From solipsis at pitrou.net Fri Mar 1 06:00:48 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 01 Mar 2013 06:00:48 +0100 Subject: [Python-checkins] Daily reference leaks (637c2cd716d1): sum=6 Message-ID: results for 637c2cd716d1 on branch "default" -------------------------------------------- test_site leaked [0, 2, 0] references, sum=2 test_site leaked [0, 2, 2] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogQ1wQc3', '-x'] From python-checkins at python.org Fri Mar 1 09:56:54 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 1 Mar 2013 09:56:54 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzE3MDc5OiB0ZXN0?= =?utf-8?q?=5Fctypes_now_works_with_unittest_test_discovery=2E__Patch_by_Z?= =?utf-8?q?achary?= Message-ID: <3ZHPdL66gWzRhN@mail.python.org> http://hg.python.org/cpython/rev/42d4a29509c4 changeset: 82431:42d4a29509c4 branch: 3.3 parent: 82428:66d0f6ef2a7f user: Ezio Melotti date: Fri Mar 01 10:55:17 2013 +0200 summary: #17079: test_ctypes now works with unittest test discovery. Patch by Zachary Ware. files: Lib/test/test_ctypes.py | 8 ++++---- Misc/NEWS | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_ctypes.py b/Lib/test/test_ctypes.py --- a/Lib/test/test_ctypes.py +++ b/Lib/test/test_ctypes.py @@ -1,16 +1,16 @@ import unittest -from test.support import run_unittest, import_module +from test.support import import_module # Skip tests if _ctypes module was not built. import_module('_ctypes') import ctypes.test -def test_main(): +def load_tests(*args): skipped, testcases = ctypes.test.get_tests(ctypes.test, "test_*.py", verbosity=0) suites = [unittest.makeSuite(t) for t in testcases] - run_unittest(unittest.TestSuite(suites)) + return unittest.TestSuite(suites) if __name__ == "__main__": - test_main() + unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -644,6 +644,9 @@ - Issue #15539: Added regression tests for Tools/scripts/pindent.py. +- Issue #17079: test_ctypes now works with unittest test discovery. + Patch by Zachary Ware. + - Issue #17304: test_hash now works with unittest test discovery. Patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 09:56:56 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 1 Mar 2013 09:56:56 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3MDc5OiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZHPdN21l7zSLy@mail.python.org> http://hg.python.org/cpython/rev/e222f24837dd changeset: 82432:e222f24837dd parent: 82429:637c2cd716d1 parent: 82431:42d4a29509c4 user: Ezio Melotti date: Fri Mar 01 10:56:35 2013 +0200 summary: #17079: merge with 3.3. files: Lib/test/test_ctypes.py | 8 ++++---- Misc/NEWS | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_ctypes.py b/Lib/test/test_ctypes.py --- a/Lib/test/test_ctypes.py +++ b/Lib/test/test_ctypes.py @@ -1,16 +1,16 @@ import unittest -from test.support import run_unittest, import_module +from test.support import import_module # Skip tests if _ctypes module was not built. import_module('_ctypes') import ctypes.test -def test_main(): +def load_tests(*args): skipped, testcases = ctypes.test.get_tests(ctypes.test, "test_*.py", verbosity=0) suites = [unittest.makeSuite(t) for t in testcases] - run_unittest(unittest.TestSuite(suites)) + return unittest.TestSuite(suites) if __name__ == "__main__": - test_main() + unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -896,6 +896,9 @@ - Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host. +- Issue #17079: test_ctypes now works with unittest test discovery. + Patch by Zachary Ware. + - Issue #17304: test_hash now works with unittest test discovery. Patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 10:25:00 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 1 Mar 2013 10:25:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzE3MDgyOiB0ZXN0?= =?utf-8?q?=5Fdbm*_now_work_with_unittest_test_discovery=2E__Patch_by_Zach?= =?utf-8?q?ary_Ware=2E?= Message-ID: <3ZHQFm5FpbzSbQ@mail.python.org> http://hg.python.org/cpython/rev/b62317fe1a22 changeset: 82433:b62317fe1a22 branch: 3.3 parent: 82431:42d4a29509c4 user: Ezio Melotti date: Fri Mar 01 11:23:28 2013 +0200 summary: #17082: test_dbm* now work with unittest test discovery. Patch by Zachary Ware. files: Lib/test/test_dbm.py | 20 ++++++++++---------- Lib/test/test_dbm_dumb.py | 10 +--------- Lib/test/test_dbm_gnu.py | 7 ++----- Lib/test/test_dbm_ndbm.py | 5 +---- Misc/NEWS | 3 +++ 5 files changed, 17 insertions(+), 28 deletions(-) diff --git a/Lib/test/test_dbm.py b/Lib/test/test_dbm.py --- a/Lib/test/test_dbm.py +++ b/Lib/test/test_dbm.py @@ -34,7 +34,7 @@ test.support.unlink(f) -class AnyDBMTestCase(unittest.TestCase): +class AnyDBMTestCase: _dict = {'0': b'', 'a': b'Python:', 'b': b'Programming', @@ -119,10 +119,6 @@ class WhichDBTestCase(unittest.TestCase): - # Actual test methods are added to namespace after class definition. - def __init__(self, *args): - unittest.TestCase.__init__(self, *args) - def test_whichdb(self): for module in dbm_iterator(): # Check whether whichdb correctly guesses module name @@ -169,12 +165,16 @@ self.d.close() -def test_main(): - classes = [WhichDBTestCase] +def load_tests(loader, tests, pattern): + classes = [] for mod in dbm_iterator(): - classes.append(type("TestCase-" + mod.__name__, (AnyDBMTestCase,), + classes.append(type("TestCase-" + mod.__name__, + (AnyDBMTestCase, unittest.TestCase), {'module': mod})) - test.support.run_unittest(*classes) + suites = [unittest.makeSuite(c) for c in classes] + + tests.addTests(suites) + return tests if __name__ == "__main__": - test_main() + unittest.main() diff --git a/Lib/test/test_dbm_dumb.py b/Lib/test/test_dbm_dumb.py --- a/Lib/test/test_dbm_dumb.py +++ b/Lib/test/test_dbm_dumb.py @@ -29,9 +29,6 @@ '\u00fc'.encode('utf-8') : b'!', } - def __init__(self, *args): - unittest.TestCase.__init__(self, *args) - def test_dumbdbm_creation(self): f = dumbdbm.open(_fname, 'c') self.assertEqual(list(f.keys()), []) @@ -195,11 +192,6 @@ def setUp(self): _delete_files() -def test_main(): - try: - support.run_unittest(DumbDBMTestCase) - finally: - _delete_files() if __name__ == "__main__": - test_main() + unittest.main() diff --git a/Lib/test/test_dbm_gnu.py b/Lib/test/test_dbm_gnu.py --- a/Lib/test/test_dbm_gnu.py +++ b/Lib/test/test_dbm_gnu.py @@ -2,7 +2,7 @@ gdbm = support.import_module("dbm.gnu") #skip if not supported import unittest import os -from test.support import verbose, TESTFN, run_unittest, unlink +from test.support import verbose, TESTFN, unlink filename = TESTFN @@ -81,8 +81,5 @@ self.assertTrue(size1 > size2 >= size0) -def test_main(): - run_unittest(TestGdbm) - if __name__ == '__main__': - test_main() + unittest.main() diff --git a/Lib/test/test_dbm_ndbm.py b/Lib/test/test_dbm_ndbm.py --- a/Lib/test/test_dbm_ndbm.py +++ b/Lib/test/test_dbm_ndbm.py @@ -36,8 +36,5 @@ except error: self.fail() -def test_main(): - support.run_unittest(DbmTestCase) - if __name__ == '__main__': - test_main() + unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -644,6 +644,9 @@ - Issue #15539: Added regression tests for Tools/scripts/pindent.py. +- Issue #17082: test_dbm* now work with unittest test discovery. + Patch by Zachary Ware. + - Issue #17079: test_ctypes now works with unittest test discovery. Patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 10:25:02 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 1 Mar 2013 10:25:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3MDgyOiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZHQFp0pwKzSkB@mail.python.org> http://hg.python.org/cpython/rev/e35c053cc4ec changeset: 82434:e35c053cc4ec parent: 82432:e222f24837dd parent: 82433:b62317fe1a22 user: Ezio Melotti date: Fri Mar 01 11:24:42 2013 +0200 summary: #17082: merge with 3.3. files: Lib/test/test_dbm.py | 20 ++++++++++---------- Lib/test/test_dbm_dumb.py | 10 +--------- Lib/test/test_dbm_gnu.py | 7 ++----- Lib/test/test_dbm_ndbm.py | 5 +---- Misc/NEWS | 3 +++ 5 files changed, 17 insertions(+), 28 deletions(-) diff --git a/Lib/test/test_dbm.py b/Lib/test/test_dbm.py --- a/Lib/test/test_dbm.py +++ b/Lib/test/test_dbm.py @@ -34,7 +34,7 @@ test.support.unlink(f) -class AnyDBMTestCase(unittest.TestCase): +class AnyDBMTestCase: _dict = {'0': b'', 'a': b'Python:', 'b': b'Programming', @@ -119,10 +119,6 @@ class WhichDBTestCase(unittest.TestCase): - # Actual test methods are added to namespace after class definition. - def __init__(self, *args): - unittest.TestCase.__init__(self, *args) - def test_whichdb(self): for module in dbm_iterator(): # Check whether whichdb correctly guesses module name @@ -169,12 +165,16 @@ self.d.close() -def test_main(): - classes = [WhichDBTestCase] +def load_tests(loader, tests, pattern): + classes = [] for mod in dbm_iterator(): - classes.append(type("TestCase-" + mod.__name__, (AnyDBMTestCase,), + classes.append(type("TestCase-" + mod.__name__, + (AnyDBMTestCase, unittest.TestCase), {'module': mod})) - test.support.run_unittest(*classes) + suites = [unittest.makeSuite(c) for c in classes] + + tests.addTests(suites) + return tests if __name__ == "__main__": - test_main() + unittest.main() diff --git a/Lib/test/test_dbm_dumb.py b/Lib/test/test_dbm_dumb.py --- a/Lib/test/test_dbm_dumb.py +++ b/Lib/test/test_dbm_dumb.py @@ -29,9 +29,6 @@ '\u00fc'.encode('utf-8') : b'!', } - def __init__(self, *args): - unittest.TestCase.__init__(self, *args) - def test_dumbdbm_creation(self): f = dumbdbm.open(_fname, 'c') self.assertEqual(list(f.keys()), []) @@ -195,11 +192,6 @@ def setUp(self): _delete_files() -def test_main(): - try: - support.run_unittest(DumbDBMTestCase) - finally: - _delete_files() if __name__ == "__main__": - test_main() + unittest.main() diff --git a/Lib/test/test_dbm_gnu.py b/Lib/test/test_dbm_gnu.py --- a/Lib/test/test_dbm_gnu.py +++ b/Lib/test/test_dbm_gnu.py @@ -2,7 +2,7 @@ gdbm = support.import_module("dbm.gnu") #skip if not supported import unittest import os -from test.support import verbose, TESTFN, run_unittest, unlink +from test.support import verbose, TESTFN, unlink filename = TESTFN @@ -81,8 +81,5 @@ self.assertTrue(size1 > size2 >= size0) -def test_main(): - run_unittest(TestGdbm) - if __name__ == '__main__': - test_main() + unittest.main() diff --git a/Lib/test/test_dbm_ndbm.py b/Lib/test/test_dbm_ndbm.py --- a/Lib/test/test_dbm_ndbm.py +++ b/Lib/test/test_dbm_ndbm.py @@ -36,8 +36,5 @@ except error: self.fail() -def test_main(): - support.run_unittest(DbmTestCase) - if __name__ == '__main__': - test_main() + unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -896,6 +896,9 @@ - Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host. +- Issue #17082: test_dbm* now work with unittest test discovery. + Patch by Zachary Ware. + - Issue #17079: test_ctypes now works with unittest test discovery. Patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 12:31:20 2013 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 1 Mar 2013 12:31:20 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Regex_should_b?= =?utf-8?q?e_a_raw_string?= Message-ID: <3ZHT3X1xLRzRXb@mail.python.org> http://hg.python.org/cpython/rev/43ac02b7e322 changeset: 82435:43ac02b7e322 branch: 3.3 parent: 82433:b62317fe1a22 user: Raymond Hettinger date: Fri Mar 01 03:30:20 2013 -0800 summary: Regex should be a raw string files: Doc/library/collections.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -210,7 +210,7 @@ >>> # Find the ten most common words in Hamlet >>> import re - >>> words = re.findall('\w+', open('hamlet.txt').read().lower()) + >>> words = re.findall(r'\w+', open('hamlet.txt').read().lower()) >>> Counter(words).most_common(10) [('the', 1143), ('and', 966), ('to', 762), ('of', 669), ('i', 631), ('you', 554), ('a', 546), ('my', 514), ('hamlet', 471), ('in', 451)] -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 12:31:21 2013 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 1 Mar 2013 12:31:21 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge?= Message-ID: <3ZHT3Y4ZvHzRXb@mail.python.org> http://hg.python.org/cpython/rev/a066466fddd3 changeset: 82436:a066466fddd3 parent: 82434:e35c053cc4ec parent: 82435:43ac02b7e322 user: Raymond Hettinger date: Fri Mar 01 03:31:05 2013 -0800 summary: Merge files: Doc/library/collections.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -215,7 +215,7 @@ >>> # Find the ten most common words in Hamlet >>> import re - >>> words = re.findall('\w+', open('hamlet.txt').read().lower()) + >>> words = re.findall(r'\w+', open('hamlet.txt').read().lower()) >>> Counter(words).most_common(10) [('the', 1143), ('and', 966), ('to', 762), ('of', 669), ('i', 631), ('you', 554), ('a', 546), ('my', 514), ('hamlet', 471), ('in', 451)] -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 13:02:02 2013 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 1 Mar 2013 13:02:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogRG9uJ3QgZGVhZGxv?= =?utf-8?q?ck_on_a_reentrant_call=2E?= Message-ID: <3ZHTky0hvLzSyt@mail.python.org> http://hg.python.org/cpython/rev/1920422626a5 changeset: 82437:1920422626a5 branch: 3.3 parent: 82435:43ac02b7e322 user: Raymond Hettinger date: Fri Mar 01 03:47:57 2013 -0800 summary: Don't deadlock on a reentrant call. files: Lib/functools.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -14,9 +14,9 @@ from _functools import partial, reduce from collections import namedtuple try: - from _thread import allocate_lock as Lock + from _thread import RLock except: - from _dummy_thread import allocate_lock as Lock + from dummy_threading import RLock ################################################################################ @@ -207,7 +207,7 @@ hits = misses = currsize = 0 full = False cache_get = cache.get # bound method to lookup a key or return None - lock = Lock() # because linkedlist updates aren't threadsafe + lock = RLock() # because linkedlist updates aren't threadsafe root = [] # root of the circular doubly linked list root[:] = [root, root, None, None] # initialize by pointing to self -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 13:02:03 2013 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 1 Mar 2013 13:02:03 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge?= Message-ID: <3ZHTkz3HSgzSq3@mail.python.org> http://hg.python.org/cpython/rev/dd341e1e30a7 changeset: 82438:dd341e1e30a7 parent: 82436:a066466fddd3 parent: 82437:1920422626a5 user: Raymond Hettinger date: Fri Mar 01 03:48:30 2013 -0800 summary: Merge files: Lib/functools.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -17,9 +17,9 @@ pass from collections import namedtuple try: - from _thread import allocate_lock as Lock + from _thread import RLock except: - from _dummy_thread import allocate_lock as Lock + from dummy_threading import RLock ################################################################################ @@ -232,7 +232,7 @@ hits = misses = 0 full = False cache_get = cache.get # bound method to lookup a key or return None - lock = Lock() # because linkedlist updates aren't threadsafe + lock = RLock() # because linkedlist updates aren't threadsafe root = [] # root of the circular doubly linked list root[:] = [root, root, None, None] # initialize by pointing to self -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 13:48:09 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 1 Mar 2013 13:48:09 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=2316935=3A_unittest_now_c?= =?utf-8?q?ounts_the_module_as_skipped_if_it_raises_SkipTest=2C?= Message-ID: <3ZHVm92kBfzSwP@mail.python.org> http://hg.python.org/cpython/rev/61ce6deb4577 changeset: 82439:61ce6deb4577 user: Ezio Melotti date: Fri Mar 01 14:47:50 2013 +0200 summary: #16935: unittest now counts the module as skipped if it raises SkipTest, instead of counting it as an error. Patch by Zachary Ware. files: Doc/library/unittest.rst | 8 ++++- Lib/unittest/loader.py | 10 ++++++ Lib/unittest/test/test_discovery.py | 27 ++++++++++++++-- Misc/NEWS | 3 + 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -1493,7 +1493,9 @@ directory must be specified separately. If importing a module fails, for example due to a syntax error, then this - will be recorded as a single error and discovery will continue. + will be recorded as a single error and discovery will continue. If the + import failure is due to ``SkipTest`` being raised, it will be recorded + as a skip instead of an error. If a test package name (directory with :file:`__init__.py`) matches the pattern then the package will be checked for a ``load_tests`` @@ -1512,6 +1514,10 @@ .. versionadded:: 3.2 + .. versionchanged:: 3.4 + Modules that raise ``SkipTest`` on import are recorded as skips, not + errors. + The following attributes of a :class:`TestLoader` can be configured either by subclassing or assignment on an instance: diff --git a/Lib/unittest/loader.py b/Lib/unittest/loader.py --- a/Lib/unittest/loader.py +++ b/Lib/unittest/loader.py @@ -34,6 +34,14 @@ TestClass = type(classname, (case.TestCase,), attrs) return suiteClass((TestClass(methodname),)) +def _make_skipped_test(methodname, exception, suiteClass): + @case.skip(str(exception)) + def testSkipped(self): + pass + attrs = {methodname: testSkipped} + TestClass = type("ModuleSkipped", (case.TestCase,), attrs) + return suiteClass((TestClass(methodname),)) + def _jython_aware_splitext(path): if path.lower().endswith('$py.class'): return path[:-9] @@ -259,6 +267,8 @@ name = self._get_name_from_path(full_path) try: module = self._get_module_from_name(name) + except case.SkipTest as e: + yield _make_skipped_test(name, e, self.suiteClass) except: yield _make_failed_import_test(name, self.suiteClass) else: diff --git a/Lib/unittest/test/test_discovery.py b/Lib/unittest/test/test_discovery.py --- a/Lib/unittest/test/test_discovery.py +++ b/Lib/unittest/test/test_discovery.py @@ -184,11 +184,9 @@ self.assertEqual(_find_tests_args, [(start_dir, 'pattern')]) self.assertIn(top_level_dir, sys.path) - def test_discover_with_modules_that_fail_to_import(self): - loader = unittest.TestLoader() - + def setup_import_issue_tests(self, fakefile): listdir = os.listdir - os.listdir = lambda _: ['test_this_does_not_exist.py'] + os.listdir = lambda _: [fakefile] isfile = os.path.isfile os.path.isfile = lambda _: True orig_sys_path = sys.path[:] @@ -198,6 +196,11 @@ sys.path[:] = orig_sys_path self.addCleanup(restore) + def test_discover_with_modules_that_fail_to_import(self): + loader = unittest.TestLoader() + + self.setup_import_issue_tests('test_this_does_not_exist.py') + suite = loader.discover('.') self.assertIn(os.getcwd(), sys.path) self.assertEqual(suite.countTestCases(), 1) @@ -206,6 +209,22 @@ with self.assertRaises(ImportError): test.test_this_does_not_exist() + def test_discover_with_module_that_raises_SkipTest_on_import(self): + loader = unittest.TestLoader() + + def _get_module_from_name(name): + raise unittest.SkipTest('skipperoo') + loader._get_module_from_name = _get_module_from_name + + self.setup_import_issue_tests('test_skip_dummy.py') + + suite = loader.discover('.') + self.assertEqual(suite.countTestCases(), 1) + + result = unittest.TestResult() + suite.run(result) + self.assertEqual(len(result.skipped), 1) + def test_command_line_handling_parseArgs(self): program = TestableTestProgram() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -270,6 +270,9 @@ Library ------- +- Issue #16935: unittest now counts the module as skipped if it raises SkipTest, + instead of counting it as an error. Patch by Zachary Ware. + - Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR. - Issue #17197: profile/cProfile modules refactored so that code of run() and -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 13:54:45 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 1 Mar 2013 13:54:45 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=2316935=3A_update_test=5F?= =?utf-8?q?crypt_now_that_unittest_discover_understands_SkipTest=2E?= Message-ID: <3ZHVvn5VmQzRZL@mail.python.org> http://hg.python.org/cpython/rev/22b6b59c70e6 changeset: 82440:22b6b59c70e6 user: Ezio Melotti date: Fri Mar 01 14:53:45 2013 +0200 summary: #16935: update test_crypt now that unittest discover understands SkipTest. files: Lib/test/test_crypt.py | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_crypt.py b/Lib/test/test_crypt.py --- a/Lib/test/test_crypt.py +++ b/Lib/test/test_crypt.py @@ -1,11 +1,7 @@ from test import support import unittest -def setUpModule(): - # this import will raise unittest.SkipTest if _crypt doesn't exist, - # so it has to be done in setUpModule for test discovery to work - global crypt - crypt = support.import_module('crypt') +crypt = support.import_module('crypt') class CryptTestCase(unittest.TestCase): -- Repository URL: http://hg.python.org/cpython From ezio.melotti at gmail.com Fri Mar 1 14:22:57 2013 From: ezio.melotti at gmail.com (Ezio Melotti) Date: Fri, 1 Mar 2013 15:22:57 +0200 Subject: [Python-checkins] cpython (3.3): Don't deadlock on a reentrant call. In-Reply-To: <3ZHTky0hvLzSyt@mail.python.org> References: <3ZHTky0hvLzSyt@mail.python.org> Message-ID: Hi, On Fri, Mar 1, 2013 at 2:02 PM, raymond.hettinger wrote: > http://hg.python.org/cpython/rev/1920422626a5 > changeset: 82437:1920422626a5 > branch: 3.3 > parent: 82435:43ac02b7e322 > user: Raymond Hettinger > date: Fri Mar 01 03:47:57 2013 -0800 > summary: > Don't deadlock on a reentrant call. this seems to have broken builds without threads. After this commit I get a compile error: $ ./configure --without-threads --with-pydebug && make -j2 [...] ./python -E -S -m sysconfig --generate-posix-vars Could not find platform dependent libraries Consider setting $PYTHONHOME to [:] Could not import runpy module Exception ignored in: 'garbage collection' Traceback (most recent call last): File "/home/wolf/dev/py/py3k/Lib/runpy.py", line 16, in import imp File "/home/wolf/dev/py/py3k/Lib/imp.py", line 23, in import tokenize File "/home/wolf/dev/py/py3k/Lib/tokenize.py", line 28, in import re File "/home/wolf/dev/py/py3k/Lib/re.py", line 124, in import functools File "/home/wolf/dev/py/py3k/Lib/functools.py", line 22, in from dummy_threading import RLock File "/home/wolf/dev/py/py3k/Lib/dummy_threading.py", line 45, in import threading File "/home/wolf/dev/py/py3k/Lib/threading.py", line 6, in from time import sleep as _sleep ImportError: No module named 'time' Fatal Python error: unexpected exception during garbage collection Current thread 0x00000000: make: *** [pybuilddir.txt] Aborted (core dumped) See also: http://buildbot.python.org/all/builders/AMD64%20Fedora%20without%20threads%203.x/builds/4006 http://buildbot.python.org/all/builders/AMD64%20Fedora%20without%20threads%203.3/builds/516 (Also having tests for this change would be nice.) Best Regards, Ezio Melotti From solipsis at pitrou.net Fri Mar 1 16:21:37 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Fri, 1 Mar 2013 16:21:37 +0100 Subject: [Python-checkins] cpython (3.3): Don't deadlock on a reentrant call. References: <3ZHTky0hvLzSyt@mail.python.org> Message-ID: <20130301162137.22f80a3e@pitrou.net> Le Fri, 1 Mar 2013 15:22:57 +0200, Ezio Melotti a ?crit : > Hi, > > On Fri, Mar 1, 2013 at 2:02 PM, raymond.hettinger > wrote: > > http://hg.python.org/cpython/rev/1920422626a5 > > changeset: 82437:1920422626a5 > > branch: 3.3 > > parent: 82435:43ac02b7e322 > > user: Raymond Hettinger > > date: Fri Mar 01 03:47:57 2013 -0800 > > summary: > > Don't deadlock on a reentrant call. > > [...] > > (Also having tests for this change would be nice.) +1, we definitely need a test for this one. Regards Antoine. From python-checkins at python.org Fri Mar 1 20:01:11 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 1 Mar 2013 20:01:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzE3MzE1OiB1bmxp?= =?utf-8?q?nk_a_file_that_test=5Fposixpath_was_leaving_around=2E?= Message-ID: <3ZHg2b3BvkzRv4@mail.python.org> http://hg.python.org/cpython/rev/ed3ca7298055 changeset: 82441:ed3ca7298055 branch: 2.7 parent: 82430:6ae4938256c6 user: Ezio Melotti date: Fri Mar 01 20:56:13 2013 +0200 summary: #17315: unlink a file that test_posixpath was leaving around. files: Lib/test/test_posixpath.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -284,6 +284,7 @@ test_support.unlink(ABSTFN+"2") test_support.unlink(ABSTFN+"y") test_support.unlink(ABSTFN+"c") + test_support.unlink(ABSTFN+"a") def test_realpath_repeated_indirect_symlinks(self): # Issue #6975. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 20:01:12 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 1 Mar 2013 20:01:12 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3MzE1OiB1bmxp?= =?utf-8?q?nk_a_file_that_test=5Fposixpath_was_leaving_around=2E?= Message-ID: <3ZHg2c6CwVz7Lkc@mail.python.org> http://hg.python.org/cpython/rev/c65e98ce1a05 changeset: 82442:c65e98ce1a05 branch: 3.2 parent: 82427:52b9d5e3f026 user: Ezio Melotti date: Fri Mar 01 20:59:17 2013 +0200 summary: #17315: unlink a file that test_posixpath was leaving around. files: Lib/test/test_posixpath.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -421,6 +421,7 @@ support.unlink(ABSTFN+"2") support.unlink(ABSTFN+"y") support.unlink(ABSTFN+"c") + support.unlink(ABSTFN+"a") @unittest.skipUnless(hasattr(os, "symlink"), "Missing symlink implementation") -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 20:01:14 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 1 Mar 2013 20:01:14 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2317315=3A_merge_with_3=2E2=2E?= Message-ID: <3ZHg2f231Wz7Lkc@mail.python.org> http://hg.python.org/cpython/rev/7a2169a80f48 changeset: 82443:7a2169a80f48 branch: 3.3 parent: 82437:1920422626a5 parent: 82442:c65e98ce1a05 user: Ezio Melotti date: Fri Mar 01 21:00:05 2013 +0200 summary: #17315: merge with 3.2. files: Lib/test/test_posixpath.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -423,6 +423,7 @@ support.unlink(ABSTFN+"2") support.unlink(ABSTFN+"y") support.unlink(ABSTFN+"c") + support.unlink(ABSTFN+"a") @unittest.skipUnless(hasattr(os, "symlink"), "Missing symlink implementation") -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 20:01:15 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 1 Mar 2013 20:01:15 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3MzE1OiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZHg2g4bSWz7LmM@mail.python.org> http://hg.python.org/cpython/rev/7234370fc556 changeset: 82444:7234370fc556 parent: 82440:22b6b59c70e6 parent: 82443:7a2169a80f48 user: Ezio Melotti date: Fri Mar 01 21:00:48 2013 +0200 summary: #17315: merge with 3.3. files: Lib/test/test_posixpath.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -366,6 +366,7 @@ support.unlink(ABSTFN+"2") support.unlink(ABSTFN+"y") support.unlink(ABSTFN+"c") + support.unlink(ABSTFN+"a") @unittest.skipUnless(hasattr(os, "symlink"), "Missing symlink implementation") -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 20:10:46 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 1 Mar 2013 20:10:46 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=2317312=3A_unlink_a_file_?= =?utf-8?q?that_test=5Faifc_was_leaving_around=2E?= Message-ID: <3ZHgFf4ZCcz7Lmk@mail.python.org> http://hg.python.org/cpython/rev/10909360a11d changeset: 82445:10909360a11d user: Ezio Melotti date: Fri Mar 01 21:10:26 2013 +0200 summary: #17312: unlink a file that test_aifc was leaving around. files: Lib/test/test_aifc.py | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py --- a/Lib/test/test_aifc.py +++ b/Lib/test/test_aifc.py @@ -331,12 +331,14 @@ def test_write_aiff_by_extension(self): sampwidth = 2 - fout = self.fout = aifc.open(TESTFN + '.aiff', 'wb') + filename = TESTFN + '.aiff' + fout = self.fout = aifc.open(filename, 'wb') + self.addCleanup(unlink, filename) fout.setparams((1, sampwidth, 1, 1, b'ULAW', b'')) frames = b'\x00' * fout.getnchannels() * sampwidth fout.writeframes(frames) fout.close() - f = self.f = aifc.open(TESTFN + '.aiff', 'rb') + f = self.f = aifc.open(filename, 'rb') self.assertEqual(f.getcomptype(), b'NONE') f.close() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 20:28:42 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 1 Mar 2013 20:28:42 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fix_markup_in_?= =?utf-8?q?unittest_doc=2E?= Message-ID: <3ZHgfL5sCKzNt4@mail.python.org> http://hg.python.org/cpython/rev/2f500533e9b9 changeset: 82446:2f500533e9b9 branch: 2.7 parent: 82441:ed3ca7298055 user: Ezio Melotti date: Fri Mar 01 21:26:04 2013 +0200 summary: Fix markup in unittest doc. files: Doc/library/unittest.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -584,7 +584,7 @@ Skipping a test is simply a matter of using the :func:`skip` :term:`decorator` or one of its conditional variants. -Basic skipping looks like this: :: +Basic skipping looks like this:: class MyTestCase(unittest.TestCase): @@ -603,7 +603,7 @@ # windows specific testing code pass -This is the output of running the example above in verbose mode: :: +This is the output of running the example above in verbose mode:: test_format (__main__.MyTestCase) ... skipped 'not supported in this library version' test_nothing (__main__.MyTestCase) ... skipped 'demonstrating skipping' @@ -614,7 +614,7 @@ OK (skipped=3) -Classes can be skipped just like methods: :: +Classes can be skipped just like methods:: @unittest.skip("showing class skipping") class MySkippedTestCase(unittest.TestCase): @@ -633,7 +633,7 @@ It's easy to roll your own skipping decorators by making a decorator that calls :func:`skip` on the test when it wants it to be skipped. This decorator skips -the test unless the passed object has a certain attribute: :: +the test unless the passed object has a certain attribute:: def skipUnlessHasattr(obj, attr): if hasattr(obj, attr): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 20:28:44 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 1 Mar 2013 20:28:44 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_Fix_markup_in_?= =?utf-8?q?unittest_doc=2E?= Message-ID: <3ZHgfN1qrCzQ4R@mail.python.org> http://hg.python.org/cpython/rev/23669bea387e changeset: 82447:23669bea387e branch: 3.2 parent: 82442:c65e98ce1a05 user: Ezio Melotti date: Fri Mar 01 21:26:04 2013 +0200 summary: Fix markup in unittest doc. files: Doc/library/unittest.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -609,7 +609,7 @@ Skipping a test is simply a matter of using the :func:`skip` :term:`decorator` or one of its conditional variants. -Basic skipping looks like this: :: +Basic skipping looks like this:: class MyTestCase(unittest.TestCase): @@ -628,7 +628,7 @@ # windows specific testing code pass -This is the output of running the example above in verbose mode: :: +This is the output of running the example above in verbose mode:: test_format (__main__.MyTestCase) ... skipped 'not supported in this library version' test_nothing (__main__.MyTestCase) ... skipped 'demonstrating skipping' @@ -639,7 +639,7 @@ OK (skipped=3) -Classes can be skipped just like methods: :: +Classes can be skipped just like methods:: @unittest.skip("showing class skipping") class MySkippedTestCase(unittest.TestCase): @@ -658,7 +658,7 @@ It's easy to roll your own skipping decorators by making a decorator that calls :func:`skip` on the test when it wants it to be skipped. This decorator skips -the test unless the passed object has a certain attribute: :: +the test unless the passed object has a certain attribute:: def skipUnlessHasattr(obj, attr): if hasattr(obj, attr): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 20:28:45 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 1 Mar 2013 20:28:45 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_markup_fixes_in_unittest_doc_from_3=2E2=2E?= Message-ID: <3ZHgfP4QV3zRhf@mail.python.org> http://hg.python.org/cpython/rev/01bfd48efef5 changeset: 82448:01bfd48efef5 branch: 3.3 parent: 82443:7a2169a80f48 parent: 82447:23669bea387e user: Ezio Melotti date: Fri Mar 01 21:28:06 2013 +0200 summary: Merge markup fixes in unittest doc from 3.2. files: Doc/library/unittest.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -476,7 +476,7 @@ Skipping a test is simply a matter of using the :func:`skip` :term:`decorator` or one of its conditional variants. -Basic skipping looks like this: :: +Basic skipping looks like this:: class MyTestCase(unittest.TestCase): @@ -495,7 +495,7 @@ # windows specific testing code pass -This is the output of running the example above in verbose mode: :: +This is the output of running the example above in verbose mode:: test_format (__main__.MyTestCase) ... skipped 'not supported in this library version' test_nothing (__main__.MyTestCase) ... skipped 'demonstrating skipping' @@ -506,7 +506,7 @@ OK (skipped=3) -Classes can be skipped just like methods: :: +Classes can be skipped just like methods:: @unittest.skip("showing class skipping") class MySkippedTestCase(unittest.TestCase): @@ -525,7 +525,7 @@ It's easy to roll your own skipping decorators by making a decorator that calls :func:`skip` on the test when it wants it to be skipped. This decorator skips -the test unless the passed object has a certain attribute: :: +the test unless the passed object has a certain attribute:: def skipUnlessHasattr(obj, attr): if hasattr(obj, attr): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 20:28:46 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 1 Mar 2013 20:28:46 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_markup_fixes_in_unittest_doc_from_3=2E3=2E?= Message-ID: <3ZHgfQ72JtzRh6@mail.python.org> http://hg.python.org/cpython/rev/1bf721567067 changeset: 82449:1bf721567067 parent: 82445:10909360a11d parent: 82448:01bfd48efef5 user: Ezio Melotti date: Fri Mar 01 21:28:23 2013 +0200 summary: Merge markup fixes in unittest doc from 3.3. files: Doc/library/unittest.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -476,7 +476,7 @@ Skipping a test is simply a matter of using the :func:`skip` :term:`decorator` or one of its conditional variants. -Basic skipping looks like this: :: +Basic skipping looks like this:: class MyTestCase(unittest.TestCase): @@ -495,7 +495,7 @@ # windows specific testing code pass -This is the output of running the example above in verbose mode: :: +This is the output of running the example above in verbose mode:: test_format (__main__.MyTestCase) ... skipped 'not supported in this library version' test_nothing (__main__.MyTestCase) ... skipped 'demonstrating skipping' @@ -506,7 +506,7 @@ OK (skipped=3) -Classes can be skipped just like methods: :: +Classes can be skipped just like methods:: @unittest.skip("showing class skipping") class MySkippedTestCase(unittest.TestCase): @@ -525,7 +525,7 @@ It's easy to roll your own skipping decorators by making a decorator that calls :func:`skip` on the test when it wants it to be skipped. This decorator skips -the test unless the passed object has a certain attribute: :: +the test unless the passed object has a certain attribute:: def skipUnlessHasattr(obj, attr): if hasattr(obj, attr): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 1 23:14:33 2013 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 1 Mar 2013 23:14:33 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_a_as=5Furi=28=29_method_a?= =?utf-8?q?s_suggested_by_Charles-Fran=C3=A7ois=2C_to_return_a_file_URI=2E?= Message-ID: <3ZHlKj6Vf8z7Ljh@mail.python.org> http://hg.python.org/peps/rev/96389266e4af changeset: 4778:96389266e4af user: Antoine Pitrou date: Fri Mar 01 23:10:53 2013 +0100 summary: Add a as_uri() method as suggested by Charles-Fran?ois, to return a file URI. files: pep-0428.txt | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/pep-0428.txt b/pep-0428.txt --- a/pep-0428.txt +++ b/pep-0428.txt @@ -341,6 +341,15 @@ >>> bytes(p) b'/home/antoine/pathlib/setup.py' +To represent the path as a ``file`` URI, call the ``as_uri()`` method:: + + >>> p = PurePosixPath('/etc/passwd') + >>> p.as_uri() + 'file:///etc/passwd' + >>> p = PureNTPath('c:/Windows') + >>> p.as_uri() + 'file:///c:/Windows' + Properties ---------- -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Mar 1 23:28:11 2013 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 1 Mar 2013 23:28:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Mention_the_dedicated_branch_?= =?utf-8?q?in_the_Mercurial_repo=2E?= Message-ID: <3ZHldR3rk0zQtG@mail.python.org> http://hg.python.org/peps/rev/53a41d76241c changeset: 4779:53a41d76241c user: Antoine Pitrou date: Fri Mar 01 23:24:24 2013 +0100 summary: Mention the dedicated branch in the Mercurial repo. files: pep-0428.txt | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/pep-0428.txt b/pep-0428.txt --- a/pep-0428.txt +++ b/pep-0428.txt @@ -55,6 +55,15 @@ .. _`Unipath`: https://bitbucket.org/sluggo/unipath/overview +Implementation +============== + +The implementation of this proposal is tracked in the ``pep428`` branch +of pathlib's `Mercurial repository`_. + +.. _`Mercurial repository`: https://bitbucket.org/pitrou/pathlib/ + + Why an object-oriented API ========================== -- Repository URL: http://hg.python.org/peps From solipsis at pitrou.net Sat Mar 2 05:59:52 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 02 Mar 2013 05:59:52 +0100 Subject: [Python-checkins] Daily reference leaks (1bf721567067): sum=1 Message-ID: results for 1bf721567067 on branch "default" -------------------------------------------- test_unittest leaked [0, -1, 2] memory blocks, sum=1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogyJDDCz', '-x'] From python-checkins at python.org Sat Mar 2 08:28:00 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 2 Mar 2013 08:28:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Remove_depende?= =?utf-8?q?ncy_on_dummy=5Fthreading_=28to_solve_a_bootstrap_problem=29=2E?= Message-ID: <3ZHzcJ3fqvz7Lmc@mail.python.org> http://hg.python.org/cpython/rev/e9732c25a018 changeset: 82450:e9732c25a018 branch: 3.3 parent: 82448:01bfd48efef5 user: Raymond Hettinger date: Fri Mar 01 23:20:13 2013 -0800 summary: Remove dependency on dummy_threading (to solve a bootstrap problem). files: Lib/functools.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -16,7 +16,10 @@ try: from _thread import RLock except: - from dummy_threading import RLock + class RLock: + 'Dummy reentrant lock' + def __enter__(self): pass + def __exit__(self, exctype, excinst, exctb): pass ################################################################################ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 2 08:28:01 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 2 Mar 2013 08:28:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge?= Message-ID: <3ZHzcK6Vkyz7LnH@mail.python.org> http://hg.python.org/cpython/rev/fd9e4646bec9 changeset: 82451:fd9e4646bec9 parent: 82449:1bf721567067 parent: 82450:e9732c25a018 user: Raymond Hettinger date: Fri Mar 01 23:21:00 2013 -0800 summary: Merge files: Lib/functools.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -19,7 +19,10 @@ try: from _thread import RLock except: - from dummy_threading import RLock + class RLock: + 'Dummy reentrant lock' + def __enter__(self): pass + def __exit__(self, exctype, excinst, exctb): pass ################################################################################ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 2 08:51:55 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 2 Mar 2013 08:51:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE3MzMx?= =?utf-8?q?=3A__Use_isidentifier=28=29_instead_of_isalnum=28=29_to_check_f?= =?utf-8?q?or_valid?= Message-ID: <3ZJ07v6LQKz7Lmf@mail.python.org> http://hg.python.org/cpython/rev/80bcc98bf939 changeset: 82452:80bcc98bf939 branch: 3.3 parent: 82450:e9732c25a018 user: Raymond Hettinger date: Fri Mar 01 23:43:48 2013 -0800 summary: Issue #17331: Use isidentifier() instead of isalnum() to check for valid identifiers. files: Lib/collections/__init__.py | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -323,24 +323,19 @@ if rename: seen = set() for index, name in enumerate(field_names): - if (not all(c.isalnum() or c=='_' for c in name) + if (not name.isidentifier() or _iskeyword(name) - or not name - or name[0].isdigit() or name.startswith('_') or name in seen): field_names[index] = '_%d' % index seen.add(name) for name in [typename] + field_names: - if not all(c.isalnum() or c=='_' for c in name): - raise ValueError('Type names and field names can only contain ' - 'alphanumeric characters and underscores: %r' % name) + if not name.isidentifier(): + raise ValueError('Type names and field names must be valid ' + 'identifiers: %r' % name) if _iskeyword(name): raise ValueError('Type names and field names cannot be a ' 'keyword: %r' % name) - if name[0].isdigit(): - raise ValueError('Type names and field names cannot start with ' - 'a number: %r' % name) seen = set() for name in field_names: if name.startswith('_') and not rename: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 2 08:51:57 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 2 Mar 2013 08:51:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge?= Message-ID: <3ZJ07x20jgz7Lng@mail.python.org> http://hg.python.org/cpython/rev/96b16fe4a961 changeset: 82453:96b16fe4a961 parent: 82451:fd9e4646bec9 parent: 82452:80bcc98bf939 user: Raymond Hettinger date: Fri Mar 01 23:51:26 2013 -0800 summary: Merge files: Lib/collections/__init__.py | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -322,24 +322,19 @@ if rename: seen = set() for index, name in enumerate(field_names): - if (not all(c.isalnum() or c=='_' for c in name) + if (not name.isidentifier() or _iskeyword(name) - or not name - or name[0].isdigit() or name.startswith('_') or name in seen): field_names[index] = '_%d' % index seen.add(name) for name in [typename] + field_names: - if not all(c.isalnum() or c=='_' for c in name): - raise ValueError('Type names and field names can only contain ' - 'alphanumeric characters and underscores: %r' % name) + if not name.isidentifier(): + raise ValueError('Type names and field names must be valid ' + 'identifiers: %r' % name) if _iskeyword(name): raise ValueError('Type names and field names cannot be a ' 'keyword: %r' % name) - if name[0].isdigit(): - raise ValueError('Type names and field names cannot start with ' - 'a number: %r' % name) seen = set() for name in field_names: if name.startswith('_') and not rename: -- Repository URL: http://hg.python.org/cpython From root at python.org Sat Mar 2 12:05:23 2013 From: root at python.org (Cron Daemon) Date: Sat, 02 Mar 2013 12:05:23 +0100 Subject: [Python-checkins] Cron /home/docs/build-devguide Message-ID: abort: error: Connection timed out From python-checkins at python.org Sat Mar 2 13:33:25 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 2 Mar 2013 13:33:25 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzE3MzMzOiB0ZXN0?= =?utf-8?q?=5Fimaplib_now_works_with_unittest_test_discovery=2E__Patch_by_?= =?utf-8?q?Zachary?= Message-ID: <3ZJ6Nj60W9zRsn@mail.python.org> http://hg.python.org/cpython/rev/02bbc5375a56 changeset: 82454:02bbc5375a56 branch: 3.3 parent: 82452:80bcc98bf939 user: Ezio Melotti date: Sat Mar 02 14:25:56 2013 +0200 summary: #17333: test_imaplib now works with unittest test discovery. Patch by Zachary Ware. files: Lib/test/test_imaplib.py | 6 +++--- Misc/NEWS | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -444,7 +444,7 @@ keyfile=CERTFILE, ssl_context=self.create_ssl_context()) -def test_main(): +def load_tests(*args): tests = [TestImaplib] if support.is_resource_enabled('network'): @@ -459,9 +459,9 @@ RemoteIMAPTest, RemoteIMAP_SSLTest, RemoteIMAP_STARTTLSTest, ]) - support.run_unittest(*tests) + return unittest.TestSuite([unittest.makeSuite(test) for test in tests]) if __name__ == "__main__": support.use_resources = ['network'] - test_main() + unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -644,6 +644,9 @@ - Issue #15539: Added regression tests for Tools/scripts/pindent.py. +- Issue #17333: test_imaplib now works with unittest test discovery. + Patch by Zachary Ware. + - Issue #17082: test_dbm* now work with unittest test discovery. Patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 2 13:33:27 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 2 Mar 2013 13:33:27 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3MzMzOiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZJ6Nl1gscz7Lnp@mail.python.org> http://hg.python.org/cpython/rev/b8bafae4a15a changeset: 82455:b8bafae4a15a parent: 82453:96b16fe4a961 parent: 82454:02bbc5375a56 user: Ezio Melotti date: Sat Mar 02 14:33:05 2013 +0200 summary: #17333: merge with 3.3. files: Lib/test/test_imaplib.py | 6 +++--- Misc/NEWS | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -444,7 +444,7 @@ keyfile=CERTFILE, ssl_context=self.create_ssl_context()) -def test_main(): +def load_tests(*args): tests = [TestImaplib] if support.is_resource_enabled('network'): @@ -459,9 +459,9 @@ RemoteIMAPTest, RemoteIMAP_SSLTest, RemoteIMAP_STARTTLSTest, ]) - support.run_unittest(*tests) + return unittest.TestSuite([unittest.makeSuite(test) for test in tests]) if __name__ == "__main__": support.use_resources = ['network'] - test_main() + unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -899,6 +899,9 @@ - Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host. +- Issue #17333: test_imaplib now works with unittest test discovery. + Patch by Zachary Ware. + - Issue #17082: test_dbm* now work with unittest test discovery. Patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 2 13:48:21 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 2 Mar 2013 13:48:21 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzE3MzM0OiB0ZXN0?= =?utf-8?q?=5Findex_now_works_with_unittest_test_discovery=2E__Patch_by_Za?= =?utf-8?q?chary?= Message-ID: <3ZJ6jx13VfzRlt@mail.python.org> http://hg.python.org/cpython/rev/886df716cd09 changeset: 82456:886df716cd09 branch: 3.3 parent: 82454:02bbc5375a56 user: Ezio Melotti date: Sat Mar 02 14:47:07 2013 +0200 summary: #17334: test_index now works with unittest test discovery. Patch by Zachary Ware. files: Lib/test/test_index.py | 29 ++++++++--------------------- Misc/NEWS | 3 +++ 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/Lib/test/test_index.py b/Lib/test/test_index.py --- a/Lib/test/test_index.py +++ b/Lib/test/test_index.py @@ -56,7 +56,7 @@ self.assertRaises(TypeError, slice(self.n).indices, 0) -class SeqTestCase(unittest.TestCase): +class SeqTestCase: # This test case isn't run directly. It just defines common tests # to the different sequence types below def setUp(self): @@ -126,7 +126,7 @@ self.assertRaises(TypeError, sliceobj, self.n, self) -class ListTestCase(SeqTestCase): +class ListTestCase(SeqTestCase, unittest.TestCase): seq = [0,10,20,30,40,50] def test_setdelitem(self): @@ -182,19 +182,19 @@ return self._list[index] -class TupleTestCase(SeqTestCase): +class TupleTestCase(SeqTestCase, unittest.TestCase): seq = (0,10,20,30,40,50) -class ByteArrayTestCase(SeqTestCase): +class ByteArrayTestCase(SeqTestCase, unittest.TestCase): seq = bytearray(b"this is a test") -class BytesTestCase(SeqTestCase): +class BytesTestCase(SeqTestCase, unittest.TestCase): seq = b"this is a test" -class StringTestCase(SeqTestCase): +class StringTestCase(SeqTestCase, unittest.TestCase): seq = "this is a test" -class NewSeqTestCase(SeqTestCase): +class NewSeqTestCase(SeqTestCase, unittest.TestCase): seq = NewSeq((0,10,20,30,40,50)) @@ -237,18 +237,5 @@ self.assertRaises(OverflowError, lambda: "a" * self.neg) -def test_main(): - support.run_unittest( - BaseTestCase, - ListTestCase, - TupleTestCase, - BytesTestCase, - ByteArrayTestCase, - StringTestCase, - NewSeqTestCase, - RangeTestCase, - OverflowTestCase, - ) - if __name__ == "__main__": - test_main() + unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -644,6 +644,9 @@ - Issue #15539: Added regression tests for Tools/scripts/pindent.py. +- Issue #17334: test_index now works with unittest test discovery. + Patch by Zachary Ware. + - Issue #17333: test_imaplib now works with unittest test discovery. Patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 2 13:48:22 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 2 Mar 2013 13:48:22 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3MzM0OiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZJ6jy3pvxz7LpD@mail.python.org> http://hg.python.org/cpython/rev/1c71882938eb changeset: 82457:1c71882938eb parent: 82455:b8bafae4a15a parent: 82456:886df716cd09 user: Ezio Melotti date: Sat Mar 02 14:48:01 2013 +0200 summary: #17334: merge with 3.3. files: Lib/test/test_index.py | 29 ++++++++--------------------- Misc/NEWS | 3 +++ 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/Lib/test/test_index.py b/Lib/test/test_index.py --- a/Lib/test/test_index.py +++ b/Lib/test/test_index.py @@ -56,7 +56,7 @@ self.assertRaises(TypeError, slice(self.n).indices, 0) -class SeqTestCase(unittest.TestCase): +class SeqTestCase: # This test case isn't run directly. It just defines common tests # to the different sequence types below def setUp(self): @@ -126,7 +126,7 @@ self.assertRaises(TypeError, sliceobj, self.n, self) -class ListTestCase(SeqTestCase): +class ListTestCase(SeqTestCase, unittest.TestCase): seq = [0,10,20,30,40,50] def test_setdelitem(self): @@ -182,19 +182,19 @@ return self._list[index] -class TupleTestCase(SeqTestCase): +class TupleTestCase(SeqTestCase, unittest.TestCase): seq = (0,10,20,30,40,50) -class ByteArrayTestCase(SeqTestCase): +class ByteArrayTestCase(SeqTestCase, unittest.TestCase): seq = bytearray(b"this is a test") -class BytesTestCase(SeqTestCase): +class BytesTestCase(SeqTestCase, unittest.TestCase): seq = b"this is a test" -class StringTestCase(SeqTestCase): +class StringTestCase(SeqTestCase, unittest.TestCase): seq = "this is a test" -class NewSeqTestCase(SeqTestCase): +class NewSeqTestCase(SeqTestCase, unittest.TestCase): seq = NewSeq((0,10,20,30,40,50)) @@ -237,18 +237,5 @@ self.assertRaises(OverflowError, lambda: "a" * self.neg) -def test_main(): - support.run_unittest( - BaseTestCase, - ListTestCase, - TupleTestCase, - BytesTestCase, - ByteArrayTestCase, - StringTestCase, - NewSeqTestCase, - RangeTestCase, - OverflowTestCase, - ) - if __name__ == "__main__": - test_main() + unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -899,6 +899,9 @@ - Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host. +- Issue #17334: test_index now works with unittest test discovery. + Patch by Zachary Ware. + - Issue #17333: test_imaplib now works with unittest test discovery. Patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From root at python.org Sat Mar 2 23:25:22 2013 From: root at python.org (Cron Daemon) Date: Sat, 02 Mar 2013 23:25:22 +0100 Subject: [Python-checkins] Cron /home/docs/build-devguide Message-ID: abort: error: Connection timed out From solipsis at pitrou.net Sun Mar 3 06:02:01 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 03 Mar 2013 06:02:01 +0100 Subject: [Python-checkins] Daily reference leaks (1c71882938eb): sum=-2 Message-ID: results for 1c71882938eb on branch "default" -------------------------------------------- test_concurrent_futures leaked [0, 0, -2] memory blocks, sum=-2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflognu59ci', '-x'] From python-checkins at python.org Sun Mar 3 12:13:48 2013 From: python-checkins at python.org (mark.dickinson) Date: Sun, 3 Mar 2013 12:13:48 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE2NDQ1?= =?utf-8?q?=3A_Fix_potential_segmentation_fault_when_deleting_an_exception?= Message-ID: <3ZJhZN66hMzRwv@mail.python.org> http://hg.python.org/cpython/rev/0e41c4466d58 changeset: 82458:0e41c4466d58 branch: 2.7 parent: 82446:2f500533e9b9 user: Mark Dickinson date: Sun Mar 03 11:13:34 2013 +0000 summary: Issue #16445: Fix potential segmentation fault when deleting an exception message. files: Lib/test/test_exceptions.py | 12 ++++++++++++ Misc/NEWS | 3 +++ Objects/exceptions.c | 3 +-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -479,6 +479,18 @@ except AssertionError as e: self.assertEqual(str(e), "(3,)") + def test_bad_exception_clearing(self): + # See issue 16445: use of Py_XDECREF instead of Py_CLEAR in + # BaseException_set_message gave a possible way to segfault the + # interpreter. + class Nasty(str): + def __del__(message): + del e.message + + e = ValueError(Nasty("msg")) + e.args = () + del e.message + # Helper class used by TestSameStrAndUnicodeMsg class ExcWithOverriddenStr(Exception): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,9 @@ Core and Builtins ----------------- +- Issue #16445: Fixed potential segmentation fault when deleting an exception + message. + - Issue #17275: Corrected class name in init error messages of the C version of BufferedWriter and BufferedRandom. diff --git a/Objects/exceptions.c b/Objects/exceptions.c --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -349,8 +349,7 @@ if (PyDict_DelItemString(self->dict, "message") < 0) return -1; } - Py_XDECREF(self->message); - self->message = NULL; + Py_CLEAR(self->message); return 0; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 3 14:13:17 2013 From: python-checkins at python.org (ezio.melotti) Date: Sun, 3 Mar 2013 14:13:17 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=2317032=3A_The_=22global?= =?utf-8?q?=22_in_the_=22NameError=3A_global_name_=27x=27_is_not_defined?= =?utf-8?q?=22_error?= Message-ID: <3ZJlDF26jczQrk@mail.python.org> http://hg.python.org/cpython/rev/f1d3fbcd837d changeset: 82459:f1d3fbcd837d parent: 82457:1c71882938eb user: Ezio Melotti date: Sun Mar 03 15:12:44 2013 +0200 summary: #17032: The "global" in the "NameError: global name 'x' is not defined" error message has been removed. Patch by Ram Rachum. files: Lib/test/test_keywordonlyarg.py | 4 ++-- Misc/ACKS | 1 + Misc/NEWS | 3 +++ Python/ceval.c | 8 +++----- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_keywordonlyarg.py b/Lib/test/test_keywordonlyarg.py --- a/Lib/test/test_keywordonlyarg.py +++ b/Lib/test/test_keywordonlyarg.py @@ -182,10 +182,10 @@ with self.assertRaises(NameError) as err: def f(v=a, x=b, *, y=c, z=d): pass - self.assertEqual(str(err.exception), "global name 'b' is not defined") + self.assertEqual(str(err.exception), "name 'b' is not defined") with self.assertRaises(NameError) as err: f = lambda v=a, x=b, *, y=c, z=d: None - self.assertEqual(str(err.exception), "global name 'b' is not defined") + self.assertEqual(str(err.exception), "name 'b' is not defined") def test_main(): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -969,6 +969,7 @@ Pierre Quentel Brian Quinlan Anders Qvist +Ram Rachum J?r?me Radix Burton Radons Jeff Ramnani diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #17032: The "global" in the "NameError: global name 'x' is not defined" + error message has been removed. Patch by Ram Rachum. + - Issue #17223: array module: Fix a crasher when converting an array containing invalid characters (outside range [U+0000; U+10ffff]) to Unicode: repr(array), str(array) and array.tounicode(). Patch written by Manuel Jacob. diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -142,8 +142,6 @@ #define NAME_ERROR_MSG \ "name '%.200s' is not defined" -#define GLOBAL_NAME_ERROR_MSG \ - "global name '%.200s' is not defined" #define UNBOUNDLOCAL_ERROR_MSG \ "local variable '%.200s' referenced before assignment" #define UNBOUNDFREE_ERROR_MSG \ @@ -2140,7 +2138,7 @@ err = PyDict_DelItem(f->f_globals, name); if (err != 0) { format_exc_check_arg( - PyExc_NameError, GLOBAL_NAME_ERROR_MSG, name); + PyExc_NameError, NAME_ERROR_MSG, name); goto error; } DISPATCH(); @@ -2208,7 +2206,7 @@ if (v == NULL) { if (!PyErr_Occurred()) format_exc_check_arg(PyExc_NameError, - GLOBAL_NAME_ERROR_MSG, name); + NAME_ERROR_MSG, name); goto error; } Py_INCREF(v); @@ -2222,7 +2220,7 @@ if (PyErr_ExceptionMatches(PyExc_KeyError)) format_exc_check_arg( PyExc_NameError, - GLOBAL_NAME_ERROR_MSG, name); + NAME_ERROR_MSG, name); goto error; } } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 3 19:53:34 2013 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 3 Mar 2013 19:53:34 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE2OTYy?= =?utf-8?q?=3A_Use_getdents64_instead_of_the_obsolete_getdents_syscall_in?= Message-ID: <3ZJtmt0djQzQmx@mail.python.org> http://hg.python.org/cpython/rev/30e643e36bae changeset: 82460:30e643e36bae branch: 3.3 parent: 82456:886df716cd09 user: Gregory P. Smith date: Sun Mar 03 10:45:05 2013 -0800 summary: Issue #16962: Use getdents64 instead of the obsolete getdents syscall in the subprocess module on Linux. files: Misc/NEWS | 6 +++--- Modules/_posixsubprocess.c | 22 ++++++++-------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -191,6 +191,9 @@ Library ------- +- Issue #16962: Use getdents64 instead of the obsolete getdents syscall + in the subprocess module on Linux. + - Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR. - Issue #14720: sqlite3: Convert datetime microseconds correctly. @@ -626,9 +629,6 @@ - Issue #15906: Fix a regression in `argparse` caused by the preceding change, when ``action='append'``, ``type='str'`` and ``default=[]``. -Extension Modules ------------------ - - Issue #12268: The io module file object write methods no longer abort early when one of its write system calls is interrupted (EINTR). diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -176,17 +176,11 @@ * This structure is very old and stable: It will not change unless the kernel * chooses to break compatibility with all existing binaries. Highly Unlikely. */ -struct linux_dirent { -#if defined(__x86_64__) && defined(__ILP32__) - /* Support the wacky x32 ABI (fake 32-bit userspace speaking to x86_64 - * kernel interfaces) - https://sites.google.com/site/x32abi/ */ +struct linux_dirent64 { unsigned long long d_ino; - unsigned long long d_off; -#else - unsigned long d_ino; /* Inode number */ - unsigned long d_off; /* Offset to next linux_dirent */ -#endif + long long d_off; unsigned short d_reclen; /* Length of this linux_dirent */ + unsigned char d_type; char d_name[256]; /* Filename (null-terminated) */ }; @@ -228,16 +222,16 @@ _close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); return; } else { - char buffer[sizeof(struct linux_dirent)]; + char buffer[sizeof(struct linux_dirent64)]; int bytes; - while ((bytes = syscall(SYS_getdents, fd_dir_fd, - (struct linux_dirent *)buffer, + while ((bytes = syscall(SYS_getdents64, fd_dir_fd, + (struct linux_dirent64 *)buffer, sizeof(buffer))) > 0) { - struct linux_dirent *entry; + struct linux_dirent64 *entry; int offset; for (offset = 0; offset < bytes; offset += entry->d_reclen) { int fd; - entry = (struct linux_dirent *)(buffer + offset); + entry = (struct linux_dirent64 *)(buffer + offset); if ((fd = _pos_int_from_ascii(entry->d_name)) < 0) continue; /* Not a number. */ if (fd != fd_dir_fd && fd >= start_fd && fd < end_fd && -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 3 19:53:35 2013 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 3 Mar 2013 19:53:35 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Fixes_Issue_=2316962=3A_Use_getdents64_instead_of_the_ob?= =?utf-8?q?solete_getdents_syscall?= Message-ID: <3ZJtmv3N8RzQqb@mail.python.org> http://hg.python.org/cpython/rev/7ab1c55fcf82 changeset: 82461:7ab1c55fcf82 parent: 82459:f1d3fbcd837d parent: 82460:30e643e36bae user: Gregory P. Smith date: Sun Mar 03 10:53:27 2013 -0800 summary: Fixes Issue #16962: Use getdents64 instead of the obsolete getdents syscall in the subprocess module on Linux. files: Misc/NEWS | 3 +++ Modules/_posixsubprocess.c | 22 ++++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -273,6 +273,9 @@ Library ------- +- Issue #16962: Use getdents64 instead of the obsolete getdents syscall + in the subprocess module on Linux. + - Issue #16935: unittest now counts the module as skipped if it raises SkipTest, instead of counting it as an error. Patch by Zachary Ware. diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -176,17 +176,11 @@ * This structure is very old and stable: It will not change unless the kernel * chooses to break compatibility with all existing binaries. Highly Unlikely. */ -struct linux_dirent { -#if defined(__x86_64__) && defined(__ILP32__) - /* Support the wacky x32 ABI (fake 32-bit userspace speaking to x86_64 - * kernel interfaces) - https://sites.google.com/site/x32abi/ */ +struct linux_dirent64 { unsigned long long d_ino; - unsigned long long d_off; -#else - unsigned long d_ino; /* Inode number */ - unsigned long d_off; /* Offset to next linux_dirent */ -#endif + long long d_off; unsigned short d_reclen; /* Length of this linux_dirent */ + unsigned char d_type; char d_name[256]; /* Filename (null-terminated) */ }; @@ -228,16 +222,16 @@ _close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); return; } else { - char buffer[sizeof(struct linux_dirent)]; + char buffer[sizeof(struct linux_dirent64)]; int bytes; - while ((bytes = syscall(SYS_getdents, fd_dir_fd, - (struct linux_dirent *)buffer, + while ((bytes = syscall(SYS_getdents64, fd_dir_fd, + (struct linux_dirent64 *)buffer, sizeof(buffer))) > 0) { - struct linux_dirent *entry; + struct linux_dirent64 *entry; int offset; for (offset = 0; offset < bytes; offset += entry->d_reclen) { int fd; - entry = (struct linux_dirent *)(buffer + offset); + entry = (struct linux_dirent64 *)(buffer + offset); if ((fd = _pos_int_from_ascii(entry->d_name)) < 0) continue; /* Not a number. */ if (fd != fd_dir_fd && fd >= start_fd && fd < end_fd && -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 3 22:34:50 2013 From: python-checkins at python.org (nadeem.vawda) Date: Sun, 3 Mar 2013 22:34:50 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzODk4?= =?utf-8?q?=3A_test=5Fssl_no_longer_prints_a_spurious_stack_trace_on_Ubunt?= =?utf-8?q?u=2E?= Message-ID: <3ZJyLy61Kxz7LkY@mail.python.org> http://hg.python.org/cpython/rev/fa24c1382bd3 changeset: 82462:fa24c1382bd3 branch: 3.2 parent: 82447:23669bea387e user: Nadeem Vawda date: Sun Mar 03 22:31:21 2013 +0100 summary: Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. files: Lib/test/test_ssl.py | 8 +++++++- Misc/NEWS | 2 ++ 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -774,7 +774,13 @@ try: self.sslconn = self.server.context.wrap_socket( self.sock, server_side=True) - except ssl.SSLError as e: + except (ssl.SSLError, socket.error) as e: + # Treat ECONNRESET as though it were an SSLError - OpenSSL + # on Ubuntu abruptly closes the connection when asked to use + # an unsupported protocol. + if (not isinstance(e, ssl.SSLError) and + e.errno != errno.ECONNRESET): + raise # XXX Various errors can have happened here, for example # a mismatching protocol version, an invalid certificate, # or a low-level bug. This should be made more discriminating. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -947,6 +947,8 @@ Tests ----- +- Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. + - Issue #17249: convert a test in test_capi to use unittest and reap threads. - Issue #17041: Fix testing when Python is configured with the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 3 22:44:40 2013 From: python-checkins at python.org (nadeem.vawda) Date: Sun, 3 Mar 2013 22:44:40 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Issue_=2313898=3A_test=5Fssl_no_longer_prints_a_spurious_stack?= =?utf-8?q?_trace_on_Ubuntu=2E?= Message-ID: <3ZJyZJ5gCXzRqX@mail.python.org> http://hg.python.org/cpython/rev/77cbb3ba5d40 changeset: 82463:77cbb3ba5d40 branch: 3.3 parent: 82460:30e643e36bae parent: 82462:fa24c1382bd3 user: Nadeem Vawda date: Sun Mar 03 22:44:22 2013 +0100 summary: Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. files: Lib/test/test_ssl.py | 6 +++++- Misc/NEWS | 2 ++ 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -942,7 +942,11 @@ self.sslconn = self.server.context.wrap_socket( self.sock, server_side=True) self.server.selected_protocols.append(self.sslconn.selected_npn_protocol()) - except ssl.SSLError as e: + except (ssl.SSLError, ConnectionResetError) as e: + # We treat ConnectionResetError as though it were an + # SSLError - OpenSSL on Ubuntu abruptly closes the + # connection when asked to use an unsupported protocol. + # # XXX Various errors can have happened here, for example # a mismatching protocol version, an invalid certificate, # or a low-level bug. This should be made more discriminating. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -635,6 +635,8 @@ Tests ----- +- Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. + - Issue #17249: convert a test in test_capi to use unittest and reap threads. - Issue #17041: Fix testing when Python is configured with the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 3 22:48:37 2013 From: python-checkins at python.org (nadeem.vawda) Date: Sun, 3 Mar 2013 22:48:37 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2313898=3A_test=5Fssl_no_longer_prints_a_spurious?= =?utf-8?q?_stack_trace_on_Ubuntu=2E?= Message-ID: <3ZJyfs1DCHzQfC@mail.python.org> http://hg.python.org/cpython/rev/69f737f410f0 changeset: 82464:69f737f410f0 parent: 82461:7ab1c55fcf82 parent: 82463:77cbb3ba5d40 user: Nadeem Vawda date: Sun Mar 03 22:48:15 2013 +0100 summary: Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. files: Lib/test/test_ssl.py | 6 +++++- Misc/NEWS | 2 ++ 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -979,7 +979,11 @@ self.sslconn = self.server.context.wrap_socket( self.sock, server_side=True) self.server.selected_protocols.append(self.sslconn.selected_npn_protocol()) - except ssl.SSLError as e: + except (ssl.SSLError, ConnectionResetError) as e: + # We treat ConnectionResetError as though it were an + # SSLError - OpenSSL on Ubuntu abruptly closes the + # connection when asked to use an unsupported protocol. + # # XXX Various errors can have happened here, for example # a mismatching protocol version, an invalid certificate, # or a low-level bug. This should be made more discriminating. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -887,6 +887,8 @@ Tests ----- +- Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. + - Issue #17283: Share code between `__main__.py` and `regrtest.py` in `Lib/test`. -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Mon Mar 4 05:57:44 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 04 Mar 2013 05:57:44 +0100 Subject: [Python-checkins] Daily reference leaks (69f737f410f0): sum=3 Message-ID: results for 69f737f410f0 on branch "default" -------------------------------------------- test_support leaked [0, -1, 1] references, sum=0 test_support leaked [0, -1, 3] memory blocks, sum=2 test_concurrent_futures leaked [0, -2, 3] memory blocks, sum=1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog66f0Kd', '-x'] From python-checkins at python.org Mon Mar 4 08:21:21 2013 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 4 Mar 2013 08:21:21 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2316098=3A__Update_?= =?utf-8?q?heapq=2Ensmallest_to_use_the_same_algorithm_as_nlargest=2E?= Message-ID: <3ZKCMj0fCzzSwn@mail.python.org> http://hg.python.org/cpython/rev/362826298fdb changeset: 82465:362826298fdb user: Raymond Hettinger date: Mon Mar 04 02:20:31 2013 -0500 summary: Issue #16098: Update heapq.nsmallest to use the same algorithm as nlargest. This removes the dependency on bisect and it bring the pure Python code in-sync with the C code. files: Lib/heapq.py | 84 ++++++++++++++++++++++++++++----------- 1 files changed, 59 insertions(+), 25 deletions(-) diff --git a/Lib/heapq.py b/Lib/heapq.py --- a/Lib/heapq.py +++ b/Lib/heapq.py @@ -127,8 +127,7 @@ __all__ = ['heappush', 'heappop', 'heapify', 'heapreplace', 'merge', 'nlargest', 'nsmallest', 'heappushpop'] -from itertools import islice, repeat, count, tee, chain -import bisect +from itertools import islice, count, tee, chain def heappush(heap, item): """Push item onto heap, maintaining the heap invariant.""" @@ -180,6 +179,19 @@ for i in reversed(range(n//2)): _siftup(x, i) +def _heappushpop_max(heap, item): + """Maxheap version of a heappush followed by a heappop.""" + if heap and heap[0] > item: + item, heap[0] = heap[0], item + _siftup_max(heap, 0) + return item + +def _heapify_max(x): + """Transform list into a maxheap, in-place, in O(len(x)) time.""" + n = len(x) + for i in reversed(range(n//2)): + _siftup_max(x, i) + def nlargest(n, iterable): """Find the n largest elements in a dataset. @@ -205,30 +217,16 @@ """ if n < 0: return [] - if hasattr(iterable, '__len__') and n * 10 <= len(iterable): - # For smaller values of n, the bisect method is faster than a minheap. - # It is also memory efficient, consuming only n elements of space. - it = iter(iterable) - result = sorted(islice(it, 0, n)) - if not result: - return result - insort = bisect.insort - pop = result.pop - los = result[-1] # los --> Largest of the nsmallest - for elem in it: - if elem < los: - insort(result, elem) - pop() - los = result[-1] + it = iter(iterable) + result = list(islice(it, n)) + if not result: return result - # An alternative approach manifests the whole iterable in memory but - # saves comparisons by heapifying all at once. Also, saves time - # over bisect.insort() which has O(n) data movement time for every - # insertion. Finding the n smallest of an m length iterable requires - # O(m) + O(n log m) comparisons. - h = list(iterable) - heapify(h) - return list(map(heappop, repeat(h, min(n, len(h))))) + _heapify_max(result) + _heappushpop = _heappushpop_max + for elem in it: + _heappushpop(result, elem) + result.sort() + return result # 'heap' is a heap at all indices >= startpos, except possibly for pos. pos # is the index of a leaf with a possibly out-of-order value. Restore the @@ -306,6 +304,42 @@ heap[pos] = newitem _siftdown(heap, startpos, pos) +def _siftdown_max(heap, startpos, pos): + 'Maxheap variant of _siftdown' + newitem = heap[pos] + # Follow the path to the root, moving parents down until finding a place + # newitem fits. + while pos > startpos: + parentpos = (pos - 1) >> 1 + parent = heap[parentpos] + if newitem > parent: + heap[pos] = parent + pos = parentpos + continue + break + heap[pos] = newitem + +def _siftup_max(heap, pos): + 'Minheap variant of _siftup' + endpos = len(heap) + startpos = pos + newitem = heap[pos] + # Bubble up the larger child until hitting a leaf. + childpos = 2*pos + 1 # leftmost child position + while childpos < endpos: + # Set childpos to index of larger child. + rightpos = childpos + 1 + if rightpos < endpos and not heap[childpos] > heap[rightpos]: + childpos = rightpos + # Move the larger child up. + heap[pos] = heap[childpos] + pos = childpos + childpos = 2*pos + 1 + # The leaf at pos is empty now. Put newitem there, and bubble it up + # to its final resting place (by sifting its parents down). + heap[pos] = newitem + _siftdown_max(heap, startpos, pos) + # If available, use C implementation try: from _heapq import * -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 08:59:00 2013 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 4 Mar 2013 08:59:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Add_test_for_R?= =?utf-8?q?Lock_in_the_lru=5Fcache=28=29=2E?= Message-ID: <3ZKDC83PfZzRkL@mail.python.org> http://hg.python.org/cpython/rev/f27eaeffc4c0 changeset: 82466:f27eaeffc4c0 branch: 3.3 parent: 82463:77cbb3ba5d40 user: Raymond Hettinger date: Mon Mar 04 02:52:50 2013 -0500 summary: Add test for RLock in the lru_cache(). files: Lib/test/test_functools.py | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -777,6 +777,31 @@ self.assertEqual(square.cache_info().hits, 4) self.assertEqual(square.cache_info().misses, 4) + def test_need_for_rlock(self): + # This will deadlock on an LRU cache that uses a regular lock + + @functools.lru_cache(maxsize=10) + def test_func(x): + 'Used to demonstrate a reentrant lru_cache call within a single thread' + return x + + class DoubleEq: + 'Demonstrate a reentrant lru_cache call within a single thread' + def __init__(self, x): + self.x = x + def __hash__(self): + return self.x + def __eq__(self, other): + if self.x == 2: + test_func(DoubleEq(1)) + return self.x == other.x + + test_func(DoubleEq(1)) # Load the cache + test_func(DoubleEq(2)) # Load the cache + self.assertEqual(test_func(DoubleEq(2)), # Trigger a re-entrant __eq__ call + DoubleEq(2)) # Verify the correct return value + + def test_main(verbose=None): test_classes = ( TestPartial, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 08:59:01 2013 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 4 Mar 2013 08:59:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZKDC965wZzSl6@mail.python.org> http://hg.python.org/cpython/rev/af1961e38ccb changeset: 82467:af1961e38ccb parent: 82465:362826298fdb parent: 82466:f27eaeffc4c0 user: Raymond Hettinger date: Mon Mar 04 02:58:40 2013 -0500 summary: merge files: Lib/test/test_functools.py | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -809,6 +809,31 @@ self.assertEqual(fib.cache_info(), functools._CacheInfo(hits=0, misses=0, maxsize=None, currsize=0)) + def test_need_for_rlock(self): + # This will deadlock on an LRU cache that uses a regular lock + + @functools.lru_cache(maxsize=10) + def test_func(x): + 'Used to demonstrate a reentrant lru_cache call within a single thread' + return x + + class DoubleEq: + 'Demonstrate a reentrant lru_cache call within a single thread' + def __init__(self, x): + self.x = x + def __hash__(self): + return self.x + def __eq__(self, other): + if self.x == 2: + test_func(DoubleEq(1)) + return self.x == other.x + + test_func(DoubleEq(1)) # Load the cache + test_func(DoubleEq(2)) # Load the cache + self.assertEqual(test_func(DoubleEq(2)), # Trigger a re-entrant __eq__ call + DoubleEq(2)) # Verify the correct return value + + def test_main(verbose=None): test_classes = ( TestPartialC, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 09:54:56 2013 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 4 Mar 2013 09:54:56 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Fix_other_re-e?= =?utf-8?q?ntrancy_nits_for_the_lru=5Fcache=2E?= Message-ID: <3ZKFRh0VFZzQrN@mail.python.org> http://hg.python.org/cpython/rev/4b06fd08b78c changeset: 82468:4b06fd08b78c branch: 3.3 parent: 82466:f27eaeffc4c0 user: Raymond Hettinger date: Mon Mar 04 03:34:09 2013 -0500 summary: Fix other re-entrancy nits for the lru_cache. Keep references for oldkey and oldvalue so they can't trigger a __del__ method to reenter our thread. Move the cache[key]=link step to the end, after the link data is in a consistent state. Under exotic circumstances, the cache[key]=link step could trigger reentrancy (i.e. the key would have to have a hash exactly equal to that for another key in the cache and the key would need a __eq__ method that makes a reentrant call our cached function). files: Lib/functools.py | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -267,19 +267,23 @@ # computed result and update the count of misses. pass elif full: - # use root to store the new key and result - root[KEY] = key - root[RESULT] = result - cache[key] = root + # use the old root to store the new key and result + oldroot = root + oldroot[KEY] = key + oldroot[RESULT] = result # empty the oldest link and make it the new root - root = root[NEXT] - del cache[root[KEY]] + root = oldroot[NEXT] + oldkey = root[KEY] + oldvalue = root[RESULT] root[KEY] = root[RESULT] = None + # now update the cache dictionary for the new links + del cache[oldkey] + cache[key] = oldroot else: # put result in a new link at the front of the queue last = root[PREV] link = [last, root, key, result] - cache[key] = last[NEXT] = root[PREV] = link + last[NEXT] = root[PREV] = cache[key] = link currsize += 1 full = (currsize == maxsize) misses += 1 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 09:54:57 2013 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 4 Mar 2013 09:54:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZKFRj33TmzRvh@mail.python.org> http://hg.python.org/cpython/rev/c761011eb02c changeset: 82469:c761011eb02c parent: 82467:af1961e38ccb parent: 82468:4b06fd08b78c user: Raymond Hettinger date: Mon Mar 04 03:54:45 2013 -0500 summary: merge files: Lib/functools.py | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -291,19 +291,23 @@ # computed result and update the count of misses. pass elif full: - # use root to store the new key and result - root[KEY] = key - root[RESULT] = result - cache[key] = root + # use the old root to store the new key and result + oldroot = root + oldroot[KEY] = key + oldroot[RESULT] = result # empty the oldest link and make it the new root - root = root[NEXT] - del cache[root[KEY]] + root = oldroot[NEXT] + oldkey = root[KEY] + oldvalue = root[RESULT] root[KEY] = root[RESULT] = None + # now update the cache dictionary for the new links + del cache[oldkey] + cache[key] = oldroot else: # put result in a new link at the front of the queue last = root[PREV] link = [last, root, key, result] - cache[key] = last[NEXT] = root[PREV] = link + last[NEXT] = root[PREV] = cache[key] = link full = (len(cache) == maxsize) misses += 1 return result -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 10:20:57 2013 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 4 Mar 2013 10:20:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogQW5vdGhlciBuaXQu?= Message-ID: <3ZKG1j2YBxz7LkK@mail.python.org> http://hg.python.org/cpython/rev/052b90daf8b9 changeset: 82470:052b90daf8b9 branch: 3.3 parent: 82468:4b06fd08b78c user: Raymond Hettinger date: Mon Mar 04 04:19:09 2013 -0500 summary: Another nit. files: Lib/functools.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -285,7 +285,7 @@ link = [last, root, key, result] last[NEXT] = root[PREV] = cache[key] = link currsize += 1 - full = (currsize == maxsize) + full = (currsize >= maxsize) misses += 1 return result -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 10:20:58 2013 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 4 Mar 2013 10:20:58 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge?= Message-ID: <3ZKG1k55Qgz7Lkj@mail.python.org> http://hg.python.org/cpython/rev/244a721edf3a changeset: 82471:244a721edf3a parent: 82469:c761011eb02c parent: 82470:052b90daf8b9 user: Raymond Hettinger date: Mon Mar 04 04:20:46 2013 -0500 summary: Merge files: Lib/functools.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -308,7 +308,7 @@ last = root[PREV] link = [last, root, key, result] last[NEXT] = root[PREV] = cache[key] = link - full = (len(cache) == maxsize) + full = (len(cache) >= maxsize) misses += 1 return result -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 14:23:26 2013 From: python-checkins at python.org (ezio.melotti) Date: Mon, 4 Mar 2013 14:23:26 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3MzQ2OiBtYWtl?= =?utf-8?q?_sure_pickle_tests_are_run_against_all_protocols=2E__Initial_pa?= =?utf-8?q?tch_by?= Message-ID: <3ZKMPV6Fc5zRw4@mail.python.org> http://hg.python.org/cpython/rev/a982feb29584 changeset: 82472:a982feb29584 branch: 3.2 parent: 82462:fa24c1382bd3 user: Ezio Melotti date: Mon Mar 04 15:17:56 2013 +0200 summary: #17346: make sure pickle tests are run against all protocols. Initial patch by Marius Gedminas. files: Lib/test/pickletester.py | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -577,10 +577,10 @@ i = C() i.attr = i for proto in protocols: - s = self.dumps(i, 2) + s = self.dumps(i, proto) x = self.loads(s) self.assertEqual(dir(x), dir(i)) - self.assertTrue(x.attr is x) + self.assertIs(x.attr, x) def test_recursive_multi(self): l = [] @@ -637,13 +637,13 @@ def test_bytes(self): for proto in protocols: for s in b'', b'xyz', b'xyz'*100: - p = self.dumps(s) + p = self.dumps(s, proto) self.assertEqual(self.loads(p), s) for s in [bytes([i]) for i in range(256)]: - p = self.dumps(s) + p = self.dumps(s, proto) self.assertEqual(self.loads(p), s) for s in [bytes([i, i]) for i in range(256)]: - p = self.dumps(s) + p = self.dumps(s, proto) self.assertEqual(self.loads(p), s) def test_ints(self): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 14:23:28 2013 From: python-checkins at python.org (ezio.melotti) Date: Mon, 4 Mar 2013 14:23:28 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2317346=3A_merge_with_3=2E2=2E?= Message-ID: <3ZKMPX1jYJz7LkD@mail.python.org> http://hg.python.org/cpython/rev/796de4f7df07 changeset: 82473:796de4f7df07 branch: 3.3 parent: 82470:052b90daf8b9 parent: 82472:a982feb29584 user: Ezio Melotti date: Mon Mar 04 15:19:02 2013 +0200 summary: #17346: merge with 3.2. files: Lib/test/pickletester.py | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -578,10 +578,10 @@ i = C() i.attr = i for proto in protocols: - s = self.dumps(i, 2) + s = self.dumps(i, proto) x = self.loads(s) self.assertEqual(dir(x), dir(i)) - self.assertTrue(x.attr is x) + self.assertIs(x.attr, x) def test_recursive_multi(self): l = [] @@ -638,13 +638,13 @@ def test_bytes(self): for proto in protocols: for s in b'', b'xyz', b'xyz'*100: - p = self.dumps(s) + p = self.dumps(s, proto) self.assertEqual(self.loads(p), s) for s in [bytes([i]) for i in range(256)]: - p = self.dumps(s) + p = self.dumps(s, proto) self.assertEqual(self.loads(p), s) for s in [bytes([i, i]) for i in range(256)]: - p = self.dumps(s) + p = self.dumps(s, proto) self.assertEqual(self.loads(p), s) def test_ints(self): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 14:23:29 2013 From: python-checkins at python.org (ezio.melotti) Date: Mon, 4 Mar 2013 14:23:29 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3MzQ2OiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZKMPY4gkCzSsc@mail.python.org> http://hg.python.org/cpython/rev/5c8a5cfe25b0 changeset: 82474:5c8a5cfe25b0 parent: 82471:244a721edf3a parent: 82473:796de4f7df07 user: Ezio Melotti date: Mon Mar 04 15:21:14 2013 +0200 summary: #17346: merge with 3.3. files: Lib/test/pickletester.py | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -578,10 +578,10 @@ i = C() i.attr = i for proto in protocols: - s = self.dumps(i, 2) + s = self.dumps(i, proto) x = self.loads(s) self.assertEqual(dir(x), dir(i)) - self.assertTrue(x.attr is x) + self.assertIs(x.attr, x) def test_recursive_multi(self): l = [] @@ -638,13 +638,13 @@ def test_bytes(self): for proto in protocols: for s in b'', b'xyz', b'xyz'*100: - p = self.dumps(s) + p = self.dumps(s, proto) self.assertEqual(self.loads(p), s) for s in [bytes([i]) for i in range(256)]: - p = self.dumps(s) + p = self.dumps(s, proto) self.assertEqual(self.loads(p), s) for s in [bytes([i, i]) for i in range(256)]: - p = self.dumps(s) + p = self.dumps(s, proto) self.assertEqual(self.loads(p), s) def test_ints(self): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 14:23:31 2013 From: python-checkins at python.org (ezio.melotti) Date: Mon, 4 Mar 2013 14:23:31 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzE3MzQ2OiBtYWtl?= =?utf-8?q?_sure_pickle_tests_are_run_against_all_protocols=2E?= Message-ID: <3ZKMPb0DbdzRw4@mail.python.org> http://hg.python.org/cpython/rev/654136546895 changeset: 82475:654136546895 branch: 2.7 parent: 82458:0e41c4466d58 user: Ezio Melotti date: Mon Mar 04 15:23:12 2013 +0200 summary: #17346: make sure pickle tests are run against all protocols. files: Lib/test/pickletester.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -503,10 +503,10 @@ i = C() i.attr = i for proto in protocols: - s = self.dumps(i, 2) + s = self.dumps(i, proto) x = self.loads(s) self.assertEqual(dir(x), dir(i)) - self.assertTrue(x.attr is x) + self.assertIs(x.attr, x) def test_recursive_multi(self): l = [] -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 15:48:39 2013 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 4 Mar 2013 15:48:39 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_fix_possible_s?= =?utf-8?q?etdefault_refleak_=28closes_=2317328=29?= Message-ID: <3ZKPHq2NJDzQmx@mail.python.org> http://hg.python.org/cpython/rev/1a589001d752 changeset: 82476:1a589001d752 branch: 3.3 parent: 82473:796de4f7df07 user: Benjamin Peterson date: Mon Mar 04 09:47:50 2013 -0500 summary: fix possible setdefault refleak (closes #17328) files: Misc/NEWS | 2 ++ Objects/dictobject.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Issue #17328: Fix possible refleak in dict.setdefault. + - Issue #17223: array module: Fix a crasher when converting an array containing invalid characters (outside range [U+0000; U+10ffff]) to Unicode: repr(array), str(array) and array.tounicode(). Patch written by Manuel Jacob. diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2230,14 +2230,14 @@ return NULL; val = *value_addr; if (val == NULL) { - Py_INCREF(failobj); - Py_INCREF(key); if (mp->ma_keys->dk_usable <= 0) { /* Need to resize. */ if (insertion_resize(mp) < 0) return NULL; ep = find_empty_slot(mp, key, hash, &value_addr); } + Py_INCREF(failobj); + Py_INCREF(key); MAINTAIN_TRACKING(mp, key, failobj); ep->me_key = key; ep->me_hash = hash; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 15:48:40 2013 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 4 Mar 2013 15:48:40 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy4zICgjMTczMjgp?= Message-ID: <3ZKPHr571wzRVF@mail.python.org> http://hg.python.org/cpython/rev/fac46cf6af3f changeset: 82477:fac46cf6af3f parent: 82474:5c8a5cfe25b0 parent: 82476:1a589001d752 user: Benjamin Peterson date: Mon Mar 04 09:48:30 2013 -0500 summary: merge 3.3 (#17328) files: Misc/NEWS | 2 ++ Objects/dictobject.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,8 @@ - Issue #17032: The "global" in the "NameError: global name 'x' is not defined" error message has been removed. Patch by Ram Rachum. +- Issue #17328: Fix possible refleak in dict.setdefault. + - Issue #17223: array module: Fix a crasher when converting an array containing invalid characters (outside range [U+0000; U+10ffff]) to Unicode: repr(array), str(array) and array.tounicode(). Patch written by Manuel Jacob. diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2235,14 +2235,14 @@ return NULL; val = *value_addr; if (val == NULL) { - Py_INCREF(failobj); - Py_INCREF(key); if (mp->ma_keys->dk_usable <= 0) { /* Need to resize. */ if (insertion_resize(mp) < 0) return NULL; ep = find_empty_slot(mp, key, hash, &value_addr); } + Py_INCREF(failobj); + Py_INCREF(key); MAINTAIN_TRACKING(mp, key, failobj); ep->me_key = key; ep->me_hash = hash; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 16:55:11 2013 From: python-checkins at python.org (nick.coghlan) Date: Mon, 4 Mar 2013 16:55:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Revised_PEP_422=2C_now_with_t?= =?utf-8?q?he_namespace_setting?= Message-ID: <3ZKQmb1dcGzQK1@mail.python.org> http://hg.python.org/peps/rev/37881876ca6f changeset: 4780:37881876ca6f user: Nick Coghlan date: Tue Mar 05 01:54:19 2013 +1000 summary: Revised PEP 422, now with the namespace setting This revealed an interesting conflict between the use of __prepare__ to share a namespace between two different class instances, and the assumption in the cache invalidation for type attribute lookup thatthe class fully controls the contents of the underlying namespace. files: pep-0422.txt | 305 +++++++++++++++++++------------------- 1 files changed, 151 insertions(+), 154 deletions(-) diff --git a/pep-0422.txt b/pep-0422.txt --- a/pep-0422.txt +++ b/pep-0422.txt @@ -1,5 +1,5 @@ PEP: 422 -Title: Simple class initialisation hook +Title: Simpler customisation of class creation Version: $Revision$ Last-Modified: $Date$ Author: Nick Coghlan , @@ -9,30 +9,34 @@ Content-Type: text/x-rst Created: 5-Jun-2012 Python-Version: 3.4 -Post-History: 5-Jun-2012, 10-Feb-2012 +Post-History: 5-Jun-2012, 10-Feb-2013 Abstract ======== -In Python 2, the body of a class definition could modify the way a class -was created (or simply arrange to run other code after the class was created) -by setting the ``__metaclass__`` attribute in the class body. While doing -this implicitly from called code required the use of an implementation detail -(specifically, ``sys._getframes()``), it could also be done explicitly in a -fully supported fashion (for example, by passing ``locals()`` to a -function that calculated a suitable ``__metaclass__`` value) +Currently, customising class creation requires the use of a custom metaclass. +This custom metaclass then persists for the entire lifecycle of the class, +creating the potential for spurious metaclass conflicts. -There is currently no corresponding mechanism in Python 3 that allows the -code executed in the class body to directly influence how the class object -is created. Instead, the class creation process is fully defined by the -class header, before the class body even begins executing. +This PEP proposes to instead support a wide range of customisation +scenarios through a new ``namespace`` parameter in the class header, and +a new ``__init_class__`` hook in the class body. -This PEP proposes a mechanism that will once again allow the body of a -class definition to more directly influence the way a class is created -(albeit in a more constrained fashion), as well as replacing some current -uses of metaclasses with a simpler, easier to understand alternative. +The new mechanism is also much easier to understand and use than +implementing a custom metaclass, and thus should provide a gentler +introduction to the full power Python's metaclass machinery. +.. note:: + + This PEP, in particular the use of __prepare__ to share a single + namespace amongst multiple class objects, highlights a possible issue + with the attribute lookup caching: when the underlying mapping is updated + by other means, the attribute lookup cache is not invalidated correctly. + Since the optimisation provided by that cache is highly desirable, + some of the ideas in this PEP may need to be declared as officially + unsupported (since the observed behaviour is rather odd when the + caches get out of sync). Background ========== @@ -81,25 +85,32 @@ name had not yet been bound in the containing scope), similarly, Python 3 metaclasses cannot call methods that rely on the implicit ``__class__`` reference (as it is not populated until after the metaclass has returned -control to the class creation machiner). +control to the class creation machinery). + +Finally, when a class uses a custom metaclass, it can pose additional +challenges to the use of multiple inheritance, as a new class cannot +inherit from parent classes with unrelated metaclasses. This means that +it is impossible to add a metaclass to an already published class: such +an addition is a backwards incompatible change due to the risk of metaclass +conflicts. Proposal ======== -This PEP proposes that a mechanism be added to Python 3 that meets the -following criteria: +This PEP proposes that a new mechanism to customise class creation be +added to Python 3.4 that meets the following criteria: -1. Restores the ability for class namespaces to have some influence on the +1. Integrates nicely with class inheritance structures (including mixins and + multiple inheritance) +2. Integrates nicely with the implicit ``__class__`` reference and + zero-argument ``super()`` syntax introduced by PEP 3135 +3. Can be added to an existing base class without a significant risk of + introducing backwards compatibility problems +4. Restores the ability for class namespaces to have some influence on the class creation process (above and beyond populating the namespace itself), but potentially without the full flexibility of the Python 2 style ``__metaclass__`` hook -2. Integrates nicely with class inheritance structures (including mixins and - multiple inheritance) -3. Integrates nicely with the implicit ``__class__`` reference and - zero-argument ``super()`` syntax introduced by PEP 3135 -4. Can be added to an existing base class without a significant risk of - introducing backwards compatibility problems One mechanism that can achieve this goal is to add a new class initialisation hook, modelled directly on the existing instance @@ -110,7 +121,6 @@ class initialisation hook as follows:: class Example: - @classmethod def __init_class__(cls): # This is invoked after the class is created, but before any # explicit decorators are called @@ -121,13 +131,15 @@ If present on the created object, this new hook will be called by the class creation machinery *after* the ``__class__`` reference has been initialised. For ``types.new_class()``, it will be called as the last step before -returning the created class object. +returning the created class object. ``__init_class__`` is implicitly +converted to a class method when the class is created (prior to the hook +being invoked). If a metaclass wishes to block class initialisation for some reason, it must arrange for ``cls.__init_class__`` to trigger ``AttributeError``. Note, that when ``__init_class__`` is called, the name of the class is not -bound to the new class object yet. As a consequence, the two argument form +yet bound to the new class object. As a consequence, the two argument form of ``super()`` cannot be used to call methods (e.g., ``super(Example, cls)`` wouldn't work in the example above). However, the zero argument form of ``super()`` works as expected, since the ``__class__`` reference is already @@ -139,19 +151,31 @@ but the situation has changed sufficiently in recent years that the idea is worth reconsidering. +However, the introduction of the metaclass ``__prepare__`` method in PEP +3115 allows a further enhancement that was not possible in Python 2: this +PEP also proposes that ``type.__prepare__`` be updated to accept a +``namespace`` keyword-only argument. If present, the value provided as the +``namespace`` argument will be returned from ``type.__prepare__`` instead of +a freshly created dictionary instance. For example, the following will use +the ordered dictionary created in the header as the class namespace:: + + class OrderedExample(namespace=collections.OrderedDict()): + def __init_class__(cls): + # cls.__dict__ is still a read-only proxy to the class namespace, + # but the underlying storage is the OrderedDict instance + Key Benefits ============ -Replaces many use cases for dynamic setting of ``__metaclass__`` ------------------------------------------------------------------ +Easier use of custom namespaces for a class +------------------------------------------- -For use cases that don't involve completely replacing the defined class, -Python 2 code that dynamically set ``__metaclass__`` can now dynamically -set ``__init_class__`` instead. For more advanced use cases, introduction of -an explicit metaclass (possibly made available as a required base class) will -still be necessary in order to support Python 3. +Currently, to use a different type (such as ``collections.OrderedDict``) for +a class namespace, or to use a pre-populated namespace, it is necessary to +write and use a custom metaclass. With this PEP, using a custom namespace +becomes as simple as specifying it in the class header. Easier inheritance of definition time behaviour @@ -201,137 +225,89 @@ that use the zero argument form of ``super()``. -Alternatives -============ +Replaces many use cases for dynamic setting of ``__metaclass__`` +----------------------------------------------------------------- +For use cases that don't involve completely replacing the defined class, +Python 2 code that dynamically set ``__metaclass__`` can now dynamically +set ``__init_class__`` instead. For more advanced use cases, introduction of +an explicit metaclass (possibly made available as a required base class) will +still be necessary in order to support Python 3. -The Python 3 Status Quo + +New Ways of Using Classes +========================= + +The new ``namespace`` keyword in the class header enables a number of +interesting options for controlling the way a class is initialised, +including some aspects of the object models of both Javascript and Ruby. + +All of the examples below are actually possible today through the use of a +custom metaclass:: + + class CustomNamespace(type): + @classmethod + def __prepare__(meta, name, bases, *, namespace=None, **kwds): + parent_namespace = super().__prepare__(name, bases, **kwds) + return namespace if namespace is not None else parent_namespace + + def __new__(meta, name, bases, ns, *, namespace=None, **kwds): + return super().__new__(meta, name, bases, ns, **kwds) + + def __init__(cls, name, bases, ns, *, namespace=None, **kwds): + return super().__init__(name, bases, ns, **kwds) + +The advantage of implementing the new keyword directly in +``type.__prepare__`` is that the *only* persistent effect is +the change in the underlying storage of the class attributes. The metaclass +of the class remains unchanged, eliminating many of the drawbacks +typically associated with these kinds of customisations. + + +Order preserving classes +------------------------ + +:: + class OrderedClass(namespace=collections.OrderedDict()): + a = 1 + b = 2 + c = 3 + + +Prepopulated namespaces ----------------------- -The Python 3 status quo already offers a great deal of flexibility. For -changes which only affect a single class definition and which can be -specified at the time the code is written, then class decorators can be -used to modify a class explicitly. Class decorators largely ignore class -inheritance and can make full use of methods that rely on the ``__class__`` -reference being populated. +:: + seed_data = dict(a=1, b=2, c=3) + class PrepopulatedClass(namespace=seed_data.copy()): + pass -Using a custom metaclass provides the same level of power as it did in -Python 2. However, it's notable that, unlike class decorators, a metaclass -cannot call any methods that rely on the ``__class__`` reference, as that -reference is not populated until after the metaclass constructor returns -control to the class creation code. -One major use case for metaclasses actually closely resembles the use of -class decorators. It occurs whenever a metaclass has an implementation that -uses the following pattern:: +Cloning a prototype class +------------------------- - class Metaclass(type): - def __new__(meta, *args, **kwds): - cls = super(Metaclass, meta).__new__(meta, *args, **kwds) - # Do something with cls - return cls +:: + class NewClass(namespace=Prototype.__dict__.copy()): + pass -The key difference between this pattern and a class decorator is that it -is automatically inherited by subclasses. However, it also comes with a -major disadvantage: Python does not allow you to inherit from classes with -unrelated metaclasses. -Thus, the status quo requires that developers choose between the following -two alternatives: +Defining an extensible class +---------------------------- -* Use a class decorator, meaning that behaviour is not inherited and must be - requested explicitly on every subclass -* Use a metaclass, meaning that behaviour is inherited, but metaclass - conflicts may make integration with other libraries and frameworks more - difficult than it otherwise would be +:: + class Extensible: + namespace = locals() -If this PEP is ultimately rejected, then this is the existing design that -will remain in place by default. + class ExtendingClass(namespace=Extensible.namespace): + pass -Restoring the Python 2 metaclass hook -------------------------------------- +Rejected Design Options +======================= -One simple alternative would be to restore support for a Python 2 style -``metaclass`` hook in the class body. This would be checked after the class -body was executed, potentially overwriting the metaclass hint provided in the -class header. -The main attraction of such an approach is that it would simplify porting -Python 2 applications that make use of this hook (especially those that do -so dynamically). - -However, this approach does nothing to simplify the process of adding -*inherited* class definition time behaviour, nor does it interoperate -cleanly with the PEP 3135 ``__class__`` and ``super()`` semantics (as with -any metaclass based solution, the ``__metaclass__`` hook would have to run -before the ``__class__`` reference has been populated. - - -Dynamic class decorators ------------------------- - -The original version of this PEP was called "Dynamic class decorators" and -focused solely on a significantly more complicated proposal than that -presented in the current version. - -As with the current version, it proposed that a new step be added to the -class creation process, after the metaclass invocation to construct the -class instance and before the application of lexical decorators. However, -instead of a simple process of calling a single class method that relies -on normal inheritance mechanisms, it proposed a far more complicated -procedure that walked the class MRO looking for decorators stored in -iterable ``__decorators__`` attributes. - -Using the current version of the PEP, the scheme originally proposed could -be implemented as:: - - class DynamicDecorators(Base): - @classmethod - def __init_class__(cls): - # Process any classes later in the MRO - try: - mro_chain = super().__init_class__ - except AttributeError: - pass - else: - mro_chain() - # Process any __decorators__ attributes in the MRO - for entry in reversed(cls.mro()): - decorators = entry.__dict__.get("__decorators__", ()) - for deco in reversed(decorators): - cls = deco(cls) - -Any subclasses of ``DynamicDecorators`` would then automatically have the -contents of any ``__decorators__`` attributes processed and invoked. - -The mechanism in the current PEP is considered superior, as many issues -to do with ordering and the same decorator being invoked multiple times -just go away, as that kind of thing is taken care of through the use of an -ordinary class method invocation. - - -Automatic metaclass derivation ------------------------------- - -When no appropriate metaclass is found, it's theoretically possible to -automatically derive a metaclass for a new type based on the metaclass hint -and the metaclasses of the bases. - -While adding such a mechanism would reduce the risk of spurious metaclass -conflicts, it would do nothing to improve integration with PEP 3135, would -not help with porting Python 2 code that set ``__metaclass__`` dynamically -and would not provide a more straightforward inherited mechanism for invoking -additional operations after the class invocation is complete. - -In addition, there would still be a risk of metaclass conflicts in cases -where the base metaclasses were not written with multiple inheritance in -mind. In such situations, there's a chance of introducing latent defects -if one or more metaclasses are not invoked correctly. - - -Calling the new hook from ``type.__init__`` -------------------------------------------- +Calling ``__init_class__`` from ``type.__init__`` +------------------------------------------------- Calling the new hook automatically from ``type.__init__``, would achieve most of the goals of this PEP. However, using that approach would mean that @@ -340,11 +316,32 @@ ``super()``), and could not make use of those features themselves. +Requiring an explict decorator on ``__init_class__`` +---------------------------------------------------- + +Originally, this PEP required the explicit use of ``@classmethod`` on the +``__init_class__`` decorator. It was made implicit since there's no +sensible interpretation for leaving it out, and that case would need to be +detected anyway in order to give a useful error message. + +This decision was reinforced after noticing that the user experience of +defining ``__prepare__`` and forgetting the ``@classmethod`` method +decorator is singularly incomprehensible (particularly since PEP 3115 +documents it as an ordinary method, and the current documentation doesn't +explicitly say anything one way or the other). + + Reference Implementation ======================== -The reference implementation has been posted to the `issue tracker`_. +A reference implementation for __init_class__ has been posted to the +`issue tracker`_. It does not yet include the new ``namespace`` parameter +for ``type.__prepare__``. +TODO +==== + +* address the 5 points in http://mail.python.org/pipermail/python-dev/2013-February/123970.html References ========== -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Mon Mar 4 16:58:02 2013 From: python-checkins at python.org (nick.coghlan) Date: Mon, 4 Mar 2013 16:58:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Fix_markup?= Message-ID: <3ZKQqt35ZFzQK1@mail.python.org> http://hg.python.org/peps/rev/63b87a7d9832 changeset: 4781:63b87a7d9832 user: Nick Coghlan date: Tue Mar 05 01:57:51 2013 +1000 summary: Fix markup files: pep-0422.txt | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/pep-0422.txt b/pep-0422.txt --- a/pep-0422.txt +++ b/pep-0422.txt @@ -268,6 +268,7 @@ ------------------------ :: + class OrderedClass(namespace=collections.OrderedDict()): a = 1 b = 2 @@ -278,6 +279,7 @@ ----------------------- :: + seed_data = dict(a=1, b=2, c=3) class PrepopulatedClass(namespace=seed_data.copy()): pass @@ -287,6 +289,7 @@ ------------------------- :: + class NewClass(namespace=Prototype.__dict__.copy()): pass @@ -295,6 +298,7 @@ ---------------------------- :: + class Extensible: namespace = locals() -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Mon Mar 4 20:33:55 2013 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 4 Mar 2013 20:33:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3Mjc4?= =?utf-8?q?=3A_Fix_a_crash_in_heapq=2Eheappush=28=29_and_heapq=2Eheappop?= =?utf-8?q?=28=29_when_the_list?= Message-ID: <3ZKWcz6PrCzQvf@mail.python.org> http://hg.python.org/cpython/rev/21ded74b51fa changeset: 82478:21ded74b51fa branch: 2.7 parent: 82475:654136546895 user: Antoine Pitrou date: Mon Mar 04 20:30:01 2013 +0100 summary: Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. files: Lib/test/test_heapq.py | 26 +++++++++++++++++++ Misc/NEWS | 3 ++ Modules/_heapqmodule.c | 40 +++++++++++++++++++++++++---- 3 files changed, 63 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_heapq.py b/Lib/test/test_heapq.py --- a/Lib/test/test_heapq.py +++ b/Lib/test/test_heapq.py @@ -315,6 +315,16 @@ 'Test multiple tiers of iterators' return chain(imap(lambda x:x, R(Ig(G(seqn))))) +class SideEffectLT: + def __init__(self, value, heap): + self.value = value + self.heap = heap + + def __lt__(self, other): + self.heap[:] = [] + return self.value < other.value + + class TestErrorHandling(TestCase): module = None @@ -361,6 +371,22 @@ self.assertRaises(TypeError, f, 2, N(s)) self.assertRaises(ZeroDivisionError, f, 2, E(s)) + # Issue #17278: the heap may change size while it's being walked. + + def test_heappush_mutating_heap(self): + heap = [] + heap.extend(SideEffectLT(i, heap) for i in range(200)) + # Python version raises IndexError, C version RuntimeError + with self.assertRaises((IndexError, RuntimeError)): + self.module.heappush(heap, SideEffectLT(5, heap)) + + def test_heappop_mutating_heap(self): + heap = [] + heap.extend(SideEffectLT(i, heap) for i in range(200)) + # Python version raises IndexError, C version RuntimeError + with self.assertRaises((IndexError, RuntimeError)): + self.module.heappop(heap) + class TestErrorHandlingPython(TestErrorHandling): module = py_heapq diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -214,6 +214,9 @@ Library ------- +- Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when + the list is being resized concurrently. + - Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR. - Issue #14720: sqlite3: Convert datetime microseconds correctly. diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c --- a/Modules/_heapqmodule.c +++ b/Modules/_heapqmodule.c @@ -35,12 +35,14 @@ static int _siftdown(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos) { - PyObject *newitem, *parent; + PyObject *newitem, *parent, *olditem; int cmp; Py_ssize_t parentpos; + Py_ssize_t size; assert(PyList_Check(heap)); - if (pos >= PyList_GET_SIZE(heap)) { + size = PyList_GET_SIZE(heap); + if (pos >= size) { PyErr_SetString(PyExc_IndexError, "index out of range"); return -1; } @@ -57,12 +59,24 @@ Py_DECREF(newitem); return -1; } + if (size != PyList_GET_SIZE(heap)) { + Py_DECREF(newitem); + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } if (cmp == 0) break; Py_INCREF(parent); - Py_DECREF(PyList_GET_ITEM(heap, pos)); + olditem = PyList_GET_ITEM(heap, pos); PyList_SET_ITEM(heap, pos, parent); + Py_DECREF(olditem); pos = parentpos; + if (size != PyList_GET_SIZE(heap)) { + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } } Py_DECREF(PyList_GET_ITEM(heap, pos)); PyList_SET_ITEM(heap, pos, newitem); @@ -74,10 +88,12 @@ { Py_ssize_t startpos, endpos, childpos, rightpos; int cmp; - PyObject *newitem, *tmp; + PyObject *newitem, *tmp, *olditem; + Py_ssize_t size; assert(PyList_Check(heap)); - endpos = PyList_GET_SIZE(heap); + size = PyList_GET_SIZE(heap); + endpos = size; startpos = pos; if (pos >= endpos) { PyErr_SetString(PyExc_IndexError, "index out of range"); @@ -102,13 +118,25 @@ if (cmp == 0) childpos = rightpos; } + if (size != PyList_GET_SIZE(heap)) { + Py_DECREF(newitem); + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } /* Move the smaller child up. */ tmp = PyList_GET_ITEM(heap, childpos); Py_INCREF(tmp); - Py_DECREF(PyList_GET_ITEM(heap, pos)); + olditem = PyList_GET_ITEM(heap, pos); PyList_SET_ITEM(heap, pos, tmp); + Py_DECREF(olditem); pos = childpos; childpos = 2*pos + 1; + if (size != PyList_GET_SIZE(heap)) { + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } } /* The leaf at pos is empty now. Put newitem there, and and bubble -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 20:39:47 2013 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 4 Mar 2013 20:39:47 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3Mjc4?= =?utf-8?q?=3A_Fix_a_crash_in_heapq=2Eheappush=28=29_and_heapq=2Eheappop?= =?utf-8?q?=28=29_when_the_list?= Message-ID: <3ZKWll0ngYzRJy@mail.python.org> http://hg.python.org/cpython/rev/905b02749c26 changeset: 82479:905b02749c26 branch: 3.2 parent: 82472:a982feb29584 user: Antoine Pitrou date: Mon Mar 04 20:30:01 2013 +0100 summary: Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. files: Lib/test/test_heapq.py | 26 +++++++++++++++++++ Misc/NEWS | 3 ++ Modules/_heapqmodule.c | 40 +++++++++++++++++++++++++---- 3 files changed, 63 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_heapq.py b/Lib/test/test_heapq.py --- a/Lib/test/test_heapq.py +++ b/Lib/test/test_heapq.py @@ -319,6 +319,16 @@ return chain(map(lambda x:x, R(Ig(G(seqn))))) +class SideEffectLT: + def __init__(self, value, heap): + self.value = value + self.heap = heap + + def __lt__(self, other): + self.heap[:] = [] + return self.value < other.value + + class TestErrorHandling(TestCase): module = None @@ -370,6 +380,22 @@ self.assertRaises(TypeError, f, 2, N(s)) self.assertRaises(ZeroDivisionError, f, 2, E(s)) + # Issue #17278: the heap may change size while it's being walked. + + def test_heappush_mutating_heap(self): + heap = [] + heap.extend(SideEffectLT(i, heap) for i in range(200)) + # Python version raises IndexError, C version RuntimeError + with self.assertRaises((IndexError, RuntimeError)): + self.module.heappush(heap, SideEffectLT(5, heap)) + + def test_heappop_mutating_heap(self): + heap = [] + heap.extend(SideEffectLT(i, heap) for i in range(200)) + # Python version raises IndexError, C version RuntimeError + with self.assertRaises((IndexError, RuntimeError)): + self.module.heappop(heap) + class TestErrorHandlingPython(TestErrorHandling): module = py_heapq diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,6 +233,9 @@ Library ------- +- Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when + the list is being resized concurrently. + - Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR. - Issue #14720: sqlite3: Convert datetime microseconds correctly. diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c --- a/Modules/_heapqmodule.c +++ b/Modules/_heapqmodule.c @@ -11,12 +11,14 @@ static int _siftdown(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos) { - PyObject *newitem, *parent; + PyObject *newitem, *parent, *olditem; int cmp; Py_ssize_t parentpos; + Py_ssize_t size; assert(PyList_Check(heap)); - if (pos >= PyList_GET_SIZE(heap)) { + size = PyList_GET_SIZE(heap); + if (pos >= size) { PyErr_SetString(PyExc_IndexError, "index out of range"); return -1; } @@ -33,12 +35,24 @@ Py_DECREF(newitem); return -1; } + if (size != PyList_GET_SIZE(heap)) { + Py_DECREF(newitem); + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } if (cmp == 0) break; Py_INCREF(parent); - Py_DECREF(PyList_GET_ITEM(heap, pos)); + olditem = PyList_GET_ITEM(heap, pos); PyList_SET_ITEM(heap, pos, parent); + Py_DECREF(olditem); pos = parentpos; + if (size != PyList_GET_SIZE(heap)) { + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } } Py_DECREF(PyList_GET_ITEM(heap, pos)); PyList_SET_ITEM(heap, pos, newitem); @@ -50,10 +64,12 @@ { Py_ssize_t startpos, endpos, childpos, rightpos; int cmp; - PyObject *newitem, *tmp; + PyObject *newitem, *tmp, *olditem; + Py_ssize_t size; assert(PyList_Check(heap)); - endpos = PyList_GET_SIZE(heap); + size = PyList_GET_SIZE(heap); + endpos = size; startpos = pos; if (pos >= endpos) { PyErr_SetString(PyExc_IndexError, "index out of range"); @@ -79,13 +95,25 @@ if (cmp == 0) childpos = rightpos; } + if (size != PyList_GET_SIZE(heap)) { + Py_DECREF(newitem); + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } /* Move the smaller child up. */ tmp = PyList_GET_ITEM(heap, childpos); Py_INCREF(tmp); - Py_DECREF(PyList_GET_ITEM(heap, pos)); + olditem = PyList_GET_ITEM(heap, pos); PyList_SET_ITEM(heap, pos, tmp); + Py_DECREF(olditem); pos = childpos; childpos = 2*pos + 1; + if (size != PyList_GET_SIZE(heap)) { + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } } /* The leaf at pos is empty now. Put newitem there, and and bubble -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 20:39:48 2013 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 4 Mar 2013 20:39:48 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Issue_=2317278=3A_Fix_a_crash_in_heapq=2Eheappush=28=29_and_he?= =?utf-8?q?apq=2Eheappop=28=29_when_the_list?= Message-ID: <3ZKWlm4lqwzSc2@mail.python.org> http://hg.python.org/cpython/rev/451299b97b4f changeset: 82480:451299b97b4f branch: 3.3 parent: 82476:1a589001d752 parent: 82479:905b02749c26 user: Antoine Pitrou date: Mon Mar 04 20:33:36 2013 +0100 summary: Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. files: Lib/test/test_heapq.py | 26 +++++++++++++++++++ Misc/NEWS | 3 ++ Modules/_heapqmodule.c | 40 +++++++++++++++++++++++++---- 3 files changed, 63 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_heapq.py b/Lib/test/test_heapq.py --- a/Lib/test/test_heapq.py +++ b/Lib/test/test_heapq.py @@ -319,6 +319,16 @@ return chain(map(lambda x:x, R(Ig(G(seqn))))) +class SideEffectLT: + def __init__(self, value, heap): + self.value = value + self.heap = heap + + def __lt__(self, other): + self.heap[:] = [] + return self.value < other.value + + class TestErrorHandling: def test_non_sequence(self): @@ -369,6 +379,22 @@ self.assertRaises(TypeError, f, 2, N(s)) self.assertRaises(ZeroDivisionError, f, 2, E(s)) + # Issue #17278: the heap may change size while it's being walked. + + def test_heappush_mutating_heap(self): + heap = [] + heap.extend(SideEffectLT(i, heap) for i in range(200)) + # Python version raises IndexError, C version RuntimeError + with self.assertRaises((IndexError, RuntimeError)): + self.module.heappush(heap, SideEffectLT(5, heap)) + + def test_heappop_mutating_heap(self): + heap = [] + heap.extend(SideEffectLT(i, heap) for i in range(200)) + # Python version raises IndexError, C version RuntimeError + with self.assertRaises((IndexError, RuntimeError)): + self.module.heappop(heap) + class TestErrorHandlingPython(TestErrorHandling, TestCase): module = py_heapq diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -193,6 +193,9 @@ Library ------- +- Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when + the list is being resized concurrently. + - Issue #16962: Use getdents64 instead of the obsolete getdents syscall in the subprocess module on Linux. diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c --- a/Modules/_heapqmodule.c +++ b/Modules/_heapqmodule.c @@ -11,12 +11,14 @@ static int _siftdown(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos) { - PyObject *newitem, *parent; + PyObject *newitem, *parent, *olditem; int cmp; Py_ssize_t parentpos; + Py_ssize_t size; assert(PyList_Check(heap)); - if (pos >= PyList_GET_SIZE(heap)) { + size = PyList_GET_SIZE(heap); + if (pos >= size) { PyErr_SetString(PyExc_IndexError, "index out of range"); return -1; } @@ -33,12 +35,24 @@ Py_DECREF(newitem); return -1; } + if (size != PyList_GET_SIZE(heap)) { + Py_DECREF(newitem); + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } if (cmp == 0) break; Py_INCREF(parent); - Py_DECREF(PyList_GET_ITEM(heap, pos)); + olditem = PyList_GET_ITEM(heap, pos); PyList_SET_ITEM(heap, pos, parent); + Py_DECREF(olditem); pos = parentpos; + if (size != PyList_GET_SIZE(heap)) { + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } } Py_DECREF(PyList_GET_ITEM(heap, pos)); PyList_SET_ITEM(heap, pos, newitem); @@ -50,10 +64,12 @@ { Py_ssize_t startpos, endpos, childpos, rightpos; int cmp; - PyObject *newitem, *tmp; + PyObject *newitem, *tmp, *olditem; + Py_ssize_t size; assert(PyList_Check(heap)); - endpos = PyList_GET_SIZE(heap); + size = PyList_GET_SIZE(heap); + endpos = size; startpos = pos; if (pos >= endpos) { PyErr_SetString(PyExc_IndexError, "index out of range"); @@ -79,13 +95,25 @@ if (cmp == 0) childpos = rightpos; } + if (size != PyList_GET_SIZE(heap)) { + Py_DECREF(newitem); + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } /* Move the smaller child up. */ tmp = PyList_GET_ITEM(heap, childpos); Py_INCREF(tmp); - Py_DECREF(PyList_GET_ITEM(heap, pos)); + olditem = PyList_GET_ITEM(heap, pos); PyList_SET_ITEM(heap, pos, tmp); + Py_DECREF(olditem); pos = childpos; childpos = 2*pos + 1; + if (size != PyList_GET_SIZE(heap)) { + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } } /* The leaf at pos is empty now. Put newitem there, and and bubble -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 20:39:50 2013 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 4 Mar 2013 20:39:50 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2317278=3A_Fix_a_crash_in_heapq=2Eheappush=28=29_?= =?utf-8?q?and_heapq=2Eheappop=28=29_when_the_list?= Message-ID: <3ZKWlp25fQzSgw@mail.python.org> http://hg.python.org/cpython/rev/d57c60db94e7 changeset: 82481:d57c60db94e7 parent: 82477:fac46cf6af3f parent: 82480:451299b97b4f user: Antoine Pitrou date: Mon Mar 04 20:35:55 2013 +0100 summary: Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. files: Lib/test/test_heapq.py | 26 +++++++++++++++++++ Misc/NEWS | 3 ++ Modules/_heapqmodule.c | 40 +++++++++++++++++++++++++---- 3 files changed, 63 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_heapq.py b/Lib/test/test_heapq.py --- a/Lib/test/test_heapq.py +++ b/Lib/test/test_heapq.py @@ -319,6 +319,16 @@ return chain(map(lambda x:x, R(Ig(G(seqn))))) +class SideEffectLT: + def __init__(self, value, heap): + self.value = value + self.heap = heap + + def __lt__(self, other): + self.heap[:] = [] + return self.value < other.value + + class TestErrorHandling: def test_non_sequence(self): @@ -369,6 +379,22 @@ self.assertRaises(TypeError, f, 2, N(s)) self.assertRaises(ZeroDivisionError, f, 2, E(s)) + # Issue #17278: the heap may change size while it's being walked. + + def test_heappush_mutating_heap(self): + heap = [] + heap.extend(SideEffectLT(i, heap) for i in range(200)) + # Python version raises IndexError, C version RuntimeError + with self.assertRaises((IndexError, RuntimeError)): + self.module.heappush(heap, SideEffectLT(5, heap)) + + def test_heappop_mutating_heap(self): + heap = [] + heap.extend(SideEffectLT(i, heap) for i in range(200)) + # Python version raises IndexError, C version RuntimeError + with self.assertRaises((IndexError, RuntimeError)): + self.module.heappop(heap) + class TestErrorHandlingPython(TestErrorHandling, TestCase): module = py_heapq diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -275,6 +275,9 @@ Library ------- +- Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when + the list is being resized concurrently. + - Issue #16962: Use getdents64 instead of the obsolete getdents syscall in the subprocess module on Linux. diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c --- a/Modules/_heapqmodule.c +++ b/Modules/_heapqmodule.c @@ -11,12 +11,14 @@ static int _siftdown(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos) { - PyObject *newitem, *parent; + PyObject *newitem, *parent, *olditem; int cmp; Py_ssize_t parentpos; + Py_ssize_t size; assert(PyList_Check(heap)); - if (pos >= PyList_GET_SIZE(heap)) { + size = PyList_GET_SIZE(heap); + if (pos >= size) { PyErr_SetString(PyExc_IndexError, "index out of range"); return -1; } @@ -33,12 +35,24 @@ Py_DECREF(newitem); return -1; } + if (size != PyList_GET_SIZE(heap)) { + Py_DECREF(newitem); + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } if (cmp == 0) break; Py_INCREF(parent); - Py_DECREF(PyList_GET_ITEM(heap, pos)); + olditem = PyList_GET_ITEM(heap, pos); PyList_SET_ITEM(heap, pos, parent); + Py_DECREF(olditem); pos = parentpos; + if (size != PyList_GET_SIZE(heap)) { + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } } Py_DECREF(PyList_GET_ITEM(heap, pos)); PyList_SET_ITEM(heap, pos, newitem); @@ -50,10 +64,12 @@ { Py_ssize_t startpos, endpos, childpos, rightpos; int cmp; - PyObject *newitem, *tmp; + PyObject *newitem, *tmp, *olditem; + Py_ssize_t size; assert(PyList_Check(heap)); - endpos = PyList_GET_SIZE(heap); + size = PyList_GET_SIZE(heap); + endpos = size; startpos = pos; if (pos >= endpos) { PyErr_SetString(PyExc_IndexError, "index out of range"); @@ -79,13 +95,25 @@ if (cmp == 0) childpos = rightpos; } + if (size != PyList_GET_SIZE(heap)) { + Py_DECREF(newitem); + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } /* Move the smaller child up. */ tmp = PyList_GET_ITEM(heap, childpos); Py_INCREF(tmp); - Py_DECREF(PyList_GET_ITEM(heap, pos)); + olditem = PyList_GET_ITEM(heap, pos); PyList_SET_ITEM(heap, pos, tmp); + Py_DECREF(olditem); pos = childpos; childpos = 2*pos + 1; + if (size != PyList_GET_SIZE(heap)) { + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } } /* The leaf at pos is empty now. Put newitem there, and and bubble -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 4 23:32:04 2013 From: python-checkins at python.org (ned.deily) Date: Mon, 4 Mar 2013 23:32:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE2ODQ4?= =?utf-8?q?=3A_python-config_now_returns_proper_--ldflags_values_for_OS_X?= Message-ID: <3ZKbZX4bgzz7Lmr@mail.python.org> http://hg.python.org/cpython/rev/bab708624dc4 changeset: 82482:bab708624dc4 branch: 2.7 parent: 82478:21ded74b51fa user: Ned Deily date: Mon Mar 04 14:31:04 2013 -0800 summary: Issue #16848: python-config now returns proper --ldflags values for OS X framework builds. files: Misc/NEWS | 3 +++ Misc/python-config.in | 3 ++- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -923,6 +923,9 @@ - Issue #17161: make install now also installs a python2 and python man page. +- Issue #16848: python-config now returns proper --ldflags values for OS X + framework builds. + Tools/Demos ----------- diff --git a/Misc/python-config.in b/Misc/python-config.in --- a/Misc/python-config.in +++ b/Misc/python-config.in @@ -51,6 +51,7 @@ if opt == '--ldflags': if not getvar('Py_ENABLE_SHARED'): libs.insert(0, '-L' + getvar('LIBPL')) - libs.extend(getvar('LINKFORSHARED').split()) + if not getvar('PYTHONFRAMEWORK'): + libs.extend(getvar('LINKFORSHARED').split()) print ' '.join(libs) -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Tue Mar 5 06:00:20 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 05 Mar 2013 06:00:20 +0100 Subject: [Python-checkins] Daily reference leaks (d57c60db94e7): sum=2 Message-ID: results for d57c60db94e7 on branch "default" -------------------------------------------- test_unittest leaked [-1, 1, 2] memory blocks, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog07mUMV', '-x'] From python-checkins at python.org Tue Mar 5 07:25:30 2013 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 5 Mar 2013 07:25:30 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_LT_in_all_comparisons?= Message-ID: <3ZKp4p2DZNz7Lmt@mail.python.org> http://hg.python.org/cpython/rev/bc059a6d6939 changeset: 82483:bc059a6d6939 parent: 82481:d57c60db94e7 user: Raymond Hettinger date: Tue Mar 05 01:17:57 2013 -0500 summary: Use LT in all comparisons files: Lib/heapq.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/heapq.py b/Lib/heapq.py --- a/Lib/heapq.py +++ b/Lib/heapq.py @@ -181,7 +181,7 @@ def _heappushpop_max(heap, item): """Maxheap version of a heappush followed by a heappop.""" - if heap and heap[0] > item: + if heap and item < heap[0]: item, heap[0] = heap[0], item _siftup_max(heap, 0) return item @@ -312,7 +312,7 @@ while pos > startpos: parentpos = (pos - 1) >> 1 parent = heap[parentpos] - if newitem > parent: + if parent < newitem: heap[pos] = parent pos = parentpos continue @@ -329,7 +329,7 @@ while childpos < endpos: # Set childpos to index of larger child. rightpos = childpos + 1 - if rightpos < endpos and not heap[childpos] > heap[rightpos]: + if rightpos < endpos and not heap[rightpos] < heap[childpos]: childpos = rightpos # Move the larger child up. heap[pos] = heap[childpos] -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 07:49:57 2013 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 5 Mar 2013 07:49:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE2MDk4?= =?utf-8?q?=3A__Update_heapq=2Ensmallest_to_use_the_same_algorithm_as_nlar?= =?utf-8?q?gest=2E?= Message-ID: <3ZKpd14tBcz7Ll4@mail.python.org> http://hg.python.org/cpython/rev/de6627cf81f4 changeset: 82484:de6627cf81f4 branch: 3.3 parent: 82480:451299b97b4f user: Raymond Hettinger date: Tue Mar 05 01:36:30 2013 -0500 summary: Issue #16098: Update heapq.nsmallest to use the same algorithm as nlargest. This removes the dependency on bisect and it bring the pure Python code in-sync with the C code. files: Lib/heapq.py | 84 ++++++++++++++++++++++++++++----------- 1 files changed, 59 insertions(+), 25 deletions(-) diff --git a/Lib/heapq.py b/Lib/heapq.py --- a/Lib/heapq.py +++ b/Lib/heapq.py @@ -127,8 +127,7 @@ __all__ = ['heappush', 'heappop', 'heapify', 'heapreplace', 'merge', 'nlargest', 'nsmallest', 'heappushpop'] -from itertools import islice, repeat, count, tee, chain -import bisect +from itertools import islice, count, tee, chain def heappush(heap, item): """Push item onto heap, maintaining the heap invariant.""" @@ -180,6 +179,19 @@ for i in reversed(range(n//2)): _siftup(x, i) +def _heappushpop_max(heap, item): + """Maxheap version of a heappush followed by a heappop.""" + if heap and item < heap[0]: + item, heap[0] = heap[0], item + _siftup_max(heap, 0) + return item + +def _heapify_max(x): + """Transform list into a maxheap, in-place, in O(len(x)) time.""" + n = len(x) + for i in reversed(range(n//2)): + _siftup_max(x, i) + def nlargest(n, iterable): """Find the n largest elements in a dataset. @@ -205,30 +217,16 @@ """ if n < 0: return [] - if hasattr(iterable, '__len__') and n * 10 <= len(iterable): - # For smaller values of n, the bisect method is faster than a minheap. - # It is also memory efficient, consuming only n elements of space. - it = iter(iterable) - result = sorted(islice(it, 0, n)) - if not result: - return result - insort = bisect.insort - pop = result.pop - los = result[-1] # los --> Largest of the nsmallest - for elem in it: - if elem < los: - insort(result, elem) - pop() - los = result[-1] + it = iter(iterable) + result = list(islice(it, n)) + if not result: return result - # An alternative approach manifests the whole iterable in memory but - # saves comparisons by heapifying all at once. Also, saves time - # over bisect.insort() which has O(n) data movement time for every - # insertion. Finding the n smallest of an m length iterable requires - # O(m) + O(n log m) comparisons. - h = list(iterable) - heapify(h) - return list(map(heappop, repeat(h, min(n, len(h))))) + _heapify_max(result) + _heappushpop = _heappushpop_max + for elem in it: + _heappushpop(result, elem) + result.sort() + return result # 'heap' is a heap at all indices >= startpos, except possibly for pos. pos # is the index of a leaf with a possibly out-of-order value. Restore the @@ -306,6 +304,42 @@ heap[pos] = newitem _siftdown(heap, startpos, pos) +def _siftdown_max(heap, startpos, pos): + 'Maxheap variant of _siftdown' + newitem = heap[pos] + # Follow the path to the root, moving parents down until finding a place + # newitem fits. + while pos > startpos: + parentpos = (pos - 1) >> 1 + parent = heap[parentpos] + if parent < newitem: + heap[pos] = parent + pos = parentpos + continue + break + heap[pos] = newitem + +def _siftup_max(heap, pos): + 'Minheap variant of _siftup' + endpos = len(heap) + startpos = pos + newitem = heap[pos] + # Bubble up the larger child until hitting a leaf. + childpos = 2*pos + 1 # leftmost child position + while childpos < endpos: + # Set childpos to index of larger child. + rightpos = childpos + 1 + if rightpos < endpos and not heap[rightpos] < heap[childpos]: + childpos = rightpos + # Move the larger child up. + heap[pos] = heap[childpos] + pos = childpos + childpos = 2*pos + 1 + # The leaf at pos is empty now. Put newitem there, and bubble it up + # to its final resting place (by sifting its parents down). + heap[pos] = newitem + _siftdown_max(heap, startpos, pos) + # If available, use C implementation try: from _heapq import * -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 07:49:59 2013 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 5 Mar 2013 07:49:59 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZKpd30fNHz7Lmg@mail.python.org> http://hg.python.org/cpython/rev/f349e03bb41f changeset: 82485:f349e03bb41f parent: 82483:bc059a6d6939 parent: 82484:de6627cf81f4 user: Raymond Hettinger date: Tue Mar 05 01:37:02 2013 -0500 summary: merge files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 08:12:00 2013 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 5 Mar 2013 08:12:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Fix_typo?= Message-ID: <3ZKq6S0BH7zR11@mail.python.org> http://hg.python.org/cpython/rev/b691f25c3553 changeset: 82486:b691f25c3553 branch: 3.3 parent: 82484:de6627cf81f4 user: Raymond Hettinger date: Tue Mar 05 02:11:10 2013 -0500 summary: Fix typo files: Lib/heapq.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/heapq.py b/Lib/heapq.py --- a/Lib/heapq.py +++ b/Lib/heapq.py @@ -320,7 +320,7 @@ heap[pos] = newitem def _siftup_max(heap, pos): - 'Minheap variant of _siftup' + 'Maxheap variant of _siftup' endpos = len(heap) startpos = pos newitem = heap[pos] -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 08:12:01 2013 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 5 Mar 2013 08:12:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZKq6T34JPz7Lmy@mail.python.org> http://hg.python.org/cpython/rev/f23814bab066 changeset: 82487:f23814bab066 parent: 82485:f349e03bb41f parent: 82486:b691f25c3553 user: Raymond Hettinger date: Tue Mar 05 02:11:37 2013 -0500 summary: merge files: Lib/heapq.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/heapq.py b/Lib/heapq.py --- a/Lib/heapq.py +++ b/Lib/heapq.py @@ -320,7 +320,7 @@ heap[pos] = newitem def _siftup_max(heap, pos): - 'Minheap variant of _siftup' + 'Maxheap variant of _siftup' endpos = len(heap) startpos = pos newitem = heap[pos] -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 08:21:08 2013 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 5 Mar 2013 08:21:08 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE2MDk4?= =?utf-8?q?=3A__Update_heapq=2Ensmallest_to_use_the_same_algorithm_as_nlar?= =?utf-8?q?gest=2E?= Message-ID: <3ZKqK02LKkzT1h@mail.python.org> http://hg.python.org/cpython/rev/aa9ed98a49cb changeset: 82488:aa9ed98a49cb branch: 2.7 parent: 82430:6ae4938256c6 user: Raymond Hettinger date: Tue Mar 05 02:15:01 2013 -0500 summary: Issue #16098: Update heapq.nsmallest to use the same algorithm as nlargest. This removes the dependency on bisect and it bring the pure Python code in-sync with the C code. files: Lib/heapq.py | 84 ++++++++++++++++++++++++++++----------- 1 files changed, 59 insertions(+), 25 deletions(-) diff --git a/Lib/heapq.py b/Lib/heapq.py --- a/Lib/heapq.py +++ b/Lib/heapq.py @@ -129,9 +129,8 @@ __all__ = ['heappush', 'heappop', 'heapify', 'heapreplace', 'merge', 'nlargest', 'nsmallest', 'heappushpop'] -from itertools import islice, repeat, count, imap, izip, tee, chain +from itertools import islice, count, imap, izip, tee, chain from operator import itemgetter -import bisect def cmp_lt(x, y): # Use __lt__ if available; otherwise, try __le__. @@ -188,6 +187,19 @@ for i in reversed(xrange(n//2)): _siftup(x, i) +def _heappushpop_max(heap, item): + """Maxheap version of a heappush followed by a heappop.""" + if heap and cmp_lt(item, heap[0]): + item, heap[0] = heap[0], item + _siftup_max(heap, 0) + return item + +def _heapify_max(x): + """Transform list into a maxheap, in-place, in O(len(x)) time.""" + n = len(x) + for i in reversed(range(n//2)): + _siftup_max(x, i) + def nlargest(n, iterable): """Find the n largest elements in a dataset. @@ -213,30 +225,16 @@ """ if n < 0: return [] - if hasattr(iterable, '__len__') and n * 10 <= len(iterable): - # For smaller values of n, the bisect method is faster than a minheap. - # It is also memory efficient, consuming only n elements of space. - it = iter(iterable) - result = sorted(islice(it, 0, n)) - if not result: - return result - insort = bisect.insort - pop = result.pop - los = result[-1] # los --> Largest of the nsmallest - for elem in it: - if cmp_lt(elem, los): - insort(result, elem) - pop() - los = result[-1] + it = iter(iterable) + result = list(islice(it, n)) + if not result: return result - # An alternative approach manifests the whole iterable in memory but - # saves comparisons by heapifying all at once. Also, saves time - # over bisect.insort() which has O(n) data movement time for every - # insertion. Finding the n smallest of an m length iterable requires - # O(m) + O(n log m) comparisons. - h = list(iterable) - heapify(h) - return map(heappop, repeat(h, min(n, len(h)))) + _heapify_max(result) + _heappushpop = _heappushpop_max + for elem in it: + _heappushpop(result, elem) + result.sort() + return result # 'heap' is a heap at all indices >= startpos, except possibly for pos. pos # is the index of a leaf with a possibly out-of-order value. Restore the @@ -314,6 +312,42 @@ heap[pos] = newitem _siftdown(heap, startpos, pos) +def _siftdown_max(heap, startpos, pos): + 'Maxheap variant of _siftdown' + newitem = heap[pos] + # Follow the path to the root, moving parents down until finding a place + # newitem fits. + while pos > startpos: + parentpos = (pos - 1) >> 1 + parent = heap[parentpos] + if cmp_lt(parent, newitem): + heap[pos] = parent + pos = parentpos + continue + break + heap[pos] = newitem + +def _siftup_max(heap, pos): + 'Maxheap variant of _siftup' + endpos = len(heap) + startpos = pos + newitem = heap[pos] + # Bubble up the larger child until hitting a leaf. + childpos = 2*pos + 1 # leftmost child position + while childpos < endpos: + # Set childpos to index of larger child. + rightpos = childpos + 1 + if rightpos < endpos and not cmp_lt(heap[rightpos], heap[childpos]): + childpos = rightpos + # Move the larger child up. + heap[pos] = heap[childpos] + pos = childpos + childpos = 2*pos + 1 + # The leaf at pos is empty now. Put newitem there, and bubble it up + # to its final resting place (by sifting its parents down). + heap[pos] = newitem + _siftdown_max(heap, startpos, pos) + # If available, use C implementation try: from _heapq import * -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 08:21:09 2013 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 5 Mar 2013 08:21:09 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_merge?= Message-ID: <3ZKqK16qkKzT2C@mail.python.org> http://hg.python.org/cpython/rev/d4269f0b866a changeset: 82489:d4269f0b866a branch: 2.7 parent: 82488:aa9ed98a49cb parent: 82482:bab708624dc4 user: Raymond Hettinger date: Tue Mar 05 02:16:45 2013 -0500 summary: merge files: Doc/library/unittest.rst | 8 ++-- Lib/test/pickletester.py | 4 +- Lib/test/test_exceptions.py | 12 +++++++ Lib/test/test_heapq.py | 26 ++++++++++++++++ Lib/test/test_posixpath.py | 1 + Misc/NEWS | 9 +++++ Misc/python-config.in | 3 +- Modules/_heapqmodule.c | 40 +++++++++++++++++++++--- Objects/exceptions.c | 3 +- 9 files changed, 91 insertions(+), 15 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -584,7 +584,7 @@ Skipping a test is simply a matter of using the :func:`skip` :term:`decorator` or one of its conditional variants. -Basic skipping looks like this: :: +Basic skipping looks like this:: class MyTestCase(unittest.TestCase): @@ -603,7 +603,7 @@ # windows specific testing code pass -This is the output of running the example above in verbose mode: :: +This is the output of running the example above in verbose mode:: test_format (__main__.MyTestCase) ... skipped 'not supported in this library version' test_nothing (__main__.MyTestCase) ... skipped 'demonstrating skipping' @@ -614,7 +614,7 @@ OK (skipped=3) -Classes can be skipped just like methods: :: +Classes can be skipped just like methods:: @unittest.skip("showing class skipping") class MySkippedTestCase(unittest.TestCase): @@ -633,7 +633,7 @@ It's easy to roll your own skipping decorators by making a decorator that calls :func:`skip` on the test when it wants it to be skipped. This decorator skips -the test unless the passed object has a certain attribute: :: +the test unless the passed object has a certain attribute:: def skipUnlessHasattr(obj, attr): if hasattr(obj, attr): diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -503,10 +503,10 @@ i = C() i.attr = i for proto in protocols: - s = self.dumps(i, 2) + s = self.dumps(i, proto) x = self.loads(s) self.assertEqual(dir(x), dir(i)) - self.assertTrue(x.attr is x) + self.assertIs(x.attr, x) def test_recursive_multi(self): l = [] diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -479,6 +479,18 @@ except AssertionError as e: self.assertEqual(str(e), "(3,)") + def test_bad_exception_clearing(self): + # See issue 16445: use of Py_XDECREF instead of Py_CLEAR in + # BaseException_set_message gave a possible way to segfault the + # interpreter. + class Nasty(str): + def __del__(message): + del e.message + + e = ValueError(Nasty("msg")) + e.args = () + del e.message + # Helper class used by TestSameStrAndUnicodeMsg class ExcWithOverriddenStr(Exception): diff --git a/Lib/test/test_heapq.py b/Lib/test/test_heapq.py --- a/Lib/test/test_heapq.py +++ b/Lib/test/test_heapq.py @@ -315,6 +315,16 @@ 'Test multiple tiers of iterators' return chain(imap(lambda x:x, R(Ig(G(seqn))))) +class SideEffectLT: + def __init__(self, value, heap): + self.value = value + self.heap = heap + + def __lt__(self, other): + self.heap[:] = [] + return self.value < other.value + + class TestErrorHandling(TestCase): module = None @@ -361,6 +371,22 @@ self.assertRaises(TypeError, f, 2, N(s)) self.assertRaises(ZeroDivisionError, f, 2, E(s)) + # Issue #17278: the heap may change size while it's being walked. + + def test_heappush_mutating_heap(self): + heap = [] + heap.extend(SideEffectLT(i, heap) for i in range(200)) + # Python version raises IndexError, C version RuntimeError + with self.assertRaises((IndexError, RuntimeError)): + self.module.heappush(heap, SideEffectLT(5, heap)) + + def test_heappop_mutating_heap(self): + heap = [] + heap.extend(SideEffectLT(i, heap) for i in range(200)) + # Python version raises IndexError, C version RuntimeError + with self.assertRaises((IndexError, RuntimeError)): + self.module.heappop(heap) + class TestErrorHandlingPython(TestErrorHandling): module = py_heapq diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -284,6 +284,7 @@ test_support.unlink(ABSTFN+"2") test_support.unlink(ABSTFN+"y") test_support.unlink(ABSTFN+"c") + test_support.unlink(ABSTFN+"a") def test_realpath_repeated_indirect_symlinks(self): # Issue #6975. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,9 @@ Core and Builtins ----------------- +- Issue #16445: Fixed potential segmentation fault when deleting an exception + message. + - Issue #17275: Corrected class name in init error messages of the C version of BufferedWriter and BufferedRandom. @@ -211,6 +214,9 @@ Library ------- +- Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when + the list is being resized concurrently. + - Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR. - Issue #14720: sqlite3: Convert datetime microseconds correctly. @@ -917,6 +923,9 @@ - Issue #17161: make install now also installs a python2 and python man page. +- Issue #16848: python-config now returns proper --ldflags values for OS X + framework builds. + Tools/Demos ----------- diff --git a/Misc/python-config.in b/Misc/python-config.in --- a/Misc/python-config.in +++ b/Misc/python-config.in @@ -51,6 +51,7 @@ if opt == '--ldflags': if not getvar('Py_ENABLE_SHARED'): libs.insert(0, '-L' + getvar('LIBPL')) - libs.extend(getvar('LINKFORSHARED').split()) + if not getvar('PYTHONFRAMEWORK'): + libs.extend(getvar('LINKFORSHARED').split()) print ' '.join(libs) diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c --- a/Modules/_heapqmodule.c +++ b/Modules/_heapqmodule.c @@ -35,12 +35,14 @@ static int _siftdown(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos) { - PyObject *newitem, *parent; + PyObject *newitem, *parent, *olditem; int cmp; Py_ssize_t parentpos; + Py_ssize_t size; assert(PyList_Check(heap)); - if (pos >= PyList_GET_SIZE(heap)) { + size = PyList_GET_SIZE(heap); + if (pos >= size) { PyErr_SetString(PyExc_IndexError, "index out of range"); return -1; } @@ -57,12 +59,24 @@ Py_DECREF(newitem); return -1; } + if (size != PyList_GET_SIZE(heap)) { + Py_DECREF(newitem); + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } if (cmp == 0) break; Py_INCREF(parent); - Py_DECREF(PyList_GET_ITEM(heap, pos)); + olditem = PyList_GET_ITEM(heap, pos); PyList_SET_ITEM(heap, pos, parent); + Py_DECREF(olditem); pos = parentpos; + if (size != PyList_GET_SIZE(heap)) { + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } } Py_DECREF(PyList_GET_ITEM(heap, pos)); PyList_SET_ITEM(heap, pos, newitem); @@ -74,10 +88,12 @@ { Py_ssize_t startpos, endpos, childpos, rightpos; int cmp; - PyObject *newitem, *tmp; + PyObject *newitem, *tmp, *olditem; + Py_ssize_t size; assert(PyList_Check(heap)); - endpos = PyList_GET_SIZE(heap); + size = PyList_GET_SIZE(heap); + endpos = size; startpos = pos; if (pos >= endpos) { PyErr_SetString(PyExc_IndexError, "index out of range"); @@ -102,13 +118,25 @@ if (cmp == 0) childpos = rightpos; } + if (size != PyList_GET_SIZE(heap)) { + Py_DECREF(newitem); + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } /* Move the smaller child up. */ tmp = PyList_GET_ITEM(heap, childpos); Py_INCREF(tmp); - Py_DECREF(PyList_GET_ITEM(heap, pos)); + olditem = PyList_GET_ITEM(heap, pos); PyList_SET_ITEM(heap, pos, tmp); + Py_DECREF(olditem); pos = childpos; childpos = 2*pos + 1; + if (size != PyList_GET_SIZE(heap)) { + PyErr_SetString(PyExc_RuntimeError, + "list changed size during iteration"); + return -1; + } } /* The leaf at pos is empty now. Put newitem there, and and bubble diff --git a/Objects/exceptions.c b/Objects/exceptions.c --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -349,8 +349,7 @@ if (PyDict_DelItemString(self->dict, "message") < 0) return -1; } - Py_XDECREF(self->message); - self->message = NULL; + Py_CLEAR(self->message); return 0; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 10:24:00 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 5 Mar 2013 10:24:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogRml4IElzc3VlICMx?= =?utf-8?q?2921=3A_BaseHTTPServer=27s_send=5Ferror_should_send_the_correct?= =?utf-8?q?_error?= Message-ID: <3ZKt2m6wKzzNn1@mail.python.org> http://hg.python.org/cpython/rev/c31d700dea8b changeset: 82490:c31d700dea8b branch: 2.7 user: Senthil Kumaran date: Tue Mar 05 01:21:13 2013 -0800 summary: Fix Issue #12921: BaseHTTPServer's send_error should send the correct error response message when send_error includes a message in addition to error status. Patch contributed by Karl. files: Lib/BaseHTTPServer.py | 2 +- Misc/NEWS | 4 ++++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Lib/BaseHTTPServer.py b/Lib/BaseHTTPServer.py --- a/Lib/BaseHTTPServer.py +++ b/Lib/BaseHTTPServer.py @@ -365,7 +365,7 @@ # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201) content = (self.error_message_format % {'code': code, 'message': _quote_html(message), 'explain': explain}) - self.send_response(code, message) + self.send_response(code, short) self.send_header("Content-Type", self.error_content_type) self.send_header('Connection', 'close') self.end_headers() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -214,6 +214,10 @@ Library ------- +- Issue #12921: BaseHTTPServer's send_error should send the correct error + response message when send_error includes a message in addition to error + status. Patch submitted by Karl. + - Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 10:24:02 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 5 Mar 2013 10:24:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogRml4IElzc3VlICMx?= =?utf-8?q?2921=3A_BaseHTTPServer=27s_send=5Ferror_should_send_the_correct?= =?utf-8?q?_error?= Message-ID: <3ZKt2p2xx9z7LnZ@mail.python.org> http://hg.python.org/cpython/rev/5126e62c60af changeset: 82491:5126e62c60af branch: 3.2 parent: 82479:905b02749c26 user: Senthil Kumaran date: Tue Mar 05 01:22:57 2013 -0800 summary: Fix Issue #12921: BaseHTTPServer's send_error should send the correct error response message when send_error includes a message in addition to error status. Patch contributed by Karl. files: Lib/http/server.py | 2 +- Misc/NEWS | 4 ++++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Lib/http/server.py b/Lib/http/server.py --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -421,7 +421,7 @@ # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201) content = (self.error_message_format % {'code': code, 'message': _quote_html(message), 'explain': explain}) - self.send_response(code, message) + self.send_response(code, shortmsg) self.send_header("Content-Type", self.error_content_type) self.send_header('Connection', 'close') self.end_headers() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,6 +233,10 @@ Library ------- +- Issue #12921: BaseHTTPServer's send_error should send the correct error + response message when send_error includes a message in addition to error + status. Patch submitted by Karl. + - Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 10:24:03 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 5 Mar 2013 10:24:03 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Fix_Issue_=2312921=3A_BaseHTTPServer=27s_send=5Ferror_should_s?= =?utf-8?q?end_the_correct_error?= Message-ID: <3ZKt2q606Dz7Lt4@mail.python.org> http://hg.python.org/cpython/rev/5d76a4746d9d changeset: 82492:5d76a4746d9d branch: 3.3 parent: 82486:b691f25c3553 parent: 82491:5126e62c60af user: Senthil Kumaran date: Tue Mar 05 01:23:44 2013 -0800 summary: Fix Issue #12921: BaseHTTPServer's send_error should send the correct error response message when send_error includes a message in addition to error status. Patch contributed by Karl. files: Lib/http/server.py | 2 +- Misc/NEWS | 4 ++++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Lib/http/server.py b/Lib/http/server.py --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -425,7 +425,7 @@ # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201) content = (self.error_message_format % {'code': code, 'message': _quote_html(message), 'explain': explain}) - self.send_response(code, message) + self.send_response(code, shortmsg) self.send_header("Content-Type", self.error_content_type) self.send_header('Connection', 'close') self.end_headers() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -193,6 +193,10 @@ Library ------- +- Issue #12921: BaseHTTPServer's send_error should send the correct error + response message when send_error includes a message in addition to error + status. Patch submitted by Karl. + - Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 10:24:05 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 5 Mar 2013 10:24:05 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Fix_Issue_=2312921=3A_BaseHTTPServer=27s_send=5Ferror_sh?= =?utf-8?q?ould_send_the_correct_error?= Message-ID: <3ZKt2s1nCJz7Lt0@mail.python.org> http://hg.python.org/cpython/rev/b87792757ee8 changeset: 82493:b87792757ee8 parent: 82487:f23814bab066 parent: 82492:5d76a4746d9d user: Senthil Kumaran date: Tue Mar 05 01:26:33 2013 -0800 summary: Fix Issue #12921: BaseHTTPServer's send_error should send the correct error response message when send_error includes a message in addition to error status. Patch contributed by Karl. files: Lib/http/server.py | 2 +- Misc/NEWS | 4 ++++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Lib/http/server.py b/Lib/http/server.py --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -426,7 +426,7 @@ content = (self.error_message_format % {'code': code, 'message': _quote_html(message), 'explain': explain}) body = content.encode('UTF-8', 'replace') - self.send_response(code, message) + self.send_response(code, shortmsg) self.send_header("Content-Type", self.error_content_type) self.send_header('Connection', 'close') self.send_header('Content-Length', int(len(body))) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -275,6 +275,10 @@ Library ------- +- Issue #12921: BaseHTTPServer's send_error should send the correct error + response message when send_error includes a message in addition to error + status. Patch submitted by Karl. + - Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 11:25:48 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 5 Mar 2013 11:25:48 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Reverting_the_?= =?utf-8?q?changeset_c31d700dea8b_made_for_Issue_=2312921?= Message-ID: <3ZKvQ44dPzzSJJ@mail.python.org> http://hg.python.org/cpython/rev/4e6c46d5f77d changeset: 82494:4e6c46d5f77d branch: 2.7 parent: 82490:c31d700dea8b user: Senthil Kumaran date: Tue Mar 05 02:24:03 2013 -0800 summary: Reverting the changeset c31d700dea8b made for Issue #12921 files: Lib/BaseHTTPServer.py | 2 +- Misc/NEWS | 4 ---- 2 files changed, 1 insertions(+), 5 deletions(-) diff --git a/Lib/BaseHTTPServer.py b/Lib/BaseHTTPServer.py --- a/Lib/BaseHTTPServer.py +++ b/Lib/BaseHTTPServer.py @@ -365,7 +365,7 @@ # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201) content = (self.error_message_format % {'code': code, 'message': _quote_html(message), 'explain': explain}) - self.send_response(code, short) + self.send_response(code, message) self.send_header("Content-Type", self.error_content_type) self.send_header('Connection', 'close') self.end_headers() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -214,10 +214,6 @@ Library ------- -- Issue #12921: BaseHTTPServer's send_error should send the correct error - response message when send_error includes a message in addition to error - status. Patch submitted by Karl. - - Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 11:25:50 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 5 Mar 2013 11:25:50 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_Reverting_the_?= =?utf-8?q?changeset_5126e62c60af_made_for_Issue_=2312921?= Message-ID: <3ZKvQ619rzz7Ljk@mail.python.org> http://hg.python.org/cpython/rev/637d7c953b10 changeset: 82495:637d7c953b10 branch: 3.2 parent: 82491:5126e62c60af user: Senthil Kumaran date: Tue Mar 05 02:25:58 2013 -0800 summary: Reverting the changeset 5126e62c60af made for Issue #12921 files: Lib/http/server.py | 2 +- Misc/NEWS | 4 ---- 2 files changed, 1 insertions(+), 5 deletions(-) diff --git a/Lib/http/server.py b/Lib/http/server.py --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -421,7 +421,7 @@ # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201) content = (self.error_message_format % {'code': code, 'message': _quote_html(message), 'explain': explain}) - self.send_response(code, shortmsg) + self.send_response(code, message) self.send_header("Content-Type", self.error_content_type) self.send_header('Connection', 'close') self.end_headers() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,10 +233,6 @@ Library ------- -- Issue #12921: BaseHTTPServer's send_error should send the correct error - response message when send_error includes a message in addition to error - status. Patch submitted by Karl. - - Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 11:25:51 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 5 Mar 2013 11:25:51 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Reverting_the_changeset_5d76a4746d9d_made_for_Issue_=2312921?= Message-ID: <3ZKvQ741VgzSJJ@mail.python.org> http://hg.python.org/cpython/rev/84e7a7f6ddb8 changeset: 82496:84e7a7f6ddb8 branch: 3.3 parent: 82492:5d76a4746d9d parent: 82495:637d7c953b10 user: Senthil Kumaran date: Tue Mar 05 02:26:50 2013 -0800 summary: Reverting the changeset 5d76a4746d9d made for Issue #12921 files: Lib/http/server.py | 2 +- Misc/NEWS | 4 ---- 2 files changed, 1 insertions(+), 5 deletions(-) diff --git a/Lib/http/server.py b/Lib/http/server.py --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -425,7 +425,7 @@ # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201) content = (self.error_message_format % {'code': code, 'message': _quote_html(message), 'explain': explain}) - self.send_response(code, shortmsg) + self.send_response(code, message) self.send_header("Content-Type", self.error_content_type) self.send_header('Connection', 'close') self.end_headers() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -193,10 +193,6 @@ Library ------- -- Issue #12921: BaseHTTPServer's send_error should send the correct error - response message when send_error includes a message in addition to error - status. Patch submitted by Karl. - - Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 11:25:52 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 5 Mar 2013 11:25:52 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Reverting_the_changeset_b87792757ee8__made_for_Issue_=23?= =?utf-8?q?12921?= Message-ID: <3ZKvQ86jVbzRvY@mail.python.org> http://hg.python.org/cpython/rev/b0890674bc21 changeset: 82497:b0890674bc21 parent: 82493:b87792757ee8 parent: 82496:84e7a7f6ddb8 user: Senthil Kumaran date: Tue Mar 05 02:28:18 2013 -0800 summary: Reverting the changeset b87792757ee8 made for Issue #12921 files: Lib/http/server.py | 2 +- Misc/NEWS | 4 ---- 2 files changed, 1 insertions(+), 5 deletions(-) diff --git a/Lib/http/server.py b/Lib/http/server.py --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -426,7 +426,7 @@ content = (self.error_message_format % {'code': code, 'message': _quote_html(message), 'explain': explain}) body = content.encode('UTF-8', 'replace') - self.send_response(code, shortmsg) + self.send_response(code, message) self.send_header("Content-Type", self.error_content_type) self.send_header('Connection', 'close') self.send_header('Content-Length', int(len(body))) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -275,10 +275,6 @@ Library ------- -- Issue #12921: BaseHTTPServer's send_error should send the correct error - response message when send_error includes a message in addition to error - status. Patch submitted by Karl. - - Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 13:22:58 2013 From: python-checkins at python.org (nick.coghlan) Date: Tue, 5 Mar 2013 13:22:58 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Adjust_the_redrafted_PEP_422_?= =?utf-8?q?to_match_reality?= Message-ID: <3ZKy1G1gHxz7LkD@mail.python.org> http://hg.python.org/peps/rev/bf60a9ca80a9 changeset: 4782:bf60a9ca80a9 user: Nick Coghlan date: Tue Mar 05 22:22:20 2013 +1000 summary: Adjust the redrafted PEP 422 to match reality files: pep-0422.txt | 107 ++++++++++++++++++++++++++++---------- 1 files changed, 78 insertions(+), 29 deletions(-) diff --git a/pep-0422.txt b/pep-0422.txt --- a/pep-0422.txt +++ b/pep-0422.txt @@ -27,16 +27,6 @@ implementing a custom metaclass, and thus should provide a gentler introduction to the full power Python's metaclass machinery. -.. note:: - - This PEP, in particular the use of __prepare__ to share a single - namespace amongst multiple class objects, highlights a possible issue - with the attribute lookup caching: when the underlying mapping is updated - by other means, the attribute lookup cache is not invalidated correctly. - Since the optimisation provided by that cache is highly desirable, - some of the ideas in this PEP may need to be declared as officially - unsupported (since the observed behaviour is rather odd when the - caches get out of sync). Background ========== @@ -153,16 +143,31 @@ However, the introduction of the metaclass ``__prepare__`` method in PEP 3115 allows a further enhancement that was not possible in Python 2: this -PEP also proposes that ``type.__prepare__`` be updated to accept a -``namespace`` keyword-only argument. If present, the value provided as the -``namespace`` argument will be returned from ``type.__prepare__`` instead of -a freshly created dictionary instance. For example, the following will use +PEP also proposes that ``type.__prepare__`` be updated to accept a factory +function as a ``namespace`` keyword-only argument. If present, the value +provided as the ``namespace`` argument will be called without arguments +to create the result of ``type.__prepare__`` instead of using a freshly +created dictionary instance. For example, the following will use the ordered dictionary created in the header as the class namespace:: - class OrderedExample(namespace=collections.OrderedDict()): + class OrderedExample(namespace=collections.OrderedDict): def __init_class__(cls): # cls.__dict__ is still a read-only proxy to the class namespace, - # but the underlying storage is the OrderedDict instance + # but the underlying storage is an OrderedDict instance + +.. note:: + + This PEP, along with the existing ability to use __prepare__ to share a + single namespace amongst multiple class objects, highlights a possible + issue with the attribute lookup caching: when the underlying mapping is + updated by other means, the attribute lookup cache is not invalidated + correctly (this is a key part of the reason class ``__dict__`` attributes + produce a read-only view of the underlying storage). + + Since the optimisation provided by that cache is highly desirable, + the use of a preexisting namespace as the class namespace may need to + be declared as officially unsupported (since the observed behaviour is + rather strange when the caches get out of sync). Key Benefits @@ -175,7 +180,8 @@ Currently, to use a different type (such as ``collections.OrderedDict``) for a class namespace, or to use a pre-populated namespace, it is necessary to write and use a custom metaclass. With this PEP, using a custom namespace -becomes as simple as specifying it in the class header. +becomes as simple as specifying an appropriate factory function in the +class header. Easier inheritance of definition time behaviour @@ -245,20 +251,19 @@ All of the examples below are actually possible today through the use of a custom metaclass:: +if 1: class CustomNamespace(type): @classmethod def __prepare__(meta, name, bases, *, namespace=None, **kwds): parent_namespace = super().__prepare__(name, bases, **kwds) - return namespace if namespace is not None else parent_namespace - + return namespace() if namespace is not None else parent_namespace def __new__(meta, name, bases, ns, *, namespace=None, **kwds): return super().__new__(meta, name, bases, ns, **kwds) - def __init__(cls, name, bases, ns, *, namespace=None, **kwds): return super().__init__(name, bases, ns, **kwds) The advantage of implementing the new keyword directly in -``type.__prepare__`` is that the *only* persistent effect is +``type.__prepare__`` is that the *only* persistent effect is then the change in the underlying storage of the class attributes. The metaclass of the class remains unchanged, eliminating many of the drawbacks typically associated with these kinds of customisations. @@ -269,7 +274,7 @@ :: - class OrderedClass(namespace=collections.OrderedDict()): + class OrderedClass(namespace=collections.OrderedDict): a = 1 b = 2 c = 3 @@ -281,7 +286,7 @@ :: seed_data = dict(a=1, b=2, c=3) - class PrepopulatedClass(namespace=seed_data.copy()): + class PrepopulatedClass(namespace=seed_data.copy): pass @@ -290,21 +295,54 @@ :: - class NewClass(namespace=Prototype.__dict__.copy()): + class NewClass(namespace=Prototype.__dict__.copy): pass -Defining an extensible class ----------------------------- +Extending a class +----------------- + +.. note:: Just because the PEP makes it *possible* to do this relatively, + cleanly doesn't mean anyone *should* do this! :: - class Extensible: - namespace = locals() + from collections import MutableMapping - class ExtendingClass(namespace=Extensible.namespace): + # The MutableMapping + dict combination should give something that + # generally behaves correctly as a mapping, while still being accepted + # as a class namespace + class ClassNamespace(MutableMapping, dict): + def __init__(self, cls): + self._cls = cls + def __len__(self): + return len(dir(self._cls)) + def __iter__(self): + for attr in dir(self._cls): + yield attr + def __contains__(self, attr): + return hasattr(self._cls, attr) + def __getitem__(self, attr): + return getattr(self._cls, attr) + def __setitem__(self, attr, value): + setattr(self._cls, attr, value) + def __delitem__(self, attr): + delattr(self._cls, attr) + + def extend(cls): + return lambda: ClassNamespace(cls) + + class Example: pass + class ExtendedExample(namespace=extend(Example)): + a = 1 + b = 2 + c = 3 + + >>> Example.a, Example.b, Example.c + (1, 2, 3) + Rejected Design Options ======================= @@ -335,6 +373,17 @@ explicitly say anything one way or the other). +Passing in the namespace directly rather than a factory function +---------------------------------------------------------------- + +At one point, this PEP proposed that the class namespace be passed +directly as a keyword argument, rather than passing a factory function. +However, this encourages an unsupported behaviour (that is, passing the +same namespace to multiple classes, or retaining direct write access +to a mapping used as a class namespace), so the API was switched to +the factory function version. + + Reference Implementation ======================== -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Tue Mar 5 13:26:01 2013 From: python-checkins at python.org (nick.coghlan) Date: Tue, 5 Mar 2013 13:26:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Fix_markup?= Message-ID: <3ZKy4n2wyzzS7w@mail.python.org> http://hg.python.org/peps/rev/e61f80e9d5fe changeset: 4783:e61f80e9d5fe user: Nick Coghlan date: Tue Mar 05 22:25:52 2013 +1000 summary: Fix markup files: pep-0422.txt | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/pep-0422.txt b/pep-0422.txt --- a/pep-0422.txt +++ b/pep-0422.txt @@ -251,7 +251,6 @@ All of the examples below are actually possible today through the use of a custom metaclass:: -if 1: class CustomNamespace(type): @classmethod def __prepare__(meta, name, bases, *, namespace=None, **kwds): -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Tue Mar 5 13:32:36 2013 From: python-checkins at python.org (nick.coghlan) Date: Tue, 5 Mar 2013 13:32:36 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Missed_a_ref_to_the_old_API_i?= =?utf-8?q?n_PEP_422?= Message-ID: <3ZKyDN03dYzT1q@mail.python.org> http://hg.python.org/peps/rev/cbeb9952c038 changeset: 4784:cbeb9952c038 user: Nick Coghlan date: Tue Mar 05 22:32:26 2013 +1000 summary: Missed a ref to the old API in PEP 422 files: pep-0422.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0422.txt b/pep-0422.txt --- a/pep-0422.txt +++ b/pep-0422.txt @@ -148,7 +148,7 @@ provided as the ``namespace`` argument will be called without arguments to create the result of ``type.__prepare__`` instead of using a freshly created dictionary instance. For example, the following will use -the ordered dictionary created in the header as the class namespace:: +an ordered dictionary as the class namespace:: class OrderedExample(namespace=collections.OrderedDict): def __init_class__(cls): -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Tue Mar 5 13:34:52 2013 From: python-checkins at python.org (nick.coghlan) Date: Tue, 5 Mar 2013 13:34:52 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Minor_wording_nit?= Message-ID: <3ZKyH03MF2z7Lm1@mail.python.org> http://hg.python.org/peps/rev/64c17479a841 changeset: 4785:64c17479a841 user: Nick Coghlan date: Tue Mar 05 22:34:43 2013 +1000 summary: Minor wording nit files: pep-0422.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0422.txt b/pep-0422.txt --- a/pep-0422.txt +++ b/pep-0422.txt @@ -141,7 +141,7 @@ but the situation has changed sufficiently in recent years that the idea is worth reconsidering. -However, the introduction of the metaclass ``__prepare__`` method in PEP +In addition, the introduction of the metaclass ``__prepare__`` method in PEP 3115 allows a further enhancement that was not possible in Python 2: this PEP also proposes that ``type.__prepare__`` be updated to accept a factory function as a ``namespace`` keyword-only argument. If present, the value -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Tue Mar 5 19:33:55 2013 From: python-checkins at python.org (ezio.melotti) Date: Tue, 5 Mar 2013 19:33:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzExNzMyOiBhZGQg?= =?utf-8?q?a_new_suppress=5Fcrash=5Fpopup=28=29_context_manager_to_test=2E?= =?utf-8?q?support=2E?= Message-ID: <3ZL6FH3p8Bz7LkT@mail.python.org> http://hg.python.org/cpython/rev/834a451f1cdb changeset: 82498:834a451f1cdb branch: 3.3 parent: 82496:84e7a7f6ddb8 user: Ezio Melotti date: Tue Mar 05 20:26:17 2013 +0200 summary: #11732: add a new suppress_crash_popup() context manager to test.support. files: Doc/library/test.rst | 7 ++++++ Lib/test/support.py | 24 ++++++++++++++++++++++- Lib/test/test_capi.py | 3 +- Lib/test/test_faulthandler.py | 6 +++- Misc/NEWS | 4 +++ 5 files changed, 40 insertions(+), 4 deletions(-) diff --git a/Doc/library/test.rst b/Doc/library/test.rst --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -405,6 +405,13 @@ A decorator for running tests that require support for symbolic links. +.. function:: suppress_crash_popup() + + A context manager that disables Windows Error Reporting dialogs using + `SetErrorMode `_. + On other platforms it's a no-op. + + .. decorator:: anticipate_failure(condition) A decorator to conditionally mark tests with diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -71,7 +71,7 @@ "TestHandler", "Matcher", "can_symlink", "skip_unless_symlink", "skip_unless_xattr", "import_fresh_module", "requires_zlib", "PIPE_MAX_SIZE", "failfast", "anticipate_failure", "run_with_tz", - "requires_bz2", "requires_lzma" + "requires_bz2", "requires_lzma", "suppress_crash_popup", ] class Error(Exception): @@ -1905,6 +1905,28 @@ msg = "no non-broken extended attribute support" return test if ok else unittest.skip(msg)(test) + +if sys.platform.startswith('win'): + @contextlib.contextmanager + def suppress_crash_popup(): + """Disable Windows Error Reporting dialogs using SetErrorMode.""" + # see http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621%28v=vs.85%29.aspx + import ctypes + k32 = ctypes.windll.kernel32 + old_error_mode = k32.GetErrorMode() + SEM_NOGPFAULTERRORBOX = 0x02 + k32.SetErrorMode(old_error_mode | SEM_NOGPFAULTERRORBOX) + try: + yield + finally: + k32.SetErrorMode(old_error_mode) +else: + # this is a no-op for other platforms + @contextlib.contextmanager + def suppress_crash_popup(): + yield + + def patch(test_instance, object_to_patch, attr_name, new_value): """Override 'object_to_patch'.'attr_name' with 'new_value'. diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -44,7 +44,8 @@ @unittest.skipUnless(threading, 'Threading required for this test.') def test_no_FatalError_infinite_loop(self): - p = subprocess.Popen([sys.executable, "-c", + with support.suppress_crash_popup(): + p = subprocess.Popen([sys.executable, "-c", 'import _testcapi;' '_testcapi.crash_no_current_thread()'], stdout=subprocess.PIPE, diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py --- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -101,7 +101,8 @@ header=re.escape(header)) if other_regex: regex += '|' + other_regex - output, exitcode = self.get_output(code, filename) + with support.suppress_crash_popup(): + output, exitcode = self.get_output(code, filename) output = '\n'.join(output) self.assertRegex(output, regex) self.assertNotEqual(exitcode, 0) @@ -229,7 +230,8 @@ faulthandler._read_null() """.strip() not_expected = 'Fatal Python error' - stderr, exitcode = self.get_output(code) + with support.suppress_crash_popup(): + stderr, exitcode = self.get_output(code) stder = '\n'.join(stderr) self.assertTrue(not_expected not in stderr, "%r is present in %r" % (not_expected, stderr)) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -640,6 +640,10 @@ Tests ----- +- Issue #11732: add a new suppress_crash_popup() context manager to test.support + that disables crash popups on Windows and use it in test_faulthandler and + test_ctypes. + - Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. - Issue #17249: convert a test in test_capi to use unittest and reap threads. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 19:33:56 2013 From: python-checkins at python.org (ezio.melotti) Date: Tue, 5 Mar 2013 19:33:56 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Fix_indentatio?= =?utf-8?q?n=2E?= Message-ID: <3ZL6FJ6zbJz7Lnl@mail.python.org> http://hg.python.org/cpython/rev/ef7565180b48 changeset: 82499:ef7565180b48 branch: 3.3 user: Ezio Melotti date: Tue Mar 05 20:31:34 2013 +0200 summary: Fix indentation. files: Lib/test/test_capi.py | 8 ++++---- Lib/test/test_faulthandler.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -46,10 +46,10 @@ def test_no_FatalError_infinite_loop(self): with support.suppress_crash_popup(): p = subprocess.Popen([sys.executable, "-c", - 'import _testcapi;' - '_testcapi.crash_no_current_thread()'], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + 'import _testcapi;' + '_testcapi.crash_no_current_thread()'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) (out, err) = p.communicate() self.assertEqual(out, b'') # This used to cause an infinite loop. diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py --- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -102,7 +102,7 @@ if other_regex: regex += '|' + other_regex with support.suppress_crash_popup(): - output, exitcode = self.get_output(code, filename) + output, exitcode = self.get_output(code, filename) output = '\n'.join(output) self.assertRegex(output, regex) self.assertNotEqual(exitcode, 0) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 5 19:33:58 2013 From: python-checkins at python.org (ezio.melotti) Date: Tue, 5 Mar 2013 19:33:58 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzExNzMyOiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZL6FL4c0tz7LpK@mail.python.org> http://hg.python.org/cpython/rev/b87123015fb0 changeset: 82500:b87123015fb0 parent: 82497:b0890674bc21 parent: 82499:ef7565180b48 user: Ezio Melotti date: Tue Mar 05 20:33:38 2013 +0200 summary: #11732: merge with 3.3. files: Doc/library/test.rst | 7 ++++++ Lib/test/support.py | 24 ++++++++++++++++++++++- Lib/test/test_capi.py | 11 +++++---- Lib/test/test_faulthandler.py | 6 +++- Misc/NEWS | 4 +++ 5 files changed, 44 insertions(+), 8 deletions(-) diff --git a/Doc/library/test.rst b/Doc/library/test.rst --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -405,6 +405,13 @@ A decorator for running tests that require support for symbolic links. +.. function:: suppress_crash_popup() + + A context manager that disables Windows Error Reporting dialogs using + `SetErrorMode `_. + On other platforms it's a no-op. + + .. decorator:: anticipate_failure(condition) A decorator to conditionally mark tests with diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -71,7 +71,7 @@ "TestHandler", "Matcher", "can_symlink", "skip_unless_symlink", "skip_unless_xattr", "import_fresh_module", "requires_zlib", "PIPE_MAX_SIZE", "failfast", "anticipate_failure", "run_with_tz", - "requires_bz2", "requires_lzma" + "requires_bz2", "requires_lzma", "suppress_crash_popup", ] class Error(Exception): @@ -1907,6 +1907,28 @@ msg = "no non-broken extended attribute support" return test if ok else unittest.skip(msg)(test) + +if sys.platform.startswith('win'): + @contextlib.contextmanager + def suppress_crash_popup(): + """Disable Windows Error Reporting dialogs using SetErrorMode.""" + # see http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621%28v=vs.85%29.aspx + import ctypes + k32 = ctypes.windll.kernel32 + old_error_mode = k32.GetErrorMode() + SEM_NOGPFAULTERRORBOX = 0x02 + k32.SetErrorMode(old_error_mode | SEM_NOGPFAULTERRORBOX) + try: + yield + finally: + k32.SetErrorMode(old_error_mode) +else: + # this is a no-op for other platforms + @contextlib.contextmanager + def suppress_crash_popup(): + yield + + def patch(test_instance, object_to_patch, attr_name, new_value): """Override 'object_to_patch'.'attr_name' with 'new_value'. diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -44,11 +44,12 @@ @unittest.skipUnless(threading, 'Threading required for this test.') def test_no_FatalError_infinite_loop(self): - p = subprocess.Popen([sys.executable, "-c", - 'import _testcapi;' - '_testcapi.crash_no_current_thread()'], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + with support.suppress_crash_popup(): + p = subprocess.Popen([sys.executable, "-c", + 'import _testcapi;' + '_testcapi.crash_no_current_thread()'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) (out, err) = p.communicate() self.assertEqual(out, b'') # This used to cause an infinite loop. diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py --- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -101,7 +101,8 @@ header=re.escape(header)) if other_regex: regex += '|' + other_regex - output, exitcode = self.get_output(code, filename) + with support.suppress_crash_popup(): + output, exitcode = self.get_output(code, filename) output = '\n'.join(output) self.assertRegex(output, regex) self.assertNotEqual(exitcode, 0) @@ -229,7 +230,8 @@ faulthandler._read_null() """.strip() not_expected = 'Fatal Python error' - stderr, exitcode = self.get_output(code) + with support.suppress_crash_popup(): + stderr, exitcode = self.get_output(code) stder = '\n'.join(stderr) self.assertTrue(not_expected not in stderr, "%r is present in %r" % (not_expected, stderr)) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -892,6 +892,10 @@ Tests ----- +- Issue #11732: add a new suppress_crash_popup() context manager to test.support + that disables crash popups on Windows and use it in test_faulthandler and + test_ctypes. + - Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. - Issue #17283: Share code between `__main__.py` and `regrtest.py` in -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 00:42:21 2013 From: python-checkins at python.org (victor.stinner) Date: Wed, 6 Mar 2013 00:42:21 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317223=3A_Add_anot?= =?utf-8?q?her_test_to_check_that_=5FPyUnicode=5FReady=28=29_rejects?= Message-ID: <3ZLF591ycqz7Lnt@mail.python.org> http://hg.python.org/cpython/rev/15190138d3f3 changeset: 82501:15190138d3f3 user: Victor Stinner date: Wed Mar 06 00:39:03 2013 +0100 summary: Issue #17223: Add another test to check that _PyUnicode_Ready() rejects code points bigger than U+10ffff files: Modules/_testcapimodule.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -1418,6 +1418,16 @@ else return raiseTestError("test_widechar", "PyUnicode_FromUnicode(L\"\\U00110000\", 1) didn't fail"); + + wide = PyUnicode_FromUnicode(NULL, 1); + if (wide == NULL) + return NULL; + PyUnicode_AS_UNICODE(wide)[0] = invalid[0]; + if (_PyUnicode_Ready(wide) < 0) + PyErr_Clear(); + else + return raiseTestError("test_widechar", + "PyUnicode_Ready() didn't fail"); #endif Py_RETURN_NONE; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 00:42:22 2013 From: python-checkins at python.org (victor.stinner) Date: Wed, 6 Mar 2013 00:42:22 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317223=3A_Fix_PyUn?= =?utf-8?q?icode=5FFromUnicode=28=29_on_Windows_=2816-bit_wchar=5Ft_type?= =?utf-8?q?=29?= Message-ID: <3ZLF5B4mmbz7Lpf@mail.python.org> http://hg.python.org/cpython/rev/b9f7b1bf36aa changeset: 82502:b9f7b1bf36aa user: Victor Stinner date: Wed Mar 06 00:41:50 2013 +0100 summary: Issue #17223: Fix PyUnicode_FromUnicode() on Windows (16-bit wchar_t type) to reject invalid UTF-16 surrogate. files: Misc/NEWS | 3 +++ Objects/unicodeobject.c | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #17223: Fix PyUnicode_FromUnicode() on Windows (16-bit wchar_t type) + to reject invalid UTF-16 surrogate. + - Issue #17032: The "global" in the "NameError: global name 'x' is not defined" error message has been removed. Patch by Ram Rachum. diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1384,13 +1384,18 @@ for (iter = begin; iter < end; ) { #if SIZEOF_WCHAR_T == 2 - if (Py_UNICODE_IS_HIGH_SURROGATE(iter[0]) - && (iter+1) < end - && Py_UNICODE_IS_LOW_SURROGATE(iter[1])) - { - ch = Py_UNICODE_JOIN_SURROGATES(iter[0], iter[1]); - ++(*num_surrogates); - iter += 2; + if (Py_UNICODE_IS_HIGH_SURROGATE(iter[0])) { + if ((iter+1) < end + && Py_UNICODE_IS_LOW_SURROGATE(iter[1])) + { + ch = Py_UNICODE_JOIN_SURROGATES(iter[0], iter[1]); + ++(*num_surrogates); + iter += 2; + } + else { + PyErr_SetString(PyExc_ValueError, "illegal UTF-16 surrogate"); + return -1; + } } else #endif -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 01:09:44 2013 From: python-checkins at python.org (victor.stinner) Date: Wed, 6 Mar 2013 01:09:44 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Backed_out_changeset_b9f7b?= =?utf-8?q?1bf36aa?= Message-ID: <3ZLFhm07Ycz7LkL@mail.python.org> http://hg.python.org/cpython/rev/583a0321c7b9 changeset: 82503:583a0321c7b9 user: Victor Stinner date: Wed Mar 06 01:09:24 2013 +0100 summary: Backed out changeset b9f7b1bf36aa files: Misc/NEWS | 3 --- Objects/unicodeobject.c | 19 +++++++------------ 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,9 +10,6 @@ Core and Builtins ----------------- -- Issue #17223: Fix PyUnicode_FromUnicode() on Windows (16-bit wchar_t type) - to reject invalid UTF-16 surrogate. - - Issue #17032: The "global" in the "NameError: global name 'x' is not defined" error message has been removed. Patch by Ram Rachum. diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1384,18 +1384,13 @@ for (iter = begin; iter < end; ) { #if SIZEOF_WCHAR_T == 2 - if (Py_UNICODE_IS_HIGH_SURROGATE(iter[0])) { - if ((iter+1) < end - && Py_UNICODE_IS_LOW_SURROGATE(iter[1])) - { - ch = Py_UNICODE_JOIN_SURROGATES(iter[0], iter[1]); - ++(*num_surrogates); - iter += 2; - } - else { - PyErr_SetString(PyExc_ValueError, "illegal UTF-16 surrogate"); - return -1; - } + if (Py_UNICODE_IS_HIGH_SURROGATE(iter[0]) + && (iter+1) < end + && Py_UNICODE_IS_LOW_SURROGATE(iter[1])) + { + ch = Py_UNICODE_JOIN_SURROGATES(iter[0], iter[1]); + ++(*num_surrogates); + iter += 2; } else #endif -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 01:59:38 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 6 Mar 2013 01:59:38 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzE3MzYzOiBmaXgg?= =?utf-8?q?arguments_in_PyState=5FAddModule_and_PyState=5FRemoveModule_doc?= =?utf-8?q?s=2E?= Message-ID: <3ZLGpL2wyPz7Lpr@mail.python.org> http://hg.python.org/cpython/rev/29d5bc1226f9 changeset: 82504:29d5bc1226f9 branch: 3.3 parent: 82499:ef7565180b48 user: Ezio Melotti date: Wed Mar 06 02:57:25 2013 +0200 summary: #17363: fix arguments in PyState_AddModule and PyState_RemoveModule docs. files: Doc/c-api/module.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -122,7 +122,7 @@ :c:func:`PyState_AddModule` beforehand. In case the corresponding module object is not found or has not been attached to the interpreter state yet, it returns NULL. -.. c:function:: int PyState_AddModule(PyModuleDef *def, PyObject *module) +.. c:function:: int PyState_AddModule(PyObject *module, PyModuleDef *def) Attaches the module object passed to the function to the interpreter state. This allows the module object to be accessible via @@ -130,7 +130,7 @@ .. versionadded:: 3.3 -.. c:function:: int PyState_RemoveModule(PyModuleDef *def, PyObject *module) +.. c:function:: int PyState_RemoveModule(PyModuleDef *def) Removes the module object created from *def* from the interpreter state. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 01:59:39 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 6 Mar 2013 01:59:39 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3MzYzOiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZLGpM5dP1z7LmC@mail.python.org> http://hg.python.org/cpython/rev/75c0cb169be5 changeset: 82505:75c0cb169be5 parent: 82503:583a0321c7b9 parent: 82504:29d5bc1226f9 user: Ezio Melotti date: Wed Mar 06 02:59:25 2013 +0200 summary: #17363: merge with 3.3. files: Doc/c-api/module.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -122,7 +122,7 @@ :c:func:`PyState_AddModule` beforehand. In case the corresponding module object is not found or has not been attached to the interpreter state yet, it returns NULL. -.. c:function:: int PyState_AddModule(PyModuleDef *def, PyObject *module) +.. c:function:: int PyState_AddModule(PyObject *module, PyModuleDef *def) Attaches the module object passed to the function to the interpreter state. This allows the module object to be accessible via @@ -130,7 +130,7 @@ .. versionadded:: 3.3 -.. c:function:: int PyState_RemoveModule(PyModuleDef *def, PyObject *module) +.. c:function:: int PyState_RemoveModule(PyModuleDef *def) Removes the module object created from *def* from the interpreter state. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 02:24:07 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 6 Mar 2013 02:24:07 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzE3MzY0OiByZW1v?= =?utf-8?q?ve_documentation_for_a_function_that_does_not_exist=2E?= Message-ID: <3ZLHLb3FxJzSlH@mail.python.org> http://hg.python.org/cpython/rev/01a8fcc91d5a changeset: 82506:01a8fcc91d5a branch: 2.7 parent: 82494:4e6c46d5f77d user: Ezio Melotti date: Wed Mar 06 03:20:27 2013 +0200 summary: #17364: remove documentation for a function that does not exist. files: Doc/library/multiprocessing.rst | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -579,7 +579,6 @@ :exc:`Queue.Empty` exception (*timeout* is ignored in that case). .. method:: get_nowait() - get_no_wait() Equivalent to ``get(False)``. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 02:24:08 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 6 Mar 2013 02:24:08 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3MzY0OiByZW1v?= =?utf-8?q?ve_documentation_for_a_function_that_does_not_exist=2E?= Message-ID: <3ZLHLc6ByWzSsL@mail.python.org> http://hg.python.org/cpython/rev/4f9de1b18cab changeset: 82507:4f9de1b18cab branch: 3.2 parent: 82495:637d7c953b10 user: Ezio Melotti date: Wed Mar 06 03:20:27 2013 +0200 summary: #17364: remove documentation for a function that does not exist. files: Doc/library/multiprocessing.rst | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -579,7 +579,6 @@ :exc:`queue.Empty` exception (*timeout* is ignored in that case). .. method:: get_nowait() - get_no_wait() Equivalent to ``get(False)``. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 02:24:10 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 6 Mar 2013 02:24:10 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2317364=3A_merge_with_3=2E2=2E?= Message-ID: <3ZLHLf1sTVzSns@mail.python.org> http://hg.python.org/cpython/rev/5e294202f93e changeset: 82508:5e294202f93e branch: 3.3 parent: 82504:29d5bc1226f9 parent: 82507:4f9de1b18cab user: Ezio Melotti date: Wed Mar 06 03:23:28 2013 +0200 summary: #17364: merge with 3.2. files: Doc/library/multiprocessing.rst | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -608,7 +608,6 @@ :exc:`queue.Empty` exception (*timeout* is ignored in that case). .. method:: get_nowait() - get_no_wait() Equivalent to ``get(False)``. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 02:24:11 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 6 Mar 2013 02:24:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3MzY0OiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZLHLg4QJkz7Lpr@mail.python.org> http://hg.python.org/cpython/rev/b87e9b8dc9ad changeset: 82509:b87e9b8dc9ad parent: 82505:75c0cb169be5 parent: 82508:5e294202f93e user: Ezio Melotti date: Wed Mar 06 03:23:52 2013 +0200 summary: #17364: merge with 3.3. files: Doc/library/multiprocessing.rst | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -608,7 +608,6 @@ :exc:`queue.Empty` exception (*timeout* is ignored in that case). .. method:: get_nowait() - get_no_wait() Equivalent to ``get(False)``. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 05:17:13 2013 From: python-checkins at python.org (terry.reedy) Date: Wed, 6 Mar 2013 05:17:13 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_PEP-434=3A_Touch-up_format_to?= =?utf-8?q?_comform_to_PEP-1_guidelines_and_PEP-12_template=2E?= Message-ID: <3ZLMBK6vflzRx7@mail.python.org> http://hg.python.org/peps/rev/fe24e53bc195 changeset: 4786:fe24e53bc195 parent: 4761:4de791923041 user: Terry Jan Reedy date: Tue Mar 05 19:07:25 2013 -0500 summary: PEP-434: Touch-up format to comform to PEP-1 guidelines and PEP-12 template. Re-write to focus more on the specific pep proposal and the difficulty of classifying IDLE issues. Added discussion of backwards compatibility with extensions. files: pep-0434.txt | 174 ++++++++++++++++++++++++++++++-------- 1 files changed, 138 insertions(+), 36 deletions(-) diff --git a/pep-0434.txt b/pep-0434.txt --- a/pep-0434.txt +++ b/pep-0434.txt @@ -1,52 +1,153 @@ PEP: 434 Title: IDLE Enhancement Exception for All Branches -Version: -Last-Modified: -Author: Todd Rovito , Terry Reedy +Version: $Revision$ +Last-Modified: $Date$ +Author: Todd Rovito , + Terry Reedy BDFL-Delegate: Nick Coghlan Status: Draft Type: Informational Content-Type: text/x-rst Created: 16-Feb-2013 -Python-Version: 2.7 Post-History: 16-Feb-2013 Abstract ======== -Generally only new features are applied to Python 3.4 but this PEP requests an -exception for IDLE [1]_. IDLE is part of the standard library and has numerous -outstanding issues [2]_. Since IDLE is often the first thing a new Python user -sees it desperately needs to be brought up to date with modern GUI standards -across the three major platforms Linux, Mac OS X, and Windows. +Most CPython tracker issues are classified as behavior or +enhancement. Most behavior patches are backported to branches for +existing versions. Enhancement patches are restricted to the default +branch that becomes the next Python version. + +This PEP proposes that the restriction on applying enhancements be +relaxed for IDLE code, residing in .../Lib/idlelib/. In practice, +this would mean that IDLE developers would not have to classify or +agree on the classification of a patch but could instead focus on +what is best for IDLE users and future IDLE developement. It would +also mean that IDLE patches would not necessarily have to be split +into 'bugfix' changes and enhancement changes. + +The PEP would apply to changes in existing features and addition of +small features, such as would require a new menu entry, but not +necessarily to possible major re-writes such as switching to themed +widgets or tabbed windows. + + +Motivation +========== + +This PEP was prompted by controversy on both the tracker and pydev +list over adding Cut, Copy, and Paste to right-click context menus +(Issue 1207589, opened in 2005 [1]_; pydev thread [2]_). The +features were available as keyboard shortcuts but not on the context +menu. It is standard, at least on Windows, that they should be when +applicable (a read-only window would only have Copy), so users do not +have to shift to the keyboard after selecting text for cutting or +copying or a slice point for pasting. The context menu was not +documented until 10 days before the new options were added (Issue +10405 [3]_). + +Normally, behavior is called a bug if it conflicts with documentation +judged to be correct. But if there is no doc, what is the standard? +If the code is its own documentation, most IDLE issues on the tracker +are enhancement issues. If we substitute reasonable user expectation, +(which can, of course, be its own subject of disagreement), many more +issues are behavior issues. + +For context menus, people disagreed on the status of the additions -- +bugfix or enhancement. Even people who called it an enhancement +disagreed as to whether the patch should be backported. This PEP +proposes to make the status disagreement irrelevant by explicitly +allowing more liberal backporting than for other stdlib modules. Rationale ========= -Python does have many advanced features yet Python is well known for being a -easy computer language for beginners [3]_. A major Python philosophy is -"batteries included" which is best demonstrated in Python's standard library -with many modules that are not typically included with other programming -languages [4]_. IDLE is a important "battery" in the Python toolbox because it -allows a beginner to get started quickly without downloading and configuring a -third party IDE. IDLE is primarily used as an application that ships with -Python, rather than as a library module used to build Python applications, -hence a different standard should apply to IDLE enhancements. Additional -patches to IDLE cannot break any existing program/library because IDLE is used -by humans. +People primarily use IDLE by running the gui application, rather than +by directly importing the effectively private (undocumented) +implementation modules in idlelib. Whether they use the shell, the +editor, or both, we believe they will benefit more from consistency +across the latest releases of current Python versions than from +consistency within the bugfix releases for one Python version. This +is especially true when existing behavior is clearly unsatisfactory. +When people use the standard interpreter, the OS-provided frame works +pretty much the same for all Python versions. If, for instance, +Microsoft were to upgrade the Command Prompt gui, the improvements +would be present regardless of which Python were running within it. +Similarly, if one edits Python code with editor X, behaviors such as +the right-click context menu and the search-replace box do not depend +on the version of Python being edited or even the language being +edited. -Details -======= +The benefit for IDLE developers is mixed. On the one hand, testing +more versions and possibly having to adjust a patch, especially for +2.7, is more work. (There is, of course, the option on not +backporting everything. For issue 12510, some changes to calltips for +classes were not included in the 2.7 patch because of issues with +old-style classes [4]_.) On the other hand, bike-shedding can be an +energy drain. If the obvious fix for a bug looks like an enhancement, +writing a separate bugfix-only patch is more work. And making the +code diverge between versions makes future multi-version patches more +difficult. -Python 2.7 does not accept bug fixes, this rule can be ignored for IDLE if the -Python development team accepts this PEP [5]_. IDLE issues will be carefully -tested on the three major platforms Linux, Mac OS X, and Windows before any -commits are made. Since IDLE is segregated to a particular part of the source -tree this enhancement exception only applies to Lib/idlelib directory in -Python branches >= 2.7. +These issue are illustrated by the search-and-replace dialog box. +It used to raise an exception for certain user entries [5]_. The +uncaught exception caused IDLE to exit. At least on Windows, the +exit was silent (no visible traceback) and looked like a crash if +IDLE was started normally, from an icon. + +Was this a bug? IDLE Help (on the current Help submenu) just says +"Replace... Open a search-and-replace dialog box", and a box *was* +opened. It is not, in general, a bug for a library method to raise an +exception. And it is not, in general, a bug for a library method to +ignore an exception raised by functions it calls. So if we were to +adopt the 'code = doc' philosopy in the absence of detailed docs, one +might say 'No'. + +However, IDLE exiting when it does not need to is definitely +obnoxious. So four of us agreed that it should be prevented. But +there was still the question of what to do instead? Catch the +exception? Just not raise the exception? Beep? Display an error +message box? Or try to do something useful with the user's entry? +Would replacing a 'crash' with useful behavior be an enhancement, +limited to future Python releases? Should IDLE developers have to +ask that? + + +Backwards Compatibility +======================= + +For IDLE, there are three types of users who might be concerned about +back compatibility. First are people who run IDLE as an application. +We have already discussed them above. + +Second are people who import one of the idlelib modules. As far as +we know, this is only done to start the IDLE application, and we do +not propose breaking such use. Otherwise, the modules are +undocumented and effectively private implementations. If an IDLE +module were defined as public, documented, and perhaps moved to the +tkinter package, it would then follow the normal rules. (Documenting +the private interfaces for the benefit of people working on the IDLE +code is a separate issue.) + +Third are people who write IDLE extensions. The guaranteed extension +interface is given in idlelib/extension.txt. This should be respected +at least in existing versions, and not frivolously changed in future +versions. But there is a warning that "The extension cannot assume +much about this [EditorWindow] argument." This guarantee should +rarely be an issue with patches, and the issue is not specific to +'enhancement' versus 'bugfix' patches. + +As is happens, after the context menu patch was applied, it came up +that extensions that added items to the context menu (rare) would be +broken because the patch a) added a new item to standard rmenu_specs +and b) expected every rmenu_spec to be lengthened. It is not clear +whether this violates the guarantee, but there is a second patch that +fixes assumption b). It should be applied when it is clear that the +first patch will not have to be reverted. References @@ -55,17 +156,18 @@ .. [1] IDLE: Right Click Context Menu, Foord, Michael (http://bugs.python.org/issue1207589) -.. [2] Meta-issue for "Invent with Python" IDLE feedback - (http://bugs.python.org/issue13504) +.. [2] Cut/Copy/Paste items in IDLE right click context menu + (http://mail.python.org/pipermail/python-dev/2012-November/122514.html) -.. [3] Getting Started with Python - (http://www.python.org/about/gettingstarted/) +.. [3] IDLE breakpoint facility undocumented, Daily, Ned + (http://bugs.python.org/issue10405) -.. [4] Batteries Included - (http://docs.python.org/2/tutorial/stdlib.html#batteries-included) +.. [4] IDLE: calltips mishandle raw strings and other examples, + Reedy, Terry + (http://bugs.python.org/issue12510) -.. [5] Python 2.7 Release Schedule - (http://www.python.org/dev/peps/pep-0373/) +.. [5] IDLE: replace ending with '\' causes crash, Reedy, Terry + (http://bugs.python.org/issue13052) Copyright -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Wed Mar 6 05:17:16 2013 From: python-checkins at python.org (terry.reedy) Date: Wed, 6 Mar 2013 05:17:16 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps_=28merge_default_-=3E_default=29?= =?utf-8?q?=3A_Merge?= Message-ID: <3ZLMBN0xNbzS96@mail.python.org> http://hg.python.org/peps/rev/feacb6c0633d changeset: 4787:feacb6c0633d parent: 4786:fe24e53bc195 parent: 4785:64c17479a841 user: Terry Jan Reedy date: Tue Mar 05 23:16:18 2013 -0500 summary: Merge files: pep-0422.txt | 341 ++++++++++++++---------- pep-0426.txt | 190 ++++++++----- pep-0427.txt | 20 +- pep-0428.txt | 18 + pep-0435.txt | 542 +++++++++++++++++++++++++++++++++++++++ pep-0436.txt | 480 ++++++++++++++++++++++++++++++++++ 6 files changed, 1371 insertions(+), 220 deletions(-) diff --git a/pep-0422.txt b/pep-0422.txt --- a/pep-0422.txt +++ b/pep-0422.txt @@ -1,5 +1,5 @@ PEP: 422 -Title: Simple class initialisation hook +Title: Simpler customisation of class creation Version: $Revision$ Last-Modified: $Date$ Author: Nick Coghlan , @@ -9,29 +9,23 @@ Content-Type: text/x-rst Created: 5-Jun-2012 Python-Version: 3.4 -Post-History: 5-Jun-2012, 10-Feb-2012 +Post-History: 5-Jun-2012, 10-Feb-2013 Abstract ======== -In Python 2, the body of a class definition could modify the way a class -was created (or simply arrange to run other code after the class was created) -by setting the ``__metaclass__`` attribute in the class body. While doing -this implicitly from called code required the use of an implementation detail -(specifically, ``sys._getframes()``), it could also be done explicitly in a -fully supported fashion (for example, by passing ``locals()`` to a -function that calculated a suitable ``__metaclass__`` value) +Currently, customising class creation requires the use of a custom metaclass. +This custom metaclass then persists for the entire lifecycle of the class, +creating the potential for spurious metaclass conflicts. -There is currently no corresponding mechanism in Python 3 that allows the -code executed in the class body to directly influence how the class object -is created. Instead, the class creation process is fully defined by the -class header, before the class body even begins executing. +This PEP proposes to instead support a wide range of customisation +scenarios through a new ``namespace`` parameter in the class header, and +a new ``__init_class__`` hook in the class body. -This PEP proposes a mechanism that will once again allow the body of a -class definition to more directly influence the way a class is created -(albeit in a more constrained fashion), as well as replacing some current -uses of metaclasses with a simpler, easier to understand alternative. +The new mechanism is also much easier to understand and use than +implementing a custom metaclass, and thus should provide a gentler +introduction to the full power Python's metaclass machinery. Background @@ -81,25 +75,32 @@ name had not yet been bound in the containing scope), similarly, Python 3 metaclasses cannot call methods that rely on the implicit ``__class__`` reference (as it is not populated until after the metaclass has returned -control to the class creation machiner). +control to the class creation machinery). + +Finally, when a class uses a custom metaclass, it can pose additional +challenges to the use of multiple inheritance, as a new class cannot +inherit from parent classes with unrelated metaclasses. This means that +it is impossible to add a metaclass to an already published class: such +an addition is a backwards incompatible change due to the risk of metaclass +conflicts. Proposal ======== -This PEP proposes that a mechanism be added to Python 3 that meets the -following criteria: +This PEP proposes that a new mechanism to customise class creation be +added to Python 3.4 that meets the following criteria: -1. Restores the ability for class namespaces to have some influence on the +1. Integrates nicely with class inheritance structures (including mixins and + multiple inheritance) +2. Integrates nicely with the implicit ``__class__`` reference and + zero-argument ``super()`` syntax introduced by PEP 3135 +3. Can be added to an existing base class without a significant risk of + introducing backwards compatibility problems +4. Restores the ability for class namespaces to have some influence on the class creation process (above and beyond populating the namespace itself), but potentially without the full flexibility of the Python 2 style ``__metaclass__`` hook -2. Integrates nicely with class inheritance structures (including mixins and - multiple inheritance) -3. Integrates nicely with the implicit ``__class__`` reference and - zero-argument ``super()`` syntax introduced by PEP 3135 -4. Can be added to an existing base class without a significant risk of - introducing backwards compatibility problems One mechanism that can achieve this goal is to add a new class initialisation hook, modelled directly on the existing instance @@ -110,7 +111,6 @@ class initialisation hook as follows:: class Example: - @classmethod def __init_class__(cls): # This is invoked after the class is created, but before any # explicit decorators are called @@ -121,13 +121,15 @@ If present on the created object, this new hook will be called by the class creation machinery *after* the ``__class__`` reference has been initialised. For ``types.new_class()``, it will be called as the last step before -returning the created class object. +returning the created class object. ``__init_class__`` is implicitly +converted to a class method when the class is created (prior to the hook +being invoked). If a metaclass wishes to block class initialisation for some reason, it must arrange for ``cls.__init_class__`` to trigger ``AttributeError``. Note, that when ``__init_class__`` is called, the name of the class is not -bound to the new class object yet. As a consequence, the two argument form +yet bound to the new class object. As a consequence, the two argument form of ``super()`` cannot be used to call methods (e.g., ``super(Example, cls)`` wouldn't work in the example above). However, the zero argument form of ``super()`` works as expected, since the ``__class__`` reference is already @@ -139,19 +141,47 @@ but the situation has changed sufficiently in recent years that the idea is worth reconsidering. +In addition, the introduction of the metaclass ``__prepare__`` method in PEP +3115 allows a further enhancement that was not possible in Python 2: this +PEP also proposes that ``type.__prepare__`` be updated to accept a factory +function as a ``namespace`` keyword-only argument. If present, the value +provided as the ``namespace`` argument will be called without arguments +to create the result of ``type.__prepare__`` instead of using a freshly +created dictionary instance. For example, the following will use +an ordered dictionary as the class namespace:: + + class OrderedExample(namespace=collections.OrderedDict): + def __init_class__(cls): + # cls.__dict__ is still a read-only proxy to the class namespace, + # but the underlying storage is an OrderedDict instance + +.. note:: + + This PEP, along with the existing ability to use __prepare__ to share a + single namespace amongst multiple class objects, highlights a possible + issue with the attribute lookup caching: when the underlying mapping is + updated by other means, the attribute lookup cache is not invalidated + correctly (this is a key part of the reason class ``__dict__`` attributes + produce a read-only view of the underlying storage). + + Since the optimisation provided by that cache is highly desirable, + the use of a preexisting namespace as the class namespace may need to + be declared as officially unsupported (since the observed behaviour is + rather strange when the caches get out of sync). + Key Benefits ============ -Replaces many use cases for dynamic setting of ``__metaclass__`` ------------------------------------------------------------------ +Easier use of custom namespaces for a class +------------------------------------------- -For use cases that don't involve completely replacing the defined class, -Python 2 code that dynamically set ``__metaclass__`` can now dynamically -set ``__init_class__`` instead. For more advanced use cases, introduction of -an explicit metaclass (possibly made available as a required base class) will -still be necessary in order to support Python 3. +Currently, to use a different type (such as ``collections.OrderedDict``) for +a class namespace, or to use a pre-populated namespace, it is necessary to +write and use a custom metaclass. With this PEP, using a custom namespace +becomes as simple as specifying an appropriate factory function in the +class header. Easier inheritance of definition time behaviour @@ -201,137 +231,124 @@ that use the zero argument form of ``super()``. -Alternatives -============ +Replaces many use cases for dynamic setting of ``__metaclass__`` +----------------------------------------------------------------- +For use cases that don't involve completely replacing the defined class, +Python 2 code that dynamically set ``__metaclass__`` can now dynamically +set ``__init_class__`` instead. For more advanced use cases, introduction of +an explicit metaclass (possibly made available as a required base class) will +still be necessary in order to support Python 3. -The Python 3 Status Quo + +New Ways of Using Classes +========================= + +The new ``namespace`` keyword in the class header enables a number of +interesting options for controlling the way a class is initialised, +including some aspects of the object models of both Javascript and Ruby. + +All of the examples below are actually possible today through the use of a +custom metaclass:: + + class CustomNamespace(type): + @classmethod + def __prepare__(meta, name, bases, *, namespace=None, **kwds): + parent_namespace = super().__prepare__(name, bases, **kwds) + return namespace() if namespace is not None else parent_namespace + def __new__(meta, name, bases, ns, *, namespace=None, **kwds): + return super().__new__(meta, name, bases, ns, **kwds) + def __init__(cls, name, bases, ns, *, namespace=None, **kwds): + return super().__init__(name, bases, ns, **kwds) + +The advantage of implementing the new keyword directly in +``type.__prepare__`` is that the *only* persistent effect is then +the change in the underlying storage of the class attributes. The metaclass +of the class remains unchanged, eliminating many of the drawbacks +typically associated with these kinds of customisations. + + +Order preserving classes +------------------------ + +:: + + class OrderedClass(namespace=collections.OrderedDict): + a = 1 + b = 2 + c = 3 + + +Prepopulated namespaces ----------------------- -The Python 3 status quo already offers a great deal of flexibility. For -changes which only affect a single class definition and which can be -specified at the time the code is written, then class decorators can be -used to modify a class explicitly. Class decorators largely ignore class -inheritance and can make full use of methods that rely on the ``__class__`` -reference being populated. +:: -Using a custom metaclass provides the same level of power as it did in -Python 2. However, it's notable that, unlike class decorators, a metaclass -cannot call any methods that rely on the ``__class__`` reference, as that -reference is not populated until after the metaclass constructor returns -control to the class creation code. + seed_data = dict(a=1, b=2, c=3) + class PrepopulatedClass(namespace=seed_data.copy): + pass -One major use case for metaclasses actually closely resembles the use of -class decorators. It occurs whenever a metaclass has an implementation that -uses the following pattern:: - class Metaclass(type): - def __new__(meta, *args, **kwds): - cls = super(Metaclass, meta).__new__(meta, *args, **kwds) - # Do something with cls - return cls +Cloning a prototype class +------------------------- -The key difference between this pattern and a class decorator is that it -is automatically inherited by subclasses. However, it also comes with a -major disadvantage: Python does not allow you to inherit from classes with -unrelated metaclasses. +:: -Thus, the status quo requires that developers choose between the following -two alternatives: + class NewClass(namespace=Prototype.__dict__.copy): + pass -* Use a class decorator, meaning that behaviour is not inherited and must be - requested explicitly on every subclass -* Use a metaclass, meaning that behaviour is inherited, but metaclass - conflicts may make integration with other libraries and frameworks more - difficult than it otherwise would be -If this PEP is ultimately rejected, then this is the existing design that -will remain in place by default. +Extending a class +----------------- +.. note:: Just because the PEP makes it *possible* to do this relatively, + cleanly doesn't mean anyone *should* do this! -Restoring the Python 2 metaclass hook -------------------------------------- +:: -One simple alternative would be to restore support for a Python 2 style -``metaclass`` hook in the class body. This would be checked after the class -body was executed, potentially overwriting the metaclass hint provided in the -class header. + from collections import MutableMapping -The main attraction of such an approach is that it would simplify porting -Python 2 applications that make use of this hook (especially those that do -so dynamically). + # The MutableMapping + dict combination should give something that + # generally behaves correctly as a mapping, while still being accepted + # as a class namespace + class ClassNamespace(MutableMapping, dict): + def __init__(self, cls): + self._cls = cls + def __len__(self): + return len(dir(self._cls)) + def __iter__(self): + for attr in dir(self._cls): + yield attr + def __contains__(self, attr): + return hasattr(self._cls, attr) + def __getitem__(self, attr): + return getattr(self._cls, attr) + def __setitem__(self, attr, value): + setattr(self._cls, attr, value) + def __delitem__(self, attr): + delattr(self._cls, attr) -However, this approach does nothing to simplify the process of adding -*inherited* class definition time behaviour, nor does it interoperate -cleanly with the PEP 3135 ``__class__`` and ``super()`` semantics (as with -any metaclass based solution, the ``__metaclass__`` hook would have to run -before the ``__class__`` reference has been populated. + def extend(cls): + return lambda: ClassNamespace(cls) + class Example: + pass -Dynamic class decorators ------------------------- + class ExtendedExample(namespace=extend(Example)): + a = 1 + b = 2 + c = 3 -The original version of this PEP was called "Dynamic class decorators" and -focused solely on a significantly more complicated proposal than that -presented in the current version. + >>> Example.a, Example.b, Example.c + (1, 2, 3) -As with the current version, it proposed that a new step be added to the -class creation process, after the metaclass invocation to construct the -class instance and before the application of lexical decorators. However, -instead of a simple process of calling a single class method that relies -on normal inheritance mechanisms, it proposed a far more complicated -procedure that walked the class MRO looking for decorators stored in -iterable ``__decorators__`` attributes. -Using the current version of the PEP, the scheme originally proposed could -be implemented as:: +Rejected Design Options +======================= - class DynamicDecorators(Base): - @classmethod - def __init_class__(cls): - # Process any classes later in the MRO - try: - mro_chain = super().__init_class__ - except AttributeError: - pass - else: - mro_chain() - # Process any __decorators__ attributes in the MRO - for entry in reversed(cls.mro()): - decorators = entry.__dict__.get("__decorators__", ()) - for deco in reversed(decorators): - cls = deco(cls) -Any subclasses of ``DynamicDecorators`` would then automatically have the -contents of any ``__decorators__`` attributes processed and invoked. - -The mechanism in the current PEP is considered superior, as many issues -to do with ordering and the same decorator being invoked multiple times -just go away, as that kind of thing is taken care of through the use of an -ordinary class method invocation. - - -Automatic metaclass derivation ------------------------------- - -When no appropriate metaclass is found, it's theoretically possible to -automatically derive a metaclass for a new type based on the metaclass hint -and the metaclasses of the bases. - -While adding such a mechanism would reduce the risk of spurious metaclass -conflicts, it would do nothing to improve integration with PEP 3135, would -not help with porting Python 2 code that set ``__metaclass__`` dynamically -and would not provide a more straightforward inherited mechanism for invoking -additional operations after the class invocation is complete. - -In addition, there would still be a risk of metaclass conflicts in cases -where the base metaclasses were not written with multiple inheritance in -mind. In such situations, there's a chance of introducing latent defects -if one or more metaclasses are not invoked correctly. - - -Calling the new hook from ``type.__init__`` -------------------------------------------- +Calling ``__init_class__`` from ``type.__init__`` +------------------------------------------------- Calling the new hook automatically from ``type.__init__``, would achieve most of the goals of this PEP. However, using that approach would mean that @@ -340,11 +357,43 @@ ``super()``), and could not make use of those features themselves. +Requiring an explict decorator on ``__init_class__`` +---------------------------------------------------- + +Originally, this PEP required the explicit use of ``@classmethod`` on the +``__init_class__`` decorator. It was made implicit since there's no +sensible interpretation for leaving it out, and that case would need to be +detected anyway in order to give a useful error message. + +This decision was reinforced after noticing that the user experience of +defining ``__prepare__`` and forgetting the ``@classmethod`` method +decorator is singularly incomprehensible (particularly since PEP 3115 +documents it as an ordinary method, and the current documentation doesn't +explicitly say anything one way or the other). + + +Passing in the namespace directly rather than a factory function +---------------------------------------------------------------- + +At one point, this PEP proposed that the class namespace be passed +directly as a keyword argument, rather than passing a factory function. +However, this encourages an unsupported behaviour (that is, passing the +same namespace to multiple classes, or retaining direct write access +to a mapping used as a class namespace), so the API was switched to +the factory function version. + + Reference Implementation ======================== -The reference implementation has been posted to the `issue tracker`_. +A reference implementation for __init_class__ has been posted to the +`issue tracker`_. It does not yet include the new ``namespace`` parameter +for ``type.__prepare__``. +TODO +==== + +* address the 5 points in http://mail.python.org/pipermail/python-dev/2013-February/123970.html References ========== diff --git a/pep-0426.txt b/pep-0426.txt --- a/pep-0426.txt +++ b/pep-0426.txt @@ -343,10 +343,10 @@ Provides-Extra (multiple use) ----------------------------- -A string containing the name of an optional feature. Must be printable -ASCII, not containing whitespace, comma (,), or square brackets []. -May be used to make a dependency conditional on whether the optional -feature has been requested. +A string containing the name of an optional feature or "extra" that may +only be available when additional dependencies have been installed. Must +be printable ASCII, not containing whitespace, comma (,), or square +brackets []. See `Optional Features`_ for details on the use of this field. @@ -861,7 +861,7 @@ Within a post-release (``1.0.post1``), the following suffixes are permitted and are ordered as shown:: - devN, + .devN, Note that ``devN`` and ``postN`` must always be preceded by a dot, even when used immediately following a numeric version (e.g. ``1.0.dev456``, @@ -976,8 +976,9 @@ As with other incompatible version schemes, date based versions can be stored in the ``Private-Version`` field. Translating them to a compliant -version is straightforward: the simplest approach is to subtract the year -of the first release from the major component in the release number. +public version is straightforward: the simplest approach is to subtract +the year before the first release from the major component in the release +number. Version specifiers @@ -994,48 +995,93 @@ The comma (",") is equivalent to a logical **and** operator. -Comparison operators must be one of ``<``, ``>``, ``<=``, ``>=``, ``==`` -or ``!=``. - -The ``==`` and ``!=`` operators are strict - in order to match, the -version supplied must exactly match the specified version, with no -additional trailing suffix. - -However, when no comparison operator is provided along with a version -identifier ``V``, it is equivalent to using the following pair of version -clauses:: - - >= V, < V+1 - -where ``V+1`` is the next version after ``V``, as determined by -incrementing the last numeric component in ``V`` (for example, if -``V == 1.0a3``, then ``V+1 == 1.0a4``, while if ``V == 1.0``, then -``V+1 == 1.1``). - -This approach makes it easy to depend on a particular release series -simply by naming it in a version specifier, without requiring any -additional annotation. For example, the following pairs of version -specifiers are equivalent:: - - 2 - >= 2, < 3 - - 3.3 - >= 3.3, < 3.4 - Whitespace between a conditional operator and the following version identifier is optional, as is the whitespace around the commas. + +Compatible release +------------------ + +A compatible release clause omits the comparison operator and matches any +version that is expected to be compatible with the specified version. + +For a given release identifier ``V.N``, the compatible release clause is +approximately equivalent to the pair of comparison clauses:: + + >= V.N, < V+1.dev0 + +where ``V+1`` is the next version after ``V``, as determined by +incrementing the last numeric component in ``V``. For example, +the following version clauses are approximately equivalent:: + + 2.2 + >= 2.2, < 3.dev0 + + 1.4.5 + >= 1.4.5, < 1.5.dev0 + +The difference between the two is that using a compatible release clause +does *not* count as `explicitly mentioning a pre-release`__. + +__ `Handling of pre-releases`_ + +If a pre-release, post-release or developmental release is named in a +compatible release clause as ``V.N.suffix``, then the suffix is ignored +when determining the upper limit of compatibility:: + + 2.2.post3 + >= 2.2.post3, < 3.dev0 + + 1.4.5a4 + >= 1.4.5a4, < 1.5.dev0 + + +Version comparisons +------------------- + +A version comparison clause includes a comparison operator and a version +identifier, and will match any version where the comparison is true. + +Comparison clauses are only needed to cover cases which cannot be handled +with an appropriate compatible release clause, including coping with +dependencies which do not have a robust backwards compatibility policy +and thus break the assumptions of a compatible release clause. + +The defined comparison operators are ``<``, ``>``, ``<=``, ``>=``, ``==``, +and ``!=``. + +The ordered comparison operators ``<``, ``>``, ``<=``, ``>=`` are based +on the consistent ordering defined by the standard `Version scheme`_. + +The ``==`` and ``!=`` operators are based on string comparisons - in order +to match, the version being checked must start with exactly that sequence of +characters. + +.. note:: + + The use of ``==`` when defining dependencies for published distributions + is strongly discouraged, as it greatly complicates the deployment of + security fixes (the strict version comparison operator is intended + primarily for use when defining dependencies for particular + applications while using a shared distribution index). + + +Handling of pre-releases +------------------------ + Pre-releases of any kind, including developmental releases, are implicitly excluded from all version specifiers, *unless* a pre-release or developmental -developmental release is explicitly mentioned in one of the clauses. For -example, this specifier implicitly excludes all pre-releases and development +release is explicitly mentioned in one of the clauses. For example, these +specifiers implicitly exclude all pre-releases and development releases of later versions:: + 2.2 >= 1.0 -While these specifiers would include them:: +While these specifiers would include at least some of them:: + 2.2.dev0 + 2.2, != 2.3b2 >= 1.0a1 >= 1.0c1 >= 1.0, != 1.0b2 @@ -1053,37 +1099,26 @@ Post-releases and purely numeric releases receive no special treatment - they are always included unless explicitly excluded. -Given the above rules, projects which include the ``.0`` suffix for the -first release in a series, such as ``2.5.0``, can easily refer specifically -to that version with the clause ``2.5.0``, while the clause ``2.5`` refers -to that entire series. Projects which omit the ".0" suffix for the first -release of a series, by using a version string like ``2.5`` rather than -``2.5.0``, will need to use an explicit clause like ``>= 2.5, < 2.5.1`` to -refer specifically to that initial release. -Some examples: +Examples +-------- -* ``Requires-Dist: zope.interface (3.1)``: any version that starts with 3.1, +* ``Requires-Dist: zope.interface (3.1)``: version 3.1 or later, but not + version 4.0 or later. Excludes pre-releases and developmental releases. +* ``Requires-Dist: zope.interface (3.1.0)``: version 3.1.0 or later, but not + version 3.2.0 or later. Excludes pre-releases and developmental releases. +* ``Requires-Dist: zope.interface (==3.1)``: any version that starts + with 3.1, excluding pre-releases and developmental releases. +* ``Requires-Dist: zope.interface (3.1.0,!=3.1.3)``: version 3.1.0 or later, + but not version 3.1.3 and not version 3.2.0 or later. Excludes pre-releases + and developmental releases. For this particular project, this means: "any + version of the 3.1 series but not 3.1.3". This is equivalent to: + ``>=3.1, !=3.1.3, <3.2``. +* ``Requires-Python: 2.6``: Any version of Python 2.6 or 2.7. It + automatically excludes Python 3 or later. +* ``Requires-Python: 3.2, < 3.3``: Specifically requires Python 3.2, excluding pre-releases. -* ``Requires-Dist: zope.interface (==3.1)``: equivalent to ``Requires-Dist: - zope.interface (3.1)``. -* ``Requires-Dist: zope.interface (3.1.0)``: any version that starts with - 3.1.0, excluding pre-releases. Since that particular project doesn't - use more than 3 digits, it also means "only the 3.1.0 release". -* ``Requires-Python: 3``: Any Python 3 version, excluding pre-releases. -* ``Requires-Python: >=2.6,<3``: Any version of Python 2.6 or 2.7, including - post-releases (if they were used for Python). It excludes pre releases of - Python 3. -* ``Requires-Python: 2.6.2``: Equivalent to ">=2.6.2,<2.6.3". So this includes - only Python 2.6.2. Of course, if Python was numbered with 4 digits, it would - include all versions of the 2.6.2 series, excluding pre-releases. -* ``Requires-Python: 2.5``: Equivalent to ">=2.5,<2.6". -* ``Requires-Dist: zope.interface (3.1,!=3.1.3)``: any version that starts - with 3.1, excluding pre-releases of 3.1 *and* excluding any version that - starts with "3.1.3". For this particular project, this means: "any version - of the 3.1 series but not 3.1.3". This is equivalent to: - ">=3.1,!=3.1.3,<3.2". -* ``Requires-Python: >=3.3a1``: Any version of Python 3.3+, including +* ``Requires-Python: 3.3a1``: Any version of Python 3.3+, including pre-releases like 3.4a1. @@ -1439,10 +1474,10 @@ The previous interpretation of version specifiers made it very easy to accidentally download a pre-release version of a dependency. This in turn made it difficult for developers to publish pre-release versions -of software to the Python Package Index, as leaving the package set as -public would lead to users inadvertently downloading pre-release software, -while hiding it would defeat the purpose of publishing it for user -testing. +of software to the Python Package Index, as even marking the package as +hidden wasn't enough to keep automated tools from downloading it, and also +made it harder for users to obtain the test release manually through the +main PyPI web interface. The previous interpretation also excluded post-releases from some version specifiers for no adequately justified reason. @@ -1451,6 +1486,16 @@ accept a pre-release version as satisfying a dependency, while allowing pre-release versions to be explicitly requested when needed. +The "some forward compatibility assumed" default version constraint is +taken directly from the Ruby community's "pessimistic version constraint" +operator [4]_ to allow projects to take a cautious approach to forward +compatibility promises, while still easily setting a minimum required +version for their dependencies. It is made the default behaviour rather +than needing a separate operator in order to explicitly discourage +overspecification of dependencies by library developers. The explicit +comparison operators remain available to cope with dependencies with +unreliable or non-existent backwards compatibility policies. + Packaging, build and installation dependencies ---------------------------------------------- @@ -1548,6 +1593,9 @@ .. [3] Version compatibility analysis script: http://hg.python.org/peps/file/default/pep-0426/pepsort.py +.. [4] Pessimistic version constraint + http://docs.rubygems.org/read/chapter/16 + Appendix A ========== diff --git a/pep-0427.txt b/pep-0427.txt --- a/pep-0427.txt +++ b/pep-0427.txt @@ -101,6 +101,15 @@ accompanying .exe wrappers. Windows installers may want to add them during install. +Recommended archiver features +''''''''''''''''''''''''''''' + +Place ``.dist-info`` at the end of the archive. + Archivers are encouraged to place the ``.dist-info`` files physically + at the end of the archive. This enables some potentially interesting + ZIP tricks including the ability to amend the metadata without + rewriting the entire archive. + File Format ----------- @@ -149,9 +158,14 @@ re.sub("[^\w\d.]+", "_", distribution, re.UNICODE) -The filename is Unicode. It will be some time before the tools are -updated to support non-ASCII filenames, but they are supported in this -specification. +The archive filename is Unicode. It will be some time before the tools +are updated to support non-ASCII filenames, but they are supported in +this specification. + +The filenames *inside* the archive are encoded as UTF-8. Although some +ZIP clients in common use do not properly display UTF-8 filenames, +the encoding is supported by both the ZIP specification and Python's +``zipfile``. File contents ''''''''''''' diff --git a/pep-0428.txt b/pep-0428.txt --- a/pep-0428.txt +++ b/pep-0428.txt @@ -55,6 +55,15 @@ .. _`Unipath`: https://bitbucket.org/sluggo/unipath/overview +Implementation +============== + +The implementation of this proposal is tracked in the ``pep428`` branch +of pathlib's `Mercurial repository`_. + +.. _`Mercurial repository`: https://bitbucket.org/pitrou/pathlib/ + + Why an object-oriented API ========================== @@ -341,6 +350,15 @@ >>> bytes(p) b'/home/antoine/pathlib/setup.py' +To represent the path as a ``file`` URI, call the ``as_uri()`` method:: + + >>> p = PurePosixPath('/etc/passwd') + >>> p.as_uri() + 'file:///etc/passwd' + >>> p = PureNTPath('c:/Windows') + >>> p.as_uri() + 'file:///c:/Windows' + Properties ---------- diff --git a/pep-0435.txt b/pep-0435.txt new file mode 100644 --- /dev/null +++ b/pep-0435.txt @@ -0,0 +1,542 @@ +PEP: 435 +Title: Adding an Enum type to the Python standard library +Version: $Revision$ +Last-Modified: $Date$ +Author: Barry Warsaw , + Eli Bendersky +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 2013-02-23 +Python-Version: 3.4 +Post-History: 2013-02-23 + + +Abstract +======== + +This PEP proposes adding an enumeration type to the Python standard library. +Specifically, it proposes moving the existing ``flufl.enum`` package by Barry +Warsaw into the standard library. Much of this PEP is based on the "using" +[1]_ document from the documentation of ``flufl.enum``. + +An enumeration is a set of symbolic names bound to unique, constant integer +values. Within an enumeration, the values can be compared by identity, and the +enumeration itself can be iterated over. Enumeration items can be converted to +and from their integer equivalents, supporting use cases such as storing +enumeration values in a database. + + +Status of discussions +===================== + +The idea of adding an enum type to Python is not new - PEP 354 [2]_ is a +previous attempt that was rejected in 2005. Recently a new set of discussions +was initiated [3]_ on the ``python-ideas`` mailing list. Many new ideas were +proposed in several threads; after a lengthy discussion Guido proposed adding +``flufl.enum`` to the standard library [4]_. This PEP is an attempt to +formalize this decision as well as discuss a number of variations that can be +considered for inclusion. + + +Motivation +========== + +*[Based partly on the Motivation stated in PEP 354]* + +The properties of an enumeration are useful for defining an immutable, related +set of constant values that have a defined sequence but no inherent semantic +meaning. Classic examples are days of the week (Sunday through Saturday) and +school assessment grades ('A' through 'D', and 'F'). Other examples include +error status values and states within a defined process. + +It is possible to simply define a sequence of values of some other basic type, +such as ``int`` or ``str``, to represent discrete arbitrary values. However, +an enumeration ensures that such values are distinct from any others including, +importantly, values within other enumerations, and that operations without +meaning ("Wednesday times two") are not defined for these values. It also +provides a convenient printable representation of enum values without requiring +tedious repetition while defining them (i.e. no ``GREEN = 'green'``). + + +Module and type name +==================== + +We propose to add a module named ``enum`` to the standard library. The main +type exposed by this module is ``Enum``. Hence, to import the ``Enum`` type +user code will run:: + + >>> from enum import Enum + + +Proposed semantics for the new enumeration type +=============================================== + +Creating an Enum +---------------- + +Enumerations are created using the class syntax, which makes them easy to read +and write. Every enumeration value must have a unique integer value and the +only restriction on their names is that they must be valid Python identifiers. +To define an enumeration, derive from the ``Enum`` class and add attributes +with assignment to their integer values:: + + >>> from enum import Enum + >>> class Colors(Enum): + ... red = 1 + ... green = 2 + ... blue = 3 + +Enumeration values are compared by identity:: + + >>> Colors.red is Colors.red + True + >>> Colors.blue is Colors.blue + True + >>> Colors.red is not Colors.blue + True + >>> Colors.blue is Colors.red + False + +Enumeration values have nice, human readable string representations:: + + >>> print(Colors.red) + Colors.red + +...while their repr has more information:: + + >>> print(repr(Colors.red)) + + +The enumeration value names are available through the class members:: + + >>> for member in Colors.__members__: + ... print(member) + red + green + blue + +Let's say you wanted to encode an enumeration value in a database. You might +want to get the enumeration class object from an enumeration value:: + + >>> cls = Colors.red.enum + >>> print(cls.__name__) + Colors + +Enums also have a property that contains just their item name:: + + >>> print(Colors.red.name) + red + >>> print(Colors.green.name) + green + >>> print(Colors.blue.name) + blue + +The str and repr of the enumeration class also provides useful information:: + + >>> print(Colors) + + >>> print(repr(Colors)) + + +You can extend previously defined Enums by subclassing:: + + >>> class MoreColors(Colors): + ... pink = 4 + ... cyan = 5 + +When extended in this way, the base enumeration's values are identical to the +same named values in the derived class:: + + >>> Colors.red is MoreColors.red + True + >>> Colors.blue is MoreColors.blue + True + +However, these are not doing comparisons against the integer equivalent +values, because if you define an enumeration with similar item names and +integer values, they will not be identical:: + + >>> class OtherColors(Enum): + ... red = 1 + ... blue = 2 + ... yellow = 3 + >>> Colors.red is OtherColors.red + False + >>> Colors.blue is not OtherColors.blue + True + +These enumeration values are not equal, nor do they hash equally:: + + >>> Colors.red == OtherColors.red + False + >>> len(set((Colors.red, OtherColors.red))) + 2 + +Ordered comparisons between enumeration values are *not* supported. Enums are +not integers:: + + >>> Colors.red < Colors.blue + Traceback (most recent call last): + ... + NotImplementedError + >>> Colors.red <= Colors.blue + Traceback (most recent call last): + ... + NotImplementedError + >>> Colors.blue > Colors.green + Traceback (most recent call last): + ... + NotImplementedError + >>> Colors.blue >= Colors.green + Traceback (most recent call last): + ... + NotImplementedError + +Equality comparisons are defined though:: + + >>> Colors.blue == Colors.blue + True + >>> Colors.green != Colors.blue + True + +Enumeration values do not support ordered comparisons:: + + >>> Colors.red < Colors.blue + Traceback (most recent call last): + ... + NotImplementedError + >>> Colors.red < 3 + Traceback (most recent call last): + ... + NotImplementedError + >>> Colors.red <= 3 + Traceback (most recent call last): + ... + NotImplementedError + >>> Colors.blue > 2 + Traceback (most recent call last): + ... + NotImplementedError + >>> Colors.blue >= 2 + Traceback (most recent call last): + ... + NotImplementedError + +While equality comparisons are allowed, comparisons against non-enumeration +values will always compare not equal:: + + >>> Colors.green == 2 + False + >>> Colors.blue == 3 + False + >>> Colors.green != 3 + True + >>> Colors.green == 'green' + False + +If you really want the integer equivalent values, you can convert enumeration +values explicitly using the ``int()`` built-in. This is quite convenient for +storing enums in a database, as well as for interoperability with C extensions +that expect integers:: + + >>> int(Colors.red) + 1 + >>> int(Colors.green) + 2 + >>> int(Colors.blue) + 3 + +You can also convert back to the enumeration value by calling the Enum +subclass, passing in the integer value for the item you want:: + + >>> Colors(1) + + >>> Colors(2) + + >>> Colors(3) + + >>> Colors(1) is Colors.red + True + +The Enum subclass also accepts the string name of the enumeration value:: + + >>> Colors('red') + + >>> Colors('blue') is Colors.blue + True + +You get exceptions though, if you try to use invalid arguments:: + + >>> Colors('magenta') + Traceback (most recent call last): + ... + ValueError: magenta + >>> Colors(99) + Traceback (most recent call last): + ... + ValueError: 99 + +The Enum base class also supports getitem syntax, exactly equivalent to the +class's call semantics:: + + >>> Colors[1] + + >>> Colors[2] + + >>> Colors[3] + + >>> Colors[1] is Colors.red + True + >>> Colors['red'] + + >>> Colors['blue'] is Colors.blue + True + >>> Colors['magenta'] + Traceback (most recent call last): + ... + ValueError: magenta + >>> Colors[99] + Traceback (most recent call last): + ... + ValueError: 99 + +The integer equivalent values serve another purpose. You may not define two +enumeration values with the same integer value:: + + >>> class Bad(Enum): + ... cartman = 1 + ... stan = 2 + ... kyle = 3 + ... kenny = 3 # Oops! + ... butters = 4 + Traceback (most recent call last): + ... + TypeError: Multiple enum values: 3 + +You also may not duplicate values in derived enumerations:: + + >>> class BadColors(Colors): + ... yellow = 4 + ... chartreuse = 2 # Oops! + Traceback (most recent call last): + ... + TypeError: Multiple enum values: 2 + +The Enum class support iteration. Enumeration values are returned in the +sorted order of their integer equivalent values:: + + >>> [v.name for v in MoreColors] + ['red', 'green', 'blue', 'pink', 'cyan'] + >>> [int(v) for v in MoreColors] + [1, 2, 3, 4, 5] + +Enumeration values are hashable, so they can be used in dictionaries and sets:: + + >>> apples = {} + >>> apples[Colors.red] = 'red delicious' + >>> apples[Colors.green] = 'granny smith' + >>> for color in sorted(apples, key=int): + ... print(color.name, '->', apples[color]) + red -> red delicious + green -> granny smith + + +Pickling +-------- + +Enumerations created with the class syntax can also be pickled and unpickled:: + + >>> from enum.tests.fruit import Fruit + >>> from pickle import dumps, loads + >>> Fruit.tomato is loads(dumps(Fruit.tomato)) + True + + +Convenience API +--------------- + +You can also create enumerations using the convenience function ``make()``, +which takes an iterable object or dictionary to provide the item names and +values. ``make()`` is a module-level function. + +The first argument to ``make()`` is the name of the enumeration, and it returns +the so-named `Enum` subclass. The second argument is a *source* which can be +either an iterable or a dictionary. In the most basic usage, *source* returns +a sequence of strings which name the enumeration items. In this case, the +values are automatically assigned starting from 1:: + + >>> import enum + >>> enum.make('Animals', ('ant', 'bee', 'cat', 'dog')) + + +The items in source can also be 2-tuples, where the first item is the +enumeration value name and the second is the integer value to assign to the +value. If 2-tuples are used, all items must be 2-tuples:: + + >>> def enumiter(): + ... start = 1 + ... while True: + ... yield start + ... start <<= 1 + >>> enum.make('Flags', zip(list('abcdefg'), enumiter())) + + + +Proposed variations +=================== + +Some variations were proposed during the discussions in the mailing list. +Here's some of the more popular ones. + + +Not having to specify values for enums +-------------------------------------- + +Michael Foord proposed (and Tim Delaney provided a proof-of-concept +implementation) to use metaclass magic that makes this possible:: + + class Color(Enum): + red, green, blue + +The values get actually assigned only when first looked up. + +Pros: cleaner syntax that requires less typing for a very common task (just +listing enumeration names without caring about the values). + +Cons: involves much magic in the implementation, which makes even the +definition of such enums baffling when first seen. Besides, explicit is +better than implicit. + + +Using special names or forms to auto-assign enum values +------------------------------------------------------- + +A different approach to avoid specifying enum values is to use a special name +or form to auto assign them. For example:: + + class Color(Enum): + red = None # auto-assigned to 0 + green = None # auto-assigned to 1 + blue = None # auto-assigned to 2 + +More flexibly:: + + class Color(Enum): + red = 7 + green = None # auto-assigned to 8 + blue = 19 + purple = None # auto-assigned to 20 + +Some variations on this theme: + +#. A special name ``auto`` imported from the enum package. +#. Georg Brandl proposed ellipsis (``...``) instead of ``None`` to achieve the + same effect. + +Pros: no need to manually enter values. Makes it easier to change the enum and +extend it, especially for large enumerations. + +Cons: actually longer to type in many simple cases. The argument of explicit +vs. implicit applies here as well. + + +Use-cases in the standard library +================================= + +The Python standard library has many places where the usage of enums would be +beneficial to replace other idioms currently used to represent them. Such +usages can be divided to two categories: user-code facing constants, and +internal constants. + +User-code facing constants like ``os.SEEK_*``, ``socket`` module constants, +decimal rounding modes, HTML error codes could benefit from being enums had +they been implemented this way from the beginning. At this point, however, at +the risk of breaking user code (that relies on the constants' actual values +rather than their meaning) such a change cannot be made. This does not mean +that future uses in the stdlib can't use an enum for defining new user-code +facing constants. + +Internal constants are not seen by user code but are employed internally by +stdlib modules. It appears that nothing should stand in the way of +implementing such constants with enums. Some examples uncovered by a very +partial skim through the stdlib: ``binhex``, ``imaplib``, ``http/client``, +``urllib/robotparser``, ``idlelib``, ``concurrent.futures``, ``turtledemo``. + +In addition, looking at the code of the Twisted library, there are many use +cases for replacing internal state constants with enums. The same can be said +about a lot of networking code (especially implementation of protocols) and +can be seen in test protocols written with the Tulip library as well. + + +Differences from PEP 354 +======================== + +Unlike PEP 354, enumeration values are not defined as a sequence of strings, +but as attributes of a class. This design was chosen because it was felt that +class syntax is more readable. + +Unlike PEP 354, enumeration values require an explicit integer value. This +difference recognizes that enumerations often represent real-world values, or +must interoperate with external real-world systems. For example, to store an +enumeration in a database, it is better to convert it to an integer on the way +in and back to an enumeration on the way out. Providing an integer value also +provides an explicit ordering. However, there is no automatic conversion to +and from the integer values, because explicit is better than implicit. + +Unlike PEP 354, this implementation does use a metaclass to define the +enumeration's syntax, and allows for extended base-enumerations so that the +common values in derived classes are identical (a singleton model). While PEP +354 dismisses this approach for its complexity, in practice any perceived +complexity, though minimal, is hidden from users of the enumeration. + +Unlike PEP 354, enumeration values can only be tested by identity comparison. +This is to emphasize the fact that enumeration values are singletons, much +like ``None``. + + +Acknowledgments +=============== + +This PEP describes the ``flufl.enum`` package by Barry Warsaw. ``flufl.enum`` +is based on an example by Jeremy Hylton. It has been modified and extended +by Barry Warsaw for use in the GNU Mailman [5]_ project. Ben Finney is the +author of the earlier enumeration PEP 354. + + +References +========== + +.. [1] http://pythonhosted.org/flufl.enum/docs/using.html +.. [2] http://www.python.org/dev/peps/pep-0354/ +.. [3] http://mail.python.org/pipermail/python-ideas/2013-January/019003.html +.. [4] http://mail.python.org/pipermail/python-ideas/2013-February/019373.html +.. [5] http://www.list.org + + +Copyright +========= + +This document has been placed in the public domain. + + +Todo +==== + + * Mark PEP 354 "superseded by" this one, if accepted + * New package name within stdlib - enum? (top-level) + * For make, can we add an API like namedtuple's? + make('Animals, 'ant bee cat dog') + I.e. when make sees a string argument it splits it, making it similar to a + tuple but with far less manual quote typing. OTOH, it just saves a ".split" + so may not be worth the effort ? + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: + diff --git a/pep-0436.txt b/pep-0436.txt new file mode 100644 --- /dev/null +++ b/pep-0436.txt @@ -0,0 +1,480 @@ +PEP: 436 +Title: The Argument Clinic DSL +Version: $Revision$ +Last-Modified: $Date$ +Author: Larry Hastings +Discussions-To: Python-Dev +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 22-Feb-2013 + + +Abstract +======== + +This document proposes "Argument Clinic", a DSL designed to facilitate +argument processing for built-in functions in the implementation of +CPython. + + +Rationale and Goals +=================== + +The primary implementation of Python, "CPython", is written in a +mixture of Python and C. One of the implementation details of CPython +is what are called "built-in" functions -- functions available to +Python programs but written in C. When a Python program calls a +built-in function and passes in arguments, those arguments must be +translated from Python values into C values. This process is called +"parsing arguments". + +As of CPython 3.3, arguments to functions are primarily parsed with +one of two functions: the original ``PyArg_ParseTuple()``, [1]_ and +the more modern ``PyArg_ParseTupleAndKeywords()``. [2]_ The former +function only handles positional parameters; the latter also +accommodates keyword and keyword-only parameters, and is preferred for +new code. + +``PyArg_ParseTuple()`` was a reasonable approach when it was first +conceived. The programmer specified the translation for the arguments +in a "format string": [3]_ each parameter matched to a "format unit", +a one-or-two character sequence telling ``PyArg_ParseTuple()`` what +Python types to accept and how to translate them into the appropriate +C value for that parameter. There were only a dozen or so of these +"format units", and each one was distinct and easy to understand. + +Over the years the ``PyArg_Parse`` interface has been extended in +numerous ways. The modern API is quite complex, to the point that it +is somewhat painful to use. Consider: + + * There are now forty different "format units"; a few are even three + characters long. This makes it difficult to understand what the + format string says without constantly cross-indexing it with the + documentation. + * There are also six meta-format units that may be buried in the + format string. (They are: ``"()|$:;"``.) + * The more format units are added, the less likely it is the + implementer can pick an easy-to-use mnemonic for the format unit, + because the character of choice is probably already in use. In + other words, the more format units we have, the more obtuse the + format units become. + * Several format units are nearly identical to others, having only + subtle differences. This makes understanding the exact semantics + of the format string even harder. + * The docstring is specified as a static C string, which is mildly + bothersome to read and edit. + * When adding a new parameter to a function using + ``PyArg_ParseTupleAndKeywords()``, it's necessary to touch six + different places in the code: [4]_ + + * Declaring the variable to store the argument. + * Passing in a pointer to that variable in the correct spot in + ``PyArg_ParseTupleAndKeywords()``, also passing in any + "length" or "converter" arguments in the correct order. + * Adding the name of the argument in the correct spot of the + "keywords" array passed in to + ``PyArg_ParseTupleAndKeywords()``. + * Adding the format unit to the correct spot in the format + string. + * Adding the parameter to the prototype in the docstring. + * Documenting the parameter in the docstring. + + * There is currently no mechanism for builtin functions to provide + their "signature" information (see ``inspect.getfullargspec`` and + ``inspect.Signature``). Adding this information using a mechanism + similar to the existing ``PyArg_Parse`` functions would require + repeating ourselves yet again. + +The goal of Argument Clinic is to replace this API with a mechanism +inheriting none of these downsides: + + * You need specify each parameter only once. + * All information about a parameter is kept together in one place. + * For each parameter, you specify its type in C; Argument Clinic + handles the translation from Python value into C value for you. + * Argument Clinic also allows for fine-tuning of argument processing + behavior with highly-readable "flags", both per-parameter and + applying across the whole function. + * Docstrings are written in plain text. + * From this, Argument Clinic generates for you all the mundane, + repetitious code and data structures CPython needs internally. + Once you've specified the interface, the next step is simply to + write your implementation using native C types. Every detail of + argument parsing is handled for you. + +Future goals of Argument Clinic include: + + * providing signature information for builtins, and + * speed improvements to the generated code. + + +DSL Syntax Summary +================== + +The Argument Clinic DSL is specified as a comment embedded in a C +file, as follows. The "Example" column on the right shows you sample +input to the Argument Clinic DSL, and the "Section" column on the left +specifies what each line represents in turn. + +:: + + +-----------------------+-----------------------------------------------------+ + | Section | Example | + +-----------------------+-----------------------------------------------------+ + | Clinic DSL start | /*[clinic] | + | Function declaration | module.function_name -> return_annotation | + | Function flags | flag flag2 flag3=value | + | Parameter declaration | type name = default | + | Parameter flags | flag flag2 flag3=value | + | Parameter docstring | Lorem ipsum dolor sit amet, consectetur | + | | adipisicing elit, sed do eiusmod tempor | + | Function docstring | Lorem ipsum dolor sit amet, consectetur adipisicing | + | | elit, sed do eiusmod tempor incididunt ut labore et | + | Clinic DSL end | [clinic]*/ | + | Clinic output | ... | + | Clinic output end | /*[clinic end output:]*/ | + +-----------------------+-----------------------------------------------------+ + + +General Behavior Of the Argument Clinic DSL +------------------------------------------- + +All lines support ``#`` as a line comment delimiter *except* +docstrings. Blank lines are always ignored. + +Like Python itself, leading whitespace is significant in the Argument +Clinic DSL. The first line of the "function" section is the +declaration; all subsequent lines at the same indent are function +flags. Once you indent, the first line is a parameter declaration; +subsequent lines at that indent are parameter flags. Indent one more +time for the lines of the parameter docstring. Finally, dedent back +to the same level as the function declaration for the function +docstring. + + +Function Declaration +-------------------- + +The return annotation is optional. If skipped, the arrow ("``->``") +must also be omitted. + + +Parameter Declaration +--------------------- + +The "type" is a C type. If it's a pointer type, you must specify a +single space between the type and the "``*``", and zero spaces between +the "``*``" and the name. (e.g. "``PyObject *foo``", not "``PyObject* +foo``") + +The "name" must be a legal C identifier. + +The "default" is a Python value. Default values are optional; if not +specified you must omit the equals sign too. Parameters which don't +have a default are implicitly required. The default value is +dynamically assigned, "live" in the generated C code, and although +it's specified as a Python value, it's translated into a native C +value in the generated C code. + +It's explicitly permitted to end the parameter declaration line with a +semicolon, though the semicolon is optional. This is intended to +allow directly cutting and pasting in declarations from C code. +However, the preferred style is without the semicolon. + + +Flags +----- + +"Flags" are like "``make -D``" arguments. They're unordered. Flags +lines are parsed much like the shell (specifically, using +``shlex.split()`` [5]_ ). You can have as many flag lines as you +like. Specifying a flag twice is currently an error. + +Supported flags for functions: + +``basename`` + The basename to use for the generated C functions. By default this + is the name of the function from the DSL, only with periods replaced + by underscores. + +``positional-only`` + This function only supports positional parameters, not keyword + parameters. See `Functions With Positional-Only Parameters`_ below. + +Supported flags for parameters: + +``bitwise`` + If the Python integer passed in is signed, copy the bits directly + even if it is negative. Only valid for unsigned integer types. + +``converter`` + Backwards-compatibility support for parameter "converter" + functions. [6]_ The value should be the name of the converter + function in C. Only valid when the type of the parameter is + ``void *``. + +``default`` + The Python value to use in place of the parameter's actual default + in Python contexts. Specifically, when specified, this value will + be used for the parameter's default in the docstring, and in the + ``Signature``. (TBD: If the string is a valid Python expression + which can be rendered into a Python value using ``eval()``, then the + result of ``eval()`` on it will be used as the default in the + ``Signature``.) Ignored if there is no default. + +``encoding`` + Encoding to use when encoding a Unicode string to a ``char *``. + Only valid when the type of the parameter is ``char *``. + +``group=`` + This parameter is part of a group of options that must either all be + specified or none specified. Parameters in the same "group" must be + contiguous. The value of the group flag is the name used for the + group variable, and therefore must be legal as a C identifier. Only + valid for functions marked "``positional-only``"; see `Functions + With Positional-Only Parameters`_ below. + +``immutable`` + Only accept immutable values. + +``keyword-only`` + This parameter (and all subsequent parameters) is keyword-only. + Keyword-only parameters must also be optional parameters. Not valid + for positional-only functions. + +``length`` + This is an iterable type, and we also want its length. The DSL will + generate a second ``Py_ssize_t`` variable; its name will be this + parameter's name appended with "``_length``". + +``nullable`` + ``None`` is a legal argument for this parameter. If ``None`` is + supplied on the Python side, the equivalent C argument will be + ``NULL``. Only valid for pointer types. + +``required`` + Normally any parameter that has a default value is automatically + optional. A parameter that has "required" set will be considered + required (non-optional) even if it has a default value. The + generated documentation will also not show any default value. + +``types`` + Space-separated list of acceptable Python types for this object. + There are also four special-case types which represent Python + protocols: + + * buffer + * mapping + * number + * sequence + +``zeroes`` + This parameter is a string type, and its value should be allowed to + have embedded zeroes. Not valid for all varieties of string + parameters. + + +Python Code +----------- + +Argument Clinic also permits embedding Python code inside C files, +which is executed in-place when Argument Clinic processes the file. +Embedded code looks like this: + +:: + + /*[python] + + # this is python code! + print("/" + "* Hello world! *" + "/") + + [python]*/ + +Any Python code is valid. Python code sections in Argument Clinic can +also be used to modify Clinic's behavior at runtime; for example, see +`Extending Argument Clinic`_. + + +Output +====== + +Argument Clinic writes its output in-line in the C file, immediately +after the section of Clinic code. For "python" sections, the output +is everything printed using ``builtins.print``. For "clinic" +sections, the output is valid C code, including: + + * a ``#define`` providing the correct ``methoddef`` structure for the + function + * a prototype for the "impl" function -- this is what you'll write + to implement this function + * a function that handles all argument processing, which calls your + "impl" function + * the definition line of the "impl" function + * and a comment indicating the end of output. + +The intention is that you will write the body of your impl function +immediately after the output -- as in, you write a left-curly-brace +immediately after the end-of-output comment and write the +implementation of the builtin in the body there. (It's a bit strange +at first, but oddly convenient.) + +Argument Clinic will define the parameters of the impl function for +you. The function will take the "self" parameter passed in +originally, all the parameters you define, and possibly some extra +generated parameters ("length" parameters; also "group" parameters, +see next section). + +Argument Clinic also writes a checksum for the output section. This +is a valuable safety feature: if you modify the output by hand, Clinic +will notice that the checksum doesn't match, and will refuse to +overwrite the file. (You can force Clinic to overwrite with the +"``-f``" command-line argument; Clinic will also ignore the checksums +when using the "``-o``" command-line argument.) + + +Functions With Positional-Only Parameters +========================================= + +A significant fraction of Python builtins implemented in C use the +older positional-only API for processing arguments +(``PyArg_ParseTuple()``). In some instances, these builtins parse +their arguments differently based on how many arguments were passed +in. This can provide some bewildering flexibility: there may be +groups of optional parameters, which must either all be specified or +none specified. And occasionally these groups are on the *left!* (For +example: ``curses.window.addch()``.) + +Argument Clinic supports these legacy use-cases with a special set of +flags. First, set the flag "``positional-only``" on the entire +function. Then, for every group of parameters that is collectively +optional, add a "``group=``" flag with a unique string to all the +parameters in that group. Note that these groups are permitted on the +right *or left* of any required parameters! However, all groups +(including the group of required parameters) must be contiguous. + +The impl function generated by Clinic will add an extra parameter for +every group, "``int _group``". This argument will be nonzero +if the group was specified on this call, and zero if it was not. + +Note that when operating in this mode, you cannot specify default +arguments. You can simulate defaults by putting parameters in +individual groups and detecting whether or not they were specified; +generally speaking it's better to simply not use "positional-only" +where it isn't absolutely necessary. (TBD: It might be possible to +relax this restriction. But adding default arguments into the mix of +groups would seemingly make calculating which groups are active a good +deal harder.) + +Also, note that it's possible to specify a set of groups to a function +such that there are several valid mappings from the number of +arguments to a valid set of groups. If this happens, Clinic will exit +with an error message. This should not be a problem, as +positional-only operation is only intended for legacy use cases, and +all the legacy functions using this quirky behavior should have +unambiguous mappings. + + +Current Status +============== + +As of this writing, there is a working prototype implementation of +Argument Clinic available online. [7]_ The prototype implements the +syntax above, and generates code using the existing ``PyArg_Parse`` +APIs. It supports translating to all current format units except +``"w*"``. Sample functions using Argument Clinic exercise all major +features, including positional-only argument parsing. + + +Extending Argument Clinic +------------------------- + +The prototype also currently provides an experimental extension +mechanism, allowing adding support for new types on-the-fly. See +``Modules/posixmodule.c`` in the prototype for an example of its use. + + +Notes / TBD +=========== + +* Guido proposed having the "function docstring" be hand-written inline, + in the middle of the output, something like this: + + :: + + /*[clinic] + ... prototype and parameters (including parameter docstrings) go here + [clinic]*/ + ... some output ... + /*[clinic docstring start]*/ + ... hand-edited function docstring goes here <-- you edit this by hand! + /*[clinic docstring end]*/ + ... more output + /*[clinic output end]*/ + + I tried it this way and don't like it -- I think it's clumsy. I + prefer that everything you write goes in one place, rather than + having an island of hand-edited stuff in the middle of the DSL + output. + +* Do we need to support tuple unpacking? (The "``(OOO)``" style + format string.) Boy I sure hope not. + +* What about Python functions that take no arguments? This syntax + doesn't provide for that. Perhaps a lone indented "None" should + mean "no arguments"? + +* This approach removes some dynamism / flexibility. With the + existing syntax one could theoretically pass in different encodings + at runtime for the "``es``"/"``et``" format units. AFAICT CPython + doesn't do this itself, however it's possible external users might + do this. (Trivia: there are no uses of "``es``" exercised by + regrtest, and all the uses of "``et``" exercised are in + socketmodule.c, except for one in _ssl.c. They're all static, + specifying the encoding ``"idna"``.) + +* Right now the "basename" flag on a function changes the ``#define + methoddef`` name too. Should it, or should the #define'd methoddef + name always be ``{module_name}_{function_name}`` ? + + +References +========== + +.. [1] ``PyArg_ParseTuple()``: + http://docs.python.org/3/c-api/arg.html#PyArg_ParseTuple + +.. [2] ``PyArg_ParseTupleAndKeywords()``: + http://docs.python.org/3/c-api/arg.html#PyArg_ParseTupleAndKeywords + +.. [3] ``PyArg_`` format units: + http://docs.python.org/3/c-api/arg.html#strings-and-buffers + +.. [4] Keyword parameters for extension functions: + http://docs.python.org/3/extending/extending.html#keyword-parameters-for-extension-functions + +.. [5] ``shlex.split()``: + http://docs.python.org/3/library/shlex.html#shlex.split + +.. [6] ``PyArg_`` "converter" functions, see ``"O&"`` in this section: + http://docs.python.org/3/c-api/arg.html#other-objects + +.. [7] Argument Clinic prototype: + https://bitbucket.org/larry/python-clinic/ + + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: -- Repository URL: http://hg.python.org/peps From solipsis at pitrou.net Wed Mar 6 05:56:24 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 06 Mar 2013 05:56:24 +0100 Subject: [Python-checkins] Daily reference leaks (b87e9b8dc9ad): sum=12 Message-ID: results for b87e9b8dc9ad on branch "default" -------------------------------------------- test_support leaked [0, 0, -1] references, sum=-1 test_capi leaked [1, 1, 1] references, sum=3 test_capi leaked [2, 4, 4] memory blocks, sum=10 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogjYSFNG', '-x'] From python-checkins at python.org Wed Mar 6 10:32:46 2013 From: python-checkins at python.org (terry.reedy) Date: Wed, 6 Mar 2013 10:32:46 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?devguide=3A_Update_link_for_Visual_C+?= =?utf-8?q?+_Express_2010=2E_Old_link_gets_forwarded_to_2012_page=2E?= Message-ID: <3ZLVBQ1r8kzSgC@mail.python.org> http://hg.python.org/devguide/rev/e9fc41c11f6b changeset: 605:e9fc41c11f6b user: Terry Jan Reedy date: Wed Mar 06 04:29:49 2013 -0500 summary: Update link for Visual C++ Express 2010. Old link gets forwarded to 2012 page. files: setup.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/setup.rst b/setup.rst --- a/setup.rst +++ b/setup.rst @@ -188,7 +188,7 @@ **Python 3.3** and later use Microsoft Visual Studio 2010. You can download Microsoft Visual C++ 2010 Express `from Microsoft's site -`_. +`_. Most Python versions prior to 3.3 use Microsoft Visual Studio 2008. You can download Microsoft Visual C++ 2008 Express Edition with SP1 -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Wed Mar 6 11:35:13 2013 From: python-checkins at python.org (terry.reedy) Date: Wed, 6 Mar 2013 11:35:13 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?devguide=3A_Add_link_for_VC++_2010_to?= =?utf-8?q?_one_for_2008=2E_Hide_both_urls_with_text_labels=2E?= Message-ID: <3ZLWZT4jhBz7Lpr@mail.python.org> http://hg.python.org/devguide/rev/1a2b7409e897 changeset: 606:1a2b7409e897 user: Terry Jan Reedy date: Wed Mar 06 05:34:42 2013 -0500 summary: Add link for VC++ 2010 to one for 2008. Hide both urls with text labels. files: setup.rst | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.rst b/setup.rst --- a/setup.rst +++ b/setup.rst @@ -199,8 +199,10 @@ checkout contains the build files for the Python version you are building. The full version of Visual Studio is not necessary for common tasks with 32-bit builds; the gratis C++ Express versions linked above are sufficient. -The limitations of the Express versions are given at -http://msdn.microsoft.com/en-us/library/hs24szh9%28v=VS.90%29.aspx . +Their limitations are given `here (2008) +`_ +and `here (2010) +`_. To build from the Visual Studio GUI, open the ``pcbuild.sln`` solution file with Visual Studio. Choose the :menuselection:`Build Solution` option -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Wed Mar 6 11:37:33 2013 From: python-checkins at python.org (terry.reedy) Date: Wed, 6 Mar 2013 11:37:33 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?devguide=3A_Add_self_for_idlelib?= Message-ID: <3ZLWd973LBzQjJ@mail.python.org> http://hg.python.org/devguide/rev/4eec85c5226a changeset: 607:4eec85c5226a user: Terry Jan Reedy date: Wed Mar 06 05:37:12 2013 -0500 summary: Add self for idlelib files: experts.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/experts.rst b/experts.rst --- a/experts.rst +++ b/experts.rst @@ -123,7 +123,7 @@ hmac html ezio.melotti http -idlelib kbk +idlelib kbk, terry.reedy imaplib imghdr imp -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Wed Mar 6 14:46:43 2013 From: python-checkins at python.org (eli.bendersky) Date: Wed, 6 Mar 2013 14:46:43 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_some_formatting?= Message-ID: <3ZLbqR65rhzN9V@mail.python.org> http://hg.python.org/cpython/rev/800875963e42 changeset: 82510:800875963e42 user: Eli Bendersky date: Wed Mar 06 05:45:57 2013 -0800 summary: Fix some formatting files: Modules/_ctypes/callproc.c | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -1078,9 +1078,10 @@ args[0].ffi_type = &ffi_type_pointer; args[0].value.p = pIunk; pa = &args[1]; - } else + } else { #endif pa = &args[0]; + } /* Convert the arguments */ for (i = 0; i < n; ++i, ++pa) { @@ -1096,9 +1097,7 @@ if (argtypes && argtype_count > i) { PyObject *v; converter = PyTuple_GET_ITEM(argtypes, i); - v = PyObject_CallFunctionObjArgs(converter, - arg, - NULL); + v = PyObject_CallFunctionObjArgs(converter, arg, NULL); if (v == NULL) { _ctypes_extend_error(PyExc_ArgError, "argument %d: ", i+1); goto cleanup; @@ -1175,9 +1174,10 @@ retval = PyErr_SetFromWindowsErr(*(int *)resbuf); else retval = PyLong_FromLong(*(int *)resbuf); - } else + } else { #endif retval = GetResult(restype, resbuf, checker); + } cleanup: for (i = 0; i < argcount; ++i) Py_XDECREF(args[i].keep); @@ -1313,9 +1313,9 @@ NULL, #endif FUNCFLAG_HRESULT, /* flags */ - argtypes, /* self->argtypes */ - NULL, /* self->restype */ - NULL); /* checker */ + argtypes, /* self->argtypes */ + NULL, /* self->restype */ + NULL); /* checker */ return result; } @@ -1480,9 +1480,9 @@ NULL, #endif FUNCFLAG_CDECL, /* flags */ - NULL, /* self->argtypes */ - NULL, /* self->restype */ - NULL); /* checker */ + NULL, /* self->argtypes */ + NULL, /* self->restype */ + NULL); /* checker */ return result; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 15:22:33 2013 From: python-checkins at python.org (eli.bendersky) Date: Wed, 6 Mar 2013 15:22:33 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_call=5Fcommethod_was_only_?= =?utf-8?q?used_in_samples/Windows=2C_which_no_longer_exists=2E?= Message-ID: <3ZLccn66Dzz7LqV@mail.python.org> http://hg.python.org/cpython/rev/9efbe60aeb08 changeset: 82511:9efbe60aeb08 user: Eli Bendersky date: Wed Mar 06 06:21:46 2013 -0800 summary: call_commethod was only used in samples/Windows, which no longer exists. This method is dead code - not documented, not tested. As far as we know, it can be horribly broken. files: Misc/NEWS | 3 + Modules/_ctypes/callproc.c | 57 -------------------------- 2 files changed, 3 insertions(+), 57 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -881,6 +881,9 @@ `sha3_256`, `sha3_384` and `sha3_512`. As part of the patch some common code was moved from _hashopenssl.c to hashlib.h. +- ctypes.call_commethod was removed, since its only usage was in the defunct + samples directory. + Extension Modules ----------------- diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -1263,62 +1263,6 @@ return Py_None; } -/* obsolete, should be removed */ -/* Only used by sample code (in samples\Windows\COM.py) */ -static PyObject * -call_commethod(PyObject *self, PyObject *args) -{ - IUnknown *pIunk; - int index; - PyObject *arguments; - PPROC *lpVtbl; - PyObject *result; - CDataObject *pcom; - PyObject *argtypes = NULL; - - if (!PyArg_ParseTuple(args, - "OiO!|O!", - &pcom, &index, - &PyTuple_Type, &arguments, - &PyTuple_Type, &argtypes)) - return NULL; - - if (argtypes && (PyTuple_GET_SIZE(arguments) != PyTuple_GET_SIZE(argtypes))) { - PyErr_Format(PyExc_TypeError, - "Method takes %d arguments (%d given)", - PyTuple_GET_SIZE(argtypes), PyTuple_GET_SIZE(arguments)); - return NULL; - } - - if (!CDataObject_Check(pcom) || (pcom->b_size != sizeof(void *))) { - PyErr_Format(PyExc_TypeError, - "COM Pointer expected instead of %s instance", - Py_TYPE(pcom)->tp_name); - return NULL; - } - - if ((*(void **)(pcom->b_ptr)) == NULL) { - PyErr_SetString(PyExc_ValueError, - "The COM 'this' pointer is NULL"); - return NULL; - } - - pIunk = (IUnknown *)(*(void **)(pcom->b_ptr)); - lpVtbl = (PPROC *)(pIunk->lpVtbl); - - result = _ctypes_callproc(lpVtbl[index], - arguments, -#ifdef MS_WIN32 - pIunk, - NULL, -#endif - FUNCFLAG_HRESULT, /* flags */ - argtypes, /* self->argtypes */ - NULL, /* self->restype */ - NULL); /* checker */ - return result; -} - static char copy_com_pointer_doc[] = "CopyComPointer(src, dst) -> HRESULT value\n"; @@ -1813,7 +1757,6 @@ {"FormatError", format_error, METH_VARARGS, format_error_doc}, {"LoadLibrary", load_library, METH_VARARGS, load_library_doc}, {"FreeLibrary", free_library, METH_VARARGS, free_library_doc}, - {"call_commethod", call_commethod, METH_VARARGS }, {"_check_HRESULT", check_hresult, METH_VARARGS}, #else {"dlopen", py_dl_open, METH_VARARGS, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 15:31:09 2013 From: python-checkins at python.org (eli.bendersky) Date: Wed, 6 Mar 2013 15:31:09 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_formatting_changes_tha?= =?utf-8?q?t_led_to_compilation_errors?= Message-ID: <3ZLcpj6KPfz7Lp8@mail.python.org> http://hg.python.org/cpython/rev/6bcec385d13d changeset: 82512:6bcec385d13d user: Eli Bendersky date: Wed Mar 06 06:30:23 2013 -0800 summary: Fix formatting changes that led to compilation errors files: Modules/_ctypes/callproc.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -1078,10 +1078,9 @@ args[0].ffi_type = &ffi_type_pointer; args[0].value.p = pIunk; pa = &args[1]; - } else { + } else #endif pa = &args[0]; - } /* Convert the arguments */ for (i = 0; i < n; ++i, ++pa) { @@ -1174,10 +1173,9 @@ retval = PyErr_SetFromWindowsErr(*(int *)resbuf); else retval = PyLong_FromLong(*(int *)resbuf); - } else { + } else #endif retval = GetResult(restype, resbuf, checker); - } cleanup: for (i = 0; i < argcount; ++i) Py_XDECREF(args[i].keep); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 15:51:26 2013 From: python-checkins at python.org (eli.bendersky) Date: Wed, 6 Mar 2013 15:51:26 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_Fix_doc_gramma?= =?utf-8?q?r_and_line_width?= Message-ID: <3ZLdG63pCkzSlY@mail.python.org> http://hg.python.org/cpython/rev/09222815097b changeset: 82513:09222815097b branch: 3.2 parent: 82507:4f9de1b18cab user: Eli Bendersky date: Wed Mar 06 06:48:57 2013 -0800 summary: Fix doc grammar and line width files: Doc/library/ctypes.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -569,8 +569,8 @@ ValueError: too many initializers >>> -You can, however, build much more complicated structures. Structures can itself -contain other structures by using a structure as a field type. +You can, however, build much more complicated structures. A structure can +itself contain other structures by using a structure as a field type. Here is a RECT structure which contains two POINTs named *upperleft* and *lowerright*:: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 15:51:27 2013 From: python-checkins at python.org (eli.bendersky) Date: Wed, 6 Mar 2013 15:51:27 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Fix_doc_grammar_and_line_width?= Message-ID: <3ZLdG76k4WzSqf@mail.python.org> http://hg.python.org/cpython/rev/2d8388759305 changeset: 82514:2d8388759305 branch: 3.3 parent: 82508:5e294202f93e parent: 82513:09222815097b user: Eli Bendersky date: Wed Mar 06 06:49:22 2013 -0800 summary: Fix doc grammar and line width files: Doc/library/ctypes.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -574,8 +574,8 @@ ValueError: too many initializers >>> -You can, however, build much more complicated structures. Structures can itself -contain other structures by using a structure as a field type. +You can, however, build much more complicated structures. A structure can +itself contain other structures by using a structure as a field type. Here is a RECT structure which contains two POINTs named *upperleft* and *lowerright*:: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 15:51:29 2013 From: python-checkins at python.org (eli.bendersky) Date: Wed, 6 Mar 2013 15:51:29 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Fix_doc_grammar_and_line_width?= Message-ID: <3ZLdG928NCzSns@mail.python.org> http://hg.python.org/cpython/rev/78a6d68a40aa changeset: 82515:78a6d68a40aa parent: 82512:6bcec385d13d parent: 82514:2d8388759305 user: Eli Bendersky date: Wed Mar 06 06:50:36 2013 -0800 summary: Fix doc grammar and line width files: Doc/library/ctypes.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -574,8 +574,8 @@ ValueError: too many initializers >>> -You can, however, build much more complicated structures. Structures can itself -contain other structures by using a structure as a field type. +You can, however, build much more complicated structures. A structure can +itself contain other structures by using a structure as a field type. Here is a RECT structure which contains two POINTs named *upperleft* and *lowerright*:: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 15:54:25 2013 From: python-checkins at python.org (eli.bendersky) Date: Wed, 6 Mar 2013 15:54:25 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fix_doc_gramma?= =?utf-8?q?r_and_line_width?= Message-ID: <3ZLdKY32MszSmx@mail.python.org> http://hg.python.org/cpython/rev/cfc777407b03 changeset: 82516:cfc777407b03 branch: 2.7 parent: 82506:01a8fcc91d5a user: Eli Bendersky date: Wed Mar 06 06:53:39 2013 -0800 summary: Fix doc grammar and line width files: Doc/library/ctypes.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -568,8 +568,8 @@ ValueError: too many initializers >>> -You can, however, build much more complicated structures. Structures can itself -contain other structures by using a structure as a field type. +You can, however, build much more complicated structures. A structure can +itself contain other structures by using a structure as a field type. Here is a RECT structure which contains two POINTs named *upperleft* and *lowerright*:: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 19:29:18 2013 From: python-checkins at python.org (victor.stinner) Date: Wed, 6 Mar 2013 19:29:18 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogX1B5VW5pY29kZV9X?= =?utf-8?q?riter=28=29_now_also_reuses_Unicode_singletons=3A?= Message-ID: <3ZLk5V74Vnz7LqK@mail.python.org> http://hg.python.org/cpython/rev/3dd2fa78fb89 changeset: 82517:3dd2fa78fb89 branch: 3.3 parent: 82514:2d8388759305 user: Victor Stinner date: Wed Mar 06 19:28:37 2013 +0100 summary: _PyUnicode_Writer() now also reuses Unicode singletons: empty string and latin1 single character files: Objects/unicodeobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -12924,7 +12924,7 @@ writer->buffer = newbuffer; } assert(_PyUnicode_CheckConsistency(writer->buffer, 1)); - return writer->buffer; + return unicode_result_ready(writer->buffer); } void -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 6 19:29:20 2013 From: python-checkins at python.org (victor.stinner) Date: Wed, 6 Mar 2013 19:29:20 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogKE1lcmdlIDMuMykgX1B5VW5pY29kZV9Xcml0ZXIoKSBub3cgYWxzbyBy?= =?utf-8?q?euses_Unicode_singletons=3A?= Message-ID: <3ZLk5X2pYfzRhC@mail.python.org> http://hg.python.org/cpython/rev/fa59a85b373f changeset: 82518:fa59a85b373f parent: 82515:78a6d68a40aa parent: 82517:3dd2fa78fb89 user: Victor Stinner date: Wed Mar 06 19:29:09 2013 +0100 summary: (Merge 3.3) _PyUnicode_Writer() now also reuses Unicode singletons: empty string and latin1 single character files: Objects/unicodeobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -12821,7 +12821,7 @@ writer->buffer = newbuffer; } assert(_PyUnicode_CheckConsistency(writer->buffer, 1)); - return writer->buffer; + return unicode_result_ready(writer->buffer); } void -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 01:23:51 2013 From: python-checkins at python.org (stefan.krah) Date: Thu, 7 Mar 2013 01:23:51 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE3MzYx?= =?utf-8?q?=3A_Use_cc_from_sysconfig_for_testing_flags=2E?= Message-ID: <3ZLsyb1Y5czSZL@mail.python.org> http://hg.python.org/cpython/rev/33208a574875 changeset: 82519:33208a574875 branch: 3.3 parent: 82517:3dd2fa78fb89 user: Stefan Krah date: Thu Mar 07 01:12:03 2013 +0100 summary: Issue #17361: Use cc from sysconfig for testing flags. files: setup.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -2013,8 +2013,8 @@ # Increase warning level for gcc: if 'gcc' in cc: - cmd = ("echo '' | gcc -Wextra -Wno-missing-field-initializers -E - " - "> /dev/null 2>&1") + cmd = ("echo '' | %s -Wextra -Wno-missing-field-initializers -E - " + "> /dev/null 2>&1" % cc) ret = os.system(cmd) if ret >> 8 == 0: extra_compile_args.extend(['-Wextra', -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 01:23:52 2013 From: python-checkins at python.org (stefan.krah) Date: Thu, 7 Mar 2013 01:23:52 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy4zLg==?= Message-ID: <3ZLsyc4CB2z7LjR@mail.python.org> http://hg.python.org/cpython/rev/7780757c6bab changeset: 82520:7780757c6bab parent: 82518:fa59a85b373f parent: 82519:33208a574875 user: Stefan Krah date: Thu Mar 07 01:23:01 2013 +0100 summary: Merge 3.3. files: setup.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -2024,8 +2024,8 @@ # Increase warning level for gcc: if 'gcc' in cc: - cmd = ("echo '' | gcc -Wextra -Wno-missing-field-initializers -E - " - "> /dev/null 2>&1") + cmd = ("echo '' | %s -Wextra -Wno-missing-field-initializers -E - " + "> /dev/null 2>&1" % cc) ret = os.system(cmd) if ret >> 8 == 0: extra_compile_args.extend(['-Wextra', -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Thu Mar 7 05:57:32 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 07 Mar 2013 05:57:32 +0100 Subject: [Python-checkins] Daily reference leaks (7780757c6bab): sum=13 Message-ID: results for 7780757c6bab on branch "default" -------------------------------------------- test_capi leaked [1, 1, 1] references, sum=3 test_capi leaked [2, 4, 4] memory blocks, sum=10 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogKpFPAY', '-x'] From python-checkins at python.org Thu Mar 7 13:51:33 2013 From: python-checkins at python.org (giampaolo.rodola) Date: Thu, 7 Mar 2013 13:51:33 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_PEP8-ify_ftplib=2Epy=3A_ge?= =?utf-8?q?t_rid_of_multiple_statements_on_one_line_=28if_cond=3A_=2E=2E?= =?utf-8?b?Lik=?= Message-ID: <3ZMBYK0g0NzSxG@mail.python.org> http://hg.python.org/cpython/rev/d01870bc43b5 changeset: 82521:d01870bc43b5 user: Giampaolo Rodola' date: Thu Mar 07 13:51:20 2013 +0100 summary: PEP8-ify ftplib.py: get rid of multiple statements on one line (if cond: ...) files: Lib/ftplib.py | 86 +++++++++++++++++++++++++------------- 1 files changed, 57 insertions(+), 29 deletions(-) diff --git a/Lib/ftplib.py b/Lib/ftplib.py --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -42,7 +42,7 @@ import warnings from socket import _GLOBAL_DEFAULT_TIMEOUT -__all__ = ["FTP","Netrc"] +__all__ = ["FTP", "Netrc"] # Magic number from MSG_OOB = 0x1 # Process data out of band @@ -184,7 +184,8 @@ # Internal: send one line to the server, appending CRLF def putline(self, line): line = line + CRLF - if self.debugging > 1: print('*put*', self.sanitize(line)) + if self.debugging > 1: + print('*put*', self.sanitize(line)) self.sock.sendall(line.encode(self.encoding)) # Internal: send one command to the server (through putline()) @@ -198,9 +199,12 @@ line = self.file.readline() if self.debugging > 1: print('*get*', self.sanitize(line)) - if not line: raise EOFError - if line[-2:] == CRLF: line = line[:-2] - elif line[-1:] in CRLF: line = line[:-1] + if not line: + raise EOFError + if line[-2:] == CRLF: + line = line[:-2] + elif line[-1:] in CRLF: + line = line[:-1] return line # Internal: get a response from the server, which may possibly @@ -223,7 +227,8 @@ # Raise various errors if the response indicates an error def getresp(self): resp = self.getmultiline() - if self.debugging: print('*resp*', self.sanitize(resp)) + if self.debugging: + print('*resp*', self.sanitize(resp)) self.lastresp = resp[:3] c = resp[:1] if c in {'1', '2', '3'}: @@ -247,7 +252,8 @@ IP and Synch; that doesn't seem to work with the servers I've tried. Instead, just send the ABOR command as OOB data.''' line = b'ABOR' + B_CRLF - if self.debugging > 1: print('*put urgent*', self.sanitize(line)) + if self.debugging > 1: + print('*put urgent*', self.sanitize(line)) self.sock.sendall(line, MSG_OOB) resp = self.getmultiline() if resp[:3] not in {'426', '225', '226'}: @@ -388,9 +394,12 @@ def login(self, user = '', passwd = '', acct = ''): '''Login, default anonymous.''' - if not user: user = 'anonymous' - if not passwd: passwd = '' - if not acct: acct = '' + if not user: + user = 'anonymous' + if not passwd: + passwd = '' + if not acct: + acct = '' if user == 'anonymous' and passwd in {'', '-'}: # If there is no anonymous ftp password specified # then we'll just use anonymous@ @@ -401,8 +410,10 @@ # host or country. passwd = passwd + 'anonymous@' resp = self.sendcmd('USER ' + user) - if resp[0] == '3': resp = self.sendcmd('PASS ' + passwd) - if resp[0] == '3': resp = self.sendcmd('ACCT ' + acct) + if resp[0] == '3': + resp = self.sendcmd('PASS ' + passwd) + if resp[0] == '3': + resp = self.sendcmd('ACCT ' + acct) if resp[0] != '2': raise error_reply(resp) return resp @@ -442,13 +453,15 @@ Returns: The response code. """ - if callback is None: callback = print_line + if callback is None: + callback = print_line resp = self.sendcmd('TYPE A') with self.transfercmd(cmd) as conn, \ conn.makefile('r', encoding=self.encoding) as fp: while 1: line = fp.readline() - if self.debugging > 2: print('*retr*', repr(line)) + if self.debugging > 2: + print('*retr*', repr(line)) if not line: break if line[-2:] == CRLF: @@ -477,9 +490,11 @@ with self.transfercmd(cmd, rest) as conn: while 1: buf = fp.read(blocksize) - if not buf: break + if not buf: + break conn.sendall(buf) - if callback: callback(buf) + if callback: + callback(buf) return self.voidresp() def storlines(self, cmd, fp, callback=None): @@ -498,12 +513,14 @@ with self.transfercmd(cmd) as conn: while 1: buf = fp.readline() - if not buf: break + if not buf: + break if buf[-2:] != B_CRLF: if buf[-1] in B_CRLF: buf = buf[:-1] buf = buf + B_CRLF conn.sendall(buf) - if callback: callback(buf) + if callback: + callback(buf) return self.voidresp() def acct(self, password): @@ -768,14 +785,16 @@ return self.voidresp() def retrlines(self, cmd, callback = None): - if callback is None: callback = print_line + if callback is None: + callback = print_line resp = self.sendcmd('TYPE A') conn = self.transfercmd(cmd) fp = conn.makefile('r', encoding=self.encoding) with fp, conn: while 1: line = fp.readline() - if self.debugging > 2: print('*retr*', repr(line)) + if self.debugging > 2: + print('*retr*', repr(line)) if not line: break if line[-2:] == CRLF: @@ -793,9 +812,11 @@ with self.transfercmd(cmd, rest) as conn: while 1: buf = fp.read(blocksize) - if not buf: break + if not buf: + break conn.sendall(buf) - if callback: callback(buf) + if callback: + callback(buf) # shutdown ssl layer if isinstance(conn, ssl.SSLSocket): conn.unwrap() @@ -806,12 +827,15 @@ with self.transfercmd(cmd) as conn: while 1: buf = fp.readline() - if not buf: break + if not buf: + break if buf[-2:] != B_CRLF: - if buf[-1] in B_CRLF: buf = buf[:-1] + if buf[-1] in B_CRLF: + buf = buf[:-1] buf = buf + B_CRLF conn.sendall(buf) - if callback: callback(buf) + if callback: + callback(buf) # shutdown ssl layer if isinstance(conn, ssl.SSLSocket): conn.unwrap() @@ -924,7 +948,8 @@ def ftpcp(source, sourcename, target, targetname = '', type = 'I'): '''Copy file from one FTP-instance to another.''' - if not targetname: targetname = sourcename + if not targetname: + targetname = sourcename type = 'TYPE ' + type source.voidcmd(type) target.voidcmd(type) @@ -934,9 +959,11 @@ # transfer request. # So: STOR before RETR, because here the target is a "user". treply = target.sendcmd('STOR ' + targetname) - if treply[:3] not in {'125', '150'}: raise error_proto # RFC 959 + if treply[:3] not in {'125', '150'}: + raise error_proto # RFC 959 sreply = source.sendcmd('RETR ' + sourcename) - if sreply[:3] not in {'125', '150'}: raise error_proto # RFC 959 + if sreply[:3] not in {'125', '150'}: + raise error_proto # RFC 959 source.voidresp() target.voidresp() @@ -968,7 +995,8 @@ in_macro = 0 while 1: line = fp.readline() - if not line: break + if not line: + break if in_macro and line.strip(): macro_lines.append(line) continue -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 14:03:57 2013 From: python-checkins at python.org (giampaolo.rodola) Date: Thu, 7 Mar 2013 14:03:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Refactor_ftplib_by_getting?= =?utf-8?q?_rid_of_4_methods_=28retr*=28=29_and_stor*=28=29=29_which_were?= Message-ID: <3ZMBqd2TtSz7Ljf@mail.python.org> http://hg.python.org/cpython/rev/154d6335a2c6 changeset: 82522:154d6335a2c6 user: Giampaolo Rodola' date: Thu Mar 07 14:03:27 2013 +0100 summary: Refactor ftplib by getting rid of 4 methods (retr*() and stor*()) which were duplicated in TLS_FTP class. files: Lib/ftplib.py | 86 ++++++-------------------------------- 1 files changed, 15 insertions(+), 71 deletions(-) diff --git a/Lib/ftplib.py b/Lib/ftplib.py --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -439,6 +439,9 @@ if not data: break callback(data) + # shutdown ssl layer + if isinstance(conn, _SSLSocket): + conn.unwrap() return self.voidresp() def retrlines(self, cmd, callback = None): @@ -469,6 +472,9 @@ elif line[-1:] == '\n': line = line[:-1] callback(line) + # shutdown ssl layer + if isinstance(conn, _SSLSocket): + conn.unwrap() return self.voidresp() def storbinary(self, cmd, fp, blocksize=8192, callback=None, rest=None): @@ -495,6 +501,9 @@ conn.sendall(buf) if callback: callback(buf) + # shutdown ssl layer + if isinstance(conn, _SSLSocket): + conn.unwrap() return self.voidresp() def storlines(self, cmd, fp, callback=None): @@ -521,6 +530,9 @@ conn.sendall(buf) if callback: callback(buf) + # shutdown ssl layer + if isinstance(conn, _SSLSocket): + conn.unwrap() return self.voidresp() def acct(self, password): @@ -655,8 +667,10 @@ try: import ssl except ImportError: - pass + _SSLSocket = None else: + _SSLSocket = ssl.SSLSocket + class FTP_TLS(FTP): '''A FTP subclass which adds TLS support to FTP as described in RFC-4217. @@ -771,76 +785,6 @@ ssl_version=self.ssl_version) return conn, size - def retrbinary(self, cmd, callback, blocksize=8192, rest=None): - self.voidcmd('TYPE I') - with self.transfercmd(cmd, rest) as conn: - while 1: - data = conn.recv(blocksize) - if not data: - break - callback(data) - # shutdown ssl layer - if isinstance(conn, ssl.SSLSocket): - conn.unwrap() - return self.voidresp() - - def retrlines(self, cmd, callback = None): - if callback is None: - callback = print_line - resp = self.sendcmd('TYPE A') - conn = self.transfercmd(cmd) - fp = conn.makefile('r', encoding=self.encoding) - with fp, conn: - while 1: - line = fp.readline() - if self.debugging > 2: - print('*retr*', repr(line)) - if not line: - break - if line[-2:] == CRLF: - line = line[:-2] - elif line[-1:] == '\n': - line = line[:-1] - callback(line) - # shutdown ssl layer - if isinstance(conn, ssl.SSLSocket): - conn.unwrap() - return self.voidresp() - - def storbinary(self, cmd, fp, blocksize=8192, callback=None, rest=None): - self.voidcmd('TYPE I') - with self.transfercmd(cmd, rest) as conn: - while 1: - buf = fp.read(blocksize) - if not buf: - break - conn.sendall(buf) - if callback: - callback(buf) - # shutdown ssl layer - if isinstance(conn, ssl.SSLSocket): - conn.unwrap() - return self.voidresp() - - def storlines(self, cmd, fp, callback=None): - self.voidcmd('TYPE A') - with self.transfercmd(cmd) as conn: - while 1: - buf = fp.readline() - if not buf: - break - if buf[-2:] != B_CRLF: - if buf[-1] in B_CRLF: - buf = buf[:-1] - buf = buf + B_CRLF - conn.sendall(buf) - if callback: - callback(buf) - # shutdown ssl layer - if isinstance(conn, ssl.SSLSocket): - conn.unwrap() - return self.voidresp() - def abort(self): # overridden as we can't pass MSG_OOB flag to sendall() line = b'ABOR' + B_CRLF -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 14:45:15 2013 From: python-checkins at python.org (nick.coghlan) Date: Thu, 7 Mar 2013 14:45:15 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogQ2xvc2UgIzE1NDY1?= =?utf-8?q?=3A_Document_C_API_version_macros?= Message-ID: <3ZMClH4KWKz7Ltk@mail.python.org> http://hg.python.org/cpython/rev/adeafab9a18f changeset: 82523:adeafab9a18f branch: 3.3 parent: 82519:33208a574875 user: Nick Coghlan date: Thu Mar 07 23:14:44 2013 +1000 summary: Close #15465: Document C API version macros Mostly moving the existing macro docs over from the standard library docs to the C API docs where they belong. Patch by Kushal Das. files: Doc/c-api/apiabiversion.rst | 39 +++++++++++++++++++++++++ Doc/c-api/index.rst | 1 + Doc/c-api/stable.rst | 20 +++++++----- Doc/library/sys.rst | 24 +-------------- Misc/NEWS | 3 + 5 files changed, 55 insertions(+), 32 deletions(-) diff --git a/Doc/c-api/apiabiversion.rst b/Doc/c-api/apiabiversion.rst new file mode 100644 --- /dev/null +++ b/Doc/c-api/apiabiversion.rst @@ -0,0 +1,39 @@ +.. highlightlang:: c + +.. _apiabiversion: + +*********************** +API and ABI Versioning +*********************** + +``PY_VERSION_HEX`` is the Python version number encoded in a single integer. + +For example if the ``PY_VERSION_HEX`` is set to ``0x030401a2``, the underlying +version information can be found by treating it as a 32 bit number in +the following manner: + + +-------+-------------------------+------------------------------------------------+ + | Bytes | Bits (big endian order) | Meaning | + +=======+=========================+================================================+ + | ``1`` | ``1-8`` | ``PY_MAJOR_VERSION`` (the ``3`` in | + | | | ``3.4.1a2``) | + +-------+-------------------------+------------------------------------------------+ + | ``2`` | ``9-16`` | ``PY_MINOR_VERSION`` (the ``4`` in | + | | | ``3.4.1a2``) | + +-------+-------------------------+------------------------------------------------+ + | ``3`` | ``17-24`` | ``PY_MICRO_VERSION`` (the ``1`` in | + | | | ``3.4.1a2``) | + +-------+-------------------------+------------------------------------------------+ + | ``4`` | ``25-28`` | ``PY_RELEASE_LEVEL`` (``0xA`` for alpha, | + | | | ``0xB`` for beta, ``0xC`` for release | + | | | candidate and ``0xF`` for final), in this | + | | | case it is alpha. | + | +-------------------------+------------------------------------------------+ + | | ``29-32`` | ``PY_RELEASE_SERIAL`` (the ``2`` in | + | | | ``3.4.1a2``, zero for final releases) | + +-------+-------------------------+------------------------------------------------+ + +Thus ``3.4.1a2`` is hexversion ``0x030401a2``. + +All the given macros are defined in :source:`Include/patchlevel.h`. + diff --git a/Doc/c-api/index.rst b/Doc/c-api/index.rst --- a/Doc/c-api/index.rst +++ b/Doc/c-api/index.rst @@ -23,3 +23,4 @@ memory.rst objimpl.rst stable.rst + apiabiversion.rst diff --git a/Doc/c-api/stable.rst b/Doc/c-api/stable.rst --- a/Doc/c-api/stable.rst +++ b/Doc/c-api/stable.rst @@ -2,9 +2,9 @@ .. _stable: -********************************** -Stable Appliction Binary Interface -********************************** +*********************************** +Stable Application Binary Interface +*********************************** Traditionally, the C API of Python will change with every release. Most changes will be source-compatible, typically by only adding API, @@ -23,13 +23,15 @@ Since Python 3.2, a subset of the API has been declared to guarantee a stable ABI. Extension modules wishing to use this API need to define -Py_LIMITED_API. A number of interpreter details then become hidden +``Py_LIMITED_API``. A number of interpreter details then become hidden from the extension module; in return, a module is built that works -on any 3.x version (x>=2) without recompilation. In some cases, the -stable ABI needs to be extended with new functions. Extensions modules -wishing to use these new APIs need to set Py_LIMITED_API to the -PY_VERSION_HEX value of the minimum Python version they want to -support (e.g. 0x03030000 for Python 3.3). Such modules will work +on any 3.x version (x>=2) without recompilation. + +In some cases, the stable ABI needs to be extended with new functions. +Extension modules wishing to use these new APIs need to set +``Py_LIMITED_API`` to the ``PY_VERSION_HEX`` value (see +:ref:`apiabiversion`) of the minimum Python version they want to +support (e.g. ``0x03030000`` for Python 3.3). Such modules will work on all subsequent Python releases, but fail to load (because of missing symbols) on the older releases. diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -598,29 +598,7 @@ :term:`struct sequence` :data:`sys.version_info` may be used for a more human-friendly encoding of the same information. - The ``hexversion`` is a 32-bit number with the following layout: - - +-------------------------+------------------------------------------------+ - | Bits (big endian order) | Meaning | - +=========================+================================================+ - | :const:`1-8` | ``PY_MAJOR_VERSION`` (the ``2`` in | - | | ``2.1.0a3``) | - +-------------------------+------------------------------------------------+ - | :const:`9-16` | ``PY_MINOR_VERSION`` (the ``1`` in | - | | ``2.1.0a3``) | - +-------------------------+------------------------------------------------+ - | :const:`17-24` | ``PY_MICRO_VERSION`` (the ``0`` in | - | | ``2.1.0a3``) | - +-------------------------+------------------------------------------------+ - | :const:`25-28` | ``PY_RELEASE_LEVEL`` (``0xA`` for alpha, | - | | ``0xB`` for beta, ``0xC`` for release | - | | candidate and ``0xF`` for final) | - +-------------------------+------------------------------------------------+ - | :const:`29-32` | ``PY_RELEASE_SERIAL`` (the ``3`` in | - | | ``2.1.0a3``, zero for final releases) | - +-------------------------+------------------------------------------------+ - - Thus ``2.1.0a3`` is hexversion ``0x020100a3``. + More details of ``hexversion`` can be found at :ref:`apiabiversion` .. data:: implementation diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -797,6 +797,9 @@ Documentation ------------- +- Issue #15465: Document the versioning macros in the C API docs rather than + the standard library docs. Patch by Kushal Das. + - Issue #16406: Combine the pages for uploading and registering to PyPI. - Issue #16403: Document how distutils uses the maintainer field in -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 14:45:17 2013 From: python-checkins at python.org (nick.coghlan) Date: Thu, 7 Mar 2013 14:45:17 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_fix_for_=2315465_from_3=2E3?= Message-ID: <3ZMClK1QTmz7LtX@mail.python.org> http://hg.python.org/cpython/rev/a1373861f62f changeset: 82524:a1373861f62f parent: 82522:154d6335a2c6 parent: 82523:adeafab9a18f user: Nick Coghlan date: Thu Mar 07 23:45:03 2013 +1000 summary: Merge fix for #15465 from 3.3 files: Doc/c-api/apiabiversion.rst | 39 +++++++++++++++++++++++++ Doc/c-api/index.rst | 1 + Doc/c-api/stable.rst | 20 +++++++----- Doc/library/sys.rst | 24 +-------------- Misc/NEWS | 3 + 5 files changed, 55 insertions(+), 32 deletions(-) diff --git a/Doc/c-api/apiabiversion.rst b/Doc/c-api/apiabiversion.rst new file mode 100644 --- /dev/null +++ b/Doc/c-api/apiabiversion.rst @@ -0,0 +1,39 @@ +.. highlightlang:: c + +.. _apiabiversion: + +*********************** +API and ABI Versioning +*********************** + +``PY_VERSION_HEX`` is the Python version number encoded in a single integer. + +For example if the ``PY_VERSION_HEX`` is set to ``0x030401a2``, the underlying +version information can be found by treating it as a 32 bit number in +the following manner: + + +-------+-------------------------+------------------------------------------------+ + | Bytes | Bits (big endian order) | Meaning | + +=======+=========================+================================================+ + | ``1`` | ``1-8`` | ``PY_MAJOR_VERSION`` (the ``3`` in | + | | | ``3.4.1a2``) | + +-------+-------------------------+------------------------------------------------+ + | ``2`` | ``9-16`` | ``PY_MINOR_VERSION`` (the ``4`` in | + | | | ``3.4.1a2``) | + +-------+-------------------------+------------------------------------------------+ + | ``3`` | ``17-24`` | ``PY_MICRO_VERSION`` (the ``1`` in | + | | | ``3.4.1a2``) | + +-------+-------------------------+------------------------------------------------+ + | ``4`` | ``25-28`` | ``PY_RELEASE_LEVEL`` (``0xA`` for alpha, | + | | | ``0xB`` for beta, ``0xC`` for release | + | | | candidate and ``0xF`` for final), in this | + | | | case it is alpha. | + | +-------------------------+------------------------------------------------+ + | | ``29-32`` | ``PY_RELEASE_SERIAL`` (the ``2`` in | + | | | ``3.4.1a2``, zero for final releases) | + +-------+-------------------------+------------------------------------------------+ + +Thus ``3.4.1a2`` is hexversion ``0x030401a2``. + +All the given macros are defined in :source:`Include/patchlevel.h`. + diff --git a/Doc/c-api/index.rst b/Doc/c-api/index.rst --- a/Doc/c-api/index.rst +++ b/Doc/c-api/index.rst @@ -23,3 +23,4 @@ memory.rst objimpl.rst stable.rst + apiabiversion.rst diff --git a/Doc/c-api/stable.rst b/Doc/c-api/stable.rst --- a/Doc/c-api/stable.rst +++ b/Doc/c-api/stable.rst @@ -2,9 +2,9 @@ .. _stable: -********************************** -Stable Appliction Binary Interface -********************************** +*********************************** +Stable Application Binary Interface +*********************************** Traditionally, the C API of Python will change with every release. Most changes will be source-compatible, typically by only adding API, @@ -23,13 +23,15 @@ Since Python 3.2, a subset of the API has been declared to guarantee a stable ABI. Extension modules wishing to use this API need to define -Py_LIMITED_API. A number of interpreter details then become hidden +``Py_LIMITED_API``. A number of interpreter details then become hidden from the extension module; in return, a module is built that works -on any 3.x version (x>=2) without recompilation. In some cases, the -stable ABI needs to be extended with new functions. Extensions modules -wishing to use these new APIs need to set Py_LIMITED_API to the -PY_VERSION_HEX value of the minimum Python version they want to -support (e.g. 0x03030000 for Python 3.3). Such modules will work +on any 3.x version (x>=2) without recompilation. + +In some cases, the stable ABI needs to be extended with new functions. +Extension modules wishing to use these new APIs need to set +``Py_LIMITED_API`` to the ``PY_VERSION_HEX`` value (see +:ref:`apiabiversion`) of the minimum Python version they want to +support (e.g. ``0x03030000`` for Python 3.3). Such modules will work on all subsequent Python releases, but fail to load (because of missing symbols) on the older releases. diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -613,29 +613,7 @@ :term:`struct sequence` :data:`sys.version_info` may be used for a more human-friendly encoding of the same information. - The ``hexversion`` is a 32-bit number with the following layout: - - +-------------------------+------------------------------------------------+ - | Bits (big endian order) | Meaning | - +=========================+================================================+ - | :const:`1-8` | ``PY_MAJOR_VERSION`` (the ``2`` in | - | | ``2.1.0a3``) | - +-------------------------+------------------------------------------------+ - | :const:`9-16` | ``PY_MINOR_VERSION`` (the ``1`` in | - | | ``2.1.0a3``) | - +-------------------------+------------------------------------------------+ - | :const:`17-24` | ``PY_MICRO_VERSION`` (the ``0`` in | - | | ``2.1.0a3``) | - +-------------------------+------------------------------------------------+ - | :const:`25-28` | ``PY_RELEASE_LEVEL`` (``0xA`` for alpha, | - | | ``0xB`` for beta, ``0xC`` for release | - | | candidate and ``0xF`` for final) | - +-------------------------+------------------------------------------------+ - | :const:`29-32` | ``PY_RELEASE_SERIAL`` (the ``3`` in | - | | ``2.1.0a3``, zero for final releases) | - +-------------------------+------------------------------------------------+ - - Thus ``2.1.0a3`` is hexversion ``0x020100a3``. + More details of ``hexversion`` can be found at :ref:`apiabiversion` .. data:: implementation diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1071,6 +1071,9 @@ Documentation ------------- +- Issue #15465: Document the versioning macros in the C API docs rather than + the standard library docs. Patch by Kushal Das. + - Issue #16406: Combine the pages for uploading and registering to PyPI. - Issue #16403: Document how distutils uses the maintainer field in -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 17:39:11 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 7 Mar 2013 17:39:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzExNzMyOiBtYWtl?= =?utf-8?q?_suppress=5Fcrash=5Fpopup=28=29_work_on_Windows_XP_and_Windows_?= =?utf-8?q?Server_2003=2E?= Message-ID: <3ZMHbz0V8fz7Ltj@mail.python.org> http://hg.python.org/cpython/rev/6ccefddc13fd changeset: 82525:6ccefddc13fd branch: 3.3 parent: 82523:adeafab9a18f user: Ezio Melotti date: Thu Mar 07 18:37:13 2013 +0200 summary: #11732: make suppress_crash_popup() work on Windows XP and Windows Server 2003. files: Lib/test/support.py | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -1911,10 +1911,12 @@ def suppress_crash_popup(): """Disable Windows Error Reporting dialogs using SetErrorMode.""" # see http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621%28v=vs.85%29.aspx + # GetErrorMode is not available on Windows XP and Windows Server 2003, + # but SetErrorMode returns the previous value, so we can use that import ctypes k32 = ctypes.windll.kernel32 - old_error_mode = k32.GetErrorMode() SEM_NOGPFAULTERRORBOX = 0x02 + old_error_mode = k32.SetErrorMode(SEM_NOGPFAULTERRORBOX) k32.SetErrorMode(old_error_mode | SEM_NOGPFAULTERRORBOX) try: yield -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 17:39:12 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 7 Mar 2013 17:39:12 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzExNzMyOiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZMHc03Dr6z7Lkg@mail.python.org> http://hg.python.org/cpython/rev/831035bda9b7 changeset: 82526:831035bda9b7 parent: 82524:a1373861f62f parent: 82525:6ccefddc13fd user: Ezio Melotti date: Thu Mar 07 18:38:45 2013 +0200 summary: #11732: merge with 3.3. files: Lib/test/support.py | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -1913,10 +1913,12 @@ def suppress_crash_popup(): """Disable Windows Error Reporting dialogs using SetErrorMode.""" # see http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621%28v=vs.85%29.aspx + # GetErrorMode is not available on Windows XP and Windows Server 2003, + # but SetErrorMode returns the previous value, so we can use that import ctypes k32 = ctypes.windll.kernel32 - old_error_mode = k32.GetErrorMode() SEM_NOGPFAULTERRORBOX = 0x02 + old_error_mode = k32.SetErrorMode(SEM_NOGPFAULTERRORBOX) k32.SetErrorMode(old_error_mode | SEM_NOGPFAULTERRORBOX) try: yield -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 17:46:25 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 7 Mar 2013 17:46:25 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzExNzMyOiBhZGQg?= =?utf-8?q?a_new_suppress=5Fcrash=5Fpopup=28=29_context_manager_to_test=2E?= =?utf-8?q?support_that?= Message-ID: <3ZMHmK04gPzSDW@mail.python.org> http://hg.python.org/cpython/rev/c0c440dcb8dd changeset: 82527:c0c440dcb8dd branch: 3.2 parent: 82513:09222815097b user: Ezio Melotti date: Thu Mar 07 18:44:29 2013 +0200 summary: #11732: add a new suppress_crash_popup() context manager to test.support that disables crash popups on Windows and use it in test_ctypes. files: Doc/library/test.rst | 7 +++++++ Lib/test/support.py | 26 +++++++++++++++++++++++++- Lib/test/test_capi.py | 11 ++++++----- Misc/NEWS | 3 +++ 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/Doc/library/test.rst b/Doc/library/test.rst --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -365,6 +365,13 @@ assert s.getvalue() == "hello\n" +.. function:: suppress_crash_popup() + + A context manager that disables Windows Error Reporting dialogs using + `SetErrorMode `_. + On other platforms it's a no-op. + + .. function:: import_module(name, deprecated=False) This function imports and returns the named module. Unlike a normal diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -56,7 +56,7 @@ "reap_children", "cpython_only", "check_impl_detail", "get_attribute", "swap_item", "swap_attr", "requires_IEEE_754", "TestHandler", "Matcher", "can_symlink", "skip_unless_symlink", - "import_fresh_module", "failfast", "run_with_tz" + "import_fresh_module", "failfast", "run_with_tz", "suppress_crash_popup", ] class Error(Exception): @@ -1775,6 +1775,30 @@ msg = "Requires functional symlink implementation" return test if ok else unittest.skip(msg)(test) + +if sys.platform.startswith('win'): + @contextlib.contextmanager + def suppress_crash_popup(): + """Disable Windows Error Reporting dialogs using SetErrorMode.""" + # see http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621%28v=vs.85%29.aspx + # GetErrorMode is not available on Windows XP and Windows Server 2003, + # but SetErrorMode returns the previous value, so we can use that + import ctypes + k32 = ctypes.windll.kernel32 + SEM_NOGPFAULTERRORBOX = 0x02 + old_error_mode = k32.SetErrorMode(SEM_NOGPFAULTERRORBOX) + k32.SetErrorMode(old_error_mode | SEM_NOGPFAULTERRORBOX) + try: + yield + finally: + k32.SetErrorMode(old_error_mode) +else: + # this is a no-op for other platforms + @contextlib.contextmanager + def suppress_crash_popup(): + yield + + def patch(test_instance, object_to_patch, attr_name, new_value): """Override 'object_to_patch'.'attr_name' with 'new_value'. diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -46,11 +46,12 @@ @unittest.skipUnless(threading, 'Threading required for this test.') def test_no_FatalError_infinite_loop(self): - p = subprocess.Popen([sys.executable, "-c", - 'import _testcapi;' - '_testcapi.crash_no_current_thread()'], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + with support.suppress_crash_popup(): + p = subprocess.Popen([sys.executable, "-c", + 'import _testcapi;' + '_testcapi.crash_no_current_thread()'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) (out, err) = p.communicate() self.assertEqual(out, b'') # This used to cause an infinite loop. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -950,6 +950,9 @@ Tests ----- +- Issue #11732: add a new suppress_crash_popup() context manager to test.support + that disables crash popups on Windows and use it in test_ctypes. + - Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. - Issue #17249: convert a test in test_capi to use unittest and reap threads. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 17:46:26 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 7 Mar 2013 17:46:26 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2311732=3A_null_merge_with_3=2E2=2E?= Message-ID: <3ZMHmL38m6z7Lkd@mail.python.org> http://hg.python.org/cpython/rev/89d62bc81e47 changeset: 82528:89d62bc81e47 branch: 3.3 parent: 82525:6ccefddc13fd parent: 82527:c0c440dcb8dd user: Ezio Melotti date: Thu Mar 07 18:45:48 2013 +0200 summary: #11732: null merge with 3.2. files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 17:46:27 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 7 Mar 2013 17:46:27 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_=2311732=3A_null_merge_with_3=2E3=2E?= Message-ID: <3ZMHmM5x7mzSvS@mail.python.org> http://hg.python.org/cpython/rev/7e818490d297 changeset: 82529:7e818490d297 parent: 82526:831035bda9b7 parent: 82528:89d62bc81e47 user: Ezio Melotti date: Thu Mar 07 18:46:09 2013 +0200 summary: #11732: null merge with 3.3. files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 18:56:27 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 7 Mar 2013 18:56:27 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_Fix_typo_in_Mi?= =?utf-8?q?sc/NEWS_entry=2E?= Message-ID: <3ZMKK73FmmzS5Y@mail.python.org> http://hg.python.org/cpython/rev/caf964ed20f1 changeset: 82530:caf964ed20f1 branch: 3.2 parent: 82527:c0c440dcb8dd user: Ezio Melotti date: Thu Mar 07 19:53:19 2013 +0200 summary: Fix typo in Misc/NEWS entry. files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -951,7 +951,7 @@ ----- - Issue #11732: add a new suppress_crash_popup() context manager to test.support - that disables crash popups on Windows and use it in test_ctypes. + that disables crash popups on Windows and use it in test_capi. - Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 18:56:28 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 7 Mar 2013 18:56:28 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_typo_fix_in_Misc/NEWS_entry_from_3=2E2=2E?= Message-ID: <3ZMKK866WyzS5Y@mail.python.org> http://hg.python.org/cpython/rev/25f0237d32ed changeset: 82531:25f0237d32ed branch: 3.3 parent: 82528:89d62bc81e47 parent: 82530:caf964ed20f1 user: Ezio Melotti date: Thu Mar 07 19:55:08 2013 +0200 summary: Merge typo fix in Misc/NEWS entry from 3.2. files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -642,7 +642,7 @@ - Issue #11732: add a new suppress_crash_popup() context manager to test.support that disables crash popups on Windows and use it in test_faulthandler and - test_ctypes. + test_capi. - Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 18:56:30 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 7 Mar 2013 18:56:30 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_typo_fix_in_Misc/NEWS_entry_from_3=2E3=2E?= Message-ID: <3ZMKKB26RDzSZL@mail.python.org> http://hg.python.org/cpython/rev/bab568ac7e7a changeset: 82532:bab568ac7e7a parent: 82529:7e818490d297 parent: 82531:25f0237d32ed user: Ezio Melotti date: Thu Mar 07 19:56:15 2013 +0200 summary: Merge typo fix in Misc/NEWS entry from 3.3. files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -897,7 +897,7 @@ - Issue #11732: add a new suppress_crash_popup() context manager to test.support that disables crash popups on Windows and use it in test_faulthandler and - test_ctypes. + test_capi. - Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 20:19:16 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 7 Mar 2013 20:19:16 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_memory_leak_introduced?= =?utf-8?q?_in_15190138d3f3=2E?= Message-ID: <3ZMM8h14rbzSlx@mail.python.org> http://hg.python.org/cpython/rev/c261b74533bf changeset: 82533:c261b74533bf user: Ezio Melotti date: Thu Mar 07 21:18:45 2013 +0200 summary: Fix memory leak introduced in 15190138d3f3. files: Modules/_testcapimodule.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -1423,11 +1423,15 @@ if (wide == NULL) return NULL; PyUnicode_AS_UNICODE(wide)[0] = invalid[0]; - if (_PyUnicode_Ready(wide) < 0) + if (_PyUnicode_Ready(wide) < 0) { + Py_DECREF(wide); PyErr_Clear(); - else + } + else { + Py_DECREF(wide); return raiseTestError("test_widechar", "PyUnicode_Ready() didn't fail"); + } #endif Py_RETURN_NONE; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 23:31:56 2013 From: python-checkins at python.org (r.david.murray) Date: Thu, 7 Mar 2013 23:31:56 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE0NjQ1OiBHZW5l?= =?utf-8?q?rator_now_emits_correct_linesep_for_all_parts=2E?= Message-ID: <3ZMRR006q6zRtV@mail.python.org> http://hg.python.org/cpython/rev/30c0f0dd0b94 changeset: 82534:30c0f0dd0b94 branch: 3.2 parent: 82530:caf964ed20f1 user: R David Murray date: Thu Mar 07 16:38:03 2013 -0500 summary: #14645: Generator now emits correct linesep for all parts. Previously the parts of the message retained whatever linesep they had on read, which means if the messages weren't read in univeral newline mode, the line endings could well be inconsistent. In general sending it via smtplib would result in them getting fixed, but it is better to generate them correctly to begin with. Also, the new send_message method of smtplib does not do the fixup, so that method is producing rfc-invalid output without this fix. files: Lib/email/generator.py | 22 ++++++++++++-- Lib/email/test/test_email.py | 35 ++++++++++++++++++++++++ Misc/NEWS | 5 +++ 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/Lib/email/generator.py b/Lib/email/generator.py --- a/Lib/email/generator.py +++ b/Lib/email/generator.py @@ -119,6 +119,19 @@ # BytesGenerator overrides this to encode strings to bytes. return s + def _write_lines(self, lines): + # We have to transform the line endings. + if not lines: + return + lines = lines.splitlines(True) + for line in lines[:-1]: + self.write(line.rstrip('\r\n')) + self.write(self._NL) + laststripped = lines[-1].rstrip('\r\n') + self.write(laststripped) + if len(lines[-1])!=len(laststripped): + self.write(self._NL) + def _write(self, msg): # We can't write the headers yet because of the following scenario: # say a multipart message includes the boundary string somewhere in @@ -198,7 +211,7 @@ payload = msg.get_payload() if self._mangle_from_: payload = fcre.sub('>From ', payload) - self.write(payload) + self._write_lines(payload) # Default body handler _writeBody = _handle_text @@ -237,7 +250,8 @@ preamble = fcre.sub('>From ', msg.preamble) else: preamble = msg.preamble - self.write(preamble + self._NL) + self._write_lines(preamble) + self.write(self._NL) # dash-boundary transport-padding CRLF self.write('--' + boundary + self._NL) # body-part @@ -259,7 +273,7 @@ epilogue = fcre.sub('>From ', msg.epilogue) else: epilogue = msg.epilogue - self.write(epilogue) + self._write_lines(epilogue) def _handle_multipart_signed(self, msg): # The contents of signed parts has to stay unmodified in order to keep @@ -393,7 +407,7 @@ if _has_surrogates(msg._payload): if self._mangle_from_: msg._payload = fcre.sub(">From ", msg._payload) - self.write(msg._payload) + self._write_lines(msg._payload) else: super(BytesGenerator,self)._handle_text(msg) diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -68,6 +68,7 @@ with openfile(findfile(filename)) as fp: return email.message_from_file(fp) + maxDiff = None # Test various aspects of the Message class's API @@ -2907,6 +2908,40 @@ email.utils.make_msgid(domain='testdomain-string')[-19:], '@testdomain-string>') + def test_Generator_linend(self): + # Issue 14645. + with openfile('msg_26.txt', newline='\n') as f: + msgtxt = f.read() + msgtxt_nl = msgtxt.replace('\r\n', '\n') + msg = email.message_from_string(msgtxt) + s = StringIO() + g = email.generator.Generator(s) + g.flatten(msg) + self.assertEqual(s.getvalue(), msgtxt_nl) + + def test_BytesGenerator_linend(self): + # Issue 14645. + with openfile('msg_26.txt', newline='\n') as f: + msgtxt = f.read() + msgtxt_nl = msgtxt.replace('\r\n', '\n') + msg = email.message_from_string(msgtxt_nl) + s = BytesIO() + g = email.generator.BytesGenerator(s) + g.flatten(msg, linesep='\r\n') + self.assertEqual(s.getvalue().decode('ascii'), msgtxt) + + def test_BytesGenerator_linend_with_non_ascii(self): + # Issue 14645. + with openfile('msg_26.txt', 'rb') as f: + msgtxt = f.read() + msgtxt = msgtxt.replace(b'with attachment', b'fo\xf6') + msgtxt_nl = msgtxt.replace(b'\r\n', b'\n') + msg = email.message_from_bytes(msgtxt_nl) + s = BytesIO() + g = email.generator.BytesGenerator(s) + g.flatten(msg, linesep='\r\n') + self.assertEqual(s.getvalue(), msgtxt) + # Test the iterator/generators class TestIterators(TestEmailBase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,6 +233,11 @@ Library ------- +- Issue #14645: The email generator classes now produce output using the + specified linesep throughout. Previously if the prolog, epilog, or + body were stored with a different linesep, that linesep was used. This + fix corrects an RFC non-compliance issue with smtplib.send_message. + - Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 23:31:57 2013 From: python-checkins at python.org (r.david.murray) Date: Thu, 7 Mar 2013 23:31:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge=3A_=2314645=3A_Generator_now_emits_correct_linesep_for_a?= =?utf-8?q?ll_parts=2E?= Message-ID: <3ZMRR145bFz7Lkx@mail.python.org> http://hg.python.org/cpython/rev/1b9dc00c4d57 changeset: 82535:1b9dc00c4d57 branch: 3.3 parent: 82531:25f0237d32ed parent: 82534:30c0f0dd0b94 user: R David Murray date: Thu Mar 07 16:43:58 2013 -0500 summary: Merge: #14645: Generator now emits correct linesep for all parts. Previously the parts of the message retained whatever linesep they had on read, which means if the messages weren't read in univeral newline mode, the line endings could well be inconsistent. In general sending it via smtplib would result in them getting fixed, but it is better to generate them correctly to begin with. Also, the new send_message method of smtplib does not do the fixup, so that method is producing rfc-invalid output without this fix. files: Lib/email/generator.py | 22 ++++++++++-- Lib/test/test_email/test_email.py | 34 +++++++++++++++++++ Misc/NEWS | 5 ++ 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/Lib/email/generator.py b/Lib/email/generator.py --- a/Lib/email/generator.py +++ b/Lib/email/generator.py @@ -146,6 +146,19 @@ # BytesGenerator overrides this to encode strings to bytes. return s + def _write_lines(self, lines): + # We have to transform the line endings. + if not lines: + return + lines = lines.splitlines(True) + for line in lines[:-1]: + self.write(line.rstrip('\r\n')) + self.write(self._NL) + laststripped = lines[-1].rstrip('\r\n') + self.write(laststripped) + if len(lines[-1])!=len(laststripped): + self.write(self._NL) + def _write(self, msg): # We can't write the headers yet because of the following scenario: # say a multipart message includes the boundary string somewhere in @@ -217,7 +230,7 @@ payload = msg.get_payload() if self._mangle_from_: payload = fcre.sub('>From ', payload) - self.write(payload) + self._write_lines(payload) # Default body handler _writeBody = _handle_text @@ -256,7 +269,8 @@ preamble = fcre.sub('>From ', msg.preamble) else: preamble = msg.preamble - self.write(preamble + self._NL) + self._write_lines(preamble) + self.write(self._NL) # dash-boundary transport-padding CRLF self.write('--' + boundary + self._NL) # body-part @@ -278,7 +292,7 @@ epilogue = fcre.sub('>From ', msg.epilogue) else: epilogue = msg.epilogue - self.write(epilogue) + self._write_lines(epilogue) def _handle_multipart_signed(self, msg): # The contents of signed parts has to stay unmodified in order to keep @@ -402,7 +416,7 @@ if _has_surrogates(msg._payload) and not self.policy.cte_type=='7bit': if self._mangle_from_: msg._payload = fcre.sub(">From ", msg._payload) - self.write(msg._payload) + self._write_lines(msg._payload) else: super(BytesGenerator,self)._handle_text(msg) diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -3111,6 +3111,40 @@ email.utils.make_msgid(domain='testdomain-string')[-19:], '@testdomain-string>') + def test_Generator_linend(self): + # Issue 14645. + with openfile('msg_26.txt', newline='\n') as f: + msgtxt = f.read() + msgtxt_nl = msgtxt.replace('\r\n', '\n') + msg = email.message_from_string(msgtxt) + s = StringIO() + g = email.generator.Generator(s) + g.flatten(msg) + self.assertEqual(s.getvalue(), msgtxt_nl) + + def test_BytesGenerator_linend(self): + # Issue 14645. + with openfile('msg_26.txt', newline='\n') as f: + msgtxt = f.read() + msgtxt_nl = msgtxt.replace('\r\n', '\n') + msg = email.message_from_string(msgtxt_nl) + s = BytesIO() + g = email.generator.BytesGenerator(s) + g.flatten(msg, linesep='\r\n') + self.assertEqual(s.getvalue().decode('ascii'), msgtxt) + + def test_BytesGenerator_linend_with_non_ascii(self): + # Issue 14645. + with openfile('msg_26.txt', 'rb') as f: + msgtxt = f.read() + msgtxt = msgtxt.replace(b'with attachment', b'fo\xf6') + msgtxt_nl = msgtxt.replace(b'\r\n', b'\n') + msg = email.message_from_bytes(msgtxt_nl) + s = BytesIO() + g = email.generator.BytesGenerator(s) + g.flatten(msg, linesep='\r\n') + self.assertEqual(s.getvalue(), msgtxt) + # Test the iterator/generators class TestIterators(TestEmailBase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -193,6 +193,11 @@ Library ------- +- Issue #14645: The email generator classes now produce output using the + specified linesep throughout. Previously if the prolog, epilog, or + body were stored with a different linesep, that linesep was used. This + fix corrects an RFC non-compliance issue with smtplib.send_message. + - Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 7 23:31:59 2013 From: python-checkins at python.org (r.david.murray) Date: Thu, 7 Mar 2013 23:31:59 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=2314645=3A_Generator_now_emits_correct_linesep?= =?utf-8?q?_for_all_parts=2E?= Message-ID: <3ZMRR31L0Xz7Lkx@mail.python.org> http://hg.python.org/cpython/rev/6b69c11b0ad0 changeset: 82536:6b69c11b0ad0 parent: 82533:c261b74533bf parent: 82535:1b9dc00c4d57 user: R David Murray date: Thu Mar 07 17:31:21 2013 -0500 summary: Merge: #14645: Generator now emits correct linesep for all parts. Previously the parts of the message retained whatever linesep they had on read, which means if the messages weren't read in univeral newline mode, the line endings could well be inconsistent. In general sending it via smtplib would result in them getting fixed, but it is better to generate them correctly to begin with. Also, the new send_message method of smtplib does not do the fixup, so that method is producing rfc-invalid output without this fix. files: Lib/email/generator.py | 22 ++++++++++-- Lib/test/test_email/test_email.py | 34 +++++++++++++++++++ Misc/NEWS | 5 ++ 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/Lib/email/generator.py b/Lib/email/generator.py --- a/Lib/email/generator.py +++ b/Lib/email/generator.py @@ -146,6 +146,19 @@ # BytesGenerator overrides this to encode strings to bytes. return s + def _write_lines(self, lines): + # We have to transform the line endings. + if not lines: + return + lines = lines.splitlines(True) + for line in lines[:-1]: + self.write(line.rstrip('\r\n')) + self.write(self._NL) + laststripped = lines[-1].rstrip('\r\n') + self.write(laststripped) + if len(lines[-1])!=len(laststripped): + self.write(self._NL) + def _write(self, msg): # We can't write the headers yet because of the following scenario: # say a multipart message includes the boundary string somewhere in @@ -217,7 +230,7 @@ payload = msg.get_payload() if self._mangle_from_: payload = fcre.sub('>From ', payload) - self.write(payload) + self._write_lines(payload) # Default body handler _writeBody = _handle_text @@ -256,7 +269,8 @@ preamble = fcre.sub('>From ', msg.preamble) else: preamble = msg.preamble - self.write(preamble + self._NL) + self._write_lines(preamble) + self.write(self._NL) # dash-boundary transport-padding CRLF self.write('--' + boundary + self._NL) # body-part @@ -278,7 +292,7 @@ epilogue = fcre.sub('>From ', msg.epilogue) else: epilogue = msg.epilogue - self.write(epilogue) + self._write_lines(epilogue) def _handle_multipart_signed(self, msg): # The contents of signed parts has to stay unmodified in order to keep @@ -402,7 +416,7 @@ if _has_surrogates(msg._payload) and not self.policy.cte_type=='7bit': if self._mangle_from_: msg._payload = fcre.sub(">From ", msg._payload) - self.write(msg._payload) + self._write_lines(msg._payload) else: super(BytesGenerator,self)._handle_text(msg) diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -3111,6 +3111,40 @@ email.utils.make_msgid(domain='testdomain-string')[-19:], '@testdomain-string>') + def test_Generator_linend(self): + # Issue 14645. + with openfile('msg_26.txt', newline='\n') as f: + msgtxt = f.read() + msgtxt_nl = msgtxt.replace('\r\n', '\n') + msg = email.message_from_string(msgtxt) + s = StringIO() + g = email.generator.Generator(s) + g.flatten(msg) + self.assertEqual(s.getvalue(), msgtxt_nl) + + def test_BytesGenerator_linend(self): + # Issue 14645. + with openfile('msg_26.txt', newline='\n') as f: + msgtxt = f.read() + msgtxt_nl = msgtxt.replace('\r\n', '\n') + msg = email.message_from_string(msgtxt_nl) + s = BytesIO() + g = email.generator.BytesGenerator(s) + g.flatten(msg, linesep='\r\n') + self.assertEqual(s.getvalue().decode('ascii'), msgtxt) + + def test_BytesGenerator_linend_with_non_ascii(self): + # Issue 14645. + with openfile('msg_26.txt', 'rb') as f: + msgtxt = f.read() + msgtxt = msgtxt.replace(b'with attachment', b'fo\xf6') + msgtxt_nl = msgtxt.replace(b'\r\n', b'\n') + msg = email.message_from_bytes(msgtxt_nl) + s = BytesIO() + g = email.generator.BytesGenerator(s) + g.flatten(msg, linesep='\r\n') + self.assertEqual(s.getvalue(), msgtxt) + # Test the iterator/generators class TestIterators(TestEmailBase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -275,6 +275,11 @@ Library ------- +- Issue #14645: The email generator classes now produce output using the + specified linesep throughout. Previously if the prolog, epilog, or + body were stored with a different linesep, that linesep was used. This + fix corrects an RFC non-compliance issue with smtplib.send_message. + - Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 8 00:17:46 2013 From: python-checkins at python.org (r.david.murray) Date: Fri, 8 Mar 2013 00:17:46 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_PEP8_fixup_on_?= =?utf-8?q?previous_patch=2C_remove_unused_import_in_test=5Femail=2E?= Message-ID: <3ZMSRt0F1Jz7LkQ@mail.python.org> http://hg.python.org/cpython/rev/c8b2ed53b884 changeset: 82537:c8b2ed53b884 branch: 3.2 parent: 82534:30c0f0dd0b94 user: R David Murray date: Thu Mar 07 18:15:13 2013 -0500 summary: PEP8 fixup on previous patch, remove unused import in test_email. files: Lib/email/generator.py | 2 +- Lib/email/test/test_email.py | 1 - 2 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Lib/email/generator.py b/Lib/email/generator.py --- a/Lib/email/generator.py +++ b/Lib/email/generator.py @@ -129,7 +129,7 @@ self.write(self._NL) laststripped = lines[-1].rstrip('\r\n') self.write(laststripped) - if len(lines[-1])!=len(laststripped): + if len(lines[-1]) != len(laststripped): self.write(self._NL) def _write(self, msg): diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -9,7 +9,6 @@ import base64 import difflib import unittest -import warnings import textwrap from io import StringIO, BytesIO -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 8 00:17:47 2013 From: python-checkins at python.org (r.david.murray) Date: Fri, 8 Mar 2013 00:17:47 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge=3A_PEP8_fixup_on_previous_patch=2C_remove_unused_imports?= =?utf-8?q?_in_test=5Femail=2E?= Message-ID: <3ZMSRv3FLzz7Ll7@mail.python.org> http://hg.python.org/cpython/rev/cffc9378b602 changeset: 82538:cffc9378b602 branch: 3.3 parent: 82535:1b9dc00c4d57 parent: 82537:c8b2ed53b884 user: R David Murray date: Thu Mar 07 18:16:47 2013 -0500 summary: Merge: PEP8 fixup on previous patch, remove unused imports in test_email. files: Lib/email/generator.py | 2 +- Lib/test/test_email/test_email.py | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Lib/email/generator.py b/Lib/email/generator.py --- a/Lib/email/generator.py +++ b/Lib/email/generator.py @@ -156,7 +156,7 @@ self.write(self._NL) laststripped = lines[-1].rstrip('\r\n') self.write(laststripped) - if len(lines[-1])!=len(laststripped): + if len(lines[-1]) != len(laststripped): self.write(self._NL) def _write(self, msg): diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -2,14 +2,10 @@ # Contact: email-sig at python.org # email package unit tests -import os import re -import sys import time import base64 -import difflib import unittest -import warnings import textwrap from io import StringIO, BytesIO @@ -37,7 +33,7 @@ from email import base64mime from email import quoprimime -from test.support import run_unittest, unlink +from test.support import unlink from test.test_email import openfile, TestEmailBase NL = '\n' -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 8 00:17:48 2013 From: python-checkins at python.org (r.david.murray) Date: Fri, 8 Mar 2013 00:17:48 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_PEP8_fixup_on_previous_patch=2C_remove_unused_i?= =?utf-8?q?mports_in_test=5Femail=2E?= Message-ID: <3ZMSRw5pbCz7LlY@mail.python.org> http://hg.python.org/cpython/rev/9aafc005a611 changeset: 82539:9aafc005a611 parent: 82536:6b69c11b0ad0 parent: 82538:cffc9378b602 user: R David Murray date: Thu Mar 07 18:17:19 2013 -0500 summary: Merge: PEP8 fixup on previous patch, remove unused imports in test_email. files: Lib/email/generator.py | 2 +- Lib/test/test_email/test_email.py | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Lib/email/generator.py b/Lib/email/generator.py --- a/Lib/email/generator.py +++ b/Lib/email/generator.py @@ -156,7 +156,7 @@ self.write(self._NL) laststripped = lines[-1].rstrip('\r\n') self.write(laststripped) - if len(lines[-1])!=len(laststripped): + if len(lines[-1]) != len(laststripped): self.write(self._NL) def _write(self, msg): diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -2,14 +2,10 @@ # Contact: email-sig at python.org # email package unit tests -import os import re -import sys import time import base64 -import difflib import unittest -import warnings import textwrap from io import StringIO, BytesIO @@ -37,7 +33,7 @@ from email import base64mime from email import quoprimime -from test.support import run_unittest, unlink +from test.support import unlink from test.test_email import openfile, TestEmailBase NL = '\n' -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 8 02:33:56 2013 From: python-checkins at python.org (victor.stinner) Date: Fri, 8 Mar 2013 02:33:56 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE3MjIz?= =?utf-8?q?=3A_the_test_is_specific_to_32-bit_wchar=5Ft_type?= Message-ID: <3ZMWT01MpyzQQP@mail.python.org> http://hg.python.org/cpython/rev/1fd165883a65 changeset: 82540:1fd165883a65 branch: 3.3 parent: 82538:cffc9378b602 user: Victor Stinner date: Fri Mar 08 02:33:06 2013 +0100 summary: Issue #17223: the test is specific to 32-bit wchar_t type Skip the test on Windows. files: Lib/test/test_array.py | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -24,15 +24,7 @@ except struct.error: have_long_long = False -try: - import ctypes - sizeof_wchar = ctypes.sizeof(ctypes.c_wchar) -except ImportError: - import sys - if sys.platform == 'win32': - sizeof_wchar = 2 - else: - sizeof_wchar = 4 +sizeof_wchar = array.array('u').itemsize class ArraySubclass(array.array): @@ -1076,8 +1068,8 @@ # U+FFFFFFFF is an invalid code point in Unicode 6.0 invalid_str = b'\xff\xff\xff\xff' else: - # invalid UTF-16 surrogate pair - invalid_str = b'\xff\xdf\x61\x00' + # PyUnicode_FromUnicode() cannot fail with 16-bit wchar_t + self.skipTest("specific to 32-bit wchar_t") a = array.array('u', invalid_str) self.assertRaises(ValueError, a.tounicode) self.assertRaises(ValueError, str, a) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 8 02:33:57 2013 From: python-checkins at python.org (victor.stinner) Date: Fri, 8 Mar 2013 02:33:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_=28Merge_3=2E3=29_Issue_=2317223=3A_the_test_is_specific?= =?utf-8?q?_to_32-bit_wchar=5Ft_type?= Message-ID: <3ZMWT14DW1zQs0@mail.python.org> http://hg.python.org/cpython/rev/42970cbfc982 changeset: 82541:42970cbfc982 parent: 82539:9aafc005a611 parent: 82540:1fd165883a65 user: Victor Stinner date: Fri Mar 08 02:33:44 2013 +0100 summary: (Merge 3.3) Issue #17223: the test is specific to 32-bit wchar_t type Skip the test on Windows. files: Lib/test/test_array.py | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -24,15 +24,7 @@ except struct.error: have_long_long = False -try: - import ctypes - sizeof_wchar = ctypes.sizeof(ctypes.c_wchar) -except ImportError: - import sys - if sys.platform == 'win32': - sizeof_wchar = 2 - else: - sizeof_wchar = 4 +sizeof_wchar = array.array('u').itemsize class ArraySubclass(array.array): @@ -1076,8 +1068,8 @@ # U+FFFFFFFF is an invalid code point in Unicode 6.0 invalid_str = b'\xff\xff\xff\xff' else: - # invalid UTF-16 surrogate pair - invalid_str = b'\xff\xdf\x61\x00' + # PyUnicode_FromUnicode() cannot fail with 16-bit wchar_t + self.skipTest("specific to 32-bit wchar_t") a = array.array('u', invalid_str) self.assertRaises(ValueError, a.tounicode) self.assertRaises(ValueError, str, a) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 8 04:17:27 2013 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 8 Mar 2013 04:17:27 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Add_PyDict=5FSetDefault=2E?= =?utf-8?q?_=28closes_=2317327=29?= Message-ID: <3ZMYmR2nDyz7Lk9@mail.python.org> http://hg.python.org/cpython/rev/a0b750ea3397 changeset: 82542:a0b750ea3397 user: Benjamin Peterson date: Thu Mar 07 22:16:29 2013 -0500 summary: Add PyDict_SetDefault. (closes #17327) Patch by Stefan Behnel and I. files: Doc/c-api/dict.rst | 9 +++++++ Doc/data/refcounts.dat | 5 ++++ Include/dictobject.h | 2 + Misc/NEWS | 2 + Objects/dictobject.c | 34 ++++++++++++++++++++--------- 5 files changed, 41 insertions(+), 11 deletions(-) diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -110,6 +110,15 @@ :c:type:`char\*`, rather than a :c:type:`PyObject\*`. +.. c:function:: PyObject* PyDict_SetDefault(PyObject *p, PyObject *key, PyObject *default) + + This is the same the Python-level :meth:`dict.setdefault`. If present, it + returns the value corresponding to *key* from the dictionary *p*. If the key + is not in the dict, it is inserted with value *defaultobj* and *defaultobj* + is inserted. This function evaluates the hash function of *key* only once, + instead of evaluating it independently for the lookup and the insertion. + + .. c:function:: PyObject* PyDict_Items(PyObject *p) Return a :c:type:`PyListObject` containing all the items from the dictionary. diff --git a/Doc/data/refcounts.dat b/Doc/data/refcounts.dat --- a/Doc/data/refcounts.dat +++ b/Doc/data/refcounts.dat @@ -220,6 +220,11 @@ PyDict_GetItemString:PyObject*:p:0: PyDict_GetItemString:char*:key:: +PyDict_SetDefault:PyObject*::0: +PyDict_SetDefault:PyObject*:p:0: +PyDict_SetDefault:PyObject*:key:0:conditionally +1 if inserted into the dict +PyDict_SetDefault:PyObject*:default:0:conditionally +1 if inserted into the dict + PyDict_Items:PyObject*::+1: PyDict_Items:PyObject*:p:0: diff --git a/Include/dictobject.h b/Include/dictobject.h --- a/Include/dictobject.h +++ b/Include/dictobject.h @@ -53,6 +53,8 @@ PyAPI_FUNC(PyObject *) PyDict_GetItemWithError(PyObject *mp, PyObject *key); PyAPI_FUNC(PyObject *) _PyDict_GetItemIdWithError(PyObject *dp, struct _Py_Identifier *key); +PyAPI_FUNC(PyObject *) PyDict_SetDefault( + PyObject *mp, PyObject *key, PyObject *defaultobj); PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item); PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key); PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #17327: Add PyDict_SetDefault. + - Issue #17032: The "global" in the "NameError: global name 'x' is not defined" error message has been removed. Patch by Ram Rachum. diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2211,19 +2211,19 @@ return val; } -static PyObject * -dict_setdefault(register PyDictObject *mp, PyObject *args) +PyObject * +PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *defaultobj) { - PyObject *key; - PyObject *failobj = Py_None; + PyDictObject *mp = (PyDictObject *)d; PyObject *val = NULL; Py_hash_t hash; PyDictKeyEntry *ep; PyObject **value_addr; - if (!PyArg_UnpackTuple(args, "setdefault", 1, 2, &key, &failobj)) + if (!PyDict_Check(d)) { + PyErr_BadInternalCall(); return NULL; - + } if (!PyUnicode_CheckExact(key) || (hash = ((PyASCIIObject *) key)->hash) == -1) { hash = PyObject_Hash(key); @@ -2241,20 +2241,32 @@ return NULL; ep = find_empty_slot(mp, key, hash, &value_addr); } - Py_INCREF(failobj); + Py_INCREF(defaultobj); Py_INCREF(key); - MAINTAIN_TRACKING(mp, key, failobj); + MAINTAIN_TRACKING(mp, key, defaultobj); ep->me_key = key; ep->me_hash = hash; - *value_addr = failobj; - val = failobj; + *value_addr = defaultobj; + val = defaultobj; mp->ma_keys->dk_usable--; mp->ma_used++; } - Py_INCREF(val); return val; } +static PyObject * +dict_setdefault(PyDictObject *mp, PyObject *args) +{ + PyObject *key, *val; + PyObject *defaultobj = Py_None; + + if (!PyArg_UnpackTuple(args, "setdefault", 1, 2, &key, &defaultobj)) + return NULL; + + val = PyDict_SetDefault(mp, key, defaultobj); + Py_XINCREF(val); + return val; +} static PyObject * dict_clear(register PyDictObject *mp) -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Fri Mar 8 05:57:03 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 08 Mar 2013 05:57:03 +0100 Subject: [Python-checkins] Daily reference leaks (42970cbfc982): sum=0 Message-ID: results for 42970cbfc982 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogeY0qxE', '-x'] From python-checkins at python.org Fri Mar 8 10:51:32 2013 From: python-checkins at python.org (vinay.sajip) Date: Fri, 8 Mar 2013 10:51:32 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317384=3A_Consolid?= =?utf-8?q?ated_cleanup_operations_in_tests=2E?= Message-ID: <3ZMkW83fZNzNs3@mail.python.org> http://hg.python.org/cpython/rev/85325bce9982 changeset: 82543:85325bce9982 user: Vinay Sajip date: Fri Mar 08 09:50:57 2013 +0000 summary: Issue #17384: Consolidated cleanup operations in tests. files: Lib/test/test_logging.py | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -3396,6 +3396,12 @@ self.assertEqual(logging.root.level, self.original_logging_level) def test_filename(self): + + def cleanup(h1, h2, fn): + h1.close() + h2.close() + os.remove(fn) + logging.basicConfig(filename='test.log') self.assertEqual(len(logging.root.handlers), 1) @@ -3403,19 +3409,23 @@ self.assertIsInstance(handler, logging.FileHandler) expected = logging.FileHandler('test.log', 'a') - self.addCleanup(expected.close) self.assertEqual(handler.stream.mode, expected.stream.mode) self.assertEqual(handler.stream.name, expected.stream.name) - self.addCleanup(os.remove, 'test.log') + self.addCleanup(cleanup, handler, expected, 'test.log') def test_filemode(self): + + def cleanup(h1, h2, fn): + h1.close() + h2.close() + os.remove(fn) + logging.basicConfig(filename='test.log', filemode='wb') handler = logging.root.handlers[0] expected = logging.FileHandler('test.log', 'wb') - self.addCleanup(expected.close) self.assertEqual(handler.stream.mode, expected.stream.mode) - self.addCleanup(os.remove, 'test.log') + self.addCleanup(cleanup, handler, expected, 'test.log') def test_stream(self): stream = io.StringIO() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 8 14:33:58 2013 From: python-checkins at python.org (eli.bendersky) Date: Fri, 8 Mar 2013 14:33:58 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3Mzc4?= =?utf-8?q?=3A_ctypes_documentation_fix=2E?= Message-ID: <3ZMqRp6TS8zQfD@mail.python.org> http://hg.python.org/cpython/rev/76be5efa0d86 changeset: 82544:76be5efa0d86 branch: 3.2 parent: 82537:c8b2ed53b884 user: Eli Bendersky date: Fri Mar 08 05:31:54 2013 -0800 summary: Issue #17378: ctypes documentation fix. Document that ctypes automatically applies byref() when argtypes declares POINTER. files: Doc/library/ctypes.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -817,6 +817,11 @@ 3 >>> +In addition, if a function argument is explicitly declared to be a pointer type +(such as ``POINTER(c_int)``) in :attr:`argtypes`, an object of the pointed +type (``c_int`` in this case) can be passed to the function. ctypes will apply +the required :func:`byref` conversion in this case automatically. + To set a POINTER type field to ``NULL``, you can assign ``None``:: >>> bar.values = None -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 8 14:34:00 2013 From: python-checkins at python.org (eli.bendersky) Date: Fri, 8 Mar 2013 14:34:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Issue_=2317378=3A_ctypes_documentation_fix=2E?= Message-ID: <3ZMqRr1xKczQrd@mail.python.org> http://hg.python.org/cpython/rev/2cd2d8f8f72f changeset: 82545:2cd2d8f8f72f branch: 3.3 parent: 82540:1fd165883a65 parent: 82544:76be5efa0d86 user: Eli Bendersky date: Fri Mar 08 05:32:45 2013 -0800 summary: Issue #17378: ctypes documentation fix. Document that ctypes automatically applies byref() when argtypes declares POINTER. files: Doc/library/ctypes.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -822,6 +822,11 @@ 3 >>> +In addition, if a function argument is explicitly declared to be a pointer type +(such as ``POINTER(c_int)``) in :attr:`argtypes`, an object of the pointed +type (``c_int`` in this case) can be passed to the function. ctypes will apply +the required :func:`byref` conversion in this case automatically. + To set a POINTER type field to ``NULL``, you can assign ``None``:: >>> bar.values = None -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 8 14:34:01 2013 From: python-checkins at python.org (eli.bendersky) Date: Fri, 8 Mar 2013 14:34:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2317378=3A_ctypes_documentation_fix=2E?= Message-ID: <3ZMqRs4PQCzQlS@mail.python.org> http://hg.python.org/cpython/rev/58c07ba40926 changeset: 82546:58c07ba40926 parent: 82543:85325bce9982 parent: 82545:2cd2d8f8f72f user: Eli Bendersky date: Fri Mar 08 05:33:05 2013 -0800 summary: Issue #17378: ctypes documentation fix. Document that ctypes automatically applies byref() when argtypes declares POINTER. files: Doc/library/ctypes.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -822,6 +822,11 @@ 3 >>> +In addition, if a function argument is explicitly declared to be a pointer type +(such as ``POINTER(c_int)``) in :attr:`argtypes`, an object of the pointed +type (``c_int`` in this case) can be passed to the function. ctypes will apply +the required :func:`byref` conversion in this case automatically. + To set a POINTER type field to ``NULL``, you can assign ``None``:: >>> bar.values = None -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 8 14:35:51 2013 From: python-checkins at python.org (eli.bendersky) Date: Fri, 8 Mar 2013 14:35:51 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogQ2xvc2luZyAjMTcz?= =?utf-8?q?78=3A_ctypes_documentation_fix=2E?= Message-ID: <3ZMqTz1nH8zMgy@mail.python.org> http://hg.python.org/cpython/rev/2dd77a12e7bf changeset: 82547:2dd77a12e7bf branch: 2.7 parent: 82516:cfc777407b03 user: Eli Bendersky date: Fri Mar 08 05:34:58 2013 -0800 summary: Closing #17378: ctypes documentation fix. Document that ctypes automatically applies byref() when argtypes declares POINTER. files: Doc/library/ctypes.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -816,6 +816,11 @@ 3 >>> +In addition, if a function argument is explicitly declared to be a pointer type +(such as ``POINTER(c_int)``) in :attr:`argtypes`, an object of the pointed +type (``c_int`` in this case) can be passed to the function. ctypes will apply +the required :func:`byref` conversion in this case automatically. + To set a POINTER type field to ``NULL``, you can assign ``None``:: >>> bar.values = None -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 8 14:36:56 2013 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 8 Mar 2013 14:36:56 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_fix_warning_=28closes_=231?= =?utf-8?q?7327=29?= Message-ID: <3ZMqWD4PsVzQrd@mail.python.org> http://hg.python.org/cpython/rev/ca9a85c36e09 changeset: 82548:ca9a85c36e09 parent: 82546:58c07ba40926 user: Benjamin Peterson date: Fri Mar 08 08:36:49 2013 -0500 summary: fix warning (closes #17327) files: Objects/dictobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2263,7 +2263,7 @@ if (!PyArg_UnpackTuple(args, "setdefault", 1, 2, &key, &defaultobj)) return NULL; - val = PyDict_SetDefault(mp, key, defaultobj); + val = PyDict_SetDefault((PyObject *)mp, key, defaultobj); Py_XINCREF(val); return val; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 00:27:39 2013 From: python-checkins at python.org (vinay.sajip) Date: Sat, 9 Mar 2013 00:27:39 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3Mzc2?= =?utf-8?q?=3A_Clarified_documentation_for_TimedRotatingFileHandler_weekda?= =?utf-8?q?y?= Message-ID: <3ZN4cq3Pf1zP9C@mail.python.org> http://hg.python.org/cpython/rev/56b74b9c81c3 changeset: 82549:56b74b9c81c3 branch: 2.7 parent: 82547:2dd77a12e7bf user: Vinay Sajip date: Fri Mar 08 23:22:22 2013 +0000 summary: Issue #17376: Clarified documentation for TimedRotatingFileHandler weekday rotation. files: Doc/library/logging.handlers.rst | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -236,11 +236,15 @@ +----------------+-----------------------+ | ``'D'`` | Days | +----------------+-----------------------+ - | ``'W'`` | Week day (0=Monday) | + | ``'W0'-'W6'`` | Weekday (0=Monday) | +----------------+-----------------------+ | ``'midnight'`` | Roll over at midnight | +----------------+-----------------------+ + When using weekday-based rotation, specify 'W0' for Monday, 'W1' for + Tuesday, and so on up to 'W6' for Sunday. In this case, the value passed for + *interval* isn't used. + The system will save old log files by appending extensions to the filename. The extensions are date-and-time based, using the strftime format ``%Y-%m-%d_%H-%M-%S`` or a leading portion thereof, depending on the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 00:27:40 2013 From: python-checkins at python.org (vinay.sajip) Date: Sat, 9 Mar 2013 00:27:40 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3Mzc2?= =?utf-8?q?=3A_Clarified_documentation_for_TimedRotatingFileHandler_weekda?= =?utf-8?q?y?= Message-ID: <3ZN4cr6SMHzP9C@mail.python.org> http://hg.python.org/cpython/rev/83f07e3a53f4 changeset: 82550:83f07e3a53f4 branch: 3.2 parent: 82544:76be5efa0d86 user: Vinay Sajip date: Fri Mar 08 23:24:30 2013 +0000 summary: Issue #17376: Clarified documentation for TimedRotatingFileHandler weekday rotation. files: Doc/library/logging.handlers.rst | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -236,11 +236,15 @@ +----------------+-----------------------+ | ``'D'`` | Days | +----------------+-----------------------+ - | ``'W'`` | Week day (0=Monday) | + | ``'W0'-'W6'`` | Weekday (0=Monday) | +----------------+-----------------------+ | ``'midnight'`` | Roll over at midnight | +----------------+-----------------------+ + When using weekday-based rotation, specify 'W0' for Monday, 'W1' for + Tuesday, and so on up to 'W6' for Sunday. In this case, the value passed for + *interval* isn't used. + The system will save old log files by appending extensions to the filename. The extensions are date-and-time based, using the strftime format ``%Y-%m-%d_%H-%M-%S`` or a leading portion thereof, depending on the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 00:27:42 2013 From: python-checkins at python.org (vinay.sajip) Date: Sat, 9 Mar 2013 00:27:42 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Issue_=2317376=3A_Merged_clarification_from_3=2E2=2E?= Message-ID: <3ZN4ct20vNzQ81@mail.python.org> http://hg.python.org/cpython/rev/12239c13db72 changeset: 82551:12239c13db72 branch: 3.3 parent: 82545:2cd2d8f8f72f parent: 82550:83f07e3a53f4 user: Vinay Sajip date: Fri Mar 08 23:26:43 2013 +0000 summary: Issue #17376: Merged clarification from 3.2. files: Doc/library/logging.handlers.rst | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -317,11 +317,15 @@ +----------------+-----------------------+ | ``'D'`` | Days | +----------------+-----------------------+ - | ``'W'`` | Week day (0=Monday) | + | ``'W0'-'W6'`` | Weekday (0=Monday) | +----------------+-----------------------+ | ``'midnight'`` | Roll over at midnight | +----------------+-----------------------+ + When using weekday-based rotation, specify 'W0' for Monday, 'W1' for + Tuesday, and so on up to 'W6' for Sunday. In this case, the value passed for + *interval* isn't used. + The system will save old log files by appending extensions to the filename. The extensions are date-and-time based, using the strftime format ``%Y-%m-%d_%H-%M-%S`` or a leading portion thereof, depending on the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 00:27:43 2013 From: python-checkins at python.org (vinay.sajip) Date: Sat, 9 Mar 2013 00:27:43 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Closes_=2317376=3A_Merged_clarification_from_3=2E3=2E?= Message-ID: <3ZN4cv4m8lzQNY@mail.python.org> http://hg.python.org/cpython/rev/a8047d1376d5 changeset: 82552:a8047d1376d5 parent: 82548:ca9a85c36e09 parent: 82551:12239c13db72 user: Vinay Sajip date: Fri Mar 08 23:27:24 2013 +0000 summary: Closes #17376: Merged clarification from 3.3. files: Doc/library/logging.handlers.rst | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -317,11 +317,15 @@ +----------------+-----------------------+ | ``'D'`` | Days | +----------------+-----------------------+ - | ``'W'`` | Week day (0=Monday) | + | ``'W0'-'W6'`` | Weekday (0=Monday) | +----------------+-----------------------+ | ``'midnight'`` | Roll over at midnight | +----------------+-----------------------+ + When using weekday-based rotation, specify 'W0' for Monday, 'W1' for + Tuesday, and so on up to 'W6' for Sunday. In this case, the value passed for + *interval* isn't used. + The system will save old log files by appending extensions to the filename. The extensions are date-and-time based, using the strftime format ``%Y-%m-%d_%H-%M-%S`` or a leading portion thereof, depending on the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 01:41:00 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 9 Mar 2013 01:41:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3MzMy?= =?utf-8?q?=3A_fix_json_doc_typo_/convered/converted/_found_by_Ernie_Hersh?= =?utf-8?b?ZXku?= Message-ID: <3ZN6FS2CZyzQDL@mail.python.org> http://hg.python.org/cpython/rev/9bd2fc35f311 changeset: 82553:9bd2fc35f311 branch: 2.7 parent: 82549:56b74b9c81c3 user: Terry Jan Reedy date: Fri Mar 08 19:35:15 2013 -0500 summary: Issue #17332: fix json doc typo /convered/converted/ found by Ernie Hershey. files: Doc/library/json.rst | 2 +- Misc/ACKS | 1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -197,7 +197,7 @@ Keys in key/value pairs of JSON are always of the type :class:`str`. When a dictionary is converted into JSON, all the keys of the dictionary are - coerced to strings. As a result of this, if a dictionary is convered + coerced to strings. As a result of this, if a dictionary is converted into JSON and then back into a dictionary, the dictionary may not equal the original one. That is, ``loads(dumps(x)) != x`` if x has non-string keys. diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -409,6 +409,7 @@ Ivan Herman J?rgen Hermann Gary Herron +Ernie Hershey Thomas Herve Bernhard Herzog Magnus L. Hetland -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 01:41:01 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 9 Mar 2013 01:41:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3MzMy?= =?utf-8?q?=3A_fix_json_doc_typo_/convered/converted/_found_by_Ernie_Hersh?= =?utf-8?b?ZXku?= Message-ID: <3ZN6FT5KjpzQDL@mail.python.org> http://hg.python.org/cpython/rev/55fd9810c9ab changeset: 82554:55fd9810c9ab branch: 3.2 parent: 82550:83f07e3a53f4 user: Terry Jan Reedy date: Fri Mar 08 19:35:15 2013 -0500 summary: Issue #17332: fix json doc typo /convered/converted/ found by Ernie Hershey. files: Doc/library/json.rst | 2 +- Misc/ACKS | 1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -195,7 +195,7 @@ Keys in key/value pairs of JSON are always of the type :class:`str`. When a dictionary is converted into JSON, all the keys of the dictionary are - coerced to strings. As a result of this, if a dictionary is convered + coerced to strings. As a result of this, if a dictionary is converted into JSON and then back into a dictionary, the dictionary may not equal the original one. That is, ``loads(dumps(x)) != x`` if x has non-string keys. diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -446,6 +446,7 @@ Ivan Herman J?rgen Hermann Gary Herron +Ernie Hershey Thomas Herve Bernhard Herzog Magnus L. Hetland -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 01:41:03 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 9 Mar 2013 01:41:03 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Issue_=2317332=3A_fix_json_doc_typo_/convered/converted/_found?= =?utf-8?q?_by_Ernie_Hershey=2E?= Message-ID: <3ZN6FW1CvRzQLp@mail.python.org> http://hg.python.org/cpython/rev/8817a09e012c changeset: 82555:8817a09e012c branch: 3.3 parent: 82551:12239c13db72 parent: 82554:55fd9810c9ab user: Terry Jan Reedy date: Fri Mar 08 19:39:30 2013 -0500 summary: Issue #17332: fix json doc typo /convered/converted/ found by Ernie Hershey. files: Doc/library/json.rst | 2 +- Misc/ACKS | 1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -195,7 +195,7 @@ Keys in key/value pairs of JSON are always of the type :class:`str`. When a dictionary is converted into JSON, all the keys of the dictionary are - coerced to strings. As a result of this, if a dictionary is convered + coerced to strings. As a result of this, if a dictionary is converted into JSON and then back into a dictionary, the dictionary may not equal the original one. That is, ``loads(dumps(x)) != x`` if x has non-string keys. diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -490,6 +490,7 @@ Ivan Herman J?rgen Hermann Gary Herron +Ernie Hershey Thomas Herve Bernhard Herzog Magnus L. Hetland -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 01:41:04 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 9 Mar 2013 01:41:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2317332=3A_fix_json_doc_typo_/convered/converted/?= =?utf-8?q?_found_by_Ernie_Hershey=2E?= Message-ID: <3ZN6FX3y8BzQM1@mail.python.org> http://hg.python.org/cpython/rev/d86f5686cef9 changeset: 82556:d86f5686cef9 parent: 82552:a8047d1376d5 parent: 82555:8817a09e012c user: Terry Jan Reedy date: Fri Mar 08 19:40:17 2013 -0500 summary: Issue #17332: fix json doc typo /convered/converted/ found by Ernie Hershey. files: Doc/library/json.rst | 2 +- Misc/ACKS | 1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -192,7 +192,7 @@ Keys in key/value pairs of JSON are always of the type :class:`str`. When a dictionary is converted into JSON, all the keys of the dictionary are - coerced to strings. As a result of this, if a dictionary is convered + coerced to strings. As a result of this, if a dictionary is converted into JSON and then back into a dictionary, the dictionary may not equal the original one. That is, ``loads(dumps(x)) != x`` if x has non-string keys. diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -493,6 +493,7 @@ Ivan Herman J?rgen Hermann Gary Herron +Ernie Hershey Thomas Herve Bernhard Herzog Magnus L. Hetland -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 05:02:38 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 9 Mar 2013 05:02:38 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3Mzc1?= =?utf-8?q?=3A__Add_docstrings_to_the_threading_module=2E?= Message-ID: <3ZNBk63LHqzPyP@mail.python.org> http://hg.python.org/cpython/rev/e0ef2bde35c3 changeset: 82557:e0ef2bde35c3 branch: 2.7 parent: 82553:9bd2fc35f311 user: Raymond Hettinger date: Fri Mar 08 21:02:13 2013 -0700 summary: Issue #17375: Add docstrings to the threading module. files: Lib/threading.py | 351 ++++++++++++++++++++++++++++++++++- 1 files changed, 346 insertions(+), 5 deletions(-) diff --git a/Lib/threading.py b/Lib/threading.py --- a/Lib/threading.py +++ b/Lib/threading.py @@ -87,10 +87,22 @@ _trace_hook = None def setprofile(func): + """Set a profile function for all threads started from the threading module. + + The func will be passed to sys.setprofile() for each thread, before its + run() method is called. + + """ global _profile_hook _profile_hook = func def settrace(func): + """Set a trace function for all threads started from the threading module. + + The func will be passed to sys.settrace() for each thread, before its run() + method is called. + + """ global _trace_hook _trace_hook = func @@ -99,9 +111,22 @@ Lock = _allocate_lock def RLock(*args, **kwargs): + """Factory function that returns a new reentrant lock. + + A reentrant lock must be released by the thread that acquired it. Once a + thread has acquired a reentrant lock, the same thread may acquire it again + without blocking; the thread must release it once for each time it has + acquired it. + + """ return _RLock(*args, **kwargs) class _RLock(_Verbose): + """A reentrant lock must be released by the thread that acquired it. Once a + thread has acquired a reentrant lock, the same thread may acquire it + again without blocking; the thread must release it once for each time it + has acquired it. + """ def __init__(self, verbose=None): _Verbose.__init__(self, verbose) @@ -119,6 +144,26 @@ self.__class__.__name__, owner, self.__count) def acquire(self, blocking=1): + """Acquire a lock, blocking or non-blocking. + + When invoked without arguments: if this thread already owns the lock, + increment the recursion level by one, and return immediately. Otherwise, + if another thread owns the lock, block until the lock is unlocked. Once + the lock is unlocked (not owned by any thread), then grab ownership, set + the recursion level to one, and return. If more than one thread is + blocked waiting until the lock is unlocked, only one at a time will be + able to grab ownership of the lock. There is no return value in this + case. + + When invoked with the blocking argument set to true, do the same thing + as when called without arguments, and return true. + + When invoked with the blocking argument set to false, do not block. If a + call without an argument would block, return false immediately; + otherwise, do the same thing as when called without arguments, and + return true. + + """ me = _get_ident() if self.__owner == me: self.__count = self.__count + 1 @@ -139,6 +184,21 @@ __enter__ = acquire def release(self): + """Release a lock, decrementing the recursion level. + + If after the decrement it is zero, reset the lock to unlocked (not owned + by any thread), and if any other threads are blocked waiting for the + lock to become unlocked, allow exactly one of them to proceed. If after + the decrement the recursion level is still nonzero, the lock remains + locked and owned by the calling thread. + + Only call this method when the calling thread owns the lock. A + RuntimeError is raised if this method is called when the lock is + unlocked. + + There is no return value. + + """ if self.__owner != _get_ident(): raise RuntimeError("cannot release un-acquired lock") self.__count = count = self.__count - 1 @@ -179,9 +239,22 @@ def Condition(*args, **kwargs): + """Factory function that returns a new condition variable object. + + A condition variable allows one or more threads to wait until they are + notified by another thread. + + If the lock argument is given and not None, it must be a Lock or RLock + object, and it is used as the underlying lock. Otherwise, a new RLock object + is created and used as the underlying lock. + + """ return _Condition(*args, **kwargs) class _Condition(_Verbose): + """Condition variables allow one or more threads to wait until they are + notified by another thread. + """ def __init__(self, lock=None, verbose=None): _Verbose.__init__(self, verbose) @@ -233,6 +306,28 @@ return True def wait(self, timeout=None): + """Wait until notified or until a timeout occurs. + + If the calling thread has not acquired the lock when this method is + called, a RuntimeError is raised. + + This method releases the underlying lock, and then blocks until it is + awakened by a notify() or notifyAll() call for the same condition + variable in another thread, or until the optional timeout occurs. Once + awakened or timed out, it re-acquires the lock and returns. + + When the timeout argument is present and not None, it should be a + floating point number specifying a timeout for the operation in seconds + (or fractions thereof). + + When the underlying lock is an RLock, it is not released using its + release() method, since this may not actually unlock the lock when it + was acquired multiple times recursively. Instead, an internal interface + of the RLock class is used, which really unlocks it even when it has + been recursively acquired several times. Another internal interface is + then used to restore the recursion level when the lock is reacquired. + + """ if not self._is_owned(): raise RuntimeError("cannot wait on un-acquired lock") waiter = _allocate_lock() @@ -275,6 +370,15 @@ self._acquire_restore(saved_state) def notify(self, n=1): + """Wake up one or more threads waiting on this condition, if any. + + If the calling thread has not acquired the lock when this method is + called, a RuntimeError is raised. + + This method wakes up at most n of the threads waiting for the condition + variable; it is a no-op if no threads are waiting. + + """ if not self._is_owned(): raise RuntimeError("cannot notify on un-acquired lock") __waiters = self.__waiters @@ -293,15 +397,35 @@ pass def notifyAll(self): + """Wake up all threads waiting on this condition. + + If the calling thread has not acquired the lock when this method + is called, a RuntimeError is raised. + + """ self.notify(len(self.__waiters)) notify_all = notifyAll def Semaphore(*args, **kwargs): + """A factory function that returns a new semaphore. + + Semaphores manage a counter representing the number of release() calls minus + the number of acquire() calls, plus an initial value. The acquire() method + blocks if necessary until it can return without making the counter + negative. If not given, value defaults to 1. + + """ return _Semaphore(*args, **kwargs) class _Semaphore(_Verbose): + """Semaphores manage a counter representing the number of release() calls + minus the number of acquire() calls, plus an initial value. The acquire() + method blocks if necessary until it can return without making the counter + negative. If not given, value defaults to 1. + + """ # After Tim Peters' semaphore class, but not quite the same (no maximum) @@ -313,6 +437,25 @@ self.__value = value def acquire(self, blocking=1): + """Acquire a semaphore, decrementing the internal counter by one. + + When invoked without arguments: if the internal counter is larger than + zero on entry, decrement it by one and return immediately. If it is zero + on entry, block, waiting until some other thread has called release() to + make it larger than zero. This is done with proper interlocking so that + if multiple acquire() calls are blocked, release() will wake exactly one + of them up. The implementation may pick one at random, so the order in + which blocked threads are awakened should not be relied on. There is no + return value in this case. + + When invoked with blocking set to true, do the same thing as when called + without arguments, and return true. + + When invoked with blocking set to false, do not block. If a call without + an argument would block, return false immediately; otherwise, do the + same thing as when called without arguments, and return true. + + """ rc = False self.__cond.acquire() while self.__value == 0: @@ -334,6 +477,12 @@ __enter__ = acquire def release(self): + """Release a semaphore, incrementing the internal counter by one. + + When the counter is zero on entry and another thread is waiting for it + to become larger than zero again, wake up that thread. + + """ self.__cond.acquire() self.__value = self.__value + 1 if __debug__: @@ -347,24 +496,64 @@ def BoundedSemaphore(*args, **kwargs): + """A factory function that returns a new bounded semaphore. + + A bounded semaphore checks to make sure its current value doesn't exceed its + initial value. If it does, ValueError is raised. In most situations + semaphores are used to guard resources with limited capacity. + + If the semaphore is released too many times it's a sign of a bug. If not + given, value defaults to 1. + + Like regular semaphores, bounded semaphores manage a counter representing + the number of release() calls minus the number of acquire() calls, plus an + initial value. The acquire() method blocks if necessary until it can return + without making the counter negative. If not given, value defaults to 1. + + """ return _BoundedSemaphore(*args, **kwargs) class _BoundedSemaphore(_Semaphore): - """Semaphore that checks that # releases is <= # acquires""" + """A bounded semaphore checks to make sure its current value doesn't exceed + its initial value. If it does, ValueError is raised. In most situations + semaphores are used to guard resources with limited capacity. + """ + def __init__(self, value=1, verbose=None): _Semaphore.__init__(self, value, verbose) self._initial_value = value def release(self): + """Release a semaphore, incrementing the internal counter by one. + + When the counter is zero on entry and another thread is waiting for it + to become larger than zero again, wake up that thread. + + If the number of releases exceeds the number of acquires, + raise a ValueError. + + """ if self._Semaphore__value >= self._initial_value: - raise ValueError, "Semaphore released too many times" + raise ValueError("Semaphore released too many times") return _Semaphore.release(self) def Event(*args, **kwargs): + """A factory function that returns a new event. + + Events manage a flag that can be set to true with the set() method and reset + to false with the clear() method. The wait() method blocks until the flag is + true. + + """ return _Event(*args, **kwargs) class _Event(_Verbose): + """A factory function that returns a new event object. An event manages a + flag that can be set to true with the set() method and reset to false + with the clear() method. The wait() method blocks until the flag is true. + + """ # After Tim Peters' event class (without is_posted()) @@ -378,11 +567,18 @@ self.__cond.__init__() def isSet(self): + 'Return true if and only if the internal flag is true.' return self.__flag is_set = isSet def set(self): + """Set the internal flag to true. + + All threads waiting for the flag to become true are awakened. Threads + that call wait() once the flag is true will not block at all. + + """ self.__cond.acquire() try: self.__flag = True @@ -391,6 +587,12 @@ self.__cond.release() def clear(self): + """Reset the internal flag to false. + + Subsequently, threads calling wait() will block until set() is called to + set the internal flag to true again. + + """ self.__cond.acquire() try: self.__flag = False @@ -398,6 +600,20 @@ self.__cond.release() def wait(self, timeout=None): + """Block until the internal flag is true. + + If the internal flag is true on entry, return immediately. Otherwise, + block until another thread calls set() to set the flag to true, or until + the optional timeout occurs. + + When the timeout argument is present and not None, it should be a + floating point number specifying a timeout for the operation in seconds + (or fractions thereof). + + This method returns the internal flag on exit, so it will always return + True except if a timeout is given and the operation times out. + + """ self.__cond.acquire() try: if not self.__flag: @@ -422,7 +638,11 @@ # Main class for threads class Thread(_Verbose): + """A class that represents a thread of control. + This class can be safely subclassed in a limited fashion. + + """ __initialized = False # Need to store a reference to sys.exc_info for printing # out exceptions when a thread tries to use a global var. during interp. @@ -435,6 +655,27 @@ def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, verbose=None): + """This constructor should always be called with keyword arguments. Arguments are: + + *group* should be None; reserved for future extension when a ThreadGroup + class is implemented. + + *target* is the callable object to be invoked by the run() + method. Defaults to None, meaning nothing is called. + + *name* is the thread name. By default, a unique name is constructed of + the form "Thread-N" where N is a small decimal number. + + *args* is the argument tuple for the target invocation. Defaults to (). + + *kwargs* is a dictionary of keyword arguments for the target + invocation. Defaults to {}. + + If a subclass overrides the constructor, it must make sure to invoke + the base class constructor (Thread.__init__()) before doing anything + else to the thread. + +""" assert group is None, "group argument must be None for now" _Verbose.__init__(self, verbose) if kwargs is None: @@ -483,6 +724,15 @@ return "<%s(%s, %s)>" % (self.__class__.__name__, self.__name, status) def start(self): + """Start the thread's activity. + + It must be called at most once per thread object. It arranges for the + object's run() method to be invoked in a separate thread of control. + + This method will raise a RuntimeError if called more than once on the + same thread object. + + """ if not self.__initialized: raise RuntimeError("thread.__init__() not called") if self.__started.is_set(): @@ -500,6 +750,14 @@ self.__started.wait() def run(self): + """Method representing the thread's activity. + + You may override this method in a subclass. The standard run() method + invokes the callable object passed to the object's constructor as the + target argument, if any, with sequential and keyword arguments taken + from the args and kwargs arguments, respectively. + + """ try: if self.__target: self.__target(*self.__args, **self.__kwargs) @@ -651,6 +909,29 @@ raise def join(self, timeout=None): + """Wait until the thread terminates. + + This blocks the calling thread until the thread whose join() method is + called terminates -- either normally or through an unhandled exception + or until the optional timeout occurs. + + When the timeout argument is present and not None, it should be a + floating point number specifying a timeout for the operation in seconds + (or fractions thereof). As join() always returns None, you must call + isAlive() after join() to decide whether a timeout happened -- if the + thread is still alive, the join() call timed out. + + When the timeout argument is not present or None, the operation will + block until the thread terminates. + + A thread can be join()ed many times. + + join() raises a RuntimeError if an attempt is made to join the current + thread as that would cause a deadlock. It is also an error to join() a + thread before it has been started and attempts to do so raises the same + exception. + + """ if not self.__initialized: raise RuntimeError("Thread.__init__() not called") if not self.__started.is_set(): @@ -685,6 +966,12 @@ @property def name(self): + """A string used for identification purposes only. + + It has no semantics. Multiple threads may be given the same name. The + initial name is set by the constructor. + + """ assert self.__initialized, "Thread.__init__() not called" return self.__name @@ -695,10 +982,24 @@ @property def ident(self): + """Thread identifier of this thread or None if it has not been started. + + This is a nonzero integer. See the thread.get_ident() function. Thread + identifiers may be recycled when a thread exits and another thread is + created. The identifier is available even after the thread has exited. + + """ assert self.__initialized, "Thread.__init__() not called" return self.__ident def isAlive(self): + """Return whether the thread is alive. + + This method returns True just before the run() method starts until just + after the run() method terminates. The module function enumerate() + returns a list of all alive threads. + + """ assert self.__initialized, "Thread.__init__() not called" return self.__started.is_set() and not self.__stopped @@ -706,6 +1007,17 @@ @property def daemon(self): + """A boolean value indicating whether this thread is a daemon thread (True) or not (False). + + This must be set before start() is called, otherwise RuntimeError is + raised. Its initial value is inherited from the creating thread; the + main thread is not a daemon thread and therefore all threads created in + the main thread default to daemon = False. + + The entire Python program exits when no alive non-daemon threads are + left. + + """ assert self.__initialized, "Thread.__init__() not called" return self.__daemonic @@ -732,14 +1044,24 @@ # The timer class was contributed by Itamar Shtull-Trauring def Timer(*args, **kwargs): + """Factory function to create a Timer object. + + Timers call a function after a specified number of seconds: + + t = Timer(30.0, f, args=[], kwargs={}) + t.start() + t.cancel() # stop the timer's action if it's still waiting + + """ return _Timer(*args, **kwargs) class _Timer(Thread): """Call a function after a specified number of seconds: - t = Timer(30.0, f, args=[], kwargs={}) - t.start() - t.cancel() # stop the timer's action if it's still waiting + t = Timer(30.0, f, args=[], kwargs={}) + t.start() + t.cancel() # stop the timer's action if it's still waiting + """ def __init__(self, interval, function, args=[], kwargs={}): @@ -828,6 +1150,12 @@ # Global API functions def currentThread(): + """Return the current Thread object, corresponding to the caller's thread of control. + + If the caller's thread of control was not created through the threading + module, a dummy thread object with limited functionality is returned. + + """ try: return _active[_get_ident()] except KeyError: @@ -837,6 +1165,12 @@ current_thread = currentThread def activeCount(): + """Return the number of Thread objects currently alive. + + The returned count is equal to the length of the list returned by + enumerate(). + + """ with _active_limbo_lock: return len(_active) + len(_limbo) @@ -847,6 +1181,13 @@ return _active.values() + _limbo.values() def enumerate(): + """Return a list of all Thread objects currently alive. + + The list includes daemonic threads, dummy thread objects created by + current_thread(), and the main thread. It excludes terminated threads and + threads that have not yet been started. + + """ with _active_limbo_lock: return _active.values() + _limbo.values() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 05:15:17 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 9 Mar 2013 05:15:17 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Improve_commen?= =?utf-8?q?ts_and_variable_names=2E?= Message-ID: <3ZNC0j4rlWzQDJ@mail.python.org> http://hg.python.org/cpython/rev/1af9f7df3a96 changeset: 82558:1af9f7df3a96 branch: 3.3 parent: 82555:8817a09e012c user: Raymond Hettinger date: Fri Mar 08 21:11:55 2013 -0700 summary: Improve comments and variable names. files: Lib/functools.py | 51 ++++++++++++++++++++++++++--------- 1 files changed, 37 insertions(+), 14 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -17,7 +17,7 @@ from _thread import RLock except: class RLock: - 'Dummy reentrant lock' + 'Dummy reentrant lock for builds without threads' def __enter__(self): pass def __exit__(self, exctype, excinst, exctb): pass @@ -146,6 +146,12 @@ _CacheInfo = namedtuple("CacheInfo", ["hits", "misses", "maxsize", "currsize"]) class _HashedSeq(list): + """ This class guarantees that hash() will be called no more than once + per element. This is important because the lru_cache() will hash + the key multiple times on a cache miss. + + """ + __slots__ = 'hashvalue' def __init__(self, tup, hash=hash): @@ -159,7 +165,16 @@ kwd_mark = (object(),), fasttypes = {int, str, frozenset, type(None)}, sorted=sorted, tuple=tuple, type=type, len=len): - 'Make a cache key from optionally typed positional and keyword arguments' + """Make a cache key from optionally typed positional and keyword arguments + + The key is constructed in a way that is flat as possible rather than + as a nested structure that would take more memory. + + If there is only a single argument and its data type is known to cache + its hash value, then that argument is returned without a wrapper. This + saves space and improves lookup speed. + + """ key = args if kwds: sorted_items = sorted(kwds.items()) @@ -217,7 +232,7 @@ if maxsize == 0: def wrapper(*args, **kwds): - # no caching, just a statistics update after a successful call + # No caching -- just a statistics update after a successful call nonlocal misses result = user_function(*args, **kwds) misses += 1 @@ -226,7 +241,7 @@ elif maxsize is None: def wrapper(*args, **kwds): - # simple caching without ordering or size limit + # Simple caching without ordering or size limit nonlocal hits, misses, currsize key = make_key(args, kwds, typed) result = cache_get(key, sentinel) @@ -242,14 +257,14 @@ else: def wrapper(*args, **kwds): - # size limited caching that tracks accesses by recency + # Size limited caching that tracks accesses by recency nonlocal root, hits, misses, currsize, full key = make_key(args, kwds, typed) with lock: link = cache_get(key) if link is not None: - # move the link to the front of the circular queue - link_prev, link_next, key, result = link + # Move the link to the front of the circular queue + link_prev, link_next, _key, result = link link_prev[NEXT] = link_next link_next[PREV] = link_prev last = root[PREV] @@ -261,26 +276,34 @@ result = user_function(*args, **kwds) with lock: if key in cache: - # getting here means that this same key was added to the - # cache while the lock was released. since the link + # Getting here means that this same key was added to the + # cache while the lock was released. Since the link # update is already done, we need only return the # computed result and update the count of misses. pass elif full: - # use the old root to store the new key and result + # Use the old root to store the new key and result. oldroot = root oldroot[KEY] = key oldroot[RESULT] = result - # empty the oldest link and make it the new root + # Empty the oldest link and make it the new root. + # Keep a reference to the old key and old result to + # prevent their ref counts from going to zero during the + # update. That will prevent potentially arbitrary object + # clean-up code (i.e. __del__) from running while we're + # still adjusting the links. root = oldroot[NEXT] oldkey = root[KEY] - oldvalue = root[RESULT] + oldresult = root[RESULT] root[KEY] = root[RESULT] = None - # now update the cache dictionary for the new links + # Now update the cache dictionary. del cache[oldkey] + # Save the potentially reentrant cache[key] assignment + # for last, after the root and links have been put in + # a consistent state. cache[key] = oldroot else: - # put result in a new link at the front of the queue + # Put result in a new link at the front of the queue. last = root[PREV] link = [last, root, key, result] last[NEXT] = root[PREV] = cache[key] = link -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 05:15:19 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 9 Mar 2013 05:15:19 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZNC0l1VrmzQKt@mail.python.org> http://hg.python.org/cpython/rev/f87346952c10 changeset: 82559:f87346952c10 parent: 82556:d86f5686cef9 parent: 82558:1af9f7df3a96 user: Raymond Hettinger date: Fri Mar 08 21:14:46 2013 -0700 summary: merge files: Lib/functools.py | 47 ++++++++++++++++++++++++++--------- 1 files changed, 35 insertions(+), 12 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -20,7 +20,7 @@ from _thread import RLock except: class RLock: - 'Dummy reentrant lock' + 'Dummy reentrant lock for builds without threads' def __enter__(self): pass def __exit__(self, exctype, excinst, exctb): pass @@ -172,6 +172,12 @@ _CacheInfo = namedtuple("CacheInfo", ["hits", "misses", "maxsize", "currsize"]) class _HashedSeq(list): + """ This class guarantees that hash() will be called no more than once + per element. This is important because the lru_cache() will hash + the key multiple times on a cache miss. + + """ + __slots__ = 'hashvalue' def __init__(self, tup, hash=hash): @@ -185,7 +191,16 @@ kwd_mark = (object(),), fasttypes = {int, str, frozenset, type(None)}, sorted=sorted, tuple=tuple, type=type, len=len): - 'Make a cache key from optionally typed positional and keyword arguments' + """Make a cache key from optionally typed positional and keyword arguments + + The key is constructed in a way that is flat as possible rather than + as a nested structure that would take more memory. + + If there is only a single argument and its data type is known to cache + its hash value, then that argument is returned without a wrapper. This + saves space and improves lookup speed. + + """ key = args if kwds: sorted_items = sorted(kwds.items()) @@ -242,7 +257,7 @@ if maxsize == 0: def wrapper(*args, **kwds): - # no caching, just a statistics update after a successful call + # No caching -- just a statistics update after a successful call nonlocal misses result = user_function(*args, **kwds) misses += 1 @@ -272,8 +287,8 @@ with lock: link = cache_get(key) if link is not None: - # move the link to the front of the circular queue - link_prev, link_next, key, result = link + # Move the link to the front of the circular queue + link_prev, link_next, _key, result = link link_prev[NEXT] = link_next link_next[PREV] = link_prev last = root[PREV] @@ -285,26 +300,34 @@ result = user_function(*args, **kwds) with lock: if key in cache: - # getting here means that this same key was added to the - # cache while the lock was released. since the link + # Getting here means that this same key was added to the + # cache while the lock was released. Since the link # update is already done, we need only return the # computed result and update the count of misses. pass elif full: - # use the old root to store the new key and result + # Use the old root to store the new key and result. oldroot = root oldroot[KEY] = key oldroot[RESULT] = result - # empty the oldest link and make it the new root + # Empty the oldest link and make it the new root. + # Keep a reference to the old key and old result to + # prevent their ref counts from going to zero during the + # update. That will prevent potentially arbitrary object + # clean-up code (i.e. __del__) from running while we're + # still adjusting the links. root = oldroot[NEXT] oldkey = root[KEY] - oldvalue = root[RESULT] + oldresult = root[RESULT] root[KEY] = root[RESULT] = None - # now update the cache dictionary for the new links + # Now update the cache dictionary. del cache[oldkey] + # Save the potentially reentrant cache[key] assignment + # for last, after the root and links have been put in + # a consistent state. cache[key] = oldroot else: - # put result in a new link at the front of the queue + # Put result in a new link at the front of the queue. last = root[PREV] link = [last, root, key, result] last[NEXT] = root[PREV] = cache[key] = link -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sat Mar 9 05:58:21 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 09 Mar 2013 05:58:21 +0100 Subject: [Python-checkins] Daily reference leaks (d86f5686cef9): sum=1 Message-ID: results for d86f5686cef9 on branch "default" -------------------------------------------- test_unittest leaked [0, -1, 2] memory blocks, sum=1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogndO2qh', '-x'] From python-checkins at python.org Sat Mar 9 08:05:29 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 9 Mar 2013 08:05:29 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Sync-up_with_3?= =?utf-8?q?=2E4_to_make_maintenance_easier=2E?= Message-ID: <3ZNGn561zRzQLy@mail.python.org> http://hg.python.org/cpython/rev/a9fa8a18d18d changeset: 82560:a9fa8a18d18d branch: 3.3 parent: 82558:1af9f7df3a96 user: Raymond Hettinger date: Fri Mar 08 23:01:07 2013 -0800 summary: Sync-up with 3.4 to make maintenance easier. files: Lib/functools.py | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -222,7 +222,7 @@ def decorating_function(user_function): cache = {} - hits = misses = currsize = 0 + hits = misses = 0 full = False cache_get = cache.get # bound method to lookup a key or return None lock = RLock() # because linkedlist updates aren't threadsafe @@ -242,7 +242,7 @@ def wrapper(*args, **kwds): # Simple caching without ordering or size limit - nonlocal hits, misses, currsize + nonlocal hits, misses key = make_key(args, kwds, typed) result = cache_get(key, sentinel) if result is not sentinel: @@ -251,14 +251,13 @@ result = user_function(*args, **kwds) cache[key] = result misses += 1 - currsize += 1 return result else: def wrapper(*args, **kwds): # Size limited caching that tracks accesses by recency - nonlocal root, hits, misses, currsize, full + nonlocal root, hits, misses, full key = make_key(args, kwds, typed) with lock: link = cache_get(key) @@ -307,23 +306,22 @@ last = root[PREV] link = [last, root, key, result] last[NEXT] = root[PREV] = cache[key] = link - currsize += 1 - full = (currsize >= maxsize) + full = (len(cache) >= maxsize) misses += 1 return result def cache_info(): """Report cache statistics""" with lock: - return _CacheInfo(hits, misses, maxsize, currsize) + return _CacheInfo(hits, misses, maxsize, len(cache)) def cache_clear(): """Clear the cache and cache statistics""" - nonlocal hits, misses, currsize, full + nonlocal hits, misses, full with lock: cache.clear() root[:] = [root, root, None, None] - hits = misses = currsize = 0 + hits = misses = 0 full = False wrapper.cache_info = cache_info -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 08:05:31 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 9 Mar 2013 08:05:31 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZNGn71ltDzQn6@mail.python.org> http://hg.python.org/cpython/rev/02ffc9f94aab changeset: 82561:02ffc9f94aab parent: 82559:f87346952c10 parent: 82560:a9fa8a18d18d user: Raymond Hettinger date: Fri Mar 08 23:04:47 2013 -0800 summary: merge files: Lib/functools.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -266,7 +266,7 @@ elif maxsize is None: def wrapper(*args, **kwds): - # simple caching without ordering or size limit + # Simple caching without ordering or size limit nonlocal hits, misses key = make_key(args, kwds, typed) result = cache_get(key, sentinel) @@ -281,7 +281,7 @@ else: def wrapper(*args, **kwds): - # size limited caching that tracks accesses by recency + # Size limited caching that tracks accesses by recency nonlocal root, hits, misses, full key = make_key(args, kwds, typed) with lock: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 08:26:49 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 9 Mar 2013 08:26:49 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE2NjQy?= =?utf-8?q?=3A_sched=2Escheduler_timefunc_initial_default_is_time=2Emonoto?= =?utf-8?q?nic=2E?= Message-ID: <3ZNHFj514szQKt@mail.python.org> http://hg.python.org/cpython/rev/258028711466 changeset: 82562:258028711466 branch: 3.3 parent: 82558:1af9f7df3a96 user: Terry Jan Reedy date: Sat Mar 09 02:14:27 2013 -0500 summary: Issue #16642: sched.scheduler timefunc initial default is time.monotonic. Patch by Ramchandra Apte files: Doc/library/sched.rst | 5 +++-- Misc/ACKS | 1 + Misc/NEWS | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Doc/library/sched.rst b/Doc/library/sched.rst --- a/Doc/library/sched.rst +++ b/Doc/library/sched.rst @@ -14,12 +14,13 @@ The :mod:`sched` module defines a class which implements a general purpose event scheduler: -.. class:: scheduler(timefunc=time.time, delayfunc=time.sleep) +.. class:: scheduler(timefunc=time.monotonic, delayfunc=time.sleep) The :class:`scheduler` class defines a generic interface to scheduling events. It needs two functions to actually deal with the "outside world" --- *timefunc* should be callable without arguments, and return a number (the "time", in any - units whatsoever). The *delayfunc* function should be callable with one + units whatsoever). If time.monotonic is not available, the *timefunc* default + is time.time instead. The *delayfunc* function should be callable with one argument, compatible with the output of *timefunc*, and should delay that many time units. *delayfunc* will also be called with the argument ``0`` after each event is run to allow other threads an opportunity to run in multi-threaded diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -44,6 +44,7 @@ Ankur Ankan Jon Anglin Heidi Annexstad +Ramchandra Apte ?ric Araujo Alicia Arlen Jeffrey Armstrong diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -802,6 +802,9 @@ Documentation ------------- +- Issue #16642: sched.scheduler timefunc initial default is time.monotonic. + Patch by Ramchandra Apte + - Issue #15465: Document the versioning macros in the C API docs rather than the standard library docs. Patch by Kushal Das. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 08:26:51 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 9 Mar 2013 08:26:51 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_closes_issue_16643_=28not_=2E=2E=2E=2E2_as_in_l?= =?utf-8?q?ast_commit_message=29?= Message-ID: <3ZNHFl0gPfzQn9@mail.python.org> http://hg.python.org/cpython/rev/ca56baa46d35 changeset: 82563:ca56baa46d35 parent: 82559:f87346952c10 parent: 82562:258028711466 user: Terry Jan Reedy date: Sat Mar 09 02:19:33 2013 -0500 summary: Merge: closes issue 16643 (not ....2 as in last commit message) files: Doc/library/sched.rst | 5 +++-- Misc/ACKS | 1 + Misc/NEWS | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Doc/library/sched.rst b/Doc/library/sched.rst --- a/Doc/library/sched.rst +++ b/Doc/library/sched.rst @@ -14,12 +14,13 @@ The :mod:`sched` module defines a class which implements a general purpose event scheduler: -.. class:: scheduler(timefunc=time.time, delayfunc=time.sleep) +.. class:: scheduler(timefunc=time.monotonic, delayfunc=time.sleep) The :class:`scheduler` class defines a generic interface to scheduling events. It needs two functions to actually deal with the "outside world" --- *timefunc* should be callable without arguments, and return a number (the "time", in any - units whatsoever). The *delayfunc* function should be callable with one + units whatsoever). If time.monotonic is not available, the *timefunc* default + is time.time instead. The *delayfunc* function should be callable with one argument, compatible with the output of *timefunc*, and should delay that many time units. *delayfunc* will also be called with the argument ``0`` after each event is run to allow other threads an opportunity to run in multi-threaded diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -44,6 +44,7 @@ Ankur Ankan Jon Anglin Heidi Annexstad +Ramchandra Apte ?ric Araujo Alicia Arlen Jeffrey Armstrong diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1078,6 +1078,9 @@ Documentation ------------- +- Issue #16642: sched.scheduler timefunc initial default is time.monotonic. + Patch by Ramchandra Apte + - Issue #15465: Document the versioning macros in the C API docs rather than the standard library docs. Patch by Kushal Das. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 08:26:52 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 9 Mar 2013 08:26:52 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_Merge_heads?= Message-ID: <3ZNHFm3FhqzQqQ@mail.python.org> http://hg.python.org/cpython/rev/a4de286f9f4b changeset: 82564:a4de286f9f4b parent: 82563:ca56baa46d35 parent: 82561:02ffc9f94aab user: Terry Jan Reedy date: Sat Mar 09 02:22:03 2013 -0500 summary: Merge heads files: Lib/functools.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -266,7 +266,7 @@ elif maxsize is None: def wrapper(*args, **kwds): - # simple caching without ordering or size limit + # Simple caching without ordering or size limit nonlocal hits, misses key = make_key(args, kwds, typed) result = cache_get(key, sentinel) @@ -281,7 +281,7 @@ else: def wrapper(*args, **kwds): - # size limited caching that tracks accesses by recency + # Size limited caching that tracks accesses by recency nonlocal root, hits, misses, full key = make_key(args, kwds, typed) with lock: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 08:26:53 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 9 Mar 2013 08:26:53 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4zIC0+IDMuMyk6?= =?utf-8?q?_Merge_heads?= Message-ID: <3ZNHFn63QxzQKt@mail.python.org> http://hg.python.org/cpython/rev/032681806a0a changeset: 82565:032681806a0a branch: 3.3 parent: 82562:258028711466 parent: 82560:a9fa8a18d18d user: Terry Jan Reedy date: Sat Mar 09 02:25:18 2013 -0500 summary: Merge heads files: Lib/functools.py | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -222,7 +222,7 @@ def decorating_function(user_function): cache = {} - hits = misses = currsize = 0 + hits = misses = 0 full = False cache_get = cache.get # bound method to lookup a key or return None lock = RLock() # because linkedlist updates aren't threadsafe @@ -242,7 +242,7 @@ def wrapper(*args, **kwds): # Simple caching without ordering or size limit - nonlocal hits, misses, currsize + nonlocal hits, misses key = make_key(args, kwds, typed) result = cache_get(key, sentinel) if result is not sentinel: @@ -251,14 +251,13 @@ result = user_function(*args, **kwds) cache[key] = result misses += 1 - currsize += 1 return result else: def wrapper(*args, **kwds): # Size limited caching that tracks accesses by recency - nonlocal root, hits, misses, currsize, full + nonlocal root, hits, misses, full key = make_key(args, kwds, typed) with lock: link = cache_get(key) @@ -307,23 +306,22 @@ last = root[PREV] link = [last, root, key, result] last[NEXT] = root[PREV] = cache[key] = link - currsize += 1 - full = (currsize >= maxsize) + full = (len(cache) >= maxsize) misses += 1 return result def cache_info(): """Report cache statistics""" with lock: - return _CacheInfo(hits, misses, maxsize, currsize) + return _CacheInfo(hits, misses, maxsize, len(cache)) def cache_clear(): """Clear the cache and cache statistics""" - nonlocal hits, misses, currsize, full + nonlocal hits, misses, full with lock: cache.clear() root[:] = [root, root, None, None] - hits = misses = currsize = 0 + hits = misses = 0 full = False wrapper.cache_info = cache_info -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 08:26:55 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 9 Mar 2013 08:26:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E3?= Message-ID: <3ZNHFq1XVPzQXR@mail.python.org> http://hg.python.org/cpython/rev/d0fcb4c9f231 changeset: 82566:d0fcb4c9f231 parent: 82564:a4de286f9f4b parent: 82565:032681806a0a user: Terry Jan Reedy date: Sat Mar 09 02:26:07 2013 -0500 summary: Merge with 3.3 files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 14:56:21 2013 From: python-checkins at python.org (eli.bendersky) Date: Sat, 9 Mar 2013 14:56:21 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_Add_warning_in?= =?utf-8?q?_ctypes_documentation_for_=2316575_and_=2316576?= Message-ID: <3ZNRv908rkzQP3@mail.python.org> http://hg.python.org/cpython/rev/0acd9408b6f1 changeset: 82567:0acd9408b6f1 branch: 3.2 parent: 82554:55fd9810c9ab user: Eli Bendersky date: Sat Mar 09 05:54:00 2013 -0800 summary: Add warning in ctypes documentation for #16575 and #16576 files: Doc/library/ctypes.rst | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -603,6 +603,13 @@ .. _ctypes-structureunion-alignment-byte-order: +.. warning:: + + :mod:`ctypes` does not support passing unions or structures with bit-fields + to functions by value. While this may work on 32-bit x86, it's not + guaranteed by the library to work in the general case. Unions and + structures with bit-fields should always be passed to functions by pointer. + Structure/union alignment and byte order ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 14:56:22 2013 From: python-checkins at python.org (eli.bendersky) Date: Sat, 9 Mar 2013 14:56:22 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Add_warning_in_ctypes_documentation_for_=2316575_and_=2316576?= Message-ID: <3ZNRvB32drzQwc@mail.python.org> http://hg.python.org/cpython/rev/bfc159f8e4b4 changeset: 82568:bfc159f8e4b4 branch: 3.3 parent: 82565:032681806a0a parent: 82567:0acd9408b6f1 user: Eli Bendersky date: Sat Mar 09 05:54:32 2013 -0800 summary: Add warning in ctypes documentation for #16575 and #16576 files: Doc/library/ctypes.rst | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -608,6 +608,13 @@ .. _ctypes-structureunion-alignment-byte-order: +.. warning:: + + :mod:`ctypes` does not support passing unions or structures with bit-fields + to functions by value. While this may work on 32-bit x86, it's not + guaranteed by the library to work in the general case. Unions and + structures with bit-fields should always be passed to functions by pointer. + Structure/union alignment and byte order ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 14:56:23 2013 From: python-checkins at python.org (eli.bendersky) Date: Sat, 9 Mar 2013 14:56:23 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Add_warning_in_ctypes_documentation_for_=2316575_and_=23?= =?utf-8?q?16576?= Message-ID: <3ZNRvC6CBqzQxl@mail.python.org> http://hg.python.org/cpython/rev/502624235c7b changeset: 82569:502624235c7b parent: 82566:d0fcb4c9f231 parent: 82568:bfc159f8e4b4 user: Eli Bendersky date: Sat Mar 09 05:55:24 2013 -0800 summary: Add warning in ctypes documentation for #16575 and #16576 files: Doc/library/ctypes.rst | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -608,6 +608,13 @@ .. _ctypes-structureunion-alignment-byte-order: +.. warning:: + + :mod:`ctypes` does not support passing unions or structures with bit-fields + to functions by value. While this may work on 32-bit x86, it's not + guaranteed by the library to work in the general case. Unions and + structures with bit-fields should always be passed to functions by pointer. + Structure/union alignment and byte order ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 14:57:31 2013 From: python-checkins at python.org (eli.bendersky) Date: Sat, 9 Mar 2013 14:57:31 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Add_warning_in?= =?utf-8?q?_ctypes_documentation_for_=2316575_and_=2316576?= Message-ID: <3ZNRwW18tWzPBN@mail.python.org> http://hg.python.org/cpython/rev/eece32440a52 changeset: 82570:eece32440a52 branch: 2.7 parent: 82557:e0ef2bde35c3 user: Eli Bendersky date: Sat Mar 09 05:56:35 2013 -0800 summary: Add warning in ctypes documentation for #16575 and #16576 files: Doc/library/ctypes.rst | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -602,6 +602,13 @@ .. _ctypes-structureunion-alignment-byte-order: +.. warning:: + + :mod:`ctypes` does not support passing unions or structures with bit-fields + to functions by value. While this may work on 32-bit x86, it's not + guaranteed by the library to work in the general case. Unions and + structures with bit-fields should always be passed to functions by pointer. + Structure/union alignment and byte order ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 16:13:45 2013 From: python-checkins at python.org (eli.bendersky) Date: Sat, 9 Mar 2013 16:13:45 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2316954=3A_Add_docs?= =?utf-8?q?trings_for_ElementTree?= Message-ID: <3ZNTcT3PrSzQSF@mail.python.org> http://hg.python.org/cpython/rev/f27d7c1eac4d changeset: 82571:f27d7c1eac4d parent: 82569:502624235c7b user: Eli Bendersky date: Sat Mar 09 07:12:48 2013 -0800 summary: Issue #16954: Add docstrings for ElementTree Based on patch by David Lam files: Lib/xml/etree/ElementTree.py | 1062 ++++++++++----------- Misc/ACKS | 1 + 2 files changed, 486 insertions(+), 577 deletions(-) diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -1,23 +1,40 @@ +"""Lightweight XML support for Python. + + XML is an inherently hierarchical data format, and the most natural way to + represent it is with a tree. This module has two classes for this purpose: + + 1. ElementTree represents the whole XML document as a tree and + + 2. Element represents a single node in this tree. + + Interactions with the whole document (reading and writing to/from files) are + usually done on the ElementTree level. Interactions with a single XML element + and its sub-elements are done on the Element level. + + Element is a flexible container object designed to store hierarchical data + structures in memory. It can be described as a cross between a list and a + dictionary. Each Element has a number of properties associated with it: + + 'tag' - a string containing the element's name. + + 'attributes' - a Python dictionary storing the element's attributes. + + 'text' - a string containing the element's text content. + + 'tail' - an optional string containing text after the element's end tag. + + And a number of child elements stored in a Python sequence. + + To create an element instance, use the Element constructor, + or the SubElement factory function. + + You can also use the ElementTree class to wrap an element structure + and convert it to and from XML. + +""" + # # ElementTree -# $Id: ElementTree.py 3440 2008-07-18 14:45:01Z fredrik $ -# -# light-weight XML support for Python 2.3 and later. -# -# history (since 1.2.6): -# 2005-11-12 fl added tostringlist/fromstringlist helpers -# 2006-07-05 fl merged in selected changes from the 1.3 sandbox -# 2006-07-05 fl removed support for 2.1 and earlier -# 2007-06-21 fl added deprecation/future warnings -# 2007-08-25 fl added doctype hook, added parser version attribute etc -# 2007-08-26 fl added new serializer code (better namespace handling, etc) -# 2007-08-27 fl warn for broken /tag searches on tree level -# 2007-09-02 fl added html/text methods to serializer (experimental) -# 2007-09-05 fl added method argument to tostring/tostringlist -# 2007-09-06 fl improved error handling -# 2007-09-13 fl added itertext, iterfind; assorted cleanups -# 2007-12-15 fl added C14N hooks, copy method (experimental) -# # Copyright (c) 1999-2008 by Fredrik Lundh. All rights reserved. # # fredrik at pythonware.com @@ -75,28 +92,6 @@ VERSION = "1.3.0" -## -# The Element type is a flexible container object, designed to -# store hierarchical data structures in memory. The type can be -# described as a cross between a list and a dictionary. -#

-# Each element has a number of properties associated with it: -#

    -#
  • a tag. This is a string identifying what kind of data -# this element represents (the element type, in other words).
  • -#
  • a number of attributes, stored in a Python dictionary.
  • -#
  • a text string.
  • -#
  • an optional tail string.
  • -#
  • a number of child elements, stored in a Python sequence
  • -#
-# -# To create an element instance, use the {@link #Element} constructor -# or the {@link #SubElement} factory function. -#

-# The {@link #ElementTree} class can be used to wrap an element -# structure, and convert it from and to XML. -## - import sys import re import warnings @@ -106,81 +101,68 @@ from . import ElementPath -## -# Parser error. This is a subclass of SyntaxError. -#

-# In addition to the exception value, an exception instance contains a -# specific exception code in the code attribute, and the line and -# column of the error in the position attribute. +class ParseError(SyntaxError): + """An error when parsing an XML document. -class ParseError(SyntaxError): + In addition to its exception value, a ParseError contains + two extra attributes: + 'code' - the specific exception code + 'position' - the line and column of the error + + """ pass # -------------------------------------------------------------------- -## -# Checks if an object appears to be a valid element object. -# -# @param An element instance. -# @return A true value if this is an element object. -# @defreturn flag def iselement(element): - # FIXME: not sure about this; - # isinstance(element, Element) or look for tag/attrib/text attributes + """Return True if *element* appears to be an Element.""" return hasattr(element, 'tag') -## -# Element class. This class defines the Element interface, and -# provides a reference implementation of this interface. -#

-# The element name, attribute names, and attribute values can be -# either ASCII strings (ordinary Python strings containing only 7-bit -# ASCII characters) or Unicode strings. -# -# @param tag The element name. -# @param attrib An optional dictionary, containing element attributes. -# @param **extra Additional attributes, given as keyword arguments. -# @see Element -# @see SubElement -# @see Comment -# @see ProcessingInstruction class Element: - # text...tail + """An XML element. - ## - # (Attribute) Element tag. + This class is the reference implementation of the Element interface. + + An element's length is its number of subelements. That means if you + you want to check if an element is truly empty, you should check BOTH + its length AND its text attribute. + + The element tag, attribute names, and attribute values can be either + bytes or strings. + + *tag* is the element name. *attrib* is an optional dictionary containing + element attributes. *extra* are additional element attributes given as + keyword arguments. + + Example form: + text...tail + + """ tag = None - - ## - # (Attribute) Element attribute dictionary. Where possible, use - # {@link #Element.get}, - # {@link #Element.set}, - # {@link #Element.keys}, and - # {@link #Element.items} to access - # element attributes. + """The element's name.""" attrib = None - - ## - # (Attribute) Text before first subelement. This is either a - # string or the value None. Note that if there was no text, this - # attribute may be either None or an empty string, depending on - # the parser. + """Dictionary of the element's attributes.""" text = None + """ + Text before first subelement. This is either a string or the value None. + Note that if there is no text, this attribute may be either + None or the empty string, depending on the parser. - ## - # (Attribute) Text after this element's end tag, but before the - # next sibling element's start tag. This is either a string or - # the value None. Note that if there was no text, this attribute - # may be either None or an empty string, depending on the parser. + """ - tail = None # text after end tag, if any + tail = None + """ + Text after this element's end tag, but before the next sibling element's + start tag. This is either a string or the value None. Note that if there + was no text, this attribute may be either None or an empty string, + depending on the parser. - # constructor + """ def __init__(self, tag, attrib={}, **extra): if not isinstance(attrib, dict): @@ -195,36 +177,30 @@ def __repr__(self): return "" % (repr(self.tag), id(self)) - ## - # Creates a new element object of the same type as this element. - # - # @param tag Element tag. - # @param attrib Element attributes, given as a dictionary. - # @return A new element instance. + def makeelement(self, tag, attrib): + """Create a new element with the same type. - def makeelement(self, tag, attrib): + *tag* is a string containing the element name. + *attrib* is a dictionary containing the element attributes. + + Do not call this method, use the SubElement factory function instead. + + """ return self.__class__(tag, attrib) - ## - # (Experimental) Copies the current element. This creates a - # shallow copy; subelements will be shared with the original tree. - # - # @return A new element instance. + def copy(self): + """Return copy of current element. - def copy(self): + This creates a shallow copy. Subelements will be shared with the + original tree. + + """ elem = self.makeelement(self.tag, self.attrib) elem.text = self.text elem.tail = self.tail elem[:] = self return elem - ## - # Returns the number of subelements. Note that this only counts - # full elements; to check if there's any content in an element, you - # have to check both the length and the text attribute. - # - # @return The number of subelements. - def __len__(self): return len(self._children) @@ -236,23 +212,9 @@ ) return len(self._children) != 0 # emulate old behaviour, for now - ## - # Returns the given subelement, by index. - # - # @param index What subelement to return. - # @return The given subelement. - # @exception IndexError If the given element does not exist. - def __getitem__(self, index): return self._children[index] - ## - # Replaces the given subelement, by index. - # - # @param index What subelement to replace. - # @param element The new element value. - # @exception IndexError If the given element does not exist. - def __setitem__(self, index, element): # if isinstance(index, slice): # for elt in element: @@ -261,46 +223,35 @@ # assert iselement(element) self._children[index] = element - ## - # Deletes the given subelement, by index. - # - # @param index What subelement to delete. - # @exception IndexError If the given element does not exist. - def __delitem__(self, index): del self._children[index] - ## - # Adds a subelement to the end of this element. In document order, - # the new element will appear after the last existing subelement (or - # directly after the text, if it's the first subelement), but before - # the end tag for this element. - # - # @param element The element to add. + def append(self, subelement): + """Add *subelement* to the end of this element. - def append(self, element): - self._assert_is_element(element) - self._children.append(element) + The new element will appear in document order after the last existing + subelement (or directly after the text, if it's the first subelement), + but before the end tag for this element. - ## - # Appends subelements from a sequence. - # - # @param elements A sequence object with zero or more elements. - # @since 1.3 + """ + self._assert_is_element(subelement) + self._children.append(subelement) def extend(self, elements): + """Append subelements from a sequence. + + *elements* is a sequence with zero or more elements. + + """ for element in elements: self._assert_is_element(element) self._children.extend(elements) - ## - # Inserts a subelement at the given position in this element. - # - # @param index Where to insert the new subelement. - def insert(self, index, element): - self._assert_is_element(element) - self._children.insert(index, element) + def insert(self, index, subelement): + """Insert *subelement* at position *index*.""" + self._assert_is_element(subelement) + self._children.insert(index, subelement) def _assert_is_element(self, e): # Need to refer to the actual Python implementation, not the @@ -308,29 +259,28 @@ if not isinstance(e, _Element): raise TypeError('expected an Element, not %s' % type(e).__name__) - ## - # Removes a matching subelement. Unlike the find methods, - # this method compares elements based on identity, not on tag - # value or contents. To remove subelements by other means, the - # easiest way is often to use a list comprehension to select what - # elements to keep, and use slice assignment to update the parent - # element. - # - # @param element What element to remove. - # @exception ValueError If a matching element could not be found. - def remove(self, element): + def remove(self, subelement): + """Remove matching subelement. + + Unlike the find methods, this method compares elements based on + identity, NOT ON tag value or contents. To remove subelements by + other means, the easiest way is to use a list comprehension to + select what elements to keep, and then use slice assignment to update + the parent element. + + ValueError is raised if a matching element could not be found. + + """ # assert iselement(element) - self._children.remove(element) - - ## - # (Deprecated) Returns all subelements. The elements are returned - # in document order. - # - # @return A list of subelements. - # @defreturn list of Element instances + self._children.remove(subelement) def getchildren(self): + """(Deprecated) Return all subelements. + + Elements are returned in document order. + + """ warnings.warn( "This method will be removed in future versions. " "Use 'list(elem)' or iteration over elem instead.", @@ -338,124 +288,132 @@ ) return self._children - ## - # Finds the first matching subelement, by tag name or path. - # - # @param path What element to look for. - # @keyparam namespaces Optional namespace prefix map. - # @return The first matching element, or None if no element was found. - # @defreturn Element or None def find(self, path, namespaces=None): + """Find first matching element by tag name or path. + + *path* is a string having either an element tag or an XPath, + *namespaces* is an optional mapping from namespace prefix to full name. + + Return the first matching element, or None if no element was found. + + """ return ElementPath.find(self, path, namespaces) - ## - # Finds text for the first matching subelement, by tag name or path. - # - # @param path What element to look for. - # @param default What to return if the element was not found. - # @keyparam namespaces Optional namespace prefix map. - # @return The text content of the first matching element, or the - # default value no element was found. Note that if the element - # is found, but has no text content, this method returns an - # empty string. - # @defreturn string def findtext(self, path, default=None, namespaces=None): + """Find text for first matching element by tag name or path. + + *path* is a string having either an element tag or an XPath, + *default* is the value to return if the element was not found, + *namespaces* is an optional mapping from namespace prefix to full name. + + Return text content of first matching element, or default value if + none was found. Note that if an element is found having no text + content, the empty string is returned. + + """ return ElementPath.findtext(self, path, default, namespaces) - ## - # Finds all matching subelements, by tag name or path. - # - # @param path What element to look for. - # @keyparam namespaces Optional namespace prefix map. - # @return A list or other sequence containing all matching elements, - # in document order. - # @defreturn list of Element instances def findall(self, path, namespaces=None): + """Find all matching subelements by tag name or path. + + *path* is a string having either an element tag or an XPath, + *namespaces* is an optional mapping from namespace prefix to full name. + + Returns list containing all matching elements in document order. + + """ return ElementPath.findall(self, path, namespaces) - ## - # Finds all matching subelements, by tag name or path. - # - # @param path What element to look for. - # @keyparam namespaces Optional namespace prefix map. - # @return An iterator or sequence containing all matching elements, - # in document order. - # @defreturn a generated sequence of Element instances def iterfind(self, path, namespaces=None): + """Find all matching subelements by tag name or path. + + *path* is a string having either an element tag or an XPath, + *namespaces* is an optional mapping from namespace prefix to full name. + + Return an iterable yielding all matching elements in document order. + + """ return ElementPath.iterfind(self, path, namespaces) - ## - # Resets an element. This function removes all subelements, clears - # all attributes, and sets the text and tail attributes - # to None. def clear(self): + """Reset element. + + This function removes all subelements, clears all attributes, and sets + the text and tail attributes to None. + + """ self.attrib.clear() self._children = [] self.text = self.tail = None - ## - # Gets an element attribute. Equivalent to attrib.get, but - # some implementations may handle this a bit more efficiently. - # - # @param key What attribute to look for. - # @param default What to return if the attribute was not found. - # @return The attribute value, or the default value, if the - # attribute was not found. - # @defreturn string or None def get(self, key, default=None): + """Get element attribute. + + Equivalent to attrib.get, but some implementations may handle this a + bit more efficiently. *key* is what attribute to look for, and + *default* is what to return if the attribute was not found. + + Returns a string containing the attribute value, or the default if + attribute was not found. + + """ return self.attrib.get(key, default) - ## - # Sets an element attribute. Equivalent to attrib[key] = value, - # but some implementations may handle this a bit more efficiently. - # - # @param key What attribute to set. - # @param value The attribute value. def set(self, key, value): + """Set element attribute. + + Equivalent to attrib[key] = value, but some implementations may handle + this a bit more efficiently. *key* is what attribute to set, and + *value* is the attribute value to set it to. + + """ self.attrib[key] = value - ## - # Gets a list of attribute names. The names are returned in an - # arbitrary order (just like for an ordinary Python dictionary). - # Equivalent to attrib.keys(). - # - # @return A list of element attribute names. - # @defreturn list of strings def keys(self): + """Get list of attribute names. + + Names are returned in an arbitrary order, just like an ordinary + Python dict. Equivalent to attrib.keys() + + """ return self.attrib.keys() - ## - # Gets element attributes, as a sequence. The attributes are - # returned in an arbitrary order. Equivalent to attrib.items(). - # - # @return A list of (name, value) tuples for all attributes. - # @defreturn list of (string, string) tuples def items(self): + """Get element attributes as a sequence. + + The attributes are returned in arbitrary order. Equivalent to + attrib.items(). + + Return a list of (name, value) tuples. + + """ return self.attrib.items() - ## - # Creates a tree iterator. The iterator loops over this element - # and all subelements, in document order, and returns all elements - # with a matching tag. - #

- # If the tree structure is modified during iteration, new or removed - # elements may or may not be included. To get a stable set, use the - # list() function on the iterator, and loop over the resulting list. - # - # @param tag What tags to look for (default is to return all elements). - # @return An iterator containing all the matching elements. - # @defreturn iterator def iter(self, tag=None): + """Create tree iterator. + + The iterator loops over the element and all subelements in document + order, returning all elements with a matching tag. + + If the tree structure is modified during iteration, new or removed + elements may or may not be included. To get a stable set, use the + list() function on the iterator, and loop over the resulting list. + + *tag* is what tags to look for (default is to return all elements) + + Return an iterator containing all the matching elements. + + """ if tag == "*": tag = None if tag is None or self.tag == tag: @@ -473,15 +431,14 @@ ) return list(self.iter(tag)) - ## - # Creates a text iterator. The iterator loops over this element - # and all subelements, in document order, and returns all inner - # text. - # - # @return An iterator containing all inner text. - # @defreturn iterator def itertext(self): + """Create text iterator. + + The iterator loops over the element and all subelements in document + order, returning all inner text. + + """ tag = self.tag if not isinstance(tag, str) and tag is not None: return @@ -495,55 +452,50 @@ # compatibility _Element = _ElementInterface = Element -## -# Subelement factory. This function creates an element instance, and -# appends it to an existing element. -#

-# The element name, attribute names, and attribute values can be -# either 8-bit ASCII strings or Unicode strings. -# -# @param parent The parent element. -# @param tag The subelement name. -# @param attrib An optional dictionary, containing element attributes. -# @param **extra Additional attributes, given as keyword arguments. -# @return An element instance. -# @defreturn Element def SubElement(parent, tag, attrib={}, **extra): + """Subelement factory which creates an element instance, and appends it + to an existing parent. + + The element tag, attribute names, and attribute values can be either + bytes or Unicode strings. + + *parent* is the parent element, *tag* is the subelements name, *attrib* is + an optional directory containing element attributes, *extra* are + additional attributes given as keyword arguments. + + """ attrib = attrib.copy() attrib.update(extra) element = parent.makeelement(tag, attrib) parent.append(element) return element -## -# Comment element factory. This factory function creates a special -# element that will be serialized as an XML comment by the standard -# serializer. -#

-# The comment string can be either an 8-bit ASCII string or a Unicode -# string. -# -# @param text A string containing the comment string. -# @return An element instance, representing a comment. -# @defreturn Element def Comment(text=None): + """Comment element factory. + + This function creates a special element which the standard serializer + serializes as an XML comment. + + *text* is a string containing the comment string. + + """ element = Element(Comment) element.text = text return element -## -# PI element factory. This factory function creates a special element -# that will be serialized as an XML processing instruction by the standard -# serializer. -# -# @param target A string containing the PI target. -# @param text A string containing the PI contents, if any. -# @return An element instance, representing a PI. -# @defreturn Element def ProcessingInstruction(target, text=None): + """Processing Instruction element factory. + + This function creates a special element which the standard serializer + serializes as an XML comment. + + *target* is a string containing the processing instruction, *text* is a + string containing the processing instruction contents, if any. + + """ element = Element(ProcessingInstruction) element.text = target if text: @@ -552,17 +504,21 @@ PI = ProcessingInstruction -## -# QName wrapper. This can be used to wrap a QName attribute value, in -# order to get proper namespace handling on output. -# -# @param text A string containing the QName value, in the form {uri}local, -# or, if the tag argument is given, the URI part of a QName. -# @param tag Optional tag. If given, the first argument is interpreted as -# an URI, and this argument is interpreted as a local name. -# @return An opaque object, representing the QName. class QName: + """Qualified name wrapper. + + This class can be used to wrap a QName attribute value in order to get + proper namespace handing on output. + + *text_or_uri* is a string containing the QName value either in the form + {uri}local, or if the tag argument is given, the URI part of a QName. + + *tag* is an optional argument which if given, will make the first + argument (text_or_uri) be interpreted as a URI, and this argument (tag) + be interpreted as a local name. + + """ def __init__(self, text_or_uri, tag=None): if tag: text_or_uri = "{%s}%s" % (text_or_uri, tag) @@ -600,55 +556,49 @@ # -------------------------------------------------------------------- -## -# ElementTree wrapper class. This class represents an entire element -# hierarchy, and adds some extra support for serialization to and from -# standard XML. -# -# @param element Optional root element. -# @keyparam file Optional file handle or file name. If given, the -# tree is initialized with the contents of this XML file. class ElementTree: + """An XML element hierarchy. + This class also provides support for serialization to and from + standard XML. + + *element* is an optional root element node, + *file* is an optional file handle or file name of an XML file whose + contents will be used to initialize the tree with. + + """ def __init__(self, element=None, file=None): # assert element is None or iselement(element) self._root = element # first node if file: self.parse(file) - ## - # Gets the root element for this tree. - # - # @return An element instance. - # @defreturn Element - def getroot(self): + """Return root element of this tree.""" return self._root - ## - # Replaces the root element for this tree. This discards the - # current contents of the tree, and replaces it with the given - # element. Use with care. - # - # @param element An element instance. + def _setroot(self, element): + """Replace root element of this tree. - def _setroot(self, element): + This will discard the current contents of the tree and replace it + with the given element. Use with care! + + """ # assert iselement(element) self._root = element - ## - # Loads an external XML document into this element tree. - # - # @param source A file name or file object. If a file object is - # given, it only has to implement a read(n) method. - # @keyparam parser An optional parser instance. If not given, the - # standard {@link XMLParser} parser is used. - # @return The document root element. - # @defreturn Element - # @exception ParseError If the parser fails to parse the document. + def parse(self, source, parser=None): + """Load external XML document into element tree. - def parse(self, source, parser=None): + *source* is a file name or file object, *parser* is an optional parser + instance that defaults to XMLParser. + + ParseError is raised if the parser fails to parse the document. + + Returns the root element of the given source document. + + """ close_source = False if not hasattr(source, "read"): source = open(source, "rb") @@ -667,15 +617,15 @@ if close_source: source.close() - ## - # Creates a tree iterator for the root element. The iterator loops - # over all elements in this tree, in document order. - # - # @param tag What tags to look for (default is to return all elements) - # @return An iterator. - # @defreturn iterator + def iter(self, tag=None): + """Create and return tree iterator for the root element. - def iter(self, tag=None): + The iterator loops over all elements in this tree, in document order. + + *tag* is a string with the tag name to iterate over + (default is to return all elements). + + """ # assert self._root is not None return self._root.iter(tag) @@ -689,16 +639,17 @@ ) return list(self.iter(tag)) - ## - # Finds the first toplevel element with given tag. - # Same as getroot().find(path). - # - # @param path What element to look for. - # @keyparam namespaces Optional namespace prefix map. - # @return The first matching element, or None if no element was found. - # @defreturn Element or None + def find(self, path, namespaces=None): + """Find first matching element by tag name or path. - def find(self, path, namespaces=None): + Same as getroot().find(path), which is Element.find() + + *path* is a string having either an element tag or an XPath, + *namespaces* is an optional mapping from namespace prefix to full name. + + Return the first matching element, or None if no element was found. + + """ # assert self._root is not None if path[:1] == "/": path = "." + path @@ -710,20 +661,17 @@ ) return self._root.find(path, namespaces) - ## - # Finds the element text for the first toplevel element with given - # tag. Same as getroot().findtext(path). - # - # @param path What toplevel element to look for. - # @param default What to return if the element was not found. - # @keyparam namespaces Optional namespace prefix map. - # @return The text content of the first matching element, or the - # default value no element was found. Note that if the element - # is found, but has no text content, this method returns an - # empty string. - # @defreturn string + def findtext(self, path, default=None, namespaces=None): + """Find first matching element by tag name or path. - def findtext(self, path, default=None, namespaces=None): + Same as getroot().findtext(path), which is Element.findtext() + + *path* is a string having either an element tag or an XPath, + *namespaces* is an optional mapping from namespace prefix to full name. + + Return the first matching element, or None if no element was found. + + """ # assert self._root is not None if path[:1] == "/": path = "." + path @@ -735,17 +683,17 @@ ) return self._root.findtext(path, default, namespaces) - ## - # Finds all toplevel elements with the given tag. - # Same as getroot().findall(path). - # - # @param path What element to look for. - # @keyparam namespaces Optional namespace prefix map. - # @return A list or iterator containing all matching elements, - # in document order. - # @defreturn list of Element instances + def findall(self, path, namespaces=None): + """Find all matching subelements by tag name or path. - def findall(self, path, namespaces=None): + Same as getroot().findall(path), which is Element.findall(). + + *path* is a string having either an element tag or an XPath, + *namespaces* is an optional mapping from namespace prefix to full name. + + Return list containing all matching elements in document order. + + """ # assert self._root is not None if path[:1] == "/": path = "." + path @@ -757,17 +705,17 @@ ) return self._root.findall(path, namespaces) - ## - # Finds all matching subelements, by tag name or path. - # Same as getroot().iterfind(path). - # - # @param path What element to look for. - # @keyparam namespaces Optional namespace prefix map. - # @return An iterator or sequence containing all matching elements, - # in document order. - # @defreturn a generated sequence of Element instances + def iterfind(self, path, namespaces=None): + """Find all matching subelements by tag name or path. - def iterfind(self, path, namespaces=None): + Same as getroot().iterfind(path), which is element.iterfind() + + *path* is a string having either an element tag or an XPath, + *namespaces* is an optional mapping from namespace prefix to full name. + + Return an iterable yielding all matching elements in document order. + + """ # assert self._root is not None if path[:1] == "/": path = "." + path @@ -785,18 +733,27 @@ default_namespace=None, method=None, *, short_empty_elements=True): - """Write the element tree to a file, as XML. 'file_or_filename' is a - file name or a file object opened for writing. - 'encoding' is the output encoding (default is US-ASCII). - 'xml_declaration' controls if an XML declaration should be added - to the output. Use False for never, True for always, None for only - if not US-ASCII or UTF-8 or Unicode (default is None). - 'default_namespace' sets the default XML namespace (for "xmlns"). - 'method' is either "xml" (default), "html", "text" or "c14n". - The keyword-only 'short_empty_elements' parameter controls the - formatting of elements that contain no content. If True (default), - they are emitted as a single self-closed tag, otherwise they are - emitted as a pair of start/end tags. + """Write element tree to a file as XML. + + Arguments: + *file_or_filename* -- file name or a file object opened for writing + + *encoding* -- the output encoding (default: US-ASCII) + + *xml_declaration* -- bool indicating if an XML declaration should be + added to the output. If None, an XML declaration + is added if encoding IS NOT either of: + US-ASCII, UTF-8, or Unicode + + *default_namespace* -- sets the default XML namespace (for "xmlns") + + *method* -- either "xml" (default), "html, "text", or "c14n" + + *short_empty_elements* -- controls the formatting of elements + that contain no content. If True (default) + they are emitted as a single self-closed + tag, otherwise they are emitted as a pair + of start/end tags """ if not method: @@ -1071,18 +1028,19 @@ # "c14n": _serialize_c14n, } -## -# Registers a namespace prefix. The registry is global, and any -# existing mapping for either the given prefix or the namespace URI -# will be removed. -# -# @param prefix Namespace prefix. -# @param uri Namespace uri. Tags and attributes in this namespace -# will be serialized with the given prefix, if at all possible. -# @exception ValueError If the prefix is reserved, or is otherwise -# invalid. def register_namespace(prefix, uri): + """Register a namespace prefix. + + The registry is global, and any existing mapping for either the + given prefix or the namespace URI will be removed. + + *prefix* is the namespace prefix, *uri* is a namespace uri. Tags and + attributes in this namespace will be serialized with prefix if possible. + + ValueError is raised if prefix is reserved or is invalid. + + """ if re.match("ns\d+$", prefix): raise ValueError("Prefix format reserved for internal use") for k, v in list(_namespace_map.items()): @@ -1158,42 +1116,27 @@ # -------------------------------------------------------------------- -## -# Generates a string representation of an XML element, including all -# subelements. If encoding is "unicode", the return type is a string; -# otherwise it is a bytes array. -# -# @param element An Element instance. -# @keyparam encoding Optional output encoding (default is US-ASCII). -# Use "unicode" to return a Unicode string. -# @keyparam method Optional output method ("xml", "html", "text" or -# "c14n"; default is "xml"). -# @return An (optionally) encoded string containing the XML data. -# @defreturn string - def tostring(element, encoding=None, method=None, *, short_empty_elements=True): + """Generate string representation of XML element. + + All subelements are included. If encoding is "unicode", a string + is returned. Otherwise a bytestring is returned. + + *element* is an Element instance, *encoding* is an optional output + encoding defaulting to US-ASCII, *method* is an optional output which can + be one of "xml" (default), "html", "text" or "c14n". + + Returns an (optionally) encoded string containing the XML data. + + """ stream = io.StringIO() if encoding == 'unicode' else io.BytesIO() ElementTree(element).write(stream, encoding, method=method, short_empty_elements=short_empty_elements) return stream.getvalue() -## -# Generates a string representation of an XML element, including all -# subelements. -# -# @param element An Element instance. -# @keyparam encoding Optional output encoding (default is US-ASCII). -# Use "unicode" to return a Unicode string. -# @keyparam method Optional output method ("xml", "html", "text" or -# "c14n"; default is "xml"). -# @return A sequence object containing the XML data. -# @defreturn sequence -# @since 1.3 - class _ListDataStream(io.BufferedIOBase): - """ An auxiliary stream accumulating into a list reference - """ + """An auxiliary stream accumulating into a list reference.""" def __init__(self, lst): self.lst = lst @@ -1217,16 +1160,17 @@ short_empty_elements=short_empty_elements) return lst -## -# Writes an element tree or element structure to sys.stdout. This -# function should be used for debugging only. -#

-# The exact output format is implementation dependent. In this -# version, it's written as an ordinary XML file. -# -# @param elem An element tree or an individual element. def dump(elem): + """Write element tree or element structure to sys.stdout. + + This function should be used for debugging only. + + *elem* is either an ElementTree, or a single Element. The exact output + format is implementation dependent. In this version, it's written as an + ordinary XML file. + + """ # debugging if not isinstance(elem, ElementTree): elem = ElementTree(elem) @@ -1238,31 +1182,36 @@ # -------------------------------------------------------------------- # parsing -## -# Parses an XML document into an element tree. -# -# @param source A filename or file object containing XML data. -# @param parser An optional parser instance. If not given, the -# standard {@link XMLParser} parser is used. -# @return An ElementTree instance def parse(source, parser=None): + """Parse XML document into element tree. + + *source* is a filename or file object containing XML data, + *parser* is an optional parser instance defaulting to XMLParser. + + Return an ElementTree instance. + + """ tree = ElementTree() tree.parse(source, parser) return tree -## -# Parses an XML document into an element tree incrementally, and reports -# what's going on to the user. -# -# @param source A filename or file object containing XML data. -# @param events A list of events to report back. If omitted, only "end" -# events are reported. -# @param parser An optional parser instance. If not given, the -# standard {@link XMLParser} parser is used. -# @return A (event, elem) iterator. def iterparse(source, events=None, parser=None): + """Incrementally parse XML document into ElementTree. + + This class also reports what's going on to the user based on the + *events* it is initialized with. The supported events are the strings + "start", "end", "start-ns" and "end-ns" (the "ns" events are used to get + detailed namespace information). If *events* is omitted, only + "end" events are reported. + + *source* is a filename or file object containing XML data, *events* is + a list of events to report back, *parser* is an optional parser instance. + + Returns an iterator providing (event, elem) pairs. + + """ close_source = False if not hasattr(source, "read"): source = open(source, "rb") @@ -1349,33 +1298,34 @@ def __iter__(self): return self -## -# Parses an XML document from a string constant. This function can -# be used to embed "XML literals" in Python code. -# -# @param source A string containing XML data. -# @param parser An optional parser instance. If not given, the -# standard {@link XMLParser} parser is used. -# @return An Element instance. -# @defreturn Element def XML(text, parser=None): + """Parse XML document from string constant. + + This function can be used to embed "XML Literals" in Python code. + + *text* is a string containing XML data, *parser* is an + optional parser instance, defaulting to the standard XMLParser. + + Returns an Element instance. + + """ if not parser: parser = XMLParser(target=TreeBuilder()) parser.feed(text) return parser.close() -## -# Parses an XML document from a string constant, and also returns -# a dictionary which maps from element id:s to elements. -# -# @param source A string containing XML data. -# @param parser An optional parser instance. If not given, the -# standard {@link XMLParser} parser is used. -# @return A tuple containing an Element instance and a dictionary. -# @defreturn (Element, dictionary) def XMLID(text, parser=None): + """Parse XML document from string constant for its IDs. + + *text* is a string containing XML data, *parser* is an + optional parser instance, defaulting to the standard XMLParser. + + Returns an (Element, dict) tuple, in which the + dict maps element id:s to elements. + + """ if not parser: parser = XMLParser(target=TreeBuilder()) parser.feed(text) @@ -1387,27 +1337,18 @@ ids[id] = elem return tree, ids -## -# Parses an XML document from a string constant. Same as {@link #XML}. -# -# @def fromstring(text) -# @param source A string containing XML data. -# @return An Element instance. -# @defreturn Element - fromstring = XML - -## -# Parses an XML document from a sequence of string fragments. -# -# @param sequence A list or other sequence containing XML data fragments. -# @param parser An optional parser instance. If not given, the -# standard {@link XMLParser} parser is used. -# @return An Element instance. -# @defreturn Element -# @since 1.3 +"""Parse XML document from string constant. Alias for XML().""" def fromstringlist(sequence, parser=None): + """Parse XML document from sequence of string fragments. + + *sequence* is a list of other sequence, *parser* is an optional parser + instance, defaulting to the standard XMLParser. + + Returns an Element instance. + + """ if not parser: parser = XMLParser(target=TreeBuilder()) for text in sequence: @@ -1416,19 +1357,20 @@ # -------------------------------------------------------------------- -## -# Generic element structure builder. This builder converts a sequence -# of {@link #TreeBuilder.start}, {@link #TreeBuilder.data}, and {@link -# #TreeBuilder.end} method calls to a well-formed element structure. -#

-# You can use this class to build an element structure using a custom XML -# parser, or a parser for some other XML-like format. -# -# @param element_factory Optional element factory. This factory -# is called to create new Element instances, as necessary. class TreeBuilder: + """Generic element structure builder. + This builder converts a sequence of start, data, and end method + calls to a well-formed element structure. + + You can use this class to build an element structure using a custom XML + parser, or a parser for some other XML-like format. + + *element_factory* is an optional element factory which is called + to create new Element instances, as necessary. + + """ def __init__(self, element_factory=None): self._data = [] # data collector self._elem = [] # element stack @@ -1438,14 +1380,8 @@ element_factory = Element self._factory = element_factory - ## - # Flushes the builder buffers, and returns the toplevel document - # element. - # - # @return An Element instance. - # @defreturn Element - def close(self): + """Flush builder buffers and return toplevel document Element.""" assert len(self._elem) == 0, "missing end tags" assert self._last is not None, "missing toplevel element" return self._last @@ -1462,24 +1398,19 @@ self._last.text = text self._data = [] - ## - # Adds text to the current element. - # - # @param data A string. This should be either an 8-bit string - # containing ASCII text, or a Unicode string. def data(self, data): + """Add text to current element.""" self._data.append(data) - ## - # Opens a new element. - # - # @param tag The element name. - # @param attrib A dictionary containing element attributes. - # @return The opened element. - # @defreturn Element def start(self, tag, attrs): + """Open new element and return it. + + *tag* is the element name, *attrs* is a dict containing element + attributes. + + """ self._flush() self._last = elem = self._factory(tag, attrs) if self._elem: @@ -1488,14 +1419,13 @@ self._tail = 0 return elem - ## - # Closes the current element. - # - # @param tag The element name. - # @return The closed element. - # @defreturn Element def end(self, tag): + """Close and return current Element. + + *tag* is the element name. + + """ self._flush() self._last = self._elem.pop() assert self._last.tag == tag,\ @@ -1504,20 +1434,18 @@ self._tail = 1 return self._last -## -# Element structure builder for XML source data, based on the -# expat parser. -# -# @keyparam target Target object. If omitted, the builder uses an -# instance of the standard {@link #TreeBuilder} class. -# @keyparam html Predefine HTML entities. This flag is not supported -# by the current implementation. -# @keyparam encoding Optional encoding. If given, the value overrides -# the encoding specified in the XML file. -# @see #ElementTree -# @see #TreeBuilder +# also see ElementTree and TreeBuilder class XMLParser: + """Element structure builder for XML source data based on the expat parser. + + *html* are predefined HTML entities (not supported currently), + *target* is an optional target object which defaults to an instance of the + standard TreeBuilder class, *encoding* is an optional encoding string + which if given, overrides the encoding specified in the XML file: + http://www.iana.org/assignments/character-sets + + """ def __init__(self, html=0, target=None, encoding=None): try: @@ -1659,15 +1587,13 @@ self.doctype(name, pubid, system[1:-1]) self._doctype = None - ## - # (Deprecated) Handles a doctype declaration. - # - # @param name Doctype name. - # @param pubid Public identifier. - # @param system System identifier. + def doctype(self, name, pubid, system): + """(Deprecated) Handle doctype declaration - def doctype(self, name, pubid, system): - """This method of XMLParser is deprecated.""" + *name* is the Doctype name, *pubid* is the public identifier, + and *system* is the system identifier. + + """ warnings.warn( "This method of XMLParser is deprecated. Define doctype() " "method on the TreeBuilder target.", @@ -1677,24 +1603,15 @@ # sentinel, if doctype is redefined in a subclass __doctype = doctype - ## - # Feeds data to the parser. - # - # @param data Encoded data. - def feed(self, data): + """Feed encoded data to parser.""" try: self.parser.Parse(data, 0) except self._error as v: self._raiseerror(v) - ## - # Finishes feeding data to the parser. - # - # @return An element structure. - # @defreturn Element - def close(self): + """Finish feeding data to parser and return element structure.""" try: self.parser.Parse("", 1) # end of data except self._error as v: @@ -1721,7 +1638,9 @@ # Overwrite 'ElementTree.parse' and 'iterparse' to use the C XMLParser class ElementTree(ElementTree): + __doc__ = ElementTree.__doc__ def parse(self, source, parser=None): + __doc__ = ElementTree.parse.__doc__ close_source = False if not hasattr(source, 'read'): source = open(source, 'rb') @@ -1743,25 +1662,14 @@ source.close() class iterparse: - """Parses an XML section into an element tree incrementally. - - Reports what?s going on to the user. 'source' is a filename or file - object containing XML data. 'events' is a list of events to report back. - The supported events are the strings "start", "end", "start-ns" and - "end-ns" (the "ns" events are used to get detailed namespace - information). If 'events' is omitted, only "end" events are reported. - 'parser' is an optional parser instance. If not given, the standard - XMLParser parser is used. Returns an iterator providing - (event, elem) pairs. - """ - + __doc__ = iterparse.__doc__ root = None - def __init__(self, file, events=None, parser=None): + def __init__(self, source, events=None, parser=None): self._close_file = False - if not hasattr(file, 'read'): - file = open(file, 'rb') + if not hasattr(source, 'read'): + source = open(source, 'rb') self._close_file = True - self._file = file + self._file = source self._events = [] self._index = 0 self._error = None diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -677,6 +677,7 @@ Erno Kuusela Ross Lagerwall Cameron Laird +David Lam Thomas Lamb Jean-Baptiste "Jiba" Lamy Ronan Lamy -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 20:25:33 2013 From: python-checkins at python.org (brett.cannon) Date: Sat, 9 Mar 2013 20:25:33 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Touch_up_the_P?= =?utf-8?q?ython_2_to_3_porting_guide?= Message-ID: <3ZNbC153DjzMFN@mail.python.org> http://hg.python.org/cpython/rev/e671a81e5966 changeset: 82572:e671a81e5966 branch: 3.3 parent: 82568:bfc159f8e4b4 user: Brett Cannon date: Sat Mar 09 14:22:35 2013 -0500 summary: Touch up the Python 2 to 3 porting guide files: Doc/howto/pyporting.rst | 61 +++++++++++++++++++++------- Misc/NEWS | 2 + 2 files changed, 48 insertions(+), 15 deletions(-) diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst --- a/Doc/howto/pyporting.rst +++ b/Doc/howto/pyporting.rst @@ -21,21 +21,21 @@ Choosing a Strategy =================== -When a project makes the decision that it's time to support both Python 2 & 3, +When a project chooses to support both Python 2 & 3, a decision needs to be made as to how to go about accomplishing that goal. The chosen strategy will depend on how large the project's existing -codebase is and how much divergence you want from your Python 2 codebase from -your Python 3 one (e.g., starting a new version with Python 3). - -If your project is brand-new or does not have a large codebase, then you may -want to consider writing/porting :ref:`all of your code for Python 3 -and use 3to2 ` to port your code for Python 2. +codebase is and how much divergence you want from your current Python 2 codebase +(e.g., changing your code to work simultaneously with Python 2 and 3). If you would prefer to maintain a codebase which is semantically **and** syntactically compatible with Python 2 & 3 simultaneously, you can write :ref:`use_same_source`. While this tends to lead to somewhat non-idiomatic code, it does mean you keep a rapid development process for you, the developer. +If your project is brand-new or does not have a large codebase, then you may +want to consider writing/porting :ref:`all of your code for Python 3 +and use 3to2 ` to port your code for Python 2. + Finally, you do have the option of :ref:`using 2to3 ` to translate Python 2 code into Python 3 code (with some manual help). This can take the form of branching your code and using 2to3 to start a Python 3 branch. You can @@ -55,10 +55,10 @@ consider. One is make sure you have a robust test suite. You need to make sure everything -continues to work, just like when you support a new minor version of Python. -This means making sure your test suite is thorough and is ported properly -between Python 2 & 3. You will also most likely want to use something like tox_ -to automate testing between both a Python 2 and Python 3 VM. +continues to work, just like when you support a new minor/feature release of +Python. This means making sure your test suite is thorough and is ported +properly between Python 2 & 3. You will also most likely want to use something +like tox_ to automate testing between both a Python 2 and Python 3 interpreter. Two, once your project has Python 3 support, make sure to add the proper classifier on the Cheeseshop_ (PyPI_). To have your project listed as Python 3 @@ -98,7 +98,8 @@ Four, read all the approaches. Just because some bit of advice applies to one approach more than another doesn't mean that some advice doesn't apply to other -strategies. +strategies. This is especially true of whether you decide to use 2to3 or be +source-compatible; tips for one approach almost always apply to the other. Five, drop support for older Python versions if possible. `Python 2.5`_ introduced a lot of useful syntax and libraries which have become idiomatic @@ -108,6 +109,14 @@ of Python which you believe can be your minimum support version and work from there. +Six, target the newest version of Python 3 that you can. Beyond just the usual +bugfixes, compatibility has continued to improve between Python 2 and 3 as time +has passed. This is especially true for Python 3.3 where the ``u`` prefix for +strings is allowed, making source-compatible Python code easier. + +Seven, make sure to look at the `Other Resources`_ for tips from other people +which may help you out. + .. _tox: http://codespeak.net/tox/ .. _Cheeseshop: @@ -169,8 +178,8 @@ prefer this approach compared to using :ref:`use_same_source` or simply keeping a separate Python 3 codebase. -Below are the typical steps taken by a project which uses a 2to3-based approach -to supporting Python 2 & 3. +Below are the typical steps taken by a project which tries to support +Python 2 & 3 while keeping the code directly executable by Python 2. Support Python 2.7 @@ -215,7 +224,9 @@ you use this future statement or not, you **must** make sure you know exactly which Python 2 strings you want to be bytes, and which are to be strings. This means you should, **at minimum** mark all strings that are meant to be text -strings with a ``u`` prefix if you do not use this future statement. +strings with a ``u`` prefix if you do not use this future statement. Python 3.3 +allows strings to continue to have the ``u`` prefix (it's a no-op in that case) +to make it easier for code to be source-compatible between Python 2 & 3. Bytes literals @@ -226,6 +237,15 @@ what is and is not a Python 3 string. When you run 2to3 on code, all Python 2 strings become Python 3 strings **unless** they are prefixed with ``b``. +This point cannot be stressed enough: make sure you know what all of your string +literals in Python 2 are meant to become in Python 3. Any string literal that +should be treated as bytes should have the ``b`` prefix. Any string literal +that should be Unicode/text in Python 2 should either have the ``u`` literal +(supported, but ignored, in Python 3.3 and later) or you should have +``from __future__ import unicode_literals`` at the top of the file. But the key +point is you should know how Python 3 will treat everyone one of your string +literals and you should mark them as appropriate. + There are some differences between byte literals in Python 2 and those in Python 3 thanks to the bytes type just being an alias to ``str`` in Python 2. Probably the biggest "gotcha" is that indexing results in different values. In @@ -264,6 +284,16 @@ than Python 2.5, use the __future__ statement. +Mark all Unicode strings with a ``u`` prefix +''''''''''''''''''''''''''''''''''''''''''''' + +While Python 2.6 has a ``__future__`` statement to automatically cause Python 2 +to treat all string literals as Unicode, Python 2.5 does not have that shortcut. +This means you should go through and mark all string literals with a ``u`` +prefix to turn them explicitly into Unicode strings where appropriate. That +leaves all unmarked string literals to be considered byte literals in Python 3. + + Handle Common "Gotchas" ----------------------- @@ -708,6 +738,7 @@ * http://lucumr.pocoo.org/2011/1/22/forwards-compatible-python/ * http://lucumr.pocoo.org/2010/2/11/porting-to-python-3-a-guide/ * http://wiki.python.org/moin/PortingPythonToPy3k +* https://wiki.ubuntu.com/Python/3 If you feel there is something missing from this document that should be added, please email the python-porting_ mailing list. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1110,6 +1110,8 @@ Documentation ------------- +- Touched up the Python 2 to 3 porting guide. + - Issue #14674: Add a discussion of the `json` module's standard compliance. Patch by Chris Rebert. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 20:25:35 2013 From: python-checkins at python.org (brett.cannon) Date: Sat, 9 Mar 2013 20:25:35 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZNbC31zffzNwJ@mail.python.org> http://hg.python.org/cpython/rev/f521fddc5092 changeset: 82573:f521fddc5092 parent: 82571:f27d7c1eac4d parent: 82572:e671a81e5966 user: Brett Cannon date: Sat Mar 09 14:25:08 2013 -0500 summary: merge files: Doc/howto/pyporting.rst | 61 +++++++++++++++++++++------- Misc/NEWS | 2 + 2 files changed, 48 insertions(+), 15 deletions(-) diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst --- a/Doc/howto/pyporting.rst +++ b/Doc/howto/pyporting.rst @@ -21,21 +21,21 @@ Choosing a Strategy =================== -When a project makes the decision that it's time to support both Python 2 & 3, +When a project chooses to support both Python 2 & 3, a decision needs to be made as to how to go about accomplishing that goal. The chosen strategy will depend on how large the project's existing -codebase is and how much divergence you want from your Python 2 codebase from -your Python 3 one (e.g., starting a new version with Python 3). - -If your project is brand-new or does not have a large codebase, then you may -want to consider writing/porting :ref:`all of your code for Python 3 -and use 3to2 ` to port your code for Python 2. +codebase is and how much divergence you want from your current Python 2 codebase +(e.g., changing your code to work simultaneously with Python 2 and 3). If you would prefer to maintain a codebase which is semantically **and** syntactically compatible with Python 2 & 3 simultaneously, you can write :ref:`use_same_source`. While this tends to lead to somewhat non-idiomatic code, it does mean you keep a rapid development process for you, the developer. +If your project is brand-new or does not have a large codebase, then you may +want to consider writing/porting :ref:`all of your code for Python 3 +and use 3to2 ` to port your code for Python 2. + Finally, you do have the option of :ref:`using 2to3 ` to translate Python 2 code into Python 3 code (with some manual help). This can take the form of branching your code and using 2to3 to start a Python 3 branch. You can @@ -55,10 +55,10 @@ consider. One is make sure you have a robust test suite. You need to make sure everything -continues to work, just like when you support a new minor version of Python. -This means making sure your test suite is thorough and is ported properly -between Python 2 & 3. You will also most likely want to use something like tox_ -to automate testing between both a Python 2 and Python 3 VM. +continues to work, just like when you support a new minor/feature release of +Python. This means making sure your test suite is thorough and is ported +properly between Python 2 & 3. You will also most likely want to use something +like tox_ to automate testing between both a Python 2 and Python 3 interpreter. Two, once your project has Python 3 support, make sure to add the proper classifier on the Cheeseshop_ (PyPI_). To have your project listed as Python 3 @@ -98,7 +98,8 @@ Four, read all the approaches. Just because some bit of advice applies to one approach more than another doesn't mean that some advice doesn't apply to other -strategies. +strategies. This is especially true of whether you decide to use 2to3 or be +source-compatible; tips for one approach almost always apply to the other. Five, drop support for older Python versions if possible. `Python 2.5`_ introduced a lot of useful syntax and libraries which have become idiomatic @@ -108,6 +109,14 @@ of Python which you believe can be your minimum support version and work from there. +Six, target the newest version of Python 3 that you can. Beyond just the usual +bugfixes, compatibility has continued to improve between Python 2 and 3 as time +has passed. This is especially true for Python 3.3 where the ``u`` prefix for +strings is allowed, making source-compatible Python code easier. + +Seven, make sure to look at the `Other Resources`_ for tips from other people +which may help you out. + .. _tox: http://codespeak.net/tox/ .. _Cheeseshop: @@ -169,8 +178,8 @@ prefer this approach compared to using :ref:`use_same_source` or simply keeping a separate Python 3 codebase. -Below are the typical steps taken by a project which uses a 2to3-based approach -to supporting Python 2 & 3. +Below are the typical steps taken by a project which tries to support +Python 2 & 3 while keeping the code directly executable by Python 2. Support Python 2.7 @@ -215,7 +224,9 @@ you use this future statement or not, you **must** make sure you know exactly which Python 2 strings you want to be bytes, and which are to be strings. This means you should, **at minimum** mark all strings that are meant to be text -strings with a ``u`` prefix if you do not use this future statement. +strings with a ``u`` prefix if you do not use this future statement. Python 3.3 +allows strings to continue to have the ``u`` prefix (it's a no-op in that case) +to make it easier for code to be source-compatible between Python 2 & 3. Bytes literals @@ -226,6 +237,15 @@ what is and is not a Python 3 string. When you run 2to3 on code, all Python 2 strings become Python 3 strings **unless** they are prefixed with ``b``. +This point cannot be stressed enough: make sure you know what all of your string +literals in Python 2 are meant to become in Python 3. Any string literal that +should be treated as bytes should have the ``b`` prefix. Any string literal +that should be Unicode/text in Python 2 should either have the ``u`` literal +(supported, but ignored, in Python 3.3 and later) or you should have +``from __future__ import unicode_literals`` at the top of the file. But the key +point is you should know how Python 3 will treat everyone one of your string +literals and you should mark them as appropriate. + There are some differences between byte literals in Python 2 and those in Python 3 thanks to the bytes type just being an alias to ``str`` in Python 2. Probably the biggest "gotcha" is that indexing results in different values. In @@ -264,6 +284,16 @@ than Python 2.5, use the __future__ statement. +Mark all Unicode strings with a ``u`` prefix +''''''''''''''''''''''''''''''''''''''''''''' + +While Python 2.6 has a ``__future__`` statement to automatically cause Python 2 +to treat all string literals as Unicode, Python 2.5 does not have that shortcut. +This means you should go through and mark all string literals with a ``u`` +prefix to turn them explicitly into Unicode strings where appropriate. That +leaves all unmarked string literals to be considered byte literals in Python 3. + + Handle Common "Gotchas" ----------------------- @@ -708,6 +738,7 @@ * http://lucumr.pocoo.org/2011/1/22/forwards-compatible-python/ * http://lucumr.pocoo.org/2010/2/11/porting-to-python-3-a-guide/ * http://wiki.python.org/moin/PortingPythonToPy3k +* https://wiki.ubuntu.com/Python/3 If you feel there is something missing from this document that should be added, please email the python-porting_ mailing list. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1409,6 +1409,8 @@ Documentation ------------- +- Touched up the Python 2 to 3 porting guide. + - Issue #14674: Add a discussion of the `json` module's standard compliance. Patch by Chris Rebert. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 21:21:53 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 9 Mar 2013 21:21:53 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzExOTYzOiBhdm9p?= =?utf-8?q?d_printing_messages_in_test=5Fparser=2E__Initial_patch_by_?= =?utf-8?q?=C3=89ric_Araujo=2E?= Message-ID: <3ZNcS14bT2zQwc@mail.python.org> http://hg.python.org/cpython/rev/9ee8c00f7e63 changeset: 82574:9ee8c00f7e63 branch: 2.7 parent: 82570:eece32440a52 user: Ezio Melotti date: Sat Mar 09 22:17:33 2013 +0200 summary: #11963: avoid printing messages in test_parser. Initial patch by ?ric Araujo. files: Lib/test/test_parser.py | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -3,6 +3,7 @@ import sys import struct from test import test_support as support +from test.script_helper import assert_python_failure # # First, we test that we can generate trees from valid source fragments, @@ -579,7 +580,7 @@ class ParserStackLimitTestCase(unittest.TestCase): - """try to push the parser to/over it's limits. + """try to push the parser to/over its limits. see http://bugs.python.org/issue1881 for a discussion """ def _nested_expression(self, level): @@ -592,8 +593,10 @@ def test_trigger_memory_error(self): e = self._nested_expression(100) - print >>sys.stderr, "Expecting 's_push: parser stack overflow' in next line" - self.assertRaises(MemoryError, parser.expr, e) + rc, out, err = assert_python_failure('-c', e) + # parsing the expression will result in an error message + # followed by a MemoryError (see #11963) + self.assertEqual(err, b's_push: parser stack overflow\nMemoryError') class STObjectTestCase(unittest.TestCase): """Test operations on ST objects themselves""" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 21:21:55 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 9 Mar 2013 21:21:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzExOTYzOiBhdm9p?= =?utf-8?q?d_printing_messages_in_test=5Fparser=2E__Initial_patch_by_?= =?utf-8?q?=C3=89ric_Araujo=2E?= Message-ID: <3ZNcS30YHKzRbP@mail.python.org> http://hg.python.org/cpython/rev/10a82140f36d changeset: 82575:10a82140f36d branch: 3.2 parent: 82567:0acd9408b6f1 user: Ezio Melotti date: Sat Mar 09 22:17:33 2013 +0200 summary: #11963: avoid printing messages in test_parser. Initial patch by ?ric Araujo. files: Lib/test/test_parser.py | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -4,6 +4,7 @@ import operator import struct from test import support +from test.script_helper import assert_python_failure # # First, we test that we can generate trees from valid source fragments, @@ -607,10 +608,10 @@ def test_trigger_memory_error(self): e = self._nested_expression(100) - print("Expecting 's_push: parser stack overflow' in next line", - file=sys.stderr) - sys.stderr.flush() - self.assertRaises(MemoryError, parser.expr, e) + rc, out, err = assert_python_failure('-c', e) + # parsing the expression will result in an error message + # followed by a MemoryError (see #11963) + self.assertEqual(err, b's_push: parser stack overflow\nMemoryError') class STObjectTestCase(unittest.TestCase): """Test operations on ST objects themselves""" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 21:21:56 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 9 Mar 2013 21:21:56 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2311963=3A_merge_with_3=2E2=2E?= Message-ID: <3ZNcS43Q85zRnJ@mail.python.org> http://hg.python.org/cpython/rev/185c923f21ec changeset: 82576:185c923f21ec branch: 3.3 parent: 82572:e671a81e5966 parent: 82575:10a82140f36d user: Ezio Melotti date: Sat Mar 09 22:20:23 2013 +0200 summary: #11963: merge with 3.2. files: Lib/test/test_parser.py | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -4,6 +4,7 @@ import operator import struct from test import support +from test.script_helper import assert_python_failure # # First, we test that we can generate trees from valid source fragments, @@ -611,10 +612,10 @@ def test_trigger_memory_error(self): e = self._nested_expression(100) - print("Expecting 's_push: parser stack overflow' in next line", - file=sys.stderr) - sys.stderr.flush() - self.assertRaises(MemoryError, parser.expr, e) + rc, out, err = assert_python_failure('-c', e) + # parsing the expression will result in an error message + # followed by a MemoryError (see #11963) + self.assertEqual(err, b's_push: parser stack overflow\nMemoryError') class STObjectTestCase(unittest.TestCase): """Test operations on ST objects themselves""" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 9 21:21:57 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 9 Mar 2013 21:21:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzExOTYzOiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZNcS560fDzQxL@mail.python.org> http://hg.python.org/cpython/rev/acf6ffc57fcf changeset: 82577:acf6ffc57fcf parent: 82573:f521fddc5092 parent: 82576:185c923f21ec user: Ezio Melotti date: Sat Mar 09 22:21:32 2013 +0200 summary: #11963: merge with 3.3. files: Lib/test/test_parser.py | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -4,6 +4,7 @@ import operator import struct from test import support +from test.script_helper import assert_python_failure # # First, we test that we can generate trees from valid source fragments, @@ -611,10 +612,10 @@ def test_trigger_memory_error(self): e = self._nested_expression(100) - print("Expecting 's_push: parser stack overflow' in next line", - file=sys.stderr) - sys.stderr.flush() - self.assertRaises(MemoryError, parser.expr, e) + rc, out, err = assert_python_failure('-c', e) + # parsing the expression will result in an error message + # followed by a MemoryError (see #11963) + self.assertEqual(err, b's_push: parser stack overflow\nMemoryError') class STObjectTestCase(unittest.TestCase): """Test operations on ST objects themselves""" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 10 02:30:12 2013 From: python-checkins at python.org (ezio.melotti) Date: Sun, 10 Mar 2013 02:30:12 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzExOTYzOiBmaXgg?= =?utf-8?q?Windows_buildbots=2E?= Message-ID: <3ZNlHm6Y99zQlF@mail.python.org> http://hg.python.org/cpython/rev/61ec83956ba6 changeset: 82578:61ec83956ba6 branch: 2.7 parent: 82574:9ee8c00f7e63 user: Ezio Melotti date: Sun Mar 10 03:25:45 2013 +0200 summary: #11963: fix Windows buildbots. files: Lib/test/test_parser.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -596,7 +596,8 @@ rc, out, err = assert_python_failure('-c', e) # parsing the expression will result in an error message # followed by a MemoryError (see #11963) - self.assertEqual(err, b's_push: parser stack overflow\nMemoryError') + self.assertIn(b's_push: parser stack overflow', err) + self.assertIn(b'MemoryError', err) class STObjectTestCase(unittest.TestCase): """Test operations on ST objects themselves""" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 10 02:30:14 2013 From: python-checkins at python.org (ezio.melotti) Date: Sun, 10 Mar 2013 02:30:14 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzExOTYzOiBmaXgg?= =?utf-8?q?Windows_buildbots=2E?= Message-ID: <3ZNlHp243fzQlF@mail.python.org> http://hg.python.org/cpython/rev/64b87578c071 changeset: 82579:64b87578c071 branch: 3.2 parent: 82575:10a82140f36d user: Ezio Melotti date: Sun Mar 10 03:25:45 2013 +0200 summary: #11963: fix Windows buildbots. files: Lib/test/test_parser.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -611,7 +611,8 @@ rc, out, err = assert_python_failure('-c', e) # parsing the expression will result in an error message # followed by a MemoryError (see #11963) - self.assertEqual(err, b's_push: parser stack overflow\nMemoryError') + self.assertIn(b's_push: parser stack overflow', err) + self.assertIn(b'MemoryError', err) class STObjectTestCase(unittest.TestCase): """Test operations on ST objects themselves""" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 10 02:30:15 2013 From: python-checkins at python.org (ezio.melotti) Date: Sun, 10 Mar 2013 02:30:15 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2311963=3A_merge_with_3=2E2=2E?= Message-ID: <3ZNlHq4pHmzRYn@mail.python.org> http://hg.python.org/cpython/rev/f683ca2b30e3 changeset: 82580:f683ca2b30e3 branch: 3.3 parent: 82576:185c923f21ec parent: 82579:64b87578c071 user: Ezio Melotti date: Sun Mar 10 03:27:26 2013 +0200 summary: #11963: merge with 3.2. files: Lib/test/test_parser.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -615,7 +615,8 @@ rc, out, err = assert_python_failure('-c', e) # parsing the expression will result in an error message # followed by a MemoryError (see #11963) - self.assertEqual(err, b's_push: parser stack overflow\nMemoryError') + self.assertIn(b's_push: parser stack overflow', err) + self.assertIn(b'MemoryError', err) class STObjectTestCase(unittest.TestCase): """Test operations on ST objects themselves""" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 10 02:30:17 2013 From: python-checkins at python.org (ezio.melotti) Date: Sun, 10 Mar 2013 02:30:17 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzExOTYzOiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZNlHs0RDVzRhN@mail.python.org> http://hg.python.org/cpython/rev/65147d2422dc changeset: 82581:65147d2422dc parent: 82577:acf6ffc57fcf parent: 82580:f683ca2b30e3 user: Ezio Melotti date: Sun Mar 10 03:29:55 2013 +0200 summary: #11963: merge with 3.3. files: Lib/test/test_parser.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -615,7 +615,8 @@ rc, out, err = assert_python_failure('-c', e) # parsing the expression will result in an error message # followed by a MemoryError (see #11963) - self.assertEqual(err, b's_push: parser stack overflow\nMemoryError') + self.assertIn(b's_push: parser stack overflow', err) + self.assertIn(b'MemoryError', err) class STObjectTestCase(unittest.TestCase): """Test operations on ST objects themselves""" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 10 03:28:43 2013 From: python-checkins at python.org (ezio.melotti) Date: Sun, 10 Mar 2013 03:28:43 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzE0NDg5OiBmaXgg?= =?utf-8?q?wrong_link=2E?= Message-ID: <3ZNmbH2z6RzR2M@mail.python.org> http://hg.python.org/cpython/rev/aea3167355fc changeset: 82582:aea3167355fc branch: 2.7 parent: 82578:61ec83956ba6 user: Ezio Melotti date: Sun Mar 10 04:28:28 2013 +0200 summary: #14489: fix wrong link. files: Doc/library/functions.rst | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -19,7 +19,7 @@ :func:`bytearray` :func:`float` :func:`list` :func:`raw_input` :func:`unichr` :func:`callable` :func:`format` :func:`locals` :func:`reduce` :func:`unicode` :func:`chr` |func-frozenset|_ :func:`long` :func:`reload` :func:`vars` -:func:`classmethod` :func:`getattr` :func:`map` :func:`repr` :func:`xrange` +:func:`classmethod` :func:`getattr` :func:`map` |func-repr|_ :func:`xrange` :func:`cmp` :func:`globals` :func:`max` :func:`reversed` :func:`zip` :func:`compile` :func:`hasattr` |func-memoryview|_ :func:`round` :func:`__import__` :func:`complex` :func:`hash` :func:`min` |func-set|_ :func:`apply` @@ -34,6 +34,7 @@ .. |func-dict| replace:: ``dict()`` .. |func-frozenset| replace:: ``frozenset()`` .. |func-memoryview| replace:: ``memoryview()`` +.. |func-repr| replace:: ``repr()`` .. |func-set| replace:: ``set()`` @@ -1179,6 +1180,7 @@ continue to use the old class definition. The same is true for derived classes. +.. _func-repr: .. function:: repr(object) Return a string containing a printable representation of an object. This is -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sun Mar 10 05:58:08 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 10 Mar 2013 05:58:08 +0100 Subject: [Python-checkins] Daily reference leaks (65147d2422dc): sum=0 Message-ID: results for 65147d2422dc on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogGrvz6O', '-x'] From python-checkins at python.org Sun Mar 10 17:37:39 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 10 Mar 2013 17:37:39 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3MzUx?= =?utf-8?q?=3A_Modernize_the_pure_Python_property=28=29_example=2E?= Message-ID: <3ZP7Qq0kntzRf4@mail.python.org> http://hg.python.org/cpython/rev/513c4aaf70d7 changeset: 82583:513c4aaf70d7 branch: 2.7 user: Raymond Hettinger date: Sun Mar 10 09:36:52 2013 -0700 summary: Issue #17351: Modernize the pure Python property() example. files: Doc/howto/descriptor.rst | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst --- a/Doc/howto/descriptor.rst +++ b/Doc/howto/descriptor.rst @@ -218,25 +218,36 @@ self.fget = fget self.fset = fset self.fdel = fdel + if doc is None and fget is not None: + doc = fget.__doc__ self.__doc__ = doc def __get__(self, obj, objtype=None): if obj is None: return self if self.fget is None: - raise AttributeError, "unreadable attribute" + raise AttributeError("unreadable attribute") return self.fget(obj) def __set__(self, obj, value): if self.fset is None: - raise AttributeError, "can't set attribute" + raise AttributeError("can't set attribute") self.fset(obj, value) def __delete__(self, obj): if self.fdel is None: - raise AttributeError, "can't delete attribute" + raise AttributeError("can't delete attribute") self.fdel(obj) + def getter(self, fget): + return type(self)(fget, self.fset, self.fdel, self.__doc__) + + def setter(self, fset): + return type(self)(self.fget, fset, self.fdel, self.__doc__) + + def deleter(self, fdel): + return type(self)(self.fget, self.fset, fdel, self.__doc__) + The :func:`property` builtin helps whenever a user interface has granted attribute access and then subsequent changes require the intervention of a method. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 10 17:42:43 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 10 Mar 2013 17:42:43 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE3MzUx?= =?utf-8?q?=3A_Modernize_the_pure_Python_property=28=29_example=2E?= Message-ID: <3ZP7Xg35gPzRvh@mail.python.org> http://hg.python.org/cpython/rev/bb7e01b5d362 changeset: 82584:bb7e01b5d362 branch: 3.3 parent: 82580:f683ca2b30e3 user: Raymond Hettinger date: Sun Mar 10 09:41:18 2013 -0700 summary: Issue #17351: Modernize the pure Python property() example. files: Doc/howto/descriptor.rst | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst --- a/Doc/howto/descriptor.rst +++ b/Doc/howto/descriptor.rst @@ -210,25 +210,36 @@ self.fget = fget self.fset = fset self.fdel = fdel + if doc is None and fget is not None: + doc = fget.__doc__ self.__doc__ = doc def __get__(self, obj, objtype=None): if obj is None: return self if self.fget is None: - raise AttributeError, "unreadable attribute" + raise AttributeError("unreadable attribute") return self.fget(obj) def __set__(self, obj, value): if self.fset is None: - raise AttributeError, "can't set attribute" + raise AttributeError("can't set attribute") self.fset(obj, value) def __delete__(self, obj): if self.fdel is None: - raise AttributeError, "can't delete attribute" + raise AttributeError("can't delete attribute") self.fdel(obj) + def getter(self, fget): + return type(self)(fget, self.fset, self.fdel, self.__doc__) + + def setter(self, fset): + return type(self)(self.fget, fset, self.fdel, self.__doc__) + + def deleter(self, fdel): + return type(self)(self.fget, self.fset, fdel, self.__doc__) + The :func:`property` builtin helps whenever a user interface has granted attribute access and then subsequent changes require the intervention of a method. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 10 17:42:44 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 10 Mar 2013 17:42:44 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZP7Xh68cQzRxV@mail.python.org> http://hg.python.org/cpython/rev/115c43340025 changeset: 82585:115c43340025 parent: 82581:65147d2422dc parent: 82584:bb7e01b5d362 user: Raymond Hettinger date: Sun Mar 10 09:42:22 2013 -0700 summary: merge files: Doc/howto/descriptor.rst | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst --- a/Doc/howto/descriptor.rst +++ b/Doc/howto/descriptor.rst @@ -210,25 +210,36 @@ self.fget = fget self.fset = fset self.fdel = fdel + if doc is None and fget is not None: + doc = fget.__doc__ self.__doc__ = doc def __get__(self, obj, objtype=None): if obj is None: return self if self.fget is None: - raise AttributeError, "unreadable attribute" + raise AttributeError("unreadable attribute") return self.fget(obj) def __set__(self, obj, value): if self.fset is None: - raise AttributeError, "can't set attribute" + raise AttributeError("can't set attribute") self.fset(obj, value) def __delete__(self, obj): if self.fdel is None: - raise AttributeError, "can't delete attribute" + raise AttributeError("can't delete attribute") self.fdel(obj) + def getter(self, fget): + return type(self)(fget, self.fset, self.fdel, self.__doc__) + + def setter(self, fset): + return type(self)(self.fget, fset, self.fdel, self.__doc__) + + def deleter(self, fdel): + return type(self)(self.fget, self.fset, fdel, self.__doc__) + The :func:`property` builtin helps whenever a user interface has granted attribute access and then subsequent changes require the intervention of a method. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 10 17:49:20 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 10 Mar 2013 17:49:20 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Classmethod_ex?= =?utf-8?q?ample_needs_to_inherit_from_object?= Message-ID: <3ZP7hJ4qxSzRq7@mail.python.org> http://hg.python.org/cpython/rev/3c39df4b886e changeset: 82586:3c39df4b886e branch: 2.7 parent: 82583:513c4aaf70d7 user: Raymond Hettinger date: Sun Mar 10 09:49:08 2013 -0700 summary: Classmethod example needs to inherit from object files: Doc/howto/descriptor.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst --- a/Doc/howto/descriptor.rst +++ b/Doc/howto/descriptor.rst @@ -409,7 +409,7 @@ :func:`dict.fromkeys` creates a new dictionary from a list of keys. The pure Python equivalent is:: - class Dict: + class Dict(object): . . . def fromkeys(klass, iterable, value=None): "Emulate dict_fromkeys() in Objects/dictobject.c" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 10 17:51:50 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 10 Mar 2013 17:51:50 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Inherit_from_o?= =?utf-8?q?bject=28=29_for_consistency?= Message-ID: <3ZP7lB1lFZzRq7@mail.python.org> http://hg.python.org/cpython/rev/5eca56b68840 changeset: 82587:5eca56b68840 branch: 3.3 parent: 82584:bb7e01b5d362 user: Raymond Hettinger date: Sun Mar 10 09:50:37 2013 -0700 summary: Inherit from object() for consistency files: Doc/howto/descriptor.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst --- a/Doc/howto/descriptor.rst +++ b/Doc/howto/descriptor.rst @@ -401,7 +401,7 @@ :func:`dict.fromkeys` creates a new dictionary from a list of keys. The pure Python equivalent is:: - class Dict: + class Dict(object): . . . def fromkeys(klass, iterable, value=None): "Emulate dict_fromkeys() in Objects/dictobject.c" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 10 17:51:52 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 10 Mar 2013 17:51:52 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZP7lD0HcSzRq7@mail.python.org> http://hg.python.org/cpython/rev/60cb72c7fd75 changeset: 82588:60cb72c7fd75 parent: 82585:115c43340025 parent: 82587:5eca56b68840 user: Raymond Hettinger date: Sun Mar 10 09:51:37 2013 -0700 summary: merge files: Doc/howto/descriptor.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst --- a/Doc/howto/descriptor.rst +++ b/Doc/howto/descriptor.rst @@ -401,7 +401,7 @@ :func:`dict.fromkeys` creates a new dictionary from a list of keys. The pure Python equivalent is:: - class Dict: + class Dict(object): . . . def fromkeys(klass, iterable, value=None): "Emulate dict_fromkeys() in Objects/dictobject.c" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 10 19:33:12 2013 From: python-checkins at python.org (daniel.holth) Date: Sun, 10 Mar 2013 19:33:12 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_wheel_clarifications?= Message-ID: <3ZPB083NjNzRtH@mail.python.org> http://hg.python.org/peps/rev/5bfc679af551 changeset: 4788:5bfc679af551 user: Daniel Holth date: Sun Mar 10 13:33:33 2013 -0400 summary: wheel clarifications files: pep-0427.txt | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/pep-0427.txt b/pep-0427.txt --- a/pep-0427.txt +++ b/pep-0427.txt @@ -96,6 +96,9 @@ point to the correct interpreter. Unix installers may need to add the +x bit to these files if the archive was created on Windows. + The ``b'#!pythonw'`` convention is allowed. ``b'#!pythonw'`` indicates + a GUI script instead of a console script. + Generate script wrappers. In wheel, scripts packaged on Unix systems will certainly not have accompanying .exe wrappers. Windows installers may want to add them @@ -288,6 +291,8 @@ { "hash": "sha256=ADD-r2urObZHcxBW3Cr-vDCu5RJwT4CaRTHiFmbcIYY" } +(The hash value is the same format used in RECORD.) + If RECORD.p7s is used, it must contain a detached S/MIME format signature of RECORD. @@ -361,6 +366,19 @@ Signed packages are only a basic building block in a secure package update system. Wheel only provides the building block. +What's the deal with "purelib" vs. "platlib"? + Wheel preserves the historic "purelib" vs. "platlib" distinction + even though both map to the same install location in any system the + author could find. + + For example, a wheel with "Root-Is-Purelib: false" with all its files + in ``{name}-{version}.data/purelib`` is equivalent to a wheel with + "Root-Is-Purelib: true" with those same files in the root, and it + is legal to have files in both the "purelib" and "platlib" categories. + + In practice a wheel should have only one of "purelib" or "platlib" + depending on whether it is pure Python or not and those files should + be at the root. References ========== -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sun Mar 10 19:33:13 2013 From: python-checkins at python.org (daniel.holth) Date: Sun, 10 Mar 2013 19:33:13 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_update_e-mail?= Message-ID: <3ZPB0968HXzRy0@mail.python.org> http://hg.python.org/peps/rev/4dbfd9610fce changeset: 4789:4dbfd9610fce user: Daniel Holth date: Sun Mar 10 13:33:55 2013 -0400 summary: update e-mail files: pep-0425.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0425.txt b/pep-0425.txt --- a/pep-0425.txt +++ b/pep-0425.txt @@ -2,7 +2,7 @@ Title: Compatibility Tags for Built Distributions Version: $Revision$ Last-Modified: 07-Aug-2012 -Author: Daniel Holth +Author: Daniel Holth Status: Accepted Type: Standards Track -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sun Mar 10 19:33:15 2013 From: python-checkins at python.org (daniel.holth) Date: Sun, 10 Mar 2013 19:33:15 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_PEP_426=3A_extensions_are_0?= =?utf-8?b?Li4x?= Message-ID: <3ZPB0C1k8jzS35@mail.python.org> http://hg.python.org/peps/rev/4fc7b84ee3e7 changeset: 4790:4fc7b84ee3e7 user: Daniel Holth date: Sun Mar 10 13:34:21 2013 -0400 summary: PEP 426: extensions are 0..1 files: pep-0426.txt | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pep-0426.txt b/pep-0426.txt --- a/pep-0426.txt +++ b/pep-0426.txt @@ -2,7 +2,7 @@ Title: Metadata for Python Software Packages 2.0 Version: $Revision$ Last-Modified: $Date$ -Author: Daniel Holth , +Author: Daniel Holth , Donald Stufft , Nick Coghlan BDFL-Delegate: Nick Coghlan @@ -527,13 +527,22 @@ An ASCII string, not containing whitespace or the ``/`` character, that indicates the presence of extended metadata. The additional fields defined by the extension are then prefixed with the name of the extension -and the ``/`` character. +and the ``/`` character. The additional fields are optional (0..1). For example:: Extension: Chili Chili/Type: Poblano Chili/Heat: Mild + Chili/json: { + "type" : "Poblano", + "heat" : "Mild" } + +The special ``{extension name}/json`` permits embedded JSON. It may be +parsed automatically by a future tool. + +Values in extension fields must still respect the general formatting +requirements for metadata headers. To avoid name conflicts, it is recommended that distribution names be used to identify metadata extensions. This practice will also make it easier to @@ -543,9 +552,6 @@ ``Extension: Chili`` field may appear before or after the corresponding extension fields ``Chili/Type:`` etc. -Values in extension fields must still respect the general formatting -requirements for metadata headers. - A bare ``Extension: Name`` entry with no corresponding extension fields is permitted. It may, for example, indicate the expected presence of an additional metadata file rather than the presence of extension fields. -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sun Mar 10 19:33:16 2013 From: python-checkins at python.org (daniel.holth) Date: Sun, 10 Mar 2013 19:33:16 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_PEP_426=3A_optional_features_?= =?utf-8?q?or_=22extra_dependencies=22?= Message-ID: <3ZPB0D45kdzS1Q@mail.python.org> http://hg.python.org/peps/rev/82a2053a7bff changeset: 4791:82a2053a7bff user: Daniel Holth date: Sun Mar 10 13:54:12 2013 -0400 summary: PEP 426: optional features or "extra dependencies" files: pep-0426.txt | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) diff --git a/pep-0426.txt b/pep-0426.txt --- a/pep-0426.txt +++ b/pep-0426.txt @@ -1199,14 +1199,15 @@ ================= Distributions may use the ``Provides-Extra`` field to declare additional -features that they provide. Environment markers may then be used to indicate +features provided through "extra" dependencies, usually corresponding to a +``try: import x ...`` block. Environment markers may be used to indicate that particular dependencies are needed only when a particular optional feature has been requested. -Other distributions then require an optional feature by placing it -inside square brackets after the distribution name when declaring the -dependency. Multiple features can be requisted by separating them with a -comma within the brackets. +Other distributions require the feature by placing it inside +square brackets after the distribution name when declaring the +dependency. Multiple features can be requisted by separating them with +a comma within the brackets. The full set of dependency requirements is then the union of the sets created by first evaluating the `Requires-Dist` fields with `extra` @@ -1220,9 +1221,13 @@ Setup-Requires-Dist: beaglevote[test, doc] -> requires beaglevote, sphinx, nose at setup time -It is legal to specify `Provides-Extra` without referencing it in any -`Requires-Dist`. It is an error to request a feature name that has -not been declared with `Provides-Extra`. +It is an error to request a feature name that has not been declared with +`Provides-Extra` but it is legal to specify `Provides-Extra` without +referencing it in any `Requires-Dist`. + +In the example, if ``beaglevote`` grew the ability to generate PDF +without extra dependencies, it should continue to ``Provides-Extra: +pdf`` for the benefit of dependent distributions. The following feature names are implicitly defined for all distributions: -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sun Mar 10 19:33:17 2013 From: python-checkins at python.org (daniel.holth) Date: Sun, 10 Mar 2013 19:33:17 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_PEP_426=3A_trailing_0=27s_pol?= =?utf-8?q?icy_for_=3D=3D?= Message-ID: <3ZPB0F6k5HzRwp@mail.python.org> http://hg.python.org/peps/rev/ae5d9b9df1a6 changeset: 4792:ae5d9b9df1a6 user: Daniel Holth date: Sun Mar 10 14:32:53 2013 -0400 summary: PEP 426: trailing 0's policy for == files: pep-0426.txt | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/pep-0426.txt b/pep-0426.txt --- a/pep-0426.txt +++ b/pep-0426.txt @@ -601,9 +601,11 @@ .. note:: - Some hard to read version identifiers are permitted by this scheme - in order to better accommodate the wide range of versioning practices - across existing public and private Python projects. + Some hard to read version identifiers are permitted by this scheme in + order to better accommodate the wide range of versioning practices + across existing public and private Python projects, given the + constraint that the package index is not yet sophisticated enough to + allow the introduction of a simpler, backwards-incompatible scheme. Accordingly, some of the versioning practices which are technically permitted by the PEP are strongly discouraged for new projects. Where @@ -1059,17 +1061,17 @@ The ordered comparison operators ``<``, ``>``, ``<=``, ``>=`` are based on the consistent ordering defined by the standard `Version scheme`_. -The ``==`` and ``!=`` operators are based on string comparisons - in order -to match, the version being checked must start with exactly that sequence of -characters. +The ``==`` and ``!=`` operators are based on a kind of prefix comparison - +trailing ``0``s are implied when comparing numeric version parts of different +lengths. ``1.0 == 1 == 1.0.0``, and ``1.0a1 == ``1.0.0.0a1``. .. note:: - The use of ``==`` when defining dependencies for published distributions - is strongly discouraged, as it greatly complicates the deployment of - security fixes (the strict version comparison operator is intended - primarily for use when defining dependencies for particular - applications while using a shared distribution index). + The use of ``==`` when defining dependencies for published + distributions is strongly discouraged as it greatly complicates the + deployment of security fixes. The strict version comparison operator + is intended primarily for use when defining dependencies for repeatable + *deployments of applications* while using a shared distribution index. Handling of pre-releases -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sun Mar 10 19:56:50 2013 From: python-checkins at python.org (terry.reedy) Date: Sun, 10 Mar 2013 19:56:50 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?ZGV2Z3VpZGU6ICcuOjonIGRpc3BsYXlzIGFz?= =?utf-8?q?_=27=2E=3A=27=2E_Reported_in_email_by_Bob_Hanson=2E?= Message-ID: <3ZPBWQ5mWJzS35@mail.python.org> http://hg.python.org/devguide/rev/05280745b1b1 changeset: 608:05280745b1b1 user: Terry Jan Reedy date: Sun Mar 10 14:54:31 2013 -0400 summary: '.::' displays as '.:'. Reported in email by Bob Hanson. files: setup.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/setup.rst b/setup.rst --- a/setup.rst +++ b/setup.rst @@ -137,7 +137,7 @@ More flags are available to ``configure``, but this is the minimum you should do to get a pydebug build of CPython. -Once ``configure`` is done, you can then compile CPython.:: +Once ``configure`` is done, you can then compile CPython with:: make -s -j2 -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Sun Mar 10 19:57:31 2013 From: python-checkins at python.org (ezio.melotti) Date: Sun, 10 Mar 2013 19:57:31 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_typo_in_PyDict=5FSetDe?= =?utf-8?q?fault_docs=2E?= Message-ID: <3ZPBXC0mnYzQst@mail.python.org> http://hg.python.org/cpython/rev/c33781454880 changeset: 82589:c33781454880 user: Ezio Melotti date: Sun Mar 10 20:57:16 2013 +0200 summary: Fix typo in PyDict_SetDefault docs. files: Doc/c-api/dict.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -112,7 +112,7 @@ .. c:function:: PyObject* PyDict_SetDefault(PyObject *p, PyObject *key, PyObject *default) - This is the same the Python-level :meth:`dict.setdefault`. If present, it + This is the same as the Python-level :meth:`dict.setdefault`. If present, it returns the value corresponding to *key* from the dictionary *p*. If the key is not in the dict, it is inserted with value *defaultobj* and *defaultobj* is inserted. This function evaluates the hash function of *key* only once, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 10 23:37:15 2013 From: python-checkins at python.org (ezio.melotti) Date: Sun, 10 Mar 2013 23:37:15 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzExOTYzOiByZW1v?= =?utf-8?q?ve_human_verification_from_test=5Fsubprocess=2E?= Message-ID: <3ZPHPl5C1nzSZq@mail.python.org> http://hg.python.org/cpython/rev/d25749c32bb4 changeset: 82590:d25749c32bb4 branch: 2.7 parent: 82586:3c39df4b886e user: Ezio Melotti date: Mon Mar 11 00:34:33 2013 +0200 summary: #11963: remove human verification from test_subprocess. files: Lib/test/test_subprocess.py | 48 ++++++++++++++++++------ Misc/NEWS | 2 + 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -150,16 +150,27 @@ self.assertEqual(p.stdin, None) def test_stdout_none(self): - # .stdout is None when not redirected - p = subprocess.Popen([sys.executable, "-c", - 'print " this bit of output is from a ' - 'test of stdout in a different ' - 'process ..."'], - stdin=subprocess.PIPE, stderr=subprocess.PIPE) - self.addCleanup(p.stdin.close) + # .stdout is None when not redirected, and the child's stdout will + # be inherited from the parent. In order to test this we run a + # subprocess in a subprocess: + # this_test + # \-- subprocess created by this test (parent) + # \-- subprocess created by the parent subprocess (child) + # The parent doesn't specify stdout, so the child will use the + # parent's stdout. This test checks that the message printed by the + # child goes to the parent stdout. The parent also checks that the + # child's stdout is None. See #11963. + code = ('import sys; from subprocess import Popen, PIPE;' + 'p = Popen([sys.executable, "-c", "print \'test_stdout_none\'"],' + ' stdin=PIPE, stderr=PIPE);' + 'p.wait(); assert p.stdout is None;') + p = subprocess.Popen([sys.executable, "-c", code], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) self.addCleanup(p.stderr.close) - p.wait() - self.assertEqual(p.stdout, None) + out, err = p.communicate() + self.assertEqual(p.returncode, 0, err) + self.assertEqual(out.rstrip(), 'test_stdout_none') def test_stderr_none(self): # .stderr is None when not redirected @@ -308,9 +319,22 @@ def test_stdout_filedes_of_stdout(self): # stdout is set to 1 (#1531862). - cmd = r"import sys, os; sys.exit(os.write(sys.stdout.fileno(), '.\n'))" - rc = subprocess.call([sys.executable, "-c", cmd], stdout=1) - self.assertEqual(rc, 2) + # To avoid printing the '.\n' on stdout, we do something similar to + # test_stdout_none (see above). The parent subprocess calls the child + # subprocess passing stdout=1, and this test uses stdout=PIPE in + # order to capture and check the output of the parent. See #11963. + code = ('import sys, subprocess; ' + 'rc = subprocess.call([sys.executable, "-c", ' + ' "import os, sys; sys.exit(os.write(sys.stdout.fileno(), ' + '\'.\\\\n\'))"], stdout=1); ' + 'assert rc == 2') + p = subprocess.Popen([sys.executable, "-c", code], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) + out, err = p.communicate() + self.assertEqual(p.returncode, 0, err) + self.assertEqual(out, '.\n') def test_cwd(self): tmpdir = tempfile.gettempdir() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -812,6 +812,8 @@ Tests ----- +- Issue #11963: remove human verification from test_parser and test_subprocess. + - Issue #17249: convert a test in test_capi to use unittest and reap threads. - We now run both test_email.py and test_email_renamed.py when running the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 01:58:08 2013 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 11 Mar 2013 01:58:08 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Update_code_to_increment_a?= =?utf-8?q?nd_decrement_using_the_cleaner_+=3D_1_and_-=3D_1_style=2E?= Message-ID: <3ZPLXJ4jMhzRxZ@mail.python.org> http://hg.python.org/cpython/rev/28b86525ef07 changeset: 82591:28b86525ef07 parent: 82589:c33781454880 user: Raymond Hettinger date: Sun Mar 10 15:13:35 2013 -0700 summary: Update code to increment and decrement using the cleaner += 1 and -= 1 style. files: Lib/threading.py | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/threading.py b/Lib/threading.py --- a/Lib/threading.py +++ b/Lib/threading.py @@ -79,7 +79,7 @@ def acquire(self, blocking=True, timeout=-1): me = get_ident() if self._owner == me: - self._count = self._count + 1 + self._count += 1 return 1 rc = self._block.acquire(blocking, timeout) if rc: @@ -261,7 +261,7 @@ break self._cond.wait(timeout) else: - self._value = self._value - 1 + self._value -= 1 rc = True self._cond.release() return rc @@ -270,7 +270,7 @@ def release(self): self._cond.acquire() - self._value = self._value + 1 + self._value += 1 self._cond.notify() self._cond.release() @@ -506,7 +506,7 @@ _counter = 0 def _newname(template="Thread-%d"): global _counter - _counter = _counter + 1 + _counter += 1 return template % _counter # Active thread administration -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 01:58:10 2013 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 11 Mar 2013 01:58:10 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317385=3A_Fix_quad?= =?utf-8?q?ratic_behavior_in_threading=2ECondition?= Message-ID: <3ZPLXL0jVYzS7C@mail.python.org> http://hg.python.org/cpython/rev/0f86b51f8f8b changeset: 82592:0f86b51f8f8b user: Raymond Hettinger date: Sun Mar 10 17:57:28 2013 -0700 summary: Issue #17385: Fix quadratic behavior in threading.Condition files: Lib/threading.py | 10 ++++++++-- Misc/NEWS | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Lib/threading.py b/Lib/threading.py --- a/Lib/threading.py +++ b/Lib/threading.py @@ -10,6 +10,12 @@ from time import time as _time from traceback import format_exc as _format_exc from _weakrefset import WeakSet +try: + from _itertools import islice as _slice + from _collections import deque as _deque +except ImportError: + from itertools import islice as _islice + from collections import deque as _deque # Note regarding PEP 8 compliant names # This threading model was originally inspired by Java, and inherited @@ -146,7 +152,7 @@ self._is_owned = lock._is_owned except AttributeError: pass - self._waiters = [] + self._waiters = _deque() def __enter__(self): return self._lock.__enter__() @@ -217,7 +223,7 @@ if not self._is_owned(): raise RuntimeError("cannot notify on un-acquired lock") __waiters = self._waiters - waiters = __waiters[:n] + waiters = _deque(_islice(__waiters, n)) if not waiters: return for waiter in waiters: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -277,6 +277,9 @@ Library ------- +_ Issue #17385: Fix quadratic behavior in threading.Condition. The FIFO + queue now uses a deque instead of a list. + - Issue #14645: The email generator classes now produce output using the specified linesep throughout. Previously if the prolog, epilog, or body were stored with a different linesep, that linesep was used. This -- Repository URL: http://hg.python.org/cpython From ezio.melotti at gmail.com Mon Mar 11 02:14:37 2013 From: ezio.melotti at gmail.com (Ezio Melotti) Date: Mon, 11 Mar 2013 03:14:37 +0200 Subject: [Python-checkins] cpython: Issue #17385: Fix quadratic behavior in threading.Condition In-Reply-To: <3ZPLXL0jVYzS7C@mail.python.org> References: <3ZPLXL0jVYzS7C@mail.python.org> Message-ID: Hi, On Mon, Mar 11, 2013 at 2:58 AM, raymond.hettinger wrote: > http://hg.python.org/cpython/rev/0f86b51f8f8b > changeset: 82592:0f86b51f8f8b > user: Raymond Hettinger > date: Sun Mar 10 17:57:28 2013 -0700 > summary: > Issue #17385: Fix quadratic behavior in threading.Condition > > files: > Lib/threading.py | 10 ++++++++-- > Misc/NEWS | 3 +++ > 2 files changed, 11 insertions(+), 2 deletions(-) > > > diff --git a/Lib/threading.py b/Lib/threading.py > --- a/Lib/threading.py > +++ b/Lib/threading.py > @@ -10,6 +10,12 @@ > from time import time as _time > from traceback import format_exc as _format_exc > from _weakrefset import WeakSet > +try: > + from _itertools import islice as _slice > + from _collections import deque as _deque > +except ImportError: > + from itertools import islice as _islice > + from collections import deque as _deque > Shouldn't the one in the 'try' be _islice too? Best Regards, Ezio Melotti From python-checkins at python.org Mon Mar 11 02:21:25 2013 From: python-checkins at python.org (ezio.melotti) Date: Mon, 11 Mar 2013 02:21:25 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzExOTYzOiBmaXgg?= =?utf-8?q?Windows_buildbots=2E?= Message-ID: <3ZPM391JbSzRvs@mail.python.org> http://hg.python.org/cpython/rev/3e14aafeca04 changeset: 82593:3e14aafeca04 branch: 2.7 parent: 82590:d25749c32bb4 user: Ezio Melotti date: Mon Mar 11 03:21:08 2013 +0200 summary: #11963: fix Windows buildbots. files: Lib/test/test_subprocess.py | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -319,22 +319,22 @@ def test_stdout_filedes_of_stdout(self): # stdout is set to 1 (#1531862). - # To avoid printing the '.\n' on stdout, we do something similar to + # To avoid printing the text on stdout, we do something similar to # test_stdout_none (see above). The parent subprocess calls the child # subprocess passing stdout=1, and this test uses stdout=PIPE in # order to capture and check the output of the parent. See #11963. code = ('import sys, subprocess; ' 'rc = subprocess.call([sys.executable, "-c", ' ' "import os, sys; sys.exit(os.write(sys.stdout.fileno(), ' - '\'.\\\\n\'))"], stdout=1); ' - 'assert rc == 2') + '\'test with stdout=1\'))"], stdout=1); ' + 'assert rc == 18') p = subprocess.Popen([sys.executable, "-c", code], stdout=subprocess.PIPE, stderr=subprocess.PIPE) self.addCleanup(p.stdout.close) self.addCleanup(p.stderr.close) out, err = p.communicate() self.assertEqual(p.returncode, 0, err) - self.assertEqual(out, '.\n') + self.assertEqual(out.rstrip(), 'test with stdout=1') def test_cwd(self): tmpdir = tempfile.gettempdir() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 04:34:50 2013 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 11 Mar 2013 04:34:50 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Improve_variable_names?= Message-ID: <3ZPQ1607qjzSXm@mail.python.org> http://hg.python.org/cpython/rev/79943dee0aca changeset: 82594:79943dee0aca parent: 82592:0f86b51f8f8b user: Raymond Hettinger date: Sun Mar 10 20:34:16 2013 -0700 summary: Improve variable names files: Lib/threading.py | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/threading.py b/Lib/threading.py --- a/Lib/threading.py +++ b/Lib/threading.py @@ -222,14 +222,14 @@ def notify(self, n=1): if not self._is_owned(): raise RuntimeError("cannot notify on un-acquired lock") - __waiters = self._waiters - waiters = _deque(_islice(__waiters, n)) - if not waiters: + all_waiters = self._waiters + waiters_to_notify = _deque(_islice(all_waiters, n)) + if not waiters_to_notify: return - for waiter in waiters: + for waiter in waiters_to_notify: waiter.release() try: - __waiters.remove(waiter) + all_waiters.remove(waiter) except ValueError: pass -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 05:03:22 2013 From: python-checkins at python.org (ezio.melotti) Date: Mon, 11 Mar 2013 05:03:22 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzExOTYzOiByZW1v?= =?utf-8?q?ve_human_verification_from_test=5Fparser_and_test=5Fsubprocess?= =?utf-8?q?=2E?= Message-ID: <3ZPQf23hvjzSQK@mail.python.org> http://hg.python.org/cpython/rev/222505a5aeac changeset: 82595:222505a5aeac branch: 3.2 parent: 82579:64b87578c071 user: Ezio Melotti date: Mon Mar 11 05:53:34 2013 +0200 summary: #11963: remove human verification from test_parser and test_subprocess. files: Lib/test/test_subprocess.py | 48 ++++++++++++++++++------ Misc/NEWS | 2 + 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -157,16 +157,27 @@ self.assertEqual(p.stdin, None) def test_stdout_none(self): - # .stdout is None when not redirected - p = subprocess.Popen([sys.executable, "-c", - 'print(" this bit of output is from a ' - 'test of stdout in a different ' - 'process ...")'], - stdin=subprocess.PIPE, stderr=subprocess.PIPE) - self.addCleanup(p.stdin.close) + # .stdout is None when not redirected, and the child's stdout will + # be inherited from the parent. In order to test this we run a + # subprocess in a subprocess: + # this_test + # \-- subprocess created by this test (parent) + # \-- subprocess created by the parent subprocess (child) + # The parent doesn't specify stdout, so the child will use the + # parent's stdout. This test checks that the message printed by the + # child goes to the parent stdout. The parent also checks that the + # child's stdout is None. See #11963. + code = ('import sys; from subprocess import Popen, PIPE;' + 'p = Popen([sys.executable, "-c", "print(\'test_stdout_none\')"],' + ' stdin=PIPE, stderr=PIPE);' + 'p.wait(); assert p.stdout is None;') + p = subprocess.Popen([sys.executable, "-c", code], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) self.addCleanup(p.stderr.close) - p.wait() - self.assertEqual(p.stdout, None) + out, err = p.communicate() + self.assertEqual(p.returncode, 0, err) + self.assertEqual(out.rstrip(), b'test_stdout_none') def test_stderr_none(self): # .stderr is None when not redirected @@ -406,9 +417,22 @@ def test_stdout_filedes_of_stdout(self): # stdout is set to 1 (#1531862). - cmd = r"import sys, os; sys.exit(os.write(sys.stdout.fileno(), b'.\n'))" - rc = subprocess.call([sys.executable, "-c", cmd], stdout=1) - self.assertEqual(rc, 2) + # To avoid printing the text on stdout, we do something similar to + # test_stdout_none (see above). The parent subprocess calls the child + # subprocess passing stdout=1, and this test uses stdout=PIPE in + # order to capture and check the output of the parent. See #11963. + code = ('import sys, subprocess; ' + 'rc = subprocess.call([sys.executable, "-c", ' + ' "import os, sys; sys.exit(os.write(sys.stdout.fileno(), ' + 'b\'test with stdout=1\'))"], stdout=1); ' + 'assert rc == 18') + p = subprocess.Popen([sys.executable, "-c", code], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) + out, err = p.communicate() + self.assertEqual(p.returncode, 0, err) + self.assertEqual(out.rstrip(), b'test with stdout=1') def test_env(self): newenv = os.environ.copy() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -955,6 +955,8 @@ Tests ----- +- Issue #11963: remove human verification from test_parser and test_subprocess. + - Issue #11732: add a new suppress_crash_popup() context manager to test.support that disables crash popups on Windows and use it in test_capi. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 05:03:24 2013 From: python-checkins at python.org (ezio.melotti) Date: Mon, 11 Mar 2013 05:03:24 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2311963=3A_merge_with_3=2E2=2E?= Message-ID: <3ZPQf41s2CzScP@mail.python.org> http://hg.python.org/cpython/rev/cc08036b37a4 changeset: 82596:cc08036b37a4 branch: 3.3 parent: 82587:5eca56b68840 parent: 82595:222505a5aeac user: Ezio Melotti date: Mon Mar 11 05:59:55 2013 +0200 summary: #11963: merge with 3.2. files: Lib/test/test_subprocess.py | 48 ++++++++++++++++++------ Misc/NEWS | 2 + 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -184,16 +184,27 @@ self.assertEqual(p.stdin, None) def test_stdout_none(self): - # .stdout is None when not redirected - p = subprocess.Popen([sys.executable, "-c", - 'print(" this bit of output is from a ' - 'test of stdout in a different ' - 'process ...")'], - stdin=subprocess.PIPE, stderr=subprocess.PIPE) - self.addCleanup(p.stdin.close) + # .stdout is None when not redirected, and the child's stdout will + # be inherited from the parent. In order to test this we run a + # subprocess in a subprocess: + # this_test + # \-- subprocess created by this test (parent) + # \-- subprocess created by the parent subprocess (child) + # The parent doesn't specify stdout, so the child will use the + # parent's stdout. This test checks that the message printed by the + # child goes to the parent stdout. The parent also checks that the + # child's stdout is None. See #11963. + code = ('import sys; from subprocess import Popen, PIPE;' + 'p = Popen([sys.executable, "-c", "print(\'test_stdout_none\')"],' + ' stdin=PIPE, stderr=PIPE);' + 'p.wait(); assert p.stdout is None;') + p = subprocess.Popen([sys.executable, "-c", code], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) self.addCleanup(p.stderr.close) - p.wait() - self.assertEqual(p.stdout, None) + out, err = p.communicate() + self.assertEqual(p.returncode, 0, err) + self.assertEqual(out.rstrip(), b'test_stdout_none') def test_stderr_none(self): # .stderr is None when not redirected @@ -471,9 +482,22 @@ def test_stdout_filedes_of_stdout(self): # stdout is set to 1 (#1531862). - cmd = r"import sys, os; sys.exit(os.write(sys.stdout.fileno(), b'.\n'))" - rc = subprocess.call([sys.executable, "-c", cmd], stdout=1) - self.assertEqual(rc, 2) + # To avoid printing the text on stdout, we do something similar to + # test_stdout_none (see above). The parent subprocess calls the child + # subprocess passing stdout=1, and this test uses stdout=PIPE in + # order to capture and check the output of the parent. See #11963. + code = ('import sys, subprocess; ' + 'rc = subprocess.call([sys.executable, "-c", ' + ' "import os, sys; sys.exit(os.write(sys.stdout.fileno(), ' + 'b\'test with stdout=1\'))"], stdout=1); ' + 'assert rc == 18') + p = subprocess.Popen([sys.executable, "-c", code], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) + out, err = p.communicate() + self.assertEqual(p.returncode, 0, err) + self.assertEqual(out.rstrip(), b'test with stdout=1') def test_stdout_devnull(self): p = subprocess.Popen([sys.executable, "-c", diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -645,6 +645,8 @@ Tests ----- +- Issue #11963: remove human verification from test_parser and test_subprocess. + - Issue #11732: add a new suppress_crash_popup() context manager to test.support that disables crash popups on Windows and use it in test_faulthandler and test_capi. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 05:03:25 2013 From: python-checkins at python.org (ezio.melotti) Date: Mon, 11 Mar 2013 05:03:25 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzExOTYzOiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZPQf562ZmzScP@mail.python.org> http://hg.python.org/cpython/rev/629dba9f6746 changeset: 82597:629dba9f6746 parent: 82594:79943dee0aca parent: 82596:cc08036b37a4 user: Ezio Melotti date: Mon Mar 11 06:03:05 2013 +0200 summary: #11963: merge with 3.3. files: Lib/test/test_subprocess.py | 48 ++++++++++++++++++------ Misc/NEWS | 2 + 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -184,16 +184,27 @@ self.assertEqual(p.stdin, None) def test_stdout_none(self): - # .stdout is None when not redirected - p = subprocess.Popen([sys.executable, "-c", - 'print(" this bit of output is from a ' - 'test of stdout in a different ' - 'process ...")'], - stdin=subprocess.PIPE, stderr=subprocess.PIPE) - self.addCleanup(p.stdin.close) + # .stdout is None when not redirected, and the child's stdout will + # be inherited from the parent. In order to test this we run a + # subprocess in a subprocess: + # this_test + # \-- subprocess created by this test (parent) + # \-- subprocess created by the parent subprocess (child) + # The parent doesn't specify stdout, so the child will use the + # parent's stdout. This test checks that the message printed by the + # child goes to the parent stdout. The parent also checks that the + # child's stdout is None. See #11963. + code = ('import sys; from subprocess import Popen, PIPE;' + 'p = Popen([sys.executable, "-c", "print(\'test_stdout_none\')"],' + ' stdin=PIPE, stderr=PIPE);' + 'p.wait(); assert p.stdout is None;') + p = subprocess.Popen([sys.executable, "-c", code], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) self.addCleanup(p.stderr.close) - p.wait() - self.assertEqual(p.stdout, None) + out, err = p.communicate() + self.assertEqual(p.returncode, 0, err) + self.assertEqual(out.rstrip(), b'test_stdout_none') def test_stderr_none(self): # .stderr is None when not redirected @@ -471,9 +482,22 @@ def test_stdout_filedes_of_stdout(self): # stdout is set to 1 (#1531862). - cmd = r"import sys, os; sys.exit(os.write(sys.stdout.fileno(), b'.\n'))" - rc = subprocess.call([sys.executable, "-c", cmd], stdout=1) - self.assertEqual(rc, 2) + # To avoid printing the text on stdout, we do something similar to + # test_stdout_none (see above). The parent subprocess calls the child + # subprocess passing stdout=1, and this test uses stdout=PIPE in + # order to capture and check the output of the parent. See #11963. + code = ('import sys, subprocess; ' + 'rc = subprocess.call([sys.executable, "-c", ' + ' "import os, sys; sys.exit(os.write(sys.stdout.fileno(), ' + 'b\'test with stdout=1\'))"], stdout=1); ' + 'assert rc == 18') + p = subprocess.Popen([sys.executable, "-c", code], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) + out, err = p.communicate() + self.assertEqual(p.returncode, 0, err) + self.assertEqual(out.rstrip(), b'test with stdout=1') def test_stdout_devnull(self): p = subprocess.Popen([sys.executable, "-c", diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -905,6 +905,8 @@ Tests ----- +- Issue #11963: remove human verification from test_parser and test_subprocess. + - Issue #11732: add a new suppress_crash_popup() context manager to test.support that disables crash popups on Windows and use it in test_faulthandler and test_capi. -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Mon Mar 11 05:58:55 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 11 Mar 2013 05:58:55 +0100 Subject: [Python-checkins] Daily reference leaks (0f86b51f8f8b): sum=0 Message-ID: results for 0f86b51f8f8b on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogUoj_bc', '-x'] From python-checkins at python.org Mon Mar 11 06:27:07 2013 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 11 Mar 2013 06:27:07 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2315806=3A_Add_cont?= =?utf-8?b?ZXh0bGliLmlnbm9yZWQoKS4=?= Message-ID: <3ZPSVg1RCXzSQK@mail.python.org> http://hg.python.org/cpython/rev/406b47c64480 changeset: 82598:406b47c64480 user: Raymond Hettinger date: Sun Mar 10 22:26:51 2013 -0700 summary: Issue #15806: Add contextlib.ignored(). files: Doc/library/contextlib.rst | 20 ++++++++++++++++++++ Lib/contextlib.py | 14 +++++++++++++- Lib/test/test_contextlib.py | 22 ++++++++++++++++++++++ Misc/NEWS | 3 +++ 4 files changed, 58 insertions(+), 1 deletions(-) diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst --- a/Doc/library/contextlib.rst +++ b/Doc/library/contextlib.rst @@ -94,6 +94,26 @@ without needing to explicitly close ``page``. Even if an error occurs, ``page.close()`` will be called when the :keyword:`with` block is exited. +.. function:: ignored(*exceptions) + + Return a context manager that ignores the specified expections if they + occur in the body of a with-statement. + + For example:: + + from contextlib import ignored + + with ignored(OSError): + os.remove('somefile.tmp') + + This code is equivalent to:: + + try: + os.remove('somefile.tmp') + except OSError: + pass + + .. versionadded:: 3.4 .. class:: ContextDecorator() diff --git a/Lib/contextlib.py b/Lib/contextlib.py --- a/Lib/contextlib.py +++ b/Lib/contextlib.py @@ -4,7 +4,7 @@ from collections import deque from functools import wraps -__all__ = ["contextmanager", "closing", "ContextDecorator", "ExitStack"] +__all__ = ["contextmanager", "closing", "ContextDecorator", "ExitStack", "ignored"] class ContextDecorator(object): @@ -140,6 +140,18 @@ def __exit__(self, *exc_info): self.thing.close() + at contextmanager +def ignored(*exceptions): + """Context manager to ignore specifed exceptions + + with ignored(OSError): + os.remove(somefile) + + """ + try: + yield + except exceptions: + pass # Inspired by discussions on http://bugs.python.org/issue13585 class ExitStack(object): diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py --- a/Lib/test/test_contextlib.py +++ b/Lib/test/test_contextlib.py @@ -594,6 +594,28 @@ stack.push(cm) self.assertIs(stack._exit_callbacks[-1], cm) +class TestIgnored(unittest.TestCase): + + def test_no_exception(self): + + with ignored(ValueError): + self.assertEqual(pow(2, 5), 32) + + def test_exact_exception(self): + + with ignored(TypeError): + len(5) + + def test_multiple_exception_args(self): + + with ignored(ZeroDivisionError, TypeError): + len(5) + + def test_exception_hierarchy(self): + + with ignored(LookupError): + 'Hello'[50] + # This is needed to make the test actually run under regrtest.py! def test_main(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -280,6 +280,9 @@ _ Issue #17385: Fix quadratic behavior in threading.Condition. The FIFO queue now uses a deque instead of a list. +- Issue #15806: Add contextlib.ignored(). This creates a context manager + to ignore specified exceptions, replacing the "except Exc: pass" idiom. + - Issue #14645: The email generator classes now produce output using the specified linesep throughout. Previously if the prolog, epilog, or body were stored with a different linesep, that linesep was used. This -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 07:57:33 2013 From: python-checkins at python.org (ezio.melotti) Date: Mon, 11 Mar 2013 07:57:33 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Remove_debug_print=2E?= Message-ID: <3ZPVW12nMNzS7h@mail.python.org> http://hg.python.org/cpython/rev/2dc08789ad3e changeset: 82599:2dc08789ad3e user: Ezio Melotti date: Mon Mar 11 08:57:17 2013 +0200 summary: Remove debug print. files: Lib/test/test_multiprocessing.py | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -1748,7 +1748,6 @@ with multiprocessing.Pool(2) as p: r = p.map_async(sqr, L) self.assertEqual(r.get(), expected) - print(p._state) self.assertRaises(ValueError, p.map_async, sqr, L) def raising(): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 08:14:24 2013 From: python-checkins at python.org (ezio.melotti) Date: Mon, 11 Mar 2013 08:14:24 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzE2MDA0OiBBZGQg?= =?utf-8?q?=60make_touch=60=2E?= Message-ID: <3ZPVtS3mkkzSHQ@mail.python.org> http://hg.python.org/cpython/rev/da3f4774b939 changeset: 82600:da3f4774b939 branch: 2.7 parent: 82593:3e14aafeca04 user: Ezio Melotti date: Mon Mar 11 09:14:09 2013 +0200 summary: #16004: Add `make touch`. files: Makefile.pre.in | 6 +++++- Misc/NEWS | 2 ++ 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1250,6 +1250,10 @@ etags Include/*.h; \ for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done +# Touch generated files +touch: + touch Include/Python-ast.h Python/Python-ast.c + # Sanitation targets -- clean leaves libraries, executables and tags # files, which clobber removes as well pycremoval: @@ -1339,7 +1343,7 @@ .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean -.PHONY: smelly funny patchcheck altmaninstall +.PHONY: smelly funny patchcheck touch altmaninstall .PHONY: gdbhooks # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -874,6 +874,8 @@ Build ----- +- Issue #16004: Add `make touch`. + - Issue #5033: Fix building of the sqlite3 extension module when the SQLite library version has "beta" in it. Patch by Andreas Pelme. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 08:43:41 2013 From: python-checkins at python.org (ezio.melotti) Date: Mon, 11 Mar 2013 08:43:41 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3MzUxOiByZW1v?= =?utf-8?q?ve_=22object=22_inheritance_from_docs=2E__Patch_by_Phil_Elson?= =?utf-8?q?=2E?= Message-ID: <3ZPWXF6ZBgzRpR@mail.python.org> http://hg.python.org/cpython/rev/4f745f7d6fca changeset: 82601:4f745f7d6fca branch: 3.2 parent: 82595:222505a5aeac user: Ezio Melotti date: Mon Mar 11 09:30:21 2013 +0200 summary: #17351: remove "object" inheritance from docs. Patch by Phil Elson. files: Doc/howto/descriptor.rst | 6 +++--- Doc/howto/logging-cookbook.rst | 6 +++--- Doc/howto/sorting.rst | 2 +- Doc/library/functions.rst | 2 +- Misc/ACKS | 1 + 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst --- a/Doc/howto/descriptor.rst +++ b/Doc/howto/descriptor.rst @@ -224,17 +224,17 @@ if obj is None: return self if self.fget is None: - raise AttributeError, "unreadable attribute" + raise AttributeError("unreadable attribute") return self.fget(obj) def __set__(self, obj, value): if self.fset is None: - raise AttributeError, "can't set attribute" + raise AttributeError("can't set attribute") self.fset(obj, value) def __delete__(self, obj): if self.fdel is None: - raise AttributeError, "can't delete attribute" + raise AttributeError("can't delete attribute") self.fdel(obj) The :func:`property` builtin helps whenever a user interface has granted diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1036,7 +1036,7 @@ call ``str()`` on that object to get the actual format string. Consider the following two classes:: - class BraceMessage(object): + class BraceMessage: def __init__(self, fmt, *args, **kwargs): self.fmt = fmt self.args = args @@ -1045,7 +1045,7 @@ def __str__(self): return self.fmt.format(*self.args, **self.kwargs) - class DollarMessage(object): + class DollarMessage: def __init__(self, fmt, **kwargs): self.fmt = fmt self.kwargs = kwargs @@ -1345,7 +1345,7 @@ import random import time - class MyHandler(object): + class MyHandler: """ A simple handler for logging events. It runs in the listener process and dispatches events to loggers based on the name in the received record, diff --git a/Doc/howto/sorting.rst b/Doc/howto/sorting.rst --- a/Doc/howto/sorting.rst +++ b/Doc/howto/sorting.rst @@ -225,7 +225,7 @@ def cmp_to_key(mycmp): 'Convert a cmp= function into a key= function' - class K(object): + class K: def __init__(self, obj, *args): self.obj = obj def __lt__(self, other): diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -317,7 +317,7 @@ ['Struct', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_clearcache', 'calcsize', 'error', 'pack', 'pack_into', 'unpack', 'unpack_from'] - >>> class Shape(object): + >>> class Shape: def __dir__(self): return ['area', 'perimeter', 'location'] >>> s = Shape() diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -303,6 +303,7 @@ Andrew Eland Julien ?lie Lance Ellinghaus +Phil Elson David Ely Jeff Epler Tom Epperly -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 08:43:43 2013 From: python-checkins at python.org (ezio.melotti) Date: Mon, 11 Mar 2013 08:43:43 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2317351=3A_merge_with_3=2E2=2E?= Message-ID: <3ZPWXH3kJVzS2h@mail.python.org> http://hg.python.org/cpython/rev/8b1d3fa3b389 changeset: 82602:8b1d3fa3b389 branch: 3.3 parent: 82596:cc08036b37a4 parent: 82601:4f745f7d6fca user: Ezio Melotti date: Mon Mar 11 09:42:40 2013 +0200 summary: #17351: merge with 3.2. files: Doc/howto/logging-cookbook.rst | 6 ++-- Doc/howto/sorting.rst | 2 +- Doc/library/contextlib.rst | 2 +- Doc/library/functions.rst | 2 +- Doc/library/unittest.mock-examples.rst | 16 +++++++------- Doc/library/unittest.mock.rst | 16 +++++++------- Misc/ACKS | 1 + 7 files changed, 23 insertions(+), 22 deletions(-) diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1036,7 +1036,7 @@ call ``str()`` on that object to get the actual format string. Consider the following two classes:: - class BraceMessage(object): + class BraceMessage: def __init__(self, fmt, *args, **kwargs): self.fmt = fmt self.args = args @@ -1045,7 +1045,7 @@ def __str__(self): return self.fmt.format(*self.args, **self.kwargs) - class DollarMessage(object): + class DollarMessage: def __init__(self, fmt, **kwargs): self.fmt = fmt self.kwargs = kwargs @@ -1372,7 +1372,7 @@ import random import time - class MyHandler(object): + class MyHandler: """ A simple handler for logging events. It runs in the listener process and dispatches events to loggers based on the name in the received record, diff --git a/Doc/howto/sorting.rst b/Doc/howto/sorting.rst --- a/Doc/howto/sorting.rst +++ b/Doc/howto/sorting.rst @@ -225,7 +225,7 @@ def cmp_to_key(mycmp): 'Convert a cmp= function into a key= function' - class K(object): + class K: def __init__(self, obj, *args): self.obj = obj def __lt__(self, other): diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst --- a/Doc/library/contextlib.rst +++ b/Doc/library/contextlib.rst @@ -361,7 +361,7 @@ from contextlib import contextmanager, ExitStack - class ResourceManager(object): + class ResourceManager: def __init__(self, acquire_resource, release_resource, check_resource_ok=None): self.acquire_resource = acquire_resource diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -324,7 +324,7 @@ '__initializing__', '__loader__', '__name__', '__package__', '_clearcache', 'calcsize', 'error', 'pack', 'pack_into', 'unpack', 'unpack_from'] - >>> class Shape(object): + >>> class Shape: ... def __dir__(self): ... return ['area', 'perimeter', 'location'] >>> s = Shape() diff --git a/Doc/library/unittest.mock-examples.rst b/Doc/library/unittest.mock-examples.rst --- a/Doc/library/unittest.mock-examples.rst +++ b/Doc/library/unittest.mock-examples.rst @@ -45,7 +45,7 @@ This example tests that calling `ProductionClass().method` results in a call to the `something` method: - >>> class ProductionClass(object): + >>> class ProductionClass: ... def method(self): ... self.something(1, 2, 3) ... def something(self, a, b, c): @@ -69,7 +69,7 @@ The simple `ProductionClass` below has a `closer` method. If it is called with an object then it calls `close` on it. - >>> class ProductionClass(object): + >>> class ProductionClass: ... def closer(self, something): ... something.close() ... @@ -398,7 +398,7 @@ Where you use `patch` to create a mock for you, you can get a reference to the mock using the "as" form of the with statement: - >>> class ProductionClass(object): + >>> class ProductionClass: ... def method(self): ... pass ... @@ -446,7 +446,7 @@ So, suppose we have some code that looks a little bit like this: - >>> class Something(object): + >>> class Something: ... def __init__(self): ... self.backend = BackendProvider() ... def method(self): @@ -554,7 +554,7 @@ Here's an example class with an "iter" method implemented as a generator: - >>> class Foo(object): + >>> class Foo: ... def iter(self): ... for i in [1, 2, 3]: ... yield i @@ -664,7 +664,7 @@ It will have `self` passed in as the first argument, which is exactly what I wanted: - >>> class Foo(object): + >>> class Foo: ... def foo(self): ... pass ... @@ -1183,7 +1183,7 @@ You can see in this example how a 'standard' call to `assert_called_with` isn't sufficient: - >>> class Foo(object): + >>> class Foo: ... def __init__(self, a, b): ... self.a, self.b = a, b ... @@ -1210,7 +1210,7 @@ And a matcher object that can use comparison functions like this for its equality operation would look something like this: - >>> class Matcher(object): + >>> class Matcher: ... def __init__(self, compare, some_obj): ... self.compare = compare ... self.some_obj = some_obj diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -695,7 +695,7 @@ Fetching a `PropertyMock` instance from an object calls the mock, with no args. Setting it calls the mock with the value being set. - >>> class Foo(object): + >>> class Foo: ... @property ... def foo(self): ... return 'something' @@ -1031,7 +1031,7 @@ To configure return values on methods of *instances* on the patched class you must do this on the `return_value`. For example: - >>> class Class(object): + >>> class Class: ... def method(self): ... pass ... @@ -1204,7 +1204,7 @@ magic methods `__getitem__`, `__setitem__`, `__delitem__` and either `__iter__` or `__contains__`. - >>> class Container(object): + >>> class Container: ... def __init__(self): ... self.values = {} ... def __getitem__(self, name): @@ -1378,7 +1378,7 @@ >>> value = 3 >>> >>> @patch('__main__.value', 'not three') - ... class Thing(object): + ... class Thing: ... def foo_one(self): ... print value ... def foo_two(self): @@ -2137,7 +2137,7 @@ `autospec` can't know about any dynamically created attributes and restricts the api to visible attributes. - >>> class Something(object): + >>> class Something: ... def __init__(self): ... self.a = 33 ... @@ -2180,7 +2180,7 @@ .. code-block:: python - class Something(object): + class Something: a = 33 This brings up another issue. It is relatively common to provide a default @@ -2191,7 +2191,7 @@ `autospec` doesn't use a spec for members that are set to `None`. These will just be ordinary mocks (well - `MagicMocks`): - >>> class Something(object): + >>> class Something: ... member = None ... >>> mock = create_autospec(Something) @@ -2206,7 +2206,7 @@ the spec. Thankfully `patch` supports this - you can simply pass the alternative object as the `autospec` argument: - >>> class Something(object): + >>> class Something: ... def __init__(self): ... self.a = 33 ... diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -331,6 +331,7 @@ Julien ?lie Lance Ellinghaus Daniel Ellis +Phil Elson David Ely Jeff Epler Jeff McNeil -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 08:43:45 2013 From: python-checkins at python.org (ezio.melotti) Date: Mon, 11 Mar 2013 08:43:45 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3MzUxOiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZPWXK0zQ1zSj5@mail.python.org> http://hg.python.org/cpython/rev/b10a9d4f08eb changeset: 82603:b10a9d4f08eb parent: 82599:2dc08789ad3e parent: 82602:8b1d3fa3b389 user: Ezio Melotti date: Mon Mar 11 09:43:25 2013 +0200 summary: #17351: merge with 3.3. files: Doc/howto/logging-cookbook.rst | 6 ++-- Doc/howto/sorting.rst | 2 +- Doc/library/contextlib.rst | 2 +- Doc/library/functions.rst | 2 +- Doc/library/unittest.mock-examples.rst | 16 +++++++------- Doc/library/unittest.mock.rst | 16 +++++++------- Misc/ACKS | 1 + 7 files changed, 23 insertions(+), 22 deletions(-) diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1034,7 +1034,7 @@ call ``str()`` on that object to get the actual format string. Consider the following two classes:: - class BraceMessage(object): + class BraceMessage: def __init__(self, fmt, *args, **kwargs): self.fmt = fmt self.args = args @@ -1043,7 +1043,7 @@ def __str__(self): return self.fmt.format(*self.args, **self.kwargs) - class DollarMessage(object): + class DollarMessage: def __init__(self, fmt, **kwargs): self.fmt = fmt self.kwargs = kwargs @@ -1370,7 +1370,7 @@ import random import time - class MyHandler(object): + class MyHandler: """ A simple handler for logging events. It runs in the listener process and dispatches events to loggers based on the name in the received record, diff --git a/Doc/howto/sorting.rst b/Doc/howto/sorting.rst --- a/Doc/howto/sorting.rst +++ b/Doc/howto/sorting.rst @@ -225,7 +225,7 @@ def cmp_to_key(mycmp): 'Convert a cmp= function into a key= function' - class K(object): + class K: def __init__(self, obj, *args): self.obj = obj def __lt__(self, other): diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst --- a/Doc/library/contextlib.rst +++ b/Doc/library/contextlib.rst @@ -381,7 +381,7 @@ from contextlib import contextmanager, ExitStack - class ResourceManager(object): + class ResourceManager: def __init__(self, acquire_resource, release_resource, check_resource_ok=None): self.acquire_resource = acquire_resource diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -324,7 +324,7 @@ '__initializing__', '__loader__', '__name__', '__package__', '_clearcache', 'calcsize', 'error', 'pack', 'pack_into', 'unpack', 'unpack_from'] - >>> class Shape(object): + >>> class Shape: ... def __dir__(self): ... return ['area', 'perimeter', 'location'] >>> s = Shape() diff --git a/Doc/library/unittest.mock-examples.rst b/Doc/library/unittest.mock-examples.rst --- a/Doc/library/unittest.mock-examples.rst +++ b/Doc/library/unittest.mock-examples.rst @@ -45,7 +45,7 @@ This example tests that calling `ProductionClass().method` results in a call to the `something` method: - >>> class ProductionClass(object): + >>> class ProductionClass: ... def method(self): ... self.something(1, 2, 3) ... def something(self, a, b, c): @@ -69,7 +69,7 @@ The simple `ProductionClass` below has a `closer` method. If it is called with an object then it calls `close` on it. - >>> class ProductionClass(object): + >>> class ProductionClass: ... def closer(self, something): ... something.close() ... @@ -412,7 +412,7 @@ Where you use `patch` to create a mock for you, you can get a reference to the mock using the "as" form of the with statement: - >>> class ProductionClass(object): + >>> class ProductionClass: ... def method(self): ... pass ... @@ -460,7 +460,7 @@ So, suppose we have some code that looks a little bit like this: - >>> class Something(object): + >>> class Something: ... def __init__(self): ... self.backend = BackendProvider() ... def method(self): @@ -568,7 +568,7 @@ Here's an example class with an "iter" method implemented as a generator: - >>> class Foo(object): + >>> class Foo: ... def iter(self): ... for i in [1, 2, 3]: ... yield i @@ -678,7 +678,7 @@ It will have `self` passed in as the first argument, which is exactly what I wanted: - >>> class Foo(object): + >>> class Foo: ... def foo(self): ... pass ... @@ -1197,7 +1197,7 @@ You can see in this example how a 'standard' call to `assert_called_with` isn't sufficient: - >>> class Foo(object): + >>> class Foo: ... def __init__(self, a, b): ... self.a, self.b = a, b ... @@ -1224,7 +1224,7 @@ And a matcher object that can use comparison functions like this for its equality operation would look something like this: - >>> class Matcher(object): + >>> class Matcher: ... def __init__(self, compare, some_obj): ... self.compare = compare ... self.some_obj = some_obj diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -715,7 +715,7 @@ Fetching a `PropertyMock` instance from an object calls the mock, with no args. Setting it calls the mock with the value being set. - >>> class Foo(object): + >>> class Foo: ... @property ... def foo(self): ... return 'something' @@ -1051,7 +1051,7 @@ To configure return values on methods of *instances* on the patched class you must do this on the `return_value`. For example: - >>> class Class(object): + >>> class Class: ... def method(self): ... pass ... @@ -1224,7 +1224,7 @@ magic methods `__getitem__`, `__setitem__`, `__delitem__` and either `__iter__` or `__contains__`. - >>> class Container(object): + >>> class Container: ... def __init__(self): ... self.values = {} ... def __getitem__(self, name): @@ -1398,7 +1398,7 @@ >>> value = 3 >>> >>> @patch('__main__.value', 'not three') - ... class Thing(object): + ... class Thing: ... def foo_one(self): ... print value ... def foo_two(self): @@ -2157,7 +2157,7 @@ `autospec` can't know about any dynamically created attributes and restricts the api to visible attributes. - >>> class Something(object): + >>> class Something: ... def __init__(self): ... self.a = 33 ... @@ -2200,7 +2200,7 @@ .. code-block:: python - class Something(object): + class Something: a = 33 This brings up another issue. It is relatively common to provide a default @@ -2211,7 +2211,7 @@ `autospec` doesn't use a spec for members that are set to `None`. These will just be ordinary mocks (well - `MagicMocks`): - >>> class Something(object): + >>> class Something: ... member = None ... >>> mock = create_autospec(Something) @@ -2226,7 +2226,7 @@ the spec. Thankfully `patch` supports this - you can simply pass the alternative object as the `autospec` argument: - >>> class Something(object): + >>> class Something: ... def __init__(self): ... self.a = 33 ... diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -334,6 +334,7 @@ Julien ?lie Lance Ellinghaus Daniel Ellis +Phil Elson David Ely Jeff Epler Jeff McNeil -- Repository URL: http://hg.python.org/cpython From brett at python.org Mon Mar 11 14:22:38 2013 From: brett at python.org (Brett Cannon) Date: Mon, 11 Mar 2013 09:22:38 -0400 Subject: [Python-checkins] cpython (2.7): #16004: Add `make touch`. In-Reply-To: <3ZPVtS3mkkzSHQ@mail.python.org> References: <3ZPVtS3mkkzSHQ@mail.python.org> Message-ID: Should this also touch Python/importlib.h? On Mon, Mar 11, 2013 at 3:14 AM, ezio.melotti wrote: > http://hg.python.org/cpython/rev/da3f4774b939 > changeset: 82600:da3f4774b939 > branch: 2.7 > parent: 82593:3e14aafeca04 > user: Ezio Melotti > date: Mon Mar 11 09:14:09 2013 +0200 > summary: > #16004: Add `make touch`. > > files: > Makefile.pre.in | 6 +++++- > Misc/NEWS | 2 ++ > 2 files changed, 7 insertions(+), 1 deletions(-) > > > diff --git a/Makefile.pre.in b/Makefile.pre.in > --- a/Makefile.pre.in > +++ b/Makefile.pre.in > @@ -1250,6 +1250,10 @@ > etags Include/*.h; \ > for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done > > +# Touch generated files > +touch: > + touch Include/Python-ast.h Python/Python-ast.c > + > # Sanitation targets -- clean leaves libraries, executables and tags > # files, which clobber removes as well > pycremoval: > @@ -1339,7 +1343,7 @@ > .PHONY: frameworkinstall frameworkinstallframework > frameworkinstallstructure > .PHONY: frameworkinstallmaclib frameworkinstallapps > frameworkinstallunixtools > .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber > distclean > -.PHONY: smelly funny patchcheck altmaninstall > +.PHONY: smelly funny patchcheck touch altmaninstall > .PHONY: gdbhooks > > # IF YOU PUT ANYTHING HERE IT WILL GO AWAY > diff --git a/Misc/NEWS b/Misc/NEWS > --- a/Misc/NEWS > +++ b/Misc/NEWS > @@ -874,6 +874,8 @@ > Build > ----- > > +- Issue #16004: Add `make touch`. > + > - Issue #5033: Fix building of the sqlite3 extension module when the > SQLite library version has "beta" in it. Patch by Andreas Pelme. > > > -- > Repository URL: http://hg.python.org/cpython > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brett at python.org Mon Mar 11 14:23:07 2013 From: brett at python.org (Brett Cannon) Date: Mon, 11 Mar 2013 09:23:07 -0400 Subject: [Python-checkins] cpython (2.7): #16004: Add `make touch`. In-Reply-To: References: <3ZPVtS3mkkzSHQ@mail.python.org> Message-ID: On Mon, Mar 11, 2013 at 9:22 AM, Brett Cannon wrote: > Should this also touch Python/importlib.h? > > nm, noticed this was added on 2.7 and not default. > > On Mon, Mar 11, 2013 at 3:14 AM, ezio.melotti wrote: > >> http://hg.python.org/cpython/rev/da3f4774b939 >> changeset: 82600:da3f4774b939 >> branch: 2.7 >> parent: 82593:3e14aafeca04 >> user: Ezio Melotti >> date: Mon Mar 11 09:14:09 2013 +0200 >> summary: >> #16004: Add `make touch`. >> >> files: >> Makefile.pre.in | 6 +++++- >> Misc/NEWS | 2 ++ >> 2 files changed, 7 insertions(+), 1 deletions(-) >> >> >> diff --git a/Makefile.pre.in b/Makefile.pre.in >> --- a/Makefile.pre.in >> +++ b/Makefile.pre.in >> @@ -1250,6 +1250,10 @@ >> etags Include/*.h; \ >> for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done >> >> +# Touch generated files >> +touch: >> + touch Include/Python-ast.h Python/Python-ast.c >> + >> # Sanitation targets -- clean leaves libraries, executables and tags >> # files, which clobber removes as well >> pycremoval: >> @@ -1339,7 +1343,7 @@ >> .PHONY: frameworkinstall frameworkinstallframework >> frameworkinstallstructure >> .PHONY: frameworkinstallmaclib frameworkinstallapps >> frameworkinstallunixtools >> .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber >> distclean >> -.PHONY: smelly funny patchcheck altmaninstall >> +.PHONY: smelly funny patchcheck touch altmaninstall >> .PHONY: gdbhooks >> >> # IF YOU PUT ANYTHING HERE IT WILL GO AWAY >> diff --git a/Misc/NEWS b/Misc/NEWS >> --- a/Misc/NEWS >> +++ b/Misc/NEWS >> @@ -874,6 +874,8 @@ >> Build >> ----- >> >> +- Issue #16004: Add `make touch`. >> + >> - Issue #5033: Fix building of the sqlite3 extension module when the >> SQLite library version has "beta" in it. Patch by Andreas Pelme. >> >> >> -- >> Repository URL: http://hg.python.org/cpython >> >> _______________________________________________ >> Python-checkins mailing list >> Python-checkins at python.org >> http://mail.python.org/mailman/listinfo/python-checkins >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From python-checkins at python.org Mon Mar 11 17:31:49 2013 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 11 Mar 2013 17:31:49 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_remove_useless_words_=28?= =?utf-8?q?=2317327=29?= Message-ID: <3ZPlFd0G97zQcx@mail.python.org> http://hg.python.org/cpython/rev/89174df2ee45 changeset: 82604:89174df2ee45 user: Benjamin Peterson date: Mon Mar 11 11:31:29 2013 -0500 summary: remove useless words (#17327) files: Doc/c-api/dict.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -114,9 +114,9 @@ This is the same as the Python-level :meth:`dict.setdefault`. If present, it returns the value corresponding to *key* from the dictionary *p*. If the key - is not in the dict, it is inserted with value *defaultobj* and *defaultobj* - is inserted. This function evaluates the hash function of *key* only once, - instead of evaluating it independently for the lookup and the insertion. + is not in the dict, it is inserted with value *defaultobj* and *defaultobj*. + This function evaluates the hash function of *key* only once, instead of + evaluating it independently for the lookup and the insertion. .. c:function:: PyObject* PyDict_Items(PyObject *p) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 17:36:07 2013 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 11 Mar 2013 17:36:07 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_remove_more_useless_words?= Message-ID: <3ZPlLb0w3VzQwB@mail.python.org> http://hg.python.org/cpython/rev/606bc9d21337 changeset: 82605:606bc9d21337 user: Benjamin Peterson date: Mon Mar 11 11:35:47 2013 -0500 summary: remove more useless words files: Doc/c-api/dict.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -114,9 +114,9 @@ This is the same as the Python-level :meth:`dict.setdefault`. If present, it returns the value corresponding to *key* from the dictionary *p*. If the key - is not in the dict, it is inserted with value *defaultobj* and *defaultobj*. - This function evaluates the hash function of *key* only once, instead of - evaluating it independently for the lookup and the insertion. + is not in the dict, it is inserted with value *defaultobj*. This function + evaluates the hash function of *key* only once, instead of evaluating it + independently for the lookup and the insertion. .. c:function:: PyObject* PyDict_Items(PyObject *p) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 17:50:35 2013 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 11 Mar 2013 17:50:35 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_say_defaultobj_is_returned?= =?utf-8?b?ICgjMTczMjcp?= Message-ID: <3ZPlgH5VJvzQd9@mail.python.org> http://hg.python.org/cpython/rev/8948dd77b095 changeset: 82606:8948dd77b095 user: Benjamin Peterson date: Mon Mar 11 11:50:21 2013 -0500 summary: say defaultobj is returned (#17327) files: Doc/c-api/dict.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -114,9 +114,9 @@ This is the same as the Python-level :meth:`dict.setdefault`. If present, it returns the value corresponding to *key* from the dictionary *p*. If the key - is not in the dict, it is inserted with value *defaultobj*. This function - evaluates the hash function of *key* only once, instead of evaluating it - independently for the lookup and the insertion. + is not in the dict, it is inserted with value *defaultobj* and *defautobj* is + returned. This function evaluates the hash function of *key* only once, + instead of evaluating it independently for the lookup and the insertion. .. c:function:: PyObject* PyDict_Items(PyObject *p) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 18:17:32 2013 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 11 Mar 2013 18:17:32 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_fix_spelling_=28=2317327?= =?utf-8?q?=29?= Message-ID: <3ZPmGN4FFFzR08@mail.python.org> http://hg.python.org/cpython/rev/f6f39ebd3121 changeset: 82607:f6f39ebd3121 user: Benjamin Peterson date: Mon Mar 11 12:17:19 2013 -0500 summary: fix spelling (#17327) files: Doc/c-api/dict.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -114,8 +114,8 @@ This is the same as the Python-level :meth:`dict.setdefault`. If present, it returns the value corresponding to *key* from the dictionary *p*. If the key - is not in the dict, it is inserted with value *defaultobj* and *defautobj* is - returned. This function evaluates the hash function of *key* only once, + is not in the dict, it is inserted with value *defaultobj* and *defaultobj* + is returned. This function evaluates the hash function of *key* only once, instead of evaluating it independently for the lookup and the insertion. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 20:39:35 2013 From: python-checkins at python.org (ezio.melotti) Date: Mon, 11 Mar 2013 20:39:35 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=2317395=3A_wait_for_live_?= =?utf-8?q?children_in_test=5Fmultiprocessing=2E?= Message-ID: <3ZPqQH21bFzQyS@mail.python.org> http://hg.python.org/cpython/rev/2966e5a55396 changeset: 82608:2966e5a55396 user: Ezio Melotti date: Mon Mar 11 21:39:18 2013 +0200 summary: #17395: wait for live children in test_multiprocessing. files: Lib/test/test_multiprocessing.py | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -2998,7 +2998,13 @@ @classmethod def tearDownClass(cls): - multiprocessing.active_children() # discard dead process objs + # only the manager process should be returned by active_children() + # but this can take a bit on slow machines, so wait a few seconds + # if there are other children too (see #17395) + t = 0.01 + while len(multiprocessing.active_children()) > 1 and t < 5: + time.sleep(t) + t *= 2 gc.collect() # do garbage collection if cls.manager._number_of_objects() != 0: # This is not really an error since some tests do not -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 22:29:05 2013 From: python-checkins at python.org (terry.reedy) Date: Mon, 11 Mar 2013 22:29:05 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3MDQ3?= =?utf-8?q?=3A_removed_doubled_words_in_Doc/*=2C_Mac/*=2C_and_Tool/*?= Message-ID: <3ZPsrd07fxzQwH@mail.python.org> http://hg.python.org/cpython/rev/1ecb712fcf22 changeset: 82609:1ecb712fcf22 branch: 2.7 parent: 82600:da3f4774b939 user: Terry Jan Reedy date: Mon Mar 11 17:09:58 2013 -0400 summary: Issue #17047: removed doubled words in Doc/*, Mac/*, and Tool/* found by Serhiy Storchaka and Matthew Barnett files: Doc/c-api/intro.rst | 2 +- Doc/library/xml.dom.rst | 2 +- Mac/README | 2 +- Tools/msi/msilib.py | 2 +- Tools/pybench/README | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -424,7 +424,7 @@ .. index:: single: sum_sequence() A simple example of detecting exceptions and passing them on is shown in the -:c:func:`sum_sequence` example above. It so happens that that example doesn't +:c:func:`sum_sequence` example above. It so happens that this example doesn't need to clean up any owned references when it detects an error. The following example function shows some error cleanup. First, to remind you why you like Python, we show the equivalent Python code:: diff --git a/Doc/library/xml.dom.rst b/Doc/library/xml.dom.rst --- a/Doc/library/xml.dom.rst +++ b/Doc/library/xml.dom.rst @@ -374,7 +374,7 @@ Add a new child node to this node at the end of the list of children, returning *newChild*. If the node was already in - in the tree, it is removed first. + the tree, it is removed first. .. method:: Node.insertBefore(newChild, refChild) diff --git a/Mac/README b/Mac/README --- a/Mac/README +++ b/Mac/README @@ -33,7 +33,7 @@ * ``--enable-universalsdk[=PATH]`` - Create a universal binary build of of Python. This can be used with both + Create a universal binary build of Python. This can be used with both regular and framework builds. The optional argument specifies which OSX SDK should be used to perform the diff --git a/Tools/msi/msilib.py b/Tools/msi/msilib.py --- a/Tools/msi/msilib.py +++ b/Tools/msi/msilib.py @@ -516,7 +516,7 @@ def add_file(self, file, src=None, version=None, language=None): """Add a file to the current component of the directory, starting a new one - one if there is no current component. By default, the file name in the source + if there is no current component. By default, the file name in the source and the file table will be identical. If the src file is specified, it is interpreted relative to the current directory. Optionally, a version and a language can be specified for the entry in the File table.""" diff --git a/Tools/pybench/README b/Tools/pybench/README --- a/Tools/pybench/README +++ b/Tools/pybench/README @@ -3,7 +3,7 @@ PYBENCH - A Python Benchmark Suite ________________________________________________________________________ - Extendable suite of of low-level benchmarks for measuring + Extendable suite of low-level benchmarks for measuring the performance of the Python implementation (interpreter, compiler or VM). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 22:29:06 2013 From: python-checkins at python.org (terry.reedy) Date: Mon, 11 Mar 2013 22:29:06 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3MDQ3?= =?utf-8?q?=3A_removed_doubled_words_in_Doc/*=2C_Mac/*=2C_and_Tool/*?= Message-ID: <3ZPsrf4KCXzQwH@mail.python.org> http://hg.python.org/cpython/rev/e37647470fcf changeset: 82610:e37647470fcf branch: 3.2 parent: 82601:4f745f7d6fca user: Terry Jan Reedy date: Mon Mar 11 17:23:46 2013 -0400 summary: Issue #17047: removed doubled words in Doc/*, Mac/*, and Tool/* found by Serhiy Storchaka and Matthew Barnett files: Doc/c-api/intro.rst | 2 +- Doc/c-api/long.rst | 4 ++-- Doc/library/xml.dom.rst | 2 +- Mac/README | 2 +- Tools/msi/msilib.py | 2 +- Tools/pybench/README | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -433,7 +433,7 @@ .. index:: single: sum_sequence() A simple example of detecting exceptions and passing them on is shown in the -:c:func:`sum_sequence` example above. It so happens that that example doesn't +:c:func:`sum_sequence` example above. It so happens that this example doesn't need to clean up any owned references when it detects an error. The following example function shows some error cleanup. First, to remind you why you like Python, we show the equivalent Python code:: diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -189,7 +189,7 @@ .. c:function:: size_t PyLong_AsSize_t(PyObject *pylong) - Return a C :c:type:`size_t` representation of of *pylong*. *pylong* must be + Return a C :c:type:`size_t` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`. Raise :exc:`OverflowError` if the value of *pylong* is out of range for a @@ -201,7 +201,7 @@ .. index:: single: OverflowError (built-in exception) - Return a C :c:type:`unsigned PY_LONG_LONG` representation of of *pylong*. + Return a C :c:type:`unsigned PY_LONG_LONG` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`. Raise :exc:`OverflowError` if the value of *pylong* is out of range for an diff --git a/Doc/library/xml.dom.rst b/Doc/library/xml.dom.rst --- a/Doc/library/xml.dom.rst +++ b/Doc/library/xml.dom.rst @@ -357,7 +357,7 @@ Add a new child node to this node at the end of the list of children, returning *newChild*. If the node was already in - in the tree, it is removed first. + the tree, it is removed first. .. method:: Node.insertBefore(newChild, refChild) diff --git a/Mac/README b/Mac/README --- a/Mac/README +++ b/Mac/README @@ -30,7 +30,7 @@ * ``--enable-universalsdk[=PATH]`` - Create a universal binary build of of Python. This can be used with both + Create a universal binary build of Python. This can be used with both regular and framework builds. The optional argument specifies which OSX SDK should be used to perform the diff --git a/Tools/msi/msilib.py b/Tools/msi/msilib.py --- a/Tools/msi/msilib.py +++ b/Tools/msi/msilib.py @@ -489,7 +489,7 @@ def add_file(self, file, src=None, version=None, language=None): """Add a file to the current component of the directory, starting a new one - one if there is no current component. By default, the file name in the source + if there is no current component. By default, the file name in the source and the file table will be identical. If the src file is specified, it is interpreted relative to the current directory. Optionally, a version and a language can be specified for the entry in the File table.""" diff --git a/Tools/pybench/README b/Tools/pybench/README --- a/Tools/pybench/README +++ b/Tools/pybench/README @@ -3,7 +3,7 @@ PYBENCH - A Python Benchmark Suite ________________________________________________________________________ - Extendable suite of of low-level benchmarks for measuring + Extendable suite of low-level benchmarks for measuring the performance of the Python implementation (interpreter, compiler or VM). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 22:29:08 2013 From: python-checkins at python.org (terry.reedy) Date: Mon, 11 Mar 2013 22:29:08 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_with_3=2E2=3A_Issue_=2317047=3A_removed_doubled_words_in?= =?utf-8?q?_Doc/*=2C?= Message-ID: <3ZPsrh153fzQwH@mail.python.org> http://hg.python.org/cpython/rev/629322a13b53 changeset: 82611:629322a13b53 branch: 3.3 parent: 82602:8b1d3fa3b389 parent: 82610:e37647470fcf user: Terry Jan Reedy date: Mon Mar 11 17:26:33 2013 -0400 summary: Merge with 3.2: Issue #17047: removed doubled words in Doc/*, Mac/*, and Tool/* found by Serhiy Storchaka and Matthew Barnett files: Doc/c-api/intro.rst | 2 +- Doc/c-api/long.rst | 4 ++-- Doc/library/xml.dom.rst | 2 +- Mac/README | 2 +- Tools/msi/msilib.py | 2 +- Tools/pybench/README | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -433,7 +433,7 @@ .. index:: single: sum_sequence() A simple example of detecting exceptions and passing them on is shown in the -:c:func:`sum_sequence` example above. It so happens that that example doesn't +:c:func:`sum_sequence` example above. It so happens that this example doesn't need to clean up any owned references when it detects an error. The following example function shows some error cleanup. First, to remind you why you like Python, we show the equivalent Python code:: diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -203,7 +203,7 @@ .. c:function:: size_t PyLong_AsSize_t(PyObject *pylong) - Return a C :c:type:`size_t` representation of of *pylong*. *pylong* must be + Return a C :c:type:`size_t` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`. Raise :exc:`OverflowError` if the value of *pylong* is out of range for a @@ -215,7 +215,7 @@ .. index:: single: OverflowError (built-in exception) - Return a C :c:type:`unsigned PY_LONG_LONG` representation of of *pylong*. + Return a C :c:type:`unsigned PY_LONG_LONG` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`. Raise :exc:`OverflowError` if the value of *pylong* is out of range for an diff --git a/Doc/library/xml.dom.rst b/Doc/library/xml.dom.rst --- a/Doc/library/xml.dom.rst +++ b/Doc/library/xml.dom.rst @@ -357,7 +357,7 @@ Add a new child node to this node at the end of the list of children, returning *newChild*. If the node was already in - in the tree, it is removed first. + the tree, it is removed first. .. method:: Node.insertBefore(newChild, refChild) diff --git a/Mac/README b/Mac/README --- a/Mac/README +++ b/Mac/README @@ -37,7 +37,7 @@ * ``--enable-universalsdk[=PATH]`` - Create a universal binary build of of Python. This can be used with both + Create a universal binary build of Python. This can be used with both regular and framework builds. The optional argument specifies which OS X SDK should be used to perform the diff --git a/Tools/msi/msilib.py b/Tools/msi/msilib.py --- a/Tools/msi/msilib.py +++ b/Tools/msi/msilib.py @@ -491,7 +491,7 @@ def add_file(self, file, src=None, version=None, language=None): """Add a file to the current component of the directory, starting a new one - one if there is no current component. By default, the file name in the source + if there is no current component. By default, the file name in the source and the file table will be identical. If the src file is specified, it is interpreted relative to the current directory. Optionally, a version and a language can be specified for the entry in the File table.""" diff --git a/Tools/pybench/README b/Tools/pybench/README --- a/Tools/pybench/README +++ b/Tools/pybench/README @@ -3,7 +3,7 @@ PYBENCH - A Python Benchmark Suite ________________________________________________________________________ - Extendable suite of of low-level benchmarks for measuring + Extendable suite of low-level benchmarks for measuring the performance of the Python implementation (interpreter, compiler or VM). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 22:29:09 2013 From: python-checkins at python.org (terry.reedy) Date: Mon, 11 Mar 2013 22:29:09 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E3=3A_Issue_=2317047=3A_removed_doubled_wo?= =?utf-8?q?rds_in_Doc/*=2C?= Message-ID: <3ZPsrj51KjzRvT@mail.python.org> http://hg.python.org/cpython/rev/c187c145b4c4 changeset: 82612:c187c145b4c4 parent: 82608:2966e5a55396 parent: 82611:629322a13b53 user: Terry Jan Reedy date: Mon Mar 11 17:27:28 2013 -0400 summary: Merge with 3.3: Issue #17047: removed doubled words in Doc/*, Mac/*, and Tool/* found by Serhiy Storchaka and Matthew Barnett files: Doc/c-api/intro.rst | 2 +- Doc/c-api/long.rst | 4 ++-- Doc/library/xml.dom.rst | 2 +- Mac/README | 2 +- Tools/msi/msilib.py | 2 +- Tools/pybench/README | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -433,7 +433,7 @@ .. index:: single: sum_sequence() A simple example of detecting exceptions and passing them on is shown in the -:c:func:`sum_sequence` example above. It so happens that that example doesn't +:c:func:`sum_sequence` example above. It so happens that this example doesn't need to clean up any owned references when it detects an error. The following example function shows some error cleanup. First, to remind you why you like Python, we show the equivalent Python code:: diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -203,7 +203,7 @@ .. c:function:: size_t PyLong_AsSize_t(PyObject *pylong) - Return a C :c:type:`size_t` representation of of *pylong*. *pylong* must be + Return a C :c:type:`size_t` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`. Raise :exc:`OverflowError` if the value of *pylong* is out of range for a @@ -215,7 +215,7 @@ .. index:: single: OverflowError (built-in exception) - Return a C :c:type:`unsigned PY_LONG_LONG` representation of of *pylong*. + Return a C :c:type:`unsigned PY_LONG_LONG` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`. Raise :exc:`OverflowError` if the value of *pylong* is out of range for an diff --git a/Doc/library/xml.dom.rst b/Doc/library/xml.dom.rst --- a/Doc/library/xml.dom.rst +++ b/Doc/library/xml.dom.rst @@ -357,7 +357,7 @@ Add a new child node to this node at the end of the list of children, returning *newChild*. If the node was already in - in the tree, it is removed first. + the tree, it is removed first. .. method:: Node.insertBefore(newChild, refChild) diff --git a/Mac/README b/Mac/README --- a/Mac/README +++ b/Mac/README @@ -37,7 +37,7 @@ * ``--enable-universalsdk[=PATH]`` - Create a universal binary build of of Python. This can be used with both + Create a universal binary build of Python. This can be used with both regular and framework builds. The optional argument specifies which OS X SDK should be used to perform the diff --git a/Tools/msi/msilib.py b/Tools/msi/msilib.py --- a/Tools/msi/msilib.py +++ b/Tools/msi/msilib.py @@ -491,7 +491,7 @@ def add_file(self, file, src=None, version=None, language=None): """Add a file to the current component of the directory, starting a new one - one if there is no current component. By default, the file name in the source + if there is no current component. By default, the file name in the source and the file table will be identical. If the src file is specified, it is interpreted relative to the current directory. Optionally, a version and a language can be specified for the entry in the File table.""" diff --git a/Tools/pybench/README b/Tools/pybench/README --- a/Tools/pybench/README +++ b/Tools/pybench/README @@ -3,7 +3,7 @@ PYBENCH - A Python Benchmark Suite ________________________________________________________________________ - Extendable suite of of low-level benchmarks for measuring + Extendable suite of low-level benchmarks for measuring the performance of the Python implementation (interpreter, compiler or VM). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 22:47:08 2013 From: python-checkins at python.org (terry.reedy) Date: Mon, 11 Mar 2013 22:47:08 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3MDQ3?= =?utf-8?q?=3A_remove_doubled_words_found_in_2=2E7_to_3=2E4_Modules/*=2C?= Message-ID: <3ZPtFS2qxvzRrF@mail.python.org> http://hg.python.org/cpython/rev/e145dddb9d93 changeset: 82613:e145dddb9d93 branch: 2.7 parent: 82609:1ecb712fcf22 user: Terry Jan Reedy date: Mon Mar 11 17:41:44 2013 -0400 summary: Issue #17047: remove doubled words found in 2.7 to 3.4 Modules/*, as reported by Serhiy Storchaka and Matthew Barnett. files: Modules/_ctypes/callproc.c | 4 ++-- Modules/_ctypes/libffi/src/dlmalloc.c | 12 ++++++------ Modules/_ctypes/libffi/src/ia64/ffi.c | 4 ++-- Modules/_heapqmodule.c | 4 ++-- Modules/_io/iobase.c | 2 +- Modules/expat/xmltok.c | 2 +- Modules/ossaudiodev.c | 2 +- Modules/zlib/deflate.c | 4 ++-- Modules/zlib/zlib.h | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -25,8 +25,8 @@ 2. After several checks, _build_callargs() is called which returns another tuple 'callargs'. This may be the same tuple as 'inargs', a slice of - 'inargs', or a completely fresh tuple, depending on several things (is is a - COM method, are 'paramflags' available). + 'inargs', or a completely fresh tuple, depending on several things (is it a + COM method?, are 'paramflags' available?). 3. _build_callargs also calculates bitarrays containing indexes into the callargs tuple, specifying how to build the return value(s) of diff --git a/Modules/_ctypes/libffi/src/dlmalloc.c b/Modules/_ctypes/libffi/src/dlmalloc.c --- a/Modules/_ctypes/libffi/src/dlmalloc.c +++ b/Modules/_ctypes/libffi/src/dlmalloc.c @@ -100,7 +100,7 @@ If you don't like either of these options, you can define CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything - else. And if if you are sure that your program using malloc has + else. And if you are sure that your program using malloc has no errors or vulnerabilities, you can define INSECURE to 1, which might (or might not) provide a small performance improvement. @@ -599,7 +599,7 @@ declaration needed is the mallinfo struct that is returned (by-copy) by mallinfo(). The malloinfo struct contains a bunch of fields that are not even meaningful in this version of malloc. These fields are - are instead filled by mallinfo() with other numbers that might be of + instead filled by mallinfo() with other numbers that might be of interest. HAVE_USR_INCLUDE_MALLOC_H should be set if you have a @@ -1564,7 +1564,7 @@ Each freshly allocated chunk must have both cinuse and pinuse set. That is, each allocated chunk borders either a previously allocated and still in-use chunk, or the base of its memory arena. This is - ensured by making all allocations from the the `lowest' part of any + ensured by making all allocations from the `lowest' part of any found chunk. Further, no free chunk physically borders another one, so each free chunk is known to be preceded and followed by either inuse chunks or the ends of memory. @@ -1770,12 +1770,12 @@ of the same size are arranged in a circularly-linked list, with only the oldest chunk (the next to be used, in our FIFO ordering) actually in the tree. (Tree members are distinguished by a non-null - parent pointer.) If a chunk with the same size an an existing node + parent pointer.) If a chunk with the same size as an existing node is inserted, it is linked off the existing node using pointers that work in the same way as fd/bk pointers of small chunks. Each tree contains a power of 2 sized range of chunk sizes (the - smallest is 0x100 <= x < 0x180), which is is divided in half at each + smallest is 0x100 <= x < 0x180), which is divided in half at each tree level, with the chunks in the smaller half of the range (0x100 <= x < 0x140 for the top nose) in the left subtree and the larger half (0x140 <= x < 0x180) in the right subtree. This is, of course, @@ -3380,7 +3380,7 @@ least-preferred order): 1. A call to MORECORE that can normally contiguously extend memory. (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or - or main space is mmapped or a previous contiguous call failed) + main space is mmapped or a previous contiguous call failed) 2. A call to MMAP new space (disabled if not HAVE_MMAP). Note that under the default settings, if MORECORE is unable to fulfill a request, and HAVE_MMAP is true, then mmap is diff --git a/Modules/_ctypes/libffi/src/ia64/ffi.c b/Modules/_ctypes/libffi/src/ia64/ffi.c --- a/Modules/_ctypes/libffi/src/ia64/ffi.c +++ b/Modules/_ctypes/libffi/src/ia64/ffi.c @@ -84,7 +84,7 @@ #define ldf_fill(result, addr) \ asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr)); -/* Return the size of the C type associated with with TYPE. Which will +/* Return the size of the C type associated with TYPE, which will be one of the FFI_IA64_TYPE_HFA_* values. */ static size_t @@ -184,7 +184,7 @@ break; case FFI_TYPE_LONGDOUBLE: - /* Similarly, except that that HFA is true for double extended, + /* Similarly, except that HFA is true for double extended, but not quad precision. Both have sizeof == 16, so tell the difference based on the precision. */ if (LDBL_MANT_DIG == 64 && nested) diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c --- a/Modules/_heapqmodule.c +++ b/Modules/_heapqmodule.c @@ -139,7 +139,7 @@ } } - /* The leaf at pos is empty now. Put newitem there, and and bubble + /* The leaf at pos is empty now. Put newitem there, and bubble it up to its final resting place (by sifting its parents down). */ Py_DECREF(PyList_GET_ITEM(heap, pos)); PyList_SET_ITEM(heap, pos, newitem); @@ -478,7 +478,7 @@ childpos = 2*pos + 1; } - /* The leaf at pos is empty now. Put newitem there, and and bubble + /* The leaf at pos is empty now. Put newitem there, and bubble it up to its final resting place (by sifting its parents down). */ Py_DECREF(PyList_GET_ITEM(heap, pos)); PyList_SET_ITEM(heap, pos, newitem); diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c --- a/Modules/_io/iobase.c +++ b/Modules/_io/iobase.c @@ -74,7 +74,7 @@ PyDoc_STRVAR(iobase_seek_doc, "Change stream position.\n" "\n" - "Change the stream position to byte offset offset. offset is\n" + "Change the stream position to the given byte offset. The offset is\n" "interpreted relative to the position indicated by whence. Values\n" "for whence are:\n" "\n" diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -1584,7 +1584,7 @@ if (ptr[0] == '\0') { /* 0 isn't a legal data character. Furthermore a document entity can only start with ASCII characters. So the only - way this can fail to be big-endian UTF-16 if it it's an + way this can fail to be big-endian UTF-16 is if it is an external parsed general entity that's labelled as UTF-16LE. */ diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c --- a/Modules/ossaudiodev.c +++ b/Modules/ossaudiodev.c @@ -215,7 +215,7 @@ */ /* _do_ioctl_1() is a private helper function used for the OSS ioctls -- - SNDCTL_DSP_{SETFMT,CHANNELS,SPEED} -- that that are called from C + SNDCTL_DSP_{SETFMT,CHANNELS,SPEED} -- that are called from C like this: ioctl(fd, SNDCTL_DSP_cmd, &arg) diff --git a/Modules/zlib/deflate.c b/Modules/zlib/deflate.c --- a/Modules/zlib/deflate.c +++ b/Modules/zlib/deflate.c @@ -163,7 +163,7 @@ /* =========================================================================== * Update a hash value with the given input byte - * IN assertion: all calls to to UPDATE_HASH are made with consecutive + * IN assertion: all calls to UPDATE_HASH are made with consecutive * input characters, so that a running hash key can be computed from the * previous key instead of complete recalculation each time. */ @@ -176,7 +176,7 @@ * the previous length of the hash chain. * If this file is compiled with -DFASTEST, the compression level is forced * to 1, and no hash chains are maintained. - * IN assertion: all calls to to INSERT_STRING are made with consecutive + * IN assertion: all calls to INSERT_STRING are made with consecutive * input characters and the first MIN_MATCH bytes of str are valid * (except for the last MIN_MATCH-1 bytes of the input file). */ diff --git a/Modules/zlib/zlib.h b/Modules/zlib/zlib.h --- a/Modules/zlib/zlib.h +++ b/Modules/zlib/zlib.h @@ -764,7 +764,7 @@ inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the success - case, the application may save the current current value of total_in which + case, the application may save the current value of total_in which indicates where valid compressed data was found. In the error case, the application may repeatedly call inflateSync, providing more input each time, until success or end of the input data. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 22:47:10 2013 From: python-checkins at python.org (terry.reedy) Date: Mon, 11 Mar 2013 22:47:10 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3MDQ3?= =?utf-8?q?=3A_remove_doubled_words_found_in_2=2E7_to_3=2E4_Modules/*=2C?= Message-ID: <3ZPtFV0GNCzRsn@mail.python.org> http://hg.python.org/cpython/rev/e9ba9f21a828 changeset: 82614:e9ba9f21a828 branch: 3.2 parent: 82610:e37647470fcf user: Terry Jan Reedy date: Mon Mar 11 17:42:46 2013 -0400 summary: Issue #17047: remove doubled words found in 2.7 to 3.4 Modules/*, as reported by Serhiy Storchaka and Matthew Barnett. files: Modules/_ctypes/callproc.c | 4 ++-- Modules/_ctypes/libffi/src/dlmalloc.c | 12 ++++++------ Modules/_ctypes/libffi/src/ia64/ffi.c | 4 ++-- Modules/_heapqmodule.c | 4 ++-- Modules/_io/iobase.c | 2 +- Modules/expat/xmltok.c | 2 +- Modules/ossaudiodev.c | 2 +- Modules/zlib/deflate.c | 4 ++-- Modules/zlib/inftrees.h | 2 +- Modules/zlib/zlib.h | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -20,8 +20,8 @@ 2. After several checks, _build_callargs() is called which returns another tuple 'callargs'. This may be the same tuple as 'inargs', a slice of - 'inargs', or a completely fresh tuple, depending on several things (is is a - COM method, are 'paramflags' available). + 'inargs', or a completely fresh tuple, depending on several things (is it a + COM method?, are 'paramflags' available?). 3. _build_callargs also calculates bitarrays containing indexes into the callargs tuple, specifying how to build the return value(s) of diff --git a/Modules/_ctypes/libffi/src/dlmalloc.c b/Modules/_ctypes/libffi/src/dlmalloc.c --- a/Modules/_ctypes/libffi/src/dlmalloc.c +++ b/Modules/_ctypes/libffi/src/dlmalloc.c @@ -100,7 +100,7 @@ If you don't like either of these options, you can define CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything - else. And if if you are sure that your program using malloc has + else. And if you are sure that your program using malloc has no errors or vulnerabilities, you can define INSECURE to 1, which might (or might not) provide a small performance improvement. @@ -599,7 +599,7 @@ declaration needed is the mallinfo struct that is returned (by-copy) by mallinfo(). The malloinfo struct contains a bunch of fields that are not even meaningful in this version of malloc. These fields are - are instead filled by mallinfo() with other numbers that might be of + instead filled by mallinfo() with other numbers that might be of interest. HAVE_USR_INCLUDE_MALLOC_H should be set if you have a @@ -1564,7 +1564,7 @@ Each freshly allocated chunk must have both cinuse and pinuse set. That is, each allocated chunk borders either a previously allocated and still in-use chunk, or the base of its memory arena. This is - ensured by making all allocations from the the `lowest' part of any + ensured by making all allocations from the `lowest' part of any found chunk. Further, no free chunk physically borders another one, so each free chunk is known to be preceded and followed by either inuse chunks or the ends of memory. @@ -1770,12 +1770,12 @@ of the same size are arranged in a circularly-linked list, with only the oldest chunk (the next to be used, in our FIFO ordering) actually in the tree. (Tree members are distinguished by a non-null - parent pointer.) If a chunk with the same size an an existing node + parent pointer.) If a chunk with the same size as an existing node is inserted, it is linked off the existing node using pointers that work in the same way as fd/bk pointers of small chunks. Each tree contains a power of 2 sized range of chunk sizes (the - smallest is 0x100 <= x < 0x180), which is is divided in half at each + smallest is 0x100 <= x < 0x180), which is divided in half at each tree level, with the chunks in the smaller half of the range (0x100 <= x < 0x140 for the top nose) in the left subtree and the larger half (0x140 <= x < 0x180) in the right subtree. This is, of course, @@ -3380,7 +3380,7 @@ least-preferred order): 1. A call to MORECORE that can normally contiguously extend memory. (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or - or main space is mmapped or a previous contiguous call failed) + main space is mmapped or a previous contiguous call failed) 2. A call to MMAP new space (disabled if not HAVE_MMAP). Note that under the default settings, if MORECORE is unable to fulfill a request, and HAVE_MMAP is true, then mmap is diff --git a/Modules/_ctypes/libffi/src/ia64/ffi.c b/Modules/_ctypes/libffi/src/ia64/ffi.c --- a/Modules/_ctypes/libffi/src/ia64/ffi.c +++ b/Modules/_ctypes/libffi/src/ia64/ffi.c @@ -84,7 +84,7 @@ #define ldf_fill(result, addr) \ asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr)); -/* Return the size of the C type associated with with TYPE. Which will +/* Return the size of the C type associated with TYPE, which will be one of the FFI_IA64_TYPE_HFA_* values. */ static size_t @@ -184,7 +184,7 @@ break; case FFI_TYPE_LONGDOUBLE: - /* Similarly, except that that HFA is true for double extended, + /* Similarly, except that HFA is true for double extended, but not quad precision. Both have sizeof == 16, so tell the difference based on the precision. */ if (LDBL_MANT_DIG == 64 && nested) diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c --- a/Modules/_heapqmodule.c +++ b/Modules/_heapqmodule.c @@ -116,7 +116,7 @@ } } - /* The leaf at pos is empty now. Put newitem there, and and bubble + /* The leaf at pos is empty now. Put newitem there, and bubble it up to its final resting place (by sifting its parents down). */ Py_DECREF(PyList_GET_ITEM(heap, pos)); PyList_SET_ITEM(heap, pos, newitem); @@ -456,7 +456,7 @@ childpos = 2*pos + 1; } - /* The leaf at pos is empty now. Put newitem there, and and bubble + /* The leaf at pos is empty now. Put newitem there, and bubble it up to its final resting place (by sifting its parents down). */ Py_DECREF(PyList_GET_ITEM(heap, pos)); PyList_SET_ITEM(heap, pos, newitem); diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c --- a/Modules/_io/iobase.c +++ b/Modules/_io/iobase.c @@ -75,7 +75,7 @@ PyDoc_STRVAR(iobase_seek_doc, "Change stream position.\n" "\n" - "Change the stream position to byte offset offset. offset is\n" + "Change the stream position to the given byte offset. The offset is\n" "interpreted relative to the position indicated by whence. Values\n" "for whence are:\n" "\n" diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -1584,7 +1584,7 @@ if (ptr[0] == '\0') { /* 0 isn't a legal data character. Furthermore a document entity can only start with ASCII characters. So the only - way this can fail to be big-endian UTF-16 if it it's an + way this can fail to be big-endian UTF-16 is if it is an external parsed general entity that's labelled as UTF-16LE. */ diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c --- a/Modules/ossaudiodev.c +++ b/Modules/ossaudiodev.c @@ -215,7 +215,7 @@ */ /* _do_ioctl_1() is a private helper function used for the OSS ioctls -- - SNDCTL_DSP_{SETFMT,CHANNELS,SPEED} -- that that are called from C + SNDCTL_DSP_{SETFMT,CHANNELS,SPEED} -- that are called from C like this: ioctl(fd, SNDCTL_DSP_cmd, &arg) diff --git a/Modules/zlib/deflate.c b/Modules/zlib/deflate.c --- a/Modules/zlib/deflate.c +++ b/Modules/zlib/deflate.c @@ -157,7 +157,7 @@ /* =========================================================================== * Update a hash value with the given input byte - * IN assertion: all calls to to UPDATE_HASH are made with consecutive + * IN assertion: all calls to UPDATE_HASH are made with consecutive * input characters, so that a running hash key can be computed from the * previous key instead of complete recalculation each time. */ @@ -170,7 +170,7 @@ * the previous length of the hash chain. * If this file is compiled with -DFASTEST, the compression level is forced * to 1, and no hash chains are maintained. - * IN assertion: all calls to to INSERT_STRING are made with consecutive + * IN assertion: all calls to INSERT_STRING are made with consecutive * input characters and the first MIN_MATCH bytes of str are valid * (except for the last MIN_MATCH-1 bytes of the input file). */ diff --git a/Modules/zlib/inftrees.h b/Modules/zlib/inftrees.h --- a/Modules/zlib/inftrees.h +++ b/Modules/zlib/inftrees.h @@ -41,7 +41,7 @@ examples/enough.c found in the zlib distribtution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. + returns 852, and "enough 30 6 15" for distance codes returns 592. The initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in inflate.c and infback.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and diff --git a/Modules/zlib/zlib.h b/Modules/zlib/zlib.h --- a/Modules/zlib/zlib.h +++ b/Modules/zlib/zlib.h @@ -812,7 +812,7 @@ inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the - success case, the application may save the current current value of total_in + success case, the application may save the current value of total_in which indicates where valid compressed data was found. In the error case, the application may repeatedly call inflateSync, providing more input each time, until success or end of the input data. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 22:47:11 2013 From: python-checkins at python.org (terry.reedy) Date: Mon, 11 Mar 2013 22:47:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_3=2E2=2C_Issue_=2317047=3A_remove_doubled_words_found_in?= =?utf-8?q?_2=2E7_to_3=2E4?= Message-ID: <3ZPtFW5MlKzRkZ@mail.python.org> http://hg.python.org/cpython/rev/a42195046e39 changeset: 82615:a42195046e39 branch: 3.3 parent: 82611:629322a13b53 parent: 82614:e9ba9f21a828 user: Terry Jan Reedy date: Mon Mar 11 17:45:12 2013 -0400 summary: Merge 3.2, Issue #17047: remove doubled words found in 2.7 to 3.4 Modules/*, as reported by Serhiy Storchaka and Matthew Barnett. files: Modules/_ctypes/callproc.c | 4 ++-- Modules/_ctypes/libffi/src/dlmalloc.c | 12 ++++++------ Modules/_ctypes/libffi/src/ia64/ffi.c | 4 ++-- Modules/_heapqmodule.c | 4 ++-- Modules/_io/iobase.c | 2 +- Modules/expat/xmltok.c | 2 +- Modules/ossaudiodev.c | 2 +- Modules/zlib/deflate.c | 4 ++-- Modules/zlib/inftrees.h | 2 +- Modules/zlib/zlib.h | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -20,8 +20,8 @@ 2. After several checks, _build_callargs() is called which returns another tuple 'callargs'. This may be the same tuple as 'inargs', a slice of - 'inargs', or a completely fresh tuple, depending on several things (is is a - COM method, are 'paramflags' available). + 'inargs', or a completely fresh tuple, depending on several things (is it a + COM method?, are 'paramflags' available?). 3. _build_callargs also calculates bitarrays containing indexes into the callargs tuple, specifying how to build the return value(s) of diff --git a/Modules/_ctypes/libffi/src/dlmalloc.c b/Modules/_ctypes/libffi/src/dlmalloc.c --- a/Modules/_ctypes/libffi/src/dlmalloc.c +++ b/Modules/_ctypes/libffi/src/dlmalloc.c @@ -100,7 +100,7 @@ If you don't like either of these options, you can define CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything - else. And if if you are sure that your program using malloc has + else. And if you are sure that your program using malloc has no errors or vulnerabilities, you can define INSECURE to 1, which might (or might not) provide a small performance improvement. @@ -607,7 +607,7 @@ declaration needed is the mallinfo struct that is returned (by-copy) by mallinfo(). The malloinfo struct contains a bunch of fields that are not even meaningful in this version of malloc. These fields are - are instead filled by mallinfo() with other numbers that might be of + instead filled by mallinfo() with other numbers that might be of interest. HAVE_USR_INCLUDE_MALLOC_H should be set if you have a @@ -1621,7 +1621,7 @@ Each freshly allocated chunk must have both cinuse and pinuse set. That is, each allocated chunk borders either a previously allocated and still in-use chunk, or the base of its memory arena. This is - ensured by making all allocations from the the `lowest' part of any + ensured by making all allocations from the `lowest' part of any found chunk. Further, no free chunk physically borders another one, so each free chunk is known to be preceded and followed by either inuse chunks or the ends of memory. @@ -1827,12 +1827,12 @@ of the same size are arranged in a circularly-linked list, with only the oldest chunk (the next to be used, in our FIFO ordering) actually in the tree. (Tree members are distinguished by a non-null - parent pointer.) If a chunk with the same size an an existing node + parent pointer.) If a chunk with the same size as an existing node is inserted, it is linked off the existing node using pointers that work in the same way as fd/bk pointers of small chunks. Each tree contains a power of 2 sized range of chunk sizes (the - smallest is 0x100 <= x < 0x180), which is is divided in half at each + smallest is 0x100 <= x < 0x180), which is divided in half at each tree level, with the chunks in the smaller half of the range (0x100 <= x < 0x140 for the top nose) in the left subtree and the larger half (0x140 <= x < 0x180) in the right subtree. This is, of course, @@ -3442,7 +3442,7 @@ least-preferred order): 1. A call to MORECORE that can normally contiguously extend memory. (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or - or main space is mmapped or a previous contiguous call failed) + main space is mmapped or a previous contiguous call failed) 2. A call to MMAP new space (disabled if not HAVE_MMAP). Note that under the default settings, if MORECORE is unable to fulfill a request, and HAVE_MMAP is true, then mmap is diff --git a/Modules/_ctypes/libffi/src/ia64/ffi.c b/Modules/_ctypes/libffi/src/ia64/ffi.c --- a/Modules/_ctypes/libffi/src/ia64/ffi.c +++ b/Modules/_ctypes/libffi/src/ia64/ffi.c @@ -85,7 +85,7 @@ #define ldf_fill(result, addr) \ asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr)); -/* Return the size of the C type associated with with TYPE. Which will +/* Return the size of the C type associated with TYPE, which will be one of the FFI_IA64_TYPE_HFA_* values. */ static size_t @@ -185,7 +185,7 @@ break; case FFI_TYPE_LONGDOUBLE: - /* Similarly, except that that HFA is true for double extended, + /* Similarly, except that HFA is true for double extended, but not quad precision. Both have sizeof == 16, so tell the difference based on the precision. */ if (LDBL_MANT_DIG == 64 && nested) diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c --- a/Modules/_heapqmodule.c +++ b/Modules/_heapqmodule.c @@ -116,7 +116,7 @@ } } - /* The leaf at pos is empty now. Put newitem there, and and bubble + /* The leaf at pos is empty now. Put newitem there, and bubble it up to its final resting place (by sifting its parents down). */ Py_DECREF(PyList_GET_ITEM(heap, pos)); PyList_SET_ITEM(heap, pos, newitem); @@ -456,7 +456,7 @@ childpos = 2*pos + 1; } - /* The leaf at pos is empty now. Put newitem there, and and bubble + /* The leaf at pos is empty now. Put newitem there, and bubble it up to its final resting place (by sifting its parents down). */ Py_DECREF(PyList_GET_ITEM(heap, pos)); PyList_SET_ITEM(heap, pos, newitem); diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c --- a/Modules/_io/iobase.c +++ b/Modules/_io/iobase.c @@ -76,7 +76,7 @@ PyDoc_STRVAR(iobase_seek_doc, "Change stream position.\n" "\n" - "Change the stream position to byte offset offset. offset is\n" + "Change the stream position to the given byte offset. The offset is\n" "interpreted relative to the position indicated by whence. Values\n" "for whence are:\n" "\n" diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -1584,7 +1584,7 @@ if (ptr[0] == '\0') { /* 0 isn't a legal data character. Furthermore a document entity can only start with ASCII characters. So the only - way this can fail to be big-endian UTF-16 if it it's an + way this can fail to be big-endian UTF-16 is if it is an external parsed general entity that's labelled as UTF-16LE. */ diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c --- a/Modules/ossaudiodev.c +++ b/Modules/ossaudiodev.c @@ -230,7 +230,7 @@ } /* _do_ioctl_1() is a private helper function used for the OSS ioctls -- - SNDCTL_DSP_{SETFMT,CHANNELS,SPEED} -- that that are called from C + SNDCTL_DSP_{SETFMT,CHANNELS,SPEED} -- that are called from C like this: ioctl(fd, SNDCTL_DSP_cmd, &arg) diff --git a/Modules/zlib/deflate.c b/Modules/zlib/deflate.c --- a/Modules/zlib/deflate.c +++ b/Modules/zlib/deflate.c @@ -157,7 +157,7 @@ /* =========================================================================== * Update a hash value with the given input byte - * IN assertion: all calls to to UPDATE_HASH are made with consecutive + * IN assertion: all calls to UPDATE_HASH are made with consecutive * input characters, so that a running hash key can be computed from the * previous key instead of complete recalculation each time. */ @@ -170,7 +170,7 @@ * the previous length of the hash chain. * If this file is compiled with -DFASTEST, the compression level is forced * to 1, and no hash chains are maintained. - * IN assertion: all calls to to INSERT_STRING are made with consecutive + * IN assertion: all calls to INSERT_STRING are made with consecutive * input characters and the first MIN_MATCH bytes of str are valid * (except for the last MIN_MATCH-1 bytes of the input file). */ diff --git a/Modules/zlib/inftrees.h b/Modules/zlib/inftrees.h --- a/Modules/zlib/inftrees.h +++ b/Modules/zlib/inftrees.h @@ -41,7 +41,7 @@ examples/enough.c found in the zlib distribtution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. + returns 852, and "enough 30 6 15" for distance codes returns 592. The initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in inflate.c and infback.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and diff --git a/Modules/zlib/zlib.h b/Modules/zlib/zlib.h --- a/Modules/zlib/zlib.h +++ b/Modules/zlib/zlib.h @@ -812,7 +812,7 @@ inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the - success case, the application may save the current current value of total_in + success case, the application may save the current value of total_in which indicates where valid compressed data was found. In the error case, the application may repeatedly call inflateSync, providing more input each time, until success or end of the input data. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 22:47:13 2013 From: python-checkins at python.org (terry.reedy) Date: Mon, 11 Mar 2013 22:47:13 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_3=2E3=2C_issue_=2317047=3A_remove_doubled_words_fo?= =?utf-8?q?und_in_2=2E7_to_3=2E4?= Message-ID: <3ZPtFY2f2YzRpR@mail.python.org> http://hg.python.org/cpython/rev/4bd13f45d3a2 changeset: 82616:4bd13f45d3a2 parent: 82612:c187c145b4c4 parent: 82615:a42195046e39 user: Terry Jan Reedy date: Mon Mar 11 17:46:07 2013 -0400 summary: Merge 3.3, issue #17047: remove doubled words found in 2.7 to 3.4 Modules/*, as reported by Serhiy Storchaka and Matthew Barnett. files: Modules/_ctypes/callproc.c | 4 ++-- Modules/_ctypes/libffi/src/dlmalloc.c | 12 ++++++------ Modules/_ctypes/libffi/src/ia64/ffi.c | 4 ++-- Modules/_heapqmodule.c | 4 ++-- Modules/_io/iobase.c | 2 +- Modules/expat/xmltok.c | 2 +- Modules/ossaudiodev.c | 2 +- Modules/zlib/deflate.c | 4 ++-- Modules/zlib/inftrees.h | 2 +- Modules/zlib/zlib.h | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -20,8 +20,8 @@ 2. After several checks, _build_callargs() is called which returns another tuple 'callargs'. This may be the same tuple as 'inargs', a slice of - 'inargs', or a completely fresh tuple, depending on several things (is is a - COM method, are 'paramflags' available). + 'inargs', or a completely fresh tuple, depending on several things (is it a + COM method?, are 'paramflags' available?). 3. _build_callargs also calculates bitarrays containing indexes into the callargs tuple, specifying how to build the return value(s) of diff --git a/Modules/_ctypes/libffi/src/dlmalloc.c b/Modules/_ctypes/libffi/src/dlmalloc.c --- a/Modules/_ctypes/libffi/src/dlmalloc.c +++ b/Modules/_ctypes/libffi/src/dlmalloc.c @@ -100,7 +100,7 @@ If you don't like either of these options, you can define CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything - else. And if if you are sure that your program using malloc has + else. And if you are sure that your program using malloc has no errors or vulnerabilities, you can define INSECURE to 1, which might (or might not) provide a small performance improvement. @@ -607,7 +607,7 @@ declaration needed is the mallinfo struct that is returned (by-copy) by mallinfo(). The malloinfo struct contains a bunch of fields that are not even meaningful in this version of malloc. These fields are - are instead filled by mallinfo() with other numbers that might be of + instead filled by mallinfo() with other numbers that might be of interest. HAVE_USR_INCLUDE_MALLOC_H should be set if you have a @@ -1621,7 +1621,7 @@ Each freshly allocated chunk must have both cinuse and pinuse set. That is, each allocated chunk borders either a previously allocated and still in-use chunk, or the base of its memory arena. This is - ensured by making all allocations from the the `lowest' part of any + ensured by making all allocations from the `lowest' part of any found chunk. Further, no free chunk physically borders another one, so each free chunk is known to be preceded and followed by either inuse chunks or the ends of memory. @@ -1827,12 +1827,12 @@ of the same size are arranged in a circularly-linked list, with only the oldest chunk (the next to be used, in our FIFO ordering) actually in the tree. (Tree members are distinguished by a non-null - parent pointer.) If a chunk with the same size an an existing node + parent pointer.) If a chunk with the same size as an existing node is inserted, it is linked off the existing node using pointers that work in the same way as fd/bk pointers of small chunks. Each tree contains a power of 2 sized range of chunk sizes (the - smallest is 0x100 <= x < 0x180), which is is divided in half at each + smallest is 0x100 <= x < 0x180), which is divided in half at each tree level, with the chunks in the smaller half of the range (0x100 <= x < 0x140 for the top nose) in the left subtree and the larger half (0x140 <= x < 0x180) in the right subtree. This is, of course, @@ -3442,7 +3442,7 @@ least-preferred order): 1. A call to MORECORE that can normally contiguously extend memory. (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or - or main space is mmapped or a previous contiguous call failed) + main space is mmapped or a previous contiguous call failed) 2. A call to MMAP new space (disabled if not HAVE_MMAP). Note that under the default settings, if MORECORE is unable to fulfill a request, and HAVE_MMAP is true, then mmap is diff --git a/Modules/_ctypes/libffi/src/ia64/ffi.c b/Modules/_ctypes/libffi/src/ia64/ffi.c --- a/Modules/_ctypes/libffi/src/ia64/ffi.c +++ b/Modules/_ctypes/libffi/src/ia64/ffi.c @@ -85,7 +85,7 @@ #define ldf_fill(result, addr) \ asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr)); -/* Return the size of the C type associated with with TYPE. Which will +/* Return the size of the C type associated with TYPE, which will be one of the FFI_IA64_TYPE_HFA_* values. */ static size_t @@ -185,7 +185,7 @@ break; case FFI_TYPE_LONGDOUBLE: - /* Similarly, except that that HFA is true for double extended, + /* Similarly, except that HFA is true for double extended, but not quad precision. Both have sizeof == 16, so tell the difference based on the precision. */ if (LDBL_MANT_DIG == 64 && nested) diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c --- a/Modules/_heapqmodule.c +++ b/Modules/_heapqmodule.c @@ -116,7 +116,7 @@ } } - /* The leaf at pos is empty now. Put newitem there, and and bubble + /* The leaf at pos is empty now. Put newitem there, and bubble it up to its final resting place (by sifting its parents down). */ Py_DECREF(PyList_GET_ITEM(heap, pos)); PyList_SET_ITEM(heap, pos, newitem); @@ -456,7 +456,7 @@ childpos = 2*pos + 1; } - /* The leaf at pos is empty now. Put newitem there, and and bubble + /* The leaf at pos is empty now. Put newitem there, and bubble it up to its final resting place (by sifting its parents down). */ Py_DECREF(PyList_GET_ITEM(heap, pos)); PyList_SET_ITEM(heap, pos, newitem); diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c --- a/Modules/_io/iobase.c +++ b/Modules/_io/iobase.c @@ -76,7 +76,7 @@ PyDoc_STRVAR(iobase_seek_doc, "Change stream position.\n" "\n" - "Change the stream position to byte offset offset. offset is\n" + "Change the stream position to the given byte offset. The offset is\n" "interpreted relative to the position indicated by whence. Values\n" "for whence are:\n" "\n" diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -1584,7 +1584,7 @@ if (ptr[0] == '\0') { /* 0 isn't a legal data character. Furthermore a document entity can only start with ASCII characters. So the only - way this can fail to be big-endian UTF-16 if it it's an + way this can fail to be big-endian UTF-16 is if it is an external parsed general entity that's labelled as UTF-16LE. */ diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c --- a/Modules/ossaudiodev.c +++ b/Modules/ossaudiodev.c @@ -230,7 +230,7 @@ } /* _do_ioctl_1() is a private helper function used for the OSS ioctls -- - SNDCTL_DSP_{SETFMT,CHANNELS,SPEED} -- that that are called from C + SNDCTL_DSP_{SETFMT,CHANNELS,SPEED} -- that are called from C like this: ioctl(fd, SNDCTL_DSP_cmd, &arg) diff --git a/Modules/zlib/deflate.c b/Modules/zlib/deflate.c --- a/Modules/zlib/deflate.c +++ b/Modules/zlib/deflate.c @@ -157,7 +157,7 @@ /* =========================================================================== * Update a hash value with the given input byte - * IN assertion: all calls to to UPDATE_HASH are made with consecutive + * IN assertion: all calls to UPDATE_HASH are made with consecutive * input characters, so that a running hash key can be computed from the * previous key instead of complete recalculation each time. */ @@ -170,7 +170,7 @@ * the previous length of the hash chain. * If this file is compiled with -DFASTEST, the compression level is forced * to 1, and no hash chains are maintained. - * IN assertion: all calls to to INSERT_STRING are made with consecutive + * IN assertion: all calls to INSERT_STRING are made with consecutive * input characters and the first MIN_MATCH bytes of str are valid * (except for the last MIN_MATCH-1 bytes of the input file). */ diff --git a/Modules/zlib/inftrees.h b/Modules/zlib/inftrees.h --- a/Modules/zlib/inftrees.h +++ b/Modules/zlib/inftrees.h @@ -41,7 +41,7 @@ examples/enough.c found in the zlib distribtution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. + returns 852, and "enough 30 6 15" for distance codes returns 592. The initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in inflate.c and infback.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and diff --git a/Modules/zlib/zlib.h b/Modules/zlib/zlib.h --- a/Modules/zlib/zlib.h +++ b/Modules/zlib/zlib.h @@ -812,7 +812,7 @@ inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the - success case, the application may save the current current value of total_in + success case, the application may save the current value of total_in which indicates where valid compressed data was found. In the error case, the application may repeatedly call inflateSync, providing more input each time, until success or end of the input data. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 23:00:09 2013 From: python-checkins at python.org (terry.reedy) Date: Mon, 11 Mar 2013 23:00:09 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3MDQ3?= =?utf-8?q?=3A_remove_doubled_words_found_in_2=2E7_to_3=2E4_Lib/*=2C?= Message-ID: <3ZPtXT6mDczRhJ@mail.python.org> http://hg.python.org/cpython/rev/cd0191a9b5c9 changeset: 82617:cd0191a9b5c9 branch: 2.7 parent: 82613:e145dddb9d93 user: Terry Jan Reedy date: Mon Mar 11 17:56:17 2013 -0400 summary: Issue #17047: remove doubled words found in 2.7 to 3.4 Lib/*, as reported by Serhiy Storchaka and Matthew Barnett. files: Lib/_pyio.py | 2 +- Lib/distutils/command/install.py | 4 +- Lib/distutils/tests/test_install.py | 2 +- Lib/ftplib.py | 4 +- Lib/idlelib/extend.txt | 4 +- Lib/idlelib/rpc.py | 2 +- Lib/lib-tk/Tix.py | 44 ++++++++-------- Lib/lib-tk/turtle.py | 4 +- Lib/lib2to3/pgen2/grammar.py | 4 +- Lib/msilib/__init__.py | 2 +- Lib/test/test_descrtut.py | 2 +- Lib/test/test_socket.py | 2 +- 12 files changed, 39 insertions(+), 37 deletions(-) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -298,7 +298,7 @@ def seek(self, pos, whence=0): """Change stream position. - Change the stream position to byte offset offset. offset is + Change the stream position to byte offset pos. Argument pos is interpreted relative to the position indicated by whence. Values for whence are: diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py --- a/Lib/distutils/command/install.py +++ b/Lib/distutils/command/install.py @@ -265,8 +265,8 @@ if self.user and (self.prefix or self.exec_prefix or self.home or self.install_base or self.install_platbase): - raise DistutilsOptionError("can't combine user with with prefix/" - "exec_prefix/home or install_(plat)base") + raise DistutilsOptionError("can't combine user with prefix, " + "exec_prefix/home, or install_(plat)base") # Next, stuff that's wrong (or dubious) only on certain platforms. if os.name != "posix": diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py --- a/Lib/distutils/tests/test_install.py +++ b/Lib/distutils/tests/test_install.py @@ -166,7 +166,7 @@ cmd.home = 'home' self.assertRaises(DistutilsOptionError, cmd.finalize_options) - # can't combine user with with prefix/exec_prefix/home or + # can't combine user with prefix/exec_prefix/home or # install_(plat)base cmd.prefix = None cmd.user = 'user' diff --git a/Lib/ftplib.py b/Lib/ftplib.py --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -454,7 +454,7 @@ blocksize: The maximum data size to read from fp and send over the connection at once. [default: 8192] callback: An optional single parameter callable that is called on - on each block of data after it is sent. [default: None] + each block of data after it is sent. [default: None] rest: Passed to transfercmd(). [default: None] Returns: @@ -477,7 +477,7 @@ cmd: A STOR command. fp: A file-like object with a readline() method. callback: An optional single parameter callable that is called on - on each line after it is sent. [default: None] + each line after it is sent. [default: None] Returns: The response code. diff --git a/Lib/idlelib/extend.txt b/Lib/idlelib/extend.txt --- a/Lib/idlelib/extend.txt +++ b/Lib/idlelib/extend.txt @@ -54,7 +54,7 @@ implement. (They are also not required to create keybindings, but in that case there must be empty bindings in cofig-extensions.def) -Here is a complete example example: +Here is a complete example: class ZoomHeight: @@ -72,7 +72,7 @@ "...Do what you want here..." The final piece of the puzzle is the file "config-extensions.def", which is -used to to configure the loading of extensions and to establish key (or, more +used to configure the loading of extensions and to establish key (or, more generally, event) bindings to the virtual events defined in the extensions. See the comments at the top of config-extensions.def for information. It's diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py --- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -2,7 +2,7 @@ For security reasons, GvR requested that Idle's Python execution server process connect to the Idle process, which listens for the connection. Since Idle has -has only one client per server, this was not a limitation. +only one client per server, this was not a limitation. +---------------------------------+ +-------------+ | SocketServer.BaseRequestHandler | | SocketIO | diff --git a/Lib/lib-tk/Tix.py b/Lib/lib-tk/Tix.py --- a/Lib/lib-tk/Tix.py +++ b/Lib/lib-tk/Tix.py @@ -1902,38 +1902,39 @@ self.tk.call(self, 'set', x, y, *args) def size_column(self, index, **kw): - """Queries or sets the size of the column given by - INDEX. INDEX may be any non-negative - integer that gives the position of a given column. + """Queries or sets the size of the column given by + INDEX. INDEX may be any non-negative + integer that gives the position of a given column. INDEX can also be the string "default"; in this case, this command queries or sets the default size of all columns. - When no option-value pair is given, this command returns a tuple - containing the current size setting of the given column. When - option-value pairs are given, the corresponding options of the + When no option-value pair is given, this command returns a tuple + containing the current size setting of the given column. When + option-value pairs are given, the corresponding options of the size setting of the given column are changed. Options may be one - of the follwing: + of the follwing: pad0 pixels Specifies the paddings to the left of a column. pad1 pixels - Specifies the paddings to the right of a column. + Specifies the paddings to the right of a column. size val - Specifies the width of a column . - Val may be: "auto" -- the width of the column is set the - the widest cell in the column; a valid Tk screen distance - unit; or a real number following by the word chars + Specifies the width of a column. Val may be: + "auto" -- the width of the column is set to the + width of the widest cell in the column; + a valid Tk screen distance unit; + or a real number following by the word chars (e.g. 3.4chars) that sets the width of the column to the given number of characters.""" return self.tk.split(self.tk.call(self._w, 'size', 'column', index, *self._options({}, kw))) def size_row(self, index, **kw): - """Queries or sets the size of the row given by - INDEX. INDEX may be any non-negative - integer that gives the position of a given row . + """Queries or sets the size of the row given by + INDEX. INDEX may be any non-negative + integer that gives the position of a given row . INDEX can also be the string "default"; in this case, this command queries or sets the default size of all rows. - When no option-value pair is given, this command returns a list con- - taining the current size setting of the given row . When option-value + When no option-value pair is given, this command returns a list con- + taining the current size setting of the given row . When option-value pairs are given, the corresponding options of the size setting of the given row are changed. Options may be one of the follwing: pad0 pixels @@ -1941,10 +1942,11 @@ pad1 pixels Specifies the paddings to the bottom of a row. size val - Specifies the height of a row. - Val may be: "auto" -- the height of the row is set the - the highest cell in the row; a valid Tk screen distance - unit; or a real number following by the word chars + Specifies the height of a row. Val may be: + "auto" -- the height of the row is set to the + height of the highest cell in the row; + a valid Tk screen distance unit; + or a real number following by the word chars (e.g. 3.4chars) that sets the height of the row to the given number of characters.""" return self.tk.split(self.tk.call( diff --git a/Lib/lib-tk/turtle.py b/Lib/lib-tk/turtle.py --- a/Lib/lib-tk/turtle.py +++ b/Lib/lib-tk/turtle.py @@ -811,8 +811,8 @@ class Terminator (Exception): """Will be raised in TurtleScreen.update, if _RUNNING becomes False. - Thus stops execution of turtle graphics script. Main purpose: use in - in the Demo-Viewer turtle.Demo.py. + This stops execution of a turtle graphics script. + Main purpose: use in the Demo-Viewer turtle.Demo.py. """ pass diff --git a/Lib/lib2to3/pgen2/grammar.py b/Lib/lib2to3/pgen2/grammar.py --- a/Lib/lib2to3/pgen2/grammar.py +++ b/Lib/lib2to3/pgen2/grammar.py @@ -20,7 +20,7 @@ class Grammar(object): - """Pgen parsing tables tables conversion class. + """Pgen parsing tables conversion class. Once initialized, this class supplies the grammar tables for the parsing engine implemented by parse.py. The parsing engine @@ -45,7 +45,7 @@ these two are each other's inverse. states -- a list of DFAs, where each DFA is a list of - states, each state is is a list of arcs, and each + states, each state is a list of arcs, and each arc is a (i, j) pair where i is a label and j is a state number. The DFA number is the index into this list. (This name is slightly confusing.) diff --git a/Lib/msilib/__init__.py b/Lib/msilib/__init__.py --- a/Lib/msilib/__init__.py +++ b/Lib/msilib/__init__.py @@ -326,7 +326,7 @@ def add_file(self, file, src=None, version=None, language=None): """Add a file to the current component of the directory, starting a new one - one if there is no current component. By default, the file name in the source + if there is no current component. By default, the file name in the source and the file table will be identical. If the src file is specified, it is interpreted relative to the current directory. Optionally, a version and a language can be specified for the entry in the File table.""" diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py --- a/Lib/test/test_descrtut.py +++ b/Lib/test/test_descrtut.py @@ -329,7 +329,7 @@ ... return self.__set(inst, value) Now let's define a class with an attribute x defined by a pair of methods, -getx() and and setx(): +getx() and setx(): >>> class C(object): ... diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -415,7 +415,7 @@ # Try same call with optional protocol omitted port2 = socket.getservbyname(service) eq(port, port2) - # Try udp, but don't barf it it doesn't exist + # Try udp, but don't barf if it doesn't exist try: udpport = socket.getservbyname(service, 'udp') except socket.error: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 23:00:11 2013 From: python-checkins at python.org (terry.reedy) Date: Mon, 11 Mar 2013 23:00:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3MDQ3?= =?utf-8?q?=3A_remove_doubled_words_found_in_2=2E7_to_3=2E4_Lib/*=2C?= Message-ID: <3ZPtXW4GXFzRkk@mail.python.org> http://hg.python.org/cpython/rev/3f5f961262ec changeset: 82618:3f5f961262ec branch: 3.2 parent: 82614:e9ba9f21a828 user: Terry Jan Reedy date: Mon Mar 11 17:57:08 2013 -0400 summary: Issue #17047: remove doubled words found in 2.7 to 3.4 Lib/*, as reported by Serhiy Storchaka and Matthew Barnett. files: Lib/_pyio.py | 2 +- Lib/concurrent/futures/_base.py | 2 +- Lib/distutils/command/install.py | 4 +- Lib/distutils/tests/test_install.py | 2 +- Lib/ftplib.py | 4 +- Lib/idlelib/extend.txt | 4 +- Lib/idlelib/rpc.py | 2 +- Lib/lib2to3/pgen2/grammar.py | 4 +- Lib/msilib/__init__.py | 2 +- Lib/test/test_descrtut.py | 2 +- Lib/test/test_socket.py | 2 +- Lib/tkinter/tix.py | 44 ++++++++-------- Lib/turtle.py | 4 +- 13 files changed, 40 insertions(+), 38 deletions(-) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -298,7 +298,7 @@ def seek(self, pos, whence=0): """Change stream position. - Change the stream position to byte offset offset. offset is + Change the stream position to byte offset pos. Argument pos is interpreted relative to the position indicated by whence. Values for whence are ints: diff --git a/Lib/concurrent/futures/_base.py b/Lib/concurrent/futures/_base.py --- a/Lib/concurrent/futures/_base.py +++ b/Lib/concurrent/futures/_base.py @@ -519,7 +519,7 @@ """Returns a iterator equivalent to map(fn, iter). Args: - fn: A callable that will take take as many arguments as there are + fn: A callable that will take as many arguments as there are passed iterables. timeout: The maximum number of seconds to wait. If None, then there is no limit on the wait time. diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py --- a/Lib/distutils/command/install.py +++ b/Lib/distutils/command/install.py @@ -278,8 +278,8 @@ if self.user and (self.prefix or self.exec_prefix or self.home or self.install_base or self.install_platbase): - raise DistutilsOptionError("can't combine user with with prefix/" - "exec_prefix/home or install_(plat)base") + raise DistutilsOptionError("can't combine user with prefix, " + "exec_prefix/home, or install_(plat)base") # Next, stuff that's wrong (or dubious) only on certain platforms. if os.name != "posix": diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py --- a/Lib/distutils/tests/test_install.py +++ b/Lib/distutils/tests/test_install.py @@ -165,7 +165,7 @@ cmd.home = 'home' self.assertRaises(DistutilsOptionError, cmd.finalize_options) - # can't combine user with with prefix/exec_prefix/home or + # can't combine user with prefix/exec_prefix/home or # install_(plat)base cmd.prefix = None cmd.user = 'user' diff --git a/Lib/ftplib.py b/Lib/ftplib.py --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -464,7 +464,7 @@ blocksize: The maximum data size to read from fp and send over the connection at once. [default: 8192] callback: An optional single parameter callable that is called on - on each block of data after it is sent. [default: None] + each block of data after it is sent. [default: None] rest: Passed to transfercmd(). [default: None] Returns: @@ -486,7 +486,7 @@ cmd: A STOR command. fp: A file-like object with a readline() method. callback: An optional single parameter callable that is called on - on each line after it is sent. [default: None] + each line after it is sent. [default: None] Returns: The response code. diff --git a/Lib/idlelib/extend.txt b/Lib/idlelib/extend.txt --- a/Lib/idlelib/extend.txt +++ b/Lib/idlelib/extend.txt @@ -54,7 +54,7 @@ implement. (They are also not required to create keybindings, but in that case there must be empty bindings in cofig-extensions.def) -Here is a complete example example: +Here is a complete example: class ZoomHeight: @@ -72,7 +72,7 @@ "...Do what you want here..." The final piece of the puzzle is the file "config-extensions.def", which is -used to to configure the loading of extensions and to establish key (or, more +used to configure the loading of extensions and to establish key (or, more generally, event) bindings to the virtual events defined in the extensions. See the comments at the top of config-extensions.def for information. It's diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py --- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -2,7 +2,7 @@ For security reasons, GvR requested that Idle's Python execution server process connect to the Idle process, which listens for the connection. Since Idle has -has only one client per server, this was not a limitation. +only one client per server, this was not a limitation. +---------------------------------+ +-------------+ | socketserver.BaseRequestHandler | | SocketIO | diff --git a/Lib/lib2to3/pgen2/grammar.py b/Lib/lib2to3/pgen2/grammar.py --- a/Lib/lib2to3/pgen2/grammar.py +++ b/Lib/lib2to3/pgen2/grammar.py @@ -20,7 +20,7 @@ class Grammar(object): - """Pgen parsing tables tables conversion class. + """Pgen parsing tables conversion class. Once initialized, this class supplies the grammar tables for the parsing engine implemented by parse.py. The parsing engine @@ -45,7 +45,7 @@ these two are each other's inverse. states -- a list of DFAs, where each DFA is a list of - states, each state is is a list of arcs, and each + states, each state is a list of arcs, and each arc is a (i, j) pair where i is a label and j is a state number. The DFA number is the index into this list. (This name is slightly confusing.) diff --git a/Lib/msilib/__init__.py b/Lib/msilib/__init__.py --- a/Lib/msilib/__init__.py +++ b/Lib/msilib/__init__.py @@ -325,7 +325,7 @@ def add_file(self, file, src=None, version=None, language=None): """Add a file to the current component of the directory, starting a new one - one if there is no current component. By default, the file name in the source + if there is no current component. By default, the file name in the source and the file table will be identical. If the src file is specified, it is interpreted relative to the current directory. Optionally, a version and a language can be specified for the entry in the File table.""" diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py --- a/Lib/test/test_descrtut.py +++ b/Lib/test/test_descrtut.py @@ -316,7 +316,7 @@ ... return self.__set(inst, value) Now let's define a class with an attribute x defined by a pair of methods, -getx() and and setx(): +getx() and setx(): >>> class C(object): ... diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -442,7 +442,7 @@ # Try same call with optional protocol omitted port2 = socket.getservbyname(service) eq(port, port2) - # Try udp, but don't barf it it doesn't exist + # Try udp, but don't barf if it doesn't exist try: udpport = socket.getservbyname(service, 'udp') except socket.error: diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py --- a/Lib/tkinter/tix.py +++ b/Lib/tkinter/tix.py @@ -1901,38 +1901,39 @@ self.tk.call(self, 'set', x, y, *args) def size_column(self, index, **kw): - """Queries or sets the size of the column given by - INDEX. INDEX may be any non-negative - integer that gives the position of a given column. + """Queries or sets the size of the column given by + INDEX. INDEX may be any non-negative + integer that gives the position of a given column. INDEX can also be the string "default"; in this case, this command queries or sets the default size of all columns. - When no option-value pair is given, this command returns a tuple - containing the current size setting of the given column. When - option-value pairs are given, the corresponding options of the + When no option-value pair is given, this command returns a tuple + containing the current size setting of the given column. When + option-value pairs are given, the corresponding options of the size setting of the given column are changed. Options may be one - of the follwing: + of the follwing: pad0 pixels Specifies the paddings to the left of a column. pad1 pixels - Specifies the paddings to the right of a column. + Specifies the paddings to the right of a column. size val - Specifies the width of a column . - Val may be: "auto" -- the width of the column is set the - the widest cell in the column; a valid Tk screen distance - unit; or a real number following by the word chars + Specifies the width of a column. Val may be: + "auto" -- the width of the column is set to the + width of the widest cell in the column; + a valid Tk screen distance unit; + or a real number following by the word chars (e.g. 3.4chars) that sets the width of the column to the given number of characters.""" return self.tk.split(self.tk.call(self._w, 'size', 'column', index, *self._options({}, kw))) def size_row(self, index, **kw): - """Queries or sets the size of the row given by - INDEX. INDEX may be any non-negative - integer that gives the position of a given row . + """Queries or sets the size of the row given by + INDEX. INDEX may be any non-negative + integer that gives the position of a given row . INDEX can also be the string "default"; in this case, this command queries or sets the default size of all rows. - When no option-value pair is given, this command returns a list con- - taining the current size setting of the given row . When option-value + When no option-value pair is given, this command returns a list con- + taining the current size setting of the given row . When option-value pairs are given, the corresponding options of the size setting of the given row are changed. Options may be one of the follwing: pad0 pixels @@ -1940,10 +1941,11 @@ pad1 pixels Specifies the paddings to the bottom of a row. size val - Specifies the height of a row. - Val may be: "auto" -- the height of the row is set the - the highest cell in the row; a valid Tk screen distance - unit; or a real number following by the word chars + Specifies the height of a row. Val may be: + "auto" -- the height of the row is set to the + height of the highest cell in the row; + a valid Tk screen distance unit; + or a real number following by the word chars (e.g. 3.4chars) that sets the height of the row to the given number of characters.""" return self.tk.split(self.tk.call( diff --git a/Lib/turtle.py b/Lib/turtle.py --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -857,8 +857,8 @@ class Terminator (Exception): """Will be raised in TurtleScreen.update, if _RUNNING becomes False. - Thus stops execution of turtle graphics script. Main purpose: use in - in the Demo-Viewer turtle.Demo.py. + This stops execution of a turtle graphics script. + Main purpose: use in the Demo-Viewer turtle.Demo.py. """ pass -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 23:00:13 2013 From: python-checkins at python.org (terry.reedy) Date: Mon, 11 Mar 2013 23:00:13 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_3=2E2=2C_issue_=2317047=3A_remove_doubled_words_found_in?= =?utf-8?q?_2=2E7_to?= Message-ID: <3ZPtXY1RnyzRld@mail.python.org> http://hg.python.org/cpython/rev/0547f89aa620 changeset: 82619:0547f89aa620 branch: 3.3 parent: 82615:a42195046e39 parent: 82618:3f5f961262ec user: Terry Jan Reedy date: Mon Mar 11 17:58:27 2013 -0400 summary: Merge 3.2, issue #17047: remove doubled words found in 2.7 to 3.4 Lib/*, as reported by Serhiy Storchaka and Matthew Barnett. files: Lib/_pyio.py | 2 +- Lib/concurrent/futures/_base.py | 2 +- Lib/distutils/command/install.py | 4 +- Lib/distutils/tests/test_install.py | 2 +- Lib/ftplib.py | 4 +- Lib/idlelib/extend.txt | 4 +- Lib/idlelib/rpc.py | 2 +- Lib/lib2to3/pgen2/grammar.py | 4 +- Lib/msilib/__init__.py | 2 +- Lib/test/test_descrtut.py | 2 +- Lib/test/test_socket.py | 2 +- Lib/tkinter/tix.py | 44 ++++++++-------- Lib/turtle.py | 4 +- 13 files changed, 40 insertions(+), 38 deletions(-) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -303,7 +303,7 @@ def seek(self, pos, whence=0): """Change stream position. - Change the stream position to byte offset offset. offset is + Change the stream position to byte offset pos. Argument pos is interpreted relative to the position indicated by whence. Values for whence are ints: diff --git a/Lib/concurrent/futures/_base.py b/Lib/concurrent/futures/_base.py --- a/Lib/concurrent/futures/_base.py +++ b/Lib/concurrent/futures/_base.py @@ -518,7 +518,7 @@ """Returns a iterator equivalent to map(fn, iter). Args: - fn: A callable that will take take as many arguments as there are + fn: A callable that will take as many arguments as there are passed iterables. timeout: The maximum number of seconds to wait. If None, then there is no limit on the wait time. diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py --- a/Lib/distutils/command/install.py +++ b/Lib/distutils/command/install.py @@ -278,8 +278,8 @@ if self.user and (self.prefix or self.exec_prefix or self.home or self.install_base or self.install_platbase): - raise DistutilsOptionError("can't combine user with with prefix/" - "exec_prefix/home or install_(plat)base") + raise DistutilsOptionError("can't combine user with prefix, " + "exec_prefix/home, or install_(plat)base") # Next, stuff that's wrong (or dubious) only on certain platforms. if os.name != "posix": diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py --- a/Lib/distutils/tests/test_install.py +++ b/Lib/distutils/tests/test_install.py @@ -165,7 +165,7 @@ cmd.home = 'home' self.assertRaises(DistutilsOptionError, cmd.finalize_options) - # can't combine user with with prefix/exec_prefix/home or + # can't combine user with prefix/exec_prefix/home or # install_(plat)base cmd.prefix = None cmd.user = 'user' diff --git a/Lib/ftplib.py b/Lib/ftplib.py --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -466,7 +466,7 @@ blocksize: The maximum data size to read from fp and send over the connection at once. [default: 8192] callback: An optional single parameter callable that is called on - on each block of data after it is sent. [default: None] + each block of data after it is sent. [default: None] rest: Passed to transfercmd(). [default: None] Returns: @@ -488,7 +488,7 @@ cmd: A STOR command. fp: A file-like object with a readline() method. callback: An optional single parameter callable that is called on - on each line after it is sent. [default: None] + each line after it is sent. [default: None] Returns: The response code. diff --git a/Lib/idlelib/extend.txt b/Lib/idlelib/extend.txt --- a/Lib/idlelib/extend.txt +++ b/Lib/idlelib/extend.txt @@ -54,7 +54,7 @@ implement. (They are also not required to create keybindings, but in that case there must be empty bindings in cofig-extensions.def) -Here is a complete example example: +Here is a complete example: class ZoomHeight: @@ -72,7 +72,7 @@ "...Do what you want here..." The final piece of the puzzle is the file "config-extensions.def", which is -used to to configure the loading of extensions and to establish key (or, more +used to configure the loading of extensions and to establish key (or, more generally, event) bindings to the virtual events defined in the extensions. See the comments at the top of config-extensions.def for information. It's diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py --- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -2,7 +2,7 @@ For security reasons, GvR requested that Idle's Python execution server process connect to the Idle process, which listens for the connection. Since Idle has -has only one client per server, this was not a limitation. +only one client per server, this was not a limitation. +---------------------------------+ +-------------+ | socketserver.BaseRequestHandler | | SocketIO | diff --git a/Lib/lib2to3/pgen2/grammar.py b/Lib/lib2to3/pgen2/grammar.py --- a/Lib/lib2to3/pgen2/grammar.py +++ b/Lib/lib2to3/pgen2/grammar.py @@ -20,7 +20,7 @@ class Grammar(object): - """Pgen parsing tables tables conversion class. + """Pgen parsing tables conversion class. Once initialized, this class supplies the grammar tables for the parsing engine implemented by parse.py. The parsing engine @@ -45,7 +45,7 @@ these two are each other's inverse. states -- a list of DFAs, where each DFA is a list of - states, each state is is a list of arcs, and each + states, each state is a list of arcs, and each arc is a (i, j) pair where i is a label and j is a state number. The DFA number is the index into this list. (This name is slightly confusing.) diff --git a/Lib/msilib/__init__.py b/Lib/msilib/__init__.py --- a/Lib/msilib/__init__.py +++ b/Lib/msilib/__init__.py @@ -325,7 +325,7 @@ def add_file(self, file, src=None, version=None, language=None): """Add a file to the current component of the directory, starting a new one - one if there is no current component. By default, the file name in the source + if there is no current component. By default, the file name in the source and the file table will be identical. If the src file is specified, it is interpreted relative to the current directory. Optionally, a version and a language can be specified for the entry in the File table.""" diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py --- a/Lib/test/test_descrtut.py +++ b/Lib/test/test_descrtut.py @@ -319,7 +319,7 @@ ... return self.__set(inst, value) Now let's define a class with an attribute x defined by a pair of methods, -getx() and and setx(): +getx() and setx(): >>> class C(object): ... diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -842,7 +842,7 @@ # Try same call with optional protocol omitted port2 = socket.getservbyname(service) eq(port, port2) - # Try udp, but don't barf it it doesn't exist + # Try udp, but don't barf if it doesn't exist try: udpport = socket.getservbyname(service, 'udp') except socket.error: diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py --- a/Lib/tkinter/tix.py +++ b/Lib/tkinter/tix.py @@ -1901,38 +1901,39 @@ self.tk.call(self, 'set', x, y, *args) def size_column(self, index, **kw): - """Queries or sets the size of the column given by - INDEX. INDEX may be any non-negative - integer that gives the position of a given column. + """Queries or sets the size of the column given by + INDEX. INDEX may be any non-negative + integer that gives the position of a given column. INDEX can also be the string "default"; in this case, this command queries or sets the default size of all columns. - When no option-value pair is given, this command returns a tuple - containing the current size setting of the given column. When - option-value pairs are given, the corresponding options of the + When no option-value pair is given, this command returns a tuple + containing the current size setting of the given column. When + option-value pairs are given, the corresponding options of the size setting of the given column are changed. Options may be one - of the follwing: + of the follwing: pad0 pixels Specifies the paddings to the left of a column. pad1 pixels - Specifies the paddings to the right of a column. + Specifies the paddings to the right of a column. size val - Specifies the width of a column . - Val may be: "auto" -- the width of the column is set the - the widest cell in the column; a valid Tk screen distance - unit; or a real number following by the word chars + Specifies the width of a column. Val may be: + "auto" -- the width of the column is set to the + width of the widest cell in the column; + a valid Tk screen distance unit; + or a real number following by the word chars (e.g. 3.4chars) that sets the width of the column to the given number of characters.""" return self.tk.split(self.tk.call(self._w, 'size', 'column', index, *self._options({}, kw))) def size_row(self, index, **kw): - """Queries or sets the size of the row given by - INDEX. INDEX may be any non-negative - integer that gives the position of a given row . + """Queries or sets the size of the row given by + INDEX. INDEX may be any non-negative + integer that gives the position of a given row . INDEX can also be the string "default"; in this case, this command queries or sets the default size of all rows. - When no option-value pair is given, this command returns a list con- - taining the current size setting of the given row . When option-value + When no option-value pair is given, this command returns a list con- + taining the current size setting of the given row . When option-value pairs are given, the corresponding options of the size setting of the given row are changed. Options may be one of the follwing: pad0 pixels @@ -1940,10 +1941,11 @@ pad1 pixels Specifies the paddings to the bottom of a row. size val - Specifies the height of a row. - Val may be: "auto" -- the height of the row is set the - the highest cell in the row; a valid Tk screen distance - unit; or a real number following by the word chars + Specifies the height of a row. Val may be: + "auto" -- the height of the row is set to the + height of the highest cell in the row; + a valid Tk screen distance unit; + or a real number following by the word chars (e.g. 3.4chars) that sets the height of the row to the given number of characters.""" return self.tk.split(self.tk.call( diff --git a/Lib/turtle.py b/Lib/turtle.py --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -856,8 +856,8 @@ class Terminator (Exception): """Will be raised in TurtleScreen.update, if _RUNNING becomes False. - Thus stops execution of turtle graphics script. Main purpose: use in - in the Demo-Viewer turtle.Demo.py. + This stops execution of a turtle graphics script. + Main purpose: use in the Demo-Viewer turtle.Demo.py. """ pass -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 23:00:14 2013 From: python-checkins at python.org (terry.reedy) Date: Mon, 11 Mar 2013 23:00:14 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_3=2E3=2C_issue_=2317047=3A_remove_doubled_words_fo?= =?utf-8?q?und_in_2=2E7_to?= Message-ID: <3ZPtXZ5rVyzRld@mail.python.org> http://hg.python.org/cpython/rev/01aa93888917 changeset: 82620:01aa93888917 parent: 82616:4bd13f45d3a2 parent: 82619:0547f89aa620 user: Terry Jan Reedy date: Mon Mar 11 17:59:07 2013 -0400 summary: Merge 3.3, issue #17047: remove doubled words found in 2.7 to 3.4 Lib/*, as reported by Serhiy Storchaka and Matthew Barnett. files: Lib/_pyio.py | 2 +- Lib/concurrent/futures/_base.py | 2 +- Lib/distutils/command/install.py | 4 +- Lib/distutils/tests/test_install.py | 2 +- Lib/ftplib.py | 4 +- Lib/idlelib/extend.txt | 4 +- Lib/idlelib/rpc.py | 2 +- Lib/lib2to3/pgen2/grammar.py | 4 +- Lib/msilib/__init__.py | 2 +- Lib/test/test_descrtut.py | 2 +- Lib/test/test_socket.py | 2 +- Lib/tkinter/tix.py | 44 ++++++++-------- Lib/turtle.py | 4 +- 13 files changed, 40 insertions(+), 38 deletions(-) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -303,7 +303,7 @@ def seek(self, pos, whence=0): """Change stream position. - Change the stream position to byte offset offset. offset is + Change the stream position to byte offset pos. Argument pos is interpreted relative to the position indicated by whence. Values for whence are ints: diff --git a/Lib/concurrent/futures/_base.py b/Lib/concurrent/futures/_base.py --- a/Lib/concurrent/futures/_base.py +++ b/Lib/concurrent/futures/_base.py @@ -517,7 +517,7 @@ """Returns a iterator equivalent to map(fn, iter). Args: - fn: A callable that will take take as many arguments as there are + fn: A callable that will take as many arguments as there are passed iterables. timeout: The maximum number of seconds to wait. If None, then there is no limit on the wait time. diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py --- a/Lib/distutils/command/install.py +++ b/Lib/distutils/command/install.py @@ -263,8 +263,8 @@ if self.user and (self.prefix or self.exec_prefix or self.home or self.install_base or self.install_platbase): - raise DistutilsOptionError("can't combine user with with prefix/" - "exec_prefix/home or install_(plat)base") + raise DistutilsOptionError("can't combine user with prefix, " + "exec_prefix/home, or install_(plat)base") # Next, stuff that's wrong (or dubious) only on certain platforms. if os.name != "posix": diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py --- a/Lib/distutils/tests/test_install.py +++ b/Lib/distutils/tests/test_install.py @@ -165,7 +165,7 @@ cmd.home = 'home' self.assertRaises(DistutilsOptionError, cmd.finalize_options) - # can't combine user with with prefix/exec_prefix/home or + # can't combine user with prefix/exec_prefix/home or # install_(plat)base cmd.prefix = None cmd.user = 'user' diff --git a/Lib/ftplib.py b/Lib/ftplib.py --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -486,7 +486,7 @@ blocksize: The maximum data size to read from fp and send over the connection at once. [default: 8192] callback: An optional single parameter callable that is called on - on each block of data after it is sent. [default: None] + each block of data after it is sent. [default: None] rest: Passed to transfercmd(). [default: None] Returns: @@ -513,7 +513,7 @@ cmd: A STOR command. fp: A file-like object with a readline() method. callback: An optional single parameter callable that is called on - on each line after it is sent. [default: None] + each line after it is sent. [default: None] Returns: The response code. diff --git a/Lib/idlelib/extend.txt b/Lib/idlelib/extend.txt --- a/Lib/idlelib/extend.txt +++ b/Lib/idlelib/extend.txt @@ -54,7 +54,7 @@ implement. (They are also not required to create keybindings, but in that case there must be empty bindings in cofig-extensions.def) -Here is a complete example example: +Here is a complete example: class ZoomHeight: @@ -72,7 +72,7 @@ "...Do what you want here..." The final piece of the puzzle is the file "config-extensions.def", which is -used to to configure the loading of extensions and to establish key (or, more +used to configure the loading of extensions and to establish key (or, more generally, event) bindings to the virtual events defined in the extensions. See the comments at the top of config-extensions.def for information. It's diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py --- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -2,7 +2,7 @@ For security reasons, GvR requested that Idle's Python execution server process connect to the Idle process, which listens for the connection. Since Idle has -has only one client per server, this was not a limitation. +only one client per server, this was not a limitation. +---------------------------------+ +-------------+ | socketserver.BaseRequestHandler | | SocketIO | diff --git a/Lib/lib2to3/pgen2/grammar.py b/Lib/lib2to3/pgen2/grammar.py --- a/Lib/lib2to3/pgen2/grammar.py +++ b/Lib/lib2to3/pgen2/grammar.py @@ -20,7 +20,7 @@ class Grammar(object): - """Pgen parsing tables tables conversion class. + """Pgen parsing tables conversion class. Once initialized, this class supplies the grammar tables for the parsing engine implemented by parse.py. The parsing engine @@ -45,7 +45,7 @@ these two are each other's inverse. states -- a list of DFAs, where each DFA is a list of - states, each state is is a list of arcs, and each + states, each state is a list of arcs, and each arc is a (i, j) pair where i is a label and j is a state number. The DFA number is the index into this list. (This name is slightly confusing.) diff --git a/Lib/msilib/__init__.py b/Lib/msilib/__init__.py --- a/Lib/msilib/__init__.py +++ b/Lib/msilib/__init__.py @@ -325,7 +325,7 @@ def add_file(self, file, src=None, version=None, language=None): """Add a file to the current component of the directory, starting a new one - one if there is no current component. By default, the file name in the source + if there is no current component. By default, the file name in the source and the file table will be identical. If the src file is specified, it is interpreted relative to the current directory. Optionally, a version and a language can be specified for the entry in the File table.""" diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py --- a/Lib/test/test_descrtut.py +++ b/Lib/test/test_descrtut.py @@ -319,7 +319,7 @@ ... return self.__set(inst, value) Now let's define a class with an attribute x defined by a pair of methods, -getx() and and setx(): +getx() and setx(): >>> class C(object): ... diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -872,7 +872,7 @@ # Try same call with optional protocol omitted port2 = socket.getservbyname(service) eq(port, port2) - # Try udp, but don't barf it it doesn't exist + # Try udp, but don't barf if it doesn't exist try: udpport = socket.getservbyname(service, 'udp') except OSError: diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py --- a/Lib/tkinter/tix.py +++ b/Lib/tkinter/tix.py @@ -1901,38 +1901,39 @@ self.tk.call(self, 'set', x, y, *args) def size_column(self, index, **kw): - """Queries or sets the size of the column given by - INDEX. INDEX may be any non-negative - integer that gives the position of a given column. + """Queries or sets the size of the column given by + INDEX. INDEX may be any non-negative + integer that gives the position of a given column. INDEX can also be the string "default"; in this case, this command queries or sets the default size of all columns. - When no option-value pair is given, this command returns a tuple - containing the current size setting of the given column. When - option-value pairs are given, the corresponding options of the + When no option-value pair is given, this command returns a tuple + containing the current size setting of the given column. When + option-value pairs are given, the corresponding options of the size setting of the given column are changed. Options may be one - of the follwing: + of the follwing: pad0 pixels Specifies the paddings to the left of a column. pad1 pixels - Specifies the paddings to the right of a column. + Specifies the paddings to the right of a column. size val - Specifies the width of a column . - Val may be: "auto" -- the width of the column is set the - the widest cell in the column; a valid Tk screen distance - unit; or a real number following by the word chars + Specifies the width of a column. Val may be: + "auto" -- the width of the column is set to the + width of the widest cell in the column; + a valid Tk screen distance unit; + or a real number following by the word chars (e.g. 3.4chars) that sets the width of the column to the given number of characters.""" return self.tk.split(self.tk.call(self._w, 'size', 'column', index, *self._options({}, kw))) def size_row(self, index, **kw): - """Queries or sets the size of the row given by - INDEX. INDEX may be any non-negative - integer that gives the position of a given row . + """Queries or sets the size of the row given by + INDEX. INDEX may be any non-negative + integer that gives the position of a given row . INDEX can also be the string "default"; in this case, this command queries or sets the default size of all rows. - When no option-value pair is given, this command returns a list con- - taining the current size setting of the given row . When option-value + When no option-value pair is given, this command returns a list con- + taining the current size setting of the given row . When option-value pairs are given, the corresponding options of the size setting of the given row are changed. Options may be one of the follwing: pad0 pixels @@ -1940,10 +1941,11 @@ pad1 pixels Specifies the paddings to the bottom of a row. size val - Specifies the height of a row. - Val may be: "auto" -- the height of the row is set the - the highest cell in the row; a valid Tk screen distance - unit; or a real number following by the word chars + Specifies the height of a row. Val may be: + "auto" -- the height of the row is set to the + height of the highest cell in the row; + a valid Tk screen distance unit; + or a real number following by the word chars (e.g. 3.4chars) that sets the height of the row to the given number of characters.""" return self.tk.split(self.tk.call( diff --git a/Lib/turtle.py b/Lib/turtle.py --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -856,8 +856,8 @@ class Terminator (Exception): """Will be raised in TurtleScreen.update, if _RUNNING becomes False. - Thus stops execution of turtle graphics script. Main purpose: use in - in the Demo-Viewer turtle.Demo.py. + This stops execution of a turtle graphics script. + Main purpose: use in the Demo-Viewer turtle.Demo.py. """ pass -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 23:40:13 2013 From: python-checkins at python.org (terry.reedy) Date: Mon, 11 Mar 2013 23:40:13 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE3MDQ3?= =?utf-8?q?=3A_remove_doubled_words_added_in_3=2E3?= Message-ID: <3ZPvQj6jhWzRYr@mail.python.org> http://hg.python.org/cpython/rev/e9ada209b67f changeset: 82621:e9ada209b67f branch: 3.3 parent: 82619:0547f89aa620 user: Terry Jan Reedy date: Mon Mar 11 18:34:00 2013 -0400 summary: Issue #17047: remove doubled words added in 3.3 as reported by Serhiy Storchaka and Matthew Barnett. files: Doc/library/email.policy.rst | 2 +- Doc/library/ipaddress.rst | 6 +++--- Doc/library/stdtypes.rst | 2 +- Doc/library/unittest.mock.rst | 2 +- Lib/email/_encoded_words.py | 2 +- Lib/email/_header_value_parser.py | 2 +- Lib/email/mime/text.py | 2 +- Lib/email/policy.py | 2 +- Lib/test/test_decimal.py | 2 +- Lib/tkinter/__init__.py | 2 +- Lib/unittest/mock.py | 2 +- Modules/socketmodule.c | 2 +- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Doc/library/email.policy.rst b/Doc/library/email.policy.rst --- a/Doc/library/email.policy.rst +++ b/Doc/library/email.policy.rst @@ -327,7 +327,7 @@ each resulting line to the ``max_line_length``. If ``cte_type`` is ``7bit``, non-ascii binary data is CTE encoded using the ``unknown-8bit`` charset. Otherwise the original source header is used, with its existing - line breaks and and any (RFC invalid) binary data it may contain. + line breaks and any (RFC invalid) binary data it may contain. .. note:: diff --git a/Doc/library/ipaddress.rst b/Doc/library/ipaddress.rst --- a/Doc/library/ipaddress.rst +++ b/Doc/library/ipaddress.rst @@ -393,7 +393,7 @@ .. attribute:: is_link_local These attributes are true for the network as a whole if they are true - true for both the network address and the broadcast address + for both the network address and the broadcast address .. attribute:: network_address @@ -452,7 +452,7 @@ .. method:: overlaps(other) ``True`` if this network is partly or wholly contained in *other* or - or *other* is wholly contained in this network. + *other* is wholly contained in this network. .. method:: address_exclude(network) @@ -582,7 +582,7 @@ .. attribute:: is_site_local These attribute is true for the network as a whole if it is true - true for both the network address and the broadcast address + for both the network address and the broadcast address Operators diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2637,7 +2637,7 @@ >>> z.nbytes 48 - Cast 1D/unsigned char to to 2D/unsigned long:: + Cast 1D/unsigned char to 2D/unsigned long:: >>> buf = struct.pack("L"*6, *list(range(6))) >>> x = memoryview(buf) diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -988,7 +988,7 @@ you pass in `create=True`, and the attribute doesn't exist, patch will create the attribute for you when the patched function is called, and delete it again afterwards. This is useful for writing tests against - attributes that your production code creates at runtime. It is off by by + attributes that your production code creates at runtime. It is off by default because it can be dangerous. With it switched on you can write passing tests against APIs that don't actually exist! diff --git a/Lib/email/_encoded_words.py b/Lib/email/_encoded_words.py --- a/Lib/email/_encoded_words.py +++ b/Lib/email/_encoded_words.py @@ -14,7 +14,7 @@ # cte (Content Transfer Encoding) is either 'q' or 'b' (ignoring case). In # theory other letters could be used for other encodings, but in practice this # (almost?) never happens. There could be a public API for adding entries -# to to the CTE tables, but YAGNI for now. 'q' is Quoted Printable, 'b' is +# to the CTE tables, but YAGNI for now. 'q' is Quoted Printable, 'b' is # Base64. The meaning of encoded_string should be obvious. 'lang' is optional # as indicated by the brackets (they are not part of the syntax) but is almost # never encountered in practice. diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py --- a/Lib/email/_header_value_parser.py +++ b/Lib/email/_header_value_parser.py @@ -1864,7 +1864,7 @@ """ dtext = / obs-dtext obs-dtext = obs-NO-WS-CTL / quoted-pair - We allow anything except the excluded characters, but but if we find any + We allow anything except the excluded characters, but if we find any ASCII other than the RFC defined printable ASCII an NonPrintableDefect is added to the token's defects list. Quoted pairs are converted to their unquoted values, so what is returned is a ptext token, in this case a diff --git a/Lib/email/mime/text.py b/Lib/email/mime/text.py --- a/Lib/email/mime/text.py +++ b/Lib/email/mime/text.py @@ -26,7 +26,7 @@ Content-Transfer-Encoding header will also be set. """ - # If no _charset was specified, check to see see if there are non-ascii + # If no _charset was specified, check to see if there are non-ascii # characters present. If not, use 'us-ascii', otherwise use utf-8. # XXX: This can be removed once #7304 is fixed. if _charset is None: diff --git a/Lib/email/policy.py b/Lib/email/policy.py --- a/Lib/email/policy.py +++ b/Lib/email/policy.py @@ -23,7 +23,7 @@ """+ PROVISIONAL - The API extensions enabled by this this policy are currently provisional. + The API extensions enabled by this policy are currently provisional. Refer to the documentation for details. This policy adds new header parsing and folding algorithms. Instead of diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -4492,7 +4492,7 @@ x = Decimal(2**578) ** Decimal("-0.5") def test_py_immutability_operations(self): - # Do operations and check that it didn't change change internal objects. + # Do operations and check that it didn't change internal objects. Decimal = P.Decimal DefaultContext = P.DefaultContext setcontext = P.setcontext diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -3152,7 +3152,7 @@ def peer_create(self, newPathName, cnf={}, **kw): # new in Tk 8.5 """Creates a peer text widget with the given newPathName, and any optional standard configuration options. By default the peer will - have the same start and and end line as the parent widget, but + have the same start and end line as the parent widget, but these can be overriden with the standard configuration options.""" self.tk.call(self._w, 'peer', 'create', newPathName, *self._options(cnf, kw)) diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -1417,7 +1417,7 @@ you pass in `create=True`, and the attribute doesn't exist, patch will create the attribute for you when the patched function is called, and delete it again afterwards. This is useful for writing tests against - attributes that your production code creates at runtime. It is off by by + attributes that your production code creates at runtime. It is off by default because it can be dangerous. With it switched on you can write passing tests against APIs that don't actually exist! diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -3609,7 +3609,7 @@ the next header, it checks its (uninitialized) cmsg_len member to see if the "message" fits in the buffer, and returns NULL if it doesn't. Zero-filling the buffer - ensures that that doesn't happen. */ + ensures that this doesn't happen. */ memset(controlbuf, 0, controllen); for (i = 0; i < ncmsgbufs; i++) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 23:40:15 2013 From: python-checkins at python.org (terry.reedy) Date: Mon, 11 Mar 2013 23:40:15 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E3=2C_issue_=2317047=3A_remove_doubled_wor?= =?utf-8?q?ds_added_in_3=2E3=2C?= Message-ID: <3ZPvQl5PjRzRkk@mail.python.org> http://hg.python.org/cpython/rev/908d45fdbecd changeset: 82622:908d45fdbecd parent: 82620:01aa93888917 parent: 82621:e9ada209b67f user: Terry Jan Reedy date: Mon Mar 11 18:36:38 2013 -0400 summary: Merge with 3.3, issue #17047: remove doubled words added in 3.3, as reported by Serhiy Storchaka and Matthew Barnett. files: Doc/library/email.policy.rst | 2 +- Doc/library/ipaddress.rst | 6 +++--- Doc/library/stdtypes.rst | 2 +- Doc/library/unittest.mock.rst | 2 +- Lib/email/_encoded_words.py | 2 +- Lib/email/_header_value_parser.py | 2 +- Lib/email/mime/text.py | 2 +- Lib/email/policy.py | 2 +- Lib/test/test_decimal.py | 2 +- Lib/tkinter/__init__.py | 2 +- Lib/unittest/mock.py | 2 +- Modules/socketmodule.c | 2 +- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Doc/library/email.policy.rst b/Doc/library/email.policy.rst --- a/Doc/library/email.policy.rst +++ b/Doc/library/email.policy.rst @@ -327,7 +327,7 @@ each resulting line to the ``max_line_length``. If ``cte_type`` is ``7bit``, non-ascii binary data is CTE encoded using the ``unknown-8bit`` charset. Otherwise the original source header is used, with its existing - line breaks and and any (RFC invalid) binary data it may contain. + line breaks and any (RFC invalid) binary data it may contain. .. note:: diff --git a/Doc/library/ipaddress.rst b/Doc/library/ipaddress.rst --- a/Doc/library/ipaddress.rst +++ b/Doc/library/ipaddress.rst @@ -393,7 +393,7 @@ .. attribute:: is_link_local These attributes are true for the network as a whole if they are true - true for both the network address and the broadcast address + for both the network address and the broadcast address .. attribute:: network_address @@ -452,7 +452,7 @@ .. method:: overlaps(other) ``True`` if this network is partly or wholly contained in *other* or - or *other* is wholly contained in this network. + *other* is wholly contained in this network. .. method:: address_exclude(network) @@ -582,7 +582,7 @@ .. attribute:: is_site_local These attribute is true for the network as a whole if it is true - true for both the network address and the broadcast address + for both the network address and the broadcast address Operators diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2637,7 +2637,7 @@ >>> z.nbytes 48 - Cast 1D/unsigned char to to 2D/unsigned long:: + Cast 1D/unsigned char to 2D/unsigned long:: >>> buf = struct.pack("L"*6, *list(range(6))) >>> x = memoryview(buf) diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -1008,7 +1008,7 @@ you pass in `create=True`, and the attribute doesn't exist, patch will create the attribute for you when the patched function is called, and delete it again afterwards. This is useful for writing tests against - attributes that your production code creates at runtime. It is off by by + attributes that your production code creates at runtime. It is off by default because it can be dangerous. With it switched on you can write passing tests against APIs that don't actually exist! diff --git a/Lib/email/_encoded_words.py b/Lib/email/_encoded_words.py --- a/Lib/email/_encoded_words.py +++ b/Lib/email/_encoded_words.py @@ -14,7 +14,7 @@ # cte (Content Transfer Encoding) is either 'q' or 'b' (ignoring case). In # theory other letters could be used for other encodings, but in practice this # (almost?) never happens. There could be a public API for adding entries -# to to the CTE tables, but YAGNI for now. 'q' is Quoted Printable, 'b' is +# to the CTE tables, but YAGNI for now. 'q' is Quoted Printable, 'b' is # Base64. The meaning of encoded_string should be obvious. 'lang' is optional # as indicated by the brackets (they are not part of the syntax) but is almost # never encountered in practice. diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py --- a/Lib/email/_header_value_parser.py +++ b/Lib/email/_header_value_parser.py @@ -1863,7 +1863,7 @@ """ dtext = / obs-dtext obs-dtext = obs-NO-WS-CTL / quoted-pair - We allow anything except the excluded characters, but but if we find any + We allow anything except the excluded characters, but if we find any ASCII other than the RFC defined printable ASCII an NonPrintableDefect is added to the token's defects list. Quoted pairs are converted to their unquoted values, so what is returned is a ptext token, in this case a diff --git a/Lib/email/mime/text.py b/Lib/email/mime/text.py --- a/Lib/email/mime/text.py +++ b/Lib/email/mime/text.py @@ -26,7 +26,7 @@ Content-Transfer-Encoding header will also be set. """ - # If no _charset was specified, check to see see if there are non-ascii + # If no _charset was specified, check to see if there are non-ascii # characters present. If not, use 'us-ascii', otherwise use utf-8. # XXX: This can be removed once #7304 is fixed. if _charset is None: diff --git a/Lib/email/policy.py b/Lib/email/policy.py --- a/Lib/email/policy.py +++ b/Lib/email/policy.py @@ -23,7 +23,7 @@ """+ PROVISIONAL - The API extensions enabled by this this policy are currently provisional. + The API extensions enabled by this policy are currently provisional. Refer to the documentation for details. This policy adds new header parsing and folding algorithms. Instead of diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -4492,7 +4492,7 @@ x = Decimal(2**578) ** Decimal("-0.5") def test_py_immutability_operations(self): - # Do operations and check that it didn't change change internal objects. + # Do operations and check that it didn't change internal objects. Decimal = P.Decimal DefaultContext = P.DefaultContext setcontext = P.setcontext diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -3113,7 +3113,7 @@ def peer_create(self, newPathName, cnf={}, **kw): # new in Tk 8.5 """Creates a peer text widget with the given newPathName, and any optional standard configuration options. By default the peer will - have the same start and and end line as the parent widget, but + have the same start and end line as the parent widget, but these can be overriden with the standard configuration options.""" self.tk.call(self._w, 'peer', 'create', newPathName, *self._options(cnf, kw)) diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -1444,7 +1444,7 @@ you pass in `create=True`, and the attribute doesn't exist, patch will create the attribute for you when the patched function is called, and delete it again afterwards. This is useful for writing tests against - attributes that your production code creates at runtime. It is off by by + attributes that your production code creates at runtime. It is off by default because it can be dangerous. With it switched on you can write passing tests against APIs that don't actually exist! diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -3546,7 +3546,7 @@ the next header, it checks its (uninitialized) cmsg_len member to see if the "message" fits in the buffer, and returns NULL if it doesn't. Zero-filling the buffer - ensures that that doesn't happen. */ + ensures that this doesn't happen. */ memset(controlbuf, 0, controllen); for (i = 0; i < ncmsgbufs; i++) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 11 23:40:17 2013 From: python-checkins at python.org (terry.reedy) Date: Mon, 11 Mar 2013 23:40:17 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317047=3A_remove_d?= =?utf-8?q?oubled_words_added_in_3=2E4=2C?= Message-ID: <3ZPvQn1VCjzRty@mail.python.org> http://hg.python.org/cpython/rev/0a26a8b13193 changeset: 82623:0a26a8b13193 user: Terry Jan Reedy date: Mon Mar 11 18:38:13 2013 -0400 summary: Issue #17047: remove doubled words added in 3.4, as reported by Serhiy Storchaka and Matthew Barnett. files: Doc/library/ssl.rst | 2 +- Include/pyport.h | 2 +- Lib/argparse.py | 2 +- Misc/HISTORY | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -824,7 +824,7 @@ will not contain return meaningful values nor can they be called safely. The *server_name_callback* function must return ``None`` to allow the - the TLS negotiation to continue. If a TLS failure is required, a constant + TLS negotiation to continue. If a TLS failure is required, a constant :const:`ALERT_DESCRIPTION_* ` can be returned. Other return values will result in a TLS fatal error with :const:`ALERT_DESCRIPTION_INTERNAL_ERROR`. diff --git a/Include/pyport.h b/Include/pyport.h --- a/Include/pyport.h +++ b/Include/pyport.h @@ -881,7 +881,7 @@ /* * Convenient macros to deal with endianness of the platform. WORDS_BIGENDIAN is * detected by configure and defined in pyconfig.h. The code in pyconfig.h - * also also takes care of Apple's universal builds. + * also takes care of Apple's universal builds. */ #ifdef WORDS_BIGENDIAN diff --git a/Lib/argparse.py b/Lib/argparse.py --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -1141,7 +1141,7 @@ - bufsize -- The file's desired buffer size. Accepts the same values as the builtin open() function. - encoding -- The file's encoding. Accepts the same values as the - the builtin open() function. + builtin open() function. - errors -- A string indicating how encoding and decoding errors are to be handled. Accepts the same value as the builtin open() function. """ diff --git a/Misc/HISTORY b/Misc/HISTORY --- a/Misc/HISTORY +++ b/Misc/HISTORY @@ -778,7 +778,7 @@ - Issue #14626: Large refactoring of functions / parameters in the os module. Many functions now support "dir_fd" and "follow_symlinks" parameters; - some also support accepting an open file descriptor in place of of a path + some also support accepting an open file descriptor in place of a path string. Added os.support_* collections as LBYL helpers. Removed many functions only previously seen in 3.3 alpha releases (often starting with "f" or "l", or ending with "at"). Originally suggested by Serhiy Storchaka; @@ -1412,7 +1412,7 @@ - Issue #14399: zipfile now recognizes that the archive has been modified even if only the comment is changed. In addition, the TypeError that results from - trying to set a non-binary value as a comment is now now raised at the time + trying to set a non-binary value as a comment is now raised at the time the comment is set rather than at the time the zipfile is written. - trace.CoverageResults.is_ignored_filename() now ignores any name that starts @@ -3052,7 +3052,7 @@ check or set the MACOSX_DEPLOYMENT_TARGET environment variable for the interpreter process. This could cause failures in non-Distutils subprocesses and was unreliable since tests or user programs could modify the interpreter - environment after Distutils set it. Instead, have Distutils set the the + environment after Distutils set it. Instead, have Distutils set the deployment target only in the environment of each build subprocess. It is still possible to globally override the default by setting MACOSX_DEPLOYMENT_TARGET before launching the interpreter; its value must be -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 12 04:06:34 2013 From: python-checkins at python.org (daniel.holth) Date: Tue, 12 Mar 2013 04:06:34 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_PEP_425=3A_enlarge_FAQ?= Message-ID: <3ZQ1L225MnzQP9@mail.python.org> http://hg.python.org/peps/rev/c842f2fd7170 changeset: 4793:c842f2fd7170 user: Daniel Holth date: Mon Mar 11 23:06:02 2013 -0400 summary: PEP 425: enlarge FAQ files: pep-0425.txt | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/pep-0425.txt b/pep-0425.txt --- a/pep-0425.txt +++ b/pep-0425.txt @@ -259,6 +259,14 @@ too, but with longer tags. Recall that all "pure Python" built distributions just use 'py'. +Why is the ABI tag (the second tag) sometimes "none" in the reference implementation? + Since Python 2 does not have an easy way to get to the SOABI + (the concept comes from newer versions of Python 3) the reference + implentation at the time of writing guesses "none". Ideally it + would detect "py27(d|m|u)" analagous to newer versions of Python, + but in the meantime "none" is a good enough way to say "don't know". + + References ========== @@ -275,7 +283,7 @@ ================ The author thanks Paul Moore, Nick Coghlan, Mark Abramowitz, and -Mr. Michele Lacchia for their valuable advice and help with this effort. +Mr. Michele Lacchia for their valuable help and advice. Copyright ========= -- Repository URL: http://hg.python.org/peps From solipsis at pitrou.net Tue Mar 12 05:58:54 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 12 Mar 2013 05:58:54 +0100 Subject: [Python-checkins] Daily reference leaks (0a26a8b13193): sum=2 Message-ID: results for 0a26a8b13193 on branch "default" -------------------------------------------- test_support leaked [0, -1, 1] references, sum=0 test_support leaked [0, -1, 3] memory blocks, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogE47LGT', '-x'] From python-checkins at python.org Tue Mar 12 06:50:24 2013 From: python-checkins at python.org (terry.reedy) Date: Tue, 12 Mar 2013 06:50:24 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE0NzA3?= =?utf-8?q?=3A_add_news_entry?= Message-ID: <3ZQ4z44QVLzRXr@mail.python.org> http://hg.python.org/cpython/rev/c162e2ff15bd changeset: 82624:c162e2ff15bd branch: 2.7 parent: 82617:cd0191a9b5c9 user: Terry Jan Reedy date: Tue Mar 12 01:26:28 2013 -0400 summary: Issue #14707: add news entry files: Misc/NEWS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -944,6 +944,9 @@ Documentation ------------- +- Issue #14707: remove doubled words in docs and docstrings + reported by Serhiy Storchaka and Matthew Barnett. + - Issue #16406: combine the pages for uploading and registering to PyPI. - Issue #16403: Document how distutils uses the maintainer field in -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 12 06:51:05 2013 From: python-checkins at python.org (ezio.melotti) Date: Tue, 12 Mar 2013 06:51:05 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzE3MDY2OiB0ZXN0?= =?utf-8?q?=5Frobotparser_now_works_with_unittest_test_discovery=2E__Patch?= =?utf-8?q?_by?= Message-ID: <3ZQ4zs2CstzRXr@mail.python.org> http://hg.python.org/cpython/rev/fa051c6276a0 changeset: 82625:fa051c6276a0 branch: 3.3 parent: 82621:e9ada209b67f user: Ezio Melotti date: Tue Mar 12 07:49:12 2013 +0200 summary: #17066: test_robotparser now works with unittest test discovery. Patch by Zachary Ware. files: Lib/test/test_robotparser.py | 16 ++++++++++------ Misc/NEWS | 3 +++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_robotparser.py b/Lib/test/test_robotparser.py --- a/Lib/test/test_robotparser.py +++ b/Lib/test/test_robotparser.py @@ -6,7 +6,10 @@ from test import support class RobotTestCase(unittest.TestCase): - def __init__(self, index, parser, url, good, agent): + def __init__(self, index=None, parser=None, url=None, good=None, agent=None): + # workaround to make unittest discovery work (see #17066) + if not isinstance(index, int): + return unittest.TestCase.__init__(self) if good: self.str = "RobotTest(%d, good, %s)" % (index, url) @@ -269,10 +272,11 @@ self.assertTrue( parser.can_fetch("*", "http://www.python.org/robots.txt")) -def test_main(): - support.run_unittest(NetworkTestCase) - support.run_unittest(tests) +def load_tests(loader, suite, pattern): + suite = unittest.makeSuite(NetworkTestCase) + suite.addTest(tests) + return suite if __name__=='__main__': - support.verbose = 1 - test_main() + support.use_resources = ['network'] + unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -662,6 +662,9 @@ - Issue #15539: Added regression tests for Tools/scripts/pindent.py. +- Issue #17066: test_robotparser now works with unittest test discovery. + Patch by Zachary Ware. + - Issue #17334: test_index now works with unittest test discovery. Patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 12 06:51:06 2013 From: python-checkins at python.org (ezio.melotti) Date: Tue, 12 Mar 2013 06:51:06 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3MDY2OiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZQ4zt4tkPzRgm@mail.python.org> http://hg.python.org/cpython/rev/8fdce849d0b3 changeset: 82626:8fdce849d0b3 parent: 82623:0a26a8b13193 parent: 82625:fa051c6276a0 user: Ezio Melotti date: Tue Mar 12 07:50:53 2013 +0200 summary: #17066: merge with 3.3. files: Lib/test/test_robotparser.py | 16 ++++++++++------ Misc/NEWS | 3 +++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_robotparser.py b/Lib/test/test_robotparser.py --- a/Lib/test/test_robotparser.py +++ b/Lib/test/test_robotparser.py @@ -6,7 +6,10 @@ from test import support class RobotTestCase(unittest.TestCase): - def __init__(self, index, parser, url, good, agent): + def __init__(self, index=None, parser=None, url=None, good=None, agent=None): + # workaround to make unittest discovery work (see #17066) + if not isinstance(index, int): + return unittest.TestCase.__init__(self) if good: self.str = "RobotTest(%d, good, %s)" % (index, url) @@ -269,10 +272,11 @@ self.assertTrue( parser.can_fetch("*", "http://www.python.org/robots.txt")) -def test_main(): - support.run_unittest(NetworkTestCase) - support.run_unittest(tests) +def load_tests(loader, suite, pattern): + suite = unittest.makeSuite(NetworkTestCase) + suite.addTest(tests) + return suite if __name__=='__main__': - support.verbose = 1 - test_main() + support.use_resources = ['network'] + unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -934,6 +934,9 @@ - Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host. +- Issue #17066: test_robotparser now works with unittest test discovery. + Patch by Zachary Ware. + - Issue #17334: test_index now works with unittest test discovery. Patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From tjreedy at udel.edu Tue Mar 12 07:14:58 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Tue, 12 Mar 2013 02:14:58 -0400 Subject: [Python-checkins] CANNOT Patch 3.x NEWS [was cpython (2.7): Issue #14707: add news entry\ In-Reply-To: <3ZQ4z44QVLzRXr@mail.python.org> References: <3ZQ4z44QVLzRXr@mail.python.org> Message-ID: <513EC7E2.90400@udel.edu> On 3/12/2013 1:50 AM, terry.reedy wrote: > http://hg.python.org/cpython/rev/c162e2ff15bd > changeset: 82624:c162e2ff15bd > branch: 2.7 > parent: 82617:cd0191a9b5c9 > user: Terry Jan Reedy > date: Tue Mar 12 01:26:28 2013 -0400 > summary: > Issue #14707: add news entry > > files: > Misc/NEWS | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > > diff --git a/Misc/NEWS b/Misc/NEWS > --- a/Misc/NEWS > +++ b/Misc/NEWS > @@ -944,6 +944,9 @@ > Documentation > ------------- > > +- Issue #14707: remove doubled words in docs and docstrings > + reported by Serhiy Storchaka and Matthew Barnett. > + > - Issue #16406: combine the pages for uploading and registering to PyPI. > > - Issue #16403: Document how distutils uses the maintainer field in The above was easy. When I tried to transplant this patch to 3.2, export and import, or directly edit 3.2 NEWS with Notepad++ or IDLE, hg makes a 319kb patch that deletes and add the entire file in chunks. I did not think I should commit and push that. The failure of transplant and import are perhaps understandable because 3.2 has a gratuitous case difference with /combine/Combine/. - Issue #16406: Combine the pages for uploading and registering to PyPI. But the inability to make a proper diff from direct edit is something else. If I add just a single blank line, even that generates a mega patch. Same with 3.3 NEWS. I also tried deleting the file to make hg regenerate from the repository database. Anyone have any idea what the problem is? Has anything changed with hg, windows, line endings and this text file in the last few months? I just pushed patches for about 20 scattered files in Docs, Lib, Modules, and Tools earlier today, so the problem seems to be specific to NEWS. tjr From python-checkins at python.org Tue Mar 12 07:19:45 2013 From: python-checkins at python.org (terry.reedy) Date: Tue, 12 Mar 2013 07:19:45 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fix_issue_numb?= =?utf-8?q?er?= Message-ID: <3ZQ5cx53sXzR5F@mail.python.org> http://hg.python.org/cpython/rev/a1bebf2c33e7 changeset: 82627:a1bebf2c33e7 branch: 2.7 parent: 82624:c162e2ff15bd user: Terry Jan Reedy date: Tue Mar 12 02:19:09 2013 -0400 summary: Fix issue number files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -944,7 +944,7 @@ Documentation ------------- -- Issue #14707: remove doubled words in docs and docstrings +- Issue #17047: remove doubled words in docs and docstrings reported by Serhiy Storchaka and Matthew Barnett. - Issue #16406: combine the pages for uploading and registering to PyPI. -- Repository URL: http://hg.python.org/cpython From tjreedy at udel.edu Tue Mar 12 07:28:11 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Tue, 12 Mar 2013 02:28:11 -0400 Subject: [Python-checkins] CANNOT Patch 3.x NEWS [was cpython (2.7): Issue #14707: add news entry\ In-Reply-To: <513EC7E2.90400@udel.edu> References: <3ZQ4z44QVLzRXr@mail.python.org> <513EC7E2.90400@udel.edu> Message-ID: <513ECAFB.8010908@udel.edu> This should be issue 17047 On 3/12/2013 2:14 AM, Terry Reedy wrote: > On 3/12/2013 1:50 AM, terry.reedy wrote: >> http://hg.python.org/cpython/rev/c162e2ff15bd >> changeset: 82624:c162e2ff15bd >> branch: 2.7 >> parent: 82617:cd0191a9b5c9 >> user: Terry Jan Reedy >> date: Tue Mar 12 01:26:28 2013 -0400 >> summary: >> Issue #14707: add news entry >> >> files: >> Misc/NEWS | 3 +++ >> 1 files changed, 3 insertions(+), 0 deletions(-) >> >> >> diff --git a/Misc/NEWS b/Misc/NEWS >> --- a/Misc/NEWS >> +++ b/Misc/NEWS >> @@ -944,6 +944,9 @@ >> Documentation >> ------------- >> >> +- Issue #14707: remove doubled words in docs and docstrings >> + reported by Serhiy Storchaka and Matthew Barnett. >> + >> - Issue #16406: combine the pages for uploading and registering to >> PyPI. >> >> - Issue #16403: Document how distutils uses the maintainer field in > > The above was easy. When I tried to transplant this patch to 3.2, export > and import, or directly edit 3.2 NEWS with Notepad++ or IDLE, hg makes a > 319kb patch that deletes and add the entire file in chunks. I did not > think I should commit and push that. > > The failure of transplant and import are perhaps understandable because > 3.2 has a gratuitous case difference with /combine/Combine/. > > - Issue #16406: Combine the pages for uploading and registering to PyPI. > > But the inability to make a proper diff from direct edit is something > else. If I add just a single blank line, even that generates a mega > patch. Same with 3.3 NEWS. I also tried deleting the file to make hg > regenerate from the repository database. > > Anyone have any idea what the problem is? Has anything changed with hg, > windows, line endings and this text file in the last few months? I just > pushed patches for about 20 scattered files in Docs, Lib, Modules, and > Tools earlier today, so the problem seems to be specific to NEWS. > > tjr > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins From ezio.melotti at gmail.com Tue Mar 12 07:52:18 2013 From: ezio.melotti at gmail.com (Ezio Melotti) Date: Tue, 12 Mar 2013 08:52:18 +0200 Subject: [Python-checkins] CANNOT Patch 3.x NEWS [was cpython (2.7): Issue #14707: add news entry\ In-Reply-To: <513EC7E2.90400@udel.edu> References: <3ZQ4z44QVLzRXr@mail.python.org> <513EC7E2.90400@udel.edu> Message-ID: Hi, On Tue, Mar 12, 2013 at 8:14 AM, Terry Reedy wrote: > On 3/12/2013 1:50 AM, terry.reedy wrote: >> >> http://hg.python.org/cpython/rev/c162e2ff15bd >> changeset: 82624:c162e2ff15bd >> branch: 2.7 >> parent: 82617:cd0191a9b5c9 >> user: Terry Jan Reedy >> date: Tue Mar 12 01:26:28 2013 -0400 >> summary: >> Issue #14707: add news entry >> >> files: >> Misc/NEWS | 3 +++ >> 1 files changed, 3 insertions(+), 0 deletions(-) >> >> >> diff --git a/Misc/NEWS b/Misc/NEWS >> --- a/Misc/NEWS >> +++ b/Misc/NEWS >> @@ -944,6 +944,9 @@ >> Documentation >> ------------- >> >> +- Issue #14707: remove doubled words in docs and docstrings >> + reported by Serhiy Storchaka and Matthew Barnett. >> + >> - Issue #16406: combine the pages for uploading and registering to PyPI. >> >> - Issue #16403: Document how distutils uses the maintainer field in > > > The above was easy. When I tried to transplant this patch to 3.2, export and > import, or directly edit 3.2 NEWS with Notepad++ or IDLE, hg makes a 319kb > patch that deletes and add the entire file in chunks. I did not think I > should commit and push that. > What are the exact commands you used? Are your clones up to date (i.e. did you do "hg pull" and "hg up" before "hg graft")? If not, you should pull/update. Does "hg heads ." show you more than one head? If so you should do "hg merge". Is your clone "clean" (i.e. does "hg status" show anything as 'M')? If not, you should do "hg revert -ar 3.2" or "hg up -C 3.2". Once your clone is clean you can just edit Misc/NEWS manually since it's easier than trying to graft the 2 changesets you made on 2.7 to add and edit the Misc/NEWS entry. You can also check with "hg in" and "hg out" if there's something you haven't pulled/pushed yet, but that shouldn't be a problem. > The failure of transplant and import are perhaps understandable because 3.2 > has a gratuitous case difference with /combine/Combine/. > > - Issue #16406: Combine the pages for uploading and registering to PyPI. > > But the inability to make a proper diff from direct edit is something else. > If I add just a single blank line, even that generates a mega patch. Same > with 3.3 NEWS. I also tried deleting the file to make hg regenerate from the > repository database. > > Anyone have any idea what the problem is? Has anything changed with hg, > windows, line endings and this text file in the last few months? I just > pushed patches for about 20 scattered files in Docs, Lib, Modules, and Tools > earlier today, so the problem seems to be specific to NEWS. > Not sure about this, but in the meanwhile you could try what I suggested above -- if that doesn't work we can find some other solution. (If you prefer you can come on #python-dev too.) Best Regards, Ezio Melotti > tjr > From python-checkins at python.org Tue Mar 12 14:07:13 2013 From: python-checkins at python.org (eli.bendersky) Date: Tue, 12 Mar 2013 14:07:13 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzExMzY3?= =?utf-8?q?=3A_fix_documentation_of_some_find*_methods_in_ElementTree?= Message-ID: <3ZQGg50ZdHzRhJ@mail.python.org> http://hg.python.org/cpython/rev/958217164846 changeset: 82628:958217164846 branch: 3.2 parent: 82618:3f5f961262ec user: Eli Bendersky date: Tue Mar 12 06:01:22 2013 -0700 summary: Issue #11367: fix documentation of some find* methods in ElementTree files: Doc/library/xml.etree.elementtree.rst | 15 +++------------ Lib/xml/etree/ElementTree.py | 11 ++++------- Misc/ACKS | 1 + 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -412,26 +412,17 @@ .. method:: find(match) - Finds the first toplevel element matching *match*. *match* may be a tag - name or path. Same as getroot().find(match). Returns the first matching - element, or ``None`` if no element was found. + Same as :meth:`Element.find`, starting at the root of the tree. .. method:: findall(match) - Finds all matching subelements, by tag name or path. Same as - getroot().findall(match). *match* may be a tag name or path. Returns a - list containing all matching elements, in document order. + Same as :meth:`Element.findall`, starting at the root of the tree. .. method:: findtext(match, default=None) - Finds the element text for the first toplevel element with given tag. - Same as getroot().findtext(match). *match* may be a tag name or path. - *default* is the value to return if the element was not found. Returns - the text content of the first matching element, or the default value no - element was found. Note that if the element is found, but has no text - content, this method returns an empty string. + Same as :meth:`Element.findtext`, starting at the root of the tree. .. method:: getiterator(tag=None) diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -705,8 +705,7 @@ return list(self.iter(tag)) ## - # Finds the first toplevel element with given tag. - # Same as getroot().find(path). + # Same as getroot().find(path), starting at the root of the tree. # # @param path What element to look for. # @keyparam namespaces Optional namespace prefix map. @@ -726,10 +725,9 @@ return self._root.find(path, namespaces) ## - # Finds the element text for the first toplevel element with given - # tag. Same as getroot().findtext(path). + # Same as getroot().findtext(path), starting at the root of the tree. # - # @param path What toplevel element to look for. + # @param path What element to look for. # @param default What to return if the element was not found. # @keyparam namespaces Optional namespace prefix map. # @return The text content of the first matching element, or the @@ -751,8 +749,7 @@ return self._root.findtext(path, default, namespaces) ## - # Finds all toplevel elements with the given tag. - # Same as getroot().findall(path). + # Same as getroot().findall(path), starting at the root of the tree. # # @param path What element to look for. # @keyparam namespaces Optional namespace prefix map. diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -436,6 +436,7 @@ Rycharde Hawkes Ben Hayden Jochen Hayek +Henrik Heimbuerger Christian Heimes Thomas Heller Malte Helmert -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 12 14:07:14 2013 From: python-checkins at python.org (eli.bendersky) Date: Tue, 12 Mar 2013 14:07:14 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Issue_=2311367=3A_fix_documentation_of_some_find*_methods_in_E?= =?utf-8?q?lementTree?= Message-ID: <3ZQGg63b3mzRyw@mail.python.org> http://hg.python.org/cpython/rev/4012d4b41b2b changeset: 82629:4012d4b41b2b branch: 3.3 parent: 82625:fa051c6276a0 parent: 82628:958217164846 user: Eli Bendersky date: Tue Mar 12 06:04:33 2013 -0700 summary: Issue #11367: fix documentation of some find* methods in ElementTree files: Lib/xml/etree/ElementTree.py | 11 ++++------- Misc/ACKS | 1 + 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -692,8 +692,7 @@ return list(self.iter(tag)) ## - # Finds the first toplevel element with given tag. - # Same as getroot().find(path). + # Same as getroot().find(path), starting at the root of the tree. # # @param path What element to look for. # @keyparam namespaces Optional namespace prefix map. @@ -713,10 +712,9 @@ return self._root.find(path, namespaces) ## - # Finds the element text for the first toplevel element with given - # tag. Same as getroot().findtext(path). + # Same as getroot().findtext(path), starting at the root of the tree. # - # @param path What toplevel element to look for. + # @param path What element to look for. # @param default What to return if the element was not found. # @keyparam namespaces Optional namespace prefix map. # @return The text content of the first matching element, or the @@ -738,8 +736,7 @@ return self._root.findtext(path, default, namespaces) ## - # Finds all toplevel elements with the given tag. - # Same as getroot().findall(path). + # Same as getroot().findall(path), starting at the root of the tree. # # @param path What element to look for. # @keyparam namespaces Optional namespace prefix map. diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -480,6 +480,7 @@ Rycharde Hawkes Ben Hayden Jochen Hayek +Henrik Heimbuerger Christian Heimes Thomas Heller Malte Helmert -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 12 14:07:15 2013 From: python-checkins at python.org (eli.bendersky) Date: Tue, 12 Mar 2013 14:07:15 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2311367=3A_fix_documentation_of_some_find*_method?= =?utf-8?q?s_in_ElementTree?= Message-ID: <3ZQGg76DS9zRwd@mail.python.org> http://hg.python.org/cpython/rev/7ae2c90f1ba2 changeset: 82630:7ae2c90f1ba2 parent: 82626:8fdce849d0b3 parent: 82629:4012d4b41b2b user: Eli Bendersky date: Tue Mar 12 06:06:06 2013 -0700 summary: Issue #11367: fix documentation of some find* methods in ElementTree files: Misc/ACKS | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -483,6 +483,7 @@ Rycharde Hawkes Ben Hayden Jochen Hayek +Henrik Heimbuerger Christian Heimes Thomas Heller Malte Helmert -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 12 14:09:09 2013 From: python-checkins at python.org (eli.bendersky) Date: Tue, 12 Mar 2013 14:09:09 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzExMzY3?= =?utf-8?q?=3A_fix_documentation_of_some_find*_methods_in_ElementTree?= Message-ID: <3ZQGjK72VlzRkN@mail.python.org> http://hg.python.org/cpython/rev/8e6db2462a77 changeset: 82631:8e6db2462a77 branch: 2.7 parent: 82627:a1bebf2c33e7 user: Eli Bendersky date: Tue Mar 12 06:08:04 2013 -0700 summary: Issue #11367: fix documentation of some find* methods in ElementTree files: Doc/library/xml.etree.elementtree.rst | 15 +++------------ Lib/xml/etree/ElementTree.py | 12 +++++------- Misc/ACKS | 1 + 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -711,26 +711,17 @@ .. method:: find(match) - Finds the first toplevel element matching *match*. *match* may be a tag - name or path. Same as getroot().find(match). Returns the first matching - element, or ``None`` if no element was found. + Same as :meth:`Element.find`, starting at the root of the tree. .. method:: findall(match) - Finds all matching subelements, by tag name or path. Same as - getroot().findall(match). *match* may be a tag name or path. Returns a - list containing all matching elements, in document order. + Same as :meth:`Element.findall`, starting at the root of the tree. .. method:: findtext(match, default=None) - Finds the element text for the first toplevel element with given tag. - Same as getroot().findtext(match). *match* may be a tag name or path. - *default* is the value to return if the element was not found. Returns - the text content of the first matching element, or the default value no - element was found. Note that if the element is found, but has no text - content, this method returns an empty string. + Same as :meth:`Element.findtext`, starting at the root of the tree. .. method:: getiterator(tag=None) diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -683,8 +683,8 @@ return list(self.iter(tag)) ## - # Finds the first toplevel element with given tag. - # Same as getroot().find(path). + # Same as getroot().find(path), starting at the root of the + # tree. # # @param path What element to look for. # @keyparam namespaces Optional namespace prefix map. @@ -704,10 +704,9 @@ return self._root.find(path, namespaces) ## - # Finds the element text for the first toplevel element with given - # tag. Same as getroot().findtext(path). + # Same as getroot().findtext(path), starting at the root of the tree. # - # @param path What toplevel element to look for. + # @param path What element to look for. # @param default What to return if the element was not found. # @keyparam namespaces Optional namespace prefix map. # @return The text content of the first matching element, or the @@ -729,8 +728,7 @@ return self._root.findtext(path, default, namespaces) ## - # Finds all toplevel elements with the given tag. - # Same as getroot().findall(path). + # Same as getroot().findall(path), starting at the root of the tree. # # @param path What element to look for. # @keyparam namespaces Optional namespace prefix map. diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -398,6 +398,7 @@ Rycharde Hawkes Ben Hayden Jochen Hayek +Henrik Heimbuerger Christian Heimes Thomas Heller Malte Helmert -- Repository URL: http://hg.python.org/cpython From ncoghlan at gmail.com Tue Mar 12 16:26:07 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Wed, 13 Mar 2013 01:26:07 +1000 Subject: [Python-checkins] cpython (2.7): #16004: Add `make touch`. In-Reply-To: References: <3ZPVtS3mkkzSHQ@mail.python.org> Message-ID: On 11 Mar 2013 06:23, "Brett Cannon" wrote: > > > > > On Mon, Mar 11, 2013 at 9:22 AM, Brett Cannon wrote: >> >> Should this also touch Python/importlib.h? >> > > nm, noticed this was added on 2.7 and not default. Default already had it, this was a back port so that "make touch" could be given as a consistent fix for certain build problems in the devguide. (Specifically, make trying to rebuild those files when you don't yet have the necessary pieces available to do so) Cheers, Nick. > >> >> >> On Mon, Mar 11, 2013 at 3:14 AM, ezio.melotti wrote: >>> >>> http://hg.python.org/cpython/rev/da3f4774b939 >>> changeset: 82600:da3f4774b939 >>> branch: 2.7 >>> parent: 82593:3e14aafeca04 >>> user: Ezio Melotti >>> date: Mon Mar 11 09:14:09 2013 +0200 >>> summary: >>> #16004: Add `make touch`. >>> >>> files: >>> Makefile.pre.in | 6 +++++- >>> Misc/NEWS | 2 ++ >>> 2 files changed, 7 insertions(+), 1 deletions(-) >>> >>> >>> diff --git a/Makefile.pre.in b/Makefile.pre.in >>> --- a/Makefile.pre.in >>> +++ b/Makefile.pre.in >>> @@ -1250,6 +1250,10 @@ >>> etags Include/*.h; \ >>> for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done >>> >>> +# Touch generated files >>> +touch: >>> + touch Include/Python-ast.h Python/Python-ast.c >>> + >>> # Sanitation targets -- clean leaves libraries, executables and tags >>> # files, which clobber removes as well >>> pycremoval: >>> @@ -1339,7 +1343,7 @@ >>> .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure >>> .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools >>> .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean >>> -.PHONY: smelly funny patchcheck altmaninstall >>> +.PHONY: smelly funny patchcheck touch altmaninstall >>> .PHONY: gdbhooks >>> >>> # IF YOU PUT ANYTHING HERE IT WILL GO AWAY >>> diff --git a/Misc/NEWS b/Misc/NEWS >>> --- a/Misc/NEWS >>> +++ b/Misc/NEWS >>> @@ -874,6 +874,8 @@ >>> Build >>> ----- >>> >>> +- Issue #16004: Add `make touch`. >>> + >>> - Issue #5033: Fix building of the sqlite3 extension module when the >>> SQLite library version has "beta" in it. Patch by Andreas Pelme. >>> >>> >>> -- >>> Repository URL: http://hg.python.org/cpython >>> >>> _______________________________________________ >>> Python-checkins mailing list >>> Python-checkins at python.org >>> http://mail.python.org/mailman/listinfo/python-checkins >>> >> > > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > -------------- next part -------------- An HTML attachment was scrubbed... URL: From python-checkins at python.org Tue Mar 12 17:56:50 2013 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 12 Mar 2013 17:56:50 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_update_links_to_6=2E2=2E0?= Message-ID: <3ZQMm23B3hzPLH@mail.python.org> http://hg.python.org/cpython/rev/e1e5423815a4 changeset: 82632:e1e5423815a4 parent: 82630:7ae2c90f1ba2 user: Benjamin Peterson date: Tue Mar 12 11:56:38 2013 -0500 summary: update links to 6.2.0 files: Doc/library/unicodedata.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/unicodedata.rst b/Doc/library/unicodedata.rst --- a/Doc/library/unicodedata.rst +++ b/Doc/library/unicodedata.rst @@ -166,6 +166,6 @@ .. rubric:: Footnotes -.. [#] http://www.unicode.org/Public/6.1.0/ucd/NameAliases.txt +.. [#] http://www.unicode.org/Public/6.2.0/ucd/NameAliases.txt -.. [#] http://www.unicode.org/Public/6.1.0/ucd/NamedSequences.txt +.. [#] http://www.unicode.org/Public/6.2.0/ucd/NamedSequences.txt -- Repository URL: http://hg.python.org/cpython From tjreedy at udel.edu Tue Mar 12 18:19:55 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Tue, 12 Mar 2013 13:19:55 -0400 Subject: [Python-checkins] CANNOT Patch 3.x NEWS [was cpython (2.7): Issue #14707: add news entry\ In-Reply-To: References: <3ZQ4z44QVLzRXr@mail.python.org> <513EC7E2.90400@udel.edu> Message-ID: <513F63BB.8060805@udel.edu> On 3/12/2013 2:52 AM, Ezio Melotti wrote: I am using the newly documented clone + 3 shares system. > What are the exact commands you used? Clicks on TortoiseHg HgWorkbench GUI ;-). > Are your clones up to date (i.e. did you do "hg pull" and "hg up" > before "hg graft")? There were no other pushes between my last de-double patch and this, and I am sure I ran my pull + 3*update .bat first. I have run it multiple times since. > Does "hg heads ." show you more than one head? The DAG window shows the normal one head per branch as appropriate for the particular branch display. At the moment, hg heads shows the four commits from Eli, 82628 to 82631 as heads plus old 2.6 and 3.1 heads. > Is your clone "clean" (i.e. does "hg status" show anything as 'M')? The status window is empty until I edit NEWS and click Refresh, at which point M Misc/News shows up with the megadiff. Right click/ Revert/yes and the file is reverted. > Once your clone is clean you can just edit Misc/NEWS manually Since the graft and import failed (producing no diff), I have been editing manually and that is when I get the megadiff. I added a couple of blank lines to ACKS and got a normal diff. Now, adding a blank line to 2.7 NEWS also gives a blank line. Could the failed graft have messed up the master copy in my cpython repository. I have tried deleting the NEWS file and reverting the deletion. hg update does not restore the file as it apparently thinks I actually want the uncommitted deletion. > it's easier than trying to graft the 2 changesets you made on 2.7 to > add and edit the Misc/NEWS entry. There was only one 2.7 changeset with only the NEWS patch. > You can also check with "hg in" and "hg out" if there's something you > haven't pulled/pushed yet, but that shouldn't be a problem. I tried both and got 'no changes'. > (If you prefer you can come on #python-dev too.) I may try that, but I suspect that my registration/nick has expired again and last time is was obnoxiously hard to get re-established. Terry From ezio.melotti at gmail.com Wed Mar 13 00:34:58 2013 From: ezio.melotti at gmail.com (Ezio Melotti) Date: Wed, 13 Mar 2013 01:34:58 +0200 Subject: [Python-checkins] CANNOT Patch 3.x NEWS [was cpython (2.7): Issue #14707: add news entry\ In-Reply-To: <513F63BB.8060805@udel.edu> References: <3ZQ4z44QVLzRXr@mail.python.org> <513EC7E2.90400@udel.edu> <513F63BB.8060805@udel.edu> Message-ID: Hi, On Tue, Mar 12, 2013 at 7:19 PM, Terry Reedy wrote: > On 3/12/2013 2:52 AM, Ezio Melotti wrote: >> What are the exact commands you used? > > Clicks on TortoiseHg HgWorkbench GUI ;-). > I wonder if TortoiseHg is doing something wrong here. Maybe you could try from cmd too. >> Are your clones up to date (i.e. did you do "hg pull" and "hg up" >> before "hg graft")? > > There were no other pushes between my last de-double patch and this, and I > am sure I ran my pull + 3*update .bat first. I have run it multiple times > since. > Around the time you pushed on 2.7 I also pushed something, so that might have created some conflict. How does your .bat look like? One gotcha of the share extension is that if you use "hg pull -u" and there's nothing to pull because you already pulled in one of the shared clones, the update won't be executed (this is actually normal behaviour of "hg pull", but the consequences are especially noticeable while using shared clones). >> Does "hg heads ." show you more than one head? > > The DAG window shows the normal one head per branch as appropriate for the > particular branch display. At the moment, hg heads shows the four commits > from Eli, 82628 to 82631 as heads plus old 2.6 and 3.1 heads. > >> Is your clone "clean" (i.e. does "hg status" show anything as 'M')? > > The status window is empty until I edit NEWS and click Refresh, at which > point M Misc/News shows up with the megadiff. > Right click/ Revert/yes and the file is reverted. > >> Once your clone is clean you can just edit Misc/NEWS manually > > Since the graft and import failed (producing no diff), I have been editing > manually and that is when I get the megadiff. I added a couple of blank > lines to ACKS and got a normal diff. Now, adding a blank line to 2.7 NEWS > also gives a blank line. > > Could the failed graft have messed up the master copy in my cpython > repository. > That's possible. From "hg help graft": If a graft merge results in conflicts, the graft process is interrupted so that the current merge can be manually resolved. Once all conflicts are addressed, the graft process can be continued with the -c/--continue option. This doesn't mean that you copy is messed up though. "hg up -C 3.2" should restore it. When I graft/merge and there are conflicts I use kdiff3, and it takes just a few seconds to solve the conflicts usually (for Misc/NEWS is ctrl+2, ctrl+3, ctrl+s, alt+f4, that roughly translates too "include both the conflicting news, save and quit). > I have tried deleting the NEWS file and reverting the deletion. > hg update does not restore the file as it apparently thinks I actually want > the uncommitted deletion. > How did you delete it? I assume that if you do it from the TortoiseHG GUI, it will mark it as "deleted" ('D' in "hg status"). If you do it from cmd/file manager hg should see it as missing ('!' in "hg status") and you can use "hg revert Misc/NEWS" to restore it. >> it's easier than trying to graft the 2 changesets you made on 2.7 to >> add and edit the Misc/NEWS entry. > > There was only one 2.7 changeset with only the NEWS patch. > I was referring to the one that added the news + the one that fixed the issue id. >> You can also check with "hg in" and "hg out" if there's something you >> haven't pulled/pushed yet, but that shouldn't be a problem. > > I tried both and got 'no changes'. > >> (If you prefer you can come on #python-dev too.) > > I may try that, but I suspect that my registration/nick has expired again > and last time is was obnoxiously hard to get re-established. > There's no need to register your nick for #python-dev (there is for #python though). You can just fire up your favourite IRC client (or even http://webchat.freenode.net/) and join. (Registering the nick shouldn't be difficult though.) > Terry > From python-checkins at python.org Wed Mar 13 00:55:23 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 13 Mar 2013 00:55:23 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzE3MzY4OiBGaXgg?= =?utf-8?q?an_off-by-one_error_in_the_Python_JSON_decoder_that_caused_a?= Message-ID: <3ZQY2z1hR0zNWy@mail.python.org> http://hg.python.org/cpython/rev/4a5ad099b176 changeset: 82633:4a5ad099b176 branch: 2.7 parent: 82631:8e6db2462a77 user: Ezio Melotti date: Wed Mar 13 01:49:57 2013 +0200 summary: #17368: Fix an off-by-one error in the Python JSON decoder that caused a failure while decoding empty object literals when object_pairs_hook was specified. files: Lib/json/decoder.py | 2 +- Lib/json/tests/test_decode.py | 9 +++++++-- Misc/NEWS | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Lib/json/decoder.py b/Lib/json/decoder.py --- a/Lib/json/decoder.py +++ b/Lib/json/decoder.py @@ -163,7 +163,7 @@ if nextchar == '}': if object_pairs_hook is not None: result = object_pairs_hook(pairs) - return result, end + return result, end + 1 pairs = {} if object_hook is not None: pairs = object_hook(pairs) diff --git a/Lib/json/tests/test_decode.py b/Lib/json/tests/test_decode.py --- a/Lib/json/tests/test_decode.py +++ b/Lib/json/tests/test_decode.py @@ -40,10 +40,15 @@ self.assertEqual(od, OrderedDict(p)) self.assertEqual(type(od), OrderedDict) # the object_pairs_hook takes priority over the object_hook - self.assertEqual(self.loads(s, - object_pairs_hook=OrderedDict, + self.assertEqual(self.loads(s, object_pairs_hook=OrderedDict, object_hook=lambda x: None), OrderedDict(p)) + # check that empty objects literals work (see #17368) + self.assertEqual(self.loads('{}', object_pairs_hook=OrderedDict), + OrderedDict()) + self.assertEqual(self.loads('{"empty": {}}', + object_pairs_hook=OrderedDict), + OrderedDict([('empty', OrderedDict())])) def test_extra_data(self): s = '[1, 2, 3]5' diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -214,6 +214,10 @@ Library ------- +- Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused + a failure while decoding empty object literals when object_pairs_hook was + specified. + - Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 00:55:24 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 13 Mar 2013 00:55:24 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3MzY4OiBGaXgg?= =?utf-8?q?an_off-by-one_error_in_the_Python_JSON_decoder_that_caused_a?= Message-ID: <3ZQY304wXwzNyc@mail.python.org> http://hg.python.org/cpython/rev/40c36d873f41 changeset: 82634:40c36d873f41 branch: 3.2 parent: 82628:958217164846 user: Ezio Melotti date: Wed Mar 13 01:52:34 2013 +0200 summary: #17368: Fix an off-by-one error in the Python JSON decoder that caused a failure while decoding empty object literals when object_pairs_hook was specified. files: Lib/json/decoder.py | 2 +- Lib/test/json_tests/test_decode.py | 14 ++++++++++---- Misc/NEWS | 4 ++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Lib/json/decoder.py b/Lib/json/decoder.py --- a/Lib/json/decoder.py +++ b/Lib/json/decoder.py @@ -167,7 +167,7 @@ if nextchar == '}': if object_pairs_hook is not None: result = object_pairs_hook(pairs) - return result, end + return result, end + 1 pairs = {} if object_hook is not None: pairs = object_hook(pairs) diff --git a/Lib/test/json_tests/test_decode.py b/Lib/test/json_tests/test_decode.py --- a/Lib/test/json_tests/test_decode.py +++ b/Lib/test/json_tests/test_decode.py @@ -25,16 +25,22 @@ p = [("xkd", 1), ("kcw", 2), ("art", 3), ("hxm", 4), ("qrt", 5), ("pad", 6), ("hoy", 7)] self.assertEqual(self.loads(s), eval(s)) - self.assertEqual(self.loads(s, object_pairs_hook = lambda x: x), p) + self.assertEqual(self.loads(s, object_pairs_hook=lambda x: x), p) self.assertEqual(self.json.load(StringIO(s), object_pairs_hook=lambda x: x), p) - od = self.loads(s, object_pairs_hook = OrderedDict) + od = self.loads(s, object_pairs_hook=OrderedDict) self.assertEqual(od, OrderedDict(p)) self.assertEqual(type(od), OrderedDict) # the object_pairs_hook takes priority over the object_hook - self.assertEqual(self.loads(s, object_pairs_hook = OrderedDict, - object_hook = lambda x: None), + self.assertEqual(self.loads(s, object_pairs_hook=OrderedDict, + object_hook=lambda x: None), OrderedDict(p)) + # check that empty objects literals work (see #17368) + self.assertEqual(self.loads('{}', object_pairs_hook=OrderedDict), + OrderedDict()) + self.assertEqual(self.loads('{"empty": {}}', + object_pairs_hook=OrderedDict), + OrderedDict([('empty', OrderedDict())])) def test_decoder_optimizations(self): # Several optimizations were made that skip over calls to diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,6 +233,10 @@ Library ------- +- Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused + a failure while decoding empty object literals when object_pairs_hook was + specified. + - Issue #14645: The email generator classes now produce output using the specified linesep throughout. Previously if the prolog, epilog, or body were stored with a different linesep, that linesep was used. This -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 00:55:26 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 13 Mar 2013 00:55:26 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2317368=3A_merge_with_3=2E2=2E?= Message-ID: <3ZQY320WyqzNbr@mail.python.org> http://hg.python.org/cpython/rev/dd2fad6b47c0 changeset: 82635:dd2fad6b47c0 branch: 3.3 parent: 82629:4012d4b41b2b parent: 82634:40c36d873f41 user: Ezio Melotti date: Wed Mar 13 01:53:38 2013 +0200 summary: #17368: merge with 3.2. files: Lib/json/decoder.py | 2 +- Lib/test/json_tests/test_decode.py | 14 ++++++++++---- Misc/NEWS | 4 ++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Lib/json/decoder.py b/Lib/json/decoder.py --- a/Lib/json/decoder.py +++ b/Lib/json/decoder.py @@ -166,7 +166,7 @@ if nextchar == '}': if object_pairs_hook is not None: result = object_pairs_hook(pairs) - return result, end + return result, end + 1 pairs = {} if object_hook is not None: pairs = object_hook(pairs) diff --git a/Lib/test/json_tests/test_decode.py b/Lib/test/json_tests/test_decode.py --- a/Lib/test/json_tests/test_decode.py +++ b/Lib/test/json_tests/test_decode.py @@ -25,16 +25,22 @@ p = [("xkd", 1), ("kcw", 2), ("art", 3), ("hxm", 4), ("qrt", 5), ("pad", 6), ("hoy", 7)] self.assertEqual(self.loads(s), eval(s)) - self.assertEqual(self.loads(s, object_pairs_hook = lambda x: x), p) + self.assertEqual(self.loads(s, object_pairs_hook=lambda x: x), p) self.assertEqual(self.json.load(StringIO(s), object_pairs_hook=lambda x: x), p) - od = self.loads(s, object_pairs_hook = OrderedDict) + od = self.loads(s, object_pairs_hook=OrderedDict) self.assertEqual(od, OrderedDict(p)) self.assertEqual(type(od), OrderedDict) # the object_pairs_hook takes priority over the object_hook - self.assertEqual(self.loads(s, object_pairs_hook = OrderedDict, - object_hook = lambda x: None), + self.assertEqual(self.loads(s, object_pairs_hook=OrderedDict, + object_hook=lambda x: None), OrderedDict(p)) + # check that empty objects literals work (see #17368) + self.assertEqual(self.loads('{}', object_pairs_hook=OrderedDict), + OrderedDict()) + self.assertEqual(self.loads('{"empty": {}}', + object_pairs_hook=OrderedDict), + OrderedDict([('empty', OrderedDict())])) def test_decoder_optimizations(self): # Several optimizations were made that skip over calls to diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -193,6 +193,10 @@ Library ------- +- Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused + a failure while decoding empty object literals when object_pairs_hook was + specified. + - Issue #14645: The email generator classes now produce output using the specified linesep throughout. Previously if the prolog, epilog, or body were stored with a different linesep, that linesep was used. This -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 00:55:27 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 13 Mar 2013 00:55:27 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3MzY4OiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZQY333FNQzP2T@mail.python.org> http://hg.python.org/cpython/rev/885ffda21849 changeset: 82636:885ffda21849 parent: 82632:e1e5423815a4 parent: 82635:dd2fad6b47c0 user: Ezio Melotti date: Wed Mar 13 01:55:07 2013 +0200 summary: #17368: merge with 3.3. files: Lib/json/decoder.py | 2 +- Lib/test/json_tests/test_decode.py | 14 ++++++++++---- Misc/NEWS | 4 ++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Lib/json/decoder.py b/Lib/json/decoder.py --- a/Lib/json/decoder.py +++ b/Lib/json/decoder.py @@ -158,7 +158,7 @@ if nextchar == '}': if object_pairs_hook is not None: result = object_pairs_hook(pairs) - return result, end + return result, end + 1 pairs = {} if object_hook is not None: pairs = object_hook(pairs) diff --git a/Lib/test/json_tests/test_decode.py b/Lib/test/json_tests/test_decode.py --- a/Lib/test/json_tests/test_decode.py +++ b/Lib/test/json_tests/test_decode.py @@ -25,16 +25,22 @@ p = [("xkd", 1), ("kcw", 2), ("art", 3), ("hxm", 4), ("qrt", 5), ("pad", 6), ("hoy", 7)] self.assertEqual(self.loads(s), eval(s)) - self.assertEqual(self.loads(s, object_pairs_hook = lambda x: x), p) + self.assertEqual(self.loads(s, object_pairs_hook=lambda x: x), p) self.assertEqual(self.json.load(StringIO(s), object_pairs_hook=lambda x: x), p) - od = self.loads(s, object_pairs_hook = OrderedDict) + od = self.loads(s, object_pairs_hook=OrderedDict) self.assertEqual(od, OrderedDict(p)) self.assertEqual(type(od), OrderedDict) # the object_pairs_hook takes priority over the object_hook - self.assertEqual(self.loads(s, object_pairs_hook = OrderedDict, - object_hook = lambda x: None), + self.assertEqual(self.loads(s, object_pairs_hook=OrderedDict, + object_hook=lambda x: None), OrderedDict(p)) + # check that empty objects literals work (see #17368) + self.assertEqual(self.loads('{}', object_pairs_hook=OrderedDict), + OrderedDict()) + self.assertEqual(self.loads('{"empty": {}}', + object_pairs_hook=OrderedDict), + OrderedDict([('empty', OrderedDict())])) def test_decoder_optimizations(self): # Several optimizations were made that skip over calls to diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -277,6 +277,10 @@ Library ------- +- Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused + a failure while decoding empty object literals when object_pairs_hook was + specified. + _ Issue #17385: Fix quadratic behavior in threading.Condition. The FIFO queue now uses a deque instead of a list. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 01:28:10 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 13 Mar 2013 01:28:10 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzE3NDAyOiBhdm9p?= =?utf-8?q?d_shadowing_built-in_map_in_mmap_examples=2E__Initial_patch_by_?= =?utf-8?q?Aman?= Message-ID: <3ZQYmp16xzzP25@mail.python.org> http://hg.python.org/cpython/rev/c226133b1493 changeset: 82637:c226133b1493 branch: 2.7 parent: 82633:4a5ad099b176 user: Ezio Melotti date: Wed Mar 13 02:26:11 2013 +0200 summary: #17402: avoid shadowing built-in map in mmap examples. Initial patch by Aman Shah. files: Doc/library/mmap.rst | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -114,19 +114,19 @@ with open("hello.txt", "r+b") as f: # memory-map the file, size 0 means whole file - map = mmap.mmap(f.fileno(), 0) + mm = mmap.mmap(f.fileno(), 0) # read content via standard file methods - print map.readline() # prints "Hello Python!" + print mm.readline() # prints "Hello Python!" # read content via slice notation - print map[:5] # prints "Hello" + print mm[:5] # prints "Hello" # update content using slice notation; # note that new content must have same size - map[6:] = " world!\n" + mm[6:] = " world!\n" # ... and read again using standard file methods - map.seek(0) - print map.readline() # prints "Hello world!" + mm.seek(0) + print mm.readline() # prints "Hello world!" # close the map - map.close() + mm.close() The next example demonstrates how to create an anonymous map and exchange @@ -135,16 +135,16 @@ import mmap import os - map = mmap.mmap(-1, 13) - map.write("Hello world!") + mm = mmap.mmap(-1, 13) + mm.write("Hello world!") pid = os.fork() if pid == 0: # In a child process - map.seek(0) - print map.readline() + mm.seek(0) + print mm.readline() - map.close() + mm.close() Memory-mapped file objects support the following methods: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 01:28:11 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 13 Mar 2013 01:28:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3NDAyOiBhdm9p?= =?utf-8?q?d_shadowing_built-in_map_in_mmap_examples=2E__Initial_patch_by_?= =?utf-8?q?Aman?= Message-ID: <3ZQYmq3gvXzP4c@mail.python.org> http://hg.python.org/cpython/rev/df27ea4bdebd changeset: 82638:df27ea4bdebd branch: 3.2 parent: 82634:40c36d873f41 user: Ezio Melotti date: Wed Mar 13 02:27:00 2013 +0200 summary: #17402: avoid shadowing built-in map in mmap examples. Initial patch by Aman Shah. files: Doc/library/mmap.rst | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -106,19 +106,19 @@ with open("hello.txt", "r+b") as f: # memory-map the file, size 0 means whole file - map = mmap.mmap(f.fileno(), 0) + mm = mmap.mmap(f.fileno(), 0) # read content via standard file methods - print(map.readline()) # prints b"Hello Python!\n" + print(mm.readline()) # prints b"Hello Python!\n" # read content via slice notation - print(map[:5]) # prints b"Hello" + print(mm[:5]) # prints b"Hello" # update content using slice notation; # note that new content must have same size - map[6:] = b" world!\n" + mm[6:] = b" world!\n" # ... and read again using standard file methods - map.seek(0) - print(map.readline()) # prints b"Hello world!\n" + mm.seek(0) + print(mm.readline()) # prints b"Hello world!\n" # close the map - map.close() + mm.close() :class:`mmap` can also be used as a context manager in a :keyword:`with` @@ -126,8 +126,8 @@ import mmap - with mmap.mmap(-1, 13) as map: - map.write("Hello world!") + with mmap.mmap(-1, 13) as mm: + mm.write("Hello world!") .. versionadded:: 3.2 Context manager support. @@ -139,16 +139,16 @@ import mmap import os - map = mmap.mmap(-1, 13) - map.write(b"Hello world!") + mm = mmap.mmap(-1, 13) + mm.write(b"Hello world!") pid = os.fork() if pid == 0: # In a child process - map.seek(0) - print(map.readline()) + mm.seek(0) + print(mm.readline()) - map.close() + mm.close() Memory-mapped file objects support the following methods: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 01:28:12 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 13 Mar 2013 01:28:12 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2317402=3A_merge_with_3=2E2=2E?= Message-ID: <3ZQYmr6jHczP86@mail.python.org> http://hg.python.org/cpython/rev/bf0632a17ab4 changeset: 82639:bf0632a17ab4 branch: 3.3 parent: 82635:dd2fad6b47c0 parent: 82638:df27ea4bdebd user: Ezio Melotti date: Wed Mar 13 02:27:35 2013 +0200 summary: #17402: merge with 3.2. files: Doc/library/mmap.rst | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -106,19 +106,19 @@ with open("hello.txt", "r+b") as f: # memory-map the file, size 0 means whole file - map = mmap.mmap(f.fileno(), 0) + mm = mmap.mmap(f.fileno(), 0) # read content via standard file methods - print(map.readline()) # prints b"Hello Python!\n" + print(mm.readline()) # prints b"Hello Python!\n" # read content via slice notation - print(map[:5]) # prints b"Hello" + print(mm[:5]) # prints b"Hello" # update content using slice notation; # note that new content must have same size - map[6:] = b" world!\n" + mm[6:] = b" world!\n" # ... and read again using standard file methods - map.seek(0) - print(map.readline()) # prints b"Hello world!\n" + mm.seek(0) + print(mm.readline()) # prints b"Hello world!\n" # close the map - map.close() + mm.close() :class:`mmap` can also be used as a context manager in a :keyword:`with` @@ -126,8 +126,8 @@ import mmap - with mmap.mmap(-1, 13) as map: - map.write("Hello world!") + with mmap.mmap(-1, 13) as mm: + mm.write("Hello world!") .. versionadded:: 3.2 Context manager support. @@ -139,16 +139,16 @@ import mmap import os - map = mmap.mmap(-1, 13) - map.write(b"Hello world!") + mm = mmap.mmap(-1, 13) + mm.write(b"Hello world!") pid = os.fork() if pid == 0: # In a child process - map.seek(0) - print(map.readline()) + mm.seek(0) + print(mm.readline()) - map.close() + mm.close() Memory-mapped file objects support the following methods: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 01:28:14 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 13 Mar 2013 01:28:14 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3NDAyOiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZQYmt2LpVzPBN@mail.python.org> http://hg.python.org/cpython/rev/b49971a1e70d changeset: 82640:b49971a1e70d parent: 82636:885ffda21849 parent: 82639:bf0632a17ab4 user: Ezio Melotti date: Wed Mar 13 02:27:53 2013 +0200 summary: #17402: merge with 3.3. files: Doc/library/mmap.rst | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -106,19 +106,19 @@ with open("hello.txt", "r+b") as f: # memory-map the file, size 0 means whole file - map = mmap.mmap(f.fileno(), 0) + mm = mmap.mmap(f.fileno(), 0) # read content via standard file methods - print(map.readline()) # prints b"Hello Python!\n" + print(mm.readline()) # prints b"Hello Python!\n" # read content via slice notation - print(map[:5]) # prints b"Hello" + print(mm[:5]) # prints b"Hello" # update content using slice notation; # note that new content must have same size - map[6:] = b" world!\n" + mm[6:] = b" world!\n" # ... and read again using standard file methods - map.seek(0) - print(map.readline()) # prints b"Hello world!\n" + mm.seek(0) + print(mm.readline()) # prints b"Hello world!\n" # close the map - map.close() + mm.close() :class:`mmap` can also be used as a context manager in a :keyword:`with` @@ -126,8 +126,8 @@ import mmap - with mmap.mmap(-1, 13) as map: - map.write("Hello world!") + with mmap.mmap(-1, 13) as mm: + mm.write("Hello world!") .. versionadded:: 3.2 Context manager support. @@ -139,16 +139,16 @@ import mmap import os - map = mmap.mmap(-1, 13) - map.write(b"Hello world!") + mm = mmap.mmap(-1, 13) + mm.write(b"Hello world!") pid = os.fork() if pid == 0: # In a child process - map.seek(0) - print(map.readline()) + mm.seek(0) + print(mm.readline()) - map.close() + mm.close() Memory-mapped file objects support the following methods: -- Repository URL: http://hg.python.org/cpython From root at python.org Wed Mar 13 01:51:02 2013 From: root at python.org (Cron Daemon) Date: Wed, 13 Mar 2013 01:51:02 +0100 Subject: [Python-checkins] Cron /home/docs/build-devguide Message-ID: abort: error: Name or service not known From solipsis at pitrou.net Wed Mar 13 06:01:27 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 13 Mar 2013 06:01:27 +0100 Subject: [Python-checkins] Daily reference leaks (b49971a1e70d): sum=1 Message-ID: results for b49971a1e70d on branch "default" -------------------------------------------- test_unittest leaked [-1, 2, 0] memory blocks, sum=1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogi0MroE', '-x'] From python-checkins at python.org Wed Mar 13 06:26:16 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 13 Mar 2013 06:26:16 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?devguide=3A_=2314468=3A_move_a_paragr?= =?utf-8?q?aph_and_link_to_the_list_of_branches=2E?= Message-ID: <3ZQhNm6pTlzNnT@mail.python.org> http://hg.python.org/devguide/rev/50e726533391 changeset: 609:50e726533391 user: Ezio Melotti date: Wed Mar 13 07:26:05 2013 +0200 summary: #14468: move a paragraph and link to the list of branches. files: committing.rst | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-) diff --git a/committing.rst b/committing.rst --- a/committing.rst +++ b/committing.rst @@ -305,11 +305,17 @@ while you only need to use ``hg pull`` once, you still need to use ``hg up`` in each clone to update its working copy). +If you don't want to specify ssh://hg at hg.python.org/cpython every time you pull +or push, you should add to the ``.hg/hgrc`` files of the clones:: + + [paths] + default = ssh://hg at hg.python.org/cpython + In order to apply a patch, commit, and merge it on all the branches, you can do as follow:: $ cd 2.7 - $ hg pull ssh://hg at hg.python.org/cpython + $ hg pull $ hg up $ hg import --no-c http://bugs.python.org/url/to/the/patch.diff $ # review, run tests, run `make patchcheck` @@ -328,13 +334,7 @@ $ hg up $ hg merge 3.3 $ hg ci -m '#12345: merge with 3.3.' - $ hg push ssh://hg at hg.python.org/cpython - -If you don't want to specify ssh://hg at hg.python.org/cpython every time, you -should add to the ``.hg/hgrc`` files of the clones:: - - [paths] - default = ssh://hg at hg.python.org/cpython + $ hg push Unless noted otherwise, the rest of the page will assume you are using the multiple clone approach, and explain in more detail these basic steps. @@ -345,12 +345,12 @@ Active branches --------------- -If you do ``hg branches`` you will see a list of branches. ``default`` is the -in-development branch, and is the only branch that receives new features. The -other branches only receive bug fixes (``2.7``, ``3.2``, ``3.3``), or security -fixes (``2.6``, ``3.1``). Depending on what you are committing (feature, bug -fix, or security fix), you should commit to the oldest branch applicable, and -then forward-port until the in-development branch. +If you do ``hg branches`` you will see a :ref:`list of branches `. +``default`` is the in-development branch, and is the only branch that receives +new features. The other branches only receive bug fixes or security fixes. +Depending on what you are committing (feature, bug fix, or security fix), you +should commit to the oldest branch applicable, and then forward-port until the +in-development branch. Merging order @@ -377,9 +377,9 @@ # Compile; run the test suite hg ci -m '#12345: fix some issue.' -Then you can switch to the ``3.x`` clone, merge, run the tests and commit:: +Then you can switch to the ``3.4`` clone, merge, run the tests and commit:: - cd ../3.x + cd ../3.4 hg merge 3.3 # Fix any conflicts; compile; run the test suite hg ci -m '#12345: merge with 3.3.' -- Repository URL: http://hg.python.org/devguide From tjreedy at udel.edu Wed Mar 13 08:41:13 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Wed, 13 Mar 2013 03:41:13 -0400 Subject: [Python-checkins] CANNOT Patch 3.x NEWS [was cpython (2.7): Issue #14707: add news entry\ In-Reply-To: References: <3ZQ4z44QVLzRXr@mail.python.org> <513EC7E2.90400@udel.edu> <513F63BB.8060805@udel.edu> Message-ID: <51402D99.3020507@udel.edu> Bottom line: I decided to restart from scratch. I am still not sure if the glitch was hg, disk 1, disk 2, or Windows, or some combination. After making and posting a patch to the tracker today, I tried to annotate a file and got an error something like 'cannot find revision -1'. I then noticed that there was no dag in the workbench dag window, as if there were no revisions. When I looked in .hg/store, the big file seemed to be missing. So I wiped, defragmented and compacted, and reloaded TortoiseHg. Tomorrow I will re-clone and share the repository. Since this is the second time I have re-cloned from python.org, I will follow the advice I read somewhere to make a _backup clone that I leave alone until I need it, so I only have to pull from now until then when I do. On 3/12/2013 7:34 PM, Ezio Melotti wrote: > I wonder if TortoiseHg is doing something wrong here. Maybe you could > try from cmd too. Workbench has a 'command' window for typing hg commands which it should pass as is to Windows much as Command Prompt does. I tried some of the things you suggested there. > Around the time you pushed on 2.7 I also pushed something, so that > might have created some conflict. I do not remember seeing that. > How does your .bat look like? pull -u to cpython + update of each of the three shares, much like written in the devguide. > That's possible. From "hg help graft": > If a graft merge results in conflicts, the graft process is interrupted so > that the current merge can be manually resolved. Once all conflicts are > addressed, the graft process can be continued with the -c/--continue > option. When merge produces a conflict, a window appears offering options including using kdiff3 to resolve. When I tried the graft, the message in the command window was just 'aborted', and I do not remember getting the resolve window. > When I graft/merge and there are conflicts I use kdiff3, and it takes > just a few seconds to solve the conflicts usually (for Misc/NEWS is > ctrl+2, ctrl+3, ctrl+s, alt+f4, that roughly translates too "include > both the conflicting news, save and quit). Since I have perhaps never gotten that sequence right, that info will be helpful. > If you do it from cmd/file manager hg should see it as missing ('!' in > "hg status") and you can use "hg revert Misc/NEWS" to restore it. This. Thanks for trying to help. I will let you know if there are any more problems after the re-clone. I still need to comment on the tcl/tk.dll and tkinter situation, but will just mention now that I ran the four test_txxxx files on 3.3a0 (on Windows) and they seemed to finish and be ok other than altering the environment. Terry From ncoghlan at gmail.com Wed Mar 13 08:01:23 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Wed, 13 Mar 2013 00:01:23 -0700 Subject: [Python-checkins] CANNOT Patch 3.x NEWS [was cpython (2.7): Issue #14707: add news entry\ In-Reply-To: <51402D99.3020507@udel.edu> References: <3ZQ4z44QVLzRXr@mail.python.org> <513EC7E2.90400@udel.edu> <513F63BB.8060805@udel.edu> <51402D99.3020507@udel.edu> Message-ID: On Wed, Mar 13, 2013 at 12:41 AM, Terry Reedy wrote: > Bottom line: I decided to restart from scratch. I am still not sure if the > glitch was hg, disk 1, disk 2, or Windows, or some combination. > > After making and posting a patch to the tracker today, I tried to annotate a > file and got an error something like 'cannot find revision -1'. I then > noticed that there was no dag in the workbench dag window, as if there were > no revisions. When I looked in .hg/store, the big file seemed to be missing. > So I wiped, defragmented and compacted, and reloaded TortoiseHg. Tomorrow I > will re-clone and share the repository. Since this is the second time I have > re-cloned from python.org, I will follow the advice I read somewhere to make > a _backup clone that I leave alone until I need it, so I only have to pull > from now until then when I do. I still keep a pristine clone around so "nuke it from orbit" remains an option. "hg histedit" lets me deal with most of my screw-ups these days, though. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia From ezio.melotti at gmail.com Wed Mar 13 09:06:55 2013 From: ezio.melotti at gmail.com (Ezio Melotti) Date: Wed, 13 Mar 2013 10:06:55 +0200 Subject: [Python-checkins] CANNOT Patch 3.x NEWS [was cpython (2.7): Issue #14707: add news entry\ In-Reply-To: <51402D99.3020507@udel.edu> References: <3ZQ4z44QVLzRXr@mail.python.org> <513EC7E2.90400@udel.edu> <513F63BB.8060805@udel.edu> <51402D99.3020507@udel.edu> Message-ID: On Wed, Mar 13, 2013 at 9:41 AM, Terry Reedy wrote: > Bottom line: I decided to restart from scratch. I am still not sure if the > glitch was hg, disk 1, disk 2, or Windows, or some combination. > > After making and posting a patch to the tracker today, I tried to annotate a > file and got an error something like 'cannot find revision -1'. I then > noticed that there was no dag in the workbench dag window, as if there were > no revisions. When I looked in .hg/store, the big file seemed to be missing. Note that with the share extension, the "big file" (which I assume is the store/ directory) only exists in the "main" clone. In the shared clones you'll find an .hg/sharedpath file that contains the path to the original .hg/ that contains the store/ dir with all the changesets. > So I wiped, defragmented and compacted, and reloaded TortoiseHg. Tomorrow I > will re-clone and share the repository. Since this is the second time I have > re-cloned from python.org, I will follow the advice I read somewhere to make > a _backup clone that I leave alone until I need it, so I only have to pull > from now until then when I do. > Good idea :) >> On 3/12/2013 7:34 PM, Ezio Melotti wrote: >> I wonder if TortoiseHg is doing something wrong here. Maybe you could >> try from cmd too. > > Workbench has a 'command' window for typing hg commands which it should pass > as is to Windows much as Command Prompt does. I tried some of the things you > suggested there. > >> Around the time you pushed on 2.7 I also pushed something, so that >> might have created some conflict. > > I do not remember seeing that. > I pushed on 3.3/default about half an hour after you pushed on 2.7, so that might have caused a push race, if during that time you were doing the merges and eventually tried to push after me without having pulled/updated in the meanwhile. The problem you described doesn't seem to be related to push races though. >> How does your .bat look like? > > pull -u to cpython + update of each of the three shares, much like written > in the devguide. > It's better to avoid using "hg pull -u", because if there's nothing to pull the "update" won't be executed. Here it shouldn't be a big problem, but you could break it if you manually pull something in one of the shared clones, and then run the .bat. Unless you also have an explicit "hg up" in the clone where you do "hg pull -u", that clone won't be updated by the script. >> That's possible. From "hg help graft": >> If a graft merge results in conflicts, the graft process is interrupted so >> that the current merge can be manually resolved. Once all conflicts are >> addressed, the graft process can be continued with the -c/--continue >> option. > > When merge produces a conflict, a window appears offering options including > using kdiff3 to resolve. When I tried the graft, the message in the command > window was just 'aborted', and I do not remember getting the resolve window. > What version of HG are you using? >> When I graft/merge and there are conflicts I use kdiff3, and it takes >> just a few seconds to solve the conflicts usually (for Misc/NEWS is >> ctrl+2, ctrl+3, ctrl+s, alt+f4, that roughly translates too "include >> both the conflicting news, save and quit). > > Since I have perhaps never gotten that sequence right, that info will be > helpful. > Glad to help, however I got it the other way around. The 1st pane is the parent and you can just ignore it; the 2nd pane is the local copy and the 3rd pane is the one from the previous branch that you are merging. The bottom pane will be the resulting file. For Misc/NEWS (the file that usually conflicts), you want the newest NEWS entry first, so you do ctrl+3 to get the one you just added, and ctrl+2 to get the one that was there already. Note that for other files you usually want to get only one of the versions, usually the one you have in the 3rd pane, so that sequence only applies to Misc/NEWS. Another tip is to use ctrl+q instead of alt+f4. >> If you do it from cmd/file manager hg should see it as missing ('!' in >> "hg status") and you can use "hg revert Misc/NEWS" to restore it. > > This. > > Thanks for trying to help. I will let you know if there are any more > problems after the re-clone. > Sure, and if you find part of the devguide that are not clear let me know (I also just uploaded a new patch to http://bugs.python.org/issue14468 to add a few new Mercurial FAQs to the devguide). Best Regards, Ezio Melotti > I still need to comment on the tcl/tk.dll and tkinter situation, but will > just mention now that I ran the four test_txxxx files on 3.3a0 (on Windows) > and they seemed to finish and be ok other than altering the environment. > > > Terry From python-checkins at python.org Wed Mar 13 16:27:53 2013 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 13 Mar 2013 16:27:53 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_expose_O=5FPATH_if_possibl?= =?utf-8?q?e?= Message-ID: <3ZQxkx0LvRzQXR@mail.python.org> http://hg.python.org/cpython/rev/38e263d40d81 changeset: 82641:38e263d40d81 user: Benjamin Peterson date: Wed Mar 13 10:27:41 2013 -0500 summary: expose O_PATH if possible files: Doc/library/os.rst | 1 + Misc/NEWS | 2 ++ Modules/posixmodule.c | 3 +++ 3 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1137,6 +1137,7 @@ O_DIRECTORY O_NOFOLLOW O_NOATIME + O_PATH These constants are GNU extensions and not present if they are not defined by the C library. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -277,6 +277,8 @@ Library ------- +- Expose the O_PATH constant in the os module if it is available. + - Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused a failure while decoding empty object literals when object_pairs_hook was specified. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -10858,6 +10858,9 @@ #ifdef O_SEARCH if (ins(d, "O_SEARCH", (long)O_SEARCH)) return -1; #endif +#ifdef O_PATH + if (ins(d, "O_PATH", (long)O_PATH)) return -1; +#endif #ifdef O_TTY_INIT if (ins(d, "O_TTY_INIT", (long)O_TTY_INIT)) return -1; #endif -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 17:38:26 2013 From: python-checkins at python.org (brett.cannon) Date: Wed, 13 Mar 2013 17:38:26 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317222=3A_Document?= =?utf-8?q?_that_py=5Fcompile_now_uses_importlib_for_its_file?= Message-ID: <3ZQzJL3wFxzR0D@mail.python.org> http://hg.python.org/cpython/rev/55806d234653 changeset: 82642:55806d234653 user: Brett Cannon date: Wed Mar 13 09:37:42 2013 -0700 summary: Issue #17222: Document that py_compile now uses importlib for its file writing and thus its semantics. files: Doc/library/py_compile.rst | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/Doc/library/py_compile.rst b/Doc/library/py_compile.rst --- a/Doc/library/py_compile.rst +++ b/Doc/library/py_compile.rst @@ -28,7 +28,7 @@ .. function:: compile(file, cfile=None, dfile=None, doraise=False, optimize=-1) - Compile a source file to byte-code and write out the byte-code cache file. + Compile a source file to byte-code and write out the byte-code cache file. The source code is loaded from the file name *file*. The byte-code is written to *cfile*, which defaults to the :PEP:`3147` path, ending in ``.pyc`` (``.pyo`` if optimization is enabled in the current interpreter). @@ -50,6 +50,11 @@ default was *file* + ``'c'`` (``'o'`` if optimization was enabled). Also added the *optimize* parameter. + .. versionchanged:: 3.4 + Changed code to use :mod:`importlib` for the byte-code cache file writing. + This means file creation/writing semantics now match what :mod:`importlib` + does, e.g. permissions, write-and-move semantics, etc. + .. function:: main(args=None) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 18:45:47 2013 From: python-checkins at python.org (brett.cannon) Date: Wed, 13 Mar 2013 18:45:47 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317117=3A_Have_bot?= =?utf-8?q?h_import_itself_and_importlib=2Eutil=2Eset=5Floader=28=29?= Message-ID: <3ZR0p30JwfzQrp@mail.python.org> http://hg.python.org/cpython/rev/7647aae9481c changeset: 82643:7647aae9481c user: Brett Cannon date: Wed Mar 13 10:41:36 2013 -0700 summary: Issue #17117: Have both import itself and importlib.util.set_loader() set __loader__ on a module when set to None. Thanks to G?kcen Eraslan for the fix. files: Doc/library/importlib.rst | 4 + Doc/reference/import.rst | 16 +- Lib/importlib/_bootstrap.py | 9 +- Lib/test/test_importlib/import_/test___loader__.py | 44 + Lib/test/test_importlib/test_util.py | 42 +- Misc/ACKS | 1 + Misc/NEWS | 3 + Python/importlib.h | 6699 ++++----- 8 files changed, 3443 insertions(+), 3375 deletions(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -774,6 +774,10 @@ It is recommended that :func:`module_for_loader` be used over this decorator as it subsumes this functionality. + .. versionchanged:: 3.4 + Set ``__loader__`` if set to ``None`` as well if the attribute does not + exist. + .. decorator:: set_package diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst --- a/Doc/reference/import.rst +++ b/Doc/reference/import.rst @@ -369,16 +369,18 @@ * The ``__loader__`` attribute must be set to the loader object that loaded the module. This is mostly for introspection and reloading, but can be used for additional loader-specific functionality, for example getting - data associated with a loader. + data associated with a loader. If the attribute is missing or set to ``None`` + then the import machinery will automatically set it **after** the module has + been imported. - * The module's ``__package__`` attribute should be set. Its value must be a + * The module's ``__package__`` attribute must be set. Its value must be a string, but it can be the same value as its ``__name__``. If the attribute is set to ``None`` or is missing, the import system will fill it in with a - more appropriate value. When the module is a package, its ``__package__`` - value should be set to its ``__name__``. When the module is not a package, - ``__package__`` should be set to the empty string for top-level modules, or - for submodules, to the parent package's name. See :pep:`366` for further - details. + more appropriate value **after** the module has been imported. + When the module is a package, its ``__package__`` value should be set to its + ``__name__``. When the module is not a package, ``__package__`` should be + set to the empty string for top-level modules, or for submodules, to the + parent package's name. See :pep:`366` for further details. This attribute is used instead of ``__name__`` to calculate explicit relative imports for main modules, as defined in :pep:`366`. diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -494,7 +494,7 @@ """Set __loader__ on the returned module.""" def set_loader_wrapper(self, *args, **kwargs): module = fxn(self, *args, **kwargs) - if not hasattr(module, '__loader__'): + if getattr(module, '__loader__', None) is None: module.__loader__ = self return module _wrap(set_loader_wrapper, fxn) @@ -875,12 +875,9 @@ module.__cached__ = module.__file__ else: module.__cached__ = module.__file__ - module.__package__ = name if self.is_package(name): module.__path__ = [_path_split(module.__file__)[0]] - else: - module.__package__ = module.__package__.rpartition('.')[0] - module.__loader__ = self + # __package__ and __loader set by @module_for_loader. _call_with_frames_removed(exec, code_object, module.__dict__) return module @@ -1551,7 +1548,7 @@ except AttributeError: pass # Set loader if need be. - if not hasattr(module, '__loader__'): + if getattr(module, '__loader__', None) is None: try: module.__loader__ = loader except AttributeError: diff --git a/Lib/test/test_importlib/import_/test___loader__.py b/Lib/test/test_importlib/import_/test___loader__.py new file mode 100644 --- /dev/null +++ b/Lib/test/test_importlib/import_/test___loader__.py @@ -0,0 +1,44 @@ +import imp +import sys +import unittest + +from .. import util +from . import util as import_util + + +class LoaderMock: + + def find_module(self, fullname, path=None): + return self + + def load_module(self, fullname): + sys.modules[fullname] = self.module + return self.module + + +class LoaderAttributeTests(unittest.TestCase): + + def test___loader___missing(self): + module = imp.new_module('blah') + try: + del module.__loader__ + except AttributeError: + pass + loader = LoaderMock() + loader.module = module + with util.uncache('blah'), util.import_state(meta_path=[loader]): + module = import_util.import_('blah') + self.assertEqual(loader, module.__loader__) + + def test___loader___is_None(self): + module = imp.new_module('blah') + module.__loader__ = None + loader = LoaderMock() + loader.module = module + with util.uncache('blah'), util.import_state(meta_path=[loader]): + returned_module = import_util.import_('blah') + self.assertEqual(loader, module.__loader__) + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/Lib/test/test_importlib/test_util.py b/Lib/test/test_importlib/test_util.py --- a/Lib/test/test_importlib/test_util.py +++ b/Lib/test/test_importlib/test_util.py @@ -162,6 +162,37 @@ self.assertEqual(wrapped.__qualname__, fxn.__qualname__) +class SetLoaderTests(unittest.TestCase): + + """Tests importlib.util.set_loader().""" + + class DummyLoader: + @util.set_loader + def load_module(self, module): + return self.module + + def test_no_attribute(self): + loader = self.DummyLoader() + loader.module = imp.new_module('blah') + try: + del loader.module.__loader__ + except AttributeError: + pass + self.assertEqual(loader, loader.load_module('blah').__loader__) + + def test_attribute_is_None(self): + loader = self.DummyLoader() + loader.module = imp.new_module('blah') + loader.module.__loader__ = None + self.assertEqual(loader, loader.load_module('blah').__loader__) + + def test_not_reset(self): + loader = self.DummyLoader() + loader.module = imp.new_module('blah') + loader.module.__loader__ = 42 + self.assertEqual(42, loader.load_module('blah').__loader__) + + class ResolveNameTests(unittest.TestCase): """Tests importlib.util.resolve_name().""" @@ -195,14 +226,5 @@ util.resolve_name('..bacon', 'spam') -def test_main(): - from test import support - support.run_unittest( - ModuleForLoaderTests, - SetPackageTests, - ResolveNameTests - ) - - if __name__ == '__main__': - test_main() + unittest.main() diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -339,6 +339,7 @@ Jeff Epler Jeff McNeil Tom Epperly +G?kcen Eraslan Stoffel Erasmus J?rgen A. Erhard Michael Ernst diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #17117: Import and @importlib.util.set_loader now set __loader__ when + it has a value of None or the attribute doesn't exist. + - Issue #17327: Add PyDict_SetDefault. - Issue #17032: The "global" in the "NameError: global name 'x' is not defined" diff --git a/Python/importlib.h b/Python/importlib.h --- a/Python/importlib.h +++ b/Python/importlib.h [stripped] -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 18:45:48 2013 From: python-checkins at python.org (brett.cannon) Date: Wed, 13 Mar 2013 18:45:48 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Normalize_whitespace?= Message-ID: <3ZR0p435yqzR3K@mail.python.org> http://hg.python.org/cpython/rev/abbc9ae0a384 changeset: 82644:abbc9ae0a384 user: Brett Cannon date: Wed Mar 13 10:45:33 2013 -0700 summary: Normalize whitespace files: Lib/test/test_importlib/import_/test___loader__.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_importlib/import_/test___loader__.py b/Lib/test/test_importlib/import_/test___loader__.py --- a/Lib/test/test_importlib/import_/test___loader__.py +++ b/Lib/test/test_importlib/import_/test___loader__.py @@ -41,4 +41,4 @@ if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 19:03:08 2013 From: python-checkins at python.org (brett.cannon) Date: Wed, 13 Mar 2013 19:03:08 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317176=3A_Document?= =?utf-8?q?_that_imp=2ENullImporter_is_no_longer_inserted?= Message-ID: <3ZR1B42ny7zRRj@mail.python.org> http://hg.python.org/cpython/rev/8e390e4784b0 changeset: 82645:8e390e4784b0 user: Brett Cannon date: Wed Mar 13 10:46:22 2013 -0700 summary: Issue #17176: Document that imp.NullImporter is no longer inserted into sys.path_importer_cache. files: Doc/library/imp.rst | 9 +++++---- Doc/library/sys.rst | 9 ++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Doc/library/imp.rst b/Doc/library/imp.rst --- a/Doc/library/imp.rst +++ b/Doc/library/imp.rst @@ -326,16 +326,17 @@ with an existing directory or empty string raises :exc:`ImportError`. Otherwise, a :class:`NullImporter` instance is returned. - Python adds instances of this type to ``sys.path_importer_cache`` for any path - entries that are not directories and are not handled by any other path hooks on - ``sys.path_hooks``. Instances have only one method: - + Instances have only one method: .. method:: NullImporter.find_module(fullname [, path]) This method always returns ``None``, indicating that the requested module could not be found. + .. versionchanged:: 3.3 + ``None`` is inserted into ``sys.path_importer_cache`` instead of an + instance of :class:`NullImporter`. + .. _examples-imp: diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -785,12 +785,15 @@ A dictionary acting as a cache for :term:`finder` objects. The keys are paths that have been passed to :data:`sys.path_hooks` and the values are the finders that are found. If a path is a valid file system path but no - explicit finder is found on :data:`sys.path_hooks` then ``None`` is - stored to represent the implicit default finder should be used. If the path - is not an existing path then :class:`imp.NullImporter` is set. + finder is found on :data:`sys.path_hooks` then ``None`` is + stored. Originally specified in :pep:`302`. + .. versionchanged:: 3.3 + ``None`` is stored instead of :class:`imp.NullImporter` when no finder + is found. + .. data:: platform -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 19:03:09 2013 From: python-checkins at python.org (brett.cannon) Date: Wed, 13 Mar 2013 19:03:09 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE3MTc2?= =?utf-8?q?=3A_Document_that_imp=2ENullImporter_is_no_longer?= Message-ID: <3ZR1B55YntzRXb@mail.python.org> http://hg.python.org/cpython/rev/e470370b4701 changeset: 82646:e470370b4701 branch: 3.3 parent: 82639:bf0632a17ab4 user: Brett Cannon date: Wed Mar 13 10:58:50 2013 -0700 summary: Issue #17176: Document that imp.NullImporter is no longer automatically used by import. files: Doc/library/imp.rst | 9 +++++---- Doc/library/sys.rst | 9 ++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Doc/library/imp.rst b/Doc/library/imp.rst --- a/Doc/library/imp.rst +++ b/Doc/library/imp.rst @@ -326,16 +326,17 @@ with an existing directory or empty string raises :exc:`ImportError`. Otherwise, a :class:`NullImporter` instance is returned. - Python adds instances of this type to ``sys.path_importer_cache`` for any path - entries that are not directories and are not handled by any other path hooks on - ``sys.path_hooks``. Instances have only one method: - + Instances have only one method: .. method:: NullImporter.find_module(fullname [, path]) This method always returns ``None``, indicating that the requested module could not be found. + .. versionchanged:: 3.3 + ``None`` is inserted into ``sys.path_importer_cache`` instead of an + instance of :class:`NullImporter`. + .. _examples-imp: diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -770,12 +770,15 @@ A dictionary acting as a cache for :term:`finder` objects. The keys are paths that have been passed to :data:`sys.path_hooks` and the values are the finders that are found. If a path is a valid file system path but no - explicit finder is found on :data:`sys.path_hooks` then ``None`` is - stored to represent the implicit default finder should be used. If the path - is not an existing path then :class:`imp.NullImporter` is set. + finder is found on :data:`sys.path_hooks` then ``None`` is + stored. Originally specified in :pep:`302`. + .. versionchanged:: 3.3 + ``None`` is stored instead of :class:`imp.NullImporter` when no finder + is found. + .. data:: platform -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 19:03:11 2013 From: python-checkins at python.org (brett.cannon) Date: Wed, 13 Mar 2013 19:03:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZR1B71NVXzQrp@mail.python.org> http://hg.python.org/cpython/rev/d965366e5ebd changeset: 82647:d965366e5ebd parent: 82645:8e390e4784b0 parent: 82646:e470370b4701 user: Brett Cannon date: Wed Mar 13 11:02:29 2013 -0700 summary: merge files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 19:09:58 2013 From: python-checkins at python.org (brett.cannon) Date: Wed, 13 Mar 2013 19:09:58 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317099=3A_Have_imp?= =?utf-8?q?ortlib=2Efind=5Floader=28=29_raise_ValueError_when?= Message-ID: <3ZR1Ky6LGLzRHR@mail.python.org> http://hg.python.org/cpython/rev/cee04627bdd0 changeset: 82648:cee04627bdd0 user: Brett Cannon date: Wed Mar 13 11:09:08 2013 -0700 summary: Issue #17099: Have importlib.find_loader() raise ValueError when __loader__ is not set on a module. This brings the exception in line with when __loader__ is None (which is equivalent to not having the attribute defined). files: Doc/library/importlib.rst | 8 +++++++- Lib/importlib/__init__.py | 2 ++ Lib/test/test_importlib/test_api.py | 14 ++++++++++++++ Misc/NEWS | 3 +++ 4 files changed, 26 insertions(+), 1 deletions(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -90,7 +90,7 @@ Find the loader for a module, optionally within the specified *path*. If the module is in :attr:`sys.modules`, then ``sys.modules[name].__loader__`` is - returned (unless the loader would be ``None``, in which case + returned (unless the loader would be ``None`` or is not set, in which case :exc:`ValueError` is raised). Otherwise a search using :attr:`sys.meta_path` is done. ``None`` is returned if no loader is found. @@ -99,6 +99,12 @@ will need to import all parent packages of the submodule and use the correct argument to *path*. + .. versionadded:: 3.3 + + .. versionchanged:: 3.4 + If ``__loader__`` is not set, raise :exc:`ValueError`, just like when the + attribute is set to ``None``. + .. function:: invalidate_caches() Invalidate the internal caches of finders stored at diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py --- a/Lib/importlib/__init__.py +++ b/Lib/importlib/__init__.py @@ -68,6 +68,8 @@ return loader except KeyError: pass + except AttributeError: + raise ValueError('{}.__loader__ is not set'.format(name)) return _bootstrap._find_module(name, path) diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py --- a/Lib/test/test_importlib/test_api.py +++ b/Lib/test/test_importlib/test_api.py @@ -116,6 +116,20 @@ with self.assertRaises(ValueError): importlib.find_loader(name) + def test_sys_modules_loader_is_not_set(self): + # Should raise ValueError + # Issue #17099 + name = 'some_mod' + with util.uncache(name): + module = imp.new_module(name) + try: + del module.__loader__ + except AttributeError: + pass + sys.modules[name] = module + with self.assertRaises(ValueError): + importlib.find_loader(name) + def test_success(self): # Return the loader found on sys.meta_path. name = 'some_mod' diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -280,6 +280,9 @@ Library ------- +- Issue #17099: Have importlib.find_loader() raise ValueError when __loader__ + is not set, harmonizing with what happens when the attribute is set to None. + - Expose the O_PATH constant in the os module if it is available. - Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 20:06:50 2013 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 13 Mar 2013 20:06:50 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_make_some_freezing_related?= =?utf-8?q?_stuff_const?= Message-ID: <3ZR2bZ6yhbzR0j@mail.python.org> http://hg.python.org/cpython/rev/a06fc2c2342a changeset: 82649:a06fc2c2342a user: Benjamin Peterson date: Wed Mar 13 14:06:39 2013 -0500 summary: make some freezing related stuff const files: Include/import.h | 6 +++--- Modules/_freeze_importlib.c | 6 +++--- Python/frozen.c | 4 ++-- Python/importlib.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Include/import.h b/Include/import.h --- a/Include/import.h +++ b/Include/import.h @@ -113,15 +113,15 @@ #ifndef Py_LIMITED_API struct _frozen { - char *name; /* ASCII encoded string */ - unsigned char *code; + const char *name; /* ASCII encoded string */ + const unsigned char *code; int size; }; /* Embedding apps may change this pointer to point to their favorite collection of frozen modules: */ -PyAPI_DATA(struct _frozen *) PyImport_FrozenModules; +PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules; #endif #ifdef __cplusplus diff --git a/Modules/_freeze_importlib.c b/Modules/_freeze_importlib.c --- a/Modules/_freeze_importlib.c +++ b/Modules/_freeze_importlib.c @@ -17,7 +17,7 @@ of frozen modules instead, left deliberately blank so as to avoid unintentional import of a stale version of _frozen_importlib. */ -static struct _frozen _PyImport_FrozenModules[] = { +const static struct _frozen _PyImport_FrozenModules[] = { {0, 0, 0} /* sentinel */ }; @@ -25,7 +25,7 @@ /* On Windows, this links with the regular pythonXY.dll, so this variable comes from frozen.obj. In the Makefile, frozen.o is not linked into this executable, so we define the variable here. */ -struct _frozen *PyImport_FrozenModules; +const struct _frozen *PyImport_FrozenModules; #endif const char header[] = "/* Auto-generated by Modules/_freeze_importlib.c */"; @@ -105,7 +105,7 @@ return 1; } fprintf(outfile, "%s\n", header); - fprintf(outfile, "unsigned char _Py_M__importlib[] = {\n"); + fprintf(outfile, "const unsigned char _Py_M__importlib[] = {\n"); for (n = 0; n < data_size; n += 16) { size_t i, end = Py_MIN(n + 16, data_size); fprintf(outfile, " "); diff --git a/Python/frozen.c b/Python/frozen.c --- a/Python/frozen.c +++ b/Python/frozen.c @@ -28,7 +28,7 @@ #define SIZE (int)sizeof(M___hello__) -static struct _frozen _PyImport_FrozenModules[] = { +static const struct _frozen _PyImport_FrozenModules[] = { /* importlib */ {"_frozen_importlib", _Py_M__importlib, (int)sizeof(_Py_M__importlib)}, /* Test module */ @@ -42,4 +42,4 @@ /* Embedding apps may change this pointer to point to their favorite collection of frozen modules: */ -struct _frozen *PyImport_FrozenModules = _PyImport_FrozenModules; +const struct _frozen *PyImport_FrozenModules = _PyImport_FrozenModules; diff --git a/Python/importlib.h b/Python/importlib.h --- a/Python/importlib.h +++ b/Python/importlib.h [stripped] -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 21:40:31 2013 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 13 Mar 2013 21:40:31 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzE3MzA3IC0gRXhh?= =?utf-8?q?mple_of_HTTP_PUT_Request_using_httplib?= Message-ID: <3ZR4gg1Q80zR34@mail.python.org> http://hg.python.org/cpython/rev/4edde40afee6 changeset: 82650:4edde40afee6 branch: 2.7 parent: 82637:c226133b1493 user: Senthil Kumaran date: Wed Mar 13 13:30:25 2013 -0700 summary: #17307 - Example of HTTP PUT Request using httplib files: Doc/library/httplib.rst | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/Doc/library/httplib.rst b/Doc/library/httplib.rst --- a/Doc/library/httplib.rst +++ b/Doc/library/httplib.rst @@ -612,3 +612,20 @@ 'Redirecting to http://bugs.python.org/issue12524' >>> conn.close() +Client side ``HTTP PUT`` requests are very similar to ``POST`` requests. The +difference lies only the server side where HTTP server will allow resources to +be created via ``PUT`` request. Here is an example session that shows how to do +``PUT`` request using httplib:: + + >>> # This creates an HTTP message + >>> # with the content of BODY as the enclosed representation + >>> # for the resource http://localhost:8080/foobar + ... + >>> import httplib + >>> BODY = "***filecontents***" + >>> conn = httplib.HTTPConnection("localhost", 8080) + >>> conn.request("PUT", "/file", BODY) + >>> response = conn.getresponse() + >>> print resp.status, response.reason + 200, OK + -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 21:40:32 2013 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 13 Mar 2013 21:40:32 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3MzA3IC0gRXhh?= =?utf-8?q?mple_of_HTTP_PUT_Request_using_http=2Eclient?= Message-ID: <3ZR4gh44PZzRFH@mail.python.org> http://hg.python.org/cpython/rev/d4ab6556ff97 changeset: 82651:d4ab6556ff97 branch: 3.2 parent: 82638:df27ea4bdebd user: Senthil Kumaran date: Wed Mar 13 13:38:33 2013 -0700 summary: #17307 - Example of HTTP PUT Request using http.client files: Doc/library/http.client.rst | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -612,6 +612,22 @@ b'Redirecting to http://bugs.python.org/issue12524' >>> conn.close() +Client side ``HTTP PUT`` requests are very similar to ``POST`` requests. The +difference lies only the server side where HTTP server will allow resources to +be created via ``PUT`` request. Here is an example session that shows how to do +``PUT`` request using http.client:: + + >>> # This creates an HTTP message + >>> # with the content of BODY as the enclosed representation + >>> # for the resource http://localhost:8080/foobar + ... + >>> import http.client + >>> BODY = "***filecontents***" + >>> conn = http.client.HTTPConnection("localhost", 8080) + >>> conn.request("PUT", "/file", BODY) + >>> response = conn.getresponse() + >>> print(resp.status, response.reason) + 200, OK .. _httpmessage-objects: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 21:40:34 2013 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 13 Mar 2013 21:40:34 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2317307_-_merge_from_3=2E2?= Message-ID: <3ZR4gk04ydzRRj@mail.python.org> http://hg.python.org/cpython/rev/9941a9bbfeb6 changeset: 82652:9941a9bbfeb6 branch: 3.3 parent: 82646:e470370b4701 parent: 82651:d4ab6556ff97 user: Senthil Kumaran date: Wed Mar 13 13:42:47 2013 -0700 summary: #17307 - merge from 3.2 files: Doc/library/http.client.rst | 18 ++++++++++++++++++ Doc/library/urllib.request.rst | 9 +++++++++ 2 files changed, 27 insertions(+), 0 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -633,6 +633,24 @@ b'Redirecting to http://bugs.python.org/issue12524' >>> conn.close() +Client side ``HTTP PUT`` requests are very similar to ``POST`` requests. The +difference lies only the server side where HTTP server will allow resources to +be created via ``PUT`` request. It should be noted that custom HTTP methods ++are also handled in :class:`urllib.request.Request` by sending the appropriate ++method attribute.Here is an example session that shows how to do ``PUT`` +request using http.client:: + + >>> # This creates an HTTP message + >>> # with the content of BODY as the enclosed representation + >>> # for the resource http://localhost:8080/foobar + ... + >>> import http.client + >>> BODY = "***filecontents***" + >>> conn = http.client.HTTPConnection("localhost", 8080) + >>> conn.request("PUT", "/file", BODY) + >>> response = conn.getresponse() + >>> print(resp.status, response.reason) + 200, OK .. _httpmessage-objects: diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1109,6 +1109,15 @@ data = sys.stdin.read() print('Content-type: text-plain\n\nGot Data: "%s"' % data) +Here is an example of doing a ``PUT`` request using :class:`Request`:: + + import urllib.request + DATA=b'some data' + req = urllib.request.Request(url='http://localhost:8080', data=DATA,method='PUT') + f = urllib.request.urlopen(req) + print(f.status) + print(f.reason) + Use of Basic HTTP Authentication:: import urllib.request -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 13 21:40:35 2013 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 13 Mar 2013 21:40:35 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_=2317307_-_merge_from_3=2E3?= Message-ID: <3ZR4gl4wq0zRH1@mail.python.org> http://hg.python.org/cpython/rev/57e5409a998e changeset: 82653:57e5409a998e parent: 82649:a06fc2c2342a parent: 82652:9941a9bbfeb6 user: Senthil Kumaran date: Wed Mar 13 13:43:23 2013 -0700 summary: #17307 - merge from 3.3 files: Doc/library/http.client.rst | 18 ++++++++++++++++++ Doc/library/urllib.request.rst | 9 +++++++++ 2 files changed, 27 insertions(+), 0 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -633,6 +633,24 @@ b'Redirecting to http://bugs.python.org/issue12524' >>> conn.close() +Client side ``HTTP PUT`` requests are very similar to ``POST`` requests. The +difference lies only the server side where HTTP server will allow resources to +be created via ``PUT`` request. It should be noted that custom HTTP methods ++are also handled in :class:`urllib.request.Request` by sending the appropriate ++method attribute.Here is an example session that shows how to do ``PUT`` +request using http.client:: + + >>> # This creates an HTTP message + >>> # with the content of BODY as the enclosed representation + >>> # for the resource http://localhost:8080/foobar + ... + >>> import http.client + >>> BODY = "***filecontents***" + >>> conn = http.client.HTTPConnection("localhost", 8080) + >>> conn.request("PUT", "/file", BODY) + >>> response = conn.getresponse() + >>> print(resp.status, response.reason) + 200, OK .. _httpmessage-objects: diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1141,6 +1141,15 @@ data = sys.stdin.read() print('Content-type: text-plain\n\nGot Data: "%s"' % data) +Here is an example of doing a ``PUT`` request using :class:`Request`:: + + import urllib.request + DATA=b'some data' + req = urllib.request.Request(url='http://localhost:8080', data=DATA,method='PUT') + f = urllib.request.urlopen(req) + print(f.status) + print(f.reason) + Use of Basic HTTP Authentication:: import urllib.request -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 14 02:42:09 2013 From: python-checkins at python.org (terry.reedy) Date: Thu, 14 Mar 2013 02:42:09 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3Mzg2?= =?utf-8?q?_make=2Ebat_must_run_with_Python_2_until_Sphinx_runs_with_Pytho?= =?utf-8?q?n_3=2E?= Message-ID: <3ZRCMj04XJzRH1@mail.python.org> http://hg.python.org/cpython/rev/9b45873e5a68 changeset: 82654:9b45873e5a68 branch: 3.2 parent: 82651:d4ab6556ff97 user: Terry Jan Reedy date: Wed Mar 13 21:33:50 2013 -0400 summary: Issue #17386 make.bat must run with Python 2 until Sphinx runs with Python 3. If PYTHON is undefined, this fails without the launcher (installed with 3.3 or from PyPI), but this is better than always failing. Patch from Zachary Ware. files: Doc/make.bat | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/make.bat b/Doc/make.bat --- a/Doc/make.bat +++ b/Doc/make.bat @@ -2,7 +2,7 @@ setlocal set SVNROOT=http://svn.python.org/projects -if "%PYTHON%" EQU "" set PYTHON=..\pcbuild\python +if "%PYTHON%" EQU "" set PYTHON=py -2 if "%HTMLHELP%" EQU "" set HTMLHELP=%ProgramFiles%\HTML Help Workshop\hhc.exe if "%DISTVERSION%" EQU "" for /f "usebackq" %%v in (`%PYTHON% tools/sphinxext/patchlevel.py`) do set DISTVERSION=%%v -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 14 02:42:10 2013 From: python-checkins at python.org (terry.reedy) Date: Thu, 14 Mar 2013 02:42:10 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_with_3=2E2=3A_Issue_=2317386?= Message-ID: <3ZRCMk2qjBzRx7@mail.python.org> http://hg.python.org/cpython/rev/e45db319e590 changeset: 82655:e45db319e590 branch: 3.3 parent: 82652:9941a9bbfeb6 parent: 82654:9b45873e5a68 user: Terry Jan Reedy date: Wed Mar 13 21:35:07 2013 -0400 summary: Merge with 3.2: Issue #17386 files: Doc/make.bat | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/make.bat b/Doc/make.bat --- a/Doc/make.bat +++ b/Doc/make.bat @@ -2,7 +2,7 @@ setlocal set SVNROOT=http://svn.python.org/projects -if "%PYTHON%" EQU "" set PYTHON=..\pcbuild\python +if "%PYTHON%" EQU "" set PYTHON=py -2 if "%HTMLHELP%" EQU "" set HTMLHELP=%ProgramFiles%\HTML Help Workshop\hhc.exe if "%DISTVERSION%" EQU "" for /f "usebackq" %%v in (`%PYTHON% tools/sphinxext/patchlevel.py`) do set DISTVERSION=%%v -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 14 02:42:11 2013 From: python-checkins at python.org (terry.reedy) Date: Thu, 14 Mar 2013 02:42:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E3=3A_Issue_=2317386?= Message-ID: <3ZRCMl5WJGzRwZ@mail.python.org> http://hg.python.org/cpython/rev/99e72eae35bb changeset: 82656:99e72eae35bb parent: 82653:57e5409a998e parent: 82655:e45db319e590 user: Terry Jan Reedy date: Wed Mar 13 21:35:46 2013 -0400 summary: Merge with 3.3: Issue #17386 files: Doc/make.bat | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/make.bat b/Doc/make.bat --- a/Doc/make.bat +++ b/Doc/make.bat @@ -2,7 +2,7 @@ setlocal set SVNROOT=http://svn.python.org/projects -if "%PYTHON%" EQU "" set PYTHON=..\pcbuild\python +if "%PYTHON%" EQU "" set PYTHON=py -2 if "%HTMLHELP%" EQU "" set HTMLHELP=%ProgramFiles%\HTML Help Workshop\hhc.exe if "%DISTVERSION%" EQU "" for /f "usebackq" %%v in (`%PYTHON% tools/sphinxext/patchlevel.py`) do set DISTVERSION=%%v -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Thu Mar 14 06:01:52 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 14 Mar 2013 06:01:52 +0100 Subject: [Python-checkins] Daily reference leaks (99e72eae35bb): sum=2 Message-ID: results for 99e72eae35bb on branch "default" -------------------------------------------- test_unittest leaked [-1, 2, 1] memory blocks, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogATjIgq', '-x'] From python-checkins at python.org Thu Mar 14 06:43:35 2013 From: python-checkins at python.org (nick.coghlan) Date: Thu, 14 Mar 2013 06:43:35 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Fix_PEP_headers?= Message-ID: <3ZRJkH2TbhzS00@mail.python.org> http://hg.python.org/peps/rev/f9164cc21a74 changeset: 4794:f9164cc21a74 user: Nick Coghlan date: Wed Mar 13 22:43:28 2013 -0700 summary: Fix PEP headers files: pep-0425.txt | 4 ++-- pep-0427.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pep-0425.txt b/pep-0425.txt --- a/pep-0425.txt +++ b/pep-0425.txt @@ -2,7 +2,7 @@ Title: Compatibility Tags for Built Distributions Version: $Revision$ Last-Modified: 07-Aug-2012 -Author: Daniel Holth BDFL-Delegate: Nick Coghlan Status: Accepted Type: Standards Track @@ -265,7 +265,7 @@ implentation at the time of writing guesses "none". Ideally it would detect "py27(d|m|u)" analagous to newer versions of Python, but in the meantime "none" is a good enough way to say "don't know". - + References ========== diff --git a/pep-0427.txt b/pep-0427.txt --- a/pep-0427.txt +++ b/pep-0427.txt @@ -2,7 +2,7 @@ Title: The Wheel Binary Package Format 1.0 Version: $Revision$ Last-Modified: $Date$ -Author: Daniel Holth +Author: Daniel Holth BDFL-Delegate: Nick Coghlan Discussions-To: Status: Accepted -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Mar 14 06:54:30 2013 From: python-checkins at python.org (nick.coghlan) Date: Thu, 14 Mar 2013 06:54:30 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_alternative_argument_clin?= =?utf-8?q?ic_DSL_PEP?= Message-ID: <3ZRJyt3fHqzS1Q@mail.python.org> http://hg.python.org/peps/rev/46f45025b61f changeset: 4795:46f45025b61f user: Nick Coghlan date: Wed Mar 13 22:54:21 2013 -0700 summary: Add alternative argument clinic DSL PEP files: pep-0437.txt | 359 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 359 insertions(+), 0 deletions(-) diff --git a/pep-0437.txt b/pep-0437.txt new file mode 100644 --- /dev/null +++ b/pep-0437.txt @@ -0,0 +1,359 @@ +PEP: 0437 +Title: A DSL for specifying signatures, annotations and argument converters +Version: $Revision$ +Last-Modified: $Date$ +Author: Stefan Krah +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 2013-03-11 +Python-Version: 3.4 +Post-History: +Resolution: + +Abstract +======== + +The Python C-API currently has no mechanism for specifying and auto-generating +function signatures, annotations or custom argument converters. + +There are several possible approaches to the problem. Cython uses *cdef* +definitions in *.pyx* files to generate the required information. However, +CPython's C-API functions often require additional initialization and +cleanup snippets that would be hard to specify in a *cdef*. + +PEP 436 proposes a domain specific language (DSL) enclosed in C comments +that largely resembles a per-parameter configuration file. A preprocessor +reads the comment and emits an argument parsing function, docstrings and +a header for the function that utilizes the results of the parsing step. + +The latter function is subsequently referred to as the *implementation +function*. + + +Rationale +========= + +Opinions differ regarding the suitability of the PEP 436 DSL in the context +of a C file. This PEP proposes an alternative DSL. The specific issues with +PEP 436 that spurred the counter proposal will be explained in the final +section of this PEP. + + +Scope +===== + +The PEP focuses exclusively on the DSL. Topics like the location of docstrings +are outside the scope of this PEP. It is however vital that the DSL is suitable +for generating custom argument parsers, a feature that is already implemented +in Cython. Therefore, one of the goals of this PEP is to keep the DSL close +to existing solutions, thus facilitating a possible inclusion of the relevant +parts of Cython into the CPython source tree. + + +DSL overview +============ + +Type safety and annotations +--------------------------- + +A conversion from a Python to a C value is fully defined by the type of +the converter function. The PyArg_Parse* family of functions accepts +custom converters in addition to the well-known default converters "i", +"f", etc. + +This PEP views the default converters as abstract functions, regardless +of how they are actually implemented. + + +Include/converters.h +-------------------- + +Converter functions must be forward-declared. All converter functions +shall be entered into the file Include/converters.h. The file is read +by the preprocessor prior to translating .c files. This is an excerpt:: + + /*[converter] + ##### Default converters ##### + "s": str -> const char *res; + "s*": [str, bytes, bytearray, rw_buffer] -> Py_buffer &res; + [...] + "es#": str -> (const char *res_encoding, char **res, Py_ssize_t *res_length); + [...] + ##### Custom converters ##### + path_converter: [str, bytes, int] -> path_t &res; + OS_STAT_DIR_FD_CONVERTER: [int, None] -> int res; + [converter_end]*/ + + +Converters are specified by their name, Python input type(s) and C output +type(s). Default converters must be have quoted names, custom converters +must have regular names. A Python type is given by its name. If a function +accepts multiple Python types, the set is written in list form. + +Since the default converters may have multiple implicit return values, +the C output type(s) are written according to the following convention: + +The main return value must be named *res*. This is a placeholder for +the actual variable name given later in the DSL. Additional implicit +return values must be prefixed by *res_*. + +By default the variables are passed by value to the implementation function. +If the address should be passed instead, *res* must be prefixed with an +ampersand. + + +Additional declarations may be placed into .c files. Duplicate declarations +are allowed as long as the function types are identical. + + +TBD: Make a list of fantasy types like *rw_buffer*. + + +Function specifications +----------------------- + +Keyword arguments +^^^^^^^^^^^^^^^^^ + +This example contains the definition of os.stat. The individual sections +will be explained in detail. Grammatically, the whole define block consists +of a function specification and an output section. The function specification +in turn consists of a declaration section, a C-declaration section and a +cleanup code section. Sections within the function specification are +separated in yacc style by '%%':: + + + /*[define posix_stat] + def os.stat(path: path_converter, *, dir_fd: OS_STAT_DIR_FD_CONVERTER = None, + follow_symlinks: "p" = True) -> os.stat_result: pass + %% + path_t path = PATH_T_INITIALIZE("stat", 0, 1); + int dir_fd = DEFAULT_DIR_FD; + int follow_symlinks = 1; + %% + path_cleanup(&path); + [define_end]*/ + + + + /*[define_output_end]*/ + + +Define block +~~~~~~~~~~~~ + +The function specification block starts with a ``/*[define`` token, followed +by an optional C function name, followed by a right bracket. If the C function +name is not given, it is generated from the declaration name. In the example, +omitting the name *posix_stat* would result in a C function name of *os_stat*. + + +Declaration +~~~~~~~~~~~ + +The required declaration is (almost) a valid Python function definition. The +'def' keyword and the function body are redundant, but the author of this PEP +finds the definition more readable if they are present. + +The function name may be a path instead of a plain identifier. Each argument +is annotated with the name of the converter function that will be applied to it. + +Default values are given in the usual Python manner and may be any valid +Python expression. + +The return value may be any Python expression. Usually it will be the name +of an object, but alternative return values could be specified in list form. + + +C-declarations +~~~~~~~~~~~~~~ + +This section contains C variable declarations. Since the converter functions +have been declared beforehand, the preprocessor can type-check the declarations. + + +Cleanup +~~~~~~~ + +The cleanup section contains literal C code that will be inserted unmodified +after the implementation function. + + +Output +~~~~~~ + +The output section contains the code emitted by the preprocessor. + + +Positional-only arguments +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Functions that do not take keyword arguments are indicated by the presence +of the *slash* special parameter:: + + /*[define stat_float_times] + def os.stat_float_times(/, newval: "i") -> os.stat_result: pass + %% + int newval = -1; + [define_end]*/ + +The preprocessor translates this definition to a PyArg_ParseTuple() call. +All arguments to the right of the slash are optional arguments. + + +Left and right optional arguments +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Some legacy functions contain optional arguments groups both to the left and +right of a central parameter. It is debatable whether a new tool should support +such functions. For completeness' sake, this is the proposed syntax:: + + /*[define] + def curses.window.addch(y: "i", x: "i", ch: "O", attr: "l") -> None + where groups = [[ch], [ch, attr], [y, x, ch], [y, x, ch, attr]] + %% + int newval = -1; + [define_end]*/ + +Here *ch* is the central parameter, *attr* can optionally be added on the +right, and the group [y, x] can optionally be added on the left. + +Essentially the rule is that all ordered combinations of the central +parameter and the optional groups must be possible such that no two +combinations have the same length. + +This is concisely expressed by putting the central parameter first in +the list and subsequently adding the optional arguments groups to the +left and right. + + +Flexibility in formatting +========================= + +If the above os.stat example is considered too compact, it can easily be +formatted this way:: + + /*[define posix_stat] + def os.stat(path: path_converter, + *, + dir_fd: OS_STAT_DIR_FD_CONVERTER = None, + follow_symlinks: "p" = True) + -> os.stat_result: pass + %% + path_t path = PATH_T_INITIALIZE("stat", 0, 1); + int dir_fd = DEFAULT_DIR_FD; + int follow_symlinks = 1; + %% + path_cleanup(&path); + [define_end]*/ + + + + /*[define_output_end]*/ + + +Easy validation of the definition +================================= + +How can an inexperienced user validate a definition like os.stat? Simply +by changing os.stat to os_stat, defining missing converters and pasting +the definition into the Python interactive interpreter! + +In fact, a converters.py module could be auto-generated from converters.h. + + +Reference implementation +======================== + +A reference implementation is available at `issue 16612`_. Since this PEP +was written under time constraints and the author is unfamiliar with the +PLY toolchain, the software is written in Standard ML and utilizes the +ml-yacc/ml-lex toolchain. + +The grammar is conflict-free and available in ml-yacc readable BNF form. + +Two tools are available: + + * *printsemant* reads a converter header and a .c file and dumps + the semantically checked parse tree to stdout. + + * *preprocess* reads a converter header and a .c file and dumps + the preprocessed .c file to stdout. + + +Known deficiencies: + + * The Python 'test' expression is not semantically checked. The syntax + however is checked since it is part of the grammar. + + * The lexer does not handle triple quoted strings. + + * The *preprocess* tool does not emit code for the left-and-right optional + arguments case. The *printsemant* tool can deal with this case. + + * Since the *preprocess* tool generates the output from the parse + tree, the original indentation of the define block is lost. + + +Grammar +======= + + TBD: The grammar exists in ml-yacc readable form, but should probably be + included here in EBNF notation. + + +Comparison with PEP 436 +======================= + +The author of this PEP has the following concerns about the DSL proposed +in PEP 436: + + * The whitespace sensitive configuration file like syntax looks out + of place in a C file. + + * The structure of the function definition gets lost in the per-parameter + specifications. Keywords like positional-only, required and keyword-only + are scattered across too many different places. + + By contrast, in the alternative DSL the structure of the function + definition can be understood at a single glance. + + * The PEP 436 DSL has 14 documented flags and at least one undocumented + (allow_fd) flag. Figuring out which of the 2**15 possible combinations + are valid places an unnecessary burden on the user. + + Experience with the PEP-3118 buffer flags has shown that sorting out + (and exhaustively testing!) valid combinations is an extremely tedious + task. The PEP-3118 flags are still not well understood by many people. + + By contrast, the alternative DSL has a central file Include/converters.h + that can be quickly searched for the desired converter. Many of the + converters are already known, perhaps even memorized by people (due + to frequent use). + + * The PEP 436 DSL allows too much freedom. Types can apparently be omitted, + the preprocessor accepts (and ignores) unknown keywords, sometimes adding + white space after a docstring results in an assertion error. + + The alternative DSL on the other hand allows no such freedoms. Omitting + converter or return value annotations is plainly a syntax error. The + LALR(1) grammar is unambiguous and specified for the complete translation + unit. + + +Copyright +========= + +This document is licensed under the `Open Publication License`_. + + +References and Footnotes +======================== + +.. _issue 16612: http://bugs.python.org/issue16612 + +.. _Open Publication License: http://www.opencontent.org/openpub/ + + + -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Mar 14 08:21:00 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 14 Mar 2013 08:21:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?devguide=3A_=2315121=3A_document_the_?= =?utf-8?q?=22email=22_component=2E?= Message-ID: <3ZRLth60cBzR0j@mail.python.org> http://hg.python.org/devguide/rev/2889f71c9e20 changeset: 610:2889f71c9e20 user: Ezio Melotti date: Thu Mar 14 09:20:48 2013 +0200 summary: #15121: document the "email" component. files: triaging.rst | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/triaging.rst b/triaging.rst --- a/triaging.rst +++ b/triaging.rst @@ -90,6 +90,8 @@ The packaging module in `Lib/packaging`_. Documentation The documentation in Doc_ (used to build the HTML doc at http://docs.python.org/). +email + The email package and related modules. Extension Modules C modules in Modules_. IDLE -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Thu Mar 14 12:41:21 2013 From: python-checkins at python.org (stefan.krah) Date: Thu, 14 Mar 2013 12:41:21 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_-_Fix_typos_and_curses=2Ewind?= =?utf-8?q?ow=2Eaddch_definition=2E?= Message-ID: <3ZRSg50NZxzRnv@mail.python.org> http://hg.python.org/peps/rev/1c5f1077ab31 changeset: 4796:1c5f1077ab31 user: Stefan Krah date: Thu Mar 14 12:40:29 2013 +0100 summary: - Fix typos and curses.window.addch definition. - Point out that the C variable declaration and cleanup sections are in fact optional. - Mention that C declaration parsing needs to be improved in the reference implementation. files: pep-0437.txt | 35 ++++++++++++++++++----------------- 1 files changed, 18 insertions(+), 17 deletions(-) diff --git a/pep-0437.txt b/pep-0437.txt --- a/pep-0437.txt +++ b/pep-0437.txt @@ -87,9 +87,9 @@ Converters are specified by their name, Python input type(s) and C output -type(s). Default converters must be have quoted names, custom converters -must have regular names. A Python type is given by its name. If a function -accepts multiple Python types, the set is written in list form. +type(s). Default converters must have quoted names, custom converters must +have regular names. A Python type is given by its name. If a function accepts +multiple Python types, the set is written in list form. Since the default converters may have multiple implicit return values, the C output type(s) are written according to the following convention: @@ -116,13 +116,12 @@ Keyword arguments ^^^^^^^^^^^^^^^^^ -This example contains the definition of os.stat. The individual sections -will be explained in detail. Grammatically, the whole define block consists -of a function specification and an output section. The function specification -in turn consists of a declaration section, a C-declaration section and a -cleanup code section. Sections within the function specification are -separated in yacc style by '%%':: - +This example contains the definition of os.stat. The individual sections will +be explained in detail. Grammatically, the whole define block consists of a +function specification and an output section. The function specification in +turn consists of a declaration section, an optional C-declaration section and +an optional cleanup code section. Sections within the function specification +are separated in yacc style by '%%':: /*[define posix_stat] def os.stat(path: path_converter, *, dir_fd: OS_STAT_DIR_FD_CONVERTER = None, @@ -169,15 +168,16 @@ C-declarations ~~~~~~~~~~~~~~ -This section contains C variable declarations. Since the converter functions -have been declared beforehand, the preprocessor can type-check the declarations. +This optional section contains C variable declarations. Since the converter +functions have been declared beforehand, the preprocessor can type-check +the declarations. Cleanup ~~~~~~~ -The cleanup section contains literal C code that will be inserted unmodified -after the implementation function. +The optional cleanup section contains literal C code that will be inserted +unmodified after the implementation function. Output @@ -210,10 +210,8 @@ such functions. For completeness' sake, this is the proposed syntax:: /*[define] - def curses.window.addch(y: "i", x: "i", ch: "O", attr: "l") -> None + def curses.window.addch(y: "i", x: "i", ch: "O", attr: "l") -> None: pass where groups = [[ch], [ch, attr], [y, x, ch], [y, x, ch, attr]] - %% - int newval = -1; [define_end]*/ Here *ch* is the central parameter, *attr* can optionally be added on the @@ -289,6 +287,9 @@ * The lexer does not handle triple quoted strings. + * C declarations are parsed in a primitive way. The final implementation + should utilize 'declarator' and 'init-declarator' from the C grammar. + * The *preprocess* tool does not emit code for the left-and-right optional arguments case. The *printsemant* tool can deal with this case. -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Mar 14 12:50:26 2013 From: python-checkins at python.org (stefan.krah) Date: Thu, 14 Mar 2013 12:50:26 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Make_it_clear_that_the_locati?= =?utf-8?q?on_of_the_docstring_*specification*_is_a_valid?= Message-ID: <3ZRSsZ2fMqzRw0@mail.python.org> http://hg.python.org/peps/rev/528a18494b0a changeset: 4797:528a18494b0a user: Stefan Krah date: Thu Mar 14 12:50:00 2013 +0100 summary: Make it clear that the location of the docstring *specification* is a valid topic for this PEP. After all, some people prefer to include docstrings inside the DSL comment. files: pep-0437.txt | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pep-0437.txt b/pep-0437.txt --- a/pep-0437.txt +++ b/pep-0437.txt @@ -43,12 +43,14 @@ Scope ===== -The PEP focuses exclusively on the DSL. Topics like the location of docstrings -are outside the scope of this PEP. It is however vital that the DSL is suitable -for generating custom argument parsers, a feature that is already implemented -in Cython. Therefore, one of the goals of this PEP is to keep the DSL close -to existing solutions, thus facilitating a possible inclusion of the relevant -parts of Cython into the CPython source tree. +The PEP focuses exclusively on the DSL. Topics like the output locations of +docstrings or the generated code are outside the scope of this PEP. + +It is however vital that the DSL is suitable for generating custom argument +parsers, a feature that is already implemented in Cython. Therefore, one of +the goals of this PEP is to keep the DSL close to existing solutions, thus +facilitating a possible inclusion of the relevant parts of Cython into the +CPython source tree. DSL overview -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Mar 14 13:05:28 2013 From: python-checkins at python.org (stefan.krah) Date: Thu, 14 Mar 2013 13:05:28 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Mention_possibility_of_=28lim?= =?utf-8?q?ited!=29_type-checking_of_converter_definitions=2E?= Message-ID: <3ZRTBw6rFYzR2d@mail.python.org> http://hg.python.org/peps/rev/3256d33dbb4e changeset: 4798:3256d33dbb4e user: Stefan Krah date: Thu Mar 14 13:04:59 2013 +0100 summary: Mention possibility of (limited!) type-checking of converter definitions. files: pep-0437.txt | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/pep-0437.txt b/pep-0437.txt --- a/pep-0437.txt +++ b/pep-0437.txt @@ -108,6 +108,10 @@ Additional declarations may be placed into .c files. Duplicate declarations are allowed as long as the function types are identical. +It is encouraged to declare custom converter types a second time right +above the converter function definition. The preprocessor will then catch +any mismatch between the declarations. + TBD: Make a list of fantasy types like *rw_buffer*. -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Mar 14 13:12:15 2013 From: python-checkins at python.org (stefan.krah) Date: Thu, 14 Mar 2013 13:12:15 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Deprecate_PY=5FSSIZE=5FT=5FCL?= =?utf-8?q?EAN=3A_Always_assume_Py=5Fssize=5Ft_for_length_arguments=2E?= Message-ID: <3ZRTLl2qlgzMKB@mail.python.org> http://hg.python.org/peps/rev/3980c63df840 changeset: 4799:3980c63df840 user: Stefan Krah date: Thu Mar 14 13:11:37 2013 +0100 summary: Deprecate PY_SSIZE_T_CLEAN: Always assume Py_ssize_t for length arguments. files: pep-0437.txt | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/pep-0437.txt b/pep-0437.txt --- a/pep-0437.txt +++ b/pep-0437.txt @@ -113,6 +113,10 @@ any mismatch between the declarations. +In order to keep the converter complexity manageable, PY_SSIZE_T_CLEAN will +be deprecated and Py_ssize_t will be assumed for all length arguments. + + TBD: Make a list of fantasy types like *rw_buffer*. -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Mar 14 15:18:51 2013 From: python-checkins at python.org (stefan.krah) Date: Thu, 14 Mar 2013 15:18:51 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_fork=5Fexec_example=2E?= Message-ID: <3ZRX8q0yT5zQd9@mail.python.org> http://hg.python.org/peps/rev/06fe3dcc6f37 changeset: 4800:06fe3dcc6f37 user: Stefan Krah date: Thu Mar 14 15:18:24 2013 +0100 summary: Add fork_exec example. files: pep-0437.txt | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/pep-0437.txt b/pep-0437.txt --- a/pep-0437.txt +++ b/pep-0437.txt @@ -261,6 +261,28 @@ /*[define_output_end]*/ +Benefits of a compact notation +============================== + +The advantages of a concise notation are especially obvious when a large +number of parameters is involved. The argument parsing part of +``_posixsubprocess.fork_exec`` is fully specified by this definition:: + + /*[define subprocess_fork_exec] + def _posixsubprocess.fork_exec( + process_args: "O", executable_list: "O", + close_fds: "p", py_fds_to_keep: "O", + cwd_obj: "O", env_list: "O", + p2cread: "i", p2cwrite: "i", c2pread: "i", c2pwrite: "i", + errread: "i", errwrite: "i", errpipe_read: "i", errpipe_write: "i", + restore_signals: "i", call_setsid: "i", preexec_fn: "i", /) -> int: pass + [define_end]*/ + + +Note that the *preprocess* tool currently emits a redundant C-declaration +section for this example, so the output is longer than necessary. + + Easy validation of the definition ================================= -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Mar 14 19:59:48 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 14 Mar 2013 19:59:48 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3Mjk5?= =?utf-8?q?=3A_Add_test_coverage_for_cPickle_with_file_objects_and_general?= =?utf-8?q?_IO?= Message-ID: <3ZRfP063HhzRXs@mail.python.org> http://hg.python.org/cpython/rev/8a0b5c9f04c2 changeset: 82657:8a0b5c9f04c2 branch: 2.7 parent: 82650:4edde40afee6 user: Serhiy Storchaka date: Thu Mar 14 20:59:09 2013 +0200 summary: Issue #17299: Add test coverage for cPickle with file objects and general IO objects. Original patch by Aman Shah. files: Lib/test/test_cpickle.py | 135 ++++++++++++++++++++++----- Misc/ACKS | 1 + Misc/NEWS | 3 + 3 files changed, 114 insertions(+), 25 deletions(-) diff --git a/Lib/test/test_cpickle.py b/Lib/test/test_cpickle.py --- a/Lib/test/test_cpickle.py +++ b/Lib/test/test_cpickle.py @@ -1,11 +1,45 @@ -import cPickle, unittest -from cStringIO import StringIO +import cPickle +import cStringIO +import io +import unittest from test.pickletester import (AbstractPickleTests, AbstractPickleModuleTests, AbstractPicklerUnpicklerObjectTests, BigmemPickleTests) from test import test_support +class cStringIOMixin: + output = input = cStringIO.StringIO + + def close(self, f): + pass + +class BytesIOMixin: + output = input = io.BytesIO + + def close(self, f): + pass + +class FileIOMixin: + + def output(self): + return open(test_support.TESTFN, 'w+') + + def input(self, data): + f = open(test_support.TESTFN, 'w+') + try: + f.write(data) + f.seek(0) + return f + except: + f.close() + raise + + def close(self, f): + f.close() + test_support.unlink(test_support.TESTFN) + + class cPickleTests(AbstractPickleTests, AbstractPickleModuleTests): def setUp(self): @@ -18,19 +52,35 @@ class cPicklePicklerTests(AbstractPickleTests): def dumps(self, arg, proto=0): - f = StringIO() - p = cPickle.Pickler(f, proto) - p.dump(arg) - f.seek(0) - return f.read() + f = self.output() + try: + p = cPickle.Pickler(f, proto) + p.dump(arg) + f.seek(0) + return f.read() + finally: + self.close(f) def loads(self, buf): - f = StringIO(buf) - p = cPickle.Unpickler(f) - return p.load() + f = self.input(buf) + try: + p = cPickle.Unpickler(f) + return p.load() + finally: + self.close(f) error = cPickle.BadPickleGet +class cStringIOCPicklerTests(cStringIOMixin, cPicklePicklerTests): + pass + +class BytesIOCPicklerTests(BytesIOMixin, cPicklePicklerTests): + pass + +class FileIOCPicklerTests(FileIOMixin, cPicklePicklerTests): + pass + + class cPickleListPicklerTests(AbstractPickleTests): def dumps(self, arg, proto=0): @@ -39,26 +89,45 @@ return p.getvalue() def loads(self, *args): - f = StringIO(args[0]) - p = cPickle.Unpickler(f) - return p.load() + f = self.input(args[0]) + try: + p = cPickle.Unpickler(f) + return p.load() + finally: + self.close(f) error = cPickle.BadPickleGet +class cStringIOCPicklerListTests(cStringIOMixin, cPickleListPicklerTests): + pass + +class BytesIOCPicklerListTests(BytesIOMixin, cPickleListPicklerTests): + pass + +class FileIOCPicklerListTests(FileIOMixin, cPickleListPicklerTests): + pass + + class cPickleFastPicklerTests(AbstractPickleTests): def dumps(self, arg, proto=0): - f = StringIO() - p = cPickle.Pickler(f, proto) - p.fast = 1 - p.dump(arg) - f.seek(0) - return f.read() + f = self.output() + try: + p = cPickle.Pickler(f, proto) + p.fast = 1 + p.dump(arg) + f.seek(0) + return f.read() + finally: + self.close(f) def loads(self, *args): - f = StringIO(args[0]) - p = cPickle.Unpickler(f) - return p.load() + f = self.input(args[0]) + try: + p = cPickle.Unpickler(f) + return p.load() + finally: + self.close(f) error = cPickle.BadPickleGet @@ -98,6 +167,16 @@ b = self.loads(self.dumps(a)) self.assertEqual(a, b) +class cStringIOCPicklerFastTests(cStringIOMixin, cPickleFastPicklerTests): + pass + +class BytesIOCPicklerFastTests(BytesIOMixin, cPickleFastPicklerTests): + pass + +class FileIOCPicklerFastTests(FileIOMixin, cPickleFastPicklerTests): + pass + + class cPicklePicklerUnpicklerObjectTests(AbstractPicklerUnpicklerObjectTests): pickler_class = cPickle.Pickler @@ -140,9 +219,15 @@ def test_main(): test_support.run_unittest( cPickleTests, - cPicklePicklerTests, - cPickleListPicklerTests, - cPickleFastPicklerTests, + cStringIOCPicklerTests, + BytesIOCPicklerTests, + FileIOCPicklerTests, + cStringIOCPicklerListTests, + BytesIOCPicklerListTests, + FileIOCPicklerListTests, + cStringIOCPicklerFastTests, + BytesIOCPicklerFastTests, + FileIOCPicklerFastTests, cPickleDeepRecursive, cPicklePicklerUnpicklerObjectTests, cPickleBigmemPickleTests, diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -910,6 +910,7 @@ Pete Sevander Denis Severson Ian Seyer +Aman Shah Ha Shao Mark Shannon Richard Shapiro diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -816,6 +816,9 @@ Tests ----- +- Issue #17299: Add test coverage for cPickle with file objects and general IO + objects. Original patch by Aman Shah. + - Issue #11963: remove human verification from test_parser and test_subprocess. - Issue #17249: convert a test in test_capi to use unittest and reap threads. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 14 20:43:29 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 14 Mar 2013 20:43:29 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyODUw?= =?utf-8?q?86=3A_Get_rid_of_the_refcounting_hack_and_speed_up_urllib=2Eunq?= =?utf-8?b?dW90ZSgpLg==?= Message-ID: <3ZRgMP2SxMzR5p@mail.python.org> http://hg.python.org/cpython/rev/4927899bea8d changeset: 82658:4927899bea8d branch: 2.7 user: Serhiy Storchaka date: Thu Mar 14 21:31:09 2013 +0200 summary: Issue #1285086: Get rid of the refcounting hack and speed up urllib.unquote(). files: Lib/urllib.py | 32 ++++++++++++++++++++------- Lib/urlparse.py | 42 +++++++++++++++++++++++++++++------- Misc/NEWS | 2 + 3 files changed, 58 insertions(+), 18 deletions(-) diff --git a/Lib/urllib.py b/Lib/urllib.py --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -28,6 +28,7 @@ import time import sys import base64 +import re from urlparse import urljoin as basejoin @@ -1198,22 +1199,35 @@ _hexdig = '0123456789ABCDEFabcdef' _hextochr = dict((a + b, chr(int(a + b, 16))) for a in _hexdig for b in _hexdig) +_asciire = re.compile('([\x00-\x7f]+)') def unquote(s): """unquote('abc%20def') -> 'abc def'.""" - res = s.split('%') + if _is_unicode(s): + if '%' not in s: + return s + bits = _asciire.split(s) + res = [bits[0]] + append = res.append + for i in range(1, len(bits), 2): + append(unquote(str(bits[i])).decode('latin1')) + append(bits[i + 1]) + return ''.join(res) + + bits = s.split('%') # fastpath - if len(res) == 1: + if len(bits) == 1: return s - s = res[0] - for item in res[1:]: + res = [bits[0]] + append = res.append + for item in bits[1:]: try: - s += _hextochr[item[:2]] + item[2:] + append(_hextochr[item[:2]]) + append(item[2:]) except KeyError: - s += '%' + item - except UnicodeDecodeError: - s += unichr(int(item[:2], 16)) + item[2:] - return s + append('%') + append(item) + return ''.join(res) def unquote_plus(s): """unquote('%7e/abc+def') -> '~/abc def'""" diff --git a/Lib/urlparse.py b/Lib/urlparse.py --- a/Lib/urlparse.py +++ b/Lib/urlparse.py @@ -28,6 +28,8 @@ """ +import re + __all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag", "urlsplit", "urlunsplit", "parse_qs", "parse_qsl"] @@ -311,6 +313,15 @@ else: return url, '' +try: + unicode +except NameError: + def _is_unicode(x): + return 0 +else: + def _is_unicode(x): + return isinstance(x, unicode) + # unquote method for parse_qs and parse_qsl # Cannot use directly from urllib as it would create a circular reference # because urllib uses urlparse methods (urljoin). If you update this function, @@ -319,22 +330,35 @@ _hexdig = '0123456789ABCDEFabcdef' _hextochr = dict((a+b, chr(int(a+b,16))) for a in _hexdig for b in _hexdig) +_asciire = re.compile('([\x00-\x7f]+)') def unquote(s): """unquote('abc%20def') -> 'abc def'.""" - res = s.split('%') + if _is_unicode(s): + if '%' not in s: + return s + bits = _asciire.split(s) + res = [bits[0]] + append = res.append + for i in range(1, len(bits), 2): + append(unquote(str(bits[i])).decode('latin1')) + append(bits[i + 1]) + return ''.join(res) + + bits = s.split('%') # fastpath - if len(res) == 1: + if len(bits) == 1: return s - s = res[0] - for item in res[1:]: + res = [bits[0]] + append = res.append + for item in bits[1:]: try: - s += _hextochr[item[:2]] + item[2:] + append(_hextochr[item[:2]]) + append(item[2:]) except KeyError: - s += '%' + item - except UnicodeDecodeError: - s += unichr(int(item[:2], 16)) + item[2:] - return s + append('%') + append(item) + return ''.join(res) def parse_qs(qs, keep_blank_values=0, strict_parsing=0): """Parse a query given as a string argument. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -214,6 +214,8 @@ Library ------- +- Issue #1285086: Get rid of the refcounting hack and speed up urllib.unquote(). + - Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused a failure while decoding empty object literals when object_pairs_hook was specified. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 14 20:43:30 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 14 Mar 2013 20:43:30 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyODUw?= =?utf-8?q?86=3A_Get_rid_of_the_refcounting_hack_and_speed_up?= Message-ID: <3ZRgMQ6crDzR9l@mail.python.org> http://hg.python.org/cpython/rev/3cb07925fcb9 changeset: 82659:3cb07925fcb9 branch: 3.2 parent: 82654:9b45873e5a68 user: Serhiy Storchaka date: Thu Mar 14 21:31:37 2013 +0200 summary: Issue #1285086: Get rid of the refcounting hack and speed up urllib.parse.unquote() and urllib.parse.unquote_to_bytes(). files: Lib/urllib/parse.py | 63 ++++++++++++++------------------ Misc/NEWS | 3 + 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -27,6 +27,7 @@ test_urlparse.py provides a good indicator of parsing behavior. """ +import re import sys import collections @@ -470,6 +471,10 @@ defrag = url return _coerce_result(DefragResult(defrag, frag)) +_hexdig = '0123456789ABCDEFabcdef' +_hextobyte = {(a + b).encode(): bytes([int(a + b, 16)]) + for a in _hexdig for b in _hexdig} + def unquote_to_bytes(string): """unquote_to_bytes('abc%20def') -> b'abc def'.""" # Note: strings are encoded as UTF-8. This is only an issue if it contains @@ -480,16 +485,21 @@ return b'' if isinstance(string, str): string = string.encode('utf-8') - res = string.split(b'%') - if len(res) == 1: + bits = string.split(b'%') + if len(bits) == 1: return string - string = res[0] - for item in res[1:]: + res = [bits[0]] + append = res.append + for item in bits[1:]: try: - string += bytes([int(item[:2], 16)]) + item[2:] - except ValueError: - string += b'%' + item - return string + append(_hextobyte[item[:2]]) + append(item[2:]) + except KeyError: + append(b'%') + append(item) + return b''.join(res) + +_asciire = re.compile('([\x00-\x7f]+)') def unquote(string, encoding='utf-8', errors='replace'): """Replace %xx escapes by their single-character equivalent. The optional @@ -501,39 +511,20 @@ unquote('abc%20def') -> 'abc def'. """ - if string == '': - return string - res = string.split('%') - if len(res) == 1: + if '%' not in string: + string.split return string if encoding is None: encoding = 'utf-8' if errors is None: errors = 'replace' - # pct_sequence: contiguous sequence of percent-encoded bytes, decoded - pct_sequence = b'' - string = res[0] - for item in res[1:]: - try: - if not item: - raise ValueError - pct_sequence += bytes.fromhex(item[:2]) - rest = item[2:] - if not rest: - # This segment was just a single percent-encoded character. - # May be part of a sequence of code units, so delay decoding. - # (Stored in pct_sequence). - continue - except ValueError: - rest = '%' + item - # Encountered non-percent-encoded characters. Flush the current - # pct_sequence. - string += pct_sequence.decode(encoding, errors) + rest - pct_sequence = b'' - if pct_sequence: - # Flush the final pct_sequence - string += pct_sequence.decode(encoding, errors) - return string + bits = _asciire.split(string) + res = [bits[0]] + append = res.append + for i in range(1, len(bits), 2): + append(unquote_to_bytes(bits[i]).decode(encoding, errors)) + append(bits[i + 1]) + return ''.join(res) def parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace'): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,6 +233,9 @@ Library ------- +- Issue #1285086: Get rid of the refcounting hack and speed up + urllib.parse.unquote() and urllib.parse.unquote_to_bytes(). + - Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused a failure while decoding empty object literals when object_pairs_hook was specified. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 14 20:43:32 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 14 Mar 2013 20:43:32 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Issue_=231285086=3A_Get_rid_of_the_refcounting_hack_and_speed_?= =?utf-8?q?up?= Message-ID: <3ZRgMS3xDxzRjJ@mail.python.org> http://hg.python.org/cpython/rev/209a9c2de9bd changeset: 82660:209a9c2de9bd branch: 3.3 parent: 82655:e45db319e590 parent: 82659:3cb07925fcb9 user: Serhiy Storchaka date: Thu Mar 14 21:33:35 2013 +0200 summary: Issue #1285086: Get rid of the refcounting hack and speed up urllib.parse.unquote() and urllib.parse.unquote_to_bytes(). files: Lib/urllib/parse.py | 63 ++++++++++++++------------------ Misc/NEWS | 3 + 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -27,6 +27,7 @@ test_urlparse.py provides a good indicator of parsing behavior. """ +import re import sys import collections @@ -470,6 +471,10 @@ defrag = url return _coerce_result(DefragResult(defrag, frag)) +_hexdig = '0123456789ABCDEFabcdef' +_hextobyte = {(a + b).encode(): bytes([int(a + b, 16)]) + for a in _hexdig for b in _hexdig} + def unquote_to_bytes(string): """unquote_to_bytes('abc%20def') -> b'abc def'.""" # Note: strings are encoded as UTF-8. This is only an issue if it contains @@ -480,16 +485,21 @@ return b'' if isinstance(string, str): string = string.encode('utf-8') - res = string.split(b'%') - if len(res) == 1: + bits = string.split(b'%') + if len(bits) == 1: return string - string = res[0] - for item in res[1:]: + res = [bits[0]] + append = res.append + for item in bits[1:]: try: - string += bytes([int(item[:2], 16)]) + item[2:] - except ValueError: - string += b'%' + item - return string + append(_hextobyte[item[:2]]) + append(item[2:]) + except KeyError: + append(b'%') + append(item) + return b''.join(res) + +_asciire = re.compile('([\x00-\x7f]+)') def unquote(string, encoding='utf-8', errors='replace'): """Replace %xx escapes by their single-character equivalent. The optional @@ -501,39 +511,20 @@ unquote('abc%20def') -> 'abc def'. """ - if string == '': - return string - res = string.split('%') - if len(res) == 1: + if '%' not in string: + string.split return string if encoding is None: encoding = 'utf-8' if errors is None: errors = 'replace' - # pct_sequence: contiguous sequence of percent-encoded bytes, decoded - pct_sequence = b'' - string = res[0] - for item in res[1:]: - try: - if not item: - raise ValueError - pct_sequence += bytes.fromhex(item[:2]) - rest = item[2:] - if not rest: - # This segment was just a single percent-encoded character. - # May be part of a sequence of code units, so delay decoding. - # (Stored in pct_sequence). - continue - except ValueError: - rest = '%' + item - # Encountered non-percent-encoded characters. Flush the current - # pct_sequence. - string += pct_sequence.decode(encoding, errors) + rest - pct_sequence = b'' - if pct_sequence: - # Flush the final pct_sequence - string += pct_sequence.decode(encoding, errors) - return string + bits = _asciire.split(string) + res = [bits[0]] + append = res.append + for i in range(1, len(bits), 2): + append(unquote_to_bytes(bits[i]).decode(encoding, errors)) + append(bits[i + 1]) + return ''.join(res) def parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace'): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -193,6 +193,9 @@ Library ------- +- Issue #1285086: Get rid of the refcounting hack and speed up + urllib.parse.unquote() and urllib.parse.unquote_to_bytes(). + - Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused a failure while decoding empty object literals when object_pairs_hook was specified. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 14 20:43:34 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 14 Mar 2013 20:43:34 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Issue_=231285086=3A_Get_rid_of_the_refcounting_hack_and_?= =?utf-8?q?speed_up?= Message-ID: <3ZRgMV0krvzRld@mail.python.org> http://hg.python.org/cpython/rev/9367411a261e changeset: 82661:9367411a261e parent: 82656:99e72eae35bb parent: 82660:209a9c2de9bd user: Serhiy Storchaka date: Thu Mar 14 21:34:55 2013 +0200 summary: Issue #1285086: Get rid of the refcounting hack and speed up urllib.parse.unquote() and urllib.parse.unquote_to_bytes(). files: Lib/urllib/parse.py | 63 ++++++++++++++------------------ Misc/NEWS | 3 + 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -27,6 +27,7 @@ test_urlparse.py provides a good indicator of parsing behavior. """ +import re import sys import collections @@ -470,6 +471,10 @@ defrag = url return _coerce_result(DefragResult(defrag, frag)) +_hexdig = '0123456789ABCDEFabcdef' +_hextobyte = {(a + b).encode(): bytes([int(a + b, 16)]) + for a in _hexdig for b in _hexdig} + def unquote_to_bytes(string): """unquote_to_bytes('abc%20def') -> b'abc def'.""" # Note: strings are encoded as UTF-8. This is only an issue if it contains @@ -480,16 +485,21 @@ return b'' if isinstance(string, str): string = string.encode('utf-8') - res = string.split(b'%') - if len(res) == 1: + bits = string.split(b'%') + if len(bits) == 1: return string - string = res[0] - for item in res[1:]: + res = [bits[0]] + append = res.append + for item in bits[1:]: try: - string += bytes([int(item[:2], 16)]) + item[2:] - except ValueError: - string += b'%' + item - return string + append(_hextobyte[item[:2]]) + append(item[2:]) + except KeyError: + append(b'%') + append(item) + return b''.join(res) + +_asciire = re.compile('([\x00-\x7f]+)') def unquote(string, encoding='utf-8', errors='replace'): """Replace %xx escapes by their single-character equivalent. The optional @@ -501,39 +511,20 @@ unquote('abc%20def') -> 'abc def'. """ - if string == '': - return string - res = string.split('%') - if len(res) == 1: + if '%' not in string: + string.split return string if encoding is None: encoding = 'utf-8' if errors is None: errors = 'replace' - # pct_sequence: contiguous sequence of percent-encoded bytes, decoded - pct_sequence = b'' - string = res[0] - for item in res[1:]: - try: - if not item: - raise ValueError - pct_sequence += bytes.fromhex(item[:2]) - rest = item[2:] - if not rest: - # This segment was just a single percent-encoded character. - # May be part of a sequence of code units, so delay decoding. - # (Stored in pct_sequence). - continue - except ValueError: - rest = '%' + item - # Encountered non-percent-encoded characters. Flush the current - # pct_sequence. - string += pct_sequence.decode(encoding, errors) + rest - pct_sequence = b'' - if pct_sequence: - # Flush the final pct_sequence - string += pct_sequence.decode(encoding, errors) - return string + bits = _asciire.split(string) + res = [bits[0]] + append = res.append + for i in range(1, len(bits), 2): + append(unquote_to_bytes(bits[i]).decode(encoding, errors)) + append(bits[i + 1]) + return ''.join(res) def parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace'): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -280,6 +280,9 @@ Library ------- +- Issue #1285086: Get rid of the refcounting hack and speed up + urllib.parse.unquote() and urllib.parse.unquote_to_bytes(). + - Issue #17099: Have importlib.find_loader() raise ValueError when __loader__ is not set, harmonizing with what happens when the attribute is set to None. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 14 22:41:29 2013 From: python-checkins at python.org (eli.bendersky) Date: Thu, 14 Mar 2013 22:41:29 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Small_cosmetic_fixes?= Message-ID: <3ZRjzY05RCzPKr@mail.python.org> http://hg.python.org/cpython/rev/ef551f885f5f changeset: 82662:ef551f885f5f parent: 82656:99e72eae35bb user: Eli Bendersky date: Thu Mar 14 14:39:51 2013 -0700 summary: Small cosmetic fixes files: Doc/library/filecmp.rst | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Doc/library/filecmp.rst b/Doc/library/filecmp.rst --- a/Doc/library/filecmp.rst +++ b/Doc/library/filecmp.rst @@ -56,8 +56,8 @@ .. class:: dircmp(a, b, ignore=None, hide=None) Construct a new directory comparison object, to compare the directories *a* - and *b*. *ignore* is a list of names to ignore, and defaults to - :attr:`filecmp.DEFAULT_IGNORES`. *hide* is a list of names to hide, and + and *b*. *ignore* is a list of names to ignore, and defaults to + :attr:`filecmp.DEFAULT_IGNORES`. *hide* is a list of names to hide, and defaults to ``[os.curdir, os.pardir]``. The :class:`dircmp` class compares files by doing *shallow* comparisons @@ -65,18 +65,15 @@ The :class:`dircmp` class provides the following methods: - .. method:: report() Print (to :data:`sys.stdout`) a comparison between *a* and *b*. - .. method:: report_partial_closure() Print a comparison between *a* and *b* and common immediate subdirectories. - .. method:: report_full_closure() Print a comparison between *a* and *b* and common subdirectories @@ -133,7 +130,7 @@ .. attribute:: common_files - Files in both *a* and *b* + Files in both *a* and *b*. .. attribute:: common_funny -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 14 22:41:30 2013 From: python-checkins at python.org (eli.bendersky) Date: Thu, 14 Mar 2013 22:41:30 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_Merge?= Message-ID: <3ZRjzZ42SVzQrN@mail.python.org> http://hg.python.org/cpython/rev/c25bc2587c48 changeset: 82663:c25bc2587c48 parent: 82662:ef551f885f5f parent: 82661:9367411a261e user: Eli Bendersky date: Thu Mar 14 14:41:23 2013 -0700 summary: Merge files: Lib/urllib/parse.py | 63 ++++++++++++++------------------ Misc/NEWS | 3 + 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -27,6 +27,7 @@ test_urlparse.py provides a good indicator of parsing behavior. """ +import re import sys import collections @@ -470,6 +471,10 @@ defrag = url return _coerce_result(DefragResult(defrag, frag)) +_hexdig = '0123456789ABCDEFabcdef' +_hextobyte = {(a + b).encode(): bytes([int(a + b, 16)]) + for a in _hexdig for b in _hexdig} + def unquote_to_bytes(string): """unquote_to_bytes('abc%20def') -> b'abc def'.""" # Note: strings are encoded as UTF-8. This is only an issue if it contains @@ -480,16 +485,21 @@ return b'' if isinstance(string, str): string = string.encode('utf-8') - res = string.split(b'%') - if len(res) == 1: + bits = string.split(b'%') + if len(bits) == 1: return string - string = res[0] - for item in res[1:]: + res = [bits[0]] + append = res.append + for item in bits[1:]: try: - string += bytes([int(item[:2], 16)]) + item[2:] - except ValueError: - string += b'%' + item - return string + append(_hextobyte[item[:2]]) + append(item[2:]) + except KeyError: + append(b'%') + append(item) + return b''.join(res) + +_asciire = re.compile('([\x00-\x7f]+)') def unquote(string, encoding='utf-8', errors='replace'): """Replace %xx escapes by their single-character equivalent. The optional @@ -501,39 +511,20 @@ unquote('abc%20def') -> 'abc def'. """ - if string == '': - return string - res = string.split('%') - if len(res) == 1: + if '%' not in string: + string.split return string if encoding is None: encoding = 'utf-8' if errors is None: errors = 'replace' - # pct_sequence: contiguous sequence of percent-encoded bytes, decoded - pct_sequence = b'' - string = res[0] - for item in res[1:]: - try: - if not item: - raise ValueError - pct_sequence += bytes.fromhex(item[:2]) - rest = item[2:] - if not rest: - # This segment was just a single percent-encoded character. - # May be part of a sequence of code units, so delay decoding. - # (Stored in pct_sequence). - continue - except ValueError: - rest = '%' + item - # Encountered non-percent-encoded characters. Flush the current - # pct_sequence. - string += pct_sequence.decode(encoding, errors) + rest - pct_sequence = b'' - if pct_sequence: - # Flush the final pct_sequence - string += pct_sequence.decode(encoding, errors) - return string + bits = _asciire.split(string) + res = [bits[0]] + append = res.append + for i in range(1, len(bits), 2): + append(unquote_to_bytes(bits[i]).decode(encoding, errors)) + append(bits[i + 1]) + return ''.join(res) def parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace'): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -280,6 +280,9 @@ Library ------- +- Issue #1285086: Get rid of the refcounting hack and speed up + urllib.parse.unquote() and urllib.parse.unquote_to_bytes(). + - Issue #17099: Have importlib.find_loader() raise ValueError when __loader__ is not set, harmonizing with what happens when the attribute is set to None. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 15 00:32:42 2013 From: python-checkins at python.org (terry.reedy) Date: Fri, 15 Mar 2013 00:32:42 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3NDEy?= =?utf-8?q?=3A_update_2=2E7_Doc/make=2Ebat_to_also_use_sphinx-1=2E0=2E7=2E?= Message-ID: <3ZRmRt14CyzNCJ@mail.python.org> http://hg.python.org/cpython/rev/7338e7ec47f0 changeset: 82664:7338e7ec47f0 branch: 2.7 parent: 82658:4927899bea8d user: Terry Jan Reedy date: Thu Mar 14 19:32:22 2013 -0400 summary: Issue #17412: update 2.7 Doc/make.bat to also use sphinx-1.0.7. files: Doc/make.bat | 2 +- Misc/NEWS | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/make.bat b/Doc/make.bat --- a/Doc/make.bat +++ b/Doc/make.bat @@ -34,7 +34,7 @@ goto end :checkout -svn co %SVNROOT%/external/Sphinx-0.6.7/sphinx tools/sphinx +svn co %SVNROOT%/external/Sphinx-1.0.7/sphinx tools/sphinx svn co %SVNROOT%/external/docutils-0.6/docutils tools/docutils svn co %SVNROOT%/external/Jinja-2.3.1/jinja2 tools/jinja2 svn co %SVNROOT%/external/Pygments-1.3.1/pygments tools/pygments diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -953,6 +953,8 @@ Documentation ------------- +- Issue #17412: update 2.7 Doc/make.bat to also use sphinx-1.0.7. + - Issue #17047: remove doubled words in docs and docstrings reported by Serhiy Storchaka and Matthew Barnett. -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Fri Mar 15 06:01:24 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 15 Mar 2013 06:01:24 +0100 Subject: [Python-checkins] Daily reference leaks (c25bc2587c48): sum=0 Message-ID: results for c25bc2587c48 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog1hqtG8', '-x'] From python-checkins at python.org Fri Mar 15 07:42:43 2013 From: python-checkins at python.org (terry.reedy) Date: Fri, 15 Mar 2013 07:42:43 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?devguide=3A_Add_VC++_2010_registratio?= =?utf-8?q?n_requirement=2E_Remove_obsolete_link=2E_Steve_Dower_of?= Message-ID: <3ZRy030ybkzRtR@mail.python.org> http://hg.python.org/devguide/rev/0690d03cef69 changeset: 611:0690d03cef69 user: Terry Jan Reedy date: Fri Mar 15 02:42:26 2013 -0400 summary: Add VC++ 2010 registration requirement. Remove obsolete link. Steve Dower of Microsoft is working to determine the officil replacement. files: setup.rst | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.rst b/setup.rst --- a/setup.rst +++ b/setup.rst @@ -189,11 +189,12 @@ **Python 3.3** and later use Microsoft Visual Studio 2010. You can download Microsoft Visual C++ 2010 Express `from Microsoft's site `_. +To use it for more than 28 days, one must register through a +Windows Live account. Most Python versions prior to 3.3 use Microsoft Visual Studio 2008. You can download Microsoft Visual C++ 2008 Express Edition with SP1 -`here `_. -You may need to select the file named ``vcsetup.exe``. +from a new location yet to be determined. Regardless of Visual Studio version, the ``PCbuild`` directory of a source checkout contains the build files for the Python version you are building. -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Fri Mar 15 08:04:45 2013 From: python-checkins at python.org (terry.reedy) Date: Fri, 15 Mar 2013 08:04:45 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317414=3A_Add_time?= =?utf-8?q?it=2C_repeat=2C_and_default=5Ftimer_to_timeit=2E=5F=5Fall=5F=5F?= =?utf-8?q?=2E?= Message-ID: <3ZRyTT0DV9zRxl@mail.python.org> http://hg.python.org/cpython/rev/dda8a6b8a351 changeset: 82665:dda8a6b8a351 parent: 82663:c25bc2587c48 user: Terry Jan Reedy date: Fri Mar 15 03:04:25 2013 -0400 summary: Issue #17414: Add timeit, repeat, and default_timer to timeit.__all__. Revise module docstring and update itertools import and use. files: Lib/timeit.py | 44 ++++++++++++++------------------------ Misc/ACKS | 2 + Misc/NEWS | 2 + 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/Lib/timeit.py b/Lib/timeit.py --- a/Lib/timeit.py +++ b/Lib/timeit.py @@ -31,38 +31,29 @@ If -n is not given, a suitable number of loops is calculated by trying successive powers of 10 until the total time is at least 0.2 seconds. -The difference in default timer function is because on Windows, -clock() has microsecond granularity but time()'s granularity is 1/60th -of a second; on Unix, clock() has 1/100th of a second granularity and -time() is much more precise. On either platform, the default timer -functions measure wall clock time, not the CPU time. This means that -other processes running on the same computer may interfere with the -timing. The best thing to do when accurate timing is necessary is to -repeat the timing a few times and use the best time. The -r option is -good for this; the default of 3 repetitions is probably enough in most -cases. On Unix, you can use clock() to measure CPU time. +Note: there is a certain baseline overhead associated with executing a +pass statement. It differs between versions. The code here doesn't try +to hide it, but you should be aware of it. The baseline overhead can be +measured by invoking the program without arguments. -Note: there is a certain baseline overhead associated with executing a -pass statement. The code here doesn't try to hide it, but you should -be aware of it. The baseline overhead can be measured by invoking the -program without arguments. +Classes: -The baseline overhead differs between Python versions! Also, to -fairly compare older Python versions to Python 2.3, you may want to -use python -O for the older versions to avoid timing SET_LINENO -instructions. + Timer + +Functions: + + timeit(string, string) -> float + repeat(string, string) -> list + default_timer() -> float + """ import gc import sys import time -try: - import itertools -except ImportError: - # Must be an older Python version (see timeit() below) - itertools = None +import itertools -__all__ = ["Timer"] +__all__ = ["Timer", "timeit", "repeat", "default_timer"] dummy_src_name = "" default_number = 1000000 @@ -180,10 +171,7 @@ to one million. The main statement, the setup statement and the timer function to be used are passed to the constructor. """ - if itertools: - it = itertools.repeat(None, number) - else: - it = [None] * number + it = itertools.repeat(None, number) gcold = gc.isenabled() gc.disable() try: diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -449,6 +449,7 @@ Dag Gruneau Filip Gruszczy?ski Thomas Guettler +Anuj Gupta Michael Guravage Lars Gust?bel Thomas G?ttler @@ -1359,3 +1360,4 @@ Kai Zhu Tarek Ziad? Peter ?strand + diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -280,6 +280,8 @@ Library ------- +- Issue #17414: Add timeit, repeat, and default_timer to timeit.__all__. + - Issue #1285086: Get rid of the refcounting hack and speed up urllib.parse.unquote() and urllib.parse.unquote_to_bytes(). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 15 08:42:13 2013 From: python-checkins at python.org (terry.reedy) Date: Fri, 15 Mar 2013 08:42:13 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3MDQ3?= =?utf-8?q?=3A_Add_news_entry?= Message-ID: <3ZRzJj4yNYzRwR@mail.python.org> http://hg.python.org/cpython/rev/4b28a6a3eda6 changeset: 82666:4b28a6a3eda6 branch: 3.2 parent: 82659:3cb07925fcb9 user: Terry Jan Reedy date: Fri Mar 15 03:33:11 2013 -0400 summary: Issue #17047: Add news entry files: Misc/NEWS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1108,6 +1108,9 @@ Documentation ------------- +- Issue #17047: remove doubled words in docs and docstrings + reported by Serhiy Storchaka and Matthew Barnett. + - Issue #16406: Combine the pages for uploading and registering to PyPI. - Issue #16403: Document how distutils uses the maintainer field in -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 15 08:42:15 2013 From: python-checkins at python.org (terry.reedy) Date: Fri, 15 Mar 2013 08:42:15 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_with_3=2E2=3A_issue_=2317047_news_entry?= Message-ID: <3ZRzJl0sw1zS2q@mail.python.org> http://hg.python.org/cpython/rev/937989570b42 changeset: 82667:937989570b42 branch: 3.3 parent: 82660:209a9c2de9bd parent: 82666:4b28a6a3eda6 user: Terry Jan Reedy date: Fri Mar 15 03:39:38 2013 -0400 summary: Merge with 3.2: issue #17047 news entry files: Misc/NEWS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -817,6 +817,9 @@ - Issue #16642: sched.scheduler timefunc initial default is time.monotonic. Patch by Ramchandra Apte +- Issue #17047: remove doubled words in docs and docstrings + reported by Serhiy Storchaka and Matthew Barnett. + - Issue #15465: Document the versioning macros in the C API docs rather than the standard library docs. Patch by Kushal Das. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 15 08:42:16 2013 From: python-checkins at python.org (terry.reedy) Date: Fri, 15 Mar 2013 08:42:16 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E2=3A_closes_issue_=2317047?= Message-ID: <3ZRzJm3XmXzS04@mail.python.org> http://hg.python.org/cpython/rev/f0a3c2006adb changeset: 82668:f0a3c2006adb parent: 82665:dda8a6b8a351 parent: 82667:937989570b42 user: Terry Jan Reedy date: Fri Mar 15 03:41:35 2013 -0400 summary: Merge with 3.2: closes issue #17047 files: Misc/NEWS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1109,6 +1109,9 @@ - Issue #16642: sched.scheduler timefunc initial default is time.monotonic. Patch by Ramchandra Apte +- Issue #17047: remove doubled words in docs and docstrings + reported by Serhiy Storchaka and Matthew Barnett. + - Issue #15465: Document the versioning macros in the C API docs rather than the standard library docs. Patch by Kushal Das. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 15 15:26:02 2013 From: python-checkins at python.org (eli.bendersky) Date: Fri, 15 Mar 2013 15:26:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_a_mention_of_IntEnum=2C_s?= =?utf-8?q?ummarizing_the_language_summit_and_later_discussions?= Message-ID: <3ZS8Gf4DhjzMgy@mail.python.org> http://hg.python.org/peps/rev/bd190f281dad changeset: 4801:bd190f281dad user: Eli Bendersky date: Fri Mar 15 07:25:45 2013 -0700 summary: Add a mention of IntEnum, summarizing the language summit and later discussions on the subject. Note that this is still in draft stage and decisions can change (and have changed more than once over the past few days). files: pep-0435.txt | 72 ++++++++++++++++++++++++++++++++++++--- 1 files changed, 65 insertions(+), 7 deletions(-) diff --git a/pep-0435.txt b/pep-0435.txt --- a/pep-0435.txt +++ b/pep-0435.txt @@ -34,9 +34,25 @@ previous attempt that was rejected in 2005. Recently a new set of discussions was initiated [3]_ on the ``python-ideas`` mailing list. Many new ideas were proposed in several threads; after a lengthy discussion Guido proposed adding -``flufl.enum`` to the standard library [4]_. This PEP is an attempt to -formalize this decision as well as discuss a number of variations that can be -considered for inclusion. +``flufl.enum`` to the standard library [4]_. During the PyCon 2013 language +summit the issue was discussed further. It became clear that many developers +want to see an enum that subclasses ``int``, which can allow us to replace +many integer constants in the standard library by enums with friendly string +representations, without ceding backwards compatibility. An additional +discussion among several interested core developers led to the proposal of +having ``IntEnum`` as a special case of ``Enum``. + +The key dividing issue between ``Enum`` and ``IntEnum`` is whether comparing +to integers is semantically meaningful. For most uses of enumerations, it's +a **feature** to reject comparison to integers; enums that compare to integers +lead, through transitivity, to comparisons between enums of unrelated types, +which isn't desirable in most cases. For some uses, however, greater +interoperatiliby with integers is desired. For instance, this is the case for +replacing existing standard library constants (such as ``socket.AF_INET``) +with enumerations. + +This PEP is an attempt to formalize this decision as well as discuss a number +of variations that were discussed and can be considered for inclusion. Motivation @@ -153,9 +169,9 @@ >>> Colors.blue is MoreColors.blue True -However, these are not doing comparisons against the integer equivalent -values, because if you define an enumeration with similar item names and -integer values, they will not be identical:: +However, these are not doing comparisons against the integer equivalent values, +because if you define an enumeration with similar item names and integer values, +they will not be identical:: >>> class OtherColors(Enum): ... red = 1 @@ -174,7 +190,7 @@ 2 Ordered comparisons between enumeration values are *not* supported. Enums are -not integers:: +not integers (but see ``IntEnum`` below):: >>> Colors.red < Colors.blue Traceback (most recent call last): @@ -342,6 +358,48 @@ green -> granny smith +IntEnum +------- + +A variation of ``Enum`` is proposed that also subclasses ``int`` - ``IntEnum``. +Such enumerations behave much more similarly to integers. In particular, they +can be compared to integers; by extensions, enumerations of different types can +also be compared to each other:: + + >>> from enum import IntEnum + >>> class Shape(IntEnum): + ... circle = 1 + ... square = 2 + ... + >>> class Request(IntEnum): + ... post = 1 + ... get = 2 + ... + >>> Shape == 1 + False + >>> Shape.circle == 1 + True + >>> Shape.circle == Request.post + True + +However they still can't be compared to ``Enum``:: + + >>> from enum import Enum, IntEnum + >>> class Shape(IntEnum): + ... circle = 1 + ... square = 2 + ... + >>> class Colors(Enum): + ... red = 1 + ... green = 2 + ... + >>> Shape.circle == Colors.red + False + +For the vast majority of code, ``Enum`` is recommended. Only if a greater +degree of interoperatility with integers is required and ``Enum`` does not +fit the bill, ``IntEnum`` should be used. + Pickling -------- -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Mar 15 15:50:26 2013 From: python-checkins at python.org (senthil.kumaran) Date: Fri, 15 Mar 2013 15:50:26 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=231291_http=2Eserver=27s_?= =?utf-8?q?send=5Ferror_takes_an_optional_explain_argument?= Message-ID: <3ZS8pp6R1NzP5j@mail.python.org> http://hg.python.org/cpython/rev/59292f366b53 changeset: 82669:59292f366b53 user: Senthil Kumaran date: Fri Mar 15 07:53:21 2013 -0700 summary: #1291 http.server's send_error takes an optional explain argument files: Doc/library/http.server.rst | 12 ++++++++---- Lib/http/server.py | 18 ++++++++++++------ Lib/test/test_httpservers.py | 10 ++++++++++ Misc/NEWS | 3 +++ 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst --- a/Doc/library/http.server.rst +++ b/Doc/library/http.server.rst @@ -170,15 +170,19 @@ .. versionadded:: 3.2 - .. method:: send_error(code, message=None) + .. method:: send_error(code, message=None, explain=None) Sends and logs a complete error reply to the client. The numeric *code* - specifies the HTTP error code, with *message* as optional, more specific text. A - complete set of headers is sent, followed by text composed using the - :attr:`error_message_format` class variable. + specifies the HTTP error code, with *message* as optional, more specific + text, usually referring to short message response. The *explain* + argument can be used to send a detailed information about the error in + response content body. A complete set of headers is sent, followed by + text composed using the :attr:`error_message_format` class variable. .. versionchanged:: 3.4 The error response includes a Content-Length header. + explain argument was added. + .. method:: send_response(code, message=None) diff --git a/Lib/http/server.py b/Lib/http/server.py --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -401,12 +401,17 @@ while not self.close_connection: self.handle_one_request() - def send_error(self, code, message=None): + def send_error(self, code, message=None, explain=None): """Send and log an error reply. - Arguments are the error code, and a detailed message. - The detailed message defaults to the short entry matching the - response code. + Arguments are + * code: an HTTP error code + 3 digits + * message: a simple optional 1 line reason phrase. + *( HTAB / SP / VCHAR / %x80-FF ) + defaults to short entry matching the response code + * explain: a detailed message defaults to the long entry + matching the response code. This sends an error response (so it must be called before any output has been generated), logs the error, and finally sends @@ -420,11 +425,12 @@ shortmsg, longmsg = '???', '???' if message is None: message = shortmsg - explain = longmsg + if explain is None: + explain = longmsg self.log_error("code %d, message %s", code, message) # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201) content = (self.error_message_format % - {'code': code, 'message': _quote_html(message), 'explain': explain}) + {'code': code, 'message': _quote_html(message), 'explain': _quote_html(explain)}) body = content.encode('UTF-8', 'replace') self.send_response(code, message) self.send_header("Content-Type", self.error_content_type) diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -95,6 +95,10 @@ def do_NOTFOUND(self): self.send_error(404) + def do_EXPLAINERROR(self): + self.send_error(999, "Short Message", + "This is a long \n explaination") + def do_CUSTOM(self): self.send_response(999) self.send_header('Content-Type', 'text/html') @@ -206,6 +210,12 @@ res = self.con.getresponse() self.assertEqual(res.status, 999) + def test_return_explain_error(self): + self.con.request('EXPLAINERROR', '/') + res = self.con.getresponse() + self.assertEqual(res.status, 999) + self.assertTrue(int(res.getheader('Content-Length'))) + def test_latin1_header(self): self.con.request('LATINONEHEADER', '/', headers={ 'X-Special-Incoming': '?rger mit Unicode' diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -280,6 +280,9 @@ Library ------- +- Issue #12921: http.server's send_error takes an explain argument to send more + information in response. Patch contributed by Karl. + - Issue #17414: Add timeit, repeat, and default_timer to timeit.__all__. - Issue #1285086: Get rid of the refcounting hack and speed up -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 15 21:34:39 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 15 Mar 2013 21:34:39 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?devguide=3A_=2314468=3A_add_FAQs_abou?= =?utf-8?q?t_merge_conflicts=2C_null_merges=2C_and_heads_merges=2E?= Message-ID: <3ZSJRz4lsnzPBg@mail.python.org> http://hg.python.org/devguide/rev/7a707540391e changeset: 612:7a707540391e user: Ezio Melotti date: Fri Mar 15 22:34:23 2013 +0200 summary: #14468: add FAQs about merge conflicts, null merges, and heads merges. files: committing.rst | 7 ++ faq.rst | 109 +++++++++++++++++++++++++----------- 2 files changed, 82 insertions(+), 34 deletions(-) diff --git a/committing.rst b/committing.rst --- a/committing.rst +++ b/committing.rst @@ -339,6 +339,11 @@ Unless noted otherwise, the rest of the page will assume you are using the multiple clone approach, and explain in more detail these basic steps. +For more advanced explanations about :ref:`null merges `, +:ref:`heads merges `, :ref:`merge conflicts +`, etc., see the :ref:`FAQs for core developers +`. + .. _share extension: http://mercurial.selenic.com/wiki/ShareExtension @@ -364,6 +369,8 @@ Python version. +.. _branch-merge: + Merging between different branches (within the same major version) ------------------------------------------------------------------ diff --git a/faq.rst b/faq.rst --- a/faq.rst +++ b/faq.rst @@ -728,6 +728,8 @@ .. _configuration options: http://www.selenic.com/mercurial/hgrc.5.html +.. _core-devs-faqs: + For core developers ------------------- @@ -767,47 +769,86 @@ option in the ``[ui]`` section. -.. _hg-merge: +.. _hg-merge-conflicts: -How do I find out which revisions need merging? -''''''''''''''''''''''''''''''''''''''''''''''' +How do I solve merge conflicts? +''''''''''''''''''''''''''''''' -In unambiguous cases, Mercurial will find out for you if you simply try:: +The easiest way is to install KDiff3 --- Mercurial will open it automatically +in case of conflicts, and you can then use it to solve the conflicts and +save the resulting file(s). KDiff3 will also take care of marking the +conflicts as resolved. +If you don't use a merge tool, you can use ``hg resolve --list`` to list the +conflicting files, resolve the conflicts manually, and the use +``hg resolve --mark `` to mark these conflicts as resolved. +You can also use ``hg resolve -am`` to mark all the conflicts as resolved. + +.. note:: + Mercurial will use KDiff3 automatically if it's installed and it can find + it --- you don't need to change any settings. KDiff3 is also already + included in the installer of TortoiseHg. For more information, see + http://mercurial.selenic.com/wiki/KDiff3. + + +.. _hg-null-merge: + +How do I make a null merge? +''''''''''''''''''''''''''' + +If you committed something (e.g. on 3.2) that shouldn't be ported on newer +branches (e.g. on 3.3), you have to do a *null merge*:: + + cd 3.3 + hg merge 3.2 + hg revert -ar 3.3 + hg resolve -am # needed only if the merge created conflicts + hg ci -m '#12345: null merge with 3.2.' + +Before committing, ``hg status`` should list all the merged files as ``M``, +but ``hg diff`` should produce no output. This will record the merge without +actually changing the content of the files. + + +.. _hg-heads-merge: + +I got "abort: push creates new remote heads!" while pushing, what do I do? +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +If you see this message while pushing, it means that you committed something +on a clone that was not up to date, thus creating a new head. +This usually happens for two reasons: + +1. You forgot to run ``hg pull`` and/or ``hg up`` before committing; +2. Someone else pushed on the main repo just before you, causing a push race; + +First of all you should pull the new changesets using ``hg pull``. Then you can +use ``hg heads`` to see which branches have multiple heads. + +If only one branch has multiple heads, you can do:: + + cd default + hg heads . + hg up csid-of-the-other-head hg merge + hg ci -m 'Merge heads.' -If that fails and Mercurial asks for explicit revisions, running:: +``hg heads .`` will show you the two heads of the current branch: the one you +pulled and the one you created with your commit (you can also specify a branch +with ``hg heads ``). While not strictly necessary, it is highly +recommended to switch to the other head before merging. This way you will be +merging only your changeset with the rest, and in case of conflicts it will be +a lot easier. - hg heads +If more than one branch has multiple heads, you have to repeat these steps for +each branch. Since this creates new changesets, you will also have to +:ref:`merge them between branches `. For example, if both ``3.3`` +and ``default`` have multiple heads, you should first merge heads in ``3.3``, +then merge heads in ``default``, and finally merge ``3.3`` with ``default`` +using ``hg merge 3.3`` as usual. -will give you the list of branch heads in your local repository. If you are -working only in a particular named branch, for example ``default``, do:: - - hg heads default - -to display the heads on that branch. - - -How do I list the files in conflict after a merge? -'''''''''''''''''''''''''''''''''''''''''''''''''' - -Use:: - - hg resolve --list - -(abbreviated ``hg resolve -l``) - - -How I mark a file resolved after I have resolved merge conflicts? -''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' - -Type:: - - hg resolve --mark - -(abbreviated ``hg resolve -m ``) - -If you are sure you have resolved all conflicts, use ``hg resolve -am``. +In order to avoid this, you should *always remember to pull and update before +committing*. How do I undo the changes made in a recent commit? -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Fri Mar 15 21:52:04 2013 From: python-checkins at python.org (terry.reedy) Date: Fri, 15 Mar 2013 21:52:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3Mzk4?= =?utf-8?q?=3A_document_url_argument_of_RobotFileParser?= Message-ID: <3ZSJr404JjzS8Q@mail.python.org> http://hg.python.org/cpython/rev/274e68e2a5a6 changeset: 82670:274e68e2a5a6 branch: 2.7 parent: 82664:7338e7ec47f0 user: Terry Jan Reedy date: Fri Mar 15 16:49:22 2013 -0400 summary: Issue #17398: document url argument of RobotFileParser files: Doc/library/robotparser.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/robotparser.rst b/Doc/library/robotparser.rst --- a/Doc/library/robotparser.rst +++ b/Doc/library/robotparser.rst @@ -26,10 +26,10 @@ structure of :file:`robots.txt` files, see http://www.robotstxt.org/orig.html. -.. class:: RobotFileParser() +.. class:: RobotFileParser(url='') - This class provides a set of methods to read, parse and answer questions - about a single :file:`robots.txt` file. + This class provides methods to read, parse and answer questions about the + :file:`robots.txt` file at *url*. .. method:: set_url(url) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 15 21:52:05 2013 From: python-checkins at python.org (terry.reedy) Date: Fri, 15 Mar 2013 21:52:05 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3Mzk4?= =?utf-8?q?=3A_document_url_argument_of_RobotFileParser?= Message-ID: <3ZSJr52f3DzS49@mail.python.org> http://hg.python.org/cpython/rev/4be7f8da7adf changeset: 82671:4be7f8da7adf branch: 3.2 parent: 82666:4b28a6a3eda6 user: Terry Jan Reedy date: Fri Mar 15 16:50:23 2013 -0400 summary: Issue #17398: document url argument of RobotFileParser files: Doc/library/urllib.robotparser.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/urllib.robotparser.rst b/Doc/library/urllib.robotparser.rst --- a/Doc/library/urllib.robotparser.rst +++ b/Doc/library/urllib.robotparser.rst @@ -19,10 +19,10 @@ structure of :file:`robots.txt` files, see http://www.robotstxt.org/orig.html. -.. class:: RobotFileParser() +.. class:: RobotFileParser(url='') - This class provides a set of methods to read, parse and answer questions - about a single :file:`robots.txt` file. + This class provides methods to read, parse and answer questions about the + :file:`robots.txt` file at *url*. .. method:: set_url(url) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 15 21:52:06 2013 From: python-checkins at python.org (terry.reedy) Date: Fri, 15 Mar 2013 21:52:06 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_with_3=2E2?= Message-ID: <3ZSJr657JpzS8Q@mail.python.org> http://hg.python.org/cpython/rev/166fb6ecb55a changeset: 82672:166fb6ecb55a branch: 3.3 parent: 82667:937989570b42 parent: 82671:4be7f8da7adf user: Terry Jan Reedy date: Fri Mar 15 16:50:54 2013 -0400 summary: Merge with 3.2 files: Doc/library/urllib.robotparser.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/urllib.robotparser.rst b/Doc/library/urllib.robotparser.rst --- a/Doc/library/urllib.robotparser.rst +++ b/Doc/library/urllib.robotparser.rst @@ -19,10 +19,10 @@ structure of :file:`robots.txt` files, see http://www.robotstxt.org/orig.html. -.. class:: RobotFileParser() +.. class:: RobotFileParser(url='') - This class provides a set of methods to read, parse and answer questions - about a single :file:`robots.txt` file. + This class provides methods to read, parse and answer questions about the + :file:`robots.txt` file at *url*. .. method:: set_url(url) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 15 21:52:08 2013 From: python-checkins at python.org (terry.reedy) Date: Fri, 15 Mar 2013 21:52:08 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E3?= Message-ID: <3ZSJr80hkmzS91@mail.python.org> http://hg.python.org/cpython/rev/46e6a8b742d9 changeset: 82673:46e6a8b742d9 parent: 82669:59292f366b53 parent: 82672:166fb6ecb55a user: Terry Jan Reedy date: Fri Mar 15 16:51:21 2013 -0400 summary: Merge with 3.3 files: Doc/library/urllib.robotparser.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/urllib.robotparser.rst b/Doc/library/urllib.robotparser.rst --- a/Doc/library/urllib.robotparser.rst +++ b/Doc/library/urllib.robotparser.rst @@ -19,10 +19,10 @@ structure of :file:`robots.txt` files, see http://www.robotstxt.org/orig.html. -.. class:: RobotFileParser() +.. class:: RobotFileParser(url='') - This class provides a set of methods to read, parse and answer questions - about a single :file:`robots.txt` file. + This class provides methods to read, parse and answer questions about the + :file:`robots.txt` file at *url*. .. method:: set_url(url) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 15 22:51:31 2013 From: python-checkins at python.org (georg.brandl) Date: Fri, 15 Mar 2013 22:51:31 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_PEP_437=3A_Add_standard_=22lo?= =?utf-8?q?cal_variables=22_footer=2E?= Message-ID: <3ZSL8g1fx8zS9v@mail.python.org> http://hg.python.org/peps/rev/470f041a461c changeset: 4802:470f041a461c user: Georg Brandl date: Fri Mar 15 22:51:01 2013 +0100 summary: PEP 437: Add standard "local variables" footer. files: pep-0437.txt | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/pep-0437.txt b/pep-0437.txt --- a/pep-0437.txt +++ b/pep-0437.txt @@ -389,4 +389,12 @@ .. _Open Publication License: http://www.opencontent.org/openpub/ - + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Mar 15 22:51:32 2013 From: python-checkins at python.org (georg.brandl) Date: Fri, 15 Mar 2013 22:51:32 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_PEP_438=3A_Transitioning_?= =?utf-8?q?to_release-file_hosting_on_PyPI=2C_submitted_by_Holger?= Message-ID: <3ZSL8h6kXSzS9v@mail.python.org> http://hg.python.org/peps/rev/021c1f97ee13 changeset: 4803:021c1f97ee13 user: Georg Brandl date: Fri Mar 15 22:51:25 2013 +0100 summary: Add PEP 438: Transitioning to release-file hosting on PyPI, submitted by Holger Krekel. files: pep-0438.txt | 387 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 387 insertions(+), 0 deletions(-) diff --git a/pep-0438.txt b/pep-0438.txt new file mode 100644 --- /dev/null +++ b/pep-0438.txt @@ -0,0 +1,387 @@ +PEP: 438 +Title: Transitioning to release-file hosting on PyPI +Version: $Revision$ +Last-Modified: $Date$ +Author: Holger Krekel , Carl Meyer +Discussions-To: catalog-sig at python.org +Status: Draft +Type: Process +Content-Type: text/x-rst +Created: 15-Mar-2013 +Post-History: + + +Abstract +======== + +This PEP proposes a backward-compatible two-phase transition process +to speed up, simplify and robustify installing from the +pypi.python.org (PyPI) package index. To ease the transition and +minimize client-side friction, **no changes to distutils or existing +installation tools are required in order to benefit from the first +transition phase, which will result in faster, more reliable installs +for most existing packages**. + +The first transition phase implements an easy and explicit means for a +package maintainer to control which release file links are served to +present-day installation tools. The first phase also includes the +implementation of analysis tools for present-day packages, to support +communication with package maintainers and the automated setting of +default modes for controlling release file links. The first phase +also will default newly-registered projects on PyPI to only serve +links to release files which were uploaded to PyPI. + +The second transition phase concerns end-user installation tools, +which shall default to only install release files that are hosted on +PyPI and tell the user if external release files exist, offering a +choice to automatically use those external files. + + +Rationale +========= + +.. _history: + +History and motivations for external hosting +-------------------------------------------- + +When PyPI went online, it offered release registration but had no +facility to host release files itself. When hosting was added, no +automated downloading tool existed yet. When Philip Eby implemented +automated downloading (through setuptools), he made the choice to +allow people to use download hosts of their choice. The finding of +externally-hosted packages was implemented as follows: + +#. The PyPI ``simple/`` index for a package contains all links found + by scraping them from that package's long_description metadata for + any release. Links in the "Download-URL" and "Home-page" metadata + fields are given ``rel=download`` and ``rel=homepage`` attributes, + respectively. + +#. Any of these links whose target is a file whose name appears to be + in the form of an installable source or binary distribution, with + name in the form "packagename-version.ARCHIVEEXT", is considered a + potential installation candidate by installation tools. + +#. Similarly, any links suffixed with an "#egg=packagename-version" + fragment are considered an installation candidate. + +#. Additionally, the ``rel=homepage`` and ``rel=download`` links are + crawled by installation tools and, if HTML, are themselves scraped + for release-file links in the above formats. + +Today, most packages released on PyPI host their release files on +PyPI, but a small percentage (XXX need updated data) rely on external +hosting. + +There are many reasons [2]_ why people have chosen external +hosting. To cite just a few: + +- release processes and scripts have been developed already and upload + to external sites + +- it takes too long to upload large files from some places in the + world + +- export restrictions e.g. for crypto-related software + +- company policies which require offering open source packages through + own sites + +- problems with integrating uploading to PyPI into one's release + process (because of release policies) + +- desiring download statistics different from those maintained by PyPI + +- perceived bad reliability of PyPI + +- not aware that PyPI offers file-hosting + +Irrespective of the present-day validity of these reasons, there +clearly is a history why people choose to host files externally and it +even was for some time the only way you could do things. This PEP +takes the position that there are at least some valid reasons for +external hosting. + +Problem +------- + +**Today, python package installers (pip, easy_install, buildout, and +others) often need to query many non-PyPI URLs even if there are no +externally hosted files**. Apart from querying pypi.python.org's +simple index pages, also all homepages and download pages ever +specified with any release of a package are crawled by an installer. +The need for installers to crawl external sites slows down +installation and makes for a brittle and unreliable installation +process. Those sites and packages also don't take part in the +:pep:`381` mirroring infrastructure, further decreasing reliability +and speed of automated installation processes around the world. + +Most packages are hosted directly on pypi.python.org [1]_. Even for +these packages, installers still crawl their homepage and +download-url, if specified. Many package uploaders are not aware that +specifying the "homepage" or "download-url" in their package metadata +will needlessly slow down the installation process for all users. + +Relying on third party sites also opens up more attack vectors for +injecting malicious packages into sites using automated installs. A +simple attack might just involve getting hold of an old now-unused +homepage domain and placing malicious packages there. Moreover, +performing a Man-in-The-Middle (MITM) attack between an installation +site and any of the download sites can inject malicious packages on +the installation site. As many homepages and download locations are +using HTTP and not HTTPS, such attacks are not hard to launch. Such +MITM attacks can easily happen even for packages which never intended +to host files externally as their homepages are contacted by +installers anyway. + +There is currently no way for package maintainers to avoid +external-link crawling, other than removing all homepage/download url +metadata for all historic releases. While a script [3]_ has been +written to perform this action, it is not a good general solution +because it removes useful metadata from PyPI releases. + +Even if the sites referenced by "Homepage" and "Download-URL" links +were not scraped for further links, there is no obvious way under the +current system for a package owner to link to an installable file from +a long_description metadata field (which is shown as package +documentation on ``/pypi/PKG``) without installation tools +automatically considering that file a candidate for installation. +Conversely, there is no way to explicitly register multiple external +release files without putting them in metadata fields. + + +Goals +----- + +These are the goals to be achieved by implementation of this PEP: + +* Package owners should be able to explicitly control which files are + presented by PyPI to installer tools as installation + candidates. Installation should not be slowed and made less reliable + by extensive and unnecessary crawling of links that package owners + did not explicitly nominate as installation files. + +* It should remain possible for package owners to choose to host their + release files on their own hosting, external to PyPI. It should be + easy for a user to request the installation of such releases using + automated installer tools. + +* Automated installer tools should not install externally-hosted + packages **by default**, but only when explicitly authorized to do + so by the user. When tools refuse to install such a package by + default, they should tell the user exactly which external link(s) + they would need to follow, and what option(s) the user can provide + to authorize the tool to follow those links. PyPI should provide all + necessary metadata for installer tools to implement this easily and + within a single request/reply interaction. + +* Migration from the status quo to the above points should be gradual + and minimize breakage. This includes tooling that makes it easy for + package owners with an existing release process that uploads to + non-PyPI hosting to also upload those release files to PyPI. + + +Solution / two transition phases +================================ + +The first transition phase introduces a "hosting-mode" field for each +project on PyPI, allowing package owners explicit control of which +release file links are served to present-day installation tools in the +machine-readable ``simple/`` index. The first transition will, after +successful hosting-mode manipulations by individual early-adopters, +set a default hosting mode for existing packages, based on automated +analysis. **Maintainers will be notified one month ahead of any such +automated change**. At completion of the first transition phase, +**all present-day existing release and installation processes and +tools are expected to continue working**. Any remaining errors or +problems are expected to only relate to installation of individual +packages and can be easily corrected by package maintainers or PyPI +admins if maintainers are not reachable. + +Also in the first phase, each link served in the ``simple/`` index +will be explicitly marked as ``rel="internal"`` (hosted by the index +itself) or ``rel="external"`` (linking to an external site that is not +part of the index). + +In the second transition phase, PyPI client installation tools shall +be updated to default to only install ``rel="internal"`` packages +unless a user specifies option(s) to permit installing from external +links. + +Maintainers of packages which currently host release files on non-PyPI +sites shall receive instructions and tools to ease "re-hosting" of +their historic and future package release files. This re-hosting tool +MUST be available before automated hosting-mode changes are announced +to package maintainers. + + +Implementation +============== + +Hosting modes +------------- + +The foundation of the first transition phase is the introduction of +three "modes" of PyPI hosting for a package, affecting which links are +generated for the ``simple/`` index. These modes are implemented +without requiring changes to installation tools via changes to the +algorithm for generating the machine-readable ``simple/`` index. + +The modes are: + +- ``pypi-scrape-crawl``: no change from the current situation of + generating machine-readable links for installation tools, as + outlined in the history_. + +- ``pypi-scrape``: for a package in this mode, links to be added to + the ``simple/`` index are still scraped from package + metadata. However, the "Home-page" and "Download-url" links are + given ``rel=ext-homepage`` and ``rel=ext-download`` attributes + instead of ``rel=homepage`` and ``rel=download``. The effect of this + (with no change in installation tools necessary) is that these links + will not be followed and scraped for further candidate links by + present-day installation tools: only installable files directly + hosted from PyPI or linked directly from PyPI metadata will be + considered for installation. Installation tools MAY evolve to offer + an option to use the new rel-attribution to crawl external pages but + MUST NOT default to it. + +- ``pypi-explicit``: for a package in this mode, only links to release + files uploaded to PyPI, and external links to release files + explicitly nominated by the package owner (via a new interface + exposed by PyPI) will be added to the ``simple/`` index. + +Thus the hope is that eventually all projects on PyPI can be migrated +to the ``pypi-explicit`` mode, while preserving the ability to install +release files hosted externally via installer tools. Deprecation of +hosting modes to eventually only allow the ``pypi-explicit`` mode is +NOT REGULATED by this PEP but is expected to become feasible some time +after successful implementation of the transition phases described in +this PEP. It is expected that deprecation requires **a new process to +deal with abandoned packages** because of unreachable maintainers for +still popular packages. + + +First transition phase (PyPI) +----------------------------- + +The proposed solution consists of multiple implementation and +communication steps: + +#. Implement in PyPI the three modes described above, with an + interface for package owners to select the mode for each package + and register explicit external file URLs. + +#. For packages in all modes, label all links in the ``simple/`` index + with ``rel="internal"`` or ``rel="external"``, to make it easier + for client tools to distinguish the types of links in the second + transition phase. + +#. Default all newly-registered packages to ``pypi-explicit`` mode + (package owners can still switch to the other modes as desired). + +#. Determine (via an automated analysis tool) which packages have all + installable files available on PyPI itself (group A), which have + all installable files linked directly from PyPI metadata (group B), + and which have installable versions available that are linked only + from external homepage/download HTML pages (group C). + +#. Send mail to maintainers of projects in group A that their project + will be automatically configured to ``pypi-explicit`` mode in one + month, and similarly to maintainers of projects in group B that + their project will be automatically configured to ``pypi-scrape`` + mode. Inform them that this change is not expected to affect + installability of their project at all, but will result in faster + and safer installs for their users. Encourage them to set this + mode themselves sooner to benefit their users. + +#. Send mail to maintainers of packages in group C that their package + hosting mode is ``pypi-scrape-crawl``, list the URLs which + currently are crawled, and suggest that they either re-host their + packages directly on PyPI and switch to ``pypi-explicit``, or at + least provide direct links to release files in PyPI metadata and + switch to ``pypi-scrape``. Provide instructions and tools to help + with these transitions. + + +Second transition phase (installer tools) +----------------------------------------- + +For the second transition phase, maintainers of installation tools are +asked to release two updates. + +The first update shall provide clear warnings if externally-hosted +release files (that is, files whose link is ``rel="external"``) are +selected for download, for which projects and URLs exactly this +happens, and warn that in future versions externally-hosted downloads +will be disabled by default. + +The second update should change the default mode to allow only +installation of ``rel="internal"`` package files, and allow +installation of externally-hosted packages only when the user supplies +an option (ideally an option specifying exactly which external domains +are to be trusted as download sources). When download of an +externally-hosted package is disallowed, the user should be notified, +with instructions for how to make the install succeed and warnings +about the implication (that a file will be downloaded from a site that +is not part of the package index). + + +Open Questions / tasks +====================== + +- Should we introduce some form of PyPI API versioning in this PEP? + (it might complicate matters and delay the implementation but is + often seen as good practise). + +- Do another round of discussions with installation tool authors and + see about incorporating their feedback. There is one known issue in + particular from Philip J. Eby who considers a host-based pattern + matching algorithm preferable to interpreting "rel" attributes. + + +References +========== + +.. [1] Donald Stufft, ratio of externally hosted versus pypi-hosted, + http://mail.python.org/pipermail/catalog-sig/2013-March/005549.html + (XXX need to update this data for all easy_install-supported formats) + +.. [2] Marc-Andre Lemburg, reasons for external hosting, + http://mail.python.org/pipermail/catalog-sig/2013-March/005626.html + +.. [3] Holger Krekel, script to remove homepage/download metadata for + all releases + http://mail.python.org/pipermail/catalog-sig/2013-February/005423.html + + +Acknowledgments +=============== + +Philip Eby for precise information and the basic ideas to implement +the transition via server-side changes only. + +Donald Stufft for pushing away from external hosting and offering to +implement both a Pull Request for the necessary PyPI changes and the +analysis tool to drive the transition phase 1. + +Marc-Andre Lemburg, Nick Coghlan and catalog-sig in general for +thinking through issues regarding getting rid of "external hosting". + + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sat Mar 16 01:46:56 2013 From: python-checkins at python.org (r.david.murray) Date: Sat, 16 Mar 2013 01:46:56 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3NDMxOiBGaXgg?= =?utf-8?q?missing_import_of_BytesFeedParser_in_email=2Eparser=2E?= Message-ID: <3ZSQ345gCfzS7C@mail.python.org> http://hg.python.org/cpython/rev/4e6cf15e55c1 changeset: 82674:4e6cf15e55c1 branch: 3.2 parent: 82671:4be7f8da7adf user: R David Murray date: Fri Mar 15 20:38:15 2013 -0400 summary: #17431: Fix missing import of BytesFeedParser in email.parser. Initial patch contributed by Edmond Burnett. files: Lib/email/parser.py | 2 +- Lib/email/test/test_email.py | 4 ++++ Misc/ACKS | 1 + Misc/NEWS | 2 ++ 4 files changed, 8 insertions(+), 1 deletions(-) diff --git a/Lib/email/parser.py b/Lib/email/parser.py --- a/Lib/email/parser.py +++ b/Lib/email/parser.py @@ -9,7 +9,7 @@ import warnings from io import StringIO, TextIOWrapper -from email.feedparser import FeedParser +from email.feedparser import FeedParser, BytesFeedParser from email.message import Message diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -38,6 +38,10 @@ from test.support import findfile, run_unittest, unlink from email.test import __file__ as landmark +# These imports are documented to work, but we are testing them using a +# different path, so we import them here just to make sure they are importable. +from email.parser import FeedParser, BytesFeedParser + NL = '\n' EMPTYSTRING = '' diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -156,6 +156,7 @@ Dick Bulterman Bill Bumgarner Jimmy Burgett +Edmond Burnett Tommy Burnette Roger Burnham Alastair Burt diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,6 +233,8 @@ Library ------- +- Issue #17431: Fix missing import of BytesFeedParser in email.parser. + - Issue #1285086: Get rid of the refcounting hack and speed up urllib.parse.unquote() and urllib.parse.unquote_to_bytes(). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 01:46:58 2013 From: python-checkins at python.org (r.david.murray) Date: Sat, 16 Mar 2013 01:46:58 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge=3A_=2317431=3A_Fix_missing_import_of_BytesFeedParser_in_?= =?utf-8?q?email=2Eparser=2E?= Message-ID: <3ZSQ361Kk3zSCQ@mail.python.org> http://hg.python.org/cpython/rev/45f6925906bf changeset: 82675:45f6925906bf branch: 3.3 parent: 82672:166fb6ecb55a parent: 82674:4e6cf15e55c1 user: R David Murray date: Fri Mar 15 20:42:29 2013 -0400 summary: Merge: #17431: Fix missing import of BytesFeedParser in email.parser. files: Lib/email/parser.py | 2 +- Lib/test/test_email/test_email.py | 4 ++++ Misc/ACKS | 1 + Misc/NEWS | 2 ++ 4 files changed, 8 insertions(+), 1 deletions(-) diff --git a/Lib/email/parser.py b/Lib/email/parser.py --- a/Lib/email/parser.py +++ b/Lib/email/parser.py @@ -9,7 +9,7 @@ import warnings from io import StringIO, TextIOWrapper -from email.feedparser import FeedParser +from email.feedparser import FeedParser, BytesFeedParser from email.message import Message from email._policybase import compat32 diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -36,6 +36,10 @@ from test.support import unlink from test.test_email import openfile, TestEmailBase +# These imports are documented to work, but we are testing them using a +# different path, so we import them here just to make sure they are importable. +from email.parser import FeedParser, BytesFeedParser + NL = '\n' EMPTYSTRING = '' SPACE = ' ' diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -172,6 +172,7 @@ Dick Bulterman Bill Bumgarner Jimmy Burgett +Edmond Burnett Tommy Burnette Roger Burnham Alastair Burt diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -193,6 +193,8 @@ Library ------- +- Issue #17431: Fix missing import of BytesFeedParser in email.parser. + - Issue #1285086: Get rid of the refcounting hack and speed up urllib.parse.unquote() and urllib.parse.unquote_to_bytes(). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 01:46:59 2013 From: python-checkins at python.org (r.david.murray) Date: Sat, 16 Mar 2013 01:46:59 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=2317431=3A_Fix_missing_import_of_BytesFeedPars?= =?utf-8?q?er_in_email=2Eparser=2E?= Message-ID: <3ZSQ374JQ2zSBh@mail.python.org> http://hg.python.org/cpython/rev/b7c1ed5ce714 changeset: 82676:b7c1ed5ce714 parent: 82673:46e6a8b742d9 parent: 82675:45f6925906bf user: R David Murray date: Fri Mar 15 20:45:11 2013 -0400 summary: Merge: #17431: Fix missing import of BytesFeedParser in email.parser. files: Lib/email/parser.py | 2 +- Lib/test/test_email/test_email.py | 4 ++++ Misc/ACKS | 1 + Misc/NEWS | 2 ++ 4 files changed, 8 insertions(+), 1 deletions(-) diff --git a/Lib/email/parser.py b/Lib/email/parser.py --- a/Lib/email/parser.py +++ b/Lib/email/parser.py @@ -9,7 +9,7 @@ import warnings from io import StringIO, TextIOWrapper -from email.feedparser import FeedParser +from email.feedparser import FeedParser, BytesFeedParser from email.message import Message from email._policybase import compat32 diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -36,6 +36,10 @@ from test.support import unlink from test.test_email import openfile, TestEmailBase +# These imports are documented to work, but we are testing them using a +# different path, so we import them here just to make sure they are importable. +from email.parser import FeedParser, BytesFeedParser + NL = '\n' EMPTYSTRING = '' SPACE = ' ' diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -173,6 +173,7 @@ Dick Bulterman Bill Bumgarner Jimmy Burgett +Edmond Burnett Tommy Burnette Roger Burnham Alastair Burt diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -280,6 +280,8 @@ Library ------- +- Issue #17431: Fix missing import of BytesFeedParser in email.parser. + - Issue #12921: http.server's send_error takes an explain argument to send more information in response. Patch contributed by Karl. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 02:08:18 2013 From: python-checkins at python.org (r.david.murray) Date: Sat, 16 Mar 2013 02:08:18 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Add_missing_FeedParser_and?= =?utf-8?q?_BytesFeedParser_to_email=2Eparser=2E=5F=5Fall=5F=5F=2E?= Message-ID: <3ZSQWk54KwzS8Y@mail.python.org> http://hg.python.org/cpython/rev/07e0cd0d39b3 changeset: 82677:07e0cd0d39b3 user: R David Murray date: Fri Mar 15 21:00:48 2013 -0400 summary: Add missing FeedParser and BytesFeedParser to email.parser.__all__. files: Lib/email/parser.py | 3 ++- Misc/NEWS | 2 ++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/email/parser.py b/Lib/email/parser.py --- a/Lib/email/parser.py +++ b/Lib/email/parser.py @@ -4,7 +4,8 @@ """A parser of RFC 2822 and MIME email messages.""" -__all__ = ['Parser', 'HeaderParser', 'BytesParser', 'BytesHeaderParser'] +__all__ = ['Parser', 'HeaderParser', 'BytesParser', 'BytesHeaderParser', + 'FeedParser', 'BytesFeedParser'] import warnings from io import StringIO, TextIOWrapper diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -280,6 +280,8 @@ Library ------- +- Added missing FeedParser and BytesFeedParser to email.parser.__all__. + - Issue #17431: Fix missing import of BytesFeedParser in email.parser. - Issue #12921: http.server's send_error takes an explain argument to send more -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sat Mar 16 06:01:36 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 16 Mar 2013 06:01:36 +0100 Subject: [Python-checkins] Daily reference leaks (07e0cd0d39b3): sum=0 Message-ID: results for 07e0cd0d39b3 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogAX999N', '-x'] From python-checkins at python.org Sat Mar 16 08:01:55 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 16 Mar 2013 08:01:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIyAxMDY1?= =?utf-8?q?2=3A_make_tcl/tk_tests_run_after_=5F=5Fall=5F=5F_test=2C_patch_?= =?utf-8?q?by_Zachary_Ware=2E?= Message-ID: <3ZSZMl5GY2zSHQ@mail.python.org> http://hg.python.org/cpython/rev/b923234b60cb changeset: 82678:b923234b60cb branch: 3.2 parent: 82674:4e6cf15e55c1 user: Terry Jan Reedy date: Sat Mar 16 02:37:06 2013 -0400 summary: Issue # 10652: make tcl/tk tests run after __all__ test, patch by Zachary Ware. files: Lib/test/test_tcl.py | 3 +++ Lib/test/test_tk.py | 3 +++ Lib/test/test_ttk_guionly.py | 3 +++ Lib/test/test_ttk_textonly.py | 3 +++ Misc/NEWS | 3 +++ 5 files changed, 15 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py --- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -8,6 +8,9 @@ # Skip this test if the _tkinter module wasn't built. _tkinter = support.import_module('_tkinter') +# Make sure tkinter._fix runs to set up the environment +support.import_fresh_module('tkinter') + from tkinter import Tcl from _tkinter import TclError diff --git a/Lib/test/test_tk.py b/Lib/test/test_tk.py --- a/Lib/test/test_tk.py +++ b/Lib/test/test_tk.py @@ -2,6 +2,9 @@ # Skip test if _tkinter wasn't built. support.import_module('_tkinter') +# Make sure tkinter._fix runs to set up the environment +support.import_fresh_module('tkinter') + # Skip test if tk cannot be initialized. from tkinter.test.support import check_tk_availability check_tk_availability() diff --git a/Lib/test/test_ttk_guionly.py b/Lib/test/test_ttk_guionly.py --- a/Lib/test/test_ttk_guionly.py +++ b/Lib/test/test_ttk_guionly.py @@ -5,6 +5,9 @@ # Skip this test if _tkinter wasn't built. support.import_module('_tkinter') +# Make sure tkinter._fix runs to set up the environment +support.import_fresh_module('tkinter') + # Skip test if tk cannot be initialized. from tkinter.test.support import check_tk_availability check_tk_availability() diff --git a/Lib/test/test_ttk_textonly.py b/Lib/test/test_ttk_textonly.py --- a/Lib/test/test_ttk_textonly.py +++ b/Lib/test/test_ttk_textonly.py @@ -4,6 +4,9 @@ # Skip this test if _tkinter does not exist. support.import_module('_tkinter') +# Make sure tkinter._fix runs to set up the environment +support.import_fresh_module('tkinter') + from tkinter.test import runtktests def test_main(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -964,6 +964,9 @@ Tests ----- +- Issue # 10652: make tcl/tk tests run after __all__ test, patch by + Zachary Ware. + - Issue #11963: remove human verification from test_parser and test_subprocess. - Issue #11732: add a new suppress_crash_popup() context manager to test.support -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 08:01:57 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 16 Mar 2013 08:01:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Issue_=23_10652=3A_make_tcl/tk_tests_run_after_=5F=5Fall=5F=5F?= =?utf-8?q?_test=2C_patch_by_Zachary_Ware=2E?= Message-ID: <3ZSZMn0pnkzSJb@mail.python.org> http://hg.python.org/cpython/rev/596e8855895e changeset: 82679:596e8855895e branch: 3.3 parent: 82675:45f6925906bf parent: 82678:b923234b60cb user: Terry Jan Reedy date: Sat Mar 16 02:51:18 2013 -0400 summary: Issue # 10652: make tcl/tk tests run after __all__ test, patch by Zachary Ware. files: Lib/test/test_tcl.py | 3 +++ Lib/test/test_tk.py | 3 +++ Lib/test/test_ttk_guionly.py | 3 +++ Lib/test/test_ttk_textonly.py | 3 +++ Misc/NEWS | 3 +++ 5 files changed, 15 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py --- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -8,6 +8,9 @@ # Skip this test if the _tkinter module wasn't built. _tkinter = support.import_module('_tkinter') +# Make sure tkinter._fix runs to set up the environment +support.import_fresh_module('tkinter') + from tkinter import Tcl from _tkinter import TclError diff --git a/Lib/test/test_tk.py b/Lib/test/test_tk.py --- a/Lib/test/test_tk.py +++ b/Lib/test/test_tk.py @@ -2,6 +2,9 @@ # Skip test if _tkinter wasn't built. support.import_module('_tkinter') +# Make sure tkinter._fix runs to set up the environment +support.import_fresh_module('tkinter') + # Skip test if tk cannot be initialized. from tkinter.test.support import check_tk_availability check_tk_availability() diff --git a/Lib/test/test_ttk_guionly.py b/Lib/test/test_ttk_guionly.py --- a/Lib/test/test_ttk_guionly.py +++ b/Lib/test/test_ttk_guionly.py @@ -5,6 +5,9 @@ # Skip this test if _tkinter wasn't built. support.import_module('_tkinter') +# Make sure tkinter._fix runs to set up the environment +support.import_fresh_module('tkinter') + # Skip test if tk cannot be initialized. from tkinter.test.support import check_tk_availability check_tk_availability() diff --git a/Lib/test/test_ttk_textonly.py b/Lib/test/test_ttk_textonly.py --- a/Lib/test/test_ttk_textonly.py +++ b/Lib/test/test_ttk_textonly.py @@ -4,6 +4,9 @@ # Skip this test if _tkinter does not exist. support.import_module('_tkinter') +# Make sure tkinter._fix runs to set up the environment +support.import_fresh_module('tkinter') + from tkinter.test import runtktests def test_main(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -654,6 +654,9 @@ Tests ----- +- Issue #10652: make tcl/tk tests run after __all__ test, patch by + Zachary Ware. + - Issue #11963: remove human verification from test_parser and test_subprocess. - Issue #11732: add a new suppress_crash_popup() context manager to test.support -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 08:01:58 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 16 Mar 2013 08:01:58 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E3?= Message-ID: <3ZSZMp3VT8zS4D@mail.python.org> http://hg.python.org/cpython/rev/44efcdf221f7 changeset: 82680:44efcdf221f7 parent: 82677:07e0cd0d39b3 parent: 82679:596e8855895e user: Terry Jan Reedy date: Sat Mar 16 02:52:24 2013 -0400 summary: Merge with 3.3 files: Lib/test/test_tcl.py | 3 +++ Lib/test/test_tk.py | 3 +++ Lib/test/test_ttk_guionly.py | 3 +++ Lib/test/test_ttk_textonly.py | 3 +++ Misc/NEWS | 3 +++ 5 files changed, 15 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py --- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -8,6 +8,9 @@ # Skip this test if the _tkinter module wasn't built. _tkinter = support.import_module('_tkinter') +# Make sure tkinter._fix runs to set up the environment +support.import_fresh_module('tkinter') + from tkinter import Tcl from _tkinter import TclError diff --git a/Lib/test/test_tk.py b/Lib/test/test_tk.py --- a/Lib/test/test_tk.py +++ b/Lib/test/test_tk.py @@ -2,6 +2,9 @@ # Skip test if _tkinter wasn't built. support.import_module('_tkinter') +# Make sure tkinter._fix runs to set up the environment +support.import_fresh_module('tkinter') + # Skip test if tk cannot be initialized. from tkinter.test.support import check_tk_availability check_tk_availability() diff --git a/Lib/test/test_ttk_guionly.py b/Lib/test/test_ttk_guionly.py --- a/Lib/test/test_ttk_guionly.py +++ b/Lib/test/test_ttk_guionly.py @@ -5,6 +5,9 @@ # Skip this test if _tkinter wasn't built. support.import_module('_tkinter') +# Make sure tkinter._fix runs to set up the environment +support.import_fresh_module('tkinter') + # Skip test if tk cannot be initialized. from tkinter.test.support import check_tk_availability check_tk_availability() diff --git a/Lib/test/test_ttk_textonly.py b/Lib/test/test_ttk_textonly.py --- a/Lib/test/test_ttk_textonly.py +++ b/Lib/test/test_ttk_textonly.py @@ -4,6 +4,9 @@ # Skip this test if _tkinter does not exist. support.import_module('_tkinter') +# Make sure tkinter._fix runs to set up the environment +support.import_fresh_module('tkinter') + from tkinter.test import runtktests def test_main(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -932,6 +932,9 @@ Tests ----- +- Issue #10652: make tcl/tk tests run after __all__ test, patch by + Zachary Ware. + - Issue #11963: remove human verification from test_parser and test_subprocess. - Issue #11732: add a new suppress_crash_popup() context manager to test.support -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 08:01:59 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 16 Mar 2013 08:01:59 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_typo?= Message-ID: <3ZSZMq6DYhzSLX@mail.python.org> http://hg.python.org/cpython/rev/cec135cb059c changeset: 82681:cec135cb059c branch: 3.2 parent: 82678:b923234b60cb user: Terry Jan Reedy date: Sat Mar 16 02:53:09 2013 -0400 summary: typo files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -964,7 +964,7 @@ Tests ----- -- Issue # 10652: make tcl/tk tests run after __all__ test, patch by +- Issue #10652: make tcl/tk tests run after __all__ test, patch by Zachary Ware. - Issue #11963: remove human verification from test_parser and test_subprocess. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 08:02:01 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 16 Mar 2013 08:02:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2312345=3A_null_merge_with_3=2E2=2E?= Message-ID: <3ZSZMs1pcdzSJs@mail.python.org> http://hg.python.org/cpython/rev/761b370f2cfd changeset: 82682:761b370f2cfd branch: 3.3 parent: 82679:596e8855895e parent: 82681:cec135cb059c user: Terry Jan Reedy date: Sat Mar 16 02:58:15 2013 -0400 summary: #12345: null merge with 3.2. files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 08:02:02 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 16 Mar 2013 08:02:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_=2310652_null_merge_from_3=2E3_which_had_wrong_issue_=23?= Message-ID: <3ZSZMt4gdQzSJ6@mail.python.org> http://hg.python.org/cpython/rev/7c76b70075db changeset: 82683:7c76b70075db parent: 82680:44efcdf221f7 parent: 82682:761b370f2cfd user: Terry Jan Reedy date: Sat Mar 16 03:01:02 2013 -0400 summary: #10652 null merge from 3.3 which had wrong issue # files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 08:03:51 2013 From: python-checkins at python.org (georg.brandl) Date: Sat, 16 Mar 2013 08:03:51 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Remove_row-spa?= =?utf-8?q?nning_cell=2C_which_the_Sphinx_text_writer_does_not_support=2E?= Message-ID: <3ZSZPz67XfzNPV@mail.python.org> http://hg.python.org/cpython/rev/6541691f5315 changeset: 82684:6541691f5315 branch: 3.3 parent: 82675:45f6925906bf user: Georg Brandl date: Sat Mar 16 08:01:49 2013 +0100 summary: Remove row-spanning cell, which the Sphinx text writer does not support. files: Doc/c-api/apiabiversion.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/c-api/apiabiversion.rst b/Doc/c-api/apiabiversion.rst --- a/Doc/c-api/apiabiversion.rst +++ b/Doc/c-api/apiabiversion.rst @@ -28,7 +28,7 @@ | | | ``0xB`` for beta, ``0xC`` for release | | | | candidate and ``0xF`` for final), in this | | | | case it is alpha. | - | +-------------------------+------------------------------------------------+ + +-------+-------------------------+------------------------------------------------+ | | ``29-32`` | ``PY_RELEASE_SERIAL`` (the ``2`` in | | | | ``3.4.1a2``, zero for final releases) | +-------+-------------------------+------------------------------------------------+ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 08:03:53 2013 From: python-checkins at python.org (georg.brandl) Date: Sat, 16 Mar 2013 08:03:53 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4zIC0+IDMuMyk6?= =?utf-8?q?_merge_heads?= Message-ID: <3ZSZQ11mgqzNPV@mail.python.org> http://hg.python.org/cpython/rev/c2be613f5ea6 changeset: 82685:c2be613f5ea6 branch: 3.3 parent: 82682:761b370f2cfd parent: 82684:6541691f5315 user: Georg Brandl date: Sat Mar 16 08:03:13 2013 +0100 summary: merge heads files: Doc/c-api/apiabiversion.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/c-api/apiabiversion.rst b/Doc/c-api/apiabiversion.rst --- a/Doc/c-api/apiabiversion.rst +++ b/Doc/c-api/apiabiversion.rst @@ -28,7 +28,7 @@ | | | ``0xB`` for beta, ``0xC`` for release | | | | candidate and ``0xF`` for final), in this | | | | case it is alpha. | - | +-------------------------+------------------------------------------------+ + +-------+-------------------------+------------------------------------------------+ | | ``29-32`` | ``PY_RELEASE_SERIAL`` (the ``2`` in | | | | ``3.4.1a2``, zero for final releases) | +-------+-------------------------+------------------------------------------------+ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 08:03:54 2013 From: python-checkins at python.org (georg.brandl) Date: Sat, 16 Mar 2013 08:03:54 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge_with_3=2E3?= Message-ID: <3ZSZQ24Fb9zSJR@mail.python.org> http://hg.python.org/cpython/rev/baad8b9888cc changeset: 82686:baad8b9888cc parent: 82683:7c76b70075db parent: 82685:c2be613f5ea6 user: Georg Brandl date: Sat Mar 16 08:03:51 2013 +0100 summary: merge with 3.3 files: Doc/c-api/apiabiversion.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/c-api/apiabiversion.rst b/Doc/c-api/apiabiversion.rst --- a/Doc/c-api/apiabiversion.rst +++ b/Doc/c-api/apiabiversion.rst @@ -28,7 +28,7 @@ | | | ``0xB`` for beta, ``0xC`` for release | | | | candidate and ``0xF`` for final), in this | | | | case it is alpha. | - | +-------------------------+------------------------------------------------+ + +-------+-------------------------+------------------------------------------------+ | | ``29-32`` | ``PY_RELEASE_SERIAL`` (the ``2`` in | | | | ``3.4.1a2``, zero for final releases) | +-------+-------------------------+------------------------------------------------+ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 17:23:06 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 16 Mar 2013 17:23:06 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_reject_non-docs_strings_be?= =?utf-8?q?tween_future_imports_=28closes_=2317434=29?= Message-ID: <3ZSpqG4D8YzS1B@mail.python.org> http://hg.python.org/cpython/rev/46cadd3955d0 changeset: 82687:46cadd3955d0 user: Benjamin Peterson date: Sat Mar 16 09:15:47 2013 -0700 summary: reject non-docs strings between future imports (closes #17434) files: Lib/test/badsyntax_future10.py | 3 ++ Lib/test/test_future.py | 8 +++++++ Misc/NEWS | 3 ++ Python/future.c | 25 ++++++++++++--------- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Lib/test/badsyntax_future10.py b/Lib/test/badsyntax_future10.py new file mode 100644 --- /dev/null +++ b/Lib/test/badsyntax_future10.py @@ -0,0 +1,3 @@ +from __future__ import absolute_import +"spam, bar, blah" +from __future__ import print_function diff --git a/Lib/test/test_future.py b/Lib/test/test_future.py --- a/Lib/test/test_future.py +++ b/Lib/test/test_future.py @@ -82,6 +82,14 @@ else: self.fail("expected exception didn't occur") + def test_badfuture10(self): + try: + from test import badsyntax_future10 + except SyntaxError as msg: + self.assertEqual(get_error_location(msg), ("badsyntax_future10", '3')) + else: + self.fail("expected exception didn't occur") + def test_parserhack(self): # test that the parser.c::future_hack function works as expected # Note: although this test must pass, it's not testing the original diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #17434: Properly raise a SyntaxError when a string occurs between future + imports. + - Issue #17117: Import and @importlib.util.set_loader now set __loader__ when it has a value of None or the attribute doesn't exist. diff --git a/Python/future.c b/Python/future.c --- a/Python/future.c +++ b/Python/future.c @@ -58,11 +58,14 @@ static int future_parse(PyFutureFeatures *ff, mod_ty mod, const char *filename) { - int i, found_docstring = 0, done = 0, prev_line = 0; + int i, done = 0, prev_line = 0; if (!(mod->kind == Module_kind || mod->kind == Interactive_kind)) return 1; + if (asdl_seq_LEN(mod->v.Module.body) == 0) + return 1; + /* A subsequent pass will detect future imports that don't appear at the beginning of the file. There's one case, however, that is easier to handle here: A series of imports @@ -71,8 +74,13 @@ but is preceded by a regular import. */ + i = 0; + stmt_ty first = (stmt_ty)asdl_seq_GET(mod->v.Module.body, i); + if (first->kind == Expr_kind && first->v.Expr.value->kind == Str_kind) + i++; - for (i = 0; i < asdl_seq_LEN(mod->v.Module.body); i++) { + + for (; i < asdl_seq_LEN(mod->v.Module.body); i++) { stmt_ty s = (stmt_ty)asdl_seq_GET(mod->v.Module.body, i); if (done && s->lineno > prev_line) @@ -99,18 +107,13 @@ return 0; ff->ff_lineno = s->lineno; } - else + else { done = 1; + } } - else if (s->kind == Expr_kind && !found_docstring) { - expr_ty e = s->v.Expr.value; - if (e->kind != Str_kind) - done = 1; - else - found_docstring = 1; + else { + done = 1; } - else - done = 1; } return 1; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 20:50:36 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 16 Mar 2013 20:50:36 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzExNDIwOiBtYWtl?= =?utf-8?q?_test_suite_pass_with_-B/DONTWRITEBYTECODE_set=2E__Initial_patc?= =?utf-8?q?h_by?= Message-ID: <3ZSvQh6sh7zSKK@mail.python.org> http://hg.python.org/cpython/rev/2370ae9ee052 changeset: 82688:2370ae9ee052 branch: 3.2 parent: 82681:cec135cb059c user: Ezio Melotti date: Sat Mar 16 19:48:51 2013 +0200 summary: #11420: make test suite pass with -B/DONTWRITEBYTECODE set. Initial patch by Thomas Wouters. files: Lib/distutils/tests/test_bdist_dumb.py | 6 +- Lib/importlib/test/source/test_file_loader.py | 3 +- Lib/test/test_imp.py | 8 +- Lib/test/test_import.py | 13 ++ Lib/test/test_runpy.py | 48 +++++---- Misc/NEWS | 3 + 6 files changed, 52 insertions(+), 29 deletions(-) diff --git a/Lib/distutils/tests/test_bdist_dumb.py b/Lib/distutils/tests/test_bdist_dumb.py --- a/Lib/distutils/tests/test_bdist_dumb.py +++ b/Lib/distutils/tests/test_bdist_dumb.py @@ -88,9 +88,9 @@ fp.close() contents = sorted(os.path.basename(fn) for fn in contents) - wanted = ['foo-0.1-py%s.%s.egg-info' % sys.version_info[:2], - 'foo.%s.pyc' % imp.get_tag(), - 'foo.py'] + wanted = ['foo-0.1-py%s.%s.egg-info' % sys.version_info[:2], 'foo.py'] + if not sys.dont_write_bytecode: + wanted.append('foo.%s.pyc' % imp.get_tag()) self.assertEqual(contents, sorted(wanted)) def test_suite(): diff --git a/Lib/importlib/test/source/test_file_loader.py b/Lib/importlib/test/source/test_file_loader.py --- a/Lib/importlib/test/source/test_file_loader.py +++ b/Lib/importlib/test/source/test_file_loader.py @@ -127,7 +127,8 @@ finally: os.unlink(file_path) pycache = os.path.dirname(imp.cache_from_source(file_path)) - shutil.rmtree(pycache) + if os.path.exists(pycache): + shutil.rmtree(pycache) def test_timestamp_overflow(self): # When a modification timestamp is larger than 2**32, it should be diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py --- a/Lib/test/test_imp.py +++ b/Lib/test/test_imp.py @@ -153,9 +153,11 @@ mod = imp.load_source(temp_mod_name, temp_mod_name + '.py') self.assertEqual(mod.a, 1) - mod = imp.load_compiled( - temp_mod_name, imp.cache_from_source(temp_mod_name + '.py')) - self.assertEqual(mod.a, 1) + if not sys.dont_write_bytecode: + mod = imp.load_compiled( + temp_mod_name, + imp.cache_from_source(temp_mod_name + '.py')) + self.assertEqual(mod.a, 1) if not os.path.exists(test_package_name): os.mkdir(test_package_name) diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -20,6 +20,10 @@ from test import script_helper +skip_if_dont_write_bytecode = unittest.skipIf( + sys.dont_write_bytecode, + "test meaningful only when writing bytecode") + def _files(name): return (name + os.extsep + "py", name + os.extsep + "pyc", @@ -109,6 +113,7 @@ @unittest.skipUnless(os.name == 'posix', "test meaningful only on posix systems") + @skip_if_dont_write_bytecode def test_execute_bit_not_copied(self): # Issue 6070: under posix .pyc files got their execute bit set if # the .py file had the execute bit set, but they aren't executable. @@ -133,6 +138,7 @@ remove_files(TESTFN) unload(TESTFN) + @skip_if_dont_write_bytecode def test_rewrite_pyc_with_read_only_source(self): # Issue 6074: a long time ago on posix, and more recently on Windows, # a read only source file resulted in a read only pyc file, which @@ -299,6 +305,7 @@ remove_files(TESTFN) unload(TESTFN) + @skip_if_dont_write_bytecode def test_file_to_source(self): # check if __file__ points to the source file where available source = TESTFN + ".py" @@ -619,6 +626,7 @@ del sys.path[0] self._clean() + @skip_if_dont_write_bytecode def test_import_pyc_path(self): self.assertFalse(os.path.exists('__pycache__')) __import__(TESTFN) @@ -631,6 +639,7 @@ "test meaningful only on posix systems") @unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0, "due to varying filesystem permission semantics (issue #11956)") + @skip_if_dont_write_bytecode def test_unwritable_directory(self): # When the umask causes the new __pycache__ directory to be # unwritable, the import still succeeds but no .pyc file is written. @@ -640,6 +649,7 @@ self.assertFalse(os.path.exists(os.path.join( '__pycache__', '{}.{}.pyc'.format(TESTFN, self.tag)))) + @skip_if_dont_write_bytecode def test_missing_source(self): # With PEP 3147 cache layout, removing the source but leaving the pyc # file does not satisfy the import. @@ -650,6 +660,7 @@ forget(TESTFN) self.assertRaises(ImportError, __import__, TESTFN) + @skip_if_dont_write_bytecode def test_missing_source_legacy(self): # Like test_missing_source() except that for backward compatibility, # when the pyc file lives where the py file would have been (and named @@ -670,6 +681,7 @@ pyc_file = imp.cache_from_source(TESTFN + '.py') self.assertEqual(m.__cached__, os.path.join(os.curdir, pyc_file)) + @skip_if_dont_write_bytecode def test___cached___legacy_pyc(self): # Like test___cached__() except that for backward compatibility, # when the pyc file lives where the py file would have been (and named @@ -684,6 +696,7 @@ self.assertEqual(m.__cached__, os.path.join(os.curdir, os.path.relpath(pyc_file))) + @skip_if_dont_write_bytecode def test_package___cached__(self): # Like test___cached__ but for packages. def cleanup(): diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py --- a/Lib/test/test_runpy.py +++ b/Lib/test/test_runpy.py @@ -254,11 +254,12 @@ self.check_code_execution(create_ns, expected_ns) __import__(mod_name) os.remove(mod_fname) - make_legacy_pyc(mod_fname) - unload(mod_name) # In case loader caches paths - if verbose > 1: print("Running from compiled:", mod_name) - self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) - self.check_code_execution(create_ns, expected_ns) + if not sys.dont_write_bytecode: + make_legacy_pyc(mod_fname) + unload(mod_name) # In case loader caches paths + if verbose > 1: print("Running from compiled:", mod_name) + self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) + self.check_code_execution(create_ns, expected_ns) finally: self._del_pkg(pkg_dir, depth, mod_name) if verbose > 1: print("Module executed successfully") @@ -287,11 +288,12 @@ self.check_code_execution(create_ns, expected_ns) __import__(mod_name) os.remove(mod_fname) - make_legacy_pyc(mod_fname) - unload(mod_name) # In case loader caches paths - if verbose > 1: print("Running from compiled:", pkg_name) - self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) - self.check_code_execution(create_ns, expected_ns) + if not sys.dont_write_bytecode: + make_legacy_pyc(mod_fname) + unload(mod_name) # In case loader caches paths + if verbose > 1: print("Running from compiled:", pkg_name) + self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) + self.check_code_execution(create_ns, expected_ns) finally: self._del_pkg(pkg_dir, depth, pkg_name) if verbose > 1: print("Package executed successfully") @@ -345,15 +347,16 @@ del d1 # Ensure __loader__ entry doesn't keep file open __import__(mod_name) os.remove(mod_fname) - make_legacy_pyc(mod_fname) - unload(mod_name) # In case the loader caches paths - if verbose > 1: print("Running from compiled:", mod_name) - d2 = run_module(mod_name, run_name=run_name) # Read from bytecode - self.assertEqual(d2["__name__"], expected_name) - self.assertEqual(d2["__package__"], pkg_name) - self.assertIn("sibling", d2) - self.assertIn("nephew", d2) - del d2 # Ensure __loader__ entry doesn't keep file open + if not sys.dont_write_bytecode: + make_legacy_pyc(mod_fname) + unload(mod_name) # In case the loader caches paths + if verbose > 1: print("Running from compiled:", mod_name) + d2 = run_module(mod_name, run_name=run_name) # Read from bytecode + self.assertEqual(d2["__name__"], expected_name) + self.assertEqual(d2["__package__"], pkg_name) + self.assertIn("sibling", d2) + self.assertIn("nephew", d2) + del d2 # Ensure __loader__ entry doesn't keep file open finally: self._del_pkg(pkg_dir, depth, mod_name) if verbose > 1: print("Module executed successfully") @@ -472,9 +475,10 @@ script_name = self._make_test_script(script_dir, mod_name) compiled_name = py_compile.compile(script_name, doraise=True) os.remove(script_name) - legacy_pyc = make_legacy_pyc(script_name) - self._check_script(script_dir, "", legacy_pyc, - script_dir) + if not sys.dont_write_bytecode: + legacy_pyc = make_legacy_pyc(script_name) + self._check_script(script_dir, "", legacy_pyc, + script_dir) def test_directory_error(self): with temp_dir() as script_dir: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -964,6 +964,9 @@ Tests ----- +- Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set. + Initial patch by Thomas Wouters. + - Issue #10652: make tcl/tk tests run after __all__ test, patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 20:50:38 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 16 Mar 2013 20:50:38 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzExNDIwOiBtYWtl?= =?utf-8?q?_test_suite_pass_with_-B/DONTWRITEBYTECODE_set=2E__Initial_patc?= =?utf-8?q?h_by?= Message-ID: <3ZSvQk47T8zSLM@mail.python.org> http://hg.python.org/cpython/rev/c70746a0291f changeset: 82689:c70746a0291f branch: 2.7 parent: 82670:274e68e2a5a6 user: Ezio Melotti date: Sat Mar 16 20:04:44 2013 +0200 summary: #11420: make test suite pass with -B/DONTWRITEBYTECODE set. Initial patch by Thomas Wouters. files: Lib/distutils/tests/test_bdist_dumb.py | 5 +- Lib/test/test_import.py | 13 +++- Lib/test/test_runpy.py | 37 +++++++------ Misc/NEWS | 3 + 4 files changed, 36 insertions(+), 22 deletions(-) diff --git a/Lib/distutils/tests/test_bdist_dumb.py b/Lib/distutils/tests/test_bdist_dumb.py --- a/Lib/distutils/tests/test_bdist_dumb.py +++ b/Lib/distutils/tests/test_bdist_dumb.py @@ -87,8 +87,9 @@ fp.close() contents = sorted(os.path.basename(fn) for fn in contents) - wanted = ['foo-0.1-py%s.%s.egg-info' % sys.version_info[:2], - 'foo.py', 'foo.pyc'] + wanted = ['foo-0.1-py%s.%s.egg-info' % sys.version_info[:2], 'foo.py'] + if not sys.dont_write_bytecode: + wanted.append('foo.pyc') self.assertEqual(contents, sorted(wanted)) def test_finalize_options(self): diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -88,7 +88,8 @@ unlink(source) try: - imp.reload(mod) + if not sys.dont_write_bytecode: + imp.reload(mod) except ImportError, err: self.fail("import from .pyc/.pyo failed: %s" % err) finally: @@ -105,7 +106,10 @@ finally: del sys.path[0] - @unittest.skipUnless(os.name == 'posix', "test meaningful only on posix systems") + @unittest.skipUnless(os.name == 'posix', + "test meaningful only on posix systems") + @unittest.skipIf(sys.dont_write_bytecode, + "test meaningful only when writing bytecode") def test_execute_bit_not_copied(self): # Issue 6070: under posix .pyc files got their execute bit set if # the .py file had the execute bit set, but they aren't executable. @@ -132,6 +136,8 @@ unload(TESTFN) del sys.path[0] + @unittest.skipIf(sys.dont_write_bytecode, + "test meaningful only when writing bytecode") def test_rewrite_pyc_with_read_only_source(self): # Issue 6074: a long time ago on posix, and more recently on Windows, # a read only source file resulted in a read only pyc file, which @@ -441,7 +447,8 @@ self.assertEqual(mod.func_filename, self.file_name) del sys.modules[self.module_name] mod = self.import_module() - self.assertEqual(mod.module_filename, self.compiled_name) + if not sys.dont_write_bytecode: + self.assertEqual(mod.module_filename, self.compiled_name) self.assertEqual(mod.code_filename, self.file_name) self.assertEqual(mod.func_filename, self.file_name) diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py --- a/Lib/test/test_runpy.py +++ b/Lib/test/test_runpy.py @@ -170,11 +170,12 @@ del d1 # Ensure __loader__ entry doesn't keep file open __import__(mod_name) os.remove(mod_fname) - if verbose: print "Running from compiled:", mod_name - d2 = run_module(mod_name) # Read from bytecode - self.assertIn("x", d2) - self.assertTrue(d2["x"] == 1) - del d2 # Ensure __loader__ entry doesn't keep file open + if not sys.dont_write_bytecode: + if verbose: print "Running from compiled:", mod_name + d2 = run_module(mod_name) # Read from bytecode + self.assertIn("x", d2) + self.assertTrue(d2["x"] == 1) + del d2 # Ensure __loader__ entry doesn't keep file open finally: self._del_pkg(pkg_dir, depth, mod_name) if verbose: print "Module executed successfully" @@ -192,11 +193,12 @@ del d1 # Ensure __loader__ entry doesn't keep file open __import__(mod_name) os.remove(mod_fname) - if verbose: print "Running from compiled:", pkg_name - d2 = run_module(pkg_name) # Read from bytecode - self.assertIn("x", d2) - self.assertTrue(d2["x"] == 1) - del d2 # Ensure __loader__ entry doesn't keep file open + if not sys.dont_write_bytecode: + if verbose: print "Running from compiled:", pkg_name + d2 = run_module(pkg_name) # Read from bytecode + self.assertIn("x", d2) + self.assertTrue(d2["x"] == 1) + del d2 # Ensure __loader__ entry doesn't keep file open finally: self._del_pkg(pkg_dir, depth, pkg_name) if verbose: print "Package executed successfully" @@ -246,13 +248,14 @@ del d1 # Ensure __loader__ entry doesn't keep file open __import__(mod_name) os.remove(mod_fname) - if verbose: print "Running from compiled:", mod_name - d2 = run_module(mod_name, run_name=run_name) # Read from bytecode - self.assertIn("__package__", d2) - self.assertTrue(d2["__package__"] == pkg_name) - self.assertIn("sibling", d2) - self.assertIn("nephew", d2) - del d2 # Ensure __loader__ entry doesn't keep file open + if not sys.dont_write_bytecode: + if verbose: print "Running from compiled:", mod_name + d2 = run_module(mod_name, run_name=run_name) # Read from bytecode + self.assertIn("__package__", d2) + self.assertTrue(d2["__package__"] == pkg_name) + self.assertIn("sibling", d2) + self.assertIn("nephew", d2) + del d2 # Ensure __loader__ entry doesn't keep file open finally: self._del_pkg(pkg_dir, depth, mod_name) if verbose: print "Module executed successfully" diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -818,6 +818,9 @@ Tests ----- +- Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set. + Initial patch by Thomas Wouters. + - Issue #17299: Add test coverage for cPickle with file objects and general IO objects. Original patch by Aman Shah. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 20:50:40 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 16 Mar 2013 20:50:40 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2311420=3A_merge_with_3=2E2=2E?= Message-ID: <3ZSvQm1C1vzRmf@mail.python.org> http://hg.python.org/cpython/rev/5aa5bebcd768 changeset: 82690:5aa5bebcd768 branch: 3.3 parent: 82685:c2be613f5ea6 parent: 82688:2370ae9ee052 user: Ezio Melotti date: Sat Mar 16 21:49:20 2013 +0200 summary: #11420: merge with 3.2. files: Lib/distutils/tests/test_bdist_dumb.py | 6 +- Lib/test/test_imp.py | 6 +- Lib/test/test_import.py | 13 ++ Lib/test/test_importlib/source/test_file_loader.py | 3 +- Lib/test/test_runpy.py | 54 +++++---- Misc/NEWS | 3 + 6 files changed, 54 insertions(+), 31 deletions(-) diff --git a/Lib/distutils/tests/test_bdist_dumb.py b/Lib/distutils/tests/test_bdist_dumb.py --- a/Lib/distutils/tests/test_bdist_dumb.py +++ b/Lib/distutils/tests/test_bdist_dumb.py @@ -88,9 +88,9 @@ fp.close() contents = sorted(os.path.basename(fn) for fn in contents) - wanted = ['foo-0.1-py%s.%s.egg-info' % sys.version_info[:2], - 'foo.%s.pyc' % imp.get_tag(), - 'foo.py'] + wanted = ['foo-0.1-py%s.%s.egg-info' % sys.version_info[:2], 'foo.py'] + if not sys.dont_write_bytecode: + wanted.append('foo.%s.pyc' % imp.get_tag()) self.assertEqual(contents, sorted(wanted)) def test_suite(): diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py --- a/Lib/test/test_imp.py +++ b/Lib/test/test_imp.py @@ -162,8 +162,10 @@ with warnings.catch_warnings(): warnings.simplefilter('ignore') - mod = imp.load_compiled( - temp_mod_name, imp.cache_from_source(temp_mod_name + '.py')) + if not sys.dont_write_bytecode: + mod = imp.load_compiled( + temp_mod_name, + imp.cache_from_source(temp_mod_name + '.py')) self.assertEqual(mod.a, 1) if not os.path.exists(test_package_name): diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -24,6 +24,10 @@ from test import script_helper +skip_if_dont_write_bytecode = unittest.skipIf( + sys.dont_write_bytecode, + "test meaningful only when writing bytecode") + def remove_files(name): for f in (name + ".py", name + ".pyc", @@ -120,6 +124,7 @@ finally: del sys.path[0] + @skip_if_dont_write_bytecode def test_bug7732(self): source = TESTFN + '.py' os.mkdir(source) @@ -230,6 +235,7 @@ remove_files(TESTFN) unload(TESTFN) + @skip_if_dont_write_bytecode def test_file_to_source(self): # check if __file__ points to the source file where available source = TESTFN + ".py" @@ -316,6 +322,7 @@ self.fail("fromlist must allow bogus names") + at skip_if_dont_write_bytecode class FilePermissionTests(unittest.TestCase): # tests for file mode on cached .pyc/.pyo files @@ -642,6 +649,7 @@ del sys.path[0] self._clean() + @skip_if_dont_write_bytecode def test_import_pyc_path(self): self.assertFalse(os.path.exists('__pycache__')) __import__(TESTFN) @@ -654,6 +662,7 @@ "test meaningful only on posix systems") @unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0, "due to varying filesystem permission semantics (issue #11956)") + @skip_if_dont_write_bytecode def test_unwritable_directory(self): # When the umask causes the new __pycache__ directory to be # unwritable, the import still succeeds but no .pyc file is written. @@ -663,6 +672,7 @@ self.assertFalse(os.path.exists(os.path.join( '__pycache__', '{}.{}.pyc'.format(TESTFN, self.tag)))) + @skip_if_dont_write_bytecode def test_missing_source(self): # With PEP 3147 cache layout, removing the source but leaving the pyc # file does not satisfy the import. @@ -673,6 +683,7 @@ forget(TESTFN) self.assertRaises(ImportError, __import__, TESTFN) + @skip_if_dont_write_bytecode def test_missing_source_legacy(self): # Like test_missing_source() except that for backward compatibility, # when the pyc file lives where the py file would have been (and named @@ -694,6 +705,7 @@ pyc_file = imp.cache_from_source(TESTFN + '.py') self.assertEqual(m.__cached__, os.path.join(os.curdir, pyc_file)) + @skip_if_dont_write_bytecode def test___cached___legacy_pyc(self): # Like test___cached__() except that for backward compatibility, # when the pyc file lives where the py file would have been (and named @@ -709,6 +721,7 @@ self.assertEqual(m.__cached__, os.path.join(os.curdir, os.path.relpath(pyc_file))) + @skip_if_dont_write_bytecode def test_package___cached__(self): # Like test___cached__ but for packages. def cleanup(): diff --git a/Lib/test/test_importlib/source/test_file_loader.py b/Lib/test/test_importlib/source/test_file_loader.py --- a/Lib/test/test_importlib/source/test_file_loader.py +++ b/Lib/test/test_importlib/source/test_file_loader.py @@ -159,7 +159,8 @@ finally: os.unlink(file_path) pycache = os.path.dirname(imp.cache_from_source(file_path)) - shutil.rmtree(pycache) + if os.path.exists(pycache): + shutil.rmtree(pycache) def test_timestamp_overflow(self): # When a modification timestamp is larger than 2**32, it should be diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py --- a/Lib/test/test_runpy.py +++ b/Lib/test/test_runpy.py @@ -258,12 +258,13 @@ importlib.invalidate_caches() __import__(mod_name) os.remove(mod_fname) - make_legacy_pyc(mod_fname) - unload(mod_name) # In case loader caches paths - importlib.invalidate_caches() - if verbose > 1: print("Running from compiled:", mod_name) - self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) - self.check_code_execution(create_ns, expected_ns) + if not sys.dont_write_bytecode: + make_legacy_pyc(mod_fname) + unload(mod_name) # In case loader caches paths + importlib.invalidate_caches() + if verbose > 1: print("Running from compiled:", mod_name) + self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) + self.check_code_execution(create_ns, expected_ns) finally: self._del_pkg(pkg_dir, depth, mod_name) if verbose > 1: print("Module executed successfully") @@ -293,12 +294,13 @@ importlib.invalidate_caches() __import__(mod_name) os.remove(mod_fname) - make_legacy_pyc(mod_fname) - unload(mod_name) # In case loader caches paths - if verbose > 1: print("Running from compiled:", pkg_name) - importlib.invalidate_caches() - self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) - self.check_code_execution(create_ns, expected_ns) + if not sys.dont_write_bytecode: + make_legacy_pyc(mod_fname) + unload(mod_name) # In case loader caches paths + if verbose > 1: print("Running from compiled:", pkg_name) + importlib.invalidate_caches() + self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) + self.check_code_execution(create_ns, expected_ns) finally: self._del_pkg(pkg_dir, depth, pkg_name) if verbose > 1: print("Package executed successfully") @@ -351,16 +353,17 @@ importlib.invalidate_caches() __import__(mod_name) os.remove(mod_fname) - make_legacy_pyc(mod_fname) - unload(mod_name) # In case the loader caches paths - if verbose > 1: print("Running from compiled:", mod_name) - importlib.invalidate_caches() - d2 = run_module(mod_name, run_name=run_name) # Read from bytecode - self.assertEqual(d2["__name__"], expected_name) - self.assertEqual(d2["__package__"], pkg_name) - self.assertIn("sibling", d2) - self.assertIn("nephew", d2) - del d2 # Ensure __loader__ entry doesn't keep file open + if not sys.dont_write_bytecode: + make_legacy_pyc(mod_fname) + unload(mod_name) # In case the loader caches paths + if verbose > 1: print("Running from compiled:", mod_name) + importlib.invalidate_caches() + d2 = run_module(mod_name, run_name=run_name) # Read from bytecode + self.assertEqual(d2["__name__"], expected_name) + self.assertEqual(d2["__package__"], pkg_name) + self.assertIn("sibling", d2) + self.assertIn("nephew", d2) + del d2 # Ensure __loader__ entry doesn't keep file open finally: self._del_pkg(pkg_dir, depth, mod_name) if verbose > 1: print("Module executed successfully") @@ -513,9 +516,10 @@ script_name = self._make_test_script(script_dir, mod_name) compiled_name = py_compile.compile(script_name, doraise=True) os.remove(script_name) - legacy_pyc = make_legacy_pyc(script_name) - self._check_script(script_dir, "", legacy_pyc, - script_dir) + if not sys.dont_write_bytecode: + legacy_pyc = make_legacy_pyc(script_name) + self._check_script(script_dir, "", legacy_pyc, + script_dir) def test_directory_error(self): with temp_dir() as script_dir: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -654,6 +654,9 @@ Tests ----- +- Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set. + Initial patch by Thomas Wouters. + - Issue #10652: make tcl/tk tests run after __all__ test, patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 20:50:41 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 16 Mar 2013 20:50:41 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzExNDIwOiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZSvQn5NTdzSLY@mail.python.org> http://hg.python.org/cpython/rev/0a15a58ac4a1 changeset: 82691:0a15a58ac4a1 parent: 82687:46cadd3955d0 parent: 82690:5aa5bebcd768 user: Ezio Melotti date: Sat Mar 16 21:50:04 2013 +0200 summary: #11420: merge with 3.3. files: Lib/distutils/tests/test_bdist_dumb.py | 6 +- Lib/test/test_imp.py | 6 +- Lib/test/test_import.py | 13 ++ Lib/test/test_importlib/source/test_file_loader.py | 3 +- Lib/test/test_runpy.py | 54 +++++---- Misc/NEWS | 3 + 6 files changed, 54 insertions(+), 31 deletions(-) diff --git a/Lib/distutils/tests/test_bdist_dumb.py b/Lib/distutils/tests/test_bdist_dumb.py --- a/Lib/distutils/tests/test_bdist_dumb.py +++ b/Lib/distutils/tests/test_bdist_dumb.py @@ -86,9 +86,9 @@ fp.close() contents = sorted(os.path.basename(fn) for fn in contents) - wanted = ['foo-0.1-py%s.%s.egg-info' % sys.version_info[:2], - 'foo.%s.pyc' % imp.get_tag(), - 'foo.py'] + wanted = ['foo-0.1-py%s.%s.egg-info' % sys.version_info[:2], 'foo.py'] + if not sys.dont_write_bytecode: + wanted.append('foo.%s.pyc' % imp.get_tag()) self.assertEqual(contents, sorted(wanted)) def test_suite(): diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py --- a/Lib/test/test_imp.py +++ b/Lib/test/test_imp.py @@ -162,8 +162,10 @@ with warnings.catch_warnings(): warnings.simplefilter('ignore') - mod = imp.load_compiled( - temp_mod_name, imp.cache_from_source(temp_mod_name + '.py')) + if not sys.dont_write_bytecode: + mod = imp.load_compiled( + temp_mod_name, + imp.cache_from_source(temp_mod_name + '.py')) self.assertEqual(mod.a, 1) if not os.path.exists(test_package_name): diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -24,6 +24,10 @@ from test import script_helper +skip_if_dont_write_bytecode = unittest.skipIf( + sys.dont_write_bytecode, + "test meaningful only when writing bytecode") + def remove_files(name): for f in (name + ".py", name + ".pyc", @@ -120,6 +124,7 @@ finally: del sys.path[0] + @skip_if_dont_write_bytecode def test_bug7732(self): source = TESTFN + '.py' os.mkdir(source) @@ -230,6 +235,7 @@ remove_files(TESTFN) unload(TESTFN) + @skip_if_dont_write_bytecode def test_file_to_source(self): # check if __file__ points to the source file where available source = TESTFN + ".py" @@ -316,6 +322,7 @@ self.fail("fromlist must allow bogus names") + at skip_if_dont_write_bytecode class FilePermissionTests(unittest.TestCase): # tests for file mode on cached .pyc/.pyo files @@ -642,6 +649,7 @@ del sys.path[0] self._clean() + @skip_if_dont_write_bytecode def test_import_pyc_path(self): self.assertFalse(os.path.exists('__pycache__')) __import__(TESTFN) @@ -654,6 +662,7 @@ "test meaningful only on posix systems") @unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0, "due to varying filesystem permission semantics (issue #11956)") + @skip_if_dont_write_bytecode def test_unwritable_directory(self): # When the umask causes the new __pycache__ directory to be # unwritable, the import still succeeds but no .pyc file is written. @@ -663,6 +672,7 @@ self.assertFalse(os.path.exists(os.path.join( '__pycache__', '{}.{}.pyc'.format(TESTFN, self.tag)))) + @skip_if_dont_write_bytecode def test_missing_source(self): # With PEP 3147 cache layout, removing the source but leaving the pyc # file does not satisfy the import. @@ -673,6 +683,7 @@ forget(TESTFN) self.assertRaises(ImportError, __import__, TESTFN) + @skip_if_dont_write_bytecode def test_missing_source_legacy(self): # Like test_missing_source() except that for backward compatibility, # when the pyc file lives where the py file would have been (and named @@ -694,6 +705,7 @@ pyc_file = imp.cache_from_source(TESTFN + '.py') self.assertEqual(m.__cached__, os.path.join(os.curdir, pyc_file)) + @skip_if_dont_write_bytecode def test___cached___legacy_pyc(self): # Like test___cached__() except that for backward compatibility, # when the pyc file lives where the py file would have been (and named @@ -709,6 +721,7 @@ self.assertEqual(m.__cached__, os.path.join(os.curdir, os.path.relpath(pyc_file))) + @skip_if_dont_write_bytecode def test_package___cached__(self): # Like test___cached__ but for packages. def cleanup(): diff --git a/Lib/test/test_importlib/source/test_file_loader.py b/Lib/test/test_importlib/source/test_file_loader.py --- a/Lib/test/test_importlib/source/test_file_loader.py +++ b/Lib/test/test_importlib/source/test_file_loader.py @@ -159,7 +159,8 @@ finally: os.unlink(file_path) pycache = os.path.dirname(imp.cache_from_source(file_path)) - shutil.rmtree(pycache) + if os.path.exists(pycache): + shutil.rmtree(pycache) def test_timestamp_overflow(self): # When a modification timestamp is larger than 2**32, it should be diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py --- a/Lib/test/test_runpy.py +++ b/Lib/test/test_runpy.py @@ -258,12 +258,13 @@ importlib.invalidate_caches() __import__(mod_name) os.remove(mod_fname) - make_legacy_pyc(mod_fname) - unload(mod_name) # In case loader caches paths - importlib.invalidate_caches() - if verbose > 1: print("Running from compiled:", mod_name) - self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) - self.check_code_execution(create_ns, expected_ns) + if not sys.dont_write_bytecode: + make_legacy_pyc(mod_fname) + unload(mod_name) # In case loader caches paths + importlib.invalidate_caches() + if verbose > 1: print("Running from compiled:", mod_name) + self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) + self.check_code_execution(create_ns, expected_ns) finally: self._del_pkg(pkg_dir, depth, mod_name) if verbose > 1: print("Module executed successfully") @@ -293,12 +294,13 @@ importlib.invalidate_caches() __import__(mod_name) os.remove(mod_fname) - make_legacy_pyc(mod_fname) - unload(mod_name) # In case loader caches paths - if verbose > 1: print("Running from compiled:", pkg_name) - importlib.invalidate_caches() - self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) - self.check_code_execution(create_ns, expected_ns) + if not sys.dont_write_bytecode: + make_legacy_pyc(mod_fname) + unload(mod_name) # In case loader caches paths + if verbose > 1: print("Running from compiled:", pkg_name) + importlib.invalidate_caches() + self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) + self.check_code_execution(create_ns, expected_ns) finally: self._del_pkg(pkg_dir, depth, pkg_name) if verbose > 1: print("Package executed successfully") @@ -351,16 +353,17 @@ importlib.invalidate_caches() __import__(mod_name) os.remove(mod_fname) - make_legacy_pyc(mod_fname) - unload(mod_name) # In case the loader caches paths - if verbose > 1: print("Running from compiled:", mod_name) - importlib.invalidate_caches() - d2 = run_module(mod_name, run_name=run_name) # Read from bytecode - self.assertEqual(d2["__name__"], expected_name) - self.assertEqual(d2["__package__"], pkg_name) - self.assertIn("sibling", d2) - self.assertIn("nephew", d2) - del d2 # Ensure __loader__ entry doesn't keep file open + if not sys.dont_write_bytecode: + make_legacy_pyc(mod_fname) + unload(mod_name) # In case the loader caches paths + if verbose > 1: print("Running from compiled:", mod_name) + importlib.invalidate_caches() + d2 = run_module(mod_name, run_name=run_name) # Read from bytecode + self.assertEqual(d2["__name__"], expected_name) + self.assertEqual(d2["__package__"], pkg_name) + self.assertIn("sibling", d2) + self.assertIn("nephew", d2) + del d2 # Ensure __loader__ entry doesn't keep file open finally: self._del_pkg(pkg_dir, depth, mod_name) if verbose > 1: print("Module executed successfully") @@ -513,9 +516,10 @@ script_name = self._make_test_script(script_dir, mod_name) compiled_name = py_compile.compile(script_name, doraise=True) os.remove(script_name) - legacy_pyc = make_legacy_pyc(script_name) - self._check_script(script_dir, "", legacy_pyc, - script_dir) + if not sys.dont_write_bytecode: + legacy_pyc = make_legacy_pyc(script_name) + self._check_script(script_dir, "", legacy_pyc, + script_dir) def test_directory_error(self): with temp_dir() as script_dir: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -935,6 +935,9 @@ Tests ----- +- Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set. + Initial patch by Thomas Wouters. + - Issue #10652: make tcl/tk tests run after __all__ test, patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 21:08:48 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 16 Mar 2013 21:08:48 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3NDE4?= =?utf-8?q?=3A_specify_that_buffer_sizes_are_bytes=2E?= Message-ID: <3ZSvqh11LfzS5n@mail.python.org> http://hg.python.org/cpython/rev/f334a0009586 changeset: 82692:f334a0009586 branch: 2.7 parent: 82670:274e68e2a5a6 user: Terry Jan Reedy date: Sat Mar 16 15:55:53 2013 -0400 summary: Issue #17418: specify that buffer sizes are bytes. files: Doc/library/functions.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -874,9 +874,9 @@ The optional *buffering* argument specifies the file's desired buffer size: 0 means unbuffered, 1 means line buffered, any other positive value means use a - buffer of (approximately) that size. A negative *buffering* means to use the - system default, which is usually line buffered for tty devices and fully - buffered for other files. If omitted, the system default is used. [#]_ + buffer of (approximately) that size (in bytes). A negative *buffering* means + to use the system default, which is usually line buffered for tty devices and + fully buffered for other files. If omitted, the system default is used. [#]_ Modes ``'r+'``, ``'w+'`` and ``'a+'`` open the file for updating (note that ``'w+'`` truncates the file). Append ``'b'`` to the mode to open the file in -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 21:08:49 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 16 Mar 2013 21:08:49 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3NDE4?= =?utf-8?q?=3A_specify_that_buffer_sizes_are_bytes_as_soon_as_possible=2E?= Message-ID: <3ZSvqj3zBfzSJb@mail.python.org> http://hg.python.org/cpython/rev/a9d54ba2370b changeset: 82693:a9d54ba2370b branch: 3.2 parent: 82681:cec135cb059c user: Terry Jan Reedy date: Sat Mar 16 15:56:27 2013 -0400 summary: Issue #17418: specify that buffer sizes are bytes as soon as possible. files: Doc/library/functions.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -868,8 +868,8 @@ *buffering* is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed in binary mode), 1 to select line buffering (only usable in text mode), and an integer > 1 to indicate the size - of a fixed-size chunk buffer. When no *buffering* argument is given, the - default buffering policy works as follows: + in bytes of a fixed-size chunk buffer. When no *buffering* argument is + given, the default buffering policy works as follows: * Binary files are buffered in fixed-size chunks; the size of the buffer is chosen using a heuristic trying to determine the underlying device's "block -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 21:08:50 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 16 Mar 2013 21:08:50 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_with_3=2E2?= Message-ID: <3ZSvqk6XVdzSKK@mail.python.org> http://hg.python.org/cpython/rev/4a749972bad6 changeset: 82694:4a749972bad6 branch: 3.3 parent: 82685:c2be613f5ea6 parent: 82693:a9d54ba2370b user: Terry Jan Reedy date: Sat Mar 16 15:56:50 2013 -0400 summary: Merge with 3.2 files: Doc/library/functions.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -876,8 +876,8 @@ *buffering* is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed in binary mode), 1 to select line buffering (only usable in text mode), and an integer > 1 to indicate the size - of a fixed-size chunk buffer. When no *buffering* argument is given, the - default buffering policy works as follows: + in bytes of a fixed-size chunk buffer. When no *buffering* argument is + given, the default buffering policy works as follows: * Binary files are buffered in fixed-size chunks; the size of the buffer is chosen using a heuristic trying to determine the underlying device's "block -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 21:08:52 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 16 Mar 2013 21:08:52 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E3?= Message-ID: <3ZSvqm22wZzSHn@mail.python.org> http://hg.python.org/cpython/rev/533a60251b9d changeset: 82695:533a60251b9d parent: 82687:46cadd3955d0 parent: 82694:4a749972bad6 user: Terry Jan Reedy date: Sat Mar 16 15:57:27 2013 -0400 summary: Merge with 3.3 files: Doc/library/functions.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -886,8 +886,8 @@ *buffering* is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed in binary mode), 1 to select line buffering (only usable in text mode), and an integer > 1 to indicate the size - of a fixed-size chunk buffer. When no *buffering* argument is given, the - default buffering policy works as follows: + in bytes of a fixed-size chunk buffer. When no *buffering* argument is + given, the default buffering policy works as follows: * Binary files are buffered in fixed-size chunks; the size of the buffer is chosen using a heuristic trying to determine the underlying device's "block -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 21:08:53 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 16 Mar 2013 21:08:53 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_Merge_heads=2E?= Message-ID: <3ZSvqn4k7szSMT@mail.python.org> http://hg.python.org/cpython/rev/c76c6fd48449 changeset: 82696:c76c6fd48449 branch: 2.7 parent: 82689:c70746a0291f parent: 82692:f334a0009586 user: Terry Jan Reedy date: Sat Mar 16 16:03:37 2013 -0400 summary: Merge heads. files: Doc/library/functions.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -874,9 +874,9 @@ The optional *buffering* argument specifies the file's desired buffer size: 0 means unbuffered, 1 means line buffered, any other positive value means use a - buffer of (approximately) that size. A negative *buffering* means to use the - system default, which is usually line buffered for tty devices and fully - buffered for other files. If omitted, the system default is used. [#]_ + buffer of (approximately) that size (in bytes). A negative *buffering* means + to use the system default, which is usually line buffered for tty devices and + fully buffered for other files. If omitted, the system default is used. [#]_ Modes ``'r+'``, ``'w+'`` and ``'a+'`` open the file for updating (note that ``'w+'`` truncates the file). Append ``'b'`` to the mode to open the file in -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 21:08:55 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 16 Mar 2013 21:08:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMik6?= =?utf-8?q?_Merge_heads_3=2E2=2E?= Message-ID: <3ZSvqq0KPkzSKK@mail.python.org> http://hg.python.org/cpython/rev/5d26de06fc38 changeset: 82697:5d26de06fc38 branch: 3.2 parent: 82688:2370ae9ee052 parent: 82693:a9d54ba2370b user: Terry Jan Reedy date: Sat Mar 16 16:05:27 2013 -0400 summary: Merge heads 3.2. files: Doc/library/functions.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -868,8 +868,8 @@ *buffering* is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed in binary mode), 1 to select line buffering (only usable in text mode), and an integer > 1 to indicate the size - of a fixed-size chunk buffer. When no *buffering* argument is given, the - default buffering policy works as follows: + in bytes of a fixed-size chunk buffer. When no *buffering* argument is + given, the default buffering policy works as follows: * Binary files are buffered in fixed-size chunks; the size of the buffer is chosen using a heuristic trying to determine the underlying device's "block -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 21:08:56 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 16 Mar 2013 21:08:56 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4zIC0+IDMuMyk6?= =?utf-8?q?_Merge_heads_3=2E3=2E?= Message-ID: <3ZSvqr35YZzSJq@mail.python.org> http://hg.python.org/cpython/rev/acf28780a4ca changeset: 82698:acf28780a4ca branch: 3.3 parent: 82690:5aa5bebcd768 parent: 82694:4a749972bad6 user: Terry Jan Reedy date: Sat Mar 16 16:06:52 2013 -0400 summary: Merge heads 3.3. files: Doc/library/functions.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -876,8 +876,8 @@ *buffering* is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed in binary mode), 1 to select line buffering (only usable in text mode), and an integer > 1 to indicate the size - of a fixed-size chunk buffer. When no *buffering* argument is given, the - default buffering policy works as follows: + in bytes of a fixed-size chunk buffer. When no *buffering* argument is + given, the default buffering policy works as follows: * Binary files are buffered in fixed-size chunks; the size of the buffer is chosen using a heuristic trying to determine the underlying device's "block -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 21:08:57 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 16 Mar 2013 21:08:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_Merge_heads_default=2E?= Message-ID: <3ZSvqs5jdLzSMT@mail.python.org> http://hg.python.org/cpython/rev/9a2f4418e65a changeset: 82699:9a2f4418e65a parent: 82691:0a15a58ac4a1 parent: 82695:533a60251b9d user: Terry Jan Reedy date: Sat Mar 16 16:08:12 2013 -0400 summary: Merge heads default. files: Doc/library/functions.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -886,8 +886,8 @@ *buffering* is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed in binary mode), 1 to select line buffering (only usable in text mode), and an integer > 1 to indicate the size - of a fixed-size chunk buffer. When no *buffering* argument is given, the - default buffering policy works as follows: + in bytes of a fixed-size chunk buffer. When no *buffering* argument is + given, the default buffering policy works as follows: * Binary files are buffered in fixed-size chunks; the size of the buffer is chosen using a heuristic trying to determine the underlying device's "block -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 21:23:43 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 16 Mar 2013 21:23:43 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_markup/wording=2E?= Message-ID: <3ZSw8v1LHDzS8R@mail.python.org> http://hg.python.org/cpython/rev/9a56825dd2f5 changeset: 82700:9a56825dd2f5 user: Ezio Melotti date: Sat Mar 16 22:23:30 2013 +0200 summary: Fix markup/wording. files: Doc/library/http.server.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst --- a/Doc/library/http.server.rst +++ b/Doc/library/http.server.rst @@ -181,7 +181,7 @@ .. versionchanged:: 3.4 The error response includes a Content-Length header. - explain argument was added. + Added the *explain* argument. .. method:: send_response(code, message=None) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 21:51:25 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 16 Mar 2013 21:51:25 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Null_merge?= Message-ID: <3ZSwms0bRLzPHc@mail.python.org> http://hg.python.org/cpython/rev/858fa8b5d5d4 changeset: 82701:858fa8b5d5d4 branch: 3.3 parent: 82698:acf28780a4ca parent: 82697:5d26de06fc38 user: Serhiy Storchaka date: Sat Mar 16 22:50:13 2013 +0200 summary: Null merge files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 21:51:26 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 16 Mar 2013 21:51:26 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Null_merge?= Message-ID: <3ZSwmt2vkYzPHc@mail.python.org> http://hg.python.org/cpython/rev/5da005db8166 changeset: 82702:5da005db8166 parent: 82700:9a56825dd2f5 parent: 82701:858fa8b5d5d4 user: Serhiy Storchaka date: Sat Mar 16 22:50:30 2013 +0200 summary: Null merge files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 21:56:37 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 16 Mar 2013 21:56:37 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE2NTY0?= =?utf-8?q?=3A_Fixed_a_performance_regression_relative_to_Python_3=2E1_in_?= =?utf-8?q?the?= Message-ID: <3ZSwts6w85zM8H@mail.python.org> http://hg.python.org/cpython/rev/14fe7a98b89c changeset: 82703:14fe7a98b89c branch: 3.2 parent: 82697:5d26de06fc38 user: Serhiy Storchaka date: Sat Mar 16 22:52:09 2013 +0200 summary: Issue #16564: Fixed a performance regression relative to Python 3.1 in the caching of compiled regular expressions. files: Lib/re.py | 34 +++++++++++++++++++++++++--------- Misc/NEWS | 3 +++ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Lib/re.py b/Lib/re.py --- a/Lib/re.py +++ b/Lib/re.py @@ -215,8 +215,8 @@ def purge(): "Clear the regular expression caches" - _compile_typed.cache_clear() - _compile_repl.cache_clear() + _cache.clear() + _cache_repl.clear() def template(pattern, flags=0): "Compile a template pattern, returning a pattern object" @@ -257,14 +257,19 @@ # -------------------------------------------------------------------- # internals +_cache = {} +_cache_repl = {} + _pattern_type = type(sre_compile.compile("", 0)) +_MAXCACHE = 512 + def _compile(pattern, flags): - return _compile_typed(type(pattern), pattern, flags) - - at functools.lru_cache(maxsize=500) -def _compile_typed(text_bytes_type, pattern, flags): # internal: compile pattern + try: + return _cache[type(pattern), pattern, flags] + except KeyError: + pass if isinstance(pattern, _pattern_type): if flags: raise ValueError( @@ -272,12 +277,23 @@ return pattern if not sre_compile.isstring(pattern): raise TypeError("first argument must be string or compiled pattern") - return sre_compile.compile(pattern, flags) + p = sre_compile.compile(pattern, flags) + if len(_cache) >= _MAXCACHE: + _cache.clear() + _cache[type(pattern), pattern, flags] = p + return p - at functools.lru_cache(maxsize=500) def _compile_repl(repl, pattern): # internal: compile replacement pattern - return sre_parse.parse_template(repl, pattern) + try: + return _cache_repl[repl, pattern] + except KeyError: + pass + p = sre_parse.parse_template(repl, pattern) + if len(_cache_repl) >= _MAXCACHE: + _cache_repl.clear() + _cache_repl[repl, pattern] = p + return p def _expand(pattern, match, template): # internal: match.expand implementation hook diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,6 +233,9 @@ Library ------- +- Issue #16564: Fixed a performance regression relative to Python 3.1 in the + caching of compiled regular expressions. + - Issue #17431: Fix missing import of BytesFeedParser in email.parser. - Issue #1285086: Get rid of the refcounting hack and speed up -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 21:56:39 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 16 Mar 2013 21:56:39 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Issue_=2316564=3A_Fixed_a_performance_regression_relative_to_P?= =?utf-8?q?ython_3=2E1_in_the?= Message-ID: <3ZSwtv2Lh3zSHZ@mail.python.org> http://hg.python.org/cpython/rev/4b4dddd670d0 changeset: 82704:4b4dddd670d0 branch: 3.3 parent: 82701:858fa8b5d5d4 parent: 82703:14fe7a98b89c user: Serhiy Storchaka date: Sat Mar 16 22:53:48 2013 +0200 summary: Issue #16564: Fixed a performance regression relative to Python 3.1 in the caching of compiled regular expressions. files: Lib/re.py | 30 ++++++++++++++++++++++++------ Misc/NEWS | 3 +++ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Lib/re.py b/Lib/re.py --- a/Lib/re.py +++ b/Lib/re.py @@ -215,8 +215,8 @@ def purge(): "Clear the regular expression caches" - _compile.cache_clear() - _compile_repl.cache_clear() + _cache.clear() + _cache_repl.clear() def template(pattern, flags=0): "Compile a template pattern, returning a pattern object" @@ -259,11 +259,18 @@ # -------------------------------------------------------------------- # internals +_cache = {} +_cache_repl = {} + _pattern_type = type(sre_compile.compile("", 0)) - at functools.lru_cache(maxsize=512, typed=True) +_MAXCACHE = 512 def _compile(pattern, flags): # internal: compile pattern + try: + return _cache[type(pattern), pattern, flags] + except KeyError: + pass if isinstance(pattern, _pattern_type): if flags: raise ValueError( @@ -271,12 +278,23 @@ return pattern if not sre_compile.isstring(pattern): raise TypeError("first argument must be string or compiled pattern") - return sre_compile.compile(pattern, flags) + p = sre_compile.compile(pattern, flags) + if len(_cache) >= _MAXCACHE: + _cache.clear() + _cache[type(pattern), pattern, flags] = p + return p - at functools.lru_cache(maxsize=512) def _compile_repl(repl, pattern): # internal: compile replacement pattern - return sre_parse.parse_template(repl, pattern) + try: + return _cache_repl[repl, pattern] + except KeyError: + pass + p = sre_parse.parse_template(repl, pattern) + if len(_cache_repl) >= _MAXCACHE: + _cache_repl.clear() + _cache_repl[repl, pattern] = p + return p def _expand(pattern, match, template): # internal: match.expand implementation hook diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -193,6 +193,9 @@ Library ------- +- Issue #16564: Fixed a performance regression relative to Python 3.1 in the + caching of compiled regular expressions. + - Issue #17431: Fix missing import of BytesFeedParser in email.parser. - Issue #1285086: Get rid of the refcounting hack and speed up -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 21:56:40 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 16 Mar 2013 21:56:40 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2316564=3A_Fixed_a_performance_regression_relativ?= =?utf-8?q?e_to_Python_3=2E1_in_the?= Message-ID: <3ZSwtw5FJHzSJq@mail.python.org> http://hg.python.org/cpython/rev/9d458ded8304 changeset: 82705:9d458ded8304 parent: 82702:5da005db8166 parent: 82704:4b4dddd670d0 user: Serhiy Storchaka date: Sat Mar 16 22:55:04 2013 +0200 summary: Issue #16564: Fixed a performance regression relative to Python 3.1 in the caching of compiled regular expressions. files: Lib/re.py | 30 ++++++++++++++++++++++++------ Misc/NEWS | 3 +++ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Lib/re.py b/Lib/re.py --- a/Lib/re.py +++ b/Lib/re.py @@ -215,8 +215,8 @@ def purge(): "Clear the regular expression caches" - _compile.cache_clear() - _compile_repl.cache_clear() + _cache.clear() + _cache_repl.clear() def template(pattern, flags=0): "Compile a template pattern, returning a pattern object" @@ -259,11 +259,18 @@ # -------------------------------------------------------------------- # internals +_cache = {} +_cache_repl = {} + _pattern_type = type(sre_compile.compile("", 0)) - at functools.lru_cache(maxsize=512, typed=True) +_MAXCACHE = 512 def _compile(pattern, flags): # internal: compile pattern + try: + return _cache[type(pattern), pattern, flags] + except KeyError: + pass if isinstance(pattern, _pattern_type): if flags: raise ValueError( @@ -271,12 +278,23 @@ return pattern if not sre_compile.isstring(pattern): raise TypeError("first argument must be string or compiled pattern") - return sre_compile.compile(pattern, flags) + p = sre_compile.compile(pattern, flags) + if len(_cache) >= _MAXCACHE: + _cache.clear() + _cache[type(pattern), pattern, flags] = p + return p - at functools.lru_cache(maxsize=512) def _compile_repl(repl, pattern): # internal: compile replacement pattern - return sre_parse.parse_template(repl, pattern) + try: + return _cache_repl[repl, pattern] + except KeyError: + pass + p = sre_parse.parse_template(repl, pattern) + if len(_cache_repl) >= _MAXCACHE: + _cache_repl.clear() + _cache_repl[repl, pattern] = p + return p def _expand(pattern, match, template): # internal: match.expand implementation hook diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -283,6 +283,9 @@ Library ------- +- Issue #16564: Fixed a performance regression relative to Python 3.1 in the + caching of compiled regular expressions. + - Added missing FeedParser and BytesFeedParser to email.parser.__all__. - Issue #17431: Fix missing import of BytesFeedParser in email.parser. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 22:01:52 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 16 Mar 2013 22:01:52 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE2Mzg5?= =?utf-8?q?=3A_Fixed_an_issue_number_in_previos_commit=2E?= Message-ID: <3ZSx0w4CDTzR6L@mail.python.org> http://hg.python.org/cpython/rev/6951d7b8d3ad changeset: 82706:6951d7b8d3ad branch: 3.2 parent: 82703:14fe7a98b89c user: Serhiy Storchaka date: Sat Mar 16 22:59:27 2013 +0200 summary: Issue #16389: Fixed an issue number in previos commit. files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,7 +233,7 @@ Library ------- -- Issue #16564: Fixed a performance regression relative to Python 3.1 in the +- Issue #16389: Fixed a performance regression relative to Python 3.1 in the caching of compiled regular expressions. - Issue #17431: Fix missing import of BytesFeedParser in email.parser. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 22:01:54 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 16 Mar 2013 22:01:54 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Issue_=2316389=3A_Fixed_an_issue_number_in_previos_commit=2E?= Message-ID: <3ZSx0y0wqlzSCQ@mail.python.org> http://hg.python.org/cpython/rev/7b737011d822 changeset: 82707:7b737011d822 branch: 3.3 parent: 82704:4b4dddd670d0 parent: 82706:6951d7b8d3ad user: Serhiy Storchaka date: Sat Mar 16 22:59:59 2013 +0200 summary: Issue #16389: Fixed an issue number in previos commit. files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -193,7 +193,7 @@ Library ------- -- Issue #16564: Fixed a performance regression relative to Python 3.1 in the +- Issue #16389: Fixed a performance regression relative to Python 3.1 in the caching of compiled regular expressions. - Issue #17431: Fix missing import of BytesFeedParser in email.parser. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 22:01:55 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 16 Mar 2013 22:01:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2316389=3A_Fixed_an_issue_number_in_previos_commi?= =?utf-8?q?t=2E?= Message-ID: <3ZSx0z40z7zSJK@mail.python.org> http://hg.python.org/cpython/rev/6898e1afc216 changeset: 82708:6898e1afc216 parent: 82705:9d458ded8304 parent: 82707:7b737011d822 user: Serhiy Storchaka date: Sat Mar 16 23:00:16 2013 +0200 summary: Issue #16389: Fixed an issue number in previos commit. files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -283,7 +283,7 @@ Library ------- -- Issue #16564: Fixed a performance regression relative to Python 3.1 in the +- Issue #16389: Fixed a performance regression relative to Python 3.1 in the caching of compiled regular expressions. - Added missing FeedParser and BytesFeedParser to email.parser.__all__. -- Repository URL: http://hg.python.org/cpython From tjreedy at udel.edu Sat Mar 16 22:03:14 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Sat, 16 Mar 2013 17:03:14 -0400 Subject: [Python-checkins] cpython (merge 3.2 -> 3.3): Null merge In-Reply-To: <3ZSwms0bRLzPHc@mail.python.org> References: <3ZSwms0bRLzPHc@mail.python.org> Message-ID: <5144DE12.5030901@udel.edu> My apologies for not doing these immediately. I was in the process of doing them when I checked and found you had already done them. On 3/16/2013 4:51 PM, serhiy.storchaka wrote: > http://hg.python.org/cpython/rev/858fa8b5d5d4 > changeset: 82701:858fa8b5d5d4 > branch: 3.3 > parent: 82698:acf28780a4ca > parent: 82697:5d26de06fc38 > user: Serhiy Storchaka > date: Sat Mar 16 22:50:13 2013 +0200 > summary: > Null merge From ezio.melotti at gmail.com Sat Mar 16 22:09:08 2013 From: ezio.melotti at gmail.com (Ezio Melotti) Date: Sat, 16 Mar 2013 23:09:08 +0200 Subject: [Python-checkins] cpython (merge default -> default): Merge heads default. In-Reply-To: <3ZSvqs5jdLzSMT@mail.python.org> References: <3ZSvqs5jdLzSMT@mail.python.org> Message-ID: Hi, On Sat, Mar 16, 2013 at 10:08 PM, terry.reedy wrote: > http://hg.python.org/cpython/rev/9a2f4418e65a > changeset: 82699:9a2f4418e65a > parent: 82691:0a15a58ac4a1 > parent: 82695:533a60251b9d > user: Terry Jan Reedy > date: Sat Mar 16 16:08:12 2013 -0400 > summary: > Merge heads default. > > files: > Doc/library/functions.rst | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > You forgot a couple of merges here. If you look at the graph at http://hg.python.org/cpython/graph/9a2f4418e65a you will see that all the heads in the individual branches got merged, but then you forgot to merge 3.2 -> 3.3 -> default (i.e. steps 5 and 6 of http://bugs.python.org/issue14468#msg184130). Serhiy fixed that shortly after: http://hg.python.org/cpython/graph/5da005db8166 At least now that the worst case scenario that doesn't really happen often?[0] happened I can point to some actual graphs that will hopefully clarify why all these merges are necessary :) Best Regards, Ezio Melotti [0]: http://bugs.python.org/issue14468#msg184140 From tjreedy at udel.edu Sat Mar 16 22:48:03 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Sat, 16 Mar 2013 17:48:03 -0400 Subject: [Python-checkins] cpython (merge default -> default): Merge heads default. In-Reply-To: References: <3ZSvqs5jdLzSMT@mail.python.org> Message-ID: <5144E893.2070405@udel.edu> > You forgot a couple of merges here. Yep. I forgot and also did not re-read *all* the faq, pushed, and then remembered. Fortunately, after starting the 3.2 to 3.3 merge, I remembered to pull again before committing (and I was able to undo the local merge-in-progress). > If you look at the graph at > http://hg.python.org/cpython/graph/9a2f4418e65a you will see that all > the heads in the individual branches got merged, but then you forgot > to merge 3.2 -> 3.3 -> default (i.e. steps 5 and 6 of > http://bugs.python.org/issue14468#msg184130). Serhiy fixed that > shortly after: http://hg.python.org/cpython/graph/5da005db8166 The FAQ says "... using hg merge 3.3 as usual." Serhiy's commit message said 'Null merge', which to me is not 'as usual', as there are extra steps given in the FAQ above. So, do he really do a 'null merge' and is that the right thing to do in this situation? I have no doubt the the extra merges are needed ;-). From tjreedy at udel.edu Sat Mar 16 22:51:08 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Sat, 16 Mar 2013 17:51:08 -0400 Subject: [Python-checkins] cpython (3.2): Issue #16389: Fixed an issue number in previos commit. In-Reply-To: <3ZSx0w4CDTzR6L@mail.python.org> References: <3ZSx0w4CDTzR6L@mail.python.org> Message-ID: <5144E94C.8090008@udel.edu> On 3/16/2013 5:01 PM, serhiy.storchaka wrote: > -- Issue #16564: Fixed a performance regression relative to Python 3.1 in the > +- Issue #16389: Fixed a performance regression relative to Python 3.1 in the > caching of compiled regular expressions. In #16564, I unlinked the mis-addressed commit message. From ezio.melotti at gmail.com Sat Mar 16 23:02:35 2013 From: ezio.melotti at gmail.com (Ezio Melotti) Date: Sun, 17 Mar 2013 00:02:35 +0200 Subject: [Python-checkins] cpython (merge default -> default): Merge heads default. In-Reply-To: <5144E893.2070405@udel.edu> References: <3ZSvqs5jdLzSMT@mail.python.org> <5144E893.2070405@udel.edu> Message-ID: On Sat, Mar 16, 2013 at 11:48 PM, Terry Reedy wrote: > The FAQ says "... using hg merge 3.3 as usual." Serhiy's commit message > said 'Null merge', which to me is not 'as usual', as there are extra steps > given in the FAQ above. So, do he really do a 'null merge' and is that the > right thing to do in this situation? > It's probably just a matter of terminology. I assume he did a "usual merge" (i.e. "hg merge 3.2; hg ci -m '...';") and call it "null merge" because there was no code that changed. I prefer to use the term "null merge" when I explicitly revert the code before committing, and in this case I would have used "Merge with 3.x.". FWIW I might add http://bugs.python.org/issue15917 at some point, to prevent these situations. Best Regards, Ezio Melotti > I have no doubt the the extra merges are needed ;-). From python-checkins at python.org Sat Mar 16 23:39:55 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 16 Mar 2013 23:39:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_C89_compliance?= Message-ID: <3ZSzB32f2ZzSBv@mail.python.org> http://hg.python.org/cpython/rev/0e253370863f changeset: 82709:0e253370863f parent: 82687:46cadd3955d0 user: Benjamin Peterson date: Sat Mar 16 15:38:28 2013 -0700 summary: C89 compliance files: Python/future.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Python/future.c b/Python/future.c --- a/Python/future.c +++ b/Python/future.c @@ -59,6 +59,7 @@ future_parse(PyFutureFeatures *ff, mod_ty mod, const char *filename) { int i, done = 0, prev_line = 0; + stmt_ty first; if (!(mod->kind == Module_kind || mod->kind == Interactive_kind)) return 1; @@ -75,7 +76,7 @@ */ i = 0; - stmt_ty first = (stmt_ty)asdl_seq_GET(mod->v.Module.body, i); + first = (stmt_ty)asdl_seq_GET(mod->v.Module.body, i); if (first->kind == Expr_kind && first->v.Expr.value->kind == Str_kind) i++; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 16 23:39:57 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 16 Mar 2013 23:39:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_merge_heads?= Message-ID: <3ZSzB51K37zSGL@mail.python.org> http://hg.python.org/cpython/rev/8002f45377d4 changeset: 82710:8002f45377d4 parent: 82709:0e253370863f parent: 82708:6898e1afc216 user: Benjamin Peterson date: Sat Mar 16 15:39:42 2013 -0700 summary: merge heads files: Doc/library/functions.rst | 4 +- Doc/library/http.server.rst | 2 +- Lib/distutils/tests/test_bdist_dumb.py | 6 +- Lib/re.py | 30 ++++- Lib/test/test_imp.py | 6 +- Lib/test/test_import.py | 13 ++ Lib/test/test_importlib/source/test_file_loader.py | 3 +- Lib/test/test_runpy.py | 54 +++++---- Misc/NEWS | 6 + 9 files changed, 84 insertions(+), 40 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -886,8 +886,8 @@ *buffering* is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed in binary mode), 1 to select line buffering (only usable in text mode), and an integer > 1 to indicate the size - of a fixed-size chunk buffer. When no *buffering* argument is given, the - default buffering policy works as follows: + in bytes of a fixed-size chunk buffer. When no *buffering* argument is + given, the default buffering policy works as follows: * Binary files are buffered in fixed-size chunks; the size of the buffer is chosen using a heuristic trying to determine the underlying device's "block diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst --- a/Doc/library/http.server.rst +++ b/Doc/library/http.server.rst @@ -181,7 +181,7 @@ .. versionchanged:: 3.4 The error response includes a Content-Length header. - explain argument was added. + Added the *explain* argument. .. method:: send_response(code, message=None) diff --git a/Lib/distutils/tests/test_bdist_dumb.py b/Lib/distutils/tests/test_bdist_dumb.py --- a/Lib/distutils/tests/test_bdist_dumb.py +++ b/Lib/distutils/tests/test_bdist_dumb.py @@ -86,9 +86,9 @@ fp.close() contents = sorted(os.path.basename(fn) for fn in contents) - wanted = ['foo-0.1-py%s.%s.egg-info' % sys.version_info[:2], - 'foo.%s.pyc' % imp.get_tag(), - 'foo.py'] + wanted = ['foo-0.1-py%s.%s.egg-info' % sys.version_info[:2], 'foo.py'] + if not sys.dont_write_bytecode: + wanted.append('foo.%s.pyc' % imp.get_tag()) self.assertEqual(contents, sorted(wanted)) def test_suite(): diff --git a/Lib/re.py b/Lib/re.py --- a/Lib/re.py +++ b/Lib/re.py @@ -215,8 +215,8 @@ def purge(): "Clear the regular expression caches" - _compile.cache_clear() - _compile_repl.cache_clear() + _cache.clear() + _cache_repl.clear() def template(pattern, flags=0): "Compile a template pattern, returning a pattern object" @@ -259,11 +259,18 @@ # -------------------------------------------------------------------- # internals +_cache = {} +_cache_repl = {} + _pattern_type = type(sre_compile.compile("", 0)) - at functools.lru_cache(maxsize=512, typed=True) +_MAXCACHE = 512 def _compile(pattern, flags): # internal: compile pattern + try: + return _cache[type(pattern), pattern, flags] + except KeyError: + pass if isinstance(pattern, _pattern_type): if flags: raise ValueError( @@ -271,12 +278,23 @@ return pattern if not sre_compile.isstring(pattern): raise TypeError("first argument must be string or compiled pattern") - return sre_compile.compile(pattern, flags) + p = sre_compile.compile(pattern, flags) + if len(_cache) >= _MAXCACHE: + _cache.clear() + _cache[type(pattern), pattern, flags] = p + return p - at functools.lru_cache(maxsize=512) def _compile_repl(repl, pattern): # internal: compile replacement pattern - return sre_parse.parse_template(repl, pattern) + try: + return _cache_repl[repl, pattern] + except KeyError: + pass + p = sre_parse.parse_template(repl, pattern) + if len(_cache_repl) >= _MAXCACHE: + _cache_repl.clear() + _cache_repl[repl, pattern] = p + return p def _expand(pattern, match, template): # internal: match.expand implementation hook diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py --- a/Lib/test/test_imp.py +++ b/Lib/test/test_imp.py @@ -162,8 +162,10 @@ with warnings.catch_warnings(): warnings.simplefilter('ignore') - mod = imp.load_compiled( - temp_mod_name, imp.cache_from_source(temp_mod_name + '.py')) + if not sys.dont_write_bytecode: + mod = imp.load_compiled( + temp_mod_name, + imp.cache_from_source(temp_mod_name + '.py')) self.assertEqual(mod.a, 1) if not os.path.exists(test_package_name): diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -24,6 +24,10 @@ from test import script_helper +skip_if_dont_write_bytecode = unittest.skipIf( + sys.dont_write_bytecode, + "test meaningful only when writing bytecode") + def remove_files(name): for f in (name + ".py", name + ".pyc", @@ -120,6 +124,7 @@ finally: del sys.path[0] + @skip_if_dont_write_bytecode def test_bug7732(self): source = TESTFN + '.py' os.mkdir(source) @@ -230,6 +235,7 @@ remove_files(TESTFN) unload(TESTFN) + @skip_if_dont_write_bytecode def test_file_to_source(self): # check if __file__ points to the source file where available source = TESTFN + ".py" @@ -316,6 +322,7 @@ self.fail("fromlist must allow bogus names") + at skip_if_dont_write_bytecode class FilePermissionTests(unittest.TestCase): # tests for file mode on cached .pyc/.pyo files @@ -642,6 +649,7 @@ del sys.path[0] self._clean() + @skip_if_dont_write_bytecode def test_import_pyc_path(self): self.assertFalse(os.path.exists('__pycache__')) __import__(TESTFN) @@ -654,6 +662,7 @@ "test meaningful only on posix systems") @unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0, "due to varying filesystem permission semantics (issue #11956)") + @skip_if_dont_write_bytecode def test_unwritable_directory(self): # When the umask causes the new __pycache__ directory to be # unwritable, the import still succeeds but no .pyc file is written. @@ -663,6 +672,7 @@ self.assertFalse(os.path.exists(os.path.join( '__pycache__', '{}.{}.pyc'.format(TESTFN, self.tag)))) + @skip_if_dont_write_bytecode def test_missing_source(self): # With PEP 3147 cache layout, removing the source but leaving the pyc # file does not satisfy the import. @@ -673,6 +683,7 @@ forget(TESTFN) self.assertRaises(ImportError, __import__, TESTFN) + @skip_if_dont_write_bytecode def test_missing_source_legacy(self): # Like test_missing_source() except that for backward compatibility, # when the pyc file lives where the py file would have been (and named @@ -694,6 +705,7 @@ pyc_file = imp.cache_from_source(TESTFN + '.py') self.assertEqual(m.__cached__, os.path.join(os.curdir, pyc_file)) + @skip_if_dont_write_bytecode def test___cached___legacy_pyc(self): # Like test___cached__() except that for backward compatibility, # when the pyc file lives where the py file would have been (and named @@ -709,6 +721,7 @@ self.assertEqual(m.__cached__, os.path.join(os.curdir, os.path.relpath(pyc_file))) + @skip_if_dont_write_bytecode def test_package___cached__(self): # Like test___cached__ but for packages. def cleanup(): diff --git a/Lib/test/test_importlib/source/test_file_loader.py b/Lib/test/test_importlib/source/test_file_loader.py --- a/Lib/test/test_importlib/source/test_file_loader.py +++ b/Lib/test/test_importlib/source/test_file_loader.py @@ -159,7 +159,8 @@ finally: os.unlink(file_path) pycache = os.path.dirname(imp.cache_from_source(file_path)) - shutil.rmtree(pycache) + if os.path.exists(pycache): + shutil.rmtree(pycache) def test_timestamp_overflow(self): # When a modification timestamp is larger than 2**32, it should be diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py --- a/Lib/test/test_runpy.py +++ b/Lib/test/test_runpy.py @@ -258,12 +258,13 @@ importlib.invalidate_caches() __import__(mod_name) os.remove(mod_fname) - make_legacy_pyc(mod_fname) - unload(mod_name) # In case loader caches paths - importlib.invalidate_caches() - if verbose > 1: print("Running from compiled:", mod_name) - self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) - self.check_code_execution(create_ns, expected_ns) + if not sys.dont_write_bytecode: + make_legacy_pyc(mod_fname) + unload(mod_name) # In case loader caches paths + importlib.invalidate_caches() + if verbose > 1: print("Running from compiled:", mod_name) + self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) + self.check_code_execution(create_ns, expected_ns) finally: self._del_pkg(pkg_dir, depth, mod_name) if verbose > 1: print("Module executed successfully") @@ -293,12 +294,13 @@ importlib.invalidate_caches() __import__(mod_name) os.remove(mod_fname) - make_legacy_pyc(mod_fname) - unload(mod_name) # In case loader caches paths - if verbose > 1: print("Running from compiled:", pkg_name) - importlib.invalidate_caches() - self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) - self.check_code_execution(create_ns, expected_ns) + if not sys.dont_write_bytecode: + make_legacy_pyc(mod_fname) + unload(mod_name) # In case loader caches paths + if verbose > 1: print("Running from compiled:", pkg_name) + importlib.invalidate_caches() + self._fix_ns_for_legacy_pyc(expected_ns, alter_sys) + self.check_code_execution(create_ns, expected_ns) finally: self._del_pkg(pkg_dir, depth, pkg_name) if verbose > 1: print("Package executed successfully") @@ -351,16 +353,17 @@ importlib.invalidate_caches() __import__(mod_name) os.remove(mod_fname) - make_legacy_pyc(mod_fname) - unload(mod_name) # In case the loader caches paths - if verbose > 1: print("Running from compiled:", mod_name) - importlib.invalidate_caches() - d2 = run_module(mod_name, run_name=run_name) # Read from bytecode - self.assertEqual(d2["__name__"], expected_name) - self.assertEqual(d2["__package__"], pkg_name) - self.assertIn("sibling", d2) - self.assertIn("nephew", d2) - del d2 # Ensure __loader__ entry doesn't keep file open + if not sys.dont_write_bytecode: + make_legacy_pyc(mod_fname) + unload(mod_name) # In case the loader caches paths + if verbose > 1: print("Running from compiled:", mod_name) + importlib.invalidate_caches() + d2 = run_module(mod_name, run_name=run_name) # Read from bytecode + self.assertEqual(d2["__name__"], expected_name) + self.assertEqual(d2["__package__"], pkg_name) + self.assertIn("sibling", d2) + self.assertIn("nephew", d2) + del d2 # Ensure __loader__ entry doesn't keep file open finally: self._del_pkg(pkg_dir, depth, mod_name) if verbose > 1: print("Module executed successfully") @@ -513,9 +516,10 @@ script_name = self._make_test_script(script_dir, mod_name) compiled_name = py_compile.compile(script_name, doraise=True) os.remove(script_name) - legacy_pyc = make_legacy_pyc(script_name) - self._check_script(script_dir, "", legacy_pyc, - script_dir) + if not sys.dont_write_bytecode: + legacy_pyc = make_legacy_pyc(script_name) + self._check_script(script_dir, "", legacy_pyc, + script_dir) def test_directory_error(self): with temp_dir() as script_dir: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -283,6 +283,9 @@ Library ------- +- Issue #16389: Fixed a performance regression relative to Python 3.1 in the + caching of compiled regular expressions. + - Added missing FeedParser and BytesFeedParser to email.parser.__all__. - Issue #17431: Fix missing import of BytesFeedParser in email.parser. @@ -935,6 +938,9 @@ Tests ----- +- Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set. + Initial patch by Thomas Wouters. + - Issue #10652: make tcl/tk tests run after __all__ test, patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sun Mar 17 05:50:23 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 17 Mar 2013 05:50:23 +0100 Subject: [Python-checkins] Daily reference leaks (8002f45377d4): sum=0 Message-ID: results for 8002f45377d4 on branch "default" -------------------------------------------- test_unittest leaked [-1, 2, 0] memory blocks, sum=1 test_imaplib leaked [-4, 1, 2] memory blocks, sum=-1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogMDFzf2', '-x'] From python-checkins at python.org Sun Mar 17 08:09:40 2013 From: python-checkins at python.org (larry.hastings) Date: Sun, 17 Mar 2013 08:09:40 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_New_DSL_syntax_and_slightly_c?= =?utf-8?q?hanged_semantics_for_the_Argument_Clinic_DSL=2E?= Message-ID: <3ZTBVD26DlzR9T@mail.python.org> http://hg.python.org/peps/rev/a2fa10b2424b changeset: 4804:a2fa10b2424b user: Larry Hastings date: Sun Mar 17 00:09:36 2013 -0700 summary: New DSL syntax and slightly changed semantics for the Argument Clinic DSL. files: pep-0436.txt | 652 ++++++++++++++++++++++++++++---------- 1 files changed, 477 insertions(+), 175 deletions(-) diff --git a/pep-0436.txt b/pep-0436.txt --- a/pep-0436.txt +++ b/pep-0436.txt @@ -13,7 +13,7 @@ Abstract ======== -This document proposes "Argument Clinic", a DSL designed to facilitate +This document proposes "Argument Clinic", a DSL to facilitate argument processing for built-in functions in the implementation of CPython. @@ -22,36 +22,37 @@ =================== The primary implementation of Python, "CPython", is written in a -mixture of Python and C. One of the implementation details of CPython +mixture of Python and C. One implementation detail of CPython is what are called "built-in" functions -- functions available to Python programs but written in C. When a Python program calls a built-in function and passes in arguments, those arguments must be translated from Python values into C values. This process is called "parsing arguments". -As of CPython 3.3, arguments to functions are primarily parsed with -one of two functions: the original ``PyArg_ParseTuple()``, [1]_ and +As of CPython 3.3, builtin functions nearly always parse their arguments +with one of two functions: the original ``PyArg_ParseTuple()``, [1]_ and the more modern ``PyArg_ParseTupleAndKeywords()``. [2]_ The former -function only handles positional parameters; the latter also -accommodates keyword and keyword-only parameters, and is preferred for -new code. +only handles positional parameters; the latter also accommodates keyword +and keyword-only parameters, and is preferred for new code. -``PyArg_ParseTuple()`` was a reasonable approach when it was first -conceived. The programmer specified the translation for the arguments -in a "format string": [3]_ each parameter matched to a "format unit", -a one-or-two character sequence telling ``PyArg_ParseTuple()`` what -Python types to accept and how to translate them into the appropriate -C value for that parameter. There were only a dozen or so of these -"format units", and each one was distinct and easy to understand. +With either function, the caller specifies the translation for +parsing arguments in a "format string": [3]_ each parameter corresponds +to a "format unit", a short character sequence telling the parsing +function what Python types to accept and how to translate them into +the appropriate C value for that parameter. -Over the years the ``PyArg_Parse`` interface has been extended in -numerous ways. The modern API is quite complex, to the point that it + +``PyArg_ParseTuple()`` was reasonable when it was first conceived. +There were only a dozen or so of these "format units"; each one +was distinct, and easy to understand and remember. +But over the years the ``PyArg_Parse`` interface has been extended +in numerous ways. The modern API is complex, to the point that it is somewhat painful to use. Consider: * There are now forty different "format units"; a few are even three - characters long. This makes it difficult to understand what the - format string says without constantly cross-indexing it with the - documentation. + characters long. This makes it difficult for the programmer to + understand what the format string says--or even perhaps to parse + it--without constantly cross-indexing it with the documentation. * There are also six meta-format units that may be buried in the format string. (They are: ``"()|$:;"``.) * The more format units are added, the less likely it is the @@ -61,8 +62,9 @@ format units become. * Several format units are nearly identical to others, having only subtle differences. This makes understanding the exact semantics - of the format string even harder. - * The docstring is specified as a static C string, which is mildly + of the format string even harder, and can make choosing the right + format unit a conundrum. + * The docstring is specified as a static C string, making it mildly bothersome to read and edit. * When adding a new parameter to a function using ``PyArg_ParseTupleAndKeywords()``, it's necessary to touch six @@ -91,18 +93,32 @@ * You need specify each parameter only once. * All information about a parameter is kept together in one place. - * For each parameter, you specify its type in C; Argument Clinic - handles the translation from Python value into C value for you. + * For each parameter, you specify a conversion function; Argument + Clinic handles the translation from Python value into C value for + you. * Argument Clinic also allows for fine-tuning of argument processing - behavior with highly-readable "flags", both per-parameter and - applying across the whole function. - * Docstrings are written in plain text. + behavior with parameterized conversion functions.. + * Docstrings are written in plain text. Function docstrings are + required; per-parameter docstrings are encouraged. * From this, Argument Clinic generates for you all the mundane, repetitious code and data structures CPython needs internally. Once you've specified the interface, the next step is simply to write your implementation using native C types. Every detail of argument parsing is handled for you. +Argument Clinic is implemented as a preprocessor. It draws inspiration +for its workflow directly from [Cog]_ by Ned Batchelder. To use Clinic, +add a block comment to your C source code beginning and ending with +special text strings, then run Clinic on the file. Clinic will find the +block comment, process the contents, and write the output back into your +C source file directly after the comment. The intent is that Clinic's +output becomes part of your source code; it's checked in to revision +control, and distributed with source packages. This means that Python +will still ship ready-to-build. It does complicate development slightly; +in order to add a new function, or modify the arguments or documentation +of an existing function using Clinic, you'll need a working Python 3 +interpreter. + Future goals of Argument Clinic include: * providing signature information for builtins, and @@ -117,24 +133,118 @@ input to the Argument Clinic DSL, and the "Section" column on the left specifies what each line represents in turn. +Argument Clinic's DSL syntax mirrors the Python ``def`` +statement, lending it some familiarity to Python core developers. + :: - +-----------------------+-----------------------------------------------------+ - | Section | Example | - +-----------------------+-----------------------------------------------------+ - | Clinic DSL start | /*[clinic] | - | Function declaration | module.function_name -> return_annotation | - | Function flags | flag flag2 flag3=value | - | Parameter declaration | type name = default | - | Parameter flags | flag flag2 flag3=value | - | Parameter docstring | Lorem ipsum dolor sit amet, consectetur | - | | adipisicing elit, sed do eiusmod tempor | - | Function docstring | Lorem ipsum dolor sit amet, consectetur adipisicing | - | | elit, sed do eiusmod tempor incididunt ut labore et | - | Clinic DSL end | [clinic]*/ | - | Clinic output | ... | - | Clinic output end | /*[clinic end output:]*/ | - +-----------------------+-----------------------------------------------------+ + +-----------------------+-----------------------------------------------------------------+ + | Section | Example | + +-----------------------+-----------------------------------------------------------------+ + | Clinic DSL start | /*[clinic] | + | Module declaration | module module_name | + | Class declaration | class module_name.class_name | + | Function declaration | module_name.function_name -> return_annotation | + | Parameter declaration | name : converter(param=value) | + | Parameter docstring | Lorem ipsum dolor sit amet, consectetur | + | | adipisicing elit, sed do eiusmod tempor | + | Function docstring | Lorem ipsum dolor sit amet, consectetur adipisicing | + | | elit, sed do eiusmod tempor incididunt ut labore et | + | Clinic DSL end | [clinic]*/ | + | Clinic output | ... | + | Clinic output end | /*[clinic end output:]*/ | + +-----------------------+-----------------------------------------------------------------+ + +To give some flavor of the proposed DSL syntax, here are some sample Clinic +code blocks. This first block reflects the normally preferred style, including +blank lines between parameters and per-argument docstrings. + +:: + + /*[clinic] + os.stat as os_stat_fn -> stat result + + path: path_t(allow_fd=1) + Path to be examined; can be string, bytes, or open-file-descriptor int. + + * + + dir_fd: OS_STAT_DIR_FD_CONVERTER = DEFAULT_DIR_FD + If not None, it should be a file descriptor open to a directory, + and path should be a relative string; path will then be relative to + that directory. + + follow_symlinks: bool = True + If False, and the last element of the path is a symbolic link, + stat will examine the symbolic link itself instead of the file + the link points to. + + Perform a stat system call on the given path. + + {parameters} + + dir_fd and follow_symlinks may not be implemented + on your platform. If they are unavailable, using them will raise a + NotImplementedError. + + It's an error to use dir_fd or follow_symlinks when specifying path as + an open file descriptor. + +[clinic]*/ + +This second example shows a minimal Clinic code block, omitting all +parameter docstrings and non-significant blank lines:: + + /*[clinic] + os.access + path: path + mode: int + * + dir_fd: OS_ACCESS_DIR_FD_CONVERTER = 1 + effective_ids: bool = False + follow_symlinks: bool = True + Use the real uid/gid to test for access to a path. + Returns True if granted, False otherwise. + + {parameters} + + dir_fd, effective_ids, and follow_symlinks may not be implemented + on your platform. If they are unavailable, using them will raise a + NotImplementedError. + + Note that most operations will use the effective uid/gid, therefore this + routine can be used in a suid/sgid environment to test if the invoking user + has the specified access to the path. + + [clinic]*/ + +This final example shows a Clinic code block handling groups of +optional parameters, including parameters on the left:: + + /*[clinic] + curses.window.addch + + [ + x: int + X-coordinate. + + y: int + Y-coordinate. + ] + + ch: char + Character to add. + + [ + attr: long + Attributes for the character. + ] + + Paint character ch at (y, x) with attributes attr, + overwriting any character previously painter at that location. + By default, the character position and attributes are the + current settings for the window object. + [clinic]*/ General Behavior Of the Argument Clinic DSL @@ -145,113 +255,219 @@ Like Python itself, leading whitespace is significant in the Argument Clinic DSL. The first line of the "function" section is the -declaration; all subsequent lines at the same indent are function -flags. Once you indent, the first line is a parameter declaration; -subsequent lines at that indent are parameter flags. Indent one more -time for the lines of the parameter docstring. Finally, dedent back -to the same level as the function declaration for the function -docstring. +function declaration. Indented lines below the function declaration +declare parameters, one per line; lines below those that are indented even +further are per-parameter docstrings. Finally, the first line dedented +back to column 0 end parameter declarations and start the function docstring. + +Parameter docstrings are optional; function docstrings are not. +Functions that specify no arguments may simply specify the function +declaration followed by the docstring. + +Module and Class Declarations +----------------------------- + +When a C file implements a module or class, this should be declared to +Clinic. The syntax is simple: + +:: + + module module_name + +or + +:: + + class module_name.class_name + +(Note that these are not actually special syntax; they are implemented +as `Directives`_.) + +The module name or class name should always be the full dotted path +from the top-level module. Nested modules and classes are supported. Function Declaration -------------------- -The return annotation is optional. If skipped, the arrow ("``->``") +The full form of the function declaration is as follows: + +:: + + dotted.name [ as legal_c_id ] [ -> return_annotation ] + +The dotted name should be the full name of the function, starting +with the highest-level package (e.g. "os.stat" or "curses.window.addch"). + +The "as legal_c_id" syntax is optional. +Argument Clinic uses the name of the function to create the names of +the generated C functions. In some circumstances, the generated name +may collide with other global names in the C program's namespace. +The "as legal_c_id" syntax allows you to override the generated name +with your own; substitute "legal_c_id" with any legal C identifier. +If skipped, the "as" keyword must also be omitted. + +The return annotation is also optional. If skipped, the arrow ("``->``") must also be omitted. Parameter Declaration --------------------- -The "type" is a C type. If it's a pointer type, you must specify a -single space between the type and the "``*``", and zero spaces between -the "``*``" and the name. (e.g. "``PyObject *foo``", not "``PyObject* -foo``") +The full form of the parameter declaration line as as follows: -The "name" must be a legal C identifier. +:: -The "default" is a Python value. Default values are optional; if not -specified you must omit the equals sign too. Parameters which don't -have a default are implicitly required. The default value is + name: converter [ (parameter=value [, parameter2=value2]) ] [ = default] + +The "name" must be a legal C identifier. Whitespace is permitted between +the name and the colon (though this is not the preferred style). Whitespace +is permitted (and encouraged) between the colon and the converter. + +The "converter" is the name of one of the "converter functions" registered +with Argument Clinic. Clinic will ship with a number of built-in converters; +new converters can also be added dynamically. In choosing a converter, you +are automatically constraining what Python types are permitted on the input, +and specifying what type the output variable (or variables) will be. Although +many of the converters will resemble the names of C types or perhaps Python +types, the name of a converter may be any legal Python identifier. + +If the converter is followed by parentheses, these parentheses enclose +parameter to the conversion function. The syntax mirrors providing arguments +a Python function call: the parameter must always be named, as if they were +"keyword-only parameters", and the values provided for the parameters will +syntactically resemble Python literal values. These parameters are always +optional, permitting all conversion functions to be called without +any parameters. In this case, you may also omit the parentheses entirely; +this is always equivalent to specifying empty parentheses. + +The "default" is a Python literal value. Default values are optional; +if not specified you must omit the equals sign too. Parameters which +don't have a default are implicitly required. The default value is dynamically assigned, "live" in the generated C code, and although it's specified as a Python value, it's translated into a native C -value in the generated C code. +value in the generated C code. Few default values are permitted, +owing to this manual translation step. -It's explicitly permitted to end the parameter declaration line with a -semicolon, though the semicolon is optional. This is intended to -allow directly cutting and pasting in declarations from C code. -However, the preferred style is without the semicolon. +If this were a Python function declaration, a parameter declaration +would be delimited by either a trailing comma or an ending parentheses. +However, Argument Clinic uses neither; parameter declarations are +delimited by a newline. A trailing comma or right parenthesis is not +permitted. +The first parameter declaration establishes the indent for all parameter +declarations in a particular Clinic code block. All subsequent parameters +must be indented to the same level. -Flags ------ -"Flags" are like "``make -D``" arguments. They're unordered. Flags -lines are parsed much like the shell (specifically, using -``shlex.split()`` [5]_ ). You can have as many flag lines as you -like. Specifying a flag twice is currently an error. +Legacy Converters +----------------- -Supported flags for functions: +For convenience's sake in converting existing code to Argument Clinic, +Clinic provides a set of legacy converters that match ``PyArg_ParseTuple`` +format units. They are specified as a C string containing the format +unit. For example, to specify a parameter "foo" as taking a Python +"int" and emitting a C int, you could specify: -``basename`` - The basename to use for the generated C functions. By default this - is the name of the function from the DSL, only with periods replaced - by underscores. +:: -``positional-only`` - This function only supports positional parameters, not keyword - parameters. See `Functions With Positional-Only Parameters`_ below. + foo : "i" -Supported flags for parameters: +(To more closely resemble a C string, these must always use double quotes.) -``bitwise`` - If the Python integer passed in is signed, copy the bits directly - even if it is negative. Only valid for unsigned integer types. +Although these resemble ``PyArg_ParseTuple`` format units, no guarantee is +made that the implementation will call a ``PyArg_Parse`` function for parsing. -``converter`` - Backwards-compatibility support for parameter "converter" - functions. [6]_ The value should be the name of the converter - function in C. Only valid when the type of the parameter is - ``void *``. +This syntax does not support parameters. Therefore it doesn't support any +of the format units that require input parameters (``"O!", "O&", "es", "es#", +"et", "et#"``). Parameters requiring one of these conversions cannot use the +legacy syntax. (You may still, however, supply a default value.) + + +Parameter Docstrings +-------------------- + +All lines that appear below and are indented further than a parameter declaration +are the docstring for that parameter. All such lines are "dedented" until the +first line is flush left. + +Special Syntax For Parameter Lines +---------------------------------- + +There are four special symbols that may be used in the parameter section. Each +of these must appear on a line by itself, indented to the same level as parameter +declarations. The four symbols are: + +``*`` + Establishes that all subsequent parameters are keyword-only. + +``[`` + Establishes the start of an optional "group" of parameters. + Note that "groups" may nest inside other "groups". + See `Functions With Positional-Only Parameters`_ below. + +``]`` + Ends an optional "group" of parameters. + +``/`` + This hints to Argument Clinic that this function is performance-sensitive, + and that it's acceptable to forego supporting keyword parameters when parsing. + (In early implementations of Clinic, this will switch Clinic from generating + code using ``PyArg_ParseTupleAndKeywords`` to using ``PyArg_ParseTuple``. + The hope is that in the future there will be no appreciable speed difference, + rendering this syntax irrelevant and deprecated but harmless.) + + +Function Docstring +------------------ + +The first line with no leading whitespace after the function declaration is the +first line of the function docstring. All subsequent lines of the Clinic block +are considered part of the docstring, and their leading whitespace is preserved. + +If the string ``{parameters}`` appears on a line by itself inside the function +docstring, Argument Clinic will insert a list of all parameters that have +docstrings, each such parameter followed by its docstring. The name of the +parameter is on a line by itself; the docstring starts on a subsequent line, +and all lines of the docstring are indented by two spaces. (Parameters with +no per-parameter docstring are suppressed.) The entire list is indented by the +leading whitespace that appeared before the ``{parameters}`` token. + +If the string ``{parameters}`` doesn't appear in the docstring, Argument Clinic +will append one to the end of the docstring, inserting a blank line above it if +the docstring does not end with a blank line, and with the parameter list at +column 0. + +Converters +---------- + +Argument Clinic contains a pre-initialized registry of converter functions. +Example converter functions: + +``int`` + Accepts a Python object implementing ``__int__``; emits a C ``int``. + +``byte`` + Accepts a Python int; emits an ``unsigned char``. The integer + must be in the range [0, 256). + +``str`` + Accepts a Python str object; emits a C ``char *``. Automatically + encodes the string using the ``ascii`` codec. + +``PyObject`` + Accepts any object; emits a C ``PyObject *`` without any conversion. + +All converters accept the following parameters: ``default`` The Python value to use in place of the parameter's actual default - in Python contexts. Specifically, when specified, this value will + in Python contexts. In other words: when specified, this value will be used for the parameter's default in the docstring, and in the - ``Signature``. (TBD: If the string is a valid Python expression - which can be rendered into a Python value using ``eval()``, then the - result of ``eval()`` on it will be used as the default in the - ``Signature``.) Ignored if there is no default. - -``encoding`` - Encoding to use when encoding a Unicode string to a ``char *``. - Only valid when the type of the parameter is ``char *``. - -``group=`` - This parameter is part of a group of options that must either all be - specified or none specified. Parameters in the same "group" must be - contiguous. The value of the group flag is the name used for the - group variable, and therefore must be legal as a C identifier. Only - valid for functions marked "``positional-only``"; see `Functions - With Positional-Only Parameters`_ below. - -``immutable`` - Only accept immutable values. - -``keyword-only`` - This parameter (and all subsequent parameters) is keyword-only. - Keyword-only parameters must also be optional parameters. Not valid - for positional-only functions. - -``length`` - This is an iterable type, and we also want its length. The DSL will - generate a second ``Py_ssize_t`` variable; its name will be this - parameter's name appended with "``_length``". - -``nullable`` - ``None`` is a legal argument for this parameter. If ``None`` is - supplied on the Python side, the equivalent C argument will be - ``NULL``. Only valid for pointer types. + ``Signature``. (TBD alternative semantics: If the string is a valid + Python expression which can be rendered into a Python value using + ``eval()``, then the result of ``eval()`` on it will be used as the + default in the ``Signature``.) Ignored if there is no default. ``required`` Normally any parameter that has a default value is automatically @@ -259,24 +475,78 @@ required (non-optional) even if it has a default value. The generated documentation will also not show any default value. + +Additionally, converters may accept one or more of these optional +parameters, on an individual basis: + +``bitwise`` + For converters that accept unsigned integers. If the Python integer + passed in is signed, copy the bits directly even if it is negative. + +``encoding`` + For converters that accept str. Encoding to use when encoding a + Unicode string to a ``char *``. + +``immutable`` + Only accept immutable values. + +``length`` + For converters that accept iterable types. Requests that the converter + also emit the length of the iterable, passed in to the ``_impl`` function + in a ``Py_ssize_t`` variable; its name will be this + parameter's name appended with "``_length``". + +``nullable`` + This converter normally does not accept ``None``, but in this case + it should. If ``None`` is supplied on the Python side, the equivalent + C argument will be ``NULL``. (The ``_impl`` argument emitted by this + converter will presumably be a pointer type.) + ``types`` - Space-separated list of acceptable Python types for this object. - There are also four special-case types which represent Python - protocols: + A list of strings representing acceptable Python types for this object. + There are also four strings which represent Python protocols: - * buffer - * mapping - * number - * sequence + * "buffer" + * "mapping" + * "number" + * "sequence" ``zeroes`` - This parameter is a string type, and its value should be allowed to - have embedded zeroes. Not valid for all varieties of string - parameters. + For converters that accept string types. The converted value should + be allowed to have embedded zeroes. + + +Directives +---------- + +Argument Clinic also permits "directives" in Clinic code blocks. +Directives are similar to *pragmas* in C; they are statements +that modify Argument Clinic's behavior. + +The format of a directive is as follows: + +:: + + directive_name [argument [second_argument [ ... ]]] + +Directives only take positional arguments. + +A Clinic code block must contain either one or more directives, +or a function declaration. It may contain both, in which +case all directives must come before the function declaration. + +Internally directives map directly to Python callables. +The directive's arguments are passed directly to the callable +as positional arguments of type ``str()``. + +Example possible directives include the production, +suppression, or redirection of Clinic output. Also, the +"module" and "class" keywords are actually implemented +as directives. Python Code ------------ +=========== Argument Clinic also permits embedding Python code inside C files, which is executed in-place when Argument Clinic processes the file. @@ -290,16 +560,21 @@ print("/" + "* Hello world! *" + "/") [python]*/ + /* Hello world! */ + /*[python end:da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ + +The ``"/* Hello world! */"`` line above was generated by running the Python +code in the preceding comment. Any Python code is valid. Python code sections in Argument Clinic can -also be used to modify Clinic's behavior at runtime; for example, see -`Extending Argument Clinic`_. +also be used to directly interact with Clinic; see +`Argument Clinic Programmatic Interfaces`_. Output ====== -Argument Clinic writes its output in-line in the C file, immediately +Argument Clinic writes its output inline in the C file, immediately after the section of Clinic code. For "python" sections, the output is everything printed using ``builtins.print``. For "clinic" sections, the output is valid C code, including: @@ -313,11 +588,10 @@ * the definition line of the "impl" function * and a comment indicating the end of output. -The intention is that you will write the body of your impl function -immediately after the output -- as in, you write a left-curly-brace -immediately after the end-of-output comment and write the -implementation of the builtin in the body there. (It's a bit strange -at first, but oddly convenient.) +The intention is that you write the body of your impl function immediately +after the output -- as in, you write a left-curly-brace immediately after +the end-of-output comment and implement builtin in the body there. +(It's a bit strange at first, but oddly convenient.) Argument Clinic will define the parameters of the impl function for you. The function will take the "self" parameter passed in @@ -332,6 +606,9 @@ "``-f``" command-line argument; Clinic will also ignore the checksums when using the "``-o``" command-line argument.) +Finally, Argument Clinic can also emit the boilerplate definition +of the PyMethodDef array for the defined classes and modules. + Functions With Positional-Only Parameters ========================================= @@ -342,61 +619,90 @@ their arguments differently based on how many arguments were passed in. This can provide some bewildering flexibility: there may be groups of optional parameters, which must either all be specified or -none specified. And occasionally these groups are on the *left!* (For -example: ``curses.window.addch()``.) +none specified. And occasionally these groups are on the *left!* (A +representative example: ``curses.window.addch()``.) -Argument Clinic supports these legacy use-cases with a special set of -flags. First, set the flag "``positional-only``" on the entire -function. Then, for every group of parameters that is collectively -optional, add a "``group=``" flag with a unique string to all the -parameters in that group. Note that these groups are permitted on the -right *or left* of any required parameters! However, all groups -(including the group of required parameters) must be contiguous. +Argument Clinic supports these legacy use-cases by allowing you to +specify parameters in groups. Each optional group of parameters +is marked with square brackets. Note that these groups are permitted +on the right *or left* of any required parameters! The impl function generated by Clinic will add an extra parameter for -every group, "``int _group``". This argument will be nonzero -if the group was specified on this call, and zero if it was not. +every group, "``int group_{left|right}_``", where x is a monotonically +increasing number assigned to each group as it builds away from the +required arguments. This argument will be nonzero if the group was +specified on this call, and zero if it was not. Note that when operating in this mode, you cannot specify default -arguments. You can simulate defaults by putting parameters in -individual groups and detecting whether or not they were specified; -generally speaking it's better to simply not use "positional-only" -where it isn't absolutely necessary. (TBD: It might be possible to -relax this restriction. But adding default arguments into the mix of -groups would seemingly make calculating which groups are active a good -deal harder.) +arguments. Also, note that it's possible to specify a set of groups to a function such that there are several valid mappings from the number of -arguments to a valid set of groups. If this happens, Clinic will exit +arguments to a valid set of groups. If this happens, Clinic will abort with an error message. This should not be a problem, as positional-only operation is only intended for legacy use cases, and -all the legacy functions using this quirky behavior should have -unambiguous mappings. +all the legacy functions using this quirky behavior have unambiguous +mappings. Current Status ============== As of this writing, there is a working prototype implementation of -Argument Clinic available online. [7]_ The prototype implements the -syntax above, and generates code using the existing ``PyArg_Parse`` -APIs. It supports translating to all current format units except -``"w*"``. Sample functions using Argument Clinic exercise all major -features, including positional-only argument parsing. +Argument Clinic available online (though the syntax may be out of date +as you read this). [7]_ The prototype generates code using the +existing ``PyArg_Parse`` APIs. It supports translating to all current +format units except the mysterious ``"w*"``. Sample functions using +Argument Clinic exercise all major features, including positional-only +argument parsing. -Extending Argument Clinic -------------------------- +Argument Clinic Programmatic Interfaces +--------------------------------------- The prototype also currently provides an experimental extension mechanism, allowing adding support for new types on-the-fly. See ``Modules/posixmodule.c`` in the prototype for an example of its use. +In the future, Argument Clinic is expected to be automatable enough +to allow querying, modification, or outright new construction of +function declarations through Python code. It may even permit +dynamically adding your own custom DSL! + Notes / TBD =========== +* Optimally we'd want Argument Clinic run automatically as part of the + normal Python build process. But this presents a bootstrapping problem; + if you don't have a system Python 3, you need a Python 3 executable to + build Python 3. I'm sure this is a solvable problem, but I don't know + what the best solution might be. (Supporting this will also require + a parallel solution for Windows.) + +* The original Clinic DSL syntax allowed naming the "groups" for + positional-only argument parsing. The current one does not; + they will therefore get computer-generated names (probably + left_1, right_2, etc.). Do we care about allowing the user + to explicitly specify names for the groups? The thing is, there's + no good place to put it. Only one syntax suggests itself to me, + and it's a syntax only a mother could love: + + :: + + [ group_name + name: converter + name2: converter2 + ] + +* During the PyCon US 2013 Language Summit, there was discussion of having + Argument Clinic also generate the actual documentation (in ReST, processed + by Sphinx) for the function. The logistics of this are TBD, but it would + require that the docstrings be written in ReST, and require that Python + ship a ReST -> ascii converter. It would be best to come to a decision + about this before we begin any large-scale conversion of the CPython + source tree to using Clinic. + * Guido proposed having the "function docstring" be hand-written inline, in the middle of the output, something like this: @@ -420,10 +726,6 @@ * Do we need to support tuple unpacking? (The "``(OOO)``" style format string.) Boy I sure hope not. -* What about Python functions that take no arguments? This syntax - doesn't provide for that. Perhaps a lone indented "None" should - mean "no arguments"? - * This approach removes some dynamism / flexibility. With the existing syntax one could theoretically pass in different encodings at runtime for the "``es``"/"``et``" format units. AFAICT CPython @@ -433,14 +735,14 @@ socketmodule.c, except for one in _ssl.c. They're all static, specifying the encoding ``"idna"``.) -* Right now the "basename" flag on a function changes the ``#define - methoddef`` name too. Should it, or should the #define'd methoddef - name always be ``{module_name}_{function_name}`` ? - References ========== +.. [Cog] ``Cog``: + http://nedbatchelder.com/code/cog/ + + .. [1] ``PyArg_ParseTuple()``: http://docs.python.org/3/c-api/arg.html#PyArg_ParseTuple -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sun Mar 17 20:30:57 2013 From: python-checkins at python.org (terry.reedy) Date: Sun, 17 Mar 2013 20:30:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3NDE1?= =?utf-8?q?=3A_Clarify_=27this=27_referent_by_moving_containing_sentence_j?= =?utf-8?q?ust_after?= Message-ID: <3ZTVxY6xN1zRxF@mail.python.org> http://hg.python.org/cpython/rev/ff9636af9505 changeset: 82711:ff9636af9505 branch: 3.2 parent: 82706:6951d7b8d3ad user: Terry Jan Reedy date: Sun Mar 17 15:21:26 2013 -0400 summary: Issue #17415: Clarify 'this' referent by moving containing sentence just after the sentence referred to. Make other minor edits to improve flow. files: Doc/library/os.path.rst | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -214,13 +214,11 @@ .. function:: normpath(path) - Normalize a pathname. This collapses redundant separators and up-level - references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all become - ``A/B``. - - It does not normalize the case (use :func:`normcase` for that). On Windows, it - converts forward slashes to backward slashes. It should be understood that this - may change the meaning of the path if it contains symbolic links! + Normalize a pathname by collapsing redundant separators and up-level + references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all + become ``A/B``. This string manipulation may change the meaning of a path + that contains symbolic links. On Windows, it converts forward slashes to + backward slashes. To normalize case, use :func:`normcase`. .. function:: realpath(path) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 17 20:30:59 2013 From: python-checkins at python.org (terry.reedy) Date: Sun, 17 Mar 2013 20:30:59 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_with_3=2E2?= Message-ID: <3ZTVxb2grhzS6h@mail.python.org> http://hg.python.org/cpython/rev/4045413a9ab4 changeset: 82712:4045413a9ab4 branch: 3.3 parent: 82707:7b737011d822 parent: 82711:ff9636af9505 user: Terry Jan Reedy date: Sun Mar 17 15:22:00 2013 -0400 summary: Merge with 3.2 files: Doc/library/os.path.rst | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -219,13 +219,11 @@ .. function:: normpath(path) - Normalize a pathname. This collapses redundant separators and up-level - references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all become - ``A/B``. - - It does not normalize the case (use :func:`normcase` for that). On Windows, it - converts forward slashes to backward slashes. It should be understood that this - may change the meaning of the path if it contains symbolic links! + Normalize a pathname by collapsing redundant separators and up-level + references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all + become ``A/B``. This string manipulation may change the meaning of a path + that contains symbolic links. On Windows, it converts forward slashes to + backward slashes. To normalize case, use :func:`normcase`. .. function:: realpath(path) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 17 20:31:00 2013 From: python-checkins at python.org (terry.reedy) Date: Sun, 17 Mar 2013 20:31:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3NDE1?= =?utf-8?q?=3A_Clarify_=27this=27_referent_by_moving_containing_sentence_j?= =?utf-8?q?ust_after?= Message-ID: <3ZTVxc5JPjzS6w@mail.python.org> http://hg.python.org/cpython/rev/bceb81b0016e changeset: 82713:bceb81b0016e branch: 2.7 parent: 82696:c76c6fd48449 user: Terry Jan Reedy date: Sun Mar 17 15:21:26 2013 -0400 summary: Issue #17415: Clarify 'this' referent by moving containing sentence just after the sentence referred to. Make other minor edits to improve flow. files: Doc/library/os.path.rst | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -219,13 +219,11 @@ .. function:: normpath(path) - Normalize a pathname. This collapses redundant separators and up-level - references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all become - ``A/B``. - - It does not normalize the case (use :func:`normcase` for that). On Windows, it - converts forward slashes to backward slashes. It should be understood that this - may change the meaning of the path if it contains symbolic links! + Normalize a pathname by collapsing redundant separators and up-level + references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all + become ``A/B``. This string manipulation may change the meaning of a path + that contains symbolic links. On Windows, it converts forward slashes to + backward slashes. To normalize case, use :func:`normcase`. .. function:: realpath(path) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 17 20:31:02 2013 From: python-checkins at python.org (terry.reedy) Date: Sun, 17 Mar 2013 20:31:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E3?= Message-ID: <3ZTVxf10QBzSlJ@mail.python.org> http://hg.python.org/cpython/rev/2d860bb13110 changeset: 82714:2d860bb13110 parent: 82710:8002f45377d4 parent: 82712:4045413a9ab4 user: Terry Jan Reedy date: Sun Mar 17 15:25:12 2013 -0400 summary: Merge with 3.3 files: Doc/library/os.path.rst | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -218,13 +218,11 @@ .. function:: normpath(path) - Normalize a pathname. This collapses redundant separators and up-level - references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all become - ``A/B``. - - It does not normalize the case (use :func:`normcase` for that). On Windows, it - converts forward slashes to backward slashes. It should be understood that this - may change the meaning of the path if it contains symbolic links! + Normalize a pathname by collapsing redundant separators and up-level + references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all + become ``A/B``. This string manipulation may change the meaning of a path + that contains symbolic links. On Windows, it converts forward slashes to + backward slashes. To normalize case, use :func:`normcase`. .. function:: realpath(path) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 17 20:31:03 2013 From: python-checkins at python.org (terry.reedy) Date: Sun, 17 Mar 2013 20:31:03 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3NDE1?= =?utf-8?q?=3A_Trim_trailing_whitespace?= Message-ID: <3ZTVxg3VShzSlY@mail.python.org> http://hg.python.org/cpython/rev/5b5a9bceb228 changeset: 82715:5b5a9bceb228 branch: 3.2 parent: 82711:ff9636af9505 user: Terry Jan Reedy date: Sun Mar 17 15:28:10 2013 -0400 summary: Issue #17415: Trim trailing whitespace files: Doc/library/os.path.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -218,7 +218,7 @@ references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all become ``A/B``. This string manipulation may change the meaning of a path that contains symbolic links. On Windows, it converts forward slashes to - backward slashes. To normalize case, use :func:`normcase`. + backward slashes. To normalize case, use :func:`normcase`. .. function:: realpath(path) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 17 20:31:04 2013 From: python-checkins at python.org (terry.reedy) Date: Sun, 17 Mar 2013 20:31:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_with_3=2E2?= Message-ID: <3ZTVxh6lVLzSlL@mail.python.org> http://hg.python.org/cpython/rev/3251b2a04fee changeset: 82716:3251b2a04fee branch: 3.3 parent: 82712:4045413a9ab4 parent: 82715:5b5a9bceb228 user: Terry Jan Reedy date: Sun Mar 17 15:28:52 2013 -0400 summary: Merge with 3.2 files: Doc/library/os.path.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -223,7 +223,7 @@ references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all become ``A/B``. This string manipulation may change the meaning of a path that contains symbolic links. On Windows, it converts forward slashes to - backward slashes. To normalize case, use :func:`normcase`. + backward slashes. To normalize case, use :func:`normcase`. .. function:: realpath(path) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 17 20:31:06 2013 From: python-checkins at python.org (terry.reedy) Date: Sun, 17 Mar 2013 20:31:06 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E3?= Message-ID: <3ZTVxk2Wm3zSmT@mail.python.org> http://hg.python.org/cpython/rev/8fddce9a9606 changeset: 82717:8fddce9a9606 parent: 82714:2d860bb13110 parent: 82716:3251b2a04fee user: Terry Jan Reedy date: Sun Mar 17 15:29:19 2013 -0400 summary: Merge with 3.3 files: Doc/library/os.path.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -222,7 +222,7 @@ references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all become ``A/B``. This string manipulation may change the meaning of a path that contains symbolic links. On Windows, it converts forward slashes to - backward slashes. To normalize case, use :func:`normcase`. + backward slashes. To normalize case, use :func:`normcase`. .. function:: realpath(path) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 17 20:31:07 2013 From: python-checkins at python.org (terry.reedy) Date: Sun, 17 Mar 2013 20:31:07 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3NDE1?= =?utf-8?q?=3A_Trim_trailing_whitespace?= Message-ID: <3ZTVxl5FljzSlL@mail.python.org> http://hg.python.org/cpython/rev/44b9f59c6ea7 changeset: 82718:44b9f59c6ea7 branch: 2.7 parent: 82713:bceb81b0016e user: Terry Jan Reedy date: Sun Mar 17 15:28:10 2013 -0400 summary: Issue #17415: Trim trailing whitespace files: Doc/library/os.path.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -223,7 +223,7 @@ references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all become ``A/B``. This string manipulation may change the meaning of a path that contains symbolic links. On Windows, it converts forward slashes to - backward slashes. To normalize case, use :func:`normcase`. + backward slashes. To normalize case, use :func:`normcase`. .. function:: realpath(path) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 17 23:50:41 2013 From: python-checkins at python.org (brett.cannon) Date: Sun, 17 Mar 2013 23:50:41 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE2ODgw?= =?utf-8?q?=3A_=5Fimp=2Eload=5Fdynamic=28=29_is_not_defined_on_a_platform_?= =?utf-8?q?that?= Message-ID: <3ZTbN11BYLzS1B@mail.python.org> http://hg.python.org/cpython/rev/d5aa922f97f9 changeset: 82719:d5aa922f97f9 branch: 3.3 parent: 82716:3251b2a04fee user: Brett Cannon date: Sun Mar 17 15:48:16 2013 -0700 summary: Issue #16880: _imp.load_dynamic() is not defined on a platform that does not support dynamic loading (e.g. Atari), so make sure that imp doesn't assume it always exists. Patch by Christian Heimes. files: Lib/imp.py | 9 +++++++-- Misc/NEWS | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Lib/imp.py b/Lib/imp.py --- a/Lib/imp.py +++ b/Lib/imp.py @@ -7,9 +7,14 @@ """ # (Probably) need to stay in _imp from _imp import (lock_held, acquire_lock, release_lock, - load_dynamic, get_frozen_object, is_frozen_package, + get_frozen_object, is_frozen_package, init_builtin, init_frozen, is_builtin, is_frozen, _fix_co_filename) +try: + from _imp import load_dynamic +except ImportError: + # Platform doesn't support dynamic loading. + load_dynamic = None # Directly exposed by this module from importlib._bootstrap import new_module @@ -160,7 +165,7 @@ return load_source(name, filename, file) elif type_ == PY_COMPILED: return load_compiled(name, filename, file) - elif type_ == C_EXTENSION: + elif type_ == C_EXTENSION and load_dynamic is not None: return load_dynamic(name, filename, file) elif type_ == PKG_DIRECTORY: return load_package(name, filename) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -193,6 +193,8 @@ Library ------- +Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. + - Issue #16389: Fixed a performance regression relative to Python 3.1 in the caching of compiled regular expressions. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 17 23:50:42 2013 From: python-checkins at python.org (brett.cannon) Date: Sun, 17 Mar 2013 23:50:42 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZTbN23yPTzShB@mail.python.org> http://hg.python.org/cpython/rev/3c3c9ad7c297 changeset: 82720:3c3c9ad7c297 parent: 82717:8fddce9a9606 parent: 82719:d5aa922f97f9 user: Brett Cannon date: Sun Mar 17 15:49:21 2013 -0700 summary: merge files: Lib/imp.py | 9 +++++++-- Misc/NEWS | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Lib/imp.py b/Lib/imp.py --- a/Lib/imp.py +++ b/Lib/imp.py @@ -7,9 +7,14 @@ """ # (Probably) need to stay in _imp from _imp import (lock_held, acquire_lock, release_lock, - load_dynamic, get_frozen_object, is_frozen_package, + get_frozen_object, is_frozen_package, init_builtin, init_frozen, is_builtin, is_frozen, _fix_co_filename) +try: + from _imp import load_dynamic +except ImportError: + # Platform doesn't support dynamic loading. + load_dynamic = None # Directly exposed by this module from importlib._bootstrap import new_module @@ -160,7 +165,7 @@ return load_source(name, filename, file) elif type_ == PY_COMPILED: return load_compiled(name, filename, file) - elif type_ == C_EXTENSION: + elif type_ == C_EXTENSION and load_dynamic is not None: return load_dynamic(name, filename, file) elif type_ == PKG_DIRECTORY: return load_package(name, filename) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -283,6 +283,8 @@ Library ------- +Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. + - Issue #16389: Fixed a performance regression relative to Python 3.1 in the caching of compiled regular expressions. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 03:06:40 2013 From: python-checkins at python.org (r.david.murray) Date: Mon, 18 Mar 2013 03:06:40 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE2MDU3OiBDbGFy?= =?utf-8?q?ify_why_the_base_method_default_is_called_in_custom_encoders=2E?= Message-ID: <3ZTgk84bgMzSkQ@mail.python.org> http://hg.python.org/cpython/rev/5d56e1214e95 changeset: 82721:5d56e1214e95 branch: 3.2 parent: 82715:5b5a9bceb228 user: R David Murray date: Sun Mar 17 21:52:35 2013 -0400 summary: #16057: Clarify why the base method default is called in custom encoders. Original patch by Kushal Das. files: Doc/library/json.rst | 2 ++ Lib/json/encoder.py | 1 + 2 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -83,6 +83,7 @@ ... def default(self, obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] + ... # Let the base class default method raise the TypeError ... return json.JSONEncoder.default(self, obj) ... >>> json.dumps(2 + 1j, cls=ComplexEncoder) @@ -431,6 +432,7 @@ pass else: return list(iterable) + # Let the base class default method raise the TypeError return json.JSONEncoder.default(self, o) diff --git a/Lib/json/encoder.py b/Lib/json/encoder.py --- a/Lib/json/encoder.py +++ b/Lib/json/encoder.py @@ -166,6 +166,7 @@ pass else: return list(iterable) + # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) """ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 03:06:42 2013 From: python-checkins at python.org (r.david.murray) Date: Mon, 18 Mar 2013 03:06:42 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_=2316057=3A_Clarify_why_the_base_method_default_is_calle?= =?utf-8?q?d_in_custom_encoders=2E?= Message-ID: <3ZTgkB02DzzPCm@mail.python.org> http://hg.python.org/cpython/rev/5f76e7db97ac changeset: 82722:5f76e7db97ac branch: 3.3 parent: 82719:d5aa922f97f9 parent: 82721:5d56e1214e95 user: R David Murray date: Sun Mar 17 21:53:23 2013 -0400 summary: Merge #16057: Clarify why the base method default is called in custom encoders. Original patch by Kushal Das. files: Doc/library/json.rst | 2 ++ Lib/json/encoder.py | 1 + 2 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -83,6 +83,7 @@ ... def default(self, obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] + ... # Let the base class default method raise the TypeError ... return json.JSONEncoder.default(self, obj) ... >>> json.dumps(2 + 1j, cls=ComplexEncoder) @@ -431,6 +432,7 @@ pass else: return list(iterable) + # Let the base class default method raise the TypeError return json.JSONEncoder.default(self, o) diff --git a/Lib/json/encoder.py b/Lib/json/encoder.py --- a/Lib/json/encoder.py +++ b/Lib/json/encoder.py @@ -166,6 +166,7 @@ pass else: return list(iterable) + # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) """ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 03:06:43 2013 From: python-checkins at python.org (r.david.murray) Date: Mon, 18 Mar 2013 03:06:43 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_=2316057=3A_Clarify_why_the_base_method_default_is?= =?utf-8?q?_called_in_custom_encoders=2E?= Message-ID: <3ZTgkC2rwXzSmJ@mail.python.org> http://hg.python.org/cpython/rev/406c6fd7e753 changeset: 82723:406c6fd7e753 parent: 82720:3c3c9ad7c297 parent: 82722:5f76e7db97ac user: R David Murray date: Sun Mar 17 21:53:48 2013 -0400 summary: Merge #16057: Clarify why the base method default is called in custom encoders. Original patch by Kushal Das. files: Doc/library/json.rst | 2 ++ Lib/json/encoder.py | 1 + 2 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -82,6 +82,7 @@ ... def default(self, obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] + ... # Let the base class default method raise the TypeError ... return json.JSONEncoder.default(self, obj) ... >>> json.dumps(2 + 1j, cls=ComplexEncoder) @@ -426,6 +427,7 @@ pass else: return list(iterable) + # Let the base class default method raise the TypeError return json.JSONEncoder.default(self, o) diff --git a/Lib/json/encoder.py b/Lib/json/encoder.py --- a/Lib/json/encoder.py +++ b/Lib/json/encoder.py @@ -166,6 +166,7 @@ pass else: return list(iterable) + # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) """ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 03:06:44 2013 From: python-checkins at python.org (r.david.murray) Date: Mon, 18 Mar 2013 03:06:44 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzE2MDU3OiBDbGFy?= =?utf-8?q?ify_why_the_base_method_default_is_called_in_custom_encoders=2E?= Message-ID: <3ZTgkD5d01zS4j@mail.python.org> http://hg.python.org/cpython/rev/ef8ea052bcc4 changeset: 82724:ef8ea052bcc4 branch: 2.7 parent: 82718:44b9f59c6ea7 user: R David Murray date: Sun Mar 17 22:06:18 2013 -0400 summary: #16057: Clarify why the base method default is called in custom encoders. Original patch by Kushal Das. files: Doc/library/json.rst | 2 ++ Lib/json/encoder.py | 1 + 2 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -84,6 +84,7 @@ ... def default(self, obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] + ... # Let the base class default method raise the TypeError ... return json.JSONEncoder.default(self, obj) ... >>> dumps(2 + 1j, cls=ComplexEncoder) @@ -452,6 +453,7 @@ pass else: return list(iterable) + # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) diff --git a/Lib/json/encoder.py b/Lib/json/encoder.py --- a/Lib/json/encoder.py +++ b/Lib/json/encoder.py @@ -177,6 +177,7 @@ pass else: return list(iterable) + # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) """ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 05:26:04 2013 From: python-checkins at python.org (r.david.murray) Date: Mon, 18 Mar 2013 05:26:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3NDQ4OiBNYWtl?= =?utf-8?q?_test=5Fsax_skip_if_there_are_no_xml_parsers=2E?= Message-ID: <3ZTkq04pZzzSnS@mail.python.org> http://hg.python.org/cpython/rev/114e363ebf83 changeset: 82725:114e363ebf83 branch: 3.2 parent: 82721:5d56e1214e95 user: R David Murray date: Mon Mar 18 00:18:12 2013 -0400 summary: #17448: Make test_sax skip if there are no xml parsers. Patch by Rafael Santos. files: Lib/test/test_sax.py | 4 ++-- Misc/ACKS | 1 + Misc/NEWS | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py --- a/Lib/test/test_sax.py +++ b/Lib/test/test_sax.py @@ -3,11 +3,12 @@ from xml.sax import make_parser, ContentHandler, \ SAXException, SAXReaderNotAvailable, SAXParseException +import unittest try: make_parser() except SAXReaderNotAvailable: # don't try to test this module if we cannot create a parser - raise ImportError("no XML parsers available") + raise unittest.SkipTest("no XML parsers available") from xml.sax.saxutils import XMLGenerator, escape, unescape, quoteattr, \ XMLFilterBase from xml.sax.expatreader import create_parser @@ -18,7 +19,6 @@ import shutil from test import support from test.support import findfile, run_unittest -import unittest TEST_XMLFILE = findfile("test.xml", subdir="xmltestdata") TEST_XMLFILE_OUT = findfile("test.xml.out", subdir="xmltestdata") diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -947,6 +947,7 @@ Kevin Samborn Adrian Sampson Ilya Sandler +Rafael Santos Mark Sapiro Ty Sarna Hugh Sasse diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -967,6 +967,9 @@ Tests ----- +- Issue #17448: test_sax now skips if there are no xml parsers available + instead of raising an ImportError. + - Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set. Initial patch by Thomas Wouters. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 05:26:06 2013 From: python-checkins at python.org (r.david.murray) Date: Mon, 18 Mar 2013 05:26:06 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_=2317448=3A_Make_test=5Fsax_skip_if_there_are_no_xml_par?= =?utf-8?q?sers=2E?= Message-ID: <3ZTkq20vMbzSnj@mail.python.org> http://hg.python.org/cpython/rev/3ab80610b2a2 changeset: 82726:3ab80610b2a2 branch: 3.3 parent: 82722:5f76e7db97ac parent: 82725:114e363ebf83 user: R David Murray date: Mon Mar 18 00:20:43 2013 -0400 summary: Merge #17448: Make test_sax skip if there are no xml parsers. Patch by Rafael Santos. files: Lib/test/test_sax.py | 4 ++-- Misc/ACKS | 1 + Misc/NEWS | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py --- a/Lib/test/test_sax.py +++ b/Lib/test/test_sax.py @@ -3,11 +3,12 @@ from xml.sax import make_parser, ContentHandler, \ SAXException, SAXReaderNotAvailable, SAXParseException +import unittest try: make_parser() except SAXReaderNotAvailable: # don't try to test this module if we cannot create a parser - raise ImportError("no XML parsers available") + raise unittest.SkipTest("no XML parsers available") from xml.sax.saxutils import XMLGenerator, escape, unescape, quoteattr, \ XMLFilterBase from xml.sax.expatreader import create_parser @@ -18,7 +19,6 @@ import shutil from test import support from test.support import findfile, run_unittest -import unittest TEST_XMLFILE = findfile("test.xml", subdir="xmltestdata") TEST_XMLFILE_OUT = findfile("test.xml.out", subdir="xmltestdata") diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1050,6 +1050,7 @@ Adrian Sampson James Sanders Ilya Sandler +Rafael Santos Mark Sapiro Ty Sarna Hugh Sasse diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -659,6 +659,9 @@ Tests ----- +- Issue #17448: test_sax now skips if there are no xml parsers available + instead of raising an ImportError. + - Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set. Initial patch by Thomas Wouters. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 05:26:07 2013 From: python-checkins at python.org (r.david.murray) Date: Mon, 18 Mar 2013 05:26:07 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_=2317448=3A_Make_test=5Fsax_skip_if_there_are_no_x?= =?utf-8?q?ml_parsers=2E?= Message-ID: <3ZTkq33nfnzSnB@mail.python.org> http://hg.python.org/cpython/rev/59621d4f1171 changeset: 82727:59621d4f1171 parent: 82723:406c6fd7e753 parent: 82726:3ab80610b2a2 user: R David Murray date: Mon Mar 18 00:21:43 2013 -0400 summary: Merge #17448: Make test_sax skip if there are no xml parsers. Patch by Rafael Santos. files: Lib/test/test_sax.py | 4 ++-- Misc/ACKS | 1 + Misc/NEWS | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py --- a/Lib/test/test_sax.py +++ b/Lib/test/test_sax.py @@ -3,11 +3,12 @@ from xml.sax import make_parser, ContentHandler, \ SAXException, SAXReaderNotAvailable, SAXParseException +import unittest try: make_parser() except SAXReaderNotAvailable: # don't try to test this module if we cannot create a parser - raise ImportError("no XML parsers available") + raise unittest.SkipTest("no XML parsers available") from xml.sax.saxutils import XMLGenerator, escape, unescape, quoteattr, \ XMLFilterBase from xml.sax.expatreader import create_parser @@ -18,7 +19,6 @@ import shutil from test import support from test.support import findfile, run_unittest -import unittest TEST_XMLFILE = findfile("test.xml", subdir="xmltestdata") TEST_XMLFILE_OUT = findfile("test.xml.out", subdir="xmltestdata") diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1065,6 +1065,7 @@ Adrian Sampson James Sanders Ilya Sandler +Rafael Santos Mark Sapiro Ty Sarna Hugh Sasse diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -940,6 +940,9 @@ Tests ----- +- Issue #17448: test_sax now skips if there are no xml parsers available + instead of raising an ImportError. + - Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set. Initial patch by Thomas Wouters. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 05:28:46 2013 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 18 Mar 2013 05:28:46 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_open_file_in_b?= =?utf-8?q?inary_mode?= Message-ID: <3ZTkt609lSzS5r@mail.python.org> http://hg.python.org/cpython/rev/6aab72424063 changeset: 82728:6aab72424063 branch: 2.7 parent: 82724:ef8ea052bcc4 user: Benjamin Peterson date: Sun Mar 17 21:28:29 2013 -0700 summary: open file in binary mode files: Lib/test/test_cpickle.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_cpickle.py b/Lib/test/test_cpickle.py --- a/Lib/test/test_cpickle.py +++ b/Lib/test/test_cpickle.py @@ -23,10 +23,10 @@ class FileIOMixin: def output(self): - return open(test_support.TESTFN, 'w+') + return open(test_support.TESTFN, 'wb+') def input(self, data): - f = open(test_support.TESTFN, 'w+') + f = open(test_support.TESTFN, 'wb+') try: f.write(data) f.seek(0) -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Mon Mar 18 05:52:24 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 18 Mar 2013 05:52:24 +0100 Subject: [Python-checkins] Daily reference leaks (406c6fd7e753): sum=2 Message-ID: results for 406c6fd7e753 on branch "default" -------------------------------------------- test_httplib leaked [0, -1, 1] references, sum=0 test_httplib leaked [0, -1, 3] memory blocks, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogtltnen', '-x'] From python-checkins at python.org Mon Mar 18 09:47:38 2013 From: python-checkins at python.org (larry.hastings) Date: Mon, 18 Mar 2013 09:47:38 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Update_for_436=2C_explicitly_?= =?utf-8?q?supporting_positional_parameters_forever=2C_amen=2E?= Message-ID: <3ZTrcp6hZCzSLM@mail.python.org> http://hg.python.org/peps/rev/890e9a9afc1e changeset: 4805:890e9a9afc1e user: Larry Hastings date: Mon Mar 18 01:47:29 2013 -0700 summary: Update for 436, explicitly supporting positional parameters forever, amen. files: pep-0436.txt | 87 +++++++++++++++++++++++++++++++-------- 1 files changed, 68 insertions(+), 19 deletions(-) diff --git a/pep-0436.txt b/pep-0436.txt --- a/pep-0436.txt +++ b/pep-0436.txt @@ -190,7 +190,7 @@ It's an error to use dir_fd or follow_symlinks when specifying path as an open file descriptor. -[clinic]*/ + [clinic]*/ This second example shows a minimal Clinic code block, omitting all parameter docstrings and non-significant blank lines:: @@ -225,11 +225,11 @@ curses.window.addch [ + y: int + Y-coordinate. + x: int X-coordinate. - - y: int - Y-coordinate. ] ch: char @@ -240,6 +240,8 @@ Attributes for the character. ] + / + Paint character ch at (y, x) with attributes attr, overwriting any character previously painter at that location. By default, the character position and attributes are the @@ -405,17 +407,25 @@ Establishes the start of an optional "group" of parameters. Note that "groups" may nest inside other "groups". See `Functions With Positional-Only Parameters`_ below. + Note that currently ``[`` is only legal for use in functions + where *all* parameters are marked positional-only, see + ``/`` below. ``]`` Ends an optional "group" of parameters. ``/`` - This hints to Argument Clinic that this function is performance-sensitive, - and that it's acceptable to forego supporting keyword parameters when parsing. - (In early implementations of Clinic, this will switch Clinic from generating - code using ``PyArg_ParseTupleAndKeywords`` to using ``PyArg_ParseTuple``. - The hope is that in the future there will be no appreciable speed difference, - rendering this syntax irrelevant and deprecated but harmless.) + Establishes that all the *proceeding* arguments are + positional-only. For now, Argument Clinic does not + support functions with both positional-only and + non-positional-only arguments; therefore, if ``/`` + is specified for a function, currently it must always + be after the last parameter. Also, Argument Clinic + does not currently support default values for + positional-only parameters. + +(The semantics of ``/`` follow a syntax for positional-only +parameters in Python once proposed by Guido. [5]_ ) Function Docstring @@ -541,8 +551,8 @@ Example possible directives include the production, suppression, or redirection of Clinic output. Also, the -"module" and "class" keywords are actually implemented -as directives. +"module" and "class" keywords are implemented +as directives in the prototype. Python Code @@ -650,7 +660,7 @@ As of this writing, there is a working prototype implementation of Argument Clinic available online (though the syntax may be out of date -as you read this). [7]_ The prototype generates code using the +as you read this). [6]_ The prototype generates code using the existing ``PyArg_Parse`` APIs. It supports translating to all current format units except the mysterious ``"w*"``. Sample functions using Argument Clinic exercise all major features, including positional-only @@ -673,6 +683,32 @@ Notes / TBD =========== +* The DSL currently makes no provision for specifying per-parameter + type annotations. This is something explicitly supported in Python; + it should be supported for builtins too, once we have reflection support. + + It seems to me that the syntax for parameter lines--dictated by + Guido--suggests conversion functions are themselves type annotations. + This makes intuitive sense. But my thought experiments in how to + convert the conversion function specification into a per-parameter + type annotation ranged from obnoxious to toxic; I don't think that + line of thinking will bear fruit. + + Instead, I think wee need to add a new syntax allowing functions + to explicitly specify a per-parameter type annotation. The problem: + what should that syntax be? I've only had one idea so far, and I + don't find it all that appealing: allow a optional second colon + on the parameter line, and the type annotation would be specified... + somewhere, either between the first and second colons, or between + the second colon and the (optional) default. + + Also, I don't think this could specify any arbitrary Python value. + I suspect it would suffer heavy restrictions on what types and + literals it could use. Perhaps the best solution would be to + store the exact string in static data, and have Python evaluate + it on demand? If so, it would be safest to restrict it to Python + literal syntax, permitting no function calls (even to builtins). + * Optimally we'd want Argument Clinic run automatically as part of the normal Python build process. But this presents a bootstrapping problem; if you don't have a system Python 3, you need a Python 3 executable to @@ -735,6 +771,16 @@ socketmodule.c, except for one in _ssl.c. They're all static, specifying the encoding ``"idna"``.) +Acknowledgements +================ + +The PEP author wishes to thank Ned Batchelder for permission to +shamelessly rip off his clever design for Cog--"my favorite tool +that I've never gotten to use". Thanks also to everyone who provided +feedback on the [bugtracker issue] and on python-dev. Special thanks +to Nick Coglan and Guido van Rossum for a rousing two-hour in-person +deep dive on the topic at PyCon US 2013. + References ========== @@ -742,6 +788,8 @@ .. [Cog] ``Cog``: http://nedbatchelder.com/code/cog/ +.. [bugtracker issue] Issue 16612 on the python.org bug tracker: + http://bugs.python.org/issue16612 .. [1] ``PyArg_ParseTuple()``: http://docs.python.org/3/c-api/arg.html#PyArg_ParseTuple @@ -755,13 +803,14 @@ .. [4] Keyword parameters for extension functions: http://docs.python.org/3/extending/extending.html#keyword-parameters-for-extension-functions -.. [5] ``shlex.split()``: - http://docs.python.org/3/library/shlex.html#shlex.split +.. [5] Guido van Rossum, posting to python-ideas, March 2012: + http://mail.python.org/pipermail/python-ideas/2012-March/014364.html + and + http://mail.python.org/pipermail/python-ideas/2012-March/014378.html + and + http://mail.python.org/pipermail/python-ideas/2012-March/014417.html -.. [6] ``PyArg_`` "converter" functions, see ``"O&"`` in this section: - http://docs.python.org/3/c-api/arg.html#other-objects - -.. [7] Argument Clinic prototype: +.. [6] Argument Clinic prototype: https://bitbucket.org/larry/python-clinic/ -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Mon Mar 18 09:59:28 2013 From: python-checkins at python.org (giampaolo.rodola) Date: Mon, 18 Mar 2013 09:59:28 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=28issue_17452_/_ftplib=29?= =?utf-8?q?_fix_TypeError_occurring_in_case_ssl_module_is_not?= Message-ID: <3ZTrtS47bfzMbR@mail.python.org> http://hg.python.org/cpython/rev/0842c5411ed6 changeset: 82729:0842c5411ed6 parent: 82727:59621d4f1171 user: Giampaolo Rodola' date: Mon Mar 18 09:59:15 2013 +0100 summary: (issue 17452 / ftplib) fix TypeError occurring in case ssl module is not installed files: Lib/ftplib.py | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/ftplib.py b/Lib/ftplib.py --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -440,7 +440,7 @@ break callback(data) # shutdown ssl layer - if isinstance(conn, _SSLSocket): + if _SSLSocket is not None and isinstance(conn, _SSLSocket): conn.unwrap() return self.voidresp() @@ -473,7 +473,7 @@ line = line[:-1] callback(line) # shutdown ssl layer - if isinstance(conn, _SSLSocket): + if _SSLSocket is not None and isinstance(conn, _SSLSocket): conn.unwrap() return self.voidresp() @@ -502,7 +502,7 @@ if callback: callback(buf) # shutdown ssl layer - if isinstance(conn, _SSLSocket): + if _SSLSocket is not None and isinstance(conn, _SSLSocket): conn.unwrap() return self.voidresp() @@ -531,7 +531,7 @@ if callback: callback(buf) # shutdown ssl layer - if isinstance(conn, _SSLSocket): + if _SSLSocket is not None and isinstance(conn, _SSLSocket): conn.unwrap() return self.voidresp() -- Repository URL: http://hg.python.org/cpython From ncoghlan at gmail.com Mon Mar 18 16:57:05 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Mon, 18 Mar 2013 08:57:05 -0700 Subject: [Python-checkins] peps: Update for 436, explicitly supporting positional parameters forever, amen. In-Reply-To: <3ZTrcp6hZCzSLM@mail.python.org> References: <3ZTrcp6hZCzSLM@mail.python.org> Message-ID: On Mon, Mar 18, 2013 at 1:47 AM, larry.hastings wrote: > Notes / TBD > =========== > > +* The DSL currently makes no provision for specifying per-parameter > + type annotations. This is something explicitly supported in Python; > + it should be supported for builtins too, once we have reflection support. > + > + It seems to me that the syntax for parameter lines--dictated by > + Guido--suggests conversion functions are themselves type annotations. > + This makes intuitive sense. But my thought experiments in how to > + convert the conversion function specification into a per-parameter > + type annotation ranged from obnoxious to toxic; I don't think that > + line of thinking will bear fruit. > + > + Instead, I think wee need to add a new syntax allowing functions > + to explicitly specify a per-parameter type annotation. The problem: > + what should that syntax be? I've only had one idea so far, and I > + don't find it all that appealing: allow a optional second colon > + on the parameter line, and the type annotation would be specified... > + somewhere, either between the first and second colons, or between > + the second colon and the (optional) default. > + > + Also, I don't think this could specify any arbitrary Python value. > + I suspect it would suffer heavy restrictions on what types and > + literals it could use. Perhaps the best solution would be to > + store the exact string in static data, and have Python evaluate > + it on demand? If so, it would be safest to restrict it to Python > + literal syntax, permitting no function calls (even to builtins). > + I think the hack we're using for the default-as-shown-in-Python will work here as well: use the converter parameterisation notation. Then "pydefault" (I think that is a better name than the current "default") and "pynote" would control what is shown for the conversion in the first line of the docstring and in any future introspection support. If either is not given, then the C default would be passed through as the Python default and the annotation would be left blank. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia From python-checkins at python.org Mon Mar 18 17:24:02 2013 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 18 Mar 2013 17:24:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_remove_extra_e?= Message-ID: <3ZV2lQ1Z7LzSDF@mail.python.org> http://hg.python.org/peps/rev/dee47f9b87a4 changeset: 4806:dee47f9b87a4 user: Benjamin Peterson date: Mon Mar 18 09:23:56 2013 -0700 summary: remove extra e files: pep-0396.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0396.txt b/pep-0396.txt --- a/pep-0396.txt +++ b/pep-0396.txt @@ -44,7 +44,7 @@ the same API to continue to work even though his users now get it from the Cheeseshop. -Carole maintains several namespace packages, each of which are +Carol maintains several namespace packages, each of which are independently developed and distributed. In order for her users to properly specify dependencies on the right versions of her packages, she specifies the version numbers in the namespace package's -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Mon Mar 18 18:10:23 2013 From: python-checkins at python.org (andrew.svetlov) Date: Mon, 18 Mar 2013 18:10:23 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE3NDYz?= =?utf-8?q?=3A_Fix_test_discovery_for_test=5Fpdb=2Epy?= Message-ID: <3ZV3mv50PPzS6q@mail.python.org> http://hg.python.org/cpython/rev/50af6682c6a7 changeset: 82730:50af6682c6a7 branch: 3.3 parent: 82726:3ab80610b2a2 user: Andrew Svetlov date: Mon Mar 18 10:09:50 2013 -0700 summary: Issue #17463: Fix test discovery for test_pdb.py files: Lib/test/test_pdb.py | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -1,5 +1,6 @@ # A test suite for pdb; not very comprehensive at the moment. +import doctest import imp import pdb import sys @@ -701,11 +702,11 @@ support.unlink(support.TESTFN) -def test_main(): +def load_tests(*args): from test import test_pdb - support.run_doctest(test_pdb, verbosity=True) - support.run_unittest(PdbTestCase) + suites = [unittest.makeSuite(PdbTestCase), doctest.DocTestSuite(test_pdb)] + return unittest.TestSuite(suites) if __name__ == '__main__': - test_main() + unittest.main() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 18:10:25 2013 From: python-checkins at python.org (andrew.svetlov) Date: Mon, 18 Mar 2013 18:10:25 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2317463=3A_Fix_test_discovery_for_test=5Fpdb=2Epy?= Message-ID: <3ZV3mx0rH3zSdT@mail.python.org> http://hg.python.org/cpython/rev/30530f6c24bb changeset: 82731:30530f6c24bb parent: 82729:0842c5411ed6 parent: 82730:50af6682c6a7 user: Andrew Svetlov date: Mon Mar 18 10:10:08 2013 -0700 summary: Issue #17463: Fix test discovery for test_pdb.py files: Lib/test/test_pdb.py | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -1,5 +1,6 @@ # A test suite for pdb; not very comprehensive at the moment. +import doctest import imp import pdb import sys @@ -701,11 +702,11 @@ support.unlink(support.TESTFN) -def test_main(): +def load_tests(*args): from test import test_pdb - support.run_doctest(test_pdb, verbosity=True) - support.run_unittest(PdbTestCase) + suites = [unittest.makeSuite(PdbTestCase), doctest.DocTestSuite(test_pdb)] + return unittest.TestSuite(suites) if __name__ == '__main__': - test_main() + unittest.main() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 18:50:19 2013 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 18 Mar 2013 18:50:19 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_unify_some_ast=2Eargument?= =?utf-8?q?=27s_attrs=3B_change_Attribute_column_offset_=28closes_=2316795?= =?utf-8?q?=29?= Message-ID: <3ZV4fz1fRnzSMR@mail.python.org> http://hg.python.org/cpython/rev/7c5c678e4164 changeset: 82732:7c5c678e4164 user: Benjamin Peterson date: Mon Mar 18 10:48:58 2013 -0700 summary: unify some ast.argument's attrs; change Attribute column offset (closes #16795) Patch from Sven Brauch. files: Include/Python-ast.h | 19 +- Lib/test/test_ast.py | 82 ++++++----- Misc/NEWS | 4 + Parser/Python.asdl | 8 +- Parser/asdl.py | 18 ++- Parser/asdl_c.py | 31 ++++- Python/Python-ast.c | 195 ++++++++++++--------------- Python/ast.c | 72 ++++------ Python/compile.c | 12 +- Python/symtable.c | 12 +- Tools/parser/unparse.py | 12 +- 11 files changed, 240 insertions(+), 225 deletions(-) diff --git a/Include/Python-ast.h b/Include/Python-ast.h --- a/Include/Python-ast.h +++ b/Include/Python-ast.h @@ -364,18 +364,18 @@ struct _arguments { asdl_seq *args; - identifier vararg; - expr_ty varargannotation; + arg_ty vararg; asdl_seq *kwonlyargs; - identifier kwarg; - expr_ty kwargannotation; + asdl_seq *kw_defaults; + arg_ty kwarg; asdl_seq *defaults; - asdl_seq *kw_defaults; }; struct _arg { identifier arg; expr_ty annotation; + int lineno; + int col_offset; }; struct _keyword { @@ -550,11 +550,10 @@ excepthandler_ty _Py_ExceptHandler(expr_ty type, identifier name, asdl_seq * body, int lineno, int col_offset, PyArena *arena); -#define arguments(a0, a1, a2, a3, a4, a5, a6, a7, a8) _Py_arguments(a0, a1, a2, a3, a4, a5, a6, a7, a8) -arguments_ty _Py_arguments(asdl_seq * args, identifier vararg, expr_ty - varargannotation, asdl_seq * kwonlyargs, identifier - kwarg, expr_ty kwargannotation, asdl_seq * defaults, - asdl_seq * kw_defaults, PyArena *arena); +#define arguments(a0, a1, a2, a3, a4, a5, a6) _Py_arguments(a0, a1, a2, a3, a4, a5, a6) +arguments_ty _Py_arguments(asdl_seq * args, arg_ty vararg, asdl_seq * + kwonlyargs, asdl_seq * kw_defaults, arg_ty kwarg, + asdl_seq * defaults, PyArena *arena); #define arg(a0, a1, a2) _Py_arg(a0, a1, a2) arg_ty _Py_arg(identifier arg, expr_ty annotation, PyArena *arena); #define keyword(a0, a1, a2) _Py_keyword(a0, a1, a2) diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -180,20 +180,36 @@ class AST_Tests(unittest.TestCase): - def _assertTrueorder(self, ast_node, parent_pos): + def _assertTrueorder(self, ast_node, parent_pos, reverse_check = False): + def should_reverse_check(parent, child): + # In some situations, the children of nodes occur before + # their parents, for example in a.b.c, a occurs before b + # but a is a child of b. + if isinstance(parent, ast.Call): + if parent.func == child: + return True + if isinstance(parent, (ast.Attribute, ast.Subscript)): + return True + return False + if not isinstance(ast_node, ast.AST) or ast_node._fields is None: return if isinstance(ast_node, (ast.expr, ast.stmt, ast.excepthandler)): node_pos = (ast_node.lineno, ast_node.col_offset) - self.assertTrue(node_pos >= parent_pos) + if reverse_check: + self.assertTrue(node_pos <= parent_pos) + else: + self.assertTrue(node_pos >= parent_pos) parent_pos = (ast_node.lineno, ast_node.col_offset) for name in ast_node._fields: value = getattr(ast_node, name) if isinstance(value, list): for child in value: - self._assertTrueorder(child, parent_pos) + self._assertTrueorder(child, parent_pos, + should_reverse_check(ast_node, child)) elif value is not None: - self._assertTrueorder(value, parent_pos) + self._assertTrueorder(value, parent_pos, + should_reverse_check(ast_node, value)) def test_AST_objects(self): x = ast.AST() @@ -262,14 +278,14 @@ def test_arguments(self): x = ast.arguments() - self.assertEqual(x._fields, ('args', 'vararg', 'varargannotation', - 'kwonlyargs', 'kwarg', 'kwargannotation', - 'defaults', 'kw_defaults')) + self.assertEqual(x._fields, ('args', 'vararg', + 'kwonlyargs', 'kw_defaults', + 'kwarg', 'defaults')) with self.assertRaises(AttributeError): x.vararg - x = ast.arguments(*range(1, 9)) + x = ast.arguments(*range(1, 7)) self.assertEqual(x.vararg, 2) def test_field_attr_writable(self): @@ -439,7 +455,7 @@ "lineno=1, col_offset=0), args=[Name(id='eggs', ctx=Load(), " "lineno=1, col_offset=5), Str(s='and cheese', lineno=1, " "col_offset=11)], keywords=[], starargs=None, kwargs=None, " - "lineno=1, col_offset=0), lineno=1, col_offset=0)])" + "lineno=1, col_offset=4), lineno=1, col_offset=0)])" ) def test_copy_location(self): @@ -460,7 +476,7 @@ "Module(body=[Expr(value=Call(func=Name(id='write', ctx=Load(), " "lineno=1, col_offset=0), args=[Str(s='spam', lineno=1, " "col_offset=6)], keywords=[], starargs=None, kwargs=None, " - "lineno=1, col_offset=0), lineno=1, col_offset=0), " + "lineno=1, col_offset=5), lineno=1, col_offset=0), " "Expr(value=Call(func=Name(id='spam', ctx=Load(), lineno=1, " "col_offset=0), args=[Str(s='eggs', lineno=1, col_offset=0)], " "keywords=[], starargs=None, kwargs=None, lineno=1, " @@ -560,8 +576,8 @@ self.mod(m, "must have Load context", "eval") def _check_arguments(self, fac, check): - def arguments(args=None, vararg=None, varargannotation=None, - kwonlyargs=None, kwarg=None, kwargannotation=None, + def arguments(args=None, vararg=None, + kwonlyargs=None, kwarg=None, defaults=None, kw_defaults=None): if args is None: args = [] @@ -571,20 +587,12 @@ defaults = [] if kw_defaults is None: kw_defaults = [] - args = ast.arguments(args, vararg, varargannotation, kwonlyargs, - kwarg, kwargannotation, defaults, kw_defaults) + args = ast.arguments(args, vararg, kwonlyargs, kw_defaults, + kwarg, defaults) return fac(args) args = [ast.arg("x", ast.Name("x", ast.Store()))] check(arguments(args=args), "must have Load context") - check(arguments(varargannotation=ast.Num(3)), - "varargannotation but no vararg") - check(arguments(varargannotation=ast.Name("x", ast.Store()), vararg="x"), - "must have Load context") check(arguments(kwonlyargs=args), "must have Load context") - check(arguments(kwargannotation=ast.Num(42)), - "kwargannotation but no kwarg") - check(arguments(kwargannotation=ast.Name("x", ast.Store()), - kwarg="x"), "must have Load context") check(arguments(defaults=[ast.Num(3)]), "more positional defaults than args") check(arguments(kw_defaults=[ast.Num(4)]), @@ -599,7 +607,7 @@ "must have Load context") def test_funcdef(self): - a = ast.arguments([], None, None, [], None, None, [], []) + a = ast.arguments([], None, [], [], None, []) f = ast.FunctionDef("x", a, [], [], None) self.stmt(f, "empty body on FunctionDef") f = ast.FunctionDef("x", a, [ast.Pass()], [ast.Name("x", ast.Store())], @@ -770,7 +778,7 @@ self.expr(u, "must have Load context") def test_lambda(self): - a = ast.arguments([], None, None, [], None, None, [], []) + a = ast.arguments([], None, [], [], None, []) self.expr(ast.Lambda(a, ast.Name("x", ast.Store())), "must have Load context") def fac(args): @@ -963,15 +971,15 @@ #### EVERYTHING BELOW IS GENERATED ##### exec_results = [ ('Module', [('Expr', (1, 0), ('NameConstant', (1, 0), None))]), -('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, None, [], None, None, [], []), [('Pass', (1, 9))], [], None)]), -('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', 'a', None)], None, None, [], None, None, [], []), [('Pass', (1, 10))], [], None)]), -('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', 'a', None)], None, None, [], None, None, [('Num', (1, 8), 0)], []), [('Pass', (1, 12))], [], None)]), -('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], 'args', None, [], None, None, [], []), [('Pass', (1, 14))], [], None)]), -('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, None, [], 'kwargs', None, [], []), [('Pass', (1, 17))], [], None)]), -('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', 'a', None), ('arg', 'b', None), ('arg', 'c', None), ('arg', 'd', None), ('arg', 'e', None)], 'args', None, [], 'kwargs', None, [('Num', (1, 11), 1), ('NameConstant', (1, 16), None), ('List', (1, 24), [], ('Load',)), ('Dict', (1, 30), [], [])], []), [('Pass', (1, 52))], [], None)]), +('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('Pass', (1, 9))], [], None)]), +('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6), 'a', None)], None, [], [], None, []), [('Pass', (1, 10))], [], None)]), +('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6), 'a', None)], None, [], [], None, [('Num', (1, 8), 0)]), [('Pass', (1, 12))], [], None)]), +('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], ('arg', (1, 7), 'args', None), [], [], None, []), [('Pass', (1, 14))], [], None)]), +('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], ('arg', (1, 8), 'kwargs', None), []), [('Pass', (1, 17))], [], None)]), +('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6), 'a', None), ('arg', (1, 9), 'b', None), ('arg', (1, 14), 'c', None), ('arg', (1, 22), 'd', None), ('arg', (1, 28), 'e', None)], ('arg', (1, 35), 'args', None), [], [], ('arg', (1, 43), 'kwargs', None), [('Num', (1, 11), 1), ('NameConstant', (1, 16), None), ('List', (1, 24), [], ('Load',)), ('Dict', (1, 30), [], [])]), [('Pass', (1, 52))], [], None)]), ('Module', [('ClassDef', (1, 0), 'C', [], [], None, None, [('Pass', (1, 8))], [])]), ('Module', [('ClassDef', (1, 0), 'C', [('Name', (1, 8), 'object', ('Load',))], [], None, None, [('Pass', (1, 17))], [])]), -('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, None, [], None, None, [], []), [('Return', (1, 8), ('Num', (1, 15), 1))], [], None)]), +('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('Return', (1, 8), ('Num', (1, 15), 1))], [], None)]), ('Module', [('Delete', (1, 0), [('Name', (1, 4), 'v', ('Del',))])]), ('Module', [('Assign', (1, 0), [('Name', (1, 0), 'v', ('Store',))], ('Num', (1, 4), 1))]), ('Module', [('AugAssign', (1, 0), ('Name', (1, 0), 'v', ('Store',)), ('Add',), ('Num', (1, 5), 1))]), @@ -980,7 +988,7 @@ ('Module', [('If', (1, 0), ('Name', (1, 3), 'v', ('Load',)), [('Pass', (1, 5))], [])]), ('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',)))], [('Pass', (1, 13))])]), ('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',))), ('withitem', ('Name', (1, 13), 'z', ('Load',)), ('Name', (1, 18), 'q', ('Store',)))], [('Pass', (1, 21))])]), -('Module', [('Raise', (1, 0), ('Call', (1, 6), ('Name', (1, 6), 'Exception', ('Load',)), [('Str', (1, 16), 'string')], [], None, None), None)]), +('Module', [('Raise', (1, 0), ('Call', (1, 15), ('Name', (1, 6), 'Exception', ('Load',)), [('Str', (1, 16), 'string')], [], None, None), None)]), ('Module', [('Try', (1, 0), [('Pass', (2, 2))], [('ExceptHandler', (3, 0), ('Name', (3, 7), 'Exception', ('Load',)), None, [('Pass', (4, 2))])], [], [])]), ('Module', [('Try', (1, 0), [('Pass', (2, 2))], [], [], [('Pass', (4, 2))])]), ('Module', [('Assert', (1, 0), ('Name', (1, 7), 'v', ('Load',)), None)]), @@ -1009,7 +1017,7 @@ ('Expression', ('BoolOp', (1, 0), ('And',), [('Name', (1, 0), 'a', ('Load',)), ('Name', (1, 6), 'b', ('Load',))])), ('Expression', ('BinOp', (1, 0), ('Name', (1, 0), 'a', ('Load',)), ('Add',), ('Name', (1, 4), 'b', ('Load',)))), ('Expression', ('UnaryOp', (1, 0), ('Not',), ('Name', (1, 4), 'v', ('Load',)))), -('Expression', ('Lambda', (1, 0), ('arguments', [], None, None, [], None, None, [], []), ('NameConstant', (1, 7), None))), +('Expression', ('Lambda', (1, 0), ('arguments', [], None, [], [], None, []), ('NameConstant', (1, 7), None))), ('Expression', ('Dict', (1, 0), [('Num', (1, 2), 1)], [('Num', (1, 4), 2)])), ('Expression', ('Dict', (1, 0), [], [])), ('Expression', ('Set', (1, 0), [('NameConstant', (1, 1), None)])), @@ -1017,17 +1025,17 @@ ('Expression', ('ListComp', (1, 1), ('Name', (1, 1), 'a', ('Load',)), [('comprehension', ('Name', (1, 7), 'b', ('Store',)), ('Name', (1, 12), 'c', ('Load',)), [('Name', (1, 17), 'd', ('Load',))])])), ('Expression', ('GeneratorExp', (1, 1), ('Name', (1, 1), 'a', ('Load',)), [('comprehension', ('Name', (1, 7), 'b', ('Store',)), ('Name', (1, 12), 'c', ('Load',)), [('Name', (1, 17), 'd', ('Load',))])])), ('Expression', ('Compare', (1, 0), ('Num', (1, 0), 1), [('Lt',), ('Lt',)], [('Num', (1, 4), 2), ('Num', (1, 8), 3)])), -('Expression', ('Call', (1, 0), ('Name', (1, 0), 'f', ('Load',)), [('Num', (1, 2), 1), ('Num', (1, 4), 2)], [('keyword', 'c', ('Num', (1, 8), 3))], ('Name', (1, 11), 'd', ('Load',)), ('Name', (1, 15), 'e', ('Load',)))), +('Expression', ('Call', (1, 1), ('Name', (1, 0), 'f', ('Load',)), [('Num', (1, 2), 1), ('Num', (1, 4), 2)], [('keyword', 'c', ('Num', (1, 8), 3))], ('Name', (1, 11), 'd', ('Load',)), ('Name', (1, 15), 'e', ('Load',)))), ('Expression', ('Num', (1, 0), 10)), ('Expression', ('Str', (1, 0), 'string')), -('Expression', ('Attribute', (1, 0), ('Name', (1, 0), 'a', ('Load',)), 'b', ('Load',))), -('Expression', ('Subscript', (1, 0), ('Name', (1, 0), 'a', ('Load',)), ('Slice', ('Name', (1, 2), 'b', ('Load',)), ('Name', (1, 4), 'c', ('Load',)), None), ('Load',))), +('Expression', ('Attribute', (1, 2), ('Name', (1, 0), 'a', ('Load',)), 'b', ('Load',))), +('Expression', ('Subscript', (1, 2), ('Name', (1, 0), 'a', ('Load',)), ('Slice', ('Name', (1, 2), 'b', ('Load',)), ('Name', (1, 4), 'c', ('Load',)), None), ('Load',))), ('Expression', ('Name', (1, 0), 'v', ('Load',))), ('Expression', ('List', (1, 0), [('Num', (1, 1), 1), ('Num', (1, 3), 2), ('Num', (1, 5), 3)], ('Load',))), ('Expression', ('List', (1, 0), [], ('Load',))), ('Expression', ('Tuple', (1, 0), [('Num', (1, 0), 1), ('Num', (1, 2), 2), ('Num', (1, 4), 3)], ('Load',))), ('Expression', ('Tuple', (1, 1), [('Num', (1, 1), 1), ('Num', (1, 3), 2), ('Num', (1, 5), 3)], ('Load',))), ('Expression', ('Tuple', (1, 0), [], ('Load',))), -('Expression', ('Call', (1, 0), ('Attribute', (1, 0), ('Attribute', (1, 0), ('Attribute', (1, 0), ('Name', (1, 0), 'a', ('Load',)), 'b', ('Load',)), 'c', ('Load',)), 'd', ('Load',)), [('Subscript', (1, 8), ('Attribute', (1, 8), ('Name', (1, 8), 'a', ('Load',)), 'b', ('Load',)), ('Slice', ('Num', (1, 12), 1), ('Num', (1, 14), 2), None), ('Load',))], [], None, None)), +('Expression', ('Call', (1, 7), ('Attribute', (1, 6), ('Attribute', (1, 4), ('Attribute', (1, 2), ('Name', (1, 0), 'a', ('Load',)), 'b', ('Load',)), 'c', ('Load',)), 'd', ('Load',)), [('Subscript', (1, 12), ('Attribute', (1, 10), ('Name', (1, 8), 'a', ('Load',)), 'b', ('Load',)), ('Slice', ('Num', (1, 12), 1), ('Num', (1, 14), 2), None), ('Load',))], [], None, None)), ] main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #16795: On the ast.arguments object, unify vararg with varargannotation + and kwarg and kwargannotation. Change the column offset of ast.Attribute to be + at the attribute name. + - Issue #17434: Properly raise a SyntaxError when a string occurs between future imports. diff --git a/Parser/Python.asdl b/Parser/Python.asdl --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -103,11 +103,11 @@ excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body) attributes (int lineno, int col_offset) - arguments = (arg* args, identifier? vararg, expr? varargannotation, - arg* kwonlyargs, identifier? kwarg, - expr? kwargannotation, expr* defaults, - expr* kw_defaults) + arguments = (arg* args, arg? vararg, arg* kwonlyargs, expr* kw_defaults, + arg? kwarg, expr* defaults) + arg = (identifier arg, expr? annotation) + attributes (int lineno, int col_offset) -- keyword arguments supplied to call keyword = (identifier arg, expr value) diff --git a/Parser/asdl.py b/Parser/asdl.py --- a/Parser/asdl.py +++ b/Parser/asdl.py @@ -158,11 +158,19 @@ msg="expected attributes, found %s" % id) return Sum(sum, attributes) - def p_product(self, info): + def p_product_0(self, info): " product ::= ( fields ) " _0, fields, _1 = info return Product(fields) + def p_product_1(self, info): + " product ::= ( fields ) Id ( fields ) " + _0, fields, _1, id, _2, attributes, _3 = info + if id.value != "attributes": + raise ASDLSyntaxError(id.lineno, + msg="expected attributes, found %s" % id) + return Product(fields, attributes) + def p_sum_0(self, constructor): " sum ::= constructor " return [constructor[0]] @@ -289,11 +297,15 @@ return "Sum(%s, %s)" % (self.types, self.attributes) class Product(AST): - def __init__(self, fields): + def __init__(self, fields, attributes=None): self.fields = fields + self.attributes = attributes or [] def __repr__(self): - return "Product(%s)" % self.fields + if self.attributes is None: + return "Product(%s)" % self.fields + else: + return "Product(%s, %s)" % (self.fields, self.attributes) class VisitorBase(object): diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -209,6 +209,11 @@ self.emit("struct _%(name)s {" % locals(), depth) for f in product.fields: self.visit(f, depth + 1) + for field in product.attributes: + # rudimentary attribute handling + type = str(field.type) + assert type in asdl.builtin_types, type + self.emit("%s %s;" % (type, field.name), depth + 1); self.emit("};", depth) self.emit("", depth) @@ -493,7 +498,13 @@ def visitField(self, field, name, sum=None, prod=None, depth=0): ctype = get_c_type(field.type) - self.emit("if (_PyObject_HasAttrId(obj, &PyId_%s)) {" % field.name, depth) + if field.opt: + add_check = " && _PyObject_GetAttrId(obj, &PyId_%s) != Py_None" \ + % (field.name) + else: + add_check = str() + self.emit("if (_PyObject_HasAttrId(obj, &PyId_%s)%s) {" + % (field.name, add_check), depth, reflow=False) self.emit("int res;", depth+1) if field.seq: self.emit("Py_ssize_t len;", depth+1) @@ -559,6 +570,13 @@ def visitProduct(self, prod, name): self.emit("static PyTypeObject *%s_type;" % name, 0) self.emit("static PyObject* ast2obj_%s(void*);" % name, 0) + if prod.attributes: + for a in prod.attributes: + self.emit_identifier(a.name) + self.emit("static char *%s_attributes[] = {" % name, 0) + for a in prod.attributes: + self.emit('"%s",' % a.name, 1) + self.emit("};", 0) if prod.fields: for f in prod.fields: self.emit_identifier(f.name) @@ -934,6 +952,11 @@ self.emit('%s_type = make_type("%s", &AST_type, %s, %d);' % (name, name, fields, len(prod.fields)), 1) self.emit("if (!%s_type) return 0;" % name, 1) + if prod.attributes: + self.emit("if (!add_attributes(%s_type, %s_attributes, %d)) return 0;" % + (name, name, len(prod.attributes)), 1) + else: + self.emit("if (!add_attributes(%s_type, NULL, 0)) return 0;" % name, 1) def visitSum(self, sum, name): self.emit('%s_type = make_type("%s", &AST_type, NULL, 0);' % @@ -1089,6 +1112,12 @@ self.emit("if (!result) return NULL;", 1) for field in prod.fields: self.visitField(field, name, 1, True) + for a in prod.attributes: + self.emit("value = ast2obj_%s(o->%s);" % (a.type, a.name), 1) + self.emit("if (!value) goto failed;", 1) + self.emit('if (_PyObject_SetAttrId(result, &PyId_%s, value) < 0)' % a.name, 1) + self.emit('goto failed;', 2) + self.emit('Py_DECREF(value);', 1) self.func_end() def visitConstructor(self, cons, enum, name): diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -412,24 +412,24 @@ static PyTypeObject *arguments_type; static PyObject* ast2obj_arguments(void*); _Py_IDENTIFIER(vararg); -_Py_IDENTIFIER(varargannotation); _Py_IDENTIFIER(kwonlyargs); +_Py_IDENTIFIER(kw_defaults); _Py_IDENTIFIER(kwarg); -_Py_IDENTIFIER(kwargannotation); _Py_IDENTIFIER(defaults); -_Py_IDENTIFIER(kw_defaults); static char *arguments_fields[]={ "args", "vararg", - "varargannotation", "kwonlyargs", + "kw_defaults", "kwarg", - "kwargannotation", "defaults", - "kw_defaults", }; static PyTypeObject *arg_type; static PyObject* ast2obj_arg(void*); +static char *arg_attributes[] = { + "lineno", + "col_offset", +}; _Py_IDENTIFIER(arg); _Py_IDENTIFIER(annotation); static char *arg_fields[]={ @@ -1056,6 +1056,7 @@ comprehension_type = make_type("comprehension", &AST_type, comprehension_fields, 3); if (!comprehension_type) return 0; + if (!add_attributes(comprehension_type, NULL, 0)) return 0; excepthandler_type = make_type("excepthandler", &AST_type, NULL, 0); if (!excepthandler_type) return 0; if (!add_attributes(excepthandler_type, excepthandler_attributes, 2)) @@ -1063,16 +1064,21 @@ ExceptHandler_type = make_type("ExceptHandler", excepthandler_type, ExceptHandler_fields, 3); if (!ExceptHandler_type) return 0; - arguments_type = make_type("arguments", &AST_type, arguments_fields, 8); + arguments_type = make_type("arguments", &AST_type, arguments_fields, 6); if (!arguments_type) return 0; + if (!add_attributes(arguments_type, NULL, 0)) return 0; arg_type = make_type("arg", &AST_type, arg_fields, 2); if (!arg_type) return 0; + if (!add_attributes(arg_type, arg_attributes, 2)) return 0; keyword_type = make_type("keyword", &AST_type, keyword_fields, 2); if (!keyword_type) return 0; + if (!add_attributes(keyword_type, NULL, 0)) return 0; alias_type = make_type("alias", &AST_type, alias_fields, 2); if (!alias_type) return 0; + if (!add_attributes(alias_type, NULL, 0)) return 0; withitem_type = make_type("withitem", &AST_type, withitem_fields, 2); if (!withitem_type) return 0; + if (!add_attributes(withitem_type, NULL, 0)) return 0; initialized = 1; return 1; } @@ -2213,9 +2219,8 @@ } arguments_ty -arguments(asdl_seq * args, identifier vararg, expr_ty varargannotation, - asdl_seq * kwonlyargs, identifier kwarg, expr_ty kwargannotation, - asdl_seq * defaults, asdl_seq * kw_defaults, PyArena *arena) +arguments(asdl_seq * args, arg_ty vararg, asdl_seq * kwonlyargs, asdl_seq * + kw_defaults, arg_ty kwarg, asdl_seq * defaults, PyArena *arena) { arguments_ty p; p = (arguments_ty)PyArena_Malloc(arena, sizeof(*p)); @@ -2223,12 +2228,10 @@ return NULL; p->args = args; p->vararg = vararg; - p->varargannotation = varargannotation; p->kwonlyargs = kwonlyargs; + p->kw_defaults = kw_defaults; p->kwarg = kwarg; - p->kwargannotation = kwargannotation; p->defaults = defaults; - p->kw_defaults = kw_defaults; return p; } @@ -3413,41 +3416,31 @@ if (_PyObject_SetAttrId(result, &PyId_args, value) == -1) goto failed; Py_DECREF(value); - value = ast2obj_identifier(o->vararg); + value = ast2obj_arg(o->vararg); if (!value) goto failed; if (_PyObject_SetAttrId(result, &PyId_vararg, value) == -1) goto failed; Py_DECREF(value); - value = ast2obj_expr(o->varargannotation); - if (!value) goto failed; - if (_PyObject_SetAttrId(result, &PyId_varargannotation, value) == -1) - goto failed; - Py_DECREF(value); value = ast2obj_list(o->kwonlyargs, ast2obj_arg); if (!value) goto failed; if (_PyObject_SetAttrId(result, &PyId_kwonlyargs, value) == -1) goto failed; Py_DECREF(value); - value = ast2obj_identifier(o->kwarg); + value = ast2obj_list(o->kw_defaults, ast2obj_expr); + if (!value) goto failed; + if (_PyObject_SetAttrId(result, &PyId_kw_defaults, value) == -1) + goto failed; + Py_DECREF(value); + value = ast2obj_arg(o->kwarg); if (!value) goto failed; if (_PyObject_SetAttrId(result, &PyId_kwarg, value) == -1) goto failed; Py_DECREF(value); - value = ast2obj_expr(o->kwargannotation); - if (!value) goto failed; - if (_PyObject_SetAttrId(result, &PyId_kwargannotation, value) == -1) - goto failed; - Py_DECREF(value); value = ast2obj_list(o->defaults, ast2obj_expr); if (!value) goto failed; if (_PyObject_SetAttrId(result, &PyId_defaults, value) == -1) goto failed; Py_DECREF(value); - value = ast2obj_list(o->kw_defaults, ast2obj_expr); - if (!value) goto failed; - if (_PyObject_SetAttrId(result, &PyId_kw_defaults, value) == -1) - goto failed; - Py_DECREF(value); return result; failed: Py_XDECREF(value); @@ -3477,6 +3470,16 @@ if (_PyObject_SetAttrId(result, &PyId_annotation, value) == -1) goto failed; Py_DECREF(value); + value = ast2obj_int(o->lineno); + if (!value) goto failed; + if (_PyObject_SetAttrId(result, &PyId_lineno, value) < 0) + goto failed; + Py_DECREF(value); + value = ast2obj_int(o->col_offset); + if (!value) goto failed; + if (_PyObject_SetAttrId(result, &PyId_col_offset, value) < 0) + goto failed; + Py_DECREF(value); return result; failed: Py_XDECREF(value); @@ -3843,7 +3846,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"decorator_list\" missing from FunctionDef"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_returns)) { + if (_PyObject_HasAttrId(obj, &PyId_returns) && _PyObject_GetAttrId(obj, &PyId_returns) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_returns); if (tmp == NULL) goto failed; @@ -3934,7 +3937,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"keywords\" missing from ClassDef"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_starargs)) { + if (_PyObject_HasAttrId(obj, &PyId_starargs) && _PyObject_GetAttrId(obj, &PyId_starargs) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_starargs); if (tmp == NULL) goto failed; @@ -3945,7 +3948,7 @@ } else { starargs = NULL; } - if (_PyObject_HasAttrId(obj, &PyId_kwargs)) { + if (_PyObject_HasAttrId(obj, &PyId_kwargs) && _PyObject_GetAttrId(obj, &PyId_kwargs) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_kwargs); if (tmp == NULL) goto failed; @@ -4018,7 +4021,7 @@ if (isinstance) { expr_ty value; - if (_PyObject_HasAttrId(obj, &PyId_value)) { + if (_PyObject_HasAttrId(obj, &PyId_value) && _PyObject_GetAttrId(obj, &PyId_value) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_value); if (tmp == NULL) goto failed; @@ -4476,7 +4479,7 @@ expr_ty exc; expr_ty cause; - if (_PyObject_HasAttrId(obj, &PyId_exc)) { + if (_PyObject_HasAttrId(obj, &PyId_exc) && _PyObject_GetAttrId(obj, &PyId_exc) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_exc); if (tmp == NULL) goto failed; @@ -4487,7 +4490,7 @@ } else { exc = NULL; } - if (_PyObject_HasAttrId(obj, &PyId_cause)) { + if (_PyObject_HasAttrId(obj, &PyId_cause) && _PyObject_GetAttrId(obj, &PyId_cause) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_cause); if (tmp == NULL) goto failed; @@ -4637,7 +4640,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from Assert"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_msg)) { + if (_PyObject_HasAttrId(obj, &PyId_msg) && _PyObject_GetAttrId(obj, &PyId_msg) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_msg); if (tmp == NULL) goto failed; @@ -4697,7 +4700,7 @@ asdl_seq* names; int level; - if (_PyObject_HasAttrId(obj, &PyId_module)) { + if (_PyObject_HasAttrId(obj, &PyId_module) && _PyObject_GetAttrId(obj, &PyId_module) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_module); if (tmp == NULL) goto failed; @@ -4733,7 +4736,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from ImportFrom"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_level)) { + if (_PyObject_HasAttrId(obj, &PyId_level) && _PyObject_GetAttrId(obj, &PyId_level) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_level); if (tmp == NULL) goto failed; @@ -5452,7 +5455,7 @@ if (isinstance) { expr_ty value; - if (_PyObject_HasAttrId(obj, &PyId_value)) { + if (_PyObject_HasAttrId(obj, &PyId_value) && _PyObject_GetAttrId(obj, &PyId_value) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_value); if (tmp == NULL) goto failed; @@ -5639,7 +5642,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"keywords\" missing from Call"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_starargs)) { + if (_PyObject_HasAttrId(obj, &PyId_starargs) && _PyObject_GetAttrId(obj, &PyId_starargs) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_starargs); if (tmp == NULL) goto failed; @@ -5650,7 +5653,7 @@ } else { starargs = NULL; } - if (_PyObject_HasAttrId(obj, &PyId_kwargs)) { + if (_PyObject_HasAttrId(obj, &PyId_kwargs) && _PyObject_GetAttrId(obj, &PyId_kwargs) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_kwargs); if (tmp == NULL) goto failed; @@ -6121,7 +6124,7 @@ expr_ty upper; expr_ty step; - if (_PyObject_HasAttrId(obj, &PyId_lower)) { + if (_PyObject_HasAttrId(obj, &PyId_lower) && _PyObject_GetAttrId(obj, &PyId_lower) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_lower); if (tmp == NULL) goto failed; @@ -6132,7 +6135,7 @@ } else { lower = NULL; } - if (_PyObject_HasAttrId(obj, &PyId_upper)) { + if (_PyObject_HasAttrId(obj, &PyId_upper) && _PyObject_GetAttrId(obj, &PyId_upper) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_upper); if (tmp == NULL) goto failed; @@ -6143,7 +6146,7 @@ } else { upper = NULL; } - if (_PyObject_HasAttrId(obj, &PyId_step)) { + if (_PyObject_HasAttrId(obj, &PyId_step) && _PyObject_GetAttrId(obj, &PyId_step) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_step); if (tmp == NULL) goto failed; @@ -6598,7 +6601,7 @@ identifier name; asdl_seq* body; - if (_PyObject_HasAttrId(obj, &PyId_type)) { + if (_PyObject_HasAttrId(obj, &PyId_type) && _PyObject_GetAttrId(obj, &PyId_type) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_type); if (tmp == NULL) goto failed; @@ -6609,7 +6612,7 @@ } else { type = NULL; } - if (_PyObject_HasAttrId(obj, &PyId_name)) { + if (_PyObject_HasAttrId(obj, &PyId_name) && _PyObject_GetAttrId(obj, &PyId_name) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_name); if (tmp == NULL) goto failed; @@ -6662,13 +6665,11 @@ { PyObject* tmp = NULL; asdl_seq* args; - identifier vararg; - expr_ty varargannotation; + arg_ty vararg; asdl_seq* kwonlyargs; - identifier kwarg; - expr_ty kwargannotation; + asdl_seq* kw_defaults; + arg_ty kwarg; asdl_seq* defaults; - asdl_seq* kw_defaults; if (_PyObject_HasAttrId(obj, &PyId_args)) { int res; @@ -6695,28 +6696,17 @@ PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from arguments"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_vararg)) { + if (_PyObject_HasAttrId(obj, &PyId_vararg) && _PyObject_GetAttrId(obj, &PyId_vararg) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_vararg); if (tmp == NULL) goto failed; - res = obj2ast_identifier(tmp, &vararg, arena); + res = obj2ast_arg(tmp, &vararg, arena); if (res != 0) goto failed; Py_XDECREF(tmp); tmp = NULL; } else { vararg = NULL; } - if (_PyObject_HasAttrId(obj, &PyId_varargannotation)) { - int res; - tmp = _PyObject_GetAttrId(obj, &PyId_varargannotation); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &varargannotation, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - varargannotation = NULL; - } if (_PyObject_HasAttrId(obj, &PyId_kwonlyargs)) { int res; Py_ssize_t len; @@ -6742,28 +6732,42 @@ PyErr_SetString(PyExc_TypeError, "required field \"kwonlyargs\" missing from arguments"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_kwarg)) { + if (_PyObject_HasAttrId(obj, &PyId_kw_defaults)) { + int res; + Py_ssize_t len; + Py_ssize_t i; + tmp = _PyObject_GetAttrId(obj, &PyId_kw_defaults); + if (tmp == NULL) goto failed; + if (!PyList_Check(tmp)) { + PyErr_Format(PyExc_TypeError, "arguments field \"kw_defaults\" must be a list, not a %.200s", tmp->ob_type->tp_name); + goto failed; + } + len = PyList_GET_SIZE(tmp); + kw_defaults = asdl_seq_new(len, arena); + if (kw_defaults == NULL) goto failed; + for (i = 0; i < len; i++) { + expr_ty value; + res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); + if (res != 0) goto failed; + asdl_seq_SET(kw_defaults, i, value); + } + Py_XDECREF(tmp); + tmp = NULL; + } else { + PyErr_SetString(PyExc_TypeError, "required field \"kw_defaults\" missing from arguments"); + return 1; + } + if (_PyObject_HasAttrId(obj, &PyId_kwarg) && _PyObject_GetAttrId(obj, &PyId_kwarg) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_kwarg); if (tmp == NULL) goto failed; - res = obj2ast_identifier(tmp, &kwarg, arena); + res = obj2ast_arg(tmp, &kwarg, arena); if (res != 0) goto failed; Py_XDECREF(tmp); tmp = NULL; } else { kwarg = NULL; } - if (_PyObject_HasAttrId(obj, &PyId_kwargannotation)) { - int res; - tmp = _PyObject_GetAttrId(obj, &PyId_kwargannotation); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &kwargannotation, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - kwargannotation = NULL; - } if (_PyObject_HasAttrId(obj, &PyId_defaults)) { int res; Py_ssize_t len; @@ -6789,33 +6793,8 @@ PyErr_SetString(PyExc_TypeError, "required field \"defaults\" missing from arguments"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_kw_defaults)) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = _PyObject_GetAttrId(obj, &PyId_kw_defaults); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "arguments field \"kw_defaults\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - kw_defaults = asdl_seq_new(len, arena); - if (kw_defaults == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(kw_defaults, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"kw_defaults\" missing from arguments"); - return 1; - } - *out = arguments(args, vararg, varargannotation, kwonlyargs, kwarg, - kwargannotation, defaults, kw_defaults, arena); + *out = arguments(args, vararg, kwonlyargs, kw_defaults, kwarg, + defaults, arena); return 0; failed: Py_XDECREF(tmp); @@ -6841,7 +6820,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"arg\" missing from arg"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_annotation)) { + if (_PyObject_HasAttrId(obj, &PyId_annotation) && _PyObject_GetAttrId(obj, &PyId_annotation) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_annotation); if (tmp == NULL) goto failed; @@ -6916,7 +6895,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from alias"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_asname)) { + if (_PyObject_HasAttrId(obj, &PyId_asname) && _PyObject_GetAttrId(obj, &PyId_asname) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_asname); if (tmp == NULL) goto failed; @@ -6953,7 +6932,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"context_expr\" missing from withitem"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_optional_vars)) { + if (_PyObject_HasAttrId(obj, &PyId_optional_vars) && _PyObject_GetAttrId(obj, &PyId_optional_vars) != Py_None) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_optional_vars); if (tmp == NULL) goto failed; diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -109,22 +109,14 @@ { if (!validate_args(args->args)) return 0; - if (args->varargannotation) { - if (!args->vararg) { - PyErr_SetString(PyExc_ValueError, "varargannotation but no vararg on arguments"); - return 0; - } - if (!validate_expr(args->varargannotation, Load)) + if (args->vararg && args->vararg->annotation + && !validate_expr(args->vararg->annotation, Load)) { return 0; } if (!validate_args(args->kwonlyargs)) return 0; - if (args->kwargannotation) { - if (!args->kwarg) { - PyErr_SetString(PyExc_ValueError, "kwargannotation but no kwarg on arguments"); - return 0; - } - if (!validate_expr(args->kwargannotation, Load)) + if (args->kwarg && args->kwarg->annotation + && !validate_expr(args->kwarg->annotation, Load)) { return 0; } if (asdl_seq_LEN(args->defaults) > asdl_seq_LEN(args->args)) { @@ -1138,7 +1130,13 @@ return NULL; } - return arg(name, annotation, c->c_arena); + arg_ty tmp = arg(name, annotation, c->c_arena); + if (!tmp) + return NULL; + + tmp->lineno = LINENO(n); + tmp->col_offset = n->n_col_offset; + return tmp; } /* returns -1 if failed to handle keyword only arguments @@ -1234,15 +1232,13 @@ int i, j, k, nposargs = 0, nkwonlyargs = 0; int nposdefaults = 0, found_default = 0; asdl_seq *posargs, *posdefaults, *kwonlyargs, *kwdefaults; - identifier vararg = NULL, kwarg = NULL; + arg_ty vararg = NULL, kwarg = NULL; arg_ty arg; - expr_ty varargannotation = NULL, kwargannotation = NULL; node *ch; if (TYPE(n) == parameters) { if (NCH(n) == 2) /* () as argument list */ - return arguments(NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, c->c_arena); + return arguments(NULL, NULL, NULL, NULL, NULL, NULL, c->c_arena); n = CHILD(n, 1); } assert(TYPE(n) == typedargslist || TYPE(n) == varargslist); @@ -1348,17 +1344,10 @@ i = res; /* res has new position to process */ } else { - vararg = NEW_IDENTIFIER(CHILD(ch, 0)); + vararg = ast_for_arg(c, ch); if (!vararg) return NULL; - if (forbidden_name(c, vararg, CHILD(ch, 0), 0)) - return NULL; - if (NCH(ch) > 1) { - /* there is an annotation on the vararg */ - varargannotation = ast_for_expr(c, CHILD(ch, 2)); - if (!varargannotation) - return NULL; - } + i += 3; if (i < NCH(n) && (TYPE(CHILD(n, i)) == tfpdef || TYPE(CHILD(n, i)) == vfpdef)) { @@ -1373,17 +1362,9 @@ case DOUBLESTAR: ch = CHILD(n, i+1); /* tfpdef */ assert(TYPE(ch) == tfpdef || TYPE(ch) == vfpdef); - kwarg = NEW_IDENTIFIER(CHILD(ch, 0)); + kwarg = ast_for_arg(c, ch); if (!kwarg) return NULL; - if (NCH(ch) > 1) { - /* there is an annotation on the kwarg */ - kwargannotation = ast_for_expr(c, CHILD(ch, 2)); - if (!kwargannotation) - return NULL; - } - if (forbidden_name(c, kwarg, CHILD(ch, 0), 0)) - return NULL; i += 3; break; default: @@ -1393,8 +1374,7 @@ return NULL; } } - return arguments(posargs, vararg, varargannotation, kwonlyargs, kwarg, - kwargannotation, posdefaults, kwdefaults, c->c_arena); + return arguments(posargs, vararg, kwonlyargs, kwdefaults, kwarg, posdefaults, c->c_arena); } static expr_ty @@ -1559,8 +1539,7 @@ expr_ty expression; if (NCH(n) == 3) { - args = arguments(NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, c->c_arena); + args = arguments(NULL, NULL, NULL, NULL, NULL, NULL, c->c_arena); if (!args) return NULL; expression = ast_for_expr(c, CHILD(n, 2)); @@ -2107,15 +2086,22 @@ if (NCH(n) == 2) return Call(left_expr, NULL, NULL, NULL, NULL, LINENO(n), n->n_col_offset, c->c_arena); - else - return ast_for_call(c, CHILD(n, 1), left_expr); + else { + expr_ty tmp = ast_for_call(c, CHILD(n, 1), left_expr); + if (!tmp) + return NULL; + + tmp->lineno = LINENO(n); + tmp->col_offset = n->n_col_offset; + return tmp; + } } else if (TYPE(CHILD(n, 0)) == DOT ) { PyObject *attr_id = NEW_IDENTIFIER(CHILD(n, 1)); if (!attr_id) return NULL; return Attribute(left_expr, attr_id, Load, - LINENO(n), n->n_col_offset, c->c_arena); + LINENO(CHILD(n, 1)), CHILD(n, 1)->n_col_offset, c->c_arena); } else { REQ(CHILD(n, 0), LSQB); @@ -2216,8 +2202,6 @@ tmp = ast_for_trailer(c, ch, e); if (!tmp) return NULL; - tmp->lineno = e->lineno; - tmp->col_offset = e->col_offset; e = tmp; } if (TYPE(CHILD(n, NCH(n) - 1)) == factor) { diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -1498,15 +1498,15 @@ if (compiler_visit_argannotations(c, args->args, names)) goto error; - if (args->varargannotation && - compiler_visit_argannotation(c, args->vararg, - args->varargannotation, names)) + if (args->vararg && args->vararg->annotation && + compiler_visit_argannotation(c, args->vararg->arg, + args->vararg->annotation, names)) goto error; if (compiler_visit_argannotations(c, args->kwonlyargs, names)) goto error; - if (args->kwargannotation && - compiler_visit_argannotation(c, args->kwarg, - args->kwargannotation, names)) + if (args->kwarg && args->kwarg->annotation && + compiler_visit_argannotation(c, args->kwarg->arg, + args->kwarg->annotation, names)) goto error; if (!return_str) { diff --git a/Python/symtable.c b/Python/symtable.c --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1530,10 +1530,10 @@ if (a->args && !symtable_visit_argannotations(st, a->args)) return 0; - if (a->varargannotation) - VISIT(st, expr, a->varargannotation); - if (a->kwargannotation) - VISIT(st, expr, a->kwargannotation); + if (a->vararg && a->vararg->annotation) + VISIT(st, expr, a->vararg->annotation); + if (a->kwarg && a->kwarg->annotation) + VISIT(st, expr, a->kwarg->annotation); if (a->kwonlyargs && !symtable_visit_argannotations(st, a->kwonlyargs)) return 0; if (s->v.FunctionDef.returns) @@ -1552,12 +1552,12 @@ if (a->kwonlyargs && !symtable_visit_params(st, a->kwonlyargs)) return 0; if (a->vararg) { - if (!symtable_add_def(st, a->vararg, DEF_PARAM)) + if (!symtable_add_def(st, a->vararg->arg, DEF_PARAM)) return 0; st->st_cur->ste_varargs = 1; } if (a->kwarg) { - if (!symtable_add_def(st, a->kwarg, DEF_PARAM)) + if (!symtable_add_def(st, a->kwarg->arg, DEF_PARAM)) return 0; st->st_cur->ste_varkeywords = 1; } diff --git a/Tools/parser/unparse.py b/Tools/parser/unparse.py --- a/Tools/parser/unparse.py +++ b/Tools/parser/unparse.py @@ -518,10 +518,10 @@ else: self.write(", ") self.write("*") if t.vararg: - self.write(t.vararg) - if t.varargannotation: + self.write(t.vararg.arg) + if t.vararg.annotation: self.write(": ") - self.dispatch(t.varargannotation) + self.dispatch(t.vararg.annotation) # keyword-only arguments if t.kwonlyargs: @@ -537,10 +537,10 @@ if t.kwarg: if first:first = False else: self.write(", ") - self.write("**"+t.kwarg) - if t.kwargannotation: + self.write("**"+t.kwarg.arg) + if t.kwarg.annotation: self.write(": ") - self.dispatch(t.kwargannotation) + self.dispatch(t.kwarg.annotation) def _keyword(self, t): self.write(t.arg) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 18:53:54 2013 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 18 Mar 2013 18:53:54 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_add_Sven_Brauch_for_his_?= =?utf-8?q?=2316795_contribution?= Message-ID: <3ZV4l65VGjzSBP@mail.python.org> http://hg.python.org/cpython/rev/219c997b880b changeset: 82733:219c997b880b user: Benjamin Peterson date: Mon Mar 18 10:52:04 2013 -0700 summary: add Sven Brauch for his #16795 contribution files: Misc/ACKS | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -149,6 +149,7 @@ Georg Brandl Christopher Brannon Terrence Brannon +Sven Brauch Erik Bray Brian Brazil Dave Brennan -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 19:00:05 2013 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 18 Mar 2013 19:00:05 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_move_declaration_to_top_of?= =?utf-8?q?_block?= Message-ID: <3ZV4tF42QszPYs@mail.python.org> http://hg.python.org/cpython/rev/d801be922dc2 changeset: 82734:d801be922dc2 user: Benjamin Peterson date: Mon Mar 18 10:59:41 2013 -0700 summary: move declaration to top of block files: Python/ast.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -1115,6 +1115,7 @@ identifier name; expr_ty annotation = NULL; node *ch; + arg_ty tmp; assert(TYPE(n) == tfpdef || TYPE(n) == vfpdef); ch = CHILD(n, 0); @@ -1130,7 +1131,7 @@ return NULL; } - arg_ty tmp = arg(name, annotation, c->c_arena); + tmp = arg(name, annotation, c->c_arena); if (!tmp) return NULL; -- Repository URL: http://hg.python.org/cpython From guido at python.org Mon Mar 18 19:04:39 2013 From: guido at python.org (Guido van Rossum) Date: Mon, 18 Mar 2013 11:04:39 -0700 Subject: [Python-checkins] peps: Update for 436, explicitly supporting positional parameters forever, amen. In-Reply-To: References: <3ZTrcp6hZCzSLM@mail.python.org> Message-ID: On Mon, Mar 18, 2013 at 8:57 AM, Nick Coghlan wrote: > On Mon, Mar 18, 2013 at 1:47 AM, larry.hastings > wrote: >> Notes / TBD >> =========== >> >> +* The DSL currently makes no provision for specifying per-parameter >> + type annotations. This is something explicitly supported in Python; >> + it should be supported for builtins too, once we have reflection support. >> + >> + It seems to me that the syntax for parameter lines--dictated by >> + Guido--suggests conversion functions are themselves type annotations. >> + This makes intuitive sense. But my thought experiments in how to >> + convert the conversion function specification into a per-parameter >> + type annotation ranged from obnoxious to toxic; I don't think that >> + line of thinking will bear fruit. >> + >> + Instead, I think wee need to add a new syntax allowing functions >> + to explicitly specify a per-parameter type annotation. The problem: >> + what should that syntax be? I've only had one idea so far, and I >> + don't find it all that appealing: allow a optional second colon >> + on the parameter line, and the type annotation would be specified... >> + somewhere, either between the first and second colons, or between >> + the second colon and the (optional) default. >> + >> + Also, I don't think this could specify any arbitrary Python value. >> + I suspect it would suffer heavy restrictions on what types and >> + literals it could use. Perhaps the best solution would be to >> + store the exact string in static data, and have Python evaluate >> + it on demand? If so, it would be safest to restrict it to Python >> + literal syntax, permitting no function calls (even to builtins). >> + > > I think the hack we're using for the default-as-shown-in-Python will > work here as well: use the converter parameterisation notation. > > Then "pydefault" (I think that is a better name than the current > "default") and "pynote" would control what is shown for the conversion > in the first line of the docstring and in any future introspection > support. If either is not given, then the C default would be passed > through as the Python default and the annotation would be left blank. Right. In fact, I think the decision of what (if anything) should be put in the annotation should be up to the converter class. It can be a specific method on the converter object. -- --Guido van Rossum (python.org/~guido) From python-checkins at python.org Mon Mar 18 22:08:37 2013 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 18 Mar 2013 22:08:37 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=2317460=3A_Remove_the_str?= =?utf-8?q?ict_argument_of_HTTPConnection_and_removing_the?= Message-ID: <3ZV93n5TZzzSZB@mail.python.org> http://hg.python.org/cpython/rev/c9bf987d80f1 changeset: 82735:c9bf987d80f1 user: Senthil Kumaran date: Mon Mar 18 14:11:41 2013 -0700 summary: #17460: Remove the strict argument of HTTPConnection and removing the DeprecationWarning being issued from 3.2 onwards. files: Doc/library/http.client.rst | 18 +++--------------- Lib/http/client.py | 23 +++++++---------------- Misc/NEWS | 5 ++++- 3 files changed, 14 insertions(+), 32 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -27,7 +27,7 @@ The module provides the following classes: -.. class:: HTTPConnection(host, port=None[, strict][, timeout], \ +.. class:: HTTPConnection(host, port=None[, timeout], \ source_address=None) An :class:`HTTPConnection` instance represents one transaction with an HTTP @@ -51,13 +51,9 @@ .. versionchanged:: 3.2 *source_address* was added. - .. versionchanged:: 3.2 - The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" - are not supported anymore. - .. class:: HTTPSConnection(host, port=None, key_file=None, \ - cert_file=None[, strict][, timeout], \ + cert_file=None[, timeout], \ source_address=None, *, context=None, \ check_hostname=None) @@ -89,20 +85,12 @@ This class now supports HTTPS virtual hosts if possible (that is, if :data:`ssl.HAS_SNI` is true). - .. versionchanged:: 3.2 - The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" - are not supported anymore. - -.. class:: HTTPResponse(sock, debuglevel=0[, strict], method=None, url=None) +.. class:: HTTPResponse(sock, debuglevel=0, method=None, url=None) Class whose instances are returned upon successful connection. Not instantiated directly by user. - .. versionchanged:: 3.2 - The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" - are not supported anymore. - The following exceptions are raised as appropriate: diff --git a/Lib/http/client.py b/Lib/http/client.py --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -267,8 +267,6 @@ return email.parser.Parser(_class=_class).parsestr(hstring) -_strict_sentinel = object() - class HTTPResponse(io.RawIOBase): # See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details. @@ -278,7 +276,7 @@ # text following RFC 2047. The basic status line parsing only # accepts iso-8859-1. - def __init__(self, sock, debuglevel=0, strict=_strict_sentinel, method=None, url=None): + def __init__(self, sock, debuglevel=0, method=None, url=None): # If the response includes a content-length header, we need to # make sure that the client doesn't read more than the # specified number of bytes. If it does, it will block until @@ -288,10 +286,6 @@ # clients unless they know what they are doing. self.fp = sock.makefile("rb") self.debuglevel = debuglevel - if strict is not _strict_sentinel: - warnings.warn("the 'strict' argument isn't supported anymore; " - "http.client now always assumes HTTP/1.x compliant servers.", - DeprecationWarning, 2) self._method = method # The HTTPResponse object is returned via urllib. The clients @@ -737,12 +731,8 @@ # as a reasonable estimate of the maximum MSS. mss = 16384 - def __init__(self, host, port=None, strict=_strict_sentinel, - timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None): - if strict is not _strict_sentinel: - warnings.warn("the 'strict' argument isn't supported anymore; " - "http.client now always assumes HTTP/1.x compliant servers.", - DeprecationWarning, 2) + def __init__(self, host, port=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, + source_address=None): self.timeout = timeout self.source_address = source_address self.sock = None @@ -1177,9 +1167,10 @@ # XXX Should key_file and cert_file be deprecated in favour of context? def __init__(self, host, port=None, key_file=None, cert_file=None, - strict=_strict_sentinel, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, - source_address=None, *, context=None, check_hostname=None): - super(HTTPSConnection, self).__init__(host, port, strict, timeout, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT, + source_address=None, *, context=None, + check_hostname=None): + super(HTTPSConnection, self).__init__(host, port, timeout, source_address) self.key_file = key_file self.cert_file = cert_file diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -287,7 +287,10 @@ Library ------- -Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. +- Issue #17460: Remove the strict argument of HTTPConnection and removing the + DeprecationWarning being issued from 3.2 onwards. + +- Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. - Issue #16389: Fixed a performance regression relative to Python 3.1 in the caching of compiled regular expressions. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 22:43:05 2013 From: python-checkins at python.org (r.david.murray) Date: Mon, 18 Mar 2013 22:43:05 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=235024=3A_whichhdr_now_re?= =?utf-8?q?turns_the_frame_count_for_WAV_files=2E?= Message-ID: <3ZV9qY1P9gzPMq@mail.python.org> http://hg.python.org/cpython/rev/f972488c6b39 changeset: 82736:f972488c6b39 user: R David Murray date: Mon Mar 18 17:42:42 2013 -0400 summary: #5024: whichhdr now returns the frame count for WAV files. Patch by Ned Jackson Lovely based on a suggestion by Robert Pyle. files: Lib/sndhdr.py | 13 ++++++++----- Lib/test/test_sndhdr.py | 2 +- Misc/ACKS | 1 + Misc/NEWS | 3 +++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Lib/sndhdr.py b/Lib/sndhdr.py --- a/Lib/sndhdr.py +++ b/Lib/sndhdr.py @@ -137,14 +137,17 @@ def test_wav(h, f): + import wave # 'RIFF' 'WAVE' 'fmt ' if not h.startswith(b'RIFF') or h[8:12] != b'WAVE' or h[12:16] != b'fmt ': return None - style = get_short_le(h[20:22]) - nchannels = get_short_le(h[22:24]) - rate = get_long_le(h[24:28]) - sample_bits = get_short_le(h[34:36]) - return 'wav', rate, nchannels, -1, sample_bits + f.seek(0) + try: + w = wave.openfp(f, 'r') + except (EOFError, wave.Error): + return None + return ('wav', w.getframerate(), w.getnchannels(), + w.getnframes(), 8*w.getsampwidth()) tests.append(test_wav) diff --git a/Lib/test/test_sndhdr.py b/Lib/test/test_sndhdr.py --- a/Lib/test/test_sndhdr.py +++ b/Lib/test/test_sndhdr.py @@ -12,7 +12,7 @@ ('sndhdr.hcom', ('hcom', 22050.0, 1, -1, 8)), ('sndhdr.sndt', ('sndt', 44100, 1, 5, 8)), ('sndhdr.voc', ('voc', 0, 1, -1, 8)), - ('sndhdr.wav', ('wav', 44100, 2, -1, 16)), + ('sndhdr.wav', ('wav', 44100, 2, 5, 16)), ): filename = findfile(filename, subdir="sndhdrdata") what = sndhdr.what(filename) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -746,6 +746,7 @@ Anne Lord Tom Loredo Justin Love +Ned Jackson Lovely Jason Lowe Tony Lownds Ray Loyzaga diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -287,6 +287,9 @@ Library ------- +- Issue #5024: sndhdr.whichhdr now returns the frame count for WAV files + rather than -1. + - Issue #17460: Remove the strict argument of HTTPConnection and removing the DeprecationWarning being issued from 3.2 onwards. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 23:05:01 2013 From: python-checkins at python.org (michael.foord) Date: Mon, 18 Mar 2013 23:05:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Documentation_?= =?utf-8?q?corrections_for_unittest=2Emock?= Message-ID: <3ZVBJs6S5jzMgy@mail.python.org> http://hg.python.org/cpython/rev/9ac6a3871d76 changeset: 82737:9ac6a3871d76 branch: 3.3 parent: 82730:50af6682c6a7 user: Michael Foord date: Mon Mar 18 15:04:03 2013 -0700 summary: Documentation corrections for unittest.mock files: Doc/library/unittest.mock.rst | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -867,6 +867,25 @@ AttributeError: f +Mock names and the name attribute +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Since "name" is an argument to the :class:`Mock` constructor, if you want your +mock object to have a "name" attribute you can't just pass it in at creation +time. There are two alternatives. One option is to use +:meth:`~Mock.configure_mock`:: + + >>> mock = MagicMock() + >>> mock.configure_mock(name='my_name') + >>> mock.name + 'my_name' + +A simpler option is to simply set the "name" attribute after mock creation:: + + >>> mock = MagicMock() + >>> mock.name = "foo" + + Attaching Mocks as Attributes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 23:05:03 2013 From: python-checkins at python.org (michael.foord) Date: Mon, 18 Mar 2013 23:05:03 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge?= Message-ID: <3ZVBJv2176zMgy@mail.python.org> http://hg.python.org/cpython/rev/72a8446fdf9a changeset: 82738:72a8446fdf9a parent: 82736:f972488c6b39 parent: 82737:9ac6a3871d76 user: Michael Foord date: Mon Mar 18 15:04:33 2013 -0700 summary: Merge files: Doc/library/unittest.mock.rst | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -887,6 +887,25 @@ AttributeError: f +Mock names and the name attribute +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Since "name" is an argument to the :class:`Mock` constructor, if you want your +mock object to have a "name" attribute you can't just pass it in at creation +time. There are two alternatives. One option is to use +:meth:`~Mock.configure_mock`:: + + >>> mock = MagicMock() + >>> mock.configure_mock(name='my_name') + >>> mock.name + 'my_name' + +A simpler option is to simply set the "name" attribute after mock creation:: + + >>> mock = MagicMock() + >>> mock.name = "foo" + + Attaching Mocks as Attributes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 23:22:56 2013 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 18 Mar 2013 23:22:56 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_use_the_HTTPS_for_pypi_upl?= =?utf-8?q?oad?= Message-ID: <3ZVBjX333SzPCm@mail.python.org> http://hg.python.org/cpython/rev/f86d46a580d8 changeset: 82739:f86d46a580d8 user: Benjamin Peterson date: Mon Mar 18 15:20:56 2013 -0700 summary: use the HTTPS for pypi upload files: Lib/distutils/config.py | 11 ++++++++++- Lib/distutils/tests/test_config.py | 4 ++-- Lib/distutils/tests/test_upload.py | 8 ++++---- Misc/NEWS | 2 ++ 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Lib/distutils/config.py b/Lib/distutils/config.py --- a/Lib/distutils/config.py +++ b/Lib/distutils/config.py @@ -21,7 +21,7 @@ class PyPIRCCommand(Command): """Base command that knows how to handle the .pypirc file """ - DEFAULT_REPOSITORY = 'http://pypi.python.org/pypi' + DEFAULT_REPOSITORY = 'https://pypi.python.org/pypi' DEFAULT_REALM = 'pypi' repository = None realm = None @@ -83,6 +83,15 @@ current[key] = config.get(server, key) else: current[key] = default + + # work around people having "repository" for the "pypi" + # section of their config set to the HTTP (rather than + # HTTPS) URL + if (server == 'pypi' and + repository in (self.DEFAULT_REPOSITORY, 'pypi')): + current['repository'] = self.DEFAULT_REPOSITORY + return current + if (current['server'] == repository or current['repository'] == repository): return current diff --git a/Lib/distutils/tests/test_config.py b/Lib/distutils/tests/test_config.py --- a/Lib/distutils/tests/test_config.py +++ b/Lib/distutils/tests/test_config.py @@ -87,7 +87,7 @@ config = list(sorted(config.items())) waited = [('password', 'secret'), ('realm', 'pypi'), - ('repository', 'http://pypi.python.org/pypi'), + ('repository', 'https://pypi.python.org/pypi'), ('server', 'server1'), ('username', 'me')] self.assertEqual(config, waited) @@ -96,7 +96,7 @@ config = cmd._read_pypirc() config = list(sorted(config.items())) waited = [('password', 'secret'), ('realm', 'pypi'), - ('repository', 'http://pypi.python.org/pypi'), + ('repository', 'https://pypi.python.org/pypi'), ('server', 'server-login'), ('username', 'tarek')] self.assertEqual(config, waited) diff --git a/Lib/distutils/tests/test_upload.py b/Lib/distutils/tests/test_upload.py --- a/Lib/distutils/tests/test_upload.py +++ b/Lib/distutils/tests/test_upload.py @@ -72,11 +72,11 @@ def setUp(self): super(uploadTestCase, self).setUp() - self.old_class = httpclient.HTTPConnection - self.conn = httpclient.HTTPConnection = FakeConnection() + self.old_class = httpclient.HTTPSConnection + self.conn = httpclient.HTTPSConnection = FakeConnection() def tearDown(self): - httpclient.HTTPConnection = self.old_class + httpclient.HTTPSConnection = self.old_class super(uploadTestCase, self).tearDown() def test_finalize_options(self): @@ -88,7 +88,7 @@ cmd.finalize_options() for attr, waited in (('username', 'me'), ('password', 'secret'), ('realm', 'pypi'), - ('repository', 'http://pypi.python.org/pypi')): + ('repository', 'https://pypi.python.org/pypi')): self.assertEqual(getattr(cmd, attr), waited) def test_saved_password(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Use the HTTPS PyPI url for upload, overriding any plain HTTP URL in pypirc. + - Issue #16795: On the ast.arguments object, unify vararg with varargannotation and kwarg and kwargannotation. Change the column offset of ast.Attribute to be at the attribute name. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 18 23:43:12 2013 From: python-checkins at python.org (guido.van.rossum) Date: Mon, 18 Mar 2013 23:43:12 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_high-level_explanation_of?= =?utf-8?q?_transports_and_protocols_early_on=2E?= Message-ID: <3ZVC8w3WHBzMgy@mail.python.org> http://hg.python.org/peps/rev/3d706be6e879 changeset: 4807:3d706be6e879 user: Guido van Rossum date: Mon Mar 18 15:43:00 2013 -0700 summary: Add high-level explanation of transports and protocols early on. files: pep-3156.txt | 41 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-) diff --git a/pep-3156.txt b/pep-3156.txt --- a/pep-3156.txt +++ b/pep-3156.txt @@ -76,6 +76,47 @@ PEP 3148) which returns a Future that is compatible with the event loop. +A Note About Transports and Protocols +------------------------------------- + +For those not familiar with Twisted, a quick explanation of the +difference between transports and protocols is in order. At the +highest level, the transport is concerned with *how* bytes are +transmitted, while the protocol determines *which* bytes to transmit +(and when). + +A transport represents a pair of streams (one in each direction) that +each transmit a sequence of bytes. The most common transport is +probably the TCP connection. Another common transport is SSL. But +there are some other things that can be viewed as transports, for +example an SSH session or a pair of UNIX pipes. Typically there +aren't many different transport implementations, and most of them +come with the event loop implementation. + +A transport has two "sides": one side talks to the network (or the +subprocess, or whatever low-level interface it wraps), and the other +side talks to the protocol. The former uses whatever API is necessary +to implement the transport; but the interface between transport and +protocol is standardized by this PEP. + +A protocol represents some kind of "application-level" protocol such +as HTTP or SMTP. Its primary interface is with the transport. While +some popular protocols will probably have a standard implementation, +often applications implement custom protocols. It also makes sense to +have libraries of useful 3rd party protocol implementations that can +be downloaded and installed from pypi.python.org. + +There is also a somewhat more general notion of transport and +protocol, where the transport wraps some other communication +abstraction. Example include an interface for sending and receiving +datagrams, or a subprocess manager. The separation of concerns is the +same as for stream transports and protocols, but the specific +interface between transport and protocol can be different in each +case. + +Details of the interfaces between transports and protocols are given +later. + Non-goals ========= -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Tue Mar 19 00:59:24 2013 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 19 Mar 2013 00:59:24 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fixes_issue_?= =?utf-8?q?=2317192=3A_Update_the_ctypes_module=27s_libffi_to_v3=2E0=2E13?= =?utf-8?q?=2E__This?= Message-ID: <3ZVDrr34ThzS8n@mail.python.org> http://hg.python.org/cpython/rev/b10ec5083a53 changeset: 82740:b10ec5083a53 branch: 2.7 parent: 82728:6aab72424063 user: Gregory P. Smith date: Mon Mar 18 16:58:50 2013 -0700 summary: Fixes issue #17192: Update the ctypes module's libffi to v3.0.13. This specifically addresses a stack misalignment issue on x86 and issues on some more recent platforms. files: Misc/NEWS | 4 + Modules/_ctypes/libffi.diff | 67 +- Modules/_ctypes/libffi/.gitignore | 21 + Modules/_ctypes/libffi/.travis.yml | 8 + Modules/_ctypes/libffi/ChangeLog | 1364 ++ Modules/_ctypes/libffi/ChangeLog.libffi | 37 +- Modules/_ctypes/libffi/LICENSE | 6 +- Modules/_ctypes/libffi/Makefile.am | 117 +- Modules/_ctypes/libffi/Makefile.in | 937 +- Modules/_ctypes/libffi/README | 173 +- Modules/_ctypes/libffi/aclocal.m4 | 1207 +- Modules/_ctypes/libffi/build-ios.sh | 67 + Modules/_ctypes/libffi/compile | 21 +- Modules/_ctypes/libffi/config.guess | 297 +- Modules/_ctypes/libffi/config.sub | 264 +- Modules/_ctypes/libffi/configure | 6037 +++++++-- Modules/_ctypes/libffi/configure.ac | 343 +- Modules/_ctypes/libffi/depcomp | 116 +- Modules/_ctypes/libffi/doc/libffi.info | Bin Modules/_ctypes/libffi/doc/libffi.texi | 42 +- Modules/_ctypes/libffi/doc/stamp-vti | 8 +- Modules/_ctypes/libffi/doc/version.texi | 8 +- Modules/_ctypes/libffi/fficonfig.h.in | 21 + Modules/_ctypes/libffi/generate-ios-source-and-headers.py | 160 + Modules/_ctypes/libffi/generate-osx-source-and-headers.py | 153 + Modules/_ctypes/libffi/include/Makefile.in | 97 +- Modules/_ctypes/libffi/include/ffi.h.in | 125 +- Modules/_ctypes/libffi/include/ffi_common.h | 18 +- Modules/_ctypes/libffi/install-sh | 515 +- Modules/_ctypes/libffi/libffi.xcodeproj/project.pbxproj | 579 + Modules/_ctypes/libffi/libtool-ldflags | 106 + Modules/_ctypes/libffi/libtool-version | 2 +- Modules/_ctypes/libffi/ltmain.sh | 4333 ++++-- Modules/_ctypes/libffi/m4/asmcfi.m4 | 13 + Modules/_ctypes/libffi/m4/ax_append_flag.m4 | 69 + Modules/_ctypes/libffi/m4/ax_cc_maxopt.m4 | 181 + Modules/_ctypes/libffi/m4/ax_cflags_warn_all.m4 | 122 + Modules/_ctypes/libffi/m4/ax_check_compile_flag.m4 | 72 + Modules/_ctypes/libffi/m4/ax_compiler_vendor.m4 | 84 + Modules/_ctypes/libffi/m4/ax_configure_args.m4 | 70 + Modules/_ctypes/libffi/m4/ax_enable_builddir.m4 | 300 + Modules/_ctypes/libffi/m4/ax_gcc_archflag.m4 | 225 + Modules/_ctypes/libffi/m4/ax_gcc_x86_cpuid.m4 | 79 + Modules/_ctypes/libffi/m4/libtool.m4 | 2294 ++- Modules/_ctypes/libffi/m4/ltoptions.m4 | 32 +- Modules/_ctypes/libffi/m4/ltversion.m4 | 12 +- Modules/_ctypes/libffi/m4/lt~obsolete.m4 | 12 +- Modules/_ctypes/libffi/man/Makefile.am | 4 +- Modules/_ctypes/libffi/man/Makefile.in | 103 +- Modules/_ctypes/libffi/man/ffi.3 | 10 + Modules/_ctypes/libffi/man/ffi_prep_cif.3 | 10 +- Modules/_ctypes/libffi/man/ffi_prep_cif_var.3 | 73 + Modules/_ctypes/libffi/mdate-sh | 0 Modules/_ctypes/libffi/missing | 104 +- Modules/_ctypes/libffi/msvcc.sh | 30 +- Modules/_ctypes/libffi/src/aarch64/ffi.c | 1076 + Modules/_ctypes/libffi/src/aarch64/ffitarget.h | 59 + Modules/_ctypes/libffi/src/aarch64/sysv.S | 307 + Modules/_ctypes/libffi/src/alpha/ffi.c | 6 +- Modules/_ctypes/libffi/src/alpha/ffitarget.h | 7 +- Modules/_ctypes/libffi/src/alpha/osf.S | 57 +- Modules/_ctypes/libffi/src/arm/ffi.c | 503 +- Modules/_ctypes/libffi/src/arm/ffitarget.h | 28 +- Modules/_ctypes/libffi/src/arm/gentramp.sh | 118 + Modules/_ctypes/libffi/src/arm/sysv.S | 226 +- Modules/_ctypes/libffi/src/arm/trampoline.S | 4450 +++++++ Modules/_ctypes/libffi/src/avr32/ffi.c | 6 +- Modules/_ctypes/libffi/src/avr32/ffitarget.h | 11 +- Modules/_ctypes/libffi/src/bfin/ffi.c | 195 + Modules/_ctypes/libffi/src/bfin/ffitarget.h | 43 + Modules/_ctypes/libffi/src/bfin/sysv.S | 177 + Modules/_ctypes/libffi/src/closures.c | 58 +- Modules/_ctypes/libffi/src/cris/ffi.c | 15 +- Modules/_ctypes/libffi/src/cris/ffitarget.h | 11 +- Modules/_ctypes/libffi/src/dlmalloc.c | 87 +- Modules/_ctypes/libffi/src/frv/ffitarget.h | 15 +- Modules/_ctypes/libffi/src/ia64/ffi.c | 20 +- Modules/_ctypes/libffi/src/ia64/ffitarget.h | 11 +- Modules/_ctypes/libffi/src/java_raw_api.c | 2 +- Modules/_ctypes/libffi/src/m32r/ffitarget.h | 11 +- Modules/_ctypes/libffi/src/m68k/ffi.c | 106 +- Modules/_ctypes/libffi/src/m68k/ffitarget.h | 11 +- Modules/_ctypes/libffi/src/m68k/sysv.S | 146 +- Modules/_ctypes/libffi/src/metag/ffi.c | 330 + Modules/_ctypes/libffi/src/metag/ffitarget.h | 53 + Modules/_ctypes/libffi/src/metag/sysv.S | 311 + Modules/_ctypes/libffi/src/microblaze/ffi.c | 321 + Modules/_ctypes/libffi/src/microblaze/ffitarget.h | 53 + Modules/_ctypes/libffi/src/microblaze/sysv.S | 302 + Modules/_ctypes/libffi/src/mips/ffi.c | 26 +- Modules/_ctypes/libffi/src/mips/ffitarget.h | 34 +- Modules/_ctypes/libffi/src/mips/n32.S | 1 + Modules/_ctypes/libffi/src/moxie/eabi.S | 137 +- Modules/_ctypes/libffi/src/moxie/ffi.c | 82 +- Modules/_ctypes/libffi/src/moxie/ffitarget.h | 12 +- Modules/_ctypes/libffi/src/pa/ffi.c | 11 +- Modules/_ctypes/libffi/src/pa/ffitarget.h | 18 +- Modules/_ctypes/libffi/src/powerpc/aix.S | 18 +- Modules/_ctypes/libffi/src/powerpc/aix_closure.S | 6 +- Modules/_ctypes/libffi/src/powerpc/asm.h | 2 +- Modules/_ctypes/libffi/src/powerpc/darwin.S | 292 +- Modules/_ctypes/libffi/src/powerpc/darwin_closure.S | 459 +- Modules/_ctypes/libffi/src/powerpc/ffi.c | 601 +- Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c | 781 +- Modules/_ctypes/libffi/src/powerpc/ffitarget.h | 43 +- Modules/_ctypes/libffi/src/powerpc/linux64.S | 21 +- Modules/_ctypes/libffi/src/powerpc/linux64_closure.S | 20 +- Modules/_ctypes/libffi/src/powerpc/ppc_closure.S | 19 + Modules/_ctypes/libffi/src/powerpc/sysv.S | 6 + Modules/_ctypes/libffi/src/prep_cif.c | 90 +- Modules/_ctypes/libffi/src/s390/ffi.c | 3 +- Modules/_ctypes/libffi/src/s390/ffitarget.h | 13 +- Modules/_ctypes/libffi/src/sh/ffi.c | 5 +- Modules/_ctypes/libffi/src/sh/ffitarget.h | 11 +- Modules/_ctypes/libffi/src/sh64/ffi.c | 5 +- Modules/_ctypes/libffi/src/sh64/ffitarget.h | 11 +- Modules/_ctypes/libffi/src/sparc/ffi.c | 78 +- Modules/_ctypes/libffi/src/sparc/ffitarget.h | 15 +- Modules/_ctypes/libffi/src/sparc/v8.S | 35 +- Modules/_ctypes/libffi/src/sparc/v9.S | 2 +- Modules/_ctypes/libffi/src/tile/ffi.c | 355 + Modules/_ctypes/libffi/src/tile/ffitarget.h | 65 + Modules/_ctypes/libffi/src/tile/tile.S | 360 + Modules/_ctypes/libffi/src/x86/ffi.c | 262 +- Modules/_ctypes/libffi/src/x86/ffi64.c | 74 +- Modules/_ctypes/libffi/src/x86/ffitarget.h | 50 +- Modules/_ctypes/libffi/src/x86/sysv.S | 81 +- Modules/_ctypes/libffi/src/x86/unix64.S | 14 +- Modules/_ctypes/libffi/src/x86/win32.S | 268 +- Modules/_ctypes/libffi/src/x86/win64.S | 22 +- Modules/_ctypes/libffi/src/xtensa/ffi.c | 298 + Modules/_ctypes/libffi/src/xtensa/ffitarget.h | 53 + Modules/_ctypes/libffi/src/xtensa/sysv.S | 253 + Modules/_ctypes/libffi/stamp-h.in | 1 + Modules/_ctypes/libffi/testsuite/Makefile.am | 140 +- Modules/_ctypes/libffi/testsuite/Makefile.in | 229 +- Modules/_ctypes/libffi/testsuite/lib/libffi-dg.exp | 300 - Modules/_ctypes/libffi/testsuite/lib/libffi.exp | 369 + Modules/_ctypes/libffi/testsuite/lib/target-libpath.exp | 22 +- Modules/_ctypes/libffi/testsuite/libffi.call/call.exp | 25 +- Modules/_ctypes/libffi/testsuite/libffi.call/closure_stdcall.c | 8 + Modules/_ctypes/libffi/testsuite/libffi.call/closure_thiscall.c | 72 + Modules/_ctypes/libffi/testsuite/libffi.call/cls_12byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_16byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_18byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_19byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_1_1byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte1.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_24byte.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_2byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_3_1byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte1.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte2.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_4_1byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_4byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_5_1_byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_5byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_64byte.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_6_1_byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_6byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_7_1_byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_7byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_8byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte1.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte2.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_double.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_float.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_pointer.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint16.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint32.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint64.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint16.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint32.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint64.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_dbls_struct.c | 4 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c | 16 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c | 6 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c | 17 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c | 4 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c | 22 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_struct_va1.c | 114 + Modules/_ctypes/libffi/testsuite/libffi.call/cls_uchar_va.c | 44 + Modules/_ctypes/libffi/testsuite/libffi.call/cls_uint_va.c | 45 + Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulong_va.c | 45 + Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_ushort_va.c | 44 + Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_abi.c | 5 +- Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_typedef.c | 7 +- Modules/_ctypes/libffi/testsuite/libffi.call/fastthis1_win32.c | 50 + Modules/_ctypes/libffi/testsuite/libffi.call/fastthis2_win32.c | 50 + Modules/_ctypes/libffi/testsuite/libffi.call/fastthis3_win32.c | 56 + Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h | 81 +- Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c | 107 + Modules/_ctypes/libffi/testsuite/libffi.call/huge_struct.c | 69 +- Modules/_ctypes/libffi/testsuite/libffi.call/many2.c | 57 + Modules/_ctypes/libffi/testsuite/libffi.call/many2_win32.c | 63 + Modules/_ctypes/libffi/testsuite/libffi.call/negint.c | 1 - Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct.c | 12 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct1.c | 16 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct10.c | 12 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct11.c | 121 + Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct2.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct3.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct4.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct5.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct6.c | 12 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct7.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct8.c | 12 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct9.c | 12 +- Modules/_ctypes/libffi/testsuite/libffi.call/return_dbl.c | 1 + Modules/_ctypes/libffi/testsuite/libffi.call/return_sc.c | 2 +- Modules/_ctypes/libffi/testsuite/libffi.call/return_uc.c | 2 +- Modules/_ctypes/libffi/testsuite/libffi.call/stret_large.c | 14 +- Modules/_ctypes/libffi/testsuite/libffi.call/stret_large2.c | 14 +- Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium2.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/strlen2_win32.c | 44 + Modules/_ctypes/libffi/testsuite/libffi.call/struct1.c | 12 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct1_win32.c | 67 + Modules/_ctypes/libffi/testsuite/libffi.call/struct2.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct2_win32.c | 67 + Modules/_ctypes/libffi/testsuite/libffi.call/struct3.c | 9 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct4.c | 13 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct5.c | 13 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct6.c | 14 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct7.c | 14 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct8.c | 13 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct9.c | 13 +- Modules/_ctypes/libffi/testsuite/libffi.call/testclosure.c | 4 +- Modules/_ctypes/libffi/testsuite/libffi.call/uninitialized.c | 61 + Modules/_ctypes/libffi/testsuite/libffi.call/va_1.c | 196 + Modules/_ctypes/libffi/testsuite/libffi.call/va_struct1.c | 121 + Modules/_ctypes/libffi/testsuite/libffi.call/va_struct2.c | 123 + Modules/_ctypes/libffi/testsuite/libffi.call/va_struct3.c | 125 + Modules/_ctypes/libffi/testsuite/libffi.special/ffitestcxx.h | 41 - Modules/_ctypes/libffi/testsuite/libffi.special/special.exp | 16 +- Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc | 1 + Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc | 1 + Modules/_ctypes/libffi/texinfo.tex | 4999 ++++++- 243 files changed, 35313 insertions(+), 8639 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -786,6 +786,10 @@ Extension Modules ----------------- +- Issue #17192: Update the ctypes module's libffi to v3.0.13. This + specifically addresses a stack misalignment issue on x86 and issues on + some more recent platforms. + - Issue #12268: The io module file object write methods no longer abort early when a write system calls is interrupted (EINTR). diff --git a/Modules/_ctypes/libffi.diff b/Modules/_ctypes/libffi.diff --- a/Modules/_ctypes/libffi.diff +++ b/Modules/_ctypes/libffi.diff @@ -1,24 +1,26 @@ -diff -urN libffi.orig/configure libffi/configure ---- libffi.orig/configure 2010-03-19 18:29:54.588499862 +0100 -+++ libffi/configure 2010-03-19 18:32:09.113499479 +0100 -@@ -11228,6 +11228,9 @@ - i?86-*-solaris2.1[0-9]*) - TARGET=X86_64; TARGETDIR=x86 +diff -r -N -u libffi.orig/autom4te.cache/output.0 libffi/autom4te.cache/output.0 +diff -r -N -u libffi.orig/configure libffi/configure +--- libffi.orig/configure 2013-03-17 15:37:50.000000000 -0700 ++++ libffi/configure 2013-03-18 15:11:39.611575163 -0700 +@@ -13368,6 +13368,10 @@ + fi ;; + + i*86-*-nto-qnx*) + TARGET=X86; TARGETDIR=x86 + ;; - i?86-*-*) - TARGET=X86; TARGETDIR=x86 ++ + x86_64-*-darwin*) + TARGET=X86_DARWIN; TARGETDIR=x86 ;; -@@ -11245,12 +11248,12 @@ +@@ -13426,12 +13430,12 @@ ;; - mips-sgi-irix5.* | mips-sgi-irix6.*) + mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) - TARGET=MIPS; TARGETDIR=mips + TARGET=MIPS_IRIX; TARGETDIR=mips ;; - mips*-*-linux*) + mips*-*-linux* | mips*-*-openbsd*) # Support 128-bit long double for NewABI. HAVE_LONG_DOUBLE='defined(__mips64)' - TARGET=MIPS; TARGETDIR=mips @@ -26,8 +28,8 @@ ;; powerpc*-*-linux* | powerpc-*-sysv*) -@@ -11307,7 +11310,7 @@ - as_fn_error "\"libffi has not been ported to $host.\"" "$LINENO" 5 +@@ -13491,7 +13495,7 @@ + as_fn_error $? "\"libffi has not been ported to $host.\"" "$LINENO" 5 fi - if test x$TARGET = xMIPS; then @@ -35,7 +37,7 @@ MIPS_TRUE= MIPS_FALSE='#' else -@@ -12422,6 +12425,12 @@ +@@ -14862,6 +14866,12 @@ ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc" @@ -48,44 +50,45 @@ cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure -@@ -13521,6 +13530,8 @@ +@@ -16047,6 +16057,8 @@ "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "libffi.pc") CONFIG_FILES="$CONFIG_FILES libffi.pc" ;; + "include/ffi_common.h") CONFIG_LINKS="$CONFIG_LINKS include/ffi_common.h:include/ffi_common.h" ;; + "fficonfig.py") CONFIG_FILES="$CONFIG_FILES fficonfig.py" ;; - *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac -diff -urN libffi.orig/configure.ac libffi/configure.ac ---- libffi.orig/configure.ac 2010-03-19 18:27:44.988498585 +0100 -+++ libffi/configure.ac 2010-03-19 18:31:29.252505178 +0100 +diff -r -N -u libffi.orig/configure.ac libffi/configure.ac +--- libffi.orig/configure.ac 2013-03-17 15:37:50.000000000 -0700 ++++ libffi/configure.ac 2013-03-18 15:11:11.392989136 -0700 @@ -1,4 +1,7 @@ dnl Process this with autoconf to create configure +# -+# file from libffi - slightly patched for ctypes ++# file from libffi - slightly patched for Python's ctypes +# - AC_PREREQ(2.63) + AC_PREREQ(2.68) -@@ -91,6 +94,9 @@ - i?86-*-solaris2.1[[0-9]]*) - TARGET=X86_64; TARGETDIR=x86 +@@ -146,6 +149,10 @@ + fi ;; + + i*86-*-nto-qnx*) + TARGET=X86; TARGETDIR=x86 + ;; - i?86-*-*) - TARGET=X86; TARGETDIR=x86 ++ + x86_64-*-darwin*) + TARGET=X86_DARWIN; TARGETDIR=x86 ;; -@@ -108,12 +114,12 @@ +@@ -204,12 +211,12 @@ ;; - mips-sgi-irix5.* | mips-sgi-irix6.*) + mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) - TARGET=MIPS; TARGETDIR=mips + TARGET=MIPS_IRIX; TARGETDIR=mips ;; - mips*-*-linux*) + mips*-*-linux* | mips*-*-openbsd*) # Support 128-bit long double for NewABI. HAVE_LONG_DOUBLE='defined(__mips64)' - TARGET=MIPS; TARGETDIR=mips @@ -93,16 +96,16 @@ ;; powerpc*-*-linux* | powerpc-*-sysv*) -@@ -170,7 +176,7 @@ +@@ -269,7 +276,7 @@ AC_MSG_ERROR(["libffi has not been ported to $host."]) fi -AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS) +AM_CONDITIONAL(MIPS,[expr x$TARGET : 'xMIPS' > /dev/null]) + AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN) AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) AM_CONDITIONAL(X86, test x$TARGET = xX86) - AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD) -@@ -401,4 +407,8 @@ +@@ -567,4 +574,8 @@ AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc) diff --git a/Modules/_ctypes/libffi/.gitignore b/Modules/_ctypes/libffi/.gitignore new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/.gitignore @@ -0,0 +1,21 @@ +.libs +.deps +*.o +*.lo +.dirstamp +*.la +Makefile +config.log +config.status +*~ +fficonfig.h +include/ffi.h +include/ffitarget.h +libffi.pc +libtool +stamp-h1 +libffi*gz +autom4te.cache +libffi.xcodeproj/xcuserdata +libffi.xcodeproj/project.xcworkspace +ios/ diff --git a/Modules/_ctypes/libffi/.travis.yml b/Modules/_ctypes/libffi/.travis.yml new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/.travis.yml @@ -0,0 +1,8 @@ +language: c +compiler: + - gcc + - clang + +before_script: sudo apt-get install dejagnu + +script: ./configure && make && make check diff --git a/Modules/_ctypes/libffi/ChangeLog b/Modules/_ctypes/libffi/ChangeLog --- a/Modules/_ctypes/libffi/ChangeLog +++ b/Modules/_ctypes/libffi/ChangeLog @@ -1,8 +1,1360 @@ +2013-03-17 Anthony Green + + * README: Update for 3.0.13. + * configure.ac: Ditto. + * configure: Rebuilt. + * doc/*: Update version. + +2013-03-17 Dave Korn + + * src/closures.c (is_emutramp_enabled + [!FFI_MMAP_EXEC_EMUTRAMP_PAX]): Move default definition outside + enclosing #if scope. + +2013-03-17 Anthony Green + + * configure.ac: Only modify toolexecdir in certain cases. + * configure: Rebuilt. + +2013-03-16 Gilles Talis + + * src/powerpc/ffi.c (ffi_prep_args_SYSV): Don't use + fparg_count,etc on __NO_FPRS__ targets. + +2013-03-16 Alan Hourihane + + * src/m68k/sysv.S (epilogue): Don't use extb instruction on + m680000 machines. + +2013-03-16 Alex Gaynor + + * src/x86/ffi.c (ffi_prep_cif_machdep): Always align stack. + +2013-03-13 Markos Chandras + + * configure.ac: Add support for Imagination Technologies Meta. + * Makefile.am: Likewise. + * README: Add Imagination Technologies Meta details. + * src/metag/ffi.c: New. + * src/metag/ffitarget.h: Likewise. + * src/metag/sysv.S: Likewise. + +2013-02-24 Andreas Schwab + + * doc/libffi.texi (Structures): Fix missing category argument of + @deftp. + +2013-02-11 Anthony Green + + * configure.ac: Update release number to 3.0.12. + * configure: Rebuilt. + * README: Update release info. + +2013-02-10 Anthony Green + + * README: Add Moxie. + * src/moxie/ffi.c: Created. + * src/moxie/eabi.S: Created. + * src/moxie/ffitarget.h: Created. + * Makefile.am (nodist_libffi_la_SOURCES): Add Moxie. + * Makefile.in: Rebuilt. + * configure.ac: Add Moxie. + * configure: Rebuilt. + * testsuite/libffi.call/huge_struct.c: Disable format string + warnings for moxie*-*-elf tests. + +2013-02-10 Anthony Green + + * Makefile.am (LTLDFLAGS): Fix reference. + * Makefile.in: Rebuilt. + +2013-02-10 Anthony Green + + * README: Update supported platforms. Update test results link. + +2013-02-09 Anthony Green + + * testsuite/libffi.call/negint.c: Remove forced -O2. + * testsuite/libffi.call/many2.c (foo): Remove GCCism. + * testsuite/libffi.call/ffitest.h: Add default PRIuPTR definition. + + * src/sparc/v8.S (ffi_closure_v8): Import ancient ulonglong + closure return type fix developed by Martin v. L?wis for cpython + fork. + +2013-02-08 Andreas Tobler + + * src/powerpc/ffi.c (ffi_prep_cif_machdep): Fix small struct + support. + * src/powerpc/sysv.S: Ditto. + +2013-02-08 Anthony Green + + * testsuite/libffi.call/cls_longdouble.c: Remove xfail for + arm*-*-*. + +2013-02-08 Anthony Green + + * src/sparc/ffi.c (ffi_prep_closure_loc): Fix cache flushing for GCC. + +2013-02-08 Matthias Klose + + * man/ffi_prep_cif.3: Clean up for debian linter. + +2013-02-08 Peter Bergner + + * src/powerpc/ffi.c (ffi_prep_args_SYSV): Account for FP args pushed + on the stack. + +2013-02-08 Anthony Green + + * Makefile.am (EXTRA_DIST): Add missing files. + * testsuite/Makefile.am (EXTRA_DIST): Ditto. + * Makefile.in: Rebuilt. + +2013-02-08 Anthony Green + + * configure.ac: Move sparc asm config checks to within functions + for compatibility with sun tools. + * configure: Rebuilt. + * src/sparc/ffi.c (ffi_prep_closure_loc): Flush cache on v9 + systems. + * src/sparc/v8.S (ffi_flush_icache): Implement a sparc v9 cache + flusher. + +2013-02-08 Nathan Rossi + + * src/microblaze/ffi.c (ffi_closure_call_SYSV): Fix handling of + small big-endian structures. + (ffi_prep_args): Ditto. + +2013-02-07 Anthony Green + + * src/sparc/v8.S (ffi_call_v8): Fix typo from last patch + (effectively hiding ffi_call_v8). + +2013-02-07 Anthony Green + + * configure.ac: Update bug reporting address. + * configure.in: Rebuild. + + * src/sparc/v8.S (ffi_flush_icache): Out-of-line cache flusher for + Sun compiler. + * src/sparc/ffi.c (ffi_call): Remove warning. + Call ffi_flush_icache for non-GCC builds. + (ffi_prep_closure_loc): Use ffi_flush_icache. + + * Makefile.am (EXTRA_DIST): Add libtool-ldflags. + * Makefile.in: Rebuilt. + * libtool-ldflags: New file. + +2013-02-07 Daniel Schepler + + * configure.ac: Correctly identify x32 systems as 64-bit. + * m4/libtool.m4: Remove libtool expr error. + * aclocal.m4, configure: Rebuilt. + +2013-02-07 Anthony Green + + * configure.ac: Fix GCC usage test. + * configure: Rebuilt. + * README: Mention LLVM/GCC x86_64 issue. + * testsuite/Makefile.in: Rebuilt. + +2013-02-07 Anthony Green + + * testsuite/libffi.call/cls_double_va.c (main): Replace // style + comments with /* */ for xlc compiler. + * testsuite/libffi.call/stret_large.c (main): Ditto. + * testsuite/libffi.call/stret_large2.c (main): Ditto. + * testsuite/libffi.call/nested_struct1.c (main): Ditto. + * testsuite/libffi.call/huge_struct.c (main): Ditto. + * testsuite/libffi.call/float_va.c (main): Ditto. + * testsuite/libffi.call/cls_struct_va1.c (main): Ditto. + * testsuite/libffi.call/cls_pointer_stack.c (main): Ditto. + * testsuite/libffi.call/cls_pointer.c (main): Ditto. + * testsuite/libffi.call/cls_longdouble_va.c (main): Ditto. + +2013-02-06 Anthony Green + + * man/ffi_prep_cif.3: Clean up for debian lintian checker. + +2013-02-06 Anthony Green + + * Makefile.am (pkgconfigdir): Add missing pkgconfig install bits. + * Makefile.in: Rebuild. + +2013-02-02 Mark H Weaver + + * src/x86/ffi64.c (ffi_call): Sign-extend integer arguments passed + via general purpose registers. + +2013-01-21 Nathan Rossi + + * README: Add MicroBlaze details. + * Makefile.am: Add MicroBlaze support. + * configure.ac: Likewise. + * src/microblaze/ffi.c: New. + * src/microblaze/ffitarget.h: Likewise. + * src/microblaze/sysv.S: Likewise. + +2013-01-21 Nathan Rossi + * testsuite/libffi.call/return_uc.c: Fixed issue. + +2013-01-21 Chris Zankel + + * README: Add Xtensa support. + * Makefile.am: Likewise. + * configure.ac: Likewise. + * Makefile.in Regenerate. + * configure: Likewise. + * src/prep_cif.c: Handle Xtensa. + * src/xtensa: New directory. + * src/xtensa/ffi.c: New file. + * src/xtensa/ffitarget.h: Ditto. + * src/xtensa/sysv.S: Ditto. + +2013-01-11 Anthony Green + + * src/powerpc/ffi_darwin.c (ffi_prep_args): Replace // style + comments with /* */ for xlc compiler. + * src/powerpc/aix.S (ffi_call_AIX): Ditto. + * testsuite/libffi.call/ffitest.h (allocate_mmap): Delete + deprecated inline function. + * testsuite/libffi.special/ffitestcxx.h: Ditto. + * README: Add update for AIX support. + +2013-01-11 Anthony Green + + * configure.ac: Robustify pc relative reloc check. + * m4/ax_cc_maxopt.m4: Don't -malign-double. This is an ABI + changing option for 32-bit x86. + * aclocal.m4, configure: Rebuilt. + * README: Update supported target list. + +2013-01-10 Anthony Green + + * README (tested): Add Compiler column to table. + +2013-01-10 Anthony Green + + * src/x86/ffi64.c (struct register_args): Make sse array and array + of unions for sunpro compiler compatibility. + +2013-01-10 Anthony Green + + * configure.ac: Test target platform size_t size. Handle both 32 + and 64-bit builds for x86_64-* and i?86-* targets (allowing for + CFLAG option to change default settings). + * configure, aclocal.m4: Rebuilt. + +2013-01-10 Anthony Green + + * testsuite/libffi.special/special.exp: Only run exception + handling tests when using GNU compiler. + + * m4/ax_compiler_vendor.m4: New file. + * configure.ac: Test for compiler vendor and don't use + AX_CFLAGS_WARN_ALL with the sun compiler. + * aclocal.m4, configure: Rebuilt. + +2013-01-10 Anthony Green + + * include/ffi_common.h: Don't use GCCisms to define types when + building with the SUNPRO compiler. + +2013-01-10 Anthony Green + + * configure.ac: Put local.exp in the right place. + * configure: Rebuilt. + + * src/x86/ffi.c: Update comment about regparm function attributes. + * src/x86/sysv.S (ffi_closure_SYSV): The SUNPRO compiler requires + that all function arguments be passed on the stack (no regparm + support). + +2013-01-08 Anthony Green + + * configure.ac: Generate local.exp. This sets CC_FOR_TARGET + when we are using the vendor compiler. + * testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): Point to + ../local.exp. + * configure, testsuite/Makefile.in: Rebuilt. + + * testsuite/libffi.call/call.exp: Run tests with different + options, depending on whether or not we are using gcc or the + vendor compiler. + * testsuite/lib/libffi.exp (libffi-init): Set using_gcc based on + whether or not we are building/testing with gcc. + +2013-01-08 Anthony Green + + * configure.ac: Switch x86 solaris target to X86 by default. + * configure: Rebuilt. + +2013-01-08 Anthony Green + + * configure.ac: Fix test for read-only eh_frame. + * configure: Rebuilt. + +2013-01-08 Anthony Green + + * src/x86/sysv.S, src/x86/unix64.S: Only emit DWARF unwind info + when building with the GNU toolchain. + * testsuite/libffi.call/ffitest.h (CHECK): Fix for Solaris vendor + compiler. + +2013-01-07 Thorsten Glaser + + * testsuite/libffi.call/cls_uchar_va.c, + testsuite/libffi.call/cls_ushort_va.c, + testsuite/libffi.call/va_1.c: Testsuite fixes. + +2013-01-07 Thorsten Glaser + + * src/m68k/ffi.c (CIF_FLAGS_SINT8, CIF_FLAGS_SINT16): Define. + (ffi_prep_cif_machdep): Fix 8-bit and 16-bit signed calls. + * src/m68k/sysv.S (ffi_call_SYSV, ffi_closure_SYSV): Ditto. + +2013-01-04 Anthony Green + + * Makefile.am (AM_CFLAGS): Don't automatically add -fexceptions + and -Wall. This is set in the configure script after testing for + GCC. + * Makefile.in: Rebuilt. + +2013-01-02 rofl0r + + * src/powerpc/ffi.c (ffi_prep_cif_machdep): Fix build error on ppc + when long double == double. + +2013-01-02 Reini Urban + + * Makefile.am (libffi_la_LDFLAGS): Add -no-undefined to LDFLAGS + (required for shared libs on cygwin/mingw). + * Makefile.in: Rebuilt. + +2012-10-31 Alan Modra + + * src/powerpc/linux64_closure.S: Add new ABI support. + * src/powerpc/linux64.S: Likewise. + +2012-10-30 Magnus Granberg + Pavel Labushev + + * configure.ac: New options pax_emutramp + * configure, fficonfig.h.in: Regenerated + * src/closures.c: New function emutramp_enabled_check() and + checks. + +2012-10-30 Frederick Cheung + + * configure.ac: Enable FFI_MAP_EXEC_WRIT for Darwin 12 (mountain + lion) and future version. + * configure: Rebuild. + +2012-10-30 James Greenhalgh + Marcus Shawcroft + + * README: Add details of aarch64 port. + * src/aarch64/ffi.c: New. + * src/aarch64/ffitarget.h: Likewise. + * src/aarch64/sysv.S: Likewise. + * Makefile.am: Support aarch64. + * configure.ac: Support aarch64. + * Makefile.in, configure: Rebuilt. + +2012-10-30 James Greenhalgh + Marcus Shawcroft + + * testsuite/lib/libffi.exp: Add support for aarch64. + * testsuite/libffi.call/cls_struct_va1.c: New. + * testsuite/libffi.call/cls_uchar_va.c: Likewise. + * testsuite/libffi.call/cls_uint_va.c: Likewise. + * testsuite/libffi.call/cls_ulong_va.c: Likewise. + * testsuite/libffi.call/cls_ushort_va.c: Likewise. + * testsuite/libffi.call/nested_struct11.c: Likewise. + * testsuite/libffi.call/uninitialized.c: Likewise. + * testsuite/libffi.call/va_1.c: Likewise. + * testsuite/libffi.call/va_struct1.c: Likewise. + * testsuite/libffi.call/va_struct2.c: Likewise. + * testsuite/libffi.call/va_struct3.c: Likewise. + +2012-10-12 Walter Lee + + * Makefile.am: Add TILE-Gx/TILEPro support. + * configure.ac: Likewise. + * Makefile.in: Regenerate. + * configure: Likewise. + * src/prep_cif.c (ffi_prep_cif_core): Handle TILE-Gx/TILEPro. + * src/tile: New directory. + * src/tile/ffi.c: New file. + * src/tile/ffitarget.h: Ditto. + * src/tile/tile.S: Ditto. + +2012-10-12 Matthias Klose + + * generate-osx-source-and-headers.py: Normalize whitespace. + +2012-09-14 David Edelsohn + + * configure: Regenerated. + +2012-08-26 Andrew Pinski + + PR libffi/53014 + * src/mips/ffi.c (ffi_prep_closure_loc): Allow n32 with soft-float and n64 with + soft-float. + +2012-08-08 Uros Bizjak + + * src/s390/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, + just return FFI_BAD_ABI when things are wrong. + +2012-07-18 H.J. Lu + + PR libffi/53982 + PR libffi/53973 + * src/x86/ffitarget.h: Check __ILP32__ instead of __LP64__ for x32. + (FFI_SIZEOF_JAVA_RAW): Defined to 4 for x32. + +2012-05-16 H.J. Lu + + * configure: Regenerated. + +2012-05-05 Nicolas Lelong + + * libffi.xcodeproj/project.pbxproj: Fixes. + * README: Update for iOS builds. + +2012-04-23 Alexandre Keunecke I. de Mendonca + + * configure.ac: Add Blackfin/sysv support + * Makefile.am: Add Blackfin/sysv support + * src/bfin/ffi.c: Add Blackfin/sysv support + * src/bfin/ffitarget.h: Add Blackfin/sysv support + +2012-04-11 Anthony Green + + * Makefile.am (EXTRA_DIST): Add new script. + * Makefile.in: Rebuilt. + +2012-04-11 Zachary Waldowski + + * generate-ios-source-and-headers.py, + libffi.xcodeproj/project.pbxproj: Support a Mac static library via + Xcode. Set iOS compatibility to 4.0. Move iOS trampoline + generation into an Xcode "run script" phase. Include both as + Xcode build scripts. Don't always regenerate config files. + +2012-04-10 Anthony Green + + * src/powerpc/ffi_darwin.c (ffi_prep_args): Add missing semicolon. + +2012-04-06 Anthony Green + + * Makefile.am (EXTRA_DIST): Add new iOS/xcode files. + * Makefile.in: Rebuilt. + +2012-04-06 Mike Lewis + + * generate-ios-source-and-headers.py: New file. + * libffi.xcodeproj/project.pbxproj: New file. + * README: Update instructions on building iOS binary. + * build-ios.sh: Delete. + +2012-04-06 Anthony Green + + * src/x86/ffi64.c (UINT128): Define differently for Intel and GNU + compilers, then use it. + +2012-04-06 H.J. Lu + + * m4/libtool.m4 (_LT_ENABLE_LOCK): Support x32. + +2012-04-06 Anthony Green + + * testsuite/Makefile.am (EXTRA_DIST): Add missing test cases. + * testsuite/Makefile.in: Rebuilt. + +2012-04-05 Zachary Waldowski + + * include/ffi.h.in: Add missing trampoline table fields. + * src/arm/sysv.S: Fix ENTRY definition, and wrap symbol references + in CNAME. + * src/x86/ffi.c: Wrap Windows specific code in ifdefs. + +2012-04-02 Peter Bergner + + * src/powerpc/ffi.c (ffi_prep_args_SYSV): Declare double_tmp. + Silence casting pointer to integer of different size warning. + Delete goto to previously deleted label. + (ffi_call): Silence possibly undefined warning. + (ffi_closure_helper_SYSV): Declare variable type. + +2012-04-02 Peter Rosin + + * src/x86/win32.S (ffi_call_win32): Sign/zero extend the return + value in the Intel version as is already done for the AT&T version. + (ffi_closure_SYSV): Likewise. + (ffi_closure_raw_SYSV): Likewise. + (ffi_closure_STDCALL): Likewise. + +2012-03-29 Peter Rosin + + * src/x86/win32.S (ffi_closure_raw_THISCALL): Unify the frame + generation, fix the ENDP label and remove the surplus third arg + from the 'lea' insn. + +2012-03-29 Peter Rosin + + * src/x86/win32.S (ffi_closure_raw_SYSV): Make the 'stubraw' label + visible outside the PROC, so that ffi_closure_raw_THISCALL can see + it. Also instruct the assembler to add a frame to the function. + +2012-03-23 Peter Rosin + + * Makefile.am (AM_CPPFLAGS): Add -DFFI_BUILDING. + * Makefile.in: Rebuilt. + * include/ffi.h.in [MSVC]: Add __declspec(dllimport) decorations + to all data exports, when compiling libffi clients using MSVC. + +2012-03-29 Peter Rosin + + * src/x86/ffitarget.h (ffi_abi): Add new ABI FFI_MS_CDECL and + make it the default for MSVC. + (FFI_TYPE_MS_STRUCT): New structure return convention. + * src/x86/ffi.c (ffi_prep_cif_machdep): Tweak the structure + return convention for FFI_MS_CDECL to be FFI_TYPE_MS_STRUCT + instead of an ordinary FFI_TYPE_STRUCT. + (ffi_prep_args): Treat FFI_TYPE_MS_STRUCT as FFI_TYPE_STRUCT. + (ffi_call): Likewise. + (ffi_prep_incoming_args_SYSV): Likewise. + (ffi_raw_call): Likewise. + (ffi_prep_closure_loc): Treat FFI_MS_CDECL as FFI_SYSV. + * src/x86/win32.S (ffi_closure_SYSV): For FFI_TYPE_MS_STRUCT, + return a pointer to the result structure in eax and don't pop + that pointer from the stack, the caller takes care of it. + (ffi_call_win32): Treat FFI_TYPE_MS_STRUCT as FFI_TYPE_STRUCT. + (ffi_closure_raw_SYSV): Likewise. + +2012-03-22 Peter Rosin + + * testsuite/libffi.call/closure_stdcall.c [MSVC]: Add inline + assembly version with Intel syntax. + * testsuite/libffi.call/closure_thiscall.c [MSVC]: Likewise. + +2012-03-23 Peter Rosin + + * testsuite/libffi.call/ffitest.h: Provide abstration of + __attribute__((fastcall)) in the form of a __FASTCALL__ + define. Define it to __fastcall for MSVC. + * testsuite/libffi.call/fastthis1_win32.c: Use the above. + * testsuite/libffi.call/fastthis2_win32.c: Likewise. + * testsuite/libffi.call/fastthis3_win32.c: Likewise. + * testsuite/libffi.call/strlen2_win32.c: Likewise. + * testsuite/libffi.call/struct1_win32.c: Likewise. + * testsuite/libffi.call/struct2_win32.c: Likewise. + +2012-03-22 Peter Rosin + + * src/x86/win32.S [MSVC] (ffi_closure_THISCALL): Remove the manual + frame on function entry, MASM adds one automatically. + +2012-03-22 Peter Rosin + + * testsuite/libffi.call/ffitest.h [MSVC]: Add kludge for missing + bits in the MSVC headers. + +2012-03-22 Peter Rosin + + * testsuite/libffi.call/cls_12byte.c: Adjust to the C89 style + with no declarations after statements. + * testsuite/libffi.call/cls_16byte.c: Likewise. + * testsuite/libffi.call/cls_18byte.c: Likewise. + * testsuite/libffi.call/cls_19byte.c: Likewise. + * testsuite/libffi.call/cls_1_1byte.c: Likewise. + * testsuite/libffi.call/cls_20byte.c: Likewise. + * testsuite/libffi.call/cls_20byte1.c: Likewise. + * testsuite/libffi.call/cls_24byte.c: Likewise. + * testsuite/libffi.call/cls_2byte.c: Likewise. + * testsuite/libffi.call/cls_3_1byte.c: Likewise. + * testsuite/libffi.call/cls_3byte1.c: Likewise. + * testsuite/libffi.call/cls_3byte2.c: Likewise. + * testsuite/libffi.call/cls_4_1byte.c: Likewise. + * testsuite/libffi.call/cls_4byte.c: Likewise. + * testsuite/libffi.call/cls_5_1_byte.c: Likewise. + * testsuite/libffi.call/cls_5byte.c: Likewise. + * testsuite/libffi.call/cls_64byte.c: Likewise. + * testsuite/libffi.call/cls_6_1_byte.c: Likewise. + * testsuite/libffi.call/cls_6byte.c: Likewise. + * testsuite/libffi.call/cls_7_1_byte.c: Likewise. + * testsuite/libffi.call/cls_7byte.c: Likewise. + * testsuite/libffi.call/cls_8byte.c: Likewise. + * testsuite/libffi.call/cls_9byte1.c: Likewise. + * testsuite/libffi.call/cls_9byte2.c: Likewise. + * testsuite/libffi.call/cls_align_double.c: Likewise. + * testsuite/libffi.call/cls_align_float.c: Likewise. + * testsuite/libffi.call/cls_align_longdouble.c: Likewise. + * testsuite/libffi.call/cls_align_longdouble_split.c: Likewise. + * testsuite/libffi.call/cls_align_longdouble_split2.c: Likewise. + * testsuite/libffi.call/cls_align_pointer.c: Likewise. + * testsuite/libffi.call/cls_align_sint16.c: Likewise. + * testsuite/libffi.call/cls_align_sint32.c: Likewise. + * testsuite/libffi.call/cls_align_sint64.c: Likewise. + * testsuite/libffi.call/cls_align_uint16.c: Likewise. + * testsuite/libffi.call/cls_align_uint32.c: Likewise. + * testsuite/libffi.call/cls_align_uint64.c: Likewise. + * testsuite/libffi.call/cls_dbls_struct.c: Likewise. + * testsuite/libffi.call/cls_pointer_stack.c: Likewise. + * testsuite/libffi.call/err_bad_typedef.c: Likewise. + * testsuite/libffi.call/huge_struct.c: Likewise. + * testsuite/libffi.call/nested_struct.c: Likewise. + * testsuite/libffi.call/nested_struct1.c: Likewise. + * testsuite/libffi.call/nested_struct10.c: Likewise. + * testsuite/libffi.call/nested_struct2.c: Likewise. + * testsuite/libffi.call/nested_struct3.c: Likewise. + * testsuite/libffi.call/nested_struct4.c: Likewise. + * testsuite/libffi.call/nested_struct5.c: Likewise. + * testsuite/libffi.call/nested_struct6.c: Likewise. + * testsuite/libffi.call/nested_struct7.c: Likewise. + * testsuite/libffi.call/nested_struct8.c: Likewise. + * testsuite/libffi.call/nested_struct9.c: Likewise. + * testsuite/libffi.call/stret_large.c: Likewise. + * testsuite/libffi.call/stret_large2.c: Likewise. + * testsuite/libffi.call/stret_medium.c: Likewise. + * testsuite/libffi.call/stret_medium2.c: Likewise. + * testsuite/libffi.call/struct1.c: Likewise. + * testsuite/libffi.call/struct1_win32.c: Likewise. + * testsuite/libffi.call/struct2.c: Likewise. + * testsuite/libffi.call/struct2_win32.c: Likewise. + * testsuite/libffi.call/struct3.c: Likewise. + * testsuite/libffi.call/struct4.c: Likewise. + * testsuite/libffi.call/struct5.c: Likewise. + * testsuite/libffi.call/struct6.c: Likewise. + * testsuite/libffi.call/struct7.c: Likewise. + * testsuite/libffi.call/struct8.c: Likewise. + * testsuite/libffi.call/struct9.c: Likewise. + * testsuite/libffi.call/testclosure.c: Likewise. + +2012-03-21 Peter Rosin + + * testsuite/libffi.call/float_va.c (float_va_fn): Use %f when + printing doubles (%lf is for long doubles). + (main): Likewise. + +2012-03-21 Peter Rosin + + * testsuite/lib/target-libpath.exp [*-*-cygwin*, *-*-mingw*] + (set_ld_library_path_env_vars): Add the library search dir to PATH + (and save PATH for later). + (restore_ld_library_path_env_vars): Restore PATH. + +2012-03-21 Peter Rosin + + * testsuite/lib/target-libpath.exp [*-*-cygwin*, *-*-mingw*] + (set_ld_library_path_env_vars): Add the library search dir to PATH + (and save PATH for later). + (restore_ld_library_path_env_vars): Restore PATH. + +2012-03-20 Peter Rosin + + * testsuite/libffi.call/strlen2_win32.c (main): Remove bug. + * src/x86/win32.S [MSVC] (ffi_closure_SYSV): Make the 'stub' label + visible outside the PROC, so that ffi_closure_THISCALL can see it. + +2012-03-20 Peter Rosin + + * testsuite/libffi.call/strlen2_win32.c (main): Remove bug. + * src/x86/win32.S [MSVC] (ffi_closure_SYSV): Make the 'stub' label + visible outside the PROC, so that ffi_closure_THISCALL can see it. + +2012-03-19 Alan Hourihane + + * src/m68k/ffi.c: Add MINT support. + * src/m68k/sysv.S: Ditto. + +2012-03-06 Chung-Lin Tang + + * src/arm/ffi.c (ffi_call): Add __ARM_EABI__ guard around call to + ffi_call_VFP(). + (ffi_prep_closure_loc): Add __ARM_EABI__ guard around use of + ffi_closure_VFP. + * src/arm/sysv.S: Add __ARM_EABI__ guard around VFP code. + +2012-03-19 chennam + + * src/powerpc/ffi_darwin.c (ffi_prep_closure_loc): Fix AIX closure + support. + +2012-03-13 Kaz Kojima + + * src/sh/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, + just return FFI_BAD_ABI when things are wrong. + * src/sh64/ffi.c (ffi_prep_closure_loc): Ditto. + +2012-03-09 David Edelsohn + + * src/powerpc/aix_closure.S (ffi_closure_ASM): Adjust for Darwin64 + change to return value of ffi_closure_helper_DARWIN and load type + from return type. + +2012-03-03 H.J. Lu + + * src/x86/ffi64.c (ffi_call): Cast the return value to unsigned + long. + (ffi_prep_closure_loc): Cast to 64bit address in trampoline. + (ffi_closure_unix64_inner): Cast return pointer to unsigned long + first. + + * src/x86/ffitarget.h (FFI_SIZEOF_ARG): Defined to 8 for x32. + (ffi_arg): Set to unsigned long long for x32. + (ffi_sarg): Set to long long for x32. + +2012-03-03 H.J. Lu + + * src/prep_cif.c (ffi_prep_cif_core): Properly check bad ABI. + +2012-03-03 Andoni Morales Alastruey + + * configure.ac: Add -no-undefined for both 32- and 64-bit x86 + windows-like hosts. + * configure: Rebuilt. + +2012-02-27 Mikael Pettersson + + PR libffi/52223 + * Makefile.am (FLAGS_TO_PASS): Define. + * Makefile.in: Regenerate. + +2012-02-23 Anthony Green + + * src/*/ffitarget.h: Ensure that users never include ffitarget.h + directly. + +2012-02-23 Kai Tietz + + PR libffi/52221 + * src/x86/ffi.c (ffi_closure_raw_THISCALL): New + prototype. + (ffi_prep_raw_closure_loc): Use ffi_closure_raw_THISCALL for + thiscall-convention. + (ffi_raw_call): Use ffi_prep_args_raw. + * src/x86/win32.S (ffi_closure_raw_THISCALL): Add + implementation for stub. + +2012-02-10 Kai Tietz + + * configure.ac (AM_LTLDFLAGS): Add -no-undefine for x64 + windows target. + * configure: Regenerated. + +2012-02-08 Kai Tietz + + * src/prep_cif.c (ffi_prep_cif): Allow for X86_WIN32 + also FFI_THISCALL. + * src/x86/ffi.c (ffi_closure_THISCALL): Add prototype. + (FFI_INIT_TRAMPOLINE_THISCALL): New trampoline code. + (ffi_prep_closure_loc): Add FFI_THISCALL support. + * src/x86/ffitarget.h (FFI_TRAMPOLINE_SIZE): Adjust size. + * src/x86/win32.S (ffi_closure_THISCALL): New closure code + for thiscall-calling convention. + * testsuite/libffi.call/closure_thiscall.c: New test. + +2012-01-28 Kai Tietz + + * src/libffi/src/x86/ffi.c (ffi_call_win32): Add new + argument to prototype for specify calling-convention. + (ffi_call): Add support for stdcall/thiscall convention. + (ffi_prep_args): Likewise. + (ffi_raw_call): Likewise. + * src/x86/ffitarget.h (ffi_abi): Add FFI_THISCALL and + FFI_FASTCALL. + * src/x86/win32.S (_ffi_call_win32): Add support for + fastcall/thiscall calling-convention calls. + * testsuite/libffi.call/fastthis1_win32.c: New test. + * testsuite/libffi.call/fastthis2_win32.c: New test. + * testsuite/libffi.call/fastthis3_win32.c: New test. + * testsuite/libffi.call/strlen2_win32.c: New test. + * testsuite/libffi.call/many2_win32.c: New test. + * testsuite/libffi.call/struct1_win32.c: New test. + * testsuite/libffi.call/struct2_win32.c: New test. + +2012-01-23 Uros Bizjak + + * src/alpha/ffi.c (ffi_prep_closure_loc): Check for bad ABI. + +2012-01-23 Anthony Green + Chris Young + + * configure.ac: Add Amiga support. + * configure: Rebuilt. + +2012-01-23 Dmitry Nadezhin + + * include/ffi_common.h (LIKELY, UNLIKELY): Fix definitions. + +2012-01-23 Andreas Schwab + + * src/m68k/sysv.S (ffi_call_SYSV): Properly test for plain + mc68000. Test for __HAVE_68881__ in addition to __MC68881__. + +2012-01-19 Jakub Jelinek + + PR rtl-optimization/48496 + * src/ia64/ffi.c (ffi_call): Fix up aliasing violations. + +2012-01-09 Rainer Orth + + * configure.ac (i?86-*-*): Set TARGET to X86_64. + * configure: Regenerate. + +2011-12-07 Andrew Pinski + + PR libffi/50051 + * src/mips/n32.S: Add ".set mips4". + +2011-11-21 Andreas Tobler + + * configure: Regenerate. + +2011-11-12 David Gilbert + + * doc/libffi.texi, include/ffi.h.in, include/ffi_common.h, + man/Makefile.am, man/ffi.3, man/ffi_prep_cif.3, + man/ffi_prep_cif_var.3, src/arm/ffi.c, src/arm/ffitarget.h, + src/cris/ffi.c, src/prep_cif.c, + testsuite/libffi.call/cls_double_va.c, + testsuite/libffi.call/cls_longdouble_va.c, + testsuite/libffi.call/float_va.c: Many changes to support variadic + function calls. + +2011-11-12 Kyle Moffett + + * src/powerpc/ffi.c, src/powerpc/ffitarget.h, + src/powerpc/ppc_closure.S, src/powerpc/sysv.S: Many changes for + softfloat powerpc variants. + +2011-11-12 Petr Salinger + + * configure.ac (FFI_EXEC_TRAMPOLINE_TABLE): Fix kfreebsd support. + * configure: Rebuilt. + +2011-11-12 Timothy Wall + + * src/arm/ffi.c (ffi_prep_args, ffi_prep_incoming_args_SYSV): Max + alignment of 4 for wince on ARM. + +2011-11-12 Kyle Moffett + Anthony Green + + * src/ppc/sysv.S, src/ppc/ffi.c: Remove use of ppc string + instructions (not available on some cores, like the PPC440). + +2011-11-12 Kimura Wataru + + * m4/ax_enable_builddir: Change from string comparison to numeric + comparison for wc output. + * configure.ac: Enable FFI_MMAP_EXEC_WRIT for darwin11 aka Mac OS + X 10.7. + * configure: Rebuilt. + +2011-11-12 Anthony Green + + * Makefile.am (AM_CCASFLAGS): Add -g option to build assembly + files with debug info. + * Makefile.in: Rebuilt. + +2011-11-12 Jasper Lievisse Adriaanse + + * README: Update list of supported OpenBSD systems. + +2011-11-12 Anthony Green + + * libtool-version: Update. + * Makefile.am (nodist_libffi_la_SOURCES): Add src/debug.c if + FFI_DEBUG. + (libffi_la_SOURCES): Remove src/debug.c + (EXTRA_DIST): Add src/debug.c + * Makefile.in: Rebuilt. + * README: Update for 3.0.11. + +2011-11-10 Richard Henderson + + * configure.ac (GCC_AS_CFI_PSEUDO_OP): Use it instead of inline check. + * configure, aclocal.m4: Rebuild. + +2011-09-04 Iain Sandoe + + PR libffi/49594 + * src/powerpc/darwin_closure.S (stubs): Make the stub binding + helper reference track the architecture pointer size. + +2011-08-25 Andrew Haley + + * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Remove hard-coded assembly + instructions. + * src/arm/sysv.S (ffi_arm_trampoline): Put them here instead. + +2011-07-11 Andrew Haley + + * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Clear icache. + +2011-06-29 Rainer Orth + + * testsuite/libffi.call/cls_double_va.c: Move PR number to comment. + * testsuite/libffi.call/cls_longdouble_va.c: Likewise. + +2011-06-29 Rainer Orth + + PR libffi/46660 + * testsuite/libffi.call/cls_double_va.c: xfail dg-output on + mips-sgi-irix6*. + * testsuite/libffi.call/cls_longdouble_va.c: Likewise. + +2011-06-14 Rainer Orth + + * testsuite/libffi.call/huge_struct.c (test_large_fn): Use PRIu8, + PRId8 instead of %hhu, %hhd. + * testsuite/libffi.call/ffitest.h [__alpha__ && __osf__] (PRId8, + PRIu8): Define. + [__sgi__] (PRId8, PRIu8): Define. + +2011-04-29 Rainer Orth + + * src/alpha/osf.S (UA_SI, FDE_ENCODING, FDE_ENCODE, FDE_ARANGE): + Define. + Use them to handle ELF vs. ECOFF differences. + [__osf__] (_GLOBAL__F_ffi_call_osf): Define. + +2011-03-30 Timothy Wall + + * src/powerpc/darwin.S: Fix unknown FDE encoding. + * src/powerpc/darwin_closure.S: ditto. + +2011-02-25 Anthony Green + + * src/powerpc/ffi.c (ffi_prep_closure_loc): Allow for more + 32-bit ABIs. + +2011-02-15 Anthony Green + + * m4/ax_cc_maxopt.m4: Don't -malign-double or use -ffast-math. + * configure: Rebuilt. + +2011-02-13 Ralf Wildenhues + + * configure: Regenerate. + +2011-02-13 Anthony Green + + * include/ffi_common.h (UNLIKELY, LIKELY): Define. + * src/x86/ffi64.c (UNLIKELY, LIKELY): Remove definition. + * src/prep_cif.c (UNLIKELY, LIKELY): Remove definition. + + * src/prep_cif.c (initialize_aggregate): Convert assertion into + FFI_BAD_TYPEDEF return. Initialize arg size and alignment to 0. + + * src/pa/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, + just return FFI_BAD_ABI when things are wrong. + * src/arm/ffi.c (ffi_prep_closure_loc): Ditto. + * src/powerpc/ffi.c (ffi_prep_closure_loc): Ditto. + * src/mips/ffi.c (ffi_prep_closure_loc): Ditto. + * src/ia64/ffi.c (ffi_prep_closure_loc): Ditto. + * src/avr32/ffi.c (ffi_prep_closure_loc): Ditto. + +2011-02-11 Anthony Green + + * src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, + just return FFI_BAD_ABI when things are wrong. + +2012-02-11 Eric Botcazou + + * src/sparc/v9.S (STACKFRAME): Bump to 176. + +2011-02-09 Stuart Shelton + + http://bugs.gentoo.org/show_bug.cgi?id=286911 + * src/mips/ffitarget.h: Clean up error messages. + * src/java_raw_api.c (ffi_java_translate_args): Cast raw arg to + ffi_raw*. + * include/ffi.h.in: Add pragma for SGI compiler. + +2011-02-09 Anthony Green + + * configure.ac: Add powerpc64-*-darwin* support. + +2011-02-09 Anthony Green + + * README: Mention Interix. + +2011-02-09 Jonathan Callen + + * configure.ac: Add Interix to win32/cygwin/mingw case. + * configure: Ditto. + * src/closures.c: Treat Interix like Cygwin, instead of as a + generic win32. + +2011-02-09 Anthony Green + + * testsuite/libffi.call/err_bad_typedef.c: Remove xfail. + * testsuite/libffi.call/err_bad_abi.c: Remove xfail. + * src/x86/ffi64.c (UNLIKELY, LIKELY): Define. + (ffi_prep_closure_loc): Check for bad ABI. + * src/prep_cif.c (UNLIKELY, LIKELY): Define. + (initialize_aggregate): Check for bad types. + +2011-02-09 Landon Fuller + + * Makefile.am (EXTRA_DIST): Add build-ios.sh, src/arm/gentramp.sh, + src/arm/trampoline.S. + (nodist_libffi_la_SOURCES): Add src/arc/trampoline.S. + * configure.ac (FFI_EXEC_TRAMPOLINE_TABLE): Define. + * src/arm/ffi.c (ffi_trampoline_table) + (ffi_closure_trampoline_table_page, ffi_trampoline_table_entry) + (FFI_TRAMPOLINE_CODELOC_CONFIG, FFI_TRAMPOLINE_CONFIG_PAGE_OFFSET) + (FFI_TRAMPOLINE_COUNT, ffi_trampoline_lock, ffi_trampoline_tables) + (ffi_trampoline_table_alloc, ffi_closure_alloc, ffi_closure_free): + Define for FFI_EXEC_TRAMPOLINE_TABLE case (iOS). + (ffi_prep_closure_loc): Handl FFI_EXEC_TRAMPOLINE_TABLE case + separately. + * src/arm/sysv.S: Handle Apple iOS host. + * src/closures.c: Handle FFI_EXEC_TRAMPOLINE_TABLE case. + * build-ios.sh: New file. + * fficonfig.h.in, configure, Makefile.in: Rebuilt. + * README: Mention ARM iOS. + +2011-02-08 Oren Held + + * src/dlmalloc.c (_STRUCT_MALLINFO): Define in order to avoid + redefinition of mallinfo on HP-UX. + +2011-02-08 Ginn Chen + + * src/sparc/ffi.c (ffi_call): Make compatible with Solaris Studio + aggregate return ABI. Flush cache. + (ffi_prep_closure_loc): Flush cache. + +2011-02-11 Anthony Green + + From Tom Honermann : + * src/powerpc/aix.S (ffi_call_AIX): Support for xlc toolchain on + AIX. Declare .ffi_prep_args. Insert nops after branch + instructions so that the AIX linker can insert TOC reload + instructions. + * src/powerpc/aix_closure.S: Declare .ffi_closure_helper_DARWIN. + +2011-02-08 Ed + + * src/powerpc/asm.h: Fix grammar nit in comment. + +2011-02-08 Uli Link + + * include/ffi.h.in (FFI_64_BIT_MAX): Define and use. + +2011-02-09 Rainer Orth + + PR libffi/46661 + * testsuite/libffi.call/cls_pointer.c (main): Cast void * to + uintptr_t first. + * testsuite/libffi.call/cls_pointer_stack.c (main): Likewise. + +2011-02-08 Rafael Avila de Espindola + + * configure.ac: Fix x86 test for pc related relocs. + * configure: Rebuilt. + +2011-02-07 Joel Sherrill + + * libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing. + Handle case when CPU variant does not have long double support. + * libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire, + and cores with soft floating point. + +2011-02-07 Joel Sherrill + + * configure.ac: Add mips*-*-rtems* support. + * configure: Regenerate. + * src/mips/ffitarget.h: Ensure needed constants are available + for targets which do not have sgidefs.h. + +2011-01-26 Dave Korn + + PR target/40125 + * configure.ac (AM_LTLDFLAGS): Add -bindir option for windows DLLs. + * configure: Regenerate. + +2010-12-18 Iain Sandoe + + PR libffi/29152 + PR libffi/42378 + * src/powerpc/darwin_closure.S: Provide Darwin64 implementation, + update comments. + * src/powerpc/ffitarget.h (POWERPC_DARWIN64): New, + (FFI_TRAMPOLINE_SIZE): Update for Darwin64. + * src/powerpc/darwin.S: Provide Darwin64 implementation, + update comments. + * src/powerpc/ffi_darwin.c: Likewise. + +2010-12-06 Rainer Orth + + * configure.ac (libffi_cv_as_ascii_pseudo_op): Use double + backslashes. + (libffi_cv_as_string_pseudo_op): Likewise. + * configure: Regenerate. + +2010-12-03 Chung-Lin Tang + + * src/arm/sysv.S (ffi_closure_SYSV): Add UNWIND to .pad directive. + (ffi_closure_VFP): Same. + (ffi_call_VFP): Move down to before ffi_closure_VFP. Add '.fpu vfp' + directive. + +2010-12-01 Rainer Orth + + * testsuite/libffi.call/ffitest.h [__sgi] (PRId64, PRIu64): Define. + (PRIuPTR): Define. + +2010-11-29 Richard Henderson + Rainer Orth + + * src/x86/sysv.S (FDE_ENCODING, FDE_ENCODE): Define. + (.eh_frame): Use FDE_ENCODING. + (.LASFDE1, .LASFDE2, LASFDE3): Simplify with FDE_ENCODE. + +2010-11-22 Jacek Caban + + * configure.ac: Check for symbol underscores on mingw-w64. + * configure: Rebuilt. + * src/x86/win64.S: Correctly access extern symbols in respect to + underscores. + +2010-11-15 Rainer Orth + + * testsuite/lib/libffi-dg.exp: Rename ... + * testsuite/lib/libffi.exp: ... to this. + * libffi/testsuite/libffi.call/call.exp: Don't load libffi-dg.exp. + * libffi/testsuite/libffi.special/special.exp: Likewise. + +2010-10-28 Chung-Lin Tang + + * src/arm/ffi.c (ffi_prep_args): Add VFP register argument handling + code, new parameter, and return value. Update comments. + (ffi_prep_cif_machdep): Add case for VFP struct return values. Add + call to layout_vfp_args(). + (ffi_call_SYSV): Update declaration. + (ffi_call_VFP): New declaration. + (ffi_call): Add VFP struct return conditions. Call ffi_call_VFP() + when ABI is FFI_VFP. + (ffi_closure_VFP): New declaration. + (ffi_closure_SYSV_inner): Add new vfp_args parameter, update call to + ffi_prep_incoming_args_SYSV(). + (ffi_prep_incoming_args_SYSV): Update parameters. Add VFP argument + case handling. + (ffi_prep_closure_loc): Pass ffi_closure_VFP to trampoline + construction under VFP hard-float. + (rec_vfp_type_p): New function. + (vfp_type_p): Same. + (place_vfp_arg): Same. + (layout_vfp_args): Same. + * src/arm/ffitarget.h (ffi_abi): Add FFI_VFP. Define FFI_DEFAULT_ABI + based on __ARM_PCS_VFP. + (FFI_EXTRA_CIF_FIELDS): Define for adding VFP hard-float specific + fields. + (FFI_TYPE_STRUCT_VFP_FLOAT): Define internally used type code. + (FFI_TYPE_STRUCT_VFP_DOUBLE): Same. + * src/arm/sysv.S (ffi_call_SYSV): Change call of ffi_prep_args() to + direct call. Move function pointer load upwards. + (ffi_call_VFP): New function. + (ffi_closure_VFP): Same. + + * testsuite/lib/libffi-dg.exp (check-flags): New function. + (dg-skip-if): New function. + * testsuite/libffi.call/cls_double_va.c: Skip if target is arm*-*-* + and compiler options include -mfloat-abi=hard. + * testsuite/libffi.call/cls_longdouble_va.c: Same. + +2010-10-01 Jakub Jelinek + + PR libffi/45677 + * src/x86/ffi64.c (ffi_prep_cif_machdep): Ensure cif->bytes is + a multiple of 8. + * testsuite/libffi.call/many2.c: New test. + +2010-08-20 Mark Wielaard + + * src/closures.c (open_temp_exec_file_mnt): Check if getmntent_r + returns NULL. + +2010-08-09 Andreas Tobler + + * configure.ac: Add target powerpc64-*-freebsd*. + * configure: Regenerate. + * testsuite/libffi.call/cls_align_longdouble_split.c: Pass + -mlong-double-128 only to linux targets. + * testsuite/libffi.call/cls_align_longdouble_split2.c: Likewise. + * testsuite/libffi.call/cls_longdouble.c: Likewise. + * testsuite/libffi.call/huge_struct.c: Likewise. + +2010-08-05 Dan Witte + + * Makefile.am: Pass FFI_DEBUG define to msvcc.sh for linking to the + debug CRT when --enable-debug is given. + * configure.ac: Define it. + * msvcc.sh: Translate -g and -DFFI_DEBUG appropriately. + +2010-08-04 Dan Witte + + * src/x86/ffitarget.h: Add X86_ANY define for all x86/x86_64 + platforms. + * src/x86/ffi.c: Remove redundant ifdef checks. + * src/prep_cif.c: Push stack space computation into src/x86/ffi.c + for X86_ANY so return value space doesn't get added twice. + +2010-08-03 Neil Rashbrooke + + * msvcc.sh: Don't pass -safeseh to ml64 because behavior is buggy. + +2010-07-22 Dan Witte + + * src/*/ffitarget.h: Make FFI_LAST_ABI one past the last valid ABI. + * src/prep_cif.c: Fix ABI assertion. + * src/cris/ffi.c: Ditto. + +2010-07-10 Evan Phoenix + + * src/closures.c (selinux_enabled_check): Fix strncmp usage bug. + +2010-07-07 Dan Hor?k + + * include/ffi.h.in: Protect #define with #ifndef. + * src/powerpc/ffitarget.h: Ditto. + * src/s390/ffitarget.h: Ditto. + * src/sparc/ffitarget.h: Ditto. + +2010-07-07 Neil Roberts + + * src/x86/sysv.S (ffi_call_SYSV): Align the stack pointer to + 16-bytes. + +2010-07-02 Jakub Jelinek + + * Makefile.am (AM_MAKEFLAGS): Pass also mandir to submakes. + * Makefile.in: Regenerated. + +2010-05-19 Rainer Orth + + * configure.ac (libffi_cv_as_x86_pcrel): Check for illegal in as + output, too. + (libffi_cv_as_ascii_pseudo_op): Check for .ascii. + (libffi_cv_as_string_pseudo_op): Check for .string. + * configure: Regenerate. + * fficonfig.h.in: Regenerate. + * src/x86/sysv.S (.eh_frame): Use .ascii, .string or error. + +2010-05-11 Dan Witte + + * doc/libffi.tex: Document previous change. + +2010-05-11 Makoto Kato + + * src/x86/ffi.c (ffi_call): Don't copy structs passed by value. + +2010-05-05 Michael Kohler + + * src/dlmalloc.c (dlfree): Fix spelling. + * src/ia64/ffi.c (ffi_prep_cif_machdep): Ditto. + * configure.ac: Ditto. + * configure: Rebuilt. + +2010-04-13 Dan Witte + + * msvcc.sh: Build with -W3 instead of -Wall. + * src/powerpc/ffi_darwin.c: Remove build warnings. + * src/x86/ffi.c: Ditto. + * src/x86/ffitarget.h: Ditto. + +2010-04-12 Dan Witte + Walter Meinl + + * configure.ac: Add OS/2 support. + * configure: Rebuilt. + * src/closures.c: Ditto. + * src/dlmalloc.c: Ditto. + * src/x86/win32.S: Ditto. + +2010-04-07 Jakub Jelinek + + * testsuite/libffi.call/err_bad_abi.c: Remove unused args variable. + +2010-04-02 Ralf Wildenhues + + * Makefile.in: Regenerate. + * aclocal.m4: Regenerate. + * include/Makefile.in: Regenerate. + * man/Makefile.in: Regenerate. + * testsuite/Makefile.in: Regenerate. + +2010-03-30 Dan Witte + + * msvcc.sh: Disable build warnings. + * README (tested): Clarify windows build procedure. + +2010-03-15 Rainer Orth + + * configure.ac (libffi_cv_as_x86_64_unwind_section_type): New test. + * configure: Regenerate. + * fficonfig.h.in: Regenerate. + * libffi/src/x86/unix64.S (.eh_frame) + [HAVE_AS_X86_64_UNWIND_SECTION_TYPE]: Use @unwind section type. + 2010-03-14 Matthias Klose * src/x86/ffi64.c: Fix typo in comment. * src/x86/ffi.c: Use /* ... */ comment style. +2010-02-24 Rainer Orth + + * doc/libffi.texi (The Closure API): Fix typo. + * doc/libffi.info: Remove. + +2010-02-15 Matthias Klose + + * src/arm/sysv.S (__ARM_ARCH__): Define for processor + __ARM_ARCH_7EM__. + +2010-01-15 Anthony Green + + * README: Add notes on building with Microsoft Visual C++. + +2010-01-15 Daniel Witte + + * msvcc.sh: New file. + + * src/x86/win32.S: Port assembly routines to MSVC and #ifdef. + * src/x86/ffi.c: Tweak function declaration and remove excess + parens. + * include/ffi.h.in: Add __declspec(align(8)) to typedef struct + ffi_closure. + + * src/x86/ffi.c: Merge ffi_call_SYSV and ffi_call_STDCALL into new + function ffi_call_win32 on X86_WIN32. + * src/x86/win32.S (ffi_call_SYSV): Rename to ffi_call_win32. + (ffi_call_STDCALL): Remove. + + * src/prep_cif.c (ffi_prep_cif): Move stack space allocation code + to ffi_prep_cif_machdep for x86. + * src/x86/ffi.c (ffi_prep_cif_machdep): To here. + +2010-01-15 Oliver Kiddle + + * src/x86/ffitarget.h (ffi_abi): Check for __i386 and __amd64 for + Sun Studio compiler compatibility. + +2010-01-12 Conrad Irwin + + * doc/libffi.texi: Add closure example. + 2010-01-07 Rainer Orth PR libffi/40701 @@ -148,6 +1500,13 @@ * src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE type on HP-UX. +2012-02-13 Kai Tietz + + PR libffi/52221 + * src/x86/ffi.c (ffi_prep_raw_closure_loc): Add thiscall + support for X86_WIN32. + (FFI_INIT_TRAMPOLINE_THISCALL): Fix displacement. + 2009-12-11 Eric Botcazou * src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long @@ -322,6 +1681,11 @@ * man/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. +2011-08-22 Jasper Lievisse Adriaanse + + * configure.ac: Add OpenBSD/hppa and OpenBSD/powerpc support. + * configure: Rebuilt. + 2009-07-30 Ralf Wildenhues * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force. diff --git a/Modules/_ctypes/libffi/ChangeLog.libffi b/Modules/_ctypes/libffi/ChangeLog.libffi --- a/Modules/_ctypes/libffi/ChangeLog.libffi +++ b/Modules/_ctypes/libffi/ChangeLog.libffi @@ -1,35 +1,6 @@ -2010-01-15 Anthony Green +2011-02-08 Andreas Tobler - * README: Add notes on building with Microsoft Visual C++. - -2010-01-15 Daniel Witte - - * msvcc.sh: New file. - - * src/x86/win32.S: Port assembly routines to MSVC and #ifdef. - * src/x86/ffi.c: Tweak function declaration and remove excess - parens. - * include/ffi.h.in: Add __declspec(align(8)) to typedef struct - ffi_closure. - - * src/x86/ffi.c: Merge ffi_call_SYSV and ffi_call_STDCALL into new - function ffi_call_win32 on X86_WIN32. - * src/x86/win32.S (ffi_call_SYSV): Rename to ffi_call_win32. - (ffi_call_STDCALL): Remove. - - * src/prep_cif.c (ffi_prep_cif): Move stack space allocation code - to ffi_prep_cif_machdep for x86. - * src/x86/ffi.c (ffi_prep_cif_machdep): To here. - -2010-01-15 Oliver Kiddle - - * src/x86/ffitarget.h (ffi_abi): Check for __i386 and __amd64 for - Sun Studio compiler compatibility. - -2010-01-12 Conrad Irwin - - * doc/libffi.texi: Add closure example. - * doc/libffi.info: Rebuilt. + * testsuite/lib/libffi.exp: Tweak for stand-alone mode. 2009-12-25 Samuli Suominen @@ -603,8 +574,8 @@ * Makefile.am, include/Makefile.am: Move headers to libffi_la_SOURCES for new automake. * Makefile.in, include/Makefile.in: Rebuilt. - - * testsuite/lib/wrapper.exp: Copied from gcc tree to allow for + + * testsuite/lib/wrapper.exp: Copied from gcc tree to allow for execution outside of gcc tree. * testsuite/lib/target-libpath.exp: Ditto. diff --git a/Modules/_ctypes/libffi/LICENSE b/Modules/_ctypes/libffi/LICENSE --- a/Modules/_ctypes/libffi/LICENSE +++ b/Modules/_ctypes/libffi/LICENSE @@ -1,4 +1,4 @@ -libffi - Copyright (c) 1996-2009 Anthony Green, Red Hat, Inc and others. +libffi - Copyright (c) 1996-2012 Anthony Green, Red Hat, Inc and others. See source files for details. Permission is hereby granted, free of charge, to any person obtaining @@ -9,8 +9,8 @@ permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF diff --git a/Modules/_ctypes/libffi/Makefile.am b/Modules/_ctypes/libffi/Makefile.am --- a/Modules/_ctypes/libffi/Makefile.am +++ b/Modules/_ctypes/libffi/Makefile.am @@ -2,37 +2,50 @@ AUTOMAKE_OPTIONS = foreign subdir-objects +ACLOCAL_AMFLAGS = -I m4 + SUBDIRS = include testsuite man -EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ - src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \ - src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \ - src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \ - src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \ - src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \ - src/ia64/unix.S \ - src/mips/ffi.c src/mips/n32.S src/mips/o32.S \ - src/mips/ffitarget.h \ - src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ - src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ - src/powerpc/ffi.c src/powerpc/sysv.S \ - src/powerpc/linux64.S src/powerpc/linux64_closure.S \ - src/powerpc/ppc_closure.S src/powerpc/asm.h \ - src/powerpc/aix.S src/powerpc/darwin.S \ - src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ - src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ - src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ - src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h \ - src/sh64/ffi.c src/sh64/sysv.S src/sh64/ffitarget.h \ - src/sparc/v8.S src/sparc/v9.S src/sparc/ffitarget.h \ - src/sparc/ffi.c src/x86/darwin64.S \ - src/x86/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/win64.S \ - src/x86/darwin.S src/x86/freebsd.S \ - src/x86/ffi64.c src/x86/unix64.S src/x86/ffitarget.h \ - src/pa/ffitarget.h src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \ - src/frv/ffi.c src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c \ - libtool-version ChangeLog.libffi m4/libtool.m4 \ - m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 +EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ + src/aarch64/ffi.c src/aarch64/ffitarget.h src/aarch64/sysv.S \ + build-ios.sh src/alpha/ffi.c src/alpha/osf.S \ + src/alpha/ffitarget.h src/arm/ffi.c src/arm/sysv.S \ + src/arm/ffitarget.h src/avr32/ffi.c src/avr32/sysv.S \ + src/avr32/ffitarget.h src/cris/ffi.c src/cris/sysv.S \ + src/cris/ffitarget.h src/ia64/ffi.c src/ia64/ffitarget.h \ + src/ia64/ia64_flags.h src/ia64/unix.S src/mips/ffi.c \ + src/mips/n32.S src/mips/o32.S src/metag/ffi.c \ + src/metag/ffitarget.h src/metag/sysv.S src/moxie/ffi.c \ + src/moxie/ffitarget.h src/moxie/eabi.S src/mips/ffitarget.h \ + src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ + src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ + src/microblaze/ffi.c src/microblaze/sysv.S \ + src/microblaze/ffitarget.h src/powerpc/ffi.c \ + src/powerpc/sysv.S src/powerpc/linux64.S \ + src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \ + src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S \ + src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ + src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ + src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ + src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c \ + src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S \ + src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c \ + src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S \ + src/x86/win32.S src/x86/darwin.S src/x86/win64.S \ + src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S \ + src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c \ + src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c \ + src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S \ + src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c \ + src/tile/ffitarget.h src/tile/tile.S libtool-version \ + src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S \ + ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4 \ + m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \ + m4/ltversion.m4 src/arm/gentramp.sh src/debug.c msvcc.sh \ + generate-ios-source-and-headers.py \ + generate-osx-source-and-headers.py \ + libffi.xcodeproj/project.pbxproj src/arm/trampoline.S \ + libtool-ldflags info_TEXINFOS = doc/libffi.texi @@ -69,6 +82,7 @@ "exec_prefix=$(exec_prefix)" \ "infodir=$(infodir)" \ "libdir=$(libdir)" \ + "mandir=$(mandir)" \ "prefix=$(prefix)" \ "AR=$(AR)" \ "AS=$(AS)" \ @@ -79,14 +93,15 @@ "RANLIB=$(RANLIB)" \ "DESTDIR=$(DESTDIR)" +# Subdir rules rely on $(FLAGS_TO_PASS) +FLAGS_TO_PASS = $(AM_MAKEFLAGS) + MAKEOVERRIDES= -ACLOCAL_AMFLAGS=$(ACLOCAL_AMFLAGS) -I m4 - -lib_LTLIBRARIES = libffi.la +toolexeclib_LTLIBRARIES = libffi.la noinst_LTLIBRARIES = libffi_convenience.la -libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c \ +libffi_la_SOURCES = src/prep_cif.c src/types.c \ src/raw_api.c src/java_raw_api.c src/closures.c pkgconfigdir = $(libdir)/pkgconfig @@ -94,9 +109,16 @@ nodist_libffi_la_SOURCES = +if FFI_DEBUG +nodist_libffi_la_SOURCES += src/debug.c +endif + if MIPS nodist_libffi_la_SOURCES += src/mips/ffi.c src/mips/o32.S src/mips/n32.S endif +if BFIN +nodist_libffi_la_SOURCES += src/bfin/ffi.c src/bfin/sysv.S +endif if X86 nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/sysv.S endif @@ -127,6 +149,12 @@ if M68K nodist_libffi_la_SOURCES += src/m68k/ffi.c src/m68k/sysv.S endif +if MOXIE +nodist_libffi_la_SOURCES += src/moxie/ffi.c src/moxie/eabi.S +endif +if MICROBLAZE +nodist_libffi_la_SOURCES += src/microblaze/ffi.c src/microblaze/sysv.S +endif if POWERPC nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S endif @@ -139,8 +167,14 @@ if POWERPC_FREEBSD nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S endif +if AARCH64 +nodist_libffi_la_SOURCES += src/aarch64/sysv.S src/aarch64/ffi.c +endif if ARM nodist_libffi_la_SOURCES += src/arm/sysv.S src/arm/ffi.c +if FFI_EXEC_TRAMPOLINE_TABLE +nodist_libffi_la_SOURCES += src/arm/trampoline.S +endif endif if AVR32 nodist_libffi_la_SOURCES += src/avr32/sysv.S src/avr32/ffi.c @@ -169,18 +203,23 @@ if PA_HPUX nodist_libffi_la_SOURCES += src/pa/hpux32.S src/pa/ffi.c endif +if TILE +nodist_libffi_la_SOURCES += src/tile/tile.S src/tile/ffi.c +endif +if XTENSA +nodist_libffi_la_SOURCES += src/xtensa/sysv.S src/xtensa/ffi.c +endif +if METAG +nodist_libffi_la_SOURCES += src/metag/sysv.S src/metag/ffi.c +endif libffi_convenience_la_SOURCES = $(libffi_la_SOURCES) nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) -AM_CFLAGS = -Wall -g -fexceptions +LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/libtool-ldflags $(LDFLAGS)) -libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) +libffi_la_LDFLAGS = -no-undefined -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src AM_CCASFLAGS = $(AM_CPPFLAGS) -# No install-html or install-pdf support in automake yet -.PHONY: install-html install-pdf -install-html: -install-pdf: diff --git a/Modules/_ctypes/libffi/Makefile.in b/Modules/_ctypes/libffi/Makefile.in --- a/Modules/_ctypes/libffi/Makefile.in +++ b/Modules/_ctypes/libffi/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.12.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -17,6 +16,23 @@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -36,31 +52,40 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ - at MIPS_TRUE@am__append_1 = src/mips/ffi.c src/mips/o32.S src/mips/n32.S - at X86_TRUE@am__append_2 = src/x86/ffi.c src/x86/sysv.S - at X86_FREEBSD_TRUE@am__append_3 = src/x86/ffi.c src/x86/freebsd.S - at X86_WIN32_TRUE@am__append_4 = src/x86/ffi.c src/x86/win32.S - at X86_WIN64_TRUE@am__append_5 = src/x86/ffi.c src/x86/win64.S - at X86_DARWIN_TRUE@am__append_6 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S - at SPARC_TRUE@am__append_7 = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S - at ALPHA_TRUE@am__append_8 = src/alpha/ffi.c src/alpha/osf.S - at IA64_TRUE@am__append_9 = src/ia64/ffi.c src/ia64/unix.S - at M32R_TRUE@am__append_10 = src/m32r/sysv.S src/m32r/ffi.c - at M68K_TRUE@am__append_11 = src/m68k/ffi.c src/m68k/sysv.S - at POWERPC_TRUE@am__append_12 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S - at POWERPC_AIX_TRUE@am__append_13 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S - at POWERPC_DARWIN_TRUE@am__append_14 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S - at POWERPC_FREEBSD_TRUE@am__append_15 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S - at ARM_TRUE@am__append_16 = src/arm/sysv.S src/arm/ffi.c - at AVR32_TRUE@am__append_17 = src/avr32/sysv.S src/avr32/ffi.c - at LIBFFI_CRIS_TRUE@am__append_18 = src/cris/sysv.S src/cris/ffi.c - at FRV_TRUE@am__append_19 = src/frv/eabi.S src/frv/ffi.c - at S390_TRUE@am__append_20 = src/s390/sysv.S src/s390/ffi.c - at X86_64_TRUE@am__append_21 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S - at SH_TRUE@am__append_22 = src/sh/sysv.S src/sh/ffi.c - at SH64_TRUE@am__append_23 = src/sh64/sysv.S src/sh64/ffi.c - at PA_LINUX_TRUE@am__append_24 = src/pa/linux.S src/pa/ffi.c - at PA_HPUX_TRUE@am__append_25 = src/pa/hpux32.S src/pa/ffi.c + at FFI_DEBUG_TRUE@am__append_1 = src/debug.c + at MIPS_TRUE@am__append_2 = src/mips/ffi.c src/mips/o32.S src/mips/n32.S + at BFIN_TRUE@am__append_3 = src/bfin/ffi.c src/bfin/sysv.S + at X86_TRUE@am__append_4 = src/x86/ffi.c src/x86/sysv.S + at X86_FREEBSD_TRUE@am__append_5 = src/x86/ffi.c src/x86/freebsd.S + at X86_WIN32_TRUE@am__append_6 = src/x86/ffi.c src/x86/win32.S + at X86_WIN64_TRUE@am__append_7 = src/x86/ffi.c src/x86/win64.S + at X86_DARWIN_TRUE@am__append_8 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S + at SPARC_TRUE@am__append_9 = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S + at ALPHA_TRUE@am__append_10 = src/alpha/ffi.c src/alpha/osf.S + at IA64_TRUE@am__append_11 = src/ia64/ffi.c src/ia64/unix.S + at M32R_TRUE@am__append_12 = src/m32r/sysv.S src/m32r/ffi.c + at M68K_TRUE@am__append_13 = src/m68k/ffi.c src/m68k/sysv.S + at MOXIE_TRUE@am__append_14 = src/moxie/ffi.c src/moxie/eabi.S + at MICROBLAZE_TRUE@am__append_15 = src/microblaze/ffi.c src/microblaze/sysv.S + at POWERPC_TRUE@am__append_16 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S + at POWERPC_AIX_TRUE@am__append_17 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S + at POWERPC_DARWIN_TRUE@am__append_18 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S + at POWERPC_FREEBSD_TRUE@am__append_19 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S + at AARCH64_TRUE@am__append_20 = src/aarch64/sysv.S src/aarch64/ffi.c + at ARM_TRUE@am__append_21 = src/arm/sysv.S src/arm/ffi.c + at ARM_TRUE@@FFI_EXEC_TRAMPOLINE_TABLE_TRUE at am__append_22 = src/arm/trampoline.S + at AVR32_TRUE@am__append_23 = src/avr32/sysv.S src/avr32/ffi.c + at LIBFFI_CRIS_TRUE@am__append_24 = src/cris/sysv.S src/cris/ffi.c + at FRV_TRUE@am__append_25 = src/frv/eabi.S src/frv/ffi.c + at S390_TRUE@am__append_26 = src/s390/sysv.S src/s390/ffi.c + at X86_64_TRUE@am__append_27 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S + at SH_TRUE@am__append_28 = src/sh/sysv.S src/sh/ffi.c + at SH64_TRUE@am__append_29 = src/sh64/sysv.S src/sh64/ffi.c + at PA_LINUX_TRUE@am__append_30 = src/pa/linux.S src/pa/ffi.c + at PA_HPUX_TRUE@am__append_31 = src/pa/hpux32.S src/pa/ffi.c + at TILE_TRUE@am__append_32 = src/tile/tile.S src/tile/ffi.c + at XTENSA_TRUE@am__append_33 = src/xtensa/sysv.S src/xtensa/ffi.c + at METAG_TRUE@am__append_34 = src/metag/sysv.S src/metag/ffi.c subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/doc/stamp-vti \ @@ -69,7 +94,19 @@ compile config.guess config.sub depcomp install-sh ltmain.sh \ mdate-sh missing texinfo.tex ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_cc_maxopt.m4 \ + $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_configure_args.m4 \ + $(top_srcdir)/m4/ax_enable_builddir.m4 \ + $(top_srcdir)/m4/ax_gcc_archflag.m4 \ + $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -100,51 +137,67 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(infodir)" \ +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)" \ "$(DESTDIR)$(pkgconfigdir)" -LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) +LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES) libffi_la_LIBADD = am__dirstamp = $(am__leading_dot)dirstamp -am_libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \ - src/raw_api.lo src/java_raw_api.lo src/closures.lo - at MIPS_TRUE@am__objects_1 = src/mips/ffi.lo src/mips/o32.lo \ +am_libffi_la_OBJECTS = src/prep_cif.lo src/types.lo src/raw_api.lo \ + src/java_raw_api.lo src/closures.lo + at FFI_DEBUG_TRUE@am__objects_1 = src/debug.lo + at MIPS_TRUE@am__objects_2 = src/mips/ffi.lo src/mips/o32.lo \ @MIPS_TRUE@ src/mips/n32.lo - at X86_TRUE@am__objects_2 = src/x86/ffi.lo src/x86/sysv.lo - at X86_FREEBSD_TRUE@am__objects_3 = src/x86/ffi.lo src/x86/freebsd.lo - at X86_WIN32_TRUE@am__objects_4 = src/x86/ffi.lo src/x86/win32.lo - at X86_WIN64_TRUE@am__objects_5 = src/x86/ffi.lo src/x86/win64.lo - at X86_DARWIN_TRUE@am__objects_6 = src/x86/ffi.lo src/x86/darwin.lo \ + at BFIN_TRUE@am__objects_3 = src/bfin/ffi.lo src/bfin/sysv.lo + at X86_TRUE@am__objects_4 = src/x86/ffi.lo src/x86/sysv.lo + at X86_FREEBSD_TRUE@am__objects_5 = src/x86/ffi.lo src/x86/freebsd.lo + at X86_WIN32_TRUE@am__objects_6 = src/x86/ffi.lo src/x86/win32.lo + at X86_WIN64_TRUE@am__objects_7 = src/x86/ffi.lo src/x86/win64.lo + at X86_DARWIN_TRUE@am__objects_8 = src/x86/ffi.lo src/x86/darwin.lo \ @X86_DARWIN_TRUE@ src/x86/ffi64.lo src/x86/darwin64.lo - at SPARC_TRUE@am__objects_7 = src/sparc/ffi.lo src/sparc/v8.lo \ + at SPARC_TRUE@am__objects_9 = src/sparc/ffi.lo src/sparc/v8.lo \ @SPARC_TRUE@ src/sparc/v9.lo - at ALPHA_TRUE@am__objects_8 = src/alpha/ffi.lo src/alpha/osf.lo - at IA64_TRUE@am__objects_9 = src/ia64/ffi.lo src/ia64/unix.lo - at M32R_TRUE@am__objects_10 = src/m32r/sysv.lo src/m32r/ffi.lo - at M68K_TRUE@am__objects_11 = src/m68k/ffi.lo src/m68k/sysv.lo - at POWERPC_TRUE@am__objects_12 = src/powerpc/ffi.lo src/powerpc/sysv.lo \ + at ALPHA_TRUE@am__objects_10 = src/alpha/ffi.lo src/alpha/osf.lo + at IA64_TRUE@am__objects_11 = src/ia64/ffi.lo src/ia64/unix.lo + at M32R_TRUE@am__objects_12 = src/m32r/sysv.lo src/m32r/ffi.lo + at M68K_TRUE@am__objects_13 = src/m68k/ffi.lo src/m68k/sysv.lo + at MOXIE_TRUE@am__objects_14 = src/moxie/ffi.lo src/moxie/eabi.lo + at MICROBLAZE_TRUE@am__objects_15 = src/microblaze/ffi.lo \ + at MICROBLAZE_TRUE@ src/microblaze/sysv.lo + at POWERPC_TRUE@am__objects_16 = src/powerpc/ffi.lo src/powerpc/sysv.lo \ @POWERPC_TRUE@ src/powerpc/ppc_closure.lo \ @POWERPC_TRUE@ src/powerpc/linux64.lo \ @POWERPC_TRUE@ src/powerpc/linux64_closure.lo - at POWERPC_AIX_TRUE@am__objects_13 = src/powerpc/ffi_darwin.lo \ + at POWERPC_AIX_TRUE@am__objects_17 = src/powerpc/ffi_darwin.lo \ @POWERPC_AIX_TRUE@ src/powerpc/aix.lo \ @POWERPC_AIX_TRUE@ src/powerpc/aix_closure.lo - at POWERPC_DARWIN_TRUE@am__objects_14 = src/powerpc/ffi_darwin.lo \ + at POWERPC_DARWIN_TRUE@am__objects_18 = src/powerpc/ffi_darwin.lo \ @POWERPC_DARWIN_TRUE@ src/powerpc/darwin.lo \ @POWERPC_DARWIN_TRUE@ src/powerpc/darwin_closure.lo - at POWERPC_FREEBSD_TRUE@am__objects_15 = src/powerpc/ffi.lo \ + at POWERPC_FREEBSD_TRUE@am__objects_19 = src/powerpc/ffi.lo \ @POWERPC_FREEBSD_TRUE@ src/powerpc/sysv.lo \ @POWERPC_FREEBSD_TRUE@ src/powerpc/ppc_closure.lo - at ARM_TRUE@am__objects_16 = src/arm/sysv.lo src/arm/ffi.lo - at AVR32_TRUE@am__objects_17 = src/avr32/sysv.lo src/avr32/ffi.lo - at LIBFFI_CRIS_TRUE@am__objects_18 = src/cris/sysv.lo src/cris/ffi.lo - at FRV_TRUE@am__objects_19 = src/frv/eabi.lo src/frv/ffi.lo - at S390_TRUE@am__objects_20 = src/s390/sysv.lo src/s390/ffi.lo - at X86_64_TRUE@am__objects_21 = src/x86/ffi64.lo src/x86/unix64.lo \ + at AARCH64_TRUE@am__objects_20 = src/aarch64/sysv.lo src/aarch64/ffi.lo + at ARM_TRUE@am__objects_21 = src/arm/sysv.lo src/arm/ffi.lo + at ARM_TRUE@@FFI_EXEC_TRAMPOLINE_TABLE_TRUE at am__objects_22 = src/arm/trampoline.lo + at AVR32_TRUE@am__objects_23 = src/avr32/sysv.lo src/avr32/ffi.lo + at LIBFFI_CRIS_TRUE@am__objects_24 = src/cris/sysv.lo src/cris/ffi.lo + at FRV_TRUE@am__objects_25 = src/frv/eabi.lo src/frv/ffi.lo + at S390_TRUE@am__objects_26 = src/s390/sysv.lo src/s390/ffi.lo + at X86_64_TRUE@am__objects_27 = src/x86/ffi64.lo src/x86/unix64.lo \ @X86_64_TRUE@ src/x86/ffi.lo src/x86/sysv.lo - at SH_TRUE@am__objects_22 = src/sh/sysv.lo src/sh/ffi.lo - at SH64_TRUE@am__objects_23 = src/sh64/sysv.lo src/sh64/ffi.lo - at PA_LINUX_TRUE@am__objects_24 = src/pa/linux.lo src/pa/ffi.lo - at PA_HPUX_TRUE@am__objects_25 = src/pa/hpux32.lo src/pa/ffi.lo + at SH_TRUE@am__objects_28 = src/sh/sysv.lo src/sh/ffi.lo + at SH64_TRUE@am__objects_29 = src/sh64/sysv.lo src/sh64/ffi.lo + at PA_LINUX_TRUE@am__objects_30 = src/pa/linux.lo src/pa/ffi.lo + at PA_HPUX_TRUE@am__objects_31 = src/pa/hpux32.lo src/pa/ffi.lo + at TILE_TRUE@am__objects_32 = src/tile/tile.lo src/tile/ffi.lo + at XTENSA_TRUE@am__objects_33 = src/xtensa/sysv.lo src/xtensa/ffi.lo + at METAG_TRUE@am__objects_34 = src/metag/sysv.lo src/metag/ffi.lo nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ $(am__objects_3) $(am__objects_4) $(am__objects_5) \ $(am__objects_6) $(am__objects_7) $(am__objects_8) \ @@ -153,17 +206,20 @@ $(am__objects_15) $(am__objects_16) $(am__objects_17) \ $(am__objects_18) $(am__objects_19) $(am__objects_20) \ $(am__objects_21) $(am__objects_22) $(am__objects_23) \ - $(am__objects_24) $(am__objects_25) + $(am__objects_24) $(am__objects_25) $(am__objects_26) \ + $(am__objects_27) $(am__objects_28) $(am__objects_29) \ + $(am__objects_30) $(am__objects_31) $(am__objects_32) \ + $(am__objects_33) $(am__objects_34) libffi_la_OBJECTS = $(am_libffi_la_OBJECTS) \ $(nodist_libffi_la_OBJECTS) libffi_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libffi_la_LDFLAGS) $(LDFLAGS) -o $@ libffi_convenience_la_LIBADD = -am__objects_26 = src/debug.lo src/prep_cif.lo src/types.lo \ - src/raw_api.lo src/java_raw_api.lo src/closures.lo -am_libffi_convenience_la_OBJECTS = $(am__objects_26) -am__objects_27 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \ +am__objects_35 = src/prep_cif.lo src/types.lo src/raw_api.lo \ + src/java_raw_api.lo src/closures.lo +am_libffi_convenience_la_OBJECTS = $(am__objects_35) +am__objects_36 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \ $(am__objects_4) $(am__objects_5) $(am__objects_6) \ $(am__objects_7) $(am__objects_8) $(am__objects_9) \ $(am__objects_10) $(am__objects_11) $(am__objects_12) \ @@ -171,8 +227,11 @@ $(am__objects_16) $(am__objects_17) $(am__objects_18) \ $(am__objects_19) $(am__objects_20) $(am__objects_21) \ $(am__objects_22) $(am__objects_23) $(am__objects_24) \ - $(am__objects_25) -nodist_libffi_convenience_la_OBJECTS = $(am__objects_27) + $(am__objects_25) $(am__objects_26) $(am__objects_27) \ + $(am__objects_28) $(am__objects_29) $(am__objects_30) \ + $(am__objects_31) $(am__objects_32) $(am__objects_33) \ + $(am__objects_34) +nodist_libffi_convenience_la_OBJECTS = $(am__objects_36) libffi_convenience_la_OBJECTS = $(am_libffi_convenience_la_OBJECTS) \ $(nodist_libffi_convenience_la_OBJECTS) DEFAULT_INCLUDES = -I. at am__isrc@ @@ -216,22 +275,31 @@ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac DATA = $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ - distdir dist dist-all distcheck + cscope distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags +CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ - { test ! -d "$(distdir)" \ - || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr "$(distdir)"; }; } + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ @@ -259,7 +327,10 @@ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best +DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ @@ -282,6 +353,7 @@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -289,6 +361,7 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ FGREP = @FGREP@ GREP = @GREP@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ @@ -307,6 +380,7 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -319,8 +393,10 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PRTDIAG = @PRTDIAG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -333,6 +409,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -340,6 +417,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -365,7 +443,6 @@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -376,6 +453,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ @@ -388,36 +466,48 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign subdir-objects +ACLOCAL_AMFLAGS = -I m4 SUBDIRS = include testsuite man -EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ - src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \ - src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \ - src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \ - src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \ - src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \ - src/ia64/unix.S \ - src/mips/ffi.c src/mips/n32.S src/mips/o32.S \ - src/mips/ffitarget.h \ - src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ - src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ - src/powerpc/ffi.c src/powerpc/sysv.S \ - src/powerpc/linux64.S src/powerpc/linux64_closure.S \ - src/powerpc/ppc_closure.S src/powerpc/asm.h \ - src/powerpc/aix.S src/powerpc/darwin.S \ - src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ - src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ - src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ - src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h \ - src/sh64/ffi.c src/sh64/sysv.S src/sh64/ffitarget.h \ - src/sparc/v8.S src/sparc/v9.S src/sparc/ffitarget.h \ - src/sparc/ffi.c src/x86/darwin64.S \ - src/x86/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/win64.S \ - src/x86/darwin.S src/x86/freebsd.S \ - src/x86/ffi64.c src/x86/unix64.S src/x86/ffitarget.h \ - src/pa/ffitarget.h src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \ - src/frv/ffi.c src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c \ - libtool-version ChangeLog.libffi m4/libtool.m4 \ - m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 +EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ + src/aarch64/ffi.c src/aarch64/ffitarget.h src/aarch64/sysv.S \ + build-ios.sh src/alpha/ffi.c src/alpha/osf.S \ + src/alpha/ffitarget.h src/arm/ffi.c src/arm/sysv.S \ + src/arm/ffitarget.h src/avr32/ffi.c src/avr32/sysv.S \ + src/avr32/ffitarget.h src/cris/ffi.c src/cris/sysv.S \ + src/cris/ffitarget.h src/ia64/ffi.c src/ia64/ffitarget.h \ + src/ia64/ia64_flags.h src/ia64/unix.S src/mips/ffi.c \ + src/mips/n32.S src/mips/o32.S src/metag/ffi.c \ + src/metag/ffitarget.h src/metag/sysv.S src/moxie/ffi.c \ + src/moxie/ffitarget.h src/moxie/eabi.S src/mips/ffitarget.h \ + src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ + src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ + src/microblaze/ffi.c src/microblaze/sysv.S \ + src/microblaze/ffitarget.h src/powerpc/ffi.c \ + src/powerpc/sysv.S src/powerpc/linux64.S \ + src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \ + src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S \ + src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ + src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ + src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ + src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c \ + src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S \ + src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c \ + src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S \ + src/x86/win32.S src/x86/darwin.S src/x86/win64.S \ + src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S \ + src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c \ + src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c \ + src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S \ + src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c \ + src/tile/ffitarget.h src/tile/tile.S libtool-version \ + src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S \ + ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4 \ + m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \ + m4/ltversion.m4 src/arm/gentramp.sh src/debug.c msvcc.sh \ + generate-ios-source-and-headers.py \ + generate-osx-source-and-headers.py \ + libffi.xcodeproj/project.pbxproj src/arm/trampoline.S \ + libtool-ldflags info_TEXINFOS = doc/libffi.texi @@ -448,6 +538,7 @@ "exec_prefix=$(exec_prefix)" \ "infodir=$(infodir)" \ "libdir=$(libdir)" \ + "mandir=$(mandir)" \ "prefix=$(prefix)" \ "AR=$(AR)" \ "AS=$(AS)" \ @@ -458,11 +549,13 @@ "RANLIB=$(RANLIB)" \ "DESTDIR=$(DESTDIR)" + +# Subdir rules rely on $(FLAGS_TO_PASS) +FLAGS_TO_PASS = $(AM_MAKEFLAGS) MAKEOVERRIDES = -ACLOCAL_AMFLAGS = $(ACLOCAL_AMFLAGS) -I m4 -lib_LTLIBRARIES = libffi.la +toolexeclib_LTLIBRARIES = libffi.la noinst_LTLIBRARIES = libffi_convenience.la -libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c \ +libffi_la_SOURCES = src/prep_cif.c src/types.c \ src/raw_api.c src/java_raw_api.c src/closures.c pkgconfigdir = $(libdir)/pkgconfig @@ -475,11 +568,14 @@ $(am__append_15) $(am__append_16) $(am__append_17) \ $(am__append_18) $(am__append_19) $(am__append_20) \ $(am__append_21) $(am__append_22) $(am__append_23) \ - $(am__append_24) $(am__append_25) + $(am__append_24) $(am__append_25) $(am__append_26) \ + $(am__append_27) $(am__append_28) $(am__append_29) \ + $(am__append_30) $(am__append_31) $(am__append_32) \ + $(am__append_33) $(am__append_34) libffi_convenience_la_SOURCES = $(libffi_la_SOURCES) nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) -AM_CFLAGS = -Wall -g -fexceptions -libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(AM_LTLDFLAGS) +LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/libtool-ldflags $(LDFLAGS)) +libffi_la_LDFLAGS = -no-undefined -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src AM_CCASFLAGS = $(AM_CPPFLAGS) all: fficonfig.h @@ -487,7 +583,7 @@ .SUFFIXES: .SUFFIXES: .S .c .dvi .lo .o .obj .ps -am--refresh: +am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ @@ -523,10 +619,8 @@ $(am__aclocal_m4_deps): fficonfig.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ - else :; fi + @if test ! -f $@; then rm -f stamp-h1; else :; fi + @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/fficonfig.h.in $(top_builddir)/config.status @rm -f stamp-h1 @@ -540,58 +634,63 @@ -rm -f fficonfig.h stamp-h1 libffi.pc: $(top_builddir)/config.status $(srcdir)/libffi.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ -install-libLTLIBRARIES: $(lib_LTLIBRARIES) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(toolexeclibdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \ } -uninstall-libLTLIBRARIES: +uninstall-toolexeclibLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$f"; \ done -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done +clean-toolexeclibLTLIBRARIES: + -test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES) + @list='$(toolexeclib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } src/$(am__dirstamp): @$(MKDIR_P) src @: > src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/$(DEPDIR) @: > src/$(DEPDIR)/$(am__dirstamp) -src/debug.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/prep_cif.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/types.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/raw_api.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/java_raw_api.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/closures.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) +src/debug.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/mips/$(am__dirstamp): @$(MKDIR_P) src/mips @: > src/mips/$(am__dirstamp) @@ -604,6 +703,16 @@ src/mips/$(DEPDIR)/$(am__dirstamp) src/mips/n32.lo: src/mips/$(am__dirstamp) \ src/mips/$(DEPDIR)/$(am__dirstamp) +src/bfin/$(am__dirstamp): + @$(MKDIR_P) src/bfin + @: > src/bfin/$(am__dirstamp) +src/bfin/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/bfin/$(DEPDIR) + @: > src/bfin/$(DEPDIR)/$(am__dirstamp) +src/bfin/ffi.lo: src/bfin/$(am__dirstamp) \ + src/bfin/$(DEPDIR)/$(am__dirstamp) +src/bfin/sysv.lo: src/bfin/$(am__dirstamp) \ + src/bfin/$(DEPDIR)/$(am__dirstamp) src/x86/$(am__dirstamp): @$(MKDIR_P) src/x86 @: > src/x86/$(am__dirstamp) @@ -678,6 +787,26 @@ src/m68k/$(DEPDIR)/$(am__dirstamp) src/m68k/sysv.lo: src/m68k/$(am__dirstamp) \ src/m68k/$(DEPDIR)/$(am__dirstamp) +src/moxie/$(am__dirstamp): + @$(MKDIR_P) src/moxie + @: > src/moxie/$(am__dirstamp) +src/moxie/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/moxie/$(DEPDIR) + @: > src/moxie/$(DEPDIR)/$(am__dirstamp) +src/moxie/ffi.lo: src/moxie/$(am__dirstamp) \ + src/moxie/$(DEPDIR)/$(am__dirstamp) +src/moxie/eabi.lo: src/moxie/$(am__dirstamp) \ + src/moxie/$(DEPDIR)/$(am__dirstamp) +src/microblaze/$(am__dirstamp): + @$(MKDIR_P) src/microblaze + @: > src/microblaze/$(am__dirstamp) +src/microblaze/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/microblaze/$(DEPDIR) + @: > src/microblaze/$(DEPDIR)/$(am__dirstamp) +src/microblaze/ffi.lo: src/microblaze/$(am__dirstamp) \ + src/microblaze/$(DEPDIR)/$(am__dirstamp) +src/microblaze/sysv.lo: src/microblaze/$(am__dirstamp) \ + src/microblaze/$(DEPDIR)/$(am__dirstamp) src/powerpc/$(am__dirstamp): @$(MKDIR_P) src/powerpc @: > src/powerpc/$(am__dirstamp) @@ -704,6 +833,16 @@ src/powerpc/$(DEPDIR)/$(am__dirstamp) src/powerpc/darwin_closure.lo: src/powerpc/$(am__dirstamp) \ src/powerpc/$(DEPDIR)/$(am__dirstamp) +src/aarch64/$(am__dirstamp): + @$(MKDIR_P) src/aarch64 + @: > src/aarch64/$(am__dirstamp) +src/aarch64/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/aarch64/$(DEPDIR) + @: > src/aarch64/$(DEPDIR)/$(am__dirstamp) +src/aarch64/sysv.lo: src/aarch64/$(am__dirstamp) \ + src/aarch64/$(DEPDIR)/$(am__dirstamp) +src/aarch64/ffi.lo: src/aarch64/$(am__dirstamp) \ + src/aarch64/$(DEPDIR)/$(am__dirstamp) src/arm/$(am__dirstamp): @$(MKDIR_P) src/arm @: > src/arm/$(am__dirstamp) @@ -714,6 +853,8 @@ src/arm/$(DEPDIR)/$(am__dirstamp) src/arm/ffi.lo: src/arm/$(am__dirstamp) \ src/arm/$(DEPDIR)/$(am__dirstamp) +src/arm/trampoline.lo: src/arm/$(am__dirstamp) \ + src/arm/$(DEPDIR)/$(am__dirstamp) src/avr32/$(am__dirstamp): @$(MKDIR_P) src/avr32 @: > src/avr32/$(am__dirstamp) @@ -786,125 +927,91 @@ src/pa/ffi.lo: src/pa/$(am__dirstamp) src/pa/$(DEPDIR)/$(am__dirstamp) src/pa/hpux32.lo: src/pa/$(am__dirstamp) \ src/pa/$(DEPDIR)/$(am__dirstamp) -libffi.la: $(libffi_la_OBJECTS) $(libffi_la_DEPENDENCIES) - $(libffi_la_LINK) -rpath $(libdir) $(libffi_la_OBJECTS) $(libffi_la_LIBADD) $(LIBS) -libffi_convenience.la: $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_DEPENDENCIES) +src/tile/$(am__dirstamp): + @$(MKDIR_P) src/tile + @: > src/tile/$(am__dirstamp) +src/tile/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/tile/$(DEPDIR) + @: > src/tile/$(DEPDIR)/$(am__dirstamp) +src/tile/tile.lo: src/tile/$(am__dirstamp) \ + src/tile/$(DEPDIR)/$(am__dirstamp) +src/tile/ffi.lo: src/tile/$(am__dirstamp) \ + src/tile/$(DEPDIR)/$(am__dirstamp) +src/xtensa/$(am__dirstamp): + @$(MKDIR_P) src/xtensa + @: > src/xtensa/$(am__dirstamp) +src/xtensa/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/xtensa/$(DEPDIR) + @: > src/xtensa/$(DEPDIR)/$(am__dirstamp) +src/xtensa/sysv.lo: src/xtensa/$(am__dirstamp) \ + src/xtensa/$(DEPDIR)/$(am__dirstamp) +src/xtensa/ffi.lo: src/xtensa/$(am__dirstamp) \ + src/xtensa/$(DEPDIR)/$(am__dirstamp) +src/metag/$(am__dirstamp): + @$(MKDIR_P) src/metag + @: > src/metag/$(am__dirstamp) +src/metag/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/metag/$(DEPDIR) + @: > src/metag/$(DEPDIR)/$(am__dirstamp) +src/metag/sysv.lo: src/metag/$(am__dirstamp) \ + src/metag/$(DEPDIR)/$(am__dirstamp) +src/metag/ffi.lo: src/metag/$(am__dirstamp) \ + src/metag/$(DEPDIR)/$(am__dirstamp) +libffi.la: $(libffi_la_OBJECTS) $(libffi_la_DEPENDENCIES) $(EXTRA_libffi_la_DEPENDENCIES) + $(libffi_la_LINK) -rpath $(toolexeclibdir) $(libffi_la_OBJECTS) $(libffi_la_LIBADD) $(LIBS) +libffi_convenience.la: $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_DEPENDENCIES) $(EXTRA_libffi_convenience_la_DEPENDENCIES) $(LINK) $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) - -rm -f src/alpha/ffi.$(OBJEXT) - -rm -f src/alpha/ffi.lo - -rm -f src/alpha/osf.$(OBJEXT) - -rm -f src/alpha/osf.lo - -rm -f src/arm/ffi.$(OBJEXT) - -rm -f src/arm/ffi.lo - -rm -f src/arm/sysv.$(OBJEXT) - -rm -f src/arm/sysv.lo - -rm -f src/avr32/ffi.$(OBJEXT) - -rm -f src/avr32/ffi.lo - -rm -f src/avr32/sysv.$(OBJEXT) - -rm -f src/avr32/sysv.lo - -rm -f src/closures.$(OBJEXT) - -rm -f src/closures.lo - -rm -f src/cris/ffi.$(OBJEXT) - -rm -f src/cris/ffi.lo - -rm -f src/cris/sysv.$(OBJEXT) - -rm -f src/cris/sysv.lo - -rm -f src/debug.$(OBJEXT) - -rm -f src/debug.lo - -rm -f src/frv/eabi.$(OBJEXT) - -rm -f src/frv/eabi.lo - -rm -f src/frv/ffi.$(OBJEXT) - -rm -f src/frv/ffi.lo - -rm -f src/ia64/ffi.$(OBJEXT) - -rm -f src/ia64/ffi.lo - -rm -f src/ia64/unix.$(OBJEXT) - -rm -f src/ia64/unix.lo - -rm -f src/java_raw_api.$(OBJEXT) - -rm -f src/java_raw_api.lo - -rm -f src/m32r/ffi.$(OBJEXT) - -rm -f src/m32r/ffi.lo - -rm -f src/m32r/sysv.$(OBJEXT) - -rm -f src/m32r/sysv.lo - -rm -f src/m68k/ffi.$(OBJEXT) - -rm -f src/m68k/ffi.lo - -rm -f src/m68k/sysv.$(OBJEXT) - -rm -f src/m68k/sysv.lo - -rm -f src/mips/ffi.$(OBJEXT) - -rm -f src/mips/ffi.lo - -rm -f src/mips/n32.$(OBJEXT) - -rm -f src/mips/n32.lo - -rm -f src/mips/o32.$(OBJEXT) - -rm -f src/mips/o32.lo - -rm -f src/pa/ffi.$(OBJEXT) - -rm -f src/pa/ffi.lo - -rm -f src/pa/hpux32.$(OBJEXT) - -rm -f src/pa/hpux32.lo - -rm -f src/pa/linux.$(OBJEXT) - -rm -f src/pa/linux.lo - -rm -f src/powerpc/aix.$(OBJEXT) - -rm -f src/powerpc/aix.lo - -rm -f src/powerpc/aix_closure.$(OBJEXT) - -rm -f src/powerpc/aix_closure.lo - -rm -f src/powerpc/darwin.$(OBJEXT) - -rm -f src/powerpc/darwin.lo - -rm -f src/powerpc/darwin_closure.$(OBJEXT) - -rm -f src/powerpc/darwin_closure.lo - -rm -f src/powerpc/ffi.$(OBJEXT) - -rm -f src/powerpc/ffi.lo - -rm -f src/powerpc/ffi_darwin.$(OBJEXT) - -rm -f src/powerpc/ffi_darwin.lo - -rm -f src/powerpc/linux64.$(OBJEXT) - -rm -f src/powerpc/linux64.lo - -rm -f src/powerpc/linux64_closure.$(OBJEXT) - -rm -f src/powerpc/linux64_closure.lo - -rm -f src/powerpc/ppc_closure.$(OBJEXT) - -rm -f src/powerpc/ppc_closure.lo - -rm -f src/powerpc/sysv.$(OBJEXT) - -rm -f src/powerpc/sysv.lo - -rm -f src/prep_cif.$(OBJEXT) - -rm -f src/prep_cif.lo - -rm -f src/raw_api.$(OBJEXT) - -rm -f src/raw_api.lo - -rm -f src/s390/ffi.$(OBJEXT) - -rm -f src/s390/ffi.lo - -rm -f src/s390/sysv.$(OBJEXT) - -rm -f src/s390/sysv.lo - -rm -f src/sh/ffi.$(OBJEXT) - -rm -f src/sh/ffi.lo - -rm -f src/sh/sysv.$(OBJEXT) - -rm -f src/sh/sysv.lo - -rm -f src/sh64/ffi.$(OBJEXT) - -rm -f src/sh64/ffi.lo - -rm -f src/sh64/sysv.$(OBJEXT) - -rm -f src/sh64/sysv.lo - -rm -f src/sparc/ffi.$(OBJEXT) - -rm -f src/sparc/ffi.lo - -rm -f src/sparc/v8.$(OBJEXT) - -rm -f src/sparc/v8.lo - -rm -f src/sparc/v9.$(OBJEXT) - -rm -f src/sparc/v9.lo - -rm -f src/types.$(OBJEXT) - -rm -f src/types.lo - -rm -f src/x86/darwin.$(OBJEXT) - -rm -f src/x86/darwin.lo - -rm -f src/x86/darwin64.$(OBJEXT) - -rm -f src/x86/darwin64.lo - -rm -f src/x86/ffi.$(OBJEXT) - -rm -f src/x86/ffi.lo - -rm -f src/x86/ffi64.$(OBJEXT) - -rm -f src/x86/ffi64.lo - -rm -f src/x86/freebsd.$(OBJEXT) - -rm -f src/x86/freebsd.lo - -rm -f src/x86/sysv.$(OBJEXT) - -rm -f src/x86/sysv.lo - -rm -f src/x86/unix64.$(OBJEXT) - -rm -f src/x86/unix64.lo - -rm -f src/x86/win32.$(OBJEXT) - -rm -f src/x86/win32.lo - -rm -f src/x86/win64.$(OBJEXT) - -rm -f src/x86/win64.lo + -rm -f src/*.$(OBJEXT) + -rm -f src/*.lo + -rm -f src/aarch64/*.$(OBJEXT) + -rm -f src/aarch64/*.lo + -rm -f src/alpha/*.$(OBJEXT) + -rm -f src/alpha/*.lo + -rm -f src/arm/*.$(OBJEXT) + -rm -f src/arm/*.lo + -rm -f src/avr32/*.$(OBJEXT) + -rm -f src/avr32/*.lo + -rm -f src/bfin/*.$(OBJEXT) + -rm -f src/bfin/*.lo + -rm -f src/cris/*.$(OBJEXT) + -rm -f src/cris/*.lo + -rm -f src/frv/*.$(OBJEXT) + -rm -f src/frv/*.lo + -rm -f src/ia64/*.$(OBJEXT) + -rm -f src/ia64/*.lo + -rm -f src/m32r/*.$(OBJEXT) + -rm -f src/m32r/*.lo + -rm -f src/m68k/*.$(OBJEXT) + -rm -f src/m68k/*.lo + -rm -f src/metag/*.$(OBJEXT) + -rm -f src/metag/*.lo + -rm -f src/microblaze/*.$(OBJEXT) + -rm -f src/microblaze/*.lo + -rm -f src/mips/*.$(OBJEXT) + -rm -f src/mips/*.lo + -rm -f src/moxie/*.$(OBJEXT) + -rm -f src/moxie/*.lo + -rm -f src/pa/*.$(OBJEXT) + -rm -f src/pa/*.lo + -rm -f src/powerpc/*.$(OBJEXT) + -rm -f src/powerpc/*.lo + -rm -f src/s390/*.$(OBJEXT) + -rm -f src/s390/*.lo + -rm -f src/sh/*.$(OBJEXT) + -rm -f src/sh/*.lo + -rm -f src/sh64/*.$(OBJEXT) + -rm -f src/sh64/*.lo + -rm -f src/sparc/*.$(OBJEXT) + -rm -f src/sparc/*.lo + -rm -f src/tile/*.$(OBJEXT) + -rm -f src/tile/*.lo + -rm -f src/x86/*.$(OBJEXT) + -rm -f src/x86/*.lo + -rm -f src/xtensa/*.$(OBJEXT) + -rm -f src/xtensa/*.lo distclean-compile: -rm -f *.tab.c @@ -915,12 +1022,17 @@ @AMDEP_TRUE@@am__include@ @am__quote at src/$(DEPDIR)/prep_cif.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/$(DEPDIR)/raw_api.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/$(DEPDIR)/types.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/aarch64/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/aarch64/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/alpha/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/alpha/$(DEPDIR)/osf.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/arm/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/arm/$(DEPDIR)/sysv.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/arm/$(DEPDIR)/trampoline.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/avr32/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/avr32/$(DEPDIR)/sysv.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/bfin/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/bfin/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/cris/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/cris/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/frv/$(DEPDIR)/eabi.Plo at am__quote@ @@ -931,9 +1043,15 @@ @AMDEP_TRUE@@am__include@ @am__quote at src/m32r/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/m68k/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/m68k/$(DEPDIR)/sysv.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/metag/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/metag/$(DEPDIR)/sysv.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/microblaze/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/microblaze/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/mips/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/mips/$(DEPDIR)/n32.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/mips/$(DEPDIR)/o32.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/moxie/$(DEPDIR)/eabi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/moxie/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/pa/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/pa/$(DEPDIR)/hpux32.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/pa/$(DEPDIR)/linux.Plo at am__quote@ @@ -956,6 +1074,8 @@ @AMDEP_TRUE@@am__include@ @am__quote at src/sparc/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/sparc/$(DEPDIR)/v8.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/sparc/$(DEPDIR)/v9.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/tile/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/tile/$(DEPDIR)/tile.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/darwin.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/darwin64.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/ffi.Plo at am__quote@ @@ -965,6 +1085,8 @@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/unix64.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/win32.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/win64.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/xtensa/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/xtensa/$(DEPDIR)/sysv.Plo at am__quote@ .S.o: @am__fastdepCCAS_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @@ -1020,22 +1142,29 @@ clean-libtool: -rm -rf .libs _libs -rm -rf src/.libs src/_libs + -rm -rf src/aarch64/.libs src/aarch64/_libs -rm -rf src/alpha/.libs src/alpha/_libs -rm -rf src/arm/.libs src/arm/_libs -rm -rf src/avr32/.libs src/avr32/_libs + -rm -rf src/bfin/.libs src/bfin/_libs -rm -rf src/cris/.libs src/cris/_libs -rm -rf src/frv/.libs src/frv/_libs -rm -rf src/ia64/.libs src/ia64/_libs -rm -rf src/m32r/.libs src/m32r/_libs -rm -rf src/m68k/.libs src/m68k/_libs + -rm -rf src/metag/.libs src/metag/_libs + -rm -rf src/microblaze/.libs src/microblaze/_libs -rm -rf src/mips/.libs src/mips/_libs + -rm -rf src/moxie/.libs src/moxie/_libs -rm -rf src/pa/.libs src/pa/_libs -rm -rf src/powerpc/.libs src/powerpc/_libs -rm -rf src/s390/.libs src/s390/_libs -rm -rf src/sh/.libs src/sh/_libs -rm -rf src/sh64/.libs src/sh64/_libs -rm -rf src/sparc/.libs src/sparc/_libs + -rm -rf src/tile/.libs src/tile/_libs -rm -rf src/x86/.libs src/x86/_libs + -rm -rf src/xtensa/.libs src/xtensa/_libs distclean-libtool: -rm -f libtool config.lt @@ -1068,12 +1197,12 @@ doc/libffi.dvi: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ - $(TEXI2DVI) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi + $(TEXI2DVI) --clean -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi doc/libffi.pdf: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ - $(TEXI2PDF) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi + $(TEXI2PDF) --clean -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi doc/libffi.html: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) rm -rf $(@:.html=.htp) @@ -1110,7 +1239,7 @@ @MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/doc/stamp-vti $(srcdir)/doc/version.texi .dvi.ps: TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ - $(DVIPS) -o $@ $< + $(DVIPS) -o $@ $< uninstall-dvi-am: @$(NORMAL_UNINSTALL) @@ -1132,9 +1261,7 @@ uninstall-info-am: @$(PRE_UNINSTALL) - @if test -d '$(DESTDIR)$(infodir)' && \ - (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ @@ -1206,8 +1333,11 @@ done install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) - test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -1221,18 +1351,16 @@ @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -1241,7 +1369,11 @@ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -1255,37 +1387,6 @@ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ @@ -1294,6 +1395,10 @@ list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done +cscopelist-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \ + done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -1357,8 +1462,32 @@ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) + +clean-cscope: + -rm -f cscope.files + +cscope.files: clean-cscope cscopelist-recursive cscopelist + +cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) @@ -1394,13 +1523,10 @@ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ @@ -1424,43 +1550,44 @@ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-info -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) dist-xz: distdir - tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz - $(am__remove_distdir) + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) + $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) + $(am__post_remove_distdir) -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another @@ -1468,21 +1595,21 @@ distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod a+w $(distdir) + chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) @@ -1492,6 +1619,7 @@ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ @@ -1515,13 +1643,21 @@ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 - $(am__remove_distdir) + $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: - @$(am__cd) '$(distuninstallcheck_dir)' \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ @@ -1542,7 +1678,7 @@ all-am: Makefile $(INFO_DEPS) $(LTLIBRARIES) $(DATA) fficonfig.h installdirs: installdirs-recursive installdirs-am: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(pkgconfigdir)"; do \ + for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive @@ -1555,10 +1691,15 @@ installcheck: installcheck-recursive install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -1569,12 +1710,16 @@ -rm -f doc/$(am__dirstamp) -rm -f src/$(DEPDIR)/$(am__dirstamp) -rm -f src/$(am__dirstamp) + -rm -f src/aarch64/$(DEPDIR)/$(am__dirstamp) + -rm -f src/aarch64/$(am__dirstamp) -rm -f src/alpha/$(DEPDIR)/$(am__dirstamp) -rm -f src/alpha/$(am__dirstamp) -rm -f src/arm/$(DEPDIR)/$(am__dirstamp) -rm -f src/arm/$(am__dirstamp) -rm -f src/avr32/$(DEPDIR)/$(am__dirstamp) -rm -f src/avr32/$(am__dirstamp) + -rm -f src/bfin/$(DEPDIR)/$(am__dirstamp) + -rm -f src/bfin/$(am__dirstamp) -rm -f src/cris/$(DEPDIR)/$(am__dirstamp) -rm -f src/cris/$(am__dirstamp) -rm -f src/frv/$(DEPDIR)/$(am__dirstamp) @@ -1585,8 +1730,14 @@ -rm -f src/m32r/$(am__dirstamp) -rm -f src/m68k/$(DEPDIR)/$(am__dirstamp) -rm -f src/m68k/$(am__dirstamp) + -rm -f src/metag/$(DEPDIR)/$(am__dirstamp) + -rm -f src/metag/$(am__dirstamp) + -rm -f src/microblaze/$(DEPDIR)/$(am__dirstamp) + -rm -f src/microblaze/$(am__dirstamp) -rm -f src/mips/$(DEPDIR)/$(am__dirstamp) -rm -f src/mips/$(am__dirstamp) + -rm -f src/moxie/$(DEPDIR)/$(am__dirstamp) + -rm -f src/moxie/$(am__dirstamp) -rm -f src/pa/$(DEPDIR)/$(am__dirstamp) -rm -f src/pa/$(am__dirstamp) -rm -f src/powerpc/$(DEPDIR)/$(am__dirstamp) @@ -1599,20 +1750,25 @@ -rm -f src/sh64/$(am__dirstamp) -rm -f src/sparc/$(DEPDIR)/$(am__dirstamp) -rm -f src/sparc/$(am__dirstamp) + -rm -f src/tile/$(DEPDIR)/$(am__dirstamp) + -rm -f src/tile/$(am__dirstamp) -rm -f src/x86/$(DEPDIR)/$(am__dirstamp) -rm -f src/x86/$(am__dirstamp) + -rm -f src/xtensa/$(DEPDIR)/$(am__dirstamp) + -rm -f src/xtensa/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive -clean-am: clean-aminfo clean-generic clean-libLTLIBRARIES \ - clean-libtool clean-noinstLTLIBRARIES mostlyclean-am +clean-am: clean-aminfo clean-generic clean-libtool \ + clean-noinstLTLIBRARIES clean-toolexeclibLTLIBRARIES \ + mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR) + -rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/metag/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags @@ -1635,8 +1791,11 @@ install-dvi-am: $(DVIS) @$(NORMAL_INSTALL) - test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)" @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -1645,22 +1804,28 @@ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ done -install-exec-am: install-libLTLIBRARIES +install-exec-am: install-toolexeclibLTLIBRARIES + +install-html: install-html-recursive install-html-am: $(HTMLS) @$(NORMAL_INSTALL) - test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)" @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ $(am__strip_dir) \ - if test -d "$$d$$p"; then \ + d2=$$d$$p; \ + if test -d "$$d2"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ - echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ - $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ + echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ else \ - list2="$$list2 $$d$$p"; \ + list2="$$list2 $$d2"; \ fi; \ done; \ test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \ @@ -1672,9 +1837,12 @@ install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) - test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)" @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \ + fi; \ for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ @@ -1692,8 +1860,7 @@ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done @$(POST_INSTALL) - @if (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + @if $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ @@ -1703,10 +1870,15 @@ else : ; fi install-man: +install-pdf: install-pdf-recursive + install-pdf-am: $(PDFS) @$(NORMAL_INSTALL) - test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)" @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -1718,8 +1890,11 @@ install-ps-am: $(PSS) @$(NORMAL_INSTALL) - test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)" @list='$(PSS)'; test -n "$(psdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -1732,7 +1907,7 @@ maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR) + -rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/metag/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-aminfo \ maintainer-clean-generic maintainer-clean-vti @@ -1751,41 +1926,39 @@ ps-am: $(PSS) uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ - uninstall-libLTLIBRARIES uninstall-pdf-am \ - uninstall-pkgconfigDATA uninstall-ps-am + uninstall-pdf-am uninstall-pkgconfigDATA uninstall-ps-am \ + uninstall-toolexeclibLTLIBRARIES .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ - ctags-recursive install-am install-strip tags-recursive + cscopelist-recursive ctags-recursive install-am install-strip \ + tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-aminfo \ - clean-generic clean-libLTLIBRARIES clean-libtool \ - clean-noinstLTLIBRARIES ctags ctags-recursive dist dist-all \ - dist-bzip2 dist-gzip dist-info dist-lzma dist-shar dist-tarZ \ - dist-xz dist-zip distcheck distclean distclean-compile \ - distclean-generic distclean-hdr distclean-libtool \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-libLTLIBRARIES \ - install-man install-pdf install-pdf-am install-pkgconfigDATA \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-aminfo maintainer-clean-generic \ - maintainer-clean-vti mostlyclean mostlyclean-aminfo \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - mostlyclean-vti pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am uninstall-dvi-am uninstall-html-am \ - uninstall-info-am uninstall-libLTLIBRARIES uninstall-pdf-am \ - uninstall-pkgconfigDATA uninstall-ps-am + clean-cscope clean-generic clean-libtool \ + clean-noinstLTLIBRARIES clean-toolexeclibLTLIBRARIES cscope \ + cscopelist cscopelist-recursive ctags ctags-recursive dist \ + dist-all dist-bzip2 dist-gzip dist-info dist-lzip dist-shar \ + dist-tarZ dist-xz dist-zip distcheck distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pkgconfigDATA install-ps \ + install-ps-am install-strip install-toolexeclibLTLIBRARIES \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti mostlyclean \ + mostlyclean-aminfo mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool mostlyclean-vti pdf pdf-am ps ps-am tags \ + tags-recursive uninstall uninstall-am uninstall-dvi-am \ + uninstall-html-am uninstall-info-am uninstall-pdf-am \ + uninstall-pkgconfigDATA uninstall-ps-am \ + uninstall-toolexeclibLTLIBRARIES -# No install-html or install-pdf support in automake yet -.PHONY: install-html install-pdf -install-html: -install-pdf: - # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/Modules/_ctypes/libffi/README b/Modules/_ctypes/libffi/README --- a/Modules/_ctypes/libffi/README +++ b/Modules/_ctypes/libffi/README @@ -1,7 +1,7 @@ Status ====== -libffi-3.0.10 was released on XXXXXXXXXX, 2010. Check the libffi web +libffi-3.0.13 was released on March 17, 2013. Check the libffi web page for updates: . @@ -43,46 +43,70 @@ For specific configuration details and testing status, please refer to the wiki page here: - http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.10 + http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.13 At the time of release, the following basic configurations have been tested: -|--------------+------------------| -| Architecture | Operating System | -|--------------+------------------| -| Alpha | Linux | -| Alpha | Tru64 | -| ARM | Linux | -| AVR32 | Linux | -| HPPA | HPUX | -| IA-64 | Linux | -| MIPS | IRIX | -| MIPS | Linux | -| MIPS64 | Linux | -| PowerPC | Linux | -| PowerPC | Mac OSX | -| PowerPC | FreeBSD | -| PowerPC64 | Linux | -| S390 | Linux | -| S390X | Linux | -| SPARC | Linux | -| SPARC | Solaris | -| SPARC64 | Linux | -| SPARC64 | FreeBSD | -| X86 | FreeBSD | -| X86 | kFreeBSD | -| X86 | Linux | -| X86 | Mac OSX | -| X86 | OpenBSD | -| X86 | Solaris | -| X86 | Windows/Cygwin | -| X86 | Windows/MingW | -| X86-64 | FreeBSD | -| X86-64 | Linux | -| X86-64 | OpenBSD | -| X86-64 | Windows/MingW | -|--------------+------------------| +|-----------------+------------------+-------------------------| +| Architecture | Operating System | Compiler | +|-----------------+------------------+-------------------------| +| AArch64 | Linux | GCC | +| Alpha | Linux | GCC | +| Alpha | Tru64 | GCC | +| ARM | Linux | GCC | +| ARM | iOS | GCC | +| AVR32 | Linux | GCC | +| Blackfin | uClinux | GCC | +| HPPA | HPUX | GCC | +| IA-64 | Linux | GCC | +| M68K | FreeMiNT | GCC | +| M68K | Linux | GCC | +| M68K | RTEMS | GCC | +| Meta | Linux | GCC | +| MicroBlaze | Linux | GCC | +| MIPS | IRIX | GCC | +| MIPS | Linux | GCC | +| MIPS | RTEMS | GCC | +| MIPS64 | Linux | GCC | +| Moxie | Bare metal | GCC +| PowerPC 32-bit | AIX | IBM XL C | +| PowerPC 64-bit | AIX | IBM XL C | +| PowerPC | AMIGA | GCC | +| PowerPC | Linux | GCC | +| PowerPC | Mac OSX | GCC | +| PowerPC | FreeBSD | GCC | +| PowerPC 64-bit | FreeBSD | GCC | +| PowerPC 64-bit | Linux | GCC | +| S390 | Linux | GCC | +| S390X | Linux | GCC | +| SPARC | Linux | GCC | +| SPARC | Solaris | GCC | +| SPARC | Solaris | Oracle Solaris Studio C | +| SPARC64 | Linux | GCC | +| SPARC64 | FreeBSD | GCC | +| SPARC64 | Solaris | Oracle Solaris Studio C | +| TILE-Gx/TILEPro | Linux | GCC | +| X86 | FreeBSD | GCC | +| X86 | GNU HURD | GCC | +| X86 | Interix | GCC | +| X86 | kFreeBSD | GCC | +| X86 | Linux | GCC | +| X86 | Mac OSX | GCC | +| X86 | OpenBSD | GCC | +| X86 | OS/2 | GCC | +| X86 | Solaris | GCC | +| X86 | Solaris | Oracle Solaris Studio C | +| X86 | Windows/Cygwin | GCC | +| X86 | Windows/MingW | GCC | +| X86-64 | FreeBSD | GCC | +| X86-64 | Linux | GCC | +| X86-64 | Linux/x32 | GCC | +| X86-64 | OpenBSD | GCC | +| X86-64 | Solaris | Oracle Solaris Studio C | +| X86-64 | Windows/MingW | GCC | +| Xtensa | Linux | GCC | +|-----------------+------------------+-------------------------| Please send additional platform test results to libffi-discuss at sourceware.org and feel free to update the wiki page @@ -113,14 +137,20 @@ Microsoft's Visual C++ compiler. In this case, use the msvcc.sh wrapper script during configuration like so: -path/to/configure --enable-shared --enable-static \ - CC=path/to/msvcc.sh LD=link \ - CPP=\"cl -nologo -EP\" +path/to/configure CC=path/to/msvcc.sh LD=link CPP=\"cl -nologo -EP\" + +For 64-bit Windows builds, use CC="path/to/msvcc.sh -m64". +You may also need to specify --build appropriately. When building with MSVC +under a MingW environment, you may need to remove the line in configure +that sets 'fix_srcfile_path' to a 'cygpath' command. ('cygpath' is not +present in MingW, and is not required when using MingW-style paths.) + +For iOS builds, the 'libffi.xcodeproj' Xcode project is available. Configure has many other options. Use "configure --help" to see them all. Once configure has finished, type "make". Note that you must be using -GNU make. You can ftp GNU make from prep.ai.mit.edu:/pub/gnu. +GNU make. You can ftp GNU make from ftp.gnu.org:/pub/gnu/make . To ensure that libffi is working as advertised, type "make check". This will require that you have DejaGNU installed. @@ -133,11 +163,53 @@ See the ChangeLog files for details. -3.0.10 ???-??-?? - Fix the N64 build on mips-sgi-irix6.5. +3.0.13 Mar-17-13 + Add Meta support. + Add missing Moxie bits. + Fix stack alignment bug on 32-bit x86. + Build fix for m68000 targets. + Build fix for soft-float Power targets. + Fix the install dir location for some platforms when building + with GCC (OS X, Solaris). + Fix Cygwin regression. + +3.0.12 Feb-11-13 + Add Moxie support. + Add AArch64 support. + Add Blackfin support. + Add TILE-Gx/TILEPro support. + Add MicroBlaze support. + Add Xtensa support. + Add support for PaX enabled kernels with MPROTECT. + Add support for native vendor compilers on + Solaris and AIX. + Work around LLVM/GCC interoperability issue on x86_64. + +3.0.11 Apr-11-12 + Lots of build fixes. + Add Amiga newer MacOS support. + Add support for variadic functions (ffi_prep_cif_var). + Add Linux/x32 support. + Add thiscall, fastcall and MSVC cdecl support on Windows. + Add Amiga and newer MacOS support. + Add m68k FreeMiNT support. + Integration with iOS' xcode build tools. + Fix Octeon and MC68881 support. + Fix code pessimizations. + +3.0.10 Aug-23-11 + Add support for Apple's iOS. + Add support for ARM VFP ABI. + Add RTEMS support for MIPS and M68K. + Fix instruction cache clearing problems on + ARM and SPARC. + Fix the N64 build on mips-sgi-irix6.5. + Enable builds with Microsoft's compiler. + Enable x86 builds with Oracle's Solaris compiler. + Fix support for calling code compiled with Oracle's Sparc + Solaris compiler. Testsuite fixes for Tru64 Unix. - Enable builds with Microsoft's compiler. - Enable x86 builds with Sun's compiler. + Additional platform support. 3.0.9 Dec-31-09 Add AVR32 and win64 ports. Add ARM softfp support. @@ -282,15 +354,19 @@ Major processor architecture ports were contributed by the following developers: +aarch64 Marcus Shawcroft, James Greenhalgh alpha Richard Henderson arm Raffaele Sena +blackfin Alexandre Keunecke I. de Mendonca cris Simon Posnjak, Hans-Peter Nilsson frv Anthony Green ia64 Hans Boehm m32r Kazuhiro Inaoka m68k Andreas Schwab +microblaze Nathan Rossi mips Anthony Green, Casey Marshall mips64 David Daney +moxie Anthony Green pa Randolph Chung, Dave Anglin, Andreas Tobler powerpc Geoffrey Keating, Andreas Tobler, David Edelsohn, John Hornkvist @@ -299,8 +375,10 @@ sh Kaz Kojima sh64 Kaz Kojima sparc Anthony Green, Gordon Irlam +tile-gx/tilepro Walter Lee x86 Anthony Green, Jon Beniston x86-64 Bo Thorsen +xtensa Chris Zankel Jesper Skov and Andrew Haley both did more than their fair share of stepping through the code and tracking down bugs. @@ -318,5 +396,6 @@ The list above is almost certainly incomplete and inaccurate. I'm happy to make corrections or additions upon request. -If you have a problem, or have found a bug, please send a note to -green at redhat.com. +If you have a problem, or have found a bug, please send a note to the +author at green at moxielogic.com, or the project mailing list at +libffi-discuss at sourceware.org. diff --git a/Modules/_ctypes/libffi/aclocal.m4 b/Modules/_ctypes/libffi/aclocal.m4 --- a/Modules/_ctypes/libffi/aclocal.m4 +++ b/Modules/_ctypes/libffi/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.11.1 -*- Autoconf -*- +# generated automatically by aclocal 1.12.2 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. + # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,28 +13,848 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],, -[m4_warning([this file was generated for autoconf 2.65. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically `autoreconf'.])]) +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- +# +# Copyright (C) 1999-2006, 2007, 2008, 2011 Free Software Foundation, Inc. +# Written by Thomas Tanner, 1999 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 18 LTDL_INIT + +# LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE]) +# ------------------------------------------ +# DIRECTORY contains the libltdl sources. It is okay to call this +# function multiple times, as long as the same DIRECTORY is always given. +AC_DEFUN([LT_CONFIG_LTDL_DIR], +[AC_BEFORE([$0], [LTDL_INIT]) +_$0($*) +])# LT_CONFIG_LTDL_DIR + +# We break this out into a separate macro, so that we can call it safely +# internally without being caught accidentally by the sed scan in libtoolize. +m4_defun([_LT_CONFIG_LTDL_DIR], +[dnl remove trailing slashes +m4_pushdef([_ARG_DIR], m4_bpatsubst([$1], [/*$])) +m4_case(_LTDL_DIR, + [], [dnl only set lt_ltdl_dir if _ARG_DIR is not simply `.' + m4_if(_ARG_DIR, [.], + [], + [m4_define([_LTDL_DIR], _ARG_DIR) + _LT_SHELL_INIT([lt_ltdl_dir=']_ARG_DIR['])])], + [m4_if(_ARG_DIR, _LTDL_DIR, + [], + [m4_fatal([multiple libltdl directories: `]_LTDL_DIR[', `]_ARG_DIR['])])]) +m4_popdef([_ARG_DIR]) +])# _LT_CONFIG_LTDL_DIR + +# Initialise: +m4_define([_LTDL_DIR], []) + + +# _LT_BUILD_PREFIX +# ---------------- +# If Autoconf is new enough, expand to `${top_build_prefix}', otherwise +# to `${top_builddir}/'. +m4_define([_LT_BUILD_PREFIX], +[m4_ifdef([AC_AUTOCONF_VERSION], + [m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.62]), + [-1], [m4_ifdef([_AC_HAVE_TOP_BUILD_PREFIX], + [${top_build_prefix}], + [${top_builddir}/])], + [${top_build_prefix}])], + [${top_builddir}/])[]dnl +]) + + +# LTDL_CONVENIENCE +# ---------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. LIBLTDL will be prefixed with +# '${top_build_prefix}' if available, otherwise with '${top_builddir}/', +# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single +# quotes!). If your package is not flat and you're not using automake, +# define top_build_prefix, top_builddir, and top_srcdir appropriately +# in your Makefiles. +AC_DEFUN([LTDL_CONVENIENCE], +[AC_BEFORE([$0], [LTDL_INIT])dnl +dnl Although the argument is deprecated and no longer documented, +dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one +dnl here make sure it is the same as any other declaration of libltdl's +dnl location! This also ensures lt_ltdl_dir is set when configure.ac is +dnl not yet using an explicit LT_CONFIG_LTDL_DIR. +m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl +_$0() +])# LTDL_CONVENIENCE + +# AC_LIBLTDL_CONVENIENCE accepted a directory argument in older libtools, +# now we have LT_CONFIG_LTDL_DIR: +AU_DEFUN([AC_LIBLTDL_CONVENIENCE], +[_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) +_LTDL_CONVENIENCE]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBLTDL_CONVENIENCE], []) + + +# _LTDL_CONVENIENCE +# ----------------- +# Code shared by LTDL_CONVENIENCE and LTDL_INIT([convenience]). +m4_defun([_LTDL_CONVENIENCE], +[case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; +esac +LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdlc.la" +LTDLDEPS=$LIBLTDL +LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" + +AC_SUBST([LIBLTDL]) +AC_SUBST([LTDLDEPS]) +AC_SUBST([LTDLINCL]) + +# For backwards non-gettext consistent compatibility... +INCLTDL="$LTDLINCL" +AC_SUBST([INCLTDL]) +])# _LTDL_CONVENIENCE + + +# LTDL_INSTALLABLE +# ---------------- +# sets LIBLTDL to the link flags for the libltdl installable library +# and LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called from here. If an installed libltdl +# is not found, LIBLTDL will be prefixed with '${top_build_prefix}' if +# available, otherwise with '${top_builddir}/', and LTDLINCL will be +# prefixed with '${top_srcdir}/' (note the single quotes!). If your +# package is not flat and you're not using automake, define top_build_prefix, +# top_builddir, and top_srcdir appropriately in your Makefiles. +# In the future, this macro may have to be called after LT_INIT. +AC_DEFUN([LTDL_INSTALLABLE], +[AC_BEFORE([$0], [LTDL_INIT])dnl +dnl Although the argument is deprecated and no longer documented, +dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one +dnl here make sure it is the same as any other declaration of libltdl's +dnl location! This also ensures lt_ltdl_dir is set when configure.ac is +dnl not yet using an explicit LT_CONFIG_LTDL_DIR. +m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl +_$0() +])# LTDL_INSTALLABLE + +# AC_LIBLTDL_INSTALLABLE accepted a directory argument in older libtools, +# now we have LT_CONFIG_LTDL_DIR: +AU_DEFUN([AC_LIBLTDL_INSTALLABLE], +[_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) +_LTDL_INSTALLABLE]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBLTDL_INSTALLABLE], []) + + +# _LTDL_INSTALLABLE +# ----------------- +# Code shared by LTDL_INSTALLABLE and LTDL_INIT([installable]). +m4_defun([_LTDL_INSTALLABLE], +[if test -f $prefix/lib/libltdl.la; then + lt_save_LDFLAGS="$LDFLAGS" + LDFLAGS="-L$prefix/lib $LDFLAGS" + AC_CHECK_LIB([ltdl], [lt_dlinit], [lt_lib_ltdl=yes]) + LDFLAGS="$lt_save_LDFLAGS" + if test x"${lt_lib_ltdl-no}" = xyes; then + if test x"$enable_ltdl_install" != xyes; then + # Don't overwrite $prefix/lib/libltdl.la without --enable-ltdl-install + AC_MSG_WARN([not overwriting libltdl at $prefix, force with `--enable-ltdl-install']) + enable_ltdl_install=no + fi + elif test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + fi +fi + +# If configure.ac declared an installable ltdl, and the user didn't override +# with --disable-ltdl-install, we will install the shipped libltdl. +case $enable_ltdl_install in + no) ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLDEPS= + LTDLINCL= + ;; + *) enable_ltdl_install=yes + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdl.la" + LTDLDEPS=$LIBLTDL + LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" + ;; +esac + +AC_SUBST([LIBLTDL]) +AC_SUBST([LTDLDEPS]) +AC_SUBST([LTDLINCL]) + +# For backwards non-gettext consistent compatibility... +INCLTDL="$LTDLINCL" +AC_SUBST([INCLTDL]) +])# LTDL_INSTALLABLE + + +# _LTDL_MODE_DISPATCH +# ------------------- +m4_define([_LTDL_MODE_DISPATCH], +[dnl If _LTDL_DIR is `.', then we are configuring libltdl itself: +m4_if(_LTDL_DIR, [], + [], + dnl if _LTDL_MODE was not set already, the default value is `subproject': + [m4_case(m4_default(_LTDL_MODE, [subproject]), + [subproject], [AC_CONFIG_SUBDIRS(_LTDL_DIR) + _LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"])], + [nonrecursive], [_LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"; lt_libobj_prefix="$lt_ltdl_dir/"])], + [recursive], [], + [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])dnl +dnl Be careful not to expand twice: +m4_define([$0], []) +])# _LTDL_MODE_DISPATCH + + +# _LT_LIBOBJ(MODULE_NAME) +# ----------------------- +# Like AC_LIBOBJ, except that MODULE_NAME goes into _LT_LIBOBJS instead +# of into LIBOBJS. +AC_DEFUN([_LT_LIBOBJ], [ + m4_pattern_allow([^_LT_LIBOBJS$]) + _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" +])# _LT_LIBOBJS + + +# LTDL_INIT([OPTIONS]) +# -------------------- +# Clients of libltdl can use this macro to allow the installer to +# choose between a shipped copy of the ltdl sources or a preinstalled +# version of the library. If the shipped ltdl sources are not in a +# subdirectory named libltdl, the directory name must be given by +# LT_CONFIG_LTDL_DIR. +AC_DEFUN([LTDL_INIT], +[dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +dnl We need to keep our own list of libobjs separate from our parent project, +dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while +dnl we look for our own LIBOBJs. +m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) +m4_pushdef([AC_LIBSOURCES]) + +dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: +m4_if(_LTDL_MODE, [], + [m4_define([_LTDL_MODE], m4_default([$2], [subproject])) + m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])], + [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])]) + +AC_ARG_WITH([included_ltdl], + [AS_HELP_STRING([--with-included-ltdl], + [use the GNU ltdl sources included here])]) + +if test "x$with_included_ltdl" != xyes; then + # We are not being forced to use the included libltdl sources, so + # decide whether there is a useful installed version we can use. + AC_CHECK_HEADER([ltdl.h], + [AC_CHECK_DECL([lt_dlinterface_register], + [AC_CHECK_LIB([ltdl], [lt_dladvise_preload], + [with_included_ltdl=no], + [with_included_ltdl=yes])], + [with_included_ltdl=yes], + [AC_INCLUDES_DEFAULT + #include ])], + [with_included_ltdl=yes], + [AC_INCLUDES_DEFAULT] + ) +fi + +dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE +dnl was called yet, then for old times' sake, we assume libltdl is in an +dnl eponymous directory: +AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])]) + +AC_ARG_WITH([ltdl_include], + [AS_HELP_STRING([--with-ltdl-include=DIR], + [use the ltdl headers installed in DIR])]) + +if test -n "$with_ltdl_include"; then + if test -f "$with_ltdl_include/ltdl.h"; then : + else + AC_MSG_ERROR([invalid ltdl include directory: `$with_ltdl_include']) + fi +else + with_ltdl_include=no +fi + +AC_ARG_WITH([ltdl_lib], + [AS_HELP_STRING([--with-ltdl-lib=DIR], + [use the libltdl.la installed in DIR])]) + +if test -n "$with_ltdl_lib"; then + if test -f "$with_ltdl_lib/libltdl.la"; then : + else + AC_MSG_ERROR([invalid ltdl library directory: `$with_ltdl_lib']) + fi +else + with_ltdl_lib=no +fi + +case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in + ,yes,no,no,) + m4_case(m4_default(_LTDL_TYPE, [convenience]), + [convenience], [_LTDL_CONVENIENCE], + [installable], [_LTDL_INSTALLABLE], + [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)]) + ;; + ,no,no,no,) + # If the included ltdl is not to be used, then use the + # preinstalled libltdl we found. + AC_DEFINE([HAVE_LTDL], [1], + [Define this if a modern libltdl is already installed]) + LIBLTDL=-lltdl + LTDLDEPS= + LTDLINCL= + ;; + ,no*,no,*) + AC_MSG_ERROR([`--with-ltdl-include' and `--with-ltdl-lib' options must be used together]) + ;; + *) with_included_ltdl=no + LIBLTDL="-L$with_ltdl_lib -lltdl" + LTDLDEPS= + LTDLINCL="-I$with_ltdl_include" + ;; +esac +INCLTDL="$LTDLINCL" + +# Report our decision... +AC_MSG_CHECKING([where to find libltdl headers]) +AC_MSG_RESULT([$LTDLINCL]) +AC_MSG_CHECKING([where to find libltdl library]) +AC_MSG_RESULT([$LIBLTDL]) + +_LTDL_SETUP + +dnl restore autoconf definition. +m4_popdef([AC_LIBOBJ]) +m4_popdef([AC_LIBSOURCES]) + +AC_CONFIG_COMMANDS_PRE([ + _ltdl_libobjs= + _ltdl_ltlibobjs= + if test -n "$_LT_LIBOBJS"; then + # Remove the extension. + _lt_sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed "$_lt_sed_drop_objext" | sort -u`; do + _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext" + _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo" + done + fi + AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs]) + AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs]) +]) + +# Only expand once: +m4_define([LTDL_INIT]) +])# LTDL_INIT + +# Old names: +AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)]) +AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)]) +AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIB_LTDL], []) +dnl AC_DEFUN([AC_WITH_LTDL], []) +dnl AC_DEFUN([LT_WITH_LTDL], []) + + +# _LTDL_SETUP +# ----------- +# Perform all the checks necessary for compilation of the ltdl objects +# -- including compiler checks and header checks. This is a public +# interface mainly for the benefit of libltdl's own configure.ac, most +# other users should call LTDL_INIT instead. +AC_DEFUN([_LTDL_SETUP], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_SYS_MODULE_EXT])dnl +AC_REQUIRE([LT_SYS_MODULE_PATH])dnl +AC_REQUIRE([LT_SYS_DLSEARCH_PATH])dnl +AC_REQUIRE([LT_LIB_DLLOAD])dnl +AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl +AC_REQUIRE([LT_FUNC_DLSYM_USCORE])dnl +AC_REQUIRE([LT_SYS_DLOPEN_DEPLIBS])dnl +AC_REQUIRE([gl_FUNC_ARGZ])dnl + +m4_require([_LT_CHECK_OBJDIR])dnl +m4_require([_LT_HEADER_DLFCN])dnl +m4_require([_LT_CHECK_DLPREOPEN])dnl +m4_require([_LT_DECL_SED])dnl + +dnl Don't require this, or it will be expanded earlier than the code +dnl that sets the variables it relies on: +_LT_ENABLE_INSTALL + +dnl _LTDL_MODE specific code must be called at least once: +_LTDL_MODE_DISPATCH + +# In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS +# the user used. This is so that ltdl.h can pick up the parent projects +# config.h file, The first file in AC_CONFIG_HEADERS must contain the +# definitions required by ltdl.c. +# FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility). +AC_CONFIG_COMMANDS_PRE([dnl +m4_pattern_allow([^LT_CONFIG_H$])dnl +m4_ifset([AH_HEADER], + [LT_CONFIG_H=AH_HEADER], + [m4_ifset([AC_LIST_HEADERS], + [LT_CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's,^[[ ]]*,,;s,[[ :]].*$,,'`], + [])])]) +AC_SUBST([LT_CONFIG_H]) + +AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], + [], [], [AC_INCLUDES_DEFAULT]) + +AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) +AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) + +m4_pattern_allow([LT_LIBEXT])dnl +AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) + +name= +eval "lt_libprefix=\"$libname_spec\"" +m4_pattern_allow([LT_LIBPREFIX])dnl +AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix]) + +name=ltdl +eval "LTDLOPEN=\"$libname_spec\"" +AC_SUBST([LTDLOPEN]) +])# _LTDL_SETUP + + +# _LT_ENABLE_INSTALL +# ------------------ +m4_define([_LT_ENABLE_INSTALL], +[AC_ARG_ENABLE([ltdl-install], + [AS_HELP_STRING([--enable-ltdl-install], [install libltdl])]) + +case ,${enable_ltdl_install},${enable_ltdl_convenience} in + *yes*) ;; + *) enable_ltdl_convenience=yes ;; +esac + +m4_ifdef([AM_CONDITIONAL], +[AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno) + AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)]) +])# _LT_ENABLE_INSTALL + + +# LT_SYS_DLOPEN_DEPLIBS +# --------------------- +AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_CACHE_CHECK([whether deplibs are loaded by dlopen], + [lt_cv_sys_dlopen_deplibs], + [# PORTME does your system automatically load deplibs for dlopen? + # or its logical equivalent (e.g. shl_load for HP-UX < 11) + # For now, we just catch OSes we know something about -- in the + # future, we'll try test this programmatically. + lt_cv_sys_dlopen_deplibs=unknown + case $host_os in + aix3*|aix4.1.*|aix4.2.*) + # Unknown whether this is true for these versions of AIX, but + # we want this `case' here to explicitly catch those versions. + lt_cv_sys_dlopen_deplibs=unknown + ;; + aix[[4-9]]*) + lt_cv_sys_dlopen_deplibs=yes + ;; + amigaos*) + case $host_cpu in + powerpc) + lt_cv_sys_dlopen_deplibs=no + ;; + esac + ;; + darwin*) + # Assuming the user has installed a libdl from somewhere, this is true + # If you are looking for one http://www.opendarwin.org/projects/dlcompat + lt_cv_sys_dlopen_deplibs=yes + ;; + freebsd* | dragonfly*) + lt_cv_sys_dlopen_deplibs=yes + ;; + gnu* | linux* | k*bsd*-gnu | kopensolaris*-gnu) + # GNU and its variants, using gnu ld.so (Glibc) + lt_cv_sys_dlopen_deplibs=yes + ;; + hpux10*|hpux11*) + lt_cv_sys_dlopen_deplibs=yes + ;; + interix*) + lt_cv_sys_dlopen_deplibs=yes + ;; + irix[[12345]]*|irix6.[[01]]*) + # Catch all versions of IRIX before 6.2, and indicate that we don't + # know how it worked for any of those versions. + lt_cv_sys_dlopen_deplibs=unknown + ;; + irix*) + # The case above catches anything before 6.2, and it's known that + # at 6.2 and later dlopen does load deplibs. + lt_cv_sys_dlopen_deplibs=yes + ;; + netbsd*) + lt_cv_sys_dlopen_deplibs=yes + ;; + openbsd*) + lt_cv_sys_dlopen_deplibs=yes + ;; + osf[[1234]]*) + # dlopen did load deplibs (at least at 4.x), but until the 5.x series, + # it did *not* use an RPATH in a shared library to find objects the + # library depends on, so we explicitly say `no'. + lt_cv_sys_dlopen_deplibs=no + ;; + osf5.0|osf5.0a|osf5.1) + # dlopen *does* load deplibs and with the right loader patch applied + # it even uses RPATH in a shared library to search for shared objects + # that the library depends on, but there's no easy way to know if that + # patch is installed. Since this is the case, all we can really + # say is unknown -- it depends on the patch being installed. If + # it is, this changes to `yes'. Without it, it would be `no'. + lt_cv_sys_dlopen_deplibs=unknown + ;; + osf*) + # the two cases above should catch all versions of osf <= 5.1. Read + # the comments above for what we know about them. + # At > 5.1, deplibs are loaded *and* any RPATH in a shared library + # is used to find them so we can finally say `yes'. + lt_cv_sys_dlopen_deplibs=yes + ;; + qnx*) + lt_cv_sys_dlopen_deplibs=yes + ;; + solaris*) + lt_cv_sys_dlopen_deplibs=yes + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + esac + ]) +if test "$lt_cv_sys_dlopen_deplibs" != yes; then + AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], + [Define if the OS needs help to load dependent libraries for dlopen().]) +fi +])# LT_SYS_DLOPEN_DEPLIBS + +# Old name: +AU_ALIAS([AC_LTDL_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], []) + + +# LT_SYS_MODULE_EXT +# ----------------- +AC_DEFUN([LT_SYS_MODULE_EXT], +[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([which extension is used for runtime loadable modules], + [libltdl_cv_shlibext], +[ +module=yes +eval libltdl_cv_shlibext=$shrext_cmds +module=no +eval libltdl_cv_shrext=$shrext_cmds + ]) +if test -n "$libltdl_cv_shlibext"; then + m4_pattern_allow([LT_MODULE_EXT])dnl + AC_DEFINE_UNQUOTED([LT_MODULE_EXT], ["$libltdl_cv_shlibext"], + [Define to the extension used for runtime loadable modules, say, ".so".]) +fi +if test "$libltdl_cv_shrext" != "$libltdl_cv_shlibext"; then + m4_pattern_allow([LT_SHARED_EXT])dnl + AC_DEFINE_UNQUOTED([LT_SHARED_EXT], ["$libltdl_cv_shrext"], + [Define to the shared library suffix, say, ".dylib".]) +fi +])# LT_SYS_MODULE_EXT + +# Old name: +AU_ALIAS([AC_LTDL_SHLIBEXT], [LT_SYS_MODULE_EXT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SHLIBEXT], []) + + +# LT_SYS_MODULE_PATH +# ------------------ +AC_DEFUN([LT_SYS_MODULE_PATH], +[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([which variable specifies run-time module search path], + [lt_cv_module_path_var], [lt_cv_module_path_var="$shlibpath_var"]) +if test -n "$lt_cv_module_path_var"; then + m4_pattern_allow([LT_MODULE_PATH_VAR])dnl + AC_DEFINE_UNQUOTED([LT_MODULE_PATH_VAR], ["$lt_cv_module_path_var"], + [Define to the name of the environment variable that determines the run-time module search path.]) +fi +])# LT_SYS_MODULE_PATH + +# Old name: +AU_ALIAS([AC_LTDL_SHLIBPATH], [LT_SYS_MODULE_PATH]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SHLIBPATH], []) + + +# LT_SYS_DLSEARCH_PATH +# -------------------- +AC_DEFUN([LT_SYS_DLSEARCH_PATH], +[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([for the default library search path], + [lt_cv_sys_dlsearch_path], + [lt_cv_sys_dlsearch_path="$sys_lib_dlsearch_path_spec"]) +if test -n "$lt_cv_sys_dlsearch_path"; then + sys_dlsearch_path= + for dir in $lt_cv_sys_dlsearch_path; do + if test -z "$sys_dlsearch_path"; then + sys_dlsearch_path="$dir" + else + sys_dlsearch_path="$sys_dlsearch_path$PATH_SEPARATOR$dir" + fi + done + m4_pattern_allow([LT_DLSEARCH_PATH])dnl + AC_DEFINE_UNQUOTED([LT_DLSEARCH_PATH], ["$sys_dlsearch_path"], + [Define to the system default library search path.]) +fi +])# LT_SYS_DLSEARCH_PATH + +# Old name: +AU_ALIAS([AC_LTDL_SYSSEARCHPATH], [LT_SYS_DLSEARCH_PATH]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SYSSEARCHPATH], []) + + +# _LT_CHECK_DLPREOPEN +# ------------------- +m4_defun([_LT_CHECK_DLPREOPEN], +[m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen], + [libltdl_cv_preloaded_symbols], + [if test -n "$lt_cv_sys_global_symbol_pipe"; then + libltdl_cv_preloaded_symbols=yes + else + libltdl_cv_preloaded_symbols=no + fi + ]) +if test x"$libltdl_cv_preloaded_symbols" = xyes; then + AC_DEFINE([HAVE_PRELOADED_SYMBOLS], [1], + [Define if libtool can extract symbol lists from object files.]) +fi +])# _LT_CHECK_DLPREOPEN + + +# LT_LIB_DLLOAD +# ------------- +AC_DEFUN([LT_LIB_DLLOAD], +[m4_pattern_allow([^LT_DLLOADERS$]) +LT_DLLOADERS= +AC_SUBST([LT_DLLOADERS]) + +AC_LANG_PUSH([C]) + +LIBADD_DLOPEN= +AC_SEARCH_LIBS([dlopen], [dl], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + if test "$ac_cv_search_dlopen" != "none required" ; then + LIBADD_DLOPEN="-ldl" + fi + libltdl_cv_lib_dl_dlopen="yes" + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H +# include +#endif + ]], [[dlopen(0, 0);]])], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + libltdl_cv_func_dlopen="yes" + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], + [AC_CHECK_LIB([svld], [dlopen], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + LIBADD_DLOPEN="-lsvld" libltdl_cv_func_dlopen="yes" + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"])])]) +if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes +then + lt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBADD_DLOPEN" + AC_CHECK_FUNCS([dlerror]) + LIBS="$lt_save_LIBS" +fi +AC_SUBST([LIBADD_DLOPEN]) + +LIBADD_SHL_LOAD= +AC_CHECK_FUNC([shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"], + [AC_CHECK_LIB([dld], [shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" + LIBADD_SHL_LOAD="-ldld"])]) +AC_SUBST([LIBADD_SHL_LOAD]) + +case $host_os in +darwin[[1567]].*) +# We only want this for pre-Mac OS X 10.4. + AC_CHECK_FUNC([_dyld_func_lookup], + [AC_DEFINE([HAVE_DYLD], [1], + [Define if you have the _dyld_func_lookup function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la"]) + ;; +beos*) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" + ;; +cygwin* | mingw* | os2* | pw32*) + AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include ]]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" + ;; +esac + +AC_CHECK_LIB([dld], [dld_link], + [AC_DEFINE([HAVE_DLD], [1], + [Define if you have the GNU dld library.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la"]) +AC_SUBST([LIBADD_DLD_LINK]) + +m4_pattern_allow([^LT_DLPREOPEN$]) +LT_DLPREOPEN= +if test -n "$LT_DLLOADERS" +then + for lt_loader in $LT_DLLOADERS; do + LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " + done + AC_DEFINE([HAVE_LIBDLLOADER], [1], + [Define if libdlloader will be built on this platform]) +fi +AC_SUBST([LT_DLPREOPEN]) + +dnl This isn't used anymore, but set it for backwards compatibility +LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" +AC_SUBST([LIBADD_DL]) + +AC_LANG_POP +])# LT_LIB_DLLOAD + +# Old name: +AU_ALIAS([AC_LTDL_DLLIB], [LT_LIB_DLLOAD]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_DLLIB], []) + + +# LT_SYS_SYMBOL_USCORE +# -------------------- +# does the compiler prefix global symbols with an underscore? +AC_DEFUN([LT_SYS_SYMBOL_USCORE], +[m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +AC_CACHE_CHECK([for _ prefix in compiled symbols], + [lt_cv_sys_symbol_underscore], + [lt_cv_sys_symbol_underscore=no + cat > conftest.$ac_ext <<_LT_EOF +void nm_test_func(){} +int main(){nm_test_func;return 0;} +_LT_EOF + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + ac_nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then + # See whether the symbols have a leading underscore. + if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then + lt_cv_sys_symbol_underscore=yes + else + if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then + : + else + echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD + fi + fi + else + echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.c >&AS_MESSAGE_LOG_FD + fi + rm -rf conftest* + ]) + sys_symbol_underscore=$lt_cv_sys_symbol_underscore + AC_SUBST([sys_symbol_underscore]) +])# LT_SYS_SYMBOL_USCORE + +# Old name: +AU_ALIAS([AC_LTDL_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SYMBOL_USCORE], []) + + +# LT_FUNC_DLSYM_USCORE +# -------------------- +AC_DEFUN([LT_FUNC_DLSYM_USCORE], +[AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl +if test x"$lt_cv_sys_symbol_underscore" = xyes; then + if test x"$libltdl_cv_func_dlopen" = xyes || + test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then + AC_CACHE_CHECK([whether we have to add an underscore for dlsym], + [libltdl_cv_need_uscore], + [libltdl_cv_need_uscore=unknown + save_LIBS="$LIBS" + LIBS="$LIBS $LIBADD_DLOPEN" + _LT_TRY_DLOPEN_SELF( + [libltdl_cv_need_uscore=no], [libltdl_cv_need_uscore=yes], + [], [libltdl_cv_need_uscore=cross]) + LIBS="$save_LIBS" + ]) + fi +fi + +if test x"$libltdl_cv_need_uscore" = xyes; then + AC_DEFINE([NEED_USCORE], [1], + [Define if dlsym() requires a leading underscore in symbol names.]) +fi +])# LT_FUNC_DLSYM_USCORE + +# Old name: +AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], []) + +# Copyright (C) 2002-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 8 + # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.11' +[am__api_version='1.12' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.1], [], +m4_if([$1], [1.12.2], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -50,14 +870,14 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.1])dnl +[AM_AUTOMAKE_VERSION([1.12.2])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # Figure out how to run the assembler. -*- Autoconf -*- -# Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -79,15 +899,17 @@ # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 2 + # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and @@ -106,7 +928,7 @@ # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you +# harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, @@ -132,22 +954,21 @@ # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1997-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 9 +# serial 10 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl @@ -166,16 +987,15 @@ Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 -# Free Software Foundation, Inc. +# Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 10 +# serial 17 -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing @@ -185,7 +1005,7 @@ # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was @@ -198,12 +1018,13 @@ AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], UPC, [depcc="$UPC" am_compiler_list=], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], @@ -211,8 +1032,9 @@ # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -251,16 +1073,16 @@ : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -269,16 +1091,16 @@ test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -326,7 +1148,7 @@ # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl @@ -336,28 +1158,34 @@ # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors]) +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' + am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -#serial 5 +# serial 6 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ @@ -376,7 +1204,7 @@ # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but + # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. @@ -388,21 +1216,19 @@ continue fi # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` @@ -420,7 +1246,7 @@ # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will +# is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], @@ -430,14 +1256,13 @@ # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 16 +# serial 19 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. @@ -483,31 +1308,41 @@ # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl +[AC_DIAGNOSE([obsolete], +[$0: two- and three-arguments forms are deprecated. For more info, see: +http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AM_PROG_MKDIR_P])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl @@ -518,28 +1353,35 @@ [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES(OBJC)], - [define([AC_PROG_OBJC], - defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +dnl Support for Objective C++ was only introduced in Autoconf 2.65, +dnl but we still cater to Autoconf 2.62. +m4_ifdef([AC_PROG_OBJCXX], +[AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl -dnl The `parallel-tests' driver may need to know about EXEEXT, so add the -dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) -dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], @@ -567,12 +1409,14 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 8 + # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. @@ -586,9 +1430,9 @@ install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi -AC_SUBST(install_sh)]) +AC_SUBST([install_sh])]) -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2003-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -612,20 +1456,19 @@ # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 5 +# serial 7 # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. -# Default is to disable them, unless `enable' is passed literally. -# For symmetry, `disable' may be passed as well. Anyway, the user +# Default is to disable them, unless 'enable' is passed literally. +# For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), @@ -633,13 +1476,14 @@ [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t at _MAINTAINER_MODE: $1])]) -AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], -[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - [USE_MAINTAINER_MODE=$enableval], - [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], + am_maintainer_other[ make rules and dependencies not useful + (and sometimes confusing) to the casual installer])], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE @@ -651,13 +1495,13 @@ # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 4 +# serial 5 # AM_MAKE_INCLUDE() # ----------------- @@ -676,7 +1520,7 @@ _am_result=none # First try GNU make style include. echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. +# Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include @@ -701,8 +1545,7 @@ rm -f confinc confmf ]) -# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -738,14 +1581,13 @@ # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1997-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 6 +# serial 7 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -775,45 +1617,19 @@ am_missing_run="$MISSING --run " else am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) + AC_MSG_WARN(['missing' script is too old or missing]) fi ]) -# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 4 +# serial 6 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -821,13 +1637,13 @@ [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) -# ------------------------------ +# -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- +# ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) @@ -840,22 +1656,18 @@ # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 5 +# serial 9 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -866,32 +1678,40 @@ esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac -# Do `set' in a subshell so we don't clobber the current shell's +# Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done test "$[2]" = conftest.file ) then @@ -901,43 +1721,61 @@ AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi -AC_MSG_RESULT(yes)]) +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 2 + # AM_PROG_INSTALL_STRIP # --------------------- -# One issue with vendor `install' (even GNU) is that you can't +# One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize +# always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# Copyright (C) 2006-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 2 +# serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- @@ -946,24 +1784,24 @@ AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- +# -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 2004-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 2 +# serial 3 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory @@ -974,10 +1812,11 @@ # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) @@ -985,7 +1824,7 @@ _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. +# Solaris sh will not grok spaces in the rhs of '-'. for _am_tool in $_am_tools do case $_am_tool in @@ -1046,6 +1885,16 @@ AC_SUBST([am__untar]) ]) # _AM_PROG_TAR +m4_include([m4/asmcfi.m4]) +m4_include([m4/ax_append_flag.m4]) +m4_include([m4/ax_cc_maxopt.m4]) +m4_include([m4/ax_cflags_warn_all.m4]) +m4_include([m4/ax_check_compile_flag.m4]) +m4_include([m4/ax_compiler_vendor.m4]) +m4_include([m4/ax_configure_args.m4]) +m4_include([m4/ax_enable_builddir.m4]) +m4_include([m4/ax_gcc_archflag.m4]) +m4_include([m4/ax_gcc_x86_cpuid.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) diff --git a/Modules/_ctypes/libffi/build-ios.sh b/Modules/_ctypes/libffi/build-ios.sh new file mode 100755 --- /dev/null +++ b/Modules/_ctypes/libffi/build-ios.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +PLATFORM_IOS=/Developer/Platforms/iPhoneOS.platform/ +PLATFORM_IOS_SIM=/Developer/Platforms/iPhoneSimulator.platform/ +SDK_IOS_VERSION="4.2" +MIN_IOS_VERSION="3.0" +OUTPUT_DIR="universal-ios" + +build_target () { + local platform=$1 + local sdk=$2 + local arch=$3 + local triple=$4 + local builddir=$5 + + mkdir -p "${builddir}" + pushd "${builddir}" + export CC="${platform}"/Developer/usr/bin/gcc-4.2 + export CFLAGS="-arch ${arch} -isysroot ${sdk} -miphoneos-version-min=${MIN_IOS_VERSION}" + ../configure --host=${triple} && make + popd +} + +# Build all targets +build_target "${PLATFORM_IOS}" "${PLATFORM_IOS}/Developer/SDKs/iPhoneOS${SDK_IOS_VERSION}.sdk/" armv6 arm-apple-darwin10 armv6-ios +build_target "${PLATFORM_IOS}" "${PLATFORM_IOS}/Developer/SDKs/iPhoneOS${SDK_IOS_VERSION}.sdk/" armv7 arm-apple-darwin10 armv7-ios +build_target "${PLATFORM_IOS_SIM}" "${PLATFORM_IOS_SIM}/Developer/SDKs/iPhoneSimulator${SDK_IOS_VERSION}.sdk/" i386 i386-apple-darwin10 i386-ios-sim + +# Create universal output directories +mkdir -p "${OUTPUT_DIR}" +mkdir -p "${OUTPUT_DIR}/include" +mkdir -p "${OUTPUT_DIR}/include/armv6" +mkdir -p "${OUTPUT_DIR}/include/armv7" +mkdir -p "${OUTPUT_DIR}/include/i386" + +# Create the universal binary +lipo -create armv6-ios/.libs/libffi.a armv7-ios/.libs/libffi.a i386-ios-sim/.libs/libffi.a -output "${OUTPUT_DIR}/libffi.a" + +# Copy in the headers +copy_headers () { + local src=$1 + local dest=$2 + + # Fix non-relative header reference + sed 's//"ffitarget.h"/' < "${src}/include/ffi.h" > "${dest}/ffi.h" + cp "${src}/include/ffitarget.h" "${dest}" +} + +copy_headers armv6-ios "${OUTPUT_DIR}/include/armv6" +copy_headers armv7-ios "${OUTPUT_DIR}/include/armv7" +copy_headers i386-ios-sim "${OUTPUT_DIR}/include/i386" + +# Create top-level header +( +cat << EOF +#ifdef __arm__ + #include + #ifdef _ARM_ARCH_6 + #include "include/armv6/ffi.h" + #elif _ARM_ARCH_7 + #include "include/armv7/ffi.h" + #endif +#elif defined(__i386__) + #include "include/i386/ffi.h" +#endif +EOF +) > "${OUTPUT_DIR}/ffi.h" diff --git a/Modules/_ctypes/libffi/compile b/Modules/_ctypes/libffi/compile --- a/Modules/_ctypes/libffi/compile +++ b/Modules/_ctypes/libffi/compile @@ -1,9 +1,10 @@ #! /bin/sh # Wrapper for compilers which do not understand `-c -o'. -scriptversion=2005-05-14.22 +scriptversion=2009-10-06.20; # UTC -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software +# Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -17,8 +18,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -103,13 +103,13 @@ fi # Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. -# Note: use `[/.-]' here to ensure that we don't use the same name +# Note: use `[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break @@ -124,9 +124,9 @@ ret=$? if test -f "$cofile"; then - mv "$cofile" "$ofile" + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then - mv "${cofile}bj" "$ofile" + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" @@ -138,5 +138,6 @@ # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: diff --git a/Modules/_ctypes/libffi/config.guess b/Modules/_ctypes/libffi/config.guess --- a/Modules/_ctypes/libffi/config.guess +++ b/Modules/_ctypes/libffi/config.guess @@ -1,14 +1,14 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 -# Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012, 2013 Free Software Foundation, Inc. -timestamp='2009-11-19' +timestamp='2012-12-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -17,26 +17,22 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches at gnu.org. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -56,8 +52,9 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -144,7 +141,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -180,7 +177,7 @@ fi ;; *) - os=netbsd + os=netbsd ;; esac # The OS release @@ -201,6 +198,10 @@ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} @@ -223,7 +224,7 @@ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on @@ -269,7 +270,10 @@ # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -295,12 +299,12 @@ echo s390-ibm-zvmoe exit ;; *:OS400:*:*) - echo powerpc-ibm-os400 + echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -333,6 +337,9 @@ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" @@ -391,23 +398,23 @@ # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; @@ -477,8 +484,8 @@ echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ @@ -491,7 +498,7 @@ else echo i586-dg-dgux${UNAME_RELEASE} fi - exit ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; @@ -548,7 +555,7 @@ echo rs6000-ibm-aix3.2 fi exit ;; - *:AIX:*:[456]) + *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 @@ -591,52 +598,52 @@ 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac + esac ;; + esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >$dummy.c - #define _HPUX_SOURCE - #include - #include + #define _HPUX_SOURCE + #include + #include - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa @@ -727,22 +734,22 @@ exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; @@ -766,14 +773,14 @@ exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} @@ -785,30 +792,35 @@ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) - case ${UNAME_MACHINE} in + case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; @@ -854,6 +866,13 @@ i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -863,7 +882,7 @@ EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; - esac + esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} @@ -875,20 +894,29 @@ then echo ${UNAME_MACHINE}-unknown-linux-gnu else - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu @@ -930,7 +958,7 @@ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) - echo or32-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu @@ -956,7 +984,7 @@ echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu @@ -964,14 +992,17 @@ sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -980,11 +1011,11 @@ echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. + # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) @@ -1016,7 +1047,7 @@ fi exit ;; i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; @@ -1044,13 +1075,13 @@ exit ;; pc:*:*:*) # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp - exit ;; + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; @@ -1085,8 +1116,8 @@ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ @@ -1129,10 +1160,10 @@ echo ns32k-sni-sysv fi exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm @@ -1158,11 +1189,11 @@ exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-unknown-sysv${UNAME_RELEASE} fi - exit ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; @@ -1175,6 +1206,9 @@ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1227,7 +1261,10 @@ *:QNX:*:4*) echo i386-pc-qnx exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1272,13 +1309,13 @@ echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} + echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; @@ -1296,11 +1333,11 @@ i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - eval $set_cc_for_build cat >$dummy.c < printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else - "" + "" #endif - ); exit (0); + ); exit (0); #endif #endif diff --git a/Modules/_ctypes/libffi/config.sub b/Modules/_ctypes/libffi/config.sub --- a/Modules/_ctypes/libffi/config.sub +++ b/Modules/_ctypes/libffi/config.sub @@ -1,38 +1,33 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 -# Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012, 2013 Free Software Foundation, Inc. -timestamp='2009-11-07' +timestamp='2012-12-29' -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches with a ChangeLog entry to config-patches at gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -75,8 +70,9 @@ version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -123,13 +119,18 @@ # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] @@ -152,12 +153,12 @@ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; - -bluegene*) - os=-cnk + -bluegene*) + os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= @@ -173,10 +174,10 @@ os=-chorusos basic_machine=$1 ;; - -chorusrdb) - os=-chorusrdb + -chorusrdb) + os=-chorusrdb basic_machine=$1 - ;; + ;; -hiux*) os=-hiuxwe2 ;; @@ -221,6 +222,12 @@ -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -245,20 +252,27 @@ # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ + | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | arc \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ + | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -281,29 +295,39 @@ | moxie \ | mt \ | msp430 \ + | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ + | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ - | rx \ + | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ - | v850 | v850e \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) - # Motorola 68HC11/12. + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -313,6 +337,21 @@ basic_machine=mt-unknown ;; + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. @@ -327,25 +366,30 @@ # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ + | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | be32-* | be64-* \ | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -367,25 +411,29 @@ | mmix-* \ | mt-* \ | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ - | romp-* | rs6000-* | rx-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ | tron-* \ | ubicom32-* \ - | v850-* | v850e-* | vax-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) @@ -410,7 +458,7 @@ basic_machine=a29k-amd os=-udi ;; - abacus) + abacus) basic_machine=abacus-unknown ;; adobe68k) @@ -480,11 +528,20 @@ basic_machine=powerpc-ibm os=-cnk ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; c90) basic_machine=c90-cray os=-unicos ;; - cegcc) + cegcc) basic_machine=arm-unknown os=-cegcc ;; @@ -516,7 +573,7 @@ basic_machine=craynv-cray os=-unicosmp ;; - cr16) + cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; @@ -674,7 +731,6 @@ i370-ibm* | ibm*) basic_machine=i370-ibm ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 @@ -732,9 +788,13 @@ basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze*) basic_machine=microblaze-xilinx ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) basic_machine=i386-pc os=-mingw32 @@ -771,10 +831,18 @@ ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; + msys) + basic_machine=i386-pc + os=-msys + ;; mvs) basic_machine=i370-ibm os=-mvs ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 @@ -839,6 +907,12 @@ np1) basic_machine=np1-gould ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -921,9 +995,10 @@ ;; power) basic_machine=power-ibm ;; - ppc) basic_machine=powerpc-unknown + ppc | ppcbe) basic_machine=powerpc-unknown ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown @@ -948,7 +1023,11 @@ basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1017,6 +1096,9 @@ basic_machine=i860-stratus os=-sysv4 ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; sun2) basic_machine=m68000-sun ;; @@ -1073,20 +1155,8 @@ basic_machine=t90-cray os=-unicos ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; tile*) - basic_machine=tile-unknown + basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) @@ -1156,6 +1226,9 @@ xps | xps100) basic_machine=xps100-honeywell ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; ymp) basic_machine=ymp-cray os=-unicos @@ -1253,9 +1326,12 @@ if [ x"$os" != x"" ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases + # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; @@ -1277,21 +1353,22 @@ # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -kopensolaris* \ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ @@ -1338,7 +1415,7 @@ -opened*) os=-openedition ;; - -os400*) + -os400*) os=-os400 ;; -wince*) @@ -1387,7 +1464,7 @@ -sinix*) os=-sysv4 ;; - -tpf*) + -tpf*) os=-tpf ;; -triton*) @@ -1432,6 +1509,8 @@ -dicos*) os=-dicos ;; + -nacl*) + ;; -none) ;; *) @@ -1454,10 +1533,10 @@ # system, and we'll never get to this point. case $basic_machine in - score-*) + score-*) os=-elf ;; - spu-*) + spu-*) os=-elf ;; *-acorn) @@ -1469,8 +1548,20 @@ arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff + c4x-* | tic4x-*) + os=-coff + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff ;; # This must come before the *-dec entry. pdp10-*) @@ -1490,14 +1581,11 @@ ;; m68000-sun) os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 ;; m68*-cisco) os=-aout ;; - mep-*) + mep-*) os=-elf ;; mips*-cisco) @@ -1524,7 +1612,7 @@ *-ibm) os=-aix ;; - *-knuth) + *-knuth) os=-mmixware ;; *-wec) diff --git a/Modules/_ctypes/libffi/configure b/Modules/_ctypes/libffi/configure --- a/Modules/_ctypes/libffi/configure +++ b/Modules/_ctypes/libffi/configure @@ -1,13 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for libffi 3.0.10rc0. +# Generated by GNU Autoconf 2.69 for libffi 3.0.13. # -# Report bugs to . +# Report bugs to . # # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -91,6 +89,7 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -135,6 +134,31 @@ # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -168,11 +192,20 @@ else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes @@ -213,14 +246,25 @@ if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -231,8 +275,8 @@ $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf at gnu.org and -$0: http://gcc.gnu.org/bugs.html about your system, -$0: including any error possibly output before this +$0: http://github.com/atgreen/libffi/issues about your +$0: system, including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi @@ -319,10 +363,18 @@ test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -359,19 +411,19 @@ fi # as_fn_arith -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 - fi - $as_echo "$as_me: error: $1" >&2 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -444,6 +496,10 @@ chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -478,16 +534,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -499,28 +555,8 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -528,161 +564,14 @@ # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} -case X$lt_ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` - ;; -esac - -ECHO=${lt_ECHO-echo} -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<_LT_EOF -$* -_LT_EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$lt_ECHO"; then - if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if { echo_test_string=`eval $cmd`; } 2>/dev/null && - { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null - then - break - fi - done - fi - - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : - else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$ECHO" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - ECHO='print -r' - elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - ECHO='printf %s\n' - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - ECHO="$CONFIG_SHELL $0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - ECHO=echo - fi - fi - fi - fi - fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -lt_ECHO=$ECHO -if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then - lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" -fi - - - test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -701,9 +590,9 @@ # Identity of this package. PACKAGE_NAME='libffi' PACKAGE_TARNAME='libffi' -PACKAGE_VERSION='3.0.10rc0' -PACKAGE_STRING='libffi 3.0.10rc0' -PACKAGE_BUGREPORT='http://gcc.gnu.org/bugs.html' +PACKAGE_VERSION='3.0.13' +PACKAGE_STRING='libffi 3.0.13' +PACKAGE_BUGREPORT='http://github.com/atgreen/libffi/issues' PACKAGE_URL='' # Factoring default headers for most tests. @@ -748,10 +637,20 @@ LIBOBJS toolexeclibdir toolexecdir +FFI_DEBUG_FALSE +FFI_DEBUG_TRUE TARGETDIR TARGET +FFI_EXEC_TRAMPOLINE_TABLE +FFI_EXEC_TRAMPOLINE_TABLE_FALSE +FFI_EXEC_TRAMPOLINE_TABLE_TRUE +sys_symbol_underscore HAVE_LONG_DOUBLE ALLOCA +XTENSA_FALSE +XTENSA_TRUE +TILE_FALSE +TILE_TRUE PA64_HPUX_FALSE PA64_HPUX_TRUE PA_HPUX_FALSE @@ -774,6 +673,8 @@ AVR32_TRUE ARM_FALSE ARM_TRUE +AARCH64_FALSE +AARCH64_TRUE POWERPC_FREEBSD_FALSE POWERPC_FREEBSD_TRUE POWERPC_DARWIN_FALSE @@ -782,6 +683,12 @@ POWERPC_AIX_TRUE POWERPC_FALSE POWERPC_TRUE +MOXIE_FALSE +MOXIE_TRUE +METAG_FALSE +METAG_TRUE +MICROBLAZE_FALSE +MICROBLAZE_TRUE M68K_FALSE M68K_TRUE M32R_FALSE @@ -802,6 +709,8 @@ X86_TRUE SPARC_FALSE SPARC_TRUE +BFIN_FALSE +BFIN_TRUE MIPS_FALSE MIPS_TRUE AM_LTLDFLAGS @@ -811,15 +720,18 @@ MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE +PRTDIAG CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL -lt_ECHO +MANIFEST_TOOL RANLIB +ac_ct_AR AR +DLLTOOL OBJDUMP LN_S NM @@ -839,6 +751,7 @@ am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE +am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE @@ -875,6 +788,7 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM +ax_enable_builddir_sed target_os target_vendor target_cpu @@ -928,14 +842,19 @@ ac_subst_files='' ac_user_opts=' enable_option_checking +enable_builddir enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_gnu_ld +with_sysroot enable_libtool_lock +enable_portable_binary +with_gcc_arch enable_maintainer_mode +enable_pax_emutramp enable_debug enable_structs enable_raw_api @@ -1010,8 +929,9 @@ fi case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -1056,7 +976,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1082,7 +1002,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1286,7 +1206,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1302,7 +1222,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1332,8 +1252,8 @@ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information." + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) @@ -1341,7 +1261,7 @@ # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error "invalid variable name: \`$ac_envvar'" ;; + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1351,7 +1271,7 @@ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1359,13 +1279,13 @@ if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error "missing argument to $ac_option" + as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1388,7 +1308,7 @@ [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1402,8 +1322,6 @@ if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1418,9 +1336,9 @@ ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error "working directory cannot be determined" + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error "pwd does not report name of working directory" + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. @@ -1459,11 +1377,11 @@ fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1489,7 +1407,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libffi 3.0.10rc0 to adapt to many kinds of systems. +\`configure' configures libffi 3.0.13 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1503,7 +1421,7 @@ --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files @@ -1560,7 +1478,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libffi 3.0.10rc0:";; + short | recursive ) echo "Configuration of libffi 3.0.13:";; esac cat <<\_ACEOF @@ -1568,15 +1486,24 @@ --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors + --disable-builddir disable automatic build in subdir of sources + + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer + --enable-portable-binary + disable compiler optimizations that would produce + unportable binaries + --enable-maintainer-mode + enable make rules and dependencies not useful (and + sometimes confusing) to the casual installer + --enable-pax_emutramp enable pax emulated trampolines, for we can't use PROT_EXEC --enable-debug debugging mode --disable-structs omit code for struct support --disable-raw-api make the raw api unavailable @@ -1585,9 +1512,13 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pic try to use only PIC/non-PIC objects [default=use + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot=DIR Search for dependent libraries within DIR + (or the compiler's sysroot if not specified). + --with-gcc-arch= use architecture for gcc -march/-mtune, + instead of guessing Some influential environment variables: CC C compiler command @@ -1604,7 +1535,7 @@ Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to . +Report bugs to . _ACEOF ac_status=$? fi @@ -1667,10 +1598,10 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libffi configure 3.0.10rc0 -generated by GNU Autoconf 2.65 - -Copyright (C) 2009 Free Software Foundation, Inc. +libffi configure 3.0.13 +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1714,7 +1645,7 @@ ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1746,7 +1677,7 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -1760,7 +1691,7 @@ # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1774,7 +1705,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1792,7 +1723,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -1817,7 +1748,7 @@ mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } >/dev/null && { + test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : @@ -1828,7 +1759,7 @@ ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1870,7 +1801,7 @@ ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1883,7 +1814,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1938,10 +1869,193 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid; break +else + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=$ac_mid; break +else + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid +else + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + echo >>conftest.val; read $3 &5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1989,7 +2103,7 @@ else ac_header_preproc=no fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } @@ -2012,17 +2126,15 @@ $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( cat <<\_ASBOX -## ------------------------------------------- ## -## Report this to http://gcc.gnu.org/bugs.html ## -## ------------------------------------------- ## -_ASBOX +( $as_echo "## ------------------------------------------------------ ## +## Report this to http://github.com/atgreen/libffi/issues ## +## ------------------------------------------------------ ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -2031,193 +2143,69 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel -# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES -# -------------------------------------------- -# Tries to find the compile-time value of EXPR in a program that includes -# INCLUDES, setting VAR accordingly. Returns whether the value could be -# computed -ac_fn_c_compute_int () +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { -static int test_array [1 - 2 * !(($2) >= 0)]; -test_array [0] = 0 - +if (sizeof ($2)) + return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=0 ac_mid=0 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 - +if (sizeof (($2))) + return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid; break -else - as_fn_arith $ac_mid + 1 && ac_lo=$as_val - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val + +else + eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=-1 ac_mid=-1 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=$ac_mid; break -else - as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - ac_lo= ac_hi= -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid -else - as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in #(( -?*) eval "$3=\$ac_lo"; ac_retval=0 ;; -'') ac_retval=1 ;; -esac - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (($2) < 0) - { - long int i = longval (); - if (i != ($2)) - return 1; - fprintf (f, "%ld", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ($2)) - return 1; - fprintf (f, "%lu", i); - } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - echo >>conftest.val; read $3 &5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libffi $as_me 3.0.10rc0, which was -generated by GNU Autoconf 2.65. Invocation command line was +It was created by libffi $as_me 3.0.13, which was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2327,11 +2315,9 @@ { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( @@ -2365,11 +2351,9 @@ ) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do @@ -2382,11 +2366,9 @@ echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## -## ------------------- ## -_ASBOX +## ------------------- ##" echo for ac_var in $ac_subst_files do @@ -2400,11 +2382,9 @@ fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo cat confdefs.h echo @@ -2459,7 +2439,12 @@ ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site @@ -2474,7 +2459,11 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -2550,7 +2539,7 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2568,16 +2557,22 @@ ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - for ac_t in install-sh install.sh shtool; do - if test -f "$ac_dir/$ac_t"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/$ac_t -c" - break 2 - fi - done + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi done if test -z "$ac_aux_dir"; then - as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -2591,27 +2586,27 @@ # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; then : +if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && - as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -2629,14 +2624,14 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; then : +if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi @@ -2644,7 +2639,7 @@ $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -2662,14 +2657,14 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } -if test "${ac_cv_target+set}" = set; then : +if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi @@ -2677,7 +2672,7 @@ $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; -*) as_fn_error "invalid value of canonical target" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' @@ -2704,7 +2699,111 @@ . ${srcdir}/configure.host -am__api_version='1.11' + + # [$]@ is unsable in 2.60+ but earlier autoconf had no ac_configure_args + if test "${ac_configure_args+set}" != "set" ; then + ac_configure_args= + for ac_arg in ${1+"$@"}; do + ac_configure_args="$ac_configure_args '$ac_arg'" + done + fi + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + + +ax_enable_builddir="." +# Check whether --enable-builddir was given. +if test "${enable_builddir+set}" = set; then : + enableval=$enable_builddir; ax_enable_builddir="$enableval" +else + ax_enable_builddir="auto" +fi + +if test ".$ac_srcdir_defaulted" != ".no" ; then +if test ".$srcdir" = ".." ; then + if test -f config.status ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: toplevel srcdir already configured... skipping subdir build" >&5 +$as_echo "$as_me: toplevel srcdir already configured... skipping subdir build" >&6;} + else + test ".$ax_enable_builddir" = "." && ax_enable_builddir="." + test ".$ax_enable_builddir" = ".no" && ax_enable_builddir="." + test ".$TARGET" = "." && TARGET="$target" + test ".$ax_enable_builddir" = ".auto" && ax_enable_builddir="$TARGET" + if test ".$ax_enable_builddir" != ".." ; then # we know where to go and + as_dir=$ax_enable_builddir; as_fn_mkdir_p + echo __.$ax_enable_builddir.__ > $ax_enable_builddir/conftest.tmp + cd $ax_enable_builddir + if grep __.$ax_enable_builddir.__ conftest.tmp >/dev/null 2>/dev/null ; then + rm conftest.tmp + { $as_echo "$as_me:${as_lineno-$LINENO}: result: continue configure in default builddir \"./$ax_enable_builddir\"" >&5 +$as_echo "continue configure in default builddir \"./$ax_enable_builddir\"" >&6; } + else + as_fn_error $? "could not change to default builddir \"./$ax_enable_builddir\"" "$LINENO" 5 + fi + srcdir=`echo "$ax_enable_builddir" | + sed -e 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g;s,[/]$,,;'` + # going to restart from subdirectory location + test -f $srcdir/config.log && mv $srcdir/config.log . + test -f $srcdir/confdefs.h && mv $srcdir/confdefs.h . + test -f $srcdir/conftest.log && mv $srcdir/conftest.log . + test -f $srcdir/$cache_file && mv $srcdir/$cache_file . + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ....exec $SHELL $srcdir/$0 \"--srcdir=$srcdir\" \"--enable-builddir=$ax_enable_builddir\" ${1+\"$@\"}" >&5 +$as_echo "....exec $SHELL $srcdir/$0 \"--srcdir=$srcdir\" \"--enable-builddir=$ax_enable_builddir\" ${1+\"$@\"}" >&6; } + case "$0" in # restart + /\\*) eval $SHELL "'$0'" "'--srcdir=$srcdir'" "'--enable-builddir=$ax_enable_builddir'" $ac_configure_args ;; + *) eval $SHELL "'$srcdir/$0'" "'--srcdir=$srcdir'" "'--enable-builddir=$ax_enable_builddir'" $ac_configure_args ;; + esac ; exit $? + fi + fi +fi fi +test ".$ax_enable_builddir" = ".auto" && ax_enable_builddir="." +# Extract the first word of "gsed sed", so it can be a program name with args. +set dummy gsed sed; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ax_enable_builddir_sed+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ax_enable_builddir_sed in + [\\/]* | ?:[\\/]*) + ac_cv_path_ax_enable_builddir_sed="$ax_enable_builddir_sed" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ax_enable_builddir_sed="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_ax_enable_builddir_sed" && ac_cv_path_ax_enable_builddir_sed="sed" + ;; +esac +fi +ax_enable_builddir_sed=$ac_cv_path_ax_enable_builddir_sed +if test -n "$ax_enable_builddir_sed"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_enable_builddir_sed" >&5 +$as_echo "$ax_enable_builddir_sed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +ax_enable_builddir_auxdir="$am_aux_dir" +ac_config_commands="$ac_config_commands buildir" + + +am__api_version='1.12' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -2723,7 +2822,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then : +if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2743,7 +2842,7 @@ # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2801,56 +2900,71 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error "unsafe absolute working directory name" "$LINENO" 5;; + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; -esac - -# Do `set' in a subshell so we don't clobber the current shell's + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error "ls -t appears to fail. Make sure there is not a broken -alias in your environment" "$LINENO" 5 - fi - + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done test "$2" = conftest.file ) then # Ok. : else - as_fn_error "newly created file is older than distributed files! + as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. @@ -2861,9 +2975,6 @@ ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) @@ -2877,8 +2988,8 @@ am_missing_run="$MISSING --run " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then @@ -2890,17 +3001,17 @@ esac fi -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. +# will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then : +if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -2912,7 +3023,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2940,7 +3051,7 @@ set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -2952,7 +3063,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2993,7 +3104,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if test "${ac_cv_path_mkdir+set}" = set; then : + if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3003,7 +3114,7 @@ test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ @@ -3032,19 +3143,13 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } -mkdir_p="$MKDIR_P" -case $mkdir_p in - [\\/$]* | ?:[\\/]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac - for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then : +if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -3056,7 +3161,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3084,7 +3189,7 @@ $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -3092,7 +3197,7 @@ all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; @@ -3126,7 +3231,7 @@ am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then - as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi @@ -3142,7 +3247,7 @@ # Define the identity of the package. PACKAGE='libffi' - VERSION='3.0.10rc0' + VERSION='3.0.13' cat >>confdefs.h <<_ACEOF @@ -3170,13 +3275,19 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + # We need awk for the "check" target. The system "awk" is bad on # some platforms. -# Always define AMTAR for backward compatibility. - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' @@ -3187,9 +3298,12 @@ # We must force CC to /not/ be precious variables; otherwise # the wrong, non-multilib-adjusted value will be used in multilibs. # As a side effect, we have to subst CFLAGS ourselves. - - - +# Also save and restore CFLAGS, since AC_PROG_CC will come up with +# defaults of its own if none are provided. + + + +save_CFLAGS=$CFLAGS ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3200,7 +3314,7 @@ set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3212,7 +3326,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3240,7 +3354,7 @@ set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3252,7 +3366,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3293,7 +3407,7 @@ set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3305,7 +3419,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3333,7 +3447,7 @@ set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3346,7 +3460,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -3392,7 +3506,7 @@ set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3404,7 +3518,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3436,7 +3550,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3448,7 +3562,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3490,8 +3604,8 @@ test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3605,9 +3719,8 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3649,8 +3762,8 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3707,9 +3820,9 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. +as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi @@ -3720,7 +3833,7 @@ ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3760,8 +3873,8 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3771,7 +3884,7 @@ ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3808,7 +3921,7 @@ ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3886,7 +3999,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -3895,8 +4008,7 @@ /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -3999,7 +4111,7 @@ _am_result=none # First try GNU make style include. echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. +# Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include @@ -4032,6 +4144,7 @@ if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' + am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= @@ -4047,15 +4160,16 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : +if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -4089,16 +4203,16 @@ : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -4107,16 +4221,16 @@ test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -4170,6 +4284,7 @@ fi +CFLAGS=$save_CFLAGS @@ -4186,15 +4301,16 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CCAS_dependencies_compiler_type+set}" = set; then : +if ${am_cv_CCAS_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -4226,16 +4342,16 @@ : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -4244,16 +4360,16 @@ test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -4316,7 +4432,7 @@ fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4441,8 +4557,8 @@ -macro_version='2.2.6' -macro_revision='1.3012' +macro_version='2.4.2' +macro_revision='1.3337' @@ -4458,9 +4574,78 @@ ltmain="$ac_aux_dir/ltmain.sh" +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case "$ECHO" in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } -if test "${ac_cv_path_SED+set}" = set; then : +if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ @@ -4480,7 +4665,7 @@ for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue + as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in @@ -4515,7 +4700,7 @@ done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then - as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5 + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED @@ -4542,7 +4727,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -4556,7 +4741,7 @@ for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -4591,7 +4776,7 @@ done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then - as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP @@ -4605,7 +4790,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -4622,7 +4807,7 @@ for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -4657,7 +4842,7 @@ done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP @@ -4672,7 +4857,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } -if test "${ac_cv_path_FGREP+set}" = set; then : +if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 @@ -4689,7 +4874,7 @@ for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue + as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in @@ -4724,7 +4909,7 @@ done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then - as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP @@ -4803,7 +4988,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi -if test "${lt_cv_path_LD+set}" = set; then : +if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then @@ -4840,10 +5025,10 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then : +if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. @@ -4870,7 +5055,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if test "${lt_cv_path_NM+set}" = set; then : +if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then @@ -4923,14 +5108,17 @@ NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$ac_tool_prefix"; then - for ac_prog in "dumpbin -symbols" "link -dump -symbols" + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_DUMPBIN+set}" = set; then : +if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then @@ -4942,7 +5130,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4968,13 +5156,13 @@ fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in "dumpbin -symbols" "link -dump -symbols" + for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then : +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then @@ -4986,7 +5174,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5023,6 +5211,15 @@ fi fi + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" @@ -5037,18 +5234,18 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } -if test "${lt_cv_nm_interface+set}" = set; then : +if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:5045: $ac_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:5048: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:5051: output\"" >&5) + (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5072,7 +5269,7 @@ # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } -if test "${lt_cv_sys_max_cmd_len+set}" = set; then : +if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 @@ -5105,6 +5302,11 @@ lt_cv_sys_max_cmd_len=8192; ;; + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. @@ -5130,6 +5332,11 @@ lt_cv_sys_max_cmd_len=196608 ;; + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not @@ -5156,7 +5363,8 @@ ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -5169,8 +5377,8 @@ # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ - = "XX$teststring$teststring"; } >/dev/null 2>&1 && + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` @@ -5212,8 +5420,8 @@ # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes @@ -5262,9 +5470,83 @@ +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } -if test "${lt_cv_ld_reload_flag+set}" = set; then : +if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' @@ -5278,6 +5560,11 @@ esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' @@ -5300,7 +5587,7 @@ set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OBJDUMP+set}" = set; then : +if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then @@ -5312,7 +5599,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5340,7 +5627,7 @@ set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then @@ -5352,7 +5639,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5399,7 +5686,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } -if test "${lt_cv_deplibs_check_method+set}" = set; then : +if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' @@ -5441,16 +5728,18 @@ # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -cegcc) +cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' @@ -5480,6 +5769,10 @@ lt_cv_deplibs_check_method=pass_all ;; +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in @@ -5488,11 +5781,11 @@ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac @@ -5513,8 +5806,8 @@ lt_cv_deplibs_check_method=pass_all ;; -# This must be Linux ELF. -linux* | k*bsd*-gnu) +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; @@ -5595,6 +5888,21 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -5610,16 +5918,26 @@ + + + + + + + + + + if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AR+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5627,8 +5945,8 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="${ac_tool_prefix}ar" + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5638,10 +5956,10 @@ fi fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -5649,17 +5967,17 @@ fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5667,8 +5985,8 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AR="ar" + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5678,17 +5996,17 @@ fi fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_AR" = x; then - AR="false" + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) @@ -5696,18 +6014,226 @@ $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac AR=$ac_ct_AR fi -else - AR="$ac_cv_prog_AR" -fi - -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru - - - - +fi + +: ${AR=ar} +: ${AR_FLAGS=cru} + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi @@ -5720,7 +6246,7 @@ set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then : +if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -5732,7 +6258,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5760,7 +6286,7 @@ set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -5772,7 +6298,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5819,7 +6345,7 @@ set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then : +if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -5831,7 +6357,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5859,7 +6385,7 @@ set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -5871,7 +6397,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5921,14 +6447,26 @@ if test -n "$RANLIB"; then case $host_os in openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + @@ -5976,7 +6514,7 @@ # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then : +if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else @@ -6037,8 +6575,8 @@ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= @@ -6062,6 +6600,7 @@ # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ @@ -6074,6 +6613,7 @@ else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no @@ -6099,8 +6639,8 @@ test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then @@ -6115,6 +6655,18 @@ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + #ifdef __cplusplus extern "C" { #endif @@ -6126,7 +6678,7 @@ cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ -const struct { +LT_DLSYM_CONST struct { const char *name; void *address; } @@ -6152,8 +6704,8 @@ _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 @@ -6163,8 +6715,8 @@ test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi @@ -6201,23 +6753,71 @@ $as_echo "ok" >&6; } fi - - - - - - - - - - - - - - - - - +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi + + +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } @@ -6254,7 +6854,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 6257 "configure"' > conftest.$ac_ext + echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6305,7 +6905,14 @@ LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -6348,7 +6955,7 @@ CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if test "${lt_cv_cc_needs_belf+set}" = set; then : +if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c @@ -6389,7 +6996,7 @@ CFLAGS="$SAVE_CFLAGS" fi ;; -sparc*-*solaris*) +*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 @@ -6400,7 +7007,20 @@ case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" @@ -6416,6 +7036,123 @@ need_locks="$enable_libtool_lock" +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi + + + + + case $host_os in rhapsody* | darwin*) @@ -6424,7 +7161,7 @@ set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_DSYMUTIL+set}" = set; then : +if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then @@ -6436,7 +7173,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6464,7 +7201,7 @@ set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then : +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then @@ -6476,7 +7213,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6516,7 +7253,7 @@ set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_NMEDIT+set}" = set; then : +if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then @@ -6528,7 +7265,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6556,7 +7293,7 @@ set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then : +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then @@ -6568,7 +7305,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6608,7 +7345,7 @@ set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_LIPO+set}" = set; then : +if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then @@ -6620,7 +7357,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6648,7 +7385,7 @@ set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then : +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then @@ -6660,7 +7397,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6700,7 +7437,7 @@ set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OTOOL+set}" = set; then : +if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then @@ -6712,7 +7449,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6740,7 +7477,7 @@ set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then : +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then @@ -6752,7 +7489,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6792,7 +7529,7 @@ set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OTOOL64+set}" = set; then : +if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then @@ -6804,7 +7541,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6832,7 +7569,7 @@ set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then : +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then @@ -6844,7 +7581,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6907,7 +7644,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } -if test "${lt_cv_apple_cc_single_mod+set}" = set; then : +if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no @@ -6923,7 +7660,13 @@ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 @@ -6934,9 +7677,10 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if test "${lt_cv_ld_exported_symbols_list+set}" = set; then : +if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no @@ -6966,6 +7710,41 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; @@ -6993,7 +7772,7 @@ else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - if test "$DSYMUTIL" != ":"; then + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= @@ -7013,7 +7792,7 @@ CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -7043,7 +7822,7 @@ # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -7059,11 +7838,11 @@ ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext +rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi @@ -7102,7 +7881,7 @@ # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -7118,18 +7897,18 @@ ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext +rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -7141,7 +7920,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7258,8 +8037,7 @@ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -7273,7 +8051,7 @@ do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " -if test "x$ac_cv_header_dlfcn_h" = x""yes; then : +if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF @@ -7284,6 +8062,8 @@ + + # Set options @@ -7359,7 +8139,22 @@ # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : - withval=$with_pic; pic_mode="$withval" + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac else pic_mode=default fi @@ -7436,6 +8231,11 @@ + + + + + test -z "$LN_S" && LN_S="ln -s" @@ -7457,7 +8257,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } -if test "${lt_cv_objdir+set}" = set; then : +if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null @@ -7485,19 +8285,6 @@ - - - - - - - - - - - - - case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some @@ -7510,23 +8297,6 @@ ;; esac -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - # Global variables: ofile=libtool can_build_shared=yes @@ -7555,7 +8325,7 @@ *) break;; esac done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it @@ -7565,7 +8335,7 @@ if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : +if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in @@ -7631,7 +8401,7 @@ if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : +if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in @@ -7764,11 +8534,16 @@ lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then : +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no @@ -7784,15 +8559,15 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7787: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7791: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes @@ -7821,8 +8596,6 @@ lt_prog_compiler_pic= lt_prog_compiler_static= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' @@ -7870,6 +8643,12 @@ lt_prog_compiler_pic='-fno-common' ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag @@ -7912,6 +8691,15 @@ lt_prog_compiler_pic='-fPIC' ;; esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in @@ -7953,7 +8741,7 @@ lt_prog_compiler_static='-non_shared' ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -7974,7 +8762,13 @@ lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; - pgcc* | pgf77* | pgf90* | pgf95*) + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -7986,25 +8780,40 @@ # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; - xl*) - # IBM XL C 8.0/Fortran 10.1 on PPC + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' ;; esac ;; @@ -8036,7 +8845,7 @@ lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in - f77* | f90* | f95*) + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; @@ -8093,13 +8902,17 @@ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 -$as_echo "$lt_prog_compiler_pic" >&6; } - - - - - + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. @@ -8107,7 +8920,7 @@ if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if test "${lt_cv_prog_compiler_pic_works+set}" = set; then : +if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no @@ -8123,15 +8936,15 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8126: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8130: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes @@ -8160,13 +8973,18 @@ + + + + + # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if test "${lt_cv_prog_compiler_static_works+set}" = set; then : +if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no @@ -8179,7 +8997,7 @@ if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes @@ -8209,7 +9027,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o+set}" = set; then : +if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no @@ -8228,16 +9046,16 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8231: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8235: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes @@ -8264,7 +9082,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o+set}" = set; then : +if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no @@ -8283,16 +9101,16 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8286: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8290: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes @@ -8358,7 +9176,6 @@ hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported @@ -8405,7 +9222,33 @@ esac ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' @@ -8423,6 +9266,7 @@ fi supports_anon_versioning=no case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... @@ -8438,11 +9282,12 @@ ld_shlibs=no cat <<_LT_EOF 1>&2 -*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. _LT_EOF fi @@ -8478,10 +9323,12 @@ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -8499,6 +9346,11 @@ fi ;; + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no @@ -8514,7 +9366,7 @@ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - gnu* | linux* | tpf* | k*bsd*-gnu) + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in @@ -8524,15 +9376,16 @@ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then - tmp_addflag= + tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -8543,13 +9396,17 @@ lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; - xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 @@ -8565,17 +9422,16 @@ fi case $cc_basename in - xlf*) + xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld='-rpath $libdir' - archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac @@ -8589,8 +9445,8 @@ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; @@ -8608,8 +9464,8 @@ _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi @@ -8655,8 +9511,8 @@ *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi @@ -8696,8 +9552,10 @@ else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi @@ -8784,7 +9642,13 @@ allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -8797,25 +9661,32 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' @@ -8824,7 +9695,13 @@ else # Determine the default libpath from the value encoded in an # empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -8837,30 +9714,42 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' @@ -8892,20 +9781,64 @@ # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac ;; darwin* | rhapsody*) @@ -8915,7 +9848,12 @@ hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='' + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in @@ -8923,7 +9861,7 @@ *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=echo + output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" @@ -8941,10 +9879,6 @@ hardcode_shlibpath_var=no ;; - freebsd1*) - ld_shlibs=no - ;; - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little @@ -8957,7 +9891,7 @@ ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) + freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes @@ -8966,7 +9900,7 @@ # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no @@ -8974,7 +9908,7 @@ hpux9*) if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi @@ -8989,14 +9923,13 @@ ;; hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes @@ -9008,16 +9941,16 @@ ;; hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then + if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else @@ -9029,7 +9962,46 @@ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + ;; esac fi @@ -9057,26 +10029,39 @@ irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo(void) {} + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' @@ -9138,17 +10123,17 @@ hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' @@ -9158,13 +10143,13 @@ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -9177,9 +10162,9 @@ no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' - archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) @@ -9367,44 +10352,50 @@ # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 -$as_echo "$archive_cmds_need_lc" >&6; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi @@ -9562,11 +10553,6 @@ - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } @@ -9575,16 +10561,23 @@ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` - else - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= @@ -9597,7 +10590,7 @@ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done - lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; @@ -9617,7 +10610,13 @@ if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` - sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([A-Za-z]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi @@ -9643,7 +10642,7 @@ case $host_os in aix3*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH @@ -9652,7 +10651,7 @@ ;; aix[4-9]*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes @@ -9705,7 +10704,7 @@ m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; @@ -9717,7 +10716,7 @@ ;; bsdi[45]*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' @@ -9736,8 +10735,9 @@ need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + case $GCC,$cc_basename in + yes,*) + # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ @@ -9758,36 +10758,83 @@ cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' ;; *) + # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' + dynamic_linker='Win32 ld.exe' + ;; + esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -9808,7 +10855,7 @@ ;; dgux*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' @@ -9816,10 +10863,6 @@ shlibpath_var=LD_LIBRARY_PATH ;; -freebsd1*) - dynamic_linker=no - ;; - freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. @@ -9827,7 +10870,7 @@ objformat=`/usr/bin/objformat` else case $host_os in - freebsd[123]*) objformat=aout ;; + freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi @@ -9845,7 +10888,7 @@ esac shlibpath_var=LD_LIBRARY_PATH case $host_os in - freebsd2*) + freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) @@ -9865,12 +10908,26 @@ ;; gnu*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; @@ -9916,12 +10973,14 @@ soname_spec='${libname}${release}${shared_ext}$major' ;; esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 ;; interix[3-9]*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' @@ -9937,7 +10996,7 @@ nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; @@ -9974,9 +11033,9 @@ dynamic_linker=no ;; -# This must be Linux ELF. -linux* | k*bsd*-gnu) - version_type=linux +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -9984,12 +11043,17 @@ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -10002,13 +11066,17 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - shlibpath_overrides_runpath=yes + lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install @@ -10020,8 +11088,9 @@ # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -10052,7 +11121,7 @@ ;; newsos6) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -10121,7 +11190,7 @@ ;; solaris*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -10146,7 +11215,7 @@ ;; sysv4 | sysv4.3*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH @@ -10170,7 +11239,7 @@ sysv4*MP*) if test -d /usr/nec ;then - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH @@ -10201,7 +11270,7 @@ tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -10211,7 +11280,7 @@ ;; uts4*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH @@ -10323,6 +11392,11 @@ + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= @@ -10395,7 +11469,7 @@ # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10429,7 +11503,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else @@ -10443,12 +11517,12 @@ *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = x""yes; then : +if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } -if test "${ac_cv_lib_dld_shl_load+set}" = set; then : +if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10482,16 +11556,16 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = x""yes; then : +if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10525,12 +11599,12 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } -if test "${ac_cv_lib_svld_dlopen+set}" = set; then : +if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10564,12 +11638,12 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = x""yes; then : +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } -if test "${ac_cv_lib_dld_dld_link+set}" = set; then : +if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10603,7 +11677,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = x""yes; then : +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi @@ -10644,7 +11718,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } -if test "${lt_cv_dlopen_self+set}" = set; then : +if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10653,7 +11727,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10656 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10694,7 +11768,13 @@ # endif #endif -void fnord() { int i=42;} +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -10703,7 +11783,11 @@ if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } /* dlclose (self); */ } else @@ -10740,7 +11824,7 @@ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if test "${lt_cv_dlopen_self_static+set}" = set; then : +if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10749,7 +11833,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10752 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10790,7 +11874,13 @@ # endif #endif -void fnord() { int i=42;} +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -10799,7 +11889,11 @@ if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } /* dlclose (self); */ } else @@ -10968,6 +12062,8 @@ + + ac_config_commands="$ac_config_commands libtool" @@ -10978,6 +12074,1021 @@ +# Test for 64-bit build. +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 +$as_echo_n "checking size of size_t... " >&6; } +if ${ac_cv_sizeof_size_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_size_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (size_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_size_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5 +$as_echo "$ac_cv_sizeof_size_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t +_ACEOF + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler vendor" >&5 +$as_echo_n "checking for C compiler vendor... " >&6; } +if ${ax_cv_c_compiler_vendor+:} false; then : + $as_echo_n "(cached) " >&6 +else + # note: don't check for gcc first since some other compilers define __GNUC__ + vendors="intel: __ICC,__ECC,__INTEL_COMPILER + ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__ + pathscale: __PATHCC__,__PATHSCALE__ + clang: __clang__ + gnu: __GNUC__ + sun: __SUNPRO_C,__SUNPRO_CC + hp: __HP_cc,__HP_aCC + dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER + borland: __BORLANDC__,__TURBOC__ + comeau: __COMO__ + cray: _CRAYC + kai: __KCC + lcc: __LCC__ + sgi: __sgi,sgi + microsoft: _MSC_VER + metrowerks: __MWERKS__ + watcom: __WATCOMC__ + portland: __PGI + unknown: UNKNOWN" + for ventest in $vendors; do + case $ventest in + *:) vendor=$ventest; continue ;; + *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + #if !($vencpp) + thisisanerror; + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done + ax_cv_c_compiler_vendor=`echo $vendor | cut -d: -f1` + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_c_compiler_vendor" >&5 +$as_echo "$ax_cv_c_compiler_vendor" >&6; } + + + + + + +# Check whether --enable-portable-binary was given. +if test "${enable_portable_binary+set}" = set; then : + enableval=$enable_portable_binary; acx_maxopt_portable=$enableval +else + acx_maxopt_portable=no +fi + + +# Try to determine "good" native compiler flags if none specified via CFLAGS +if test "$ac_test_CFLAGS" != "set"; then + CFLAGS="" + case $ax_cv_c_compiler_vendor in + dec) CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host" + if test "x$acx_maxopt_portable" = xno; then + CFLAGS="$CFLAGS -arch host" + fi;; + + sun) CFLAGS="-native -fast -xO5 -dalign" + if test "x$acx_maxopt_portable" = xyes; then + CFLAGS="$CFLAGS -xarch=generic" + fi;; + + hp) CFLAGS="+Oall +Optrs_ansi +DSnative" + if test "x$acx_maxopt_portable" = xyes; then + CFLAGS="$CFLAGS +DAportable" + fi;; + + ibm) if test "x$acx_maxopt_portable" = xno; then + xlc_opt="-qarch=auto -qtune=auto" + else + xlc_opt="-qtune=auto" + fi + as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$xlc_opt" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $xlc_opt" >&5 +$as_echo_n "checking whether C compiler accepts $xlc_opt... " >&6; } +if eval \${$as_CACHEVAR+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS $xlc_opt" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_CACHEVAR=yes" +else + eval "$as_CACHEVAR=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +eval ac_res=\$$as_CACHEVAR + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : + CFLAGS="-O3 -qansialias -w $xlc_opt" +else + CFLAGS="-O3 -qansialias -w" + echo "******************************************************" + echo "* You seem to have the IBM C compiler. It is *" + echo "* recommended for best performance that you use: *" + echo "* *" + echo "* CFLAGS=-O3 -qarch=xxx -qtune=xxx -qansialias -w *" + echo "* ^^^ ^^^ *" + echo "* where xxx is pwr2, pwr3, 604, or whatever kind of *" + echo "* CPU you have. (Set the CFLAGS environment var. *" + echo "* and re-run configure.) For more info, man cc. *" + echo "******************************************************" +fi + + ;; + + intel) CFLAGS="-O3 -ansi_alias" + if test "x$acx_maxopt_portable" = xno; then + icc_archflag=unknown + icc_flags="" + case $host_cpu in + i686*|x86_64*) + # icc accepts gcc assembly syntax, so these should work: + +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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 0 output" >&5 +$as_echo_n "checking for x86 cpuid 0 output... " >&6; } +if ${ax_cv_gcc_x86_cpuid_0+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_gcc_x86_cpuid_0=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + int op = 0, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_gcc_x86_cpuid_0=`cat conftest_cpuid`; rm -f conftest_cpuid +else + ax_cv_gcc_x86_cpuid_0=unknown; rm -f conftest_cpuid +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_x86_cpuid_0" >&5 +$as_echo "$ax_cv_gcc_x86_cpuid_0" >&6; } +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 + + + +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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 1 output" >&5 +$as_echo_n "checking for x86 cpuid 1 output... " >&6; } +if ${ax_cv_gcc_x86_cpuid_1+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_gcc_x86_cpuid_1=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + int op = 1, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_gcc_x86_cpuid_1=`cat conftest_cpuid`; rm -f conftest_cpuid +else + ax_cv_gcc_x86_cpuid_1=unknown; rm -f conftest_cpuid +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_x86_cpuid_1" >&5 +$as_echo "$ax_cv_gcc_x86_cpuid_1" >&6; } +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 + + + case $ax_cv_gcc_x86_cpuid_0 in # see AX_GCC_ARCHFLAG + *:756e6547:*:*) # Intel + case $ax_cv_gcc_x86_cpuid_1 in + *6a?:*[234]:*:*|*6[789b]?:*:*:*) icc_flags="-xK";; + *f3[347]:*:*:*|*f41347:*:*:*) icc_flags="-xP -xN -xW -xK";; + *f??:*:*:*) icc_flags="-xN -xW -xK";; + esac ;; + esac ;; + esac + if test "x$icc_flags" != x; then + for flag in $icc_flags; do + as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$flag" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 +$as_echo_n "checking whether C compiler accepts $flag... " >&6; } +if eval \${$as_CACHEVAR+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS $flag" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_CACHEVAR=yes" +else + eval "$as_CACHEVAR=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +eval ac_res=\$$as_CACHEVAR + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : + icc_archflag=$flag; break +else + : +fi + + done + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for icc architecture flag" >&5 +$as_echo_n "checking for icc architecture flag... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $icc_archflag" >&5 +$as_echo "$icc_archflag" >&6; } + if test "x$icc_archflag" != xunknown; then + CFLAGS="$CFLAGS $icc_archflag" + fi + fi + ;; + + gnu) + # default optimization flags for gcc on all systems + CFLAGS="-O3 -fomit-frame-pointer" + + # -malign-double for x86 systems + # LIBFFI -- DON'T DO THIS - CHANGES ABI + # AX_CHECK_COMPILE_FLAG(-malign-double, CFLAGS="$CFLAGS -malign-double") + + # -fstrict-aliasing for gcc-2.95+ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstrict-aliasing" >&5 +$as_echo_n "checking whether C compiler accepts -fstrict-aliasing... " >&6; } +if ${ax_cv_check_cflags___fstrict_aliasing+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -fstrict-aliasing" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ax_cv_check_cflags___fstrict_aliasing=yes +else + ax_cv_check_cflags___fstrict_aliasing=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fstrict_aliasing" >&5 +$as_echo "$ax_cv_check_cflags___fstrict_aliasing" >&6; } +if test x"$ax_cv_check_cflags___fstrict_aliasing" = xyes; then : + CFLAGS="$CFLAGS -fstrict-aliasing" +else + : +fi + + + # note that we enable "unsafe" fp optimization with other compilers, too + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -ffast-math" >&5 +$as_echo_n "checking whether C compiler accepts -ffast-math... " >&6; } +if ${ax_cv_check_cflags___ffast_math+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -ffast-math" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ax_cv_check_cflags___ffast_math=yes +else + ax_cv_check_cflags___ffast_math=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___ffast_math" >&5 +$as_echo "$ax_cv_check_cflags___ffast_math" >&6; } +if test x"$ax_cv_check_cflags___ffast_math" = xyes; then : + CFLAGS="$CFLAGS -ffast-math" +else + : +fi + + + + + + +# Check whether --with-gcc-arch was given. +if test "${with_gcc_arch+set}" = set; then : + withval=$with_gcc_arch; ax_gcc_arch=$withval +else + ax_gcc_arch=yes +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc architecture flag" >&5 +$as_echo_n "checking for gcc architecture flag... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } +if ${ax_cv_gcc_archflag+:} false; then : + $as_echo_n "(cached) " >&6 +else + +ax_cv_gcc_archflag="unknown" + +if test "$GCC" = yes; then + +if test "x$ax_gcc_arch" = xyes; then +ax_gcc_arch="" +if test "$cross_compiling" = no; then +case $host_cpu in + i[3456]86*|x86_64*) # use cpuid codes + +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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 0 output" >&5 +$as_echo_n "checking for x86 cpuid 0 output... " >&6; } +if ${ax_cv_gcc_x86_cpuid_0+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_gcc_x86_cpuid_0=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + int op = 0, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_gcc_x86_cpuid_0=`cat conftest_cpuid`; rm -f conftest_cpuid +else + ax_cv_gcc_x86_cpuid_0=unknown; rm -f conftest_cpuid +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_x86_cpuid_0" >&5 +$as_echo "$ax_cv_gcc_x86_cpuid_0" >&6; } +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 + + + +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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 1 output" >&5 +$as_echo_n "checking for x86 cpuid 1 output... " >&6; } +if ${ax_cv_gcc_x86_cpuid_1+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_gcc_x86_cpuid_1=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + int op = 1, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_gcc_x86_cpuid_1=`cat conftest_cpuid`; rm -f conftest_cpuid +else + ax_cv_gcc_x86_cpuid_1=unknown; rm -f conftest_cpuid +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_x86_cpuid_1" >&5 +$as_echo "$ax_cv_gcc_x86_cpuid_1" >&6; } +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 + + + case $ax_cv_gcc_x86_cpuid_0 in + *:756e6547:*:*) # Intel + case $ax_cv_gcc_x86_cpuid_1 in + *5[48]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;; + *5??:*:*:*) ax_gcc_arch=pentium ;; + *0?6[3456]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *0?6a?:*[01]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *0?6a?:*[234]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *0?6[9de]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; + *0?6[78b]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *0?6f?:*:*:*|*1?66?:*:*:*) ax_gcc_arch="core2 pentium-m pentium3 pentiumpro" ;; + *1?6[7d]?:*:*:*) ax_gcc_arch="penryn core2 pentium-m pentium3 pentiumpro" ;; + *1?6[aef]?:*:*:*|*2?6[5cef]?:*:*:*) ax_gcc_arch="corei7 core2 pentium-m pentium3 pentiumpro" ;; + *1?6c?:*:*:*|*[23]?66?:*:*:*) ax_gcc_arch="atom core2 pentium-m pentium3 pentiumpro" ;; + *2?6[ad]?:*:*:*) ax_gcc_arch="corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;; + *0?6??:*:*:*) ax_gcc_arch=pentiumpro ;; + *6??:*:*:*) ax_gcc_arch="core2 pentiumpro" ;; + ?000?f3[347]:*:*:*|?000?f41347:*:*:*|?000?f6?:*:*:*) + case $host_cpu in + x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; + *) ax_gcc_arch="prescott pentium4 pentiumpro" ;; + esac ;; + ?000?f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; + esac ;; + *:68747541:*:*) # AMD + case $ax_cv_gcc_x86_cpuid_1 in + *5[67]?:*:*:*) ax_gcc_arch=k6 ;; + *5[8d]?:*:*:*) ax_gcc_arch="k6-2 k6" ;; + *5[9]?:*:*:*) ax_gcc_arch="k6-3 k6" ;; + *60?:*:*:*) ax_gcc_arch=k7 ;; + *6[12]?:*:*:*) ax_gcc_arch="athlon k7" ;; + *6[34]?:*:*:*) ax_gcc_arch="athlon-tbird k7" ;; + *67?:*:*:*) ax_gcc_arch="athlon-4 athlon k7" ;; + *6[68a]?:*:*:*) + +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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 0x80000006 output" >&5 +$as_echo_n "checking for x86 cpuid 0x80000006 output... " >&6; } +if ${ax_cv_gcc_x86_cpuid_0x80000006+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_gcc_x86_cpuid_0x80000006=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + int op = 0x80000006, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_gcc_x86_cpuid_0x80000006=`cat conftest_cpuid`; rm -f conftest_cpuid +else + ax_cv_gcc_x86_cpuid_0x80000006=unknown; rm -f conftest_cpuid +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_x86_cpuid_0x80000006" >&5 +$as_echo "$ax_cv_gcc_x86_cpuid_0x80000006" >&6; } +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 + + # L2 cache size + case $ax_cv_gcc_x86_cpuid_0x80000006 in + *:*:*[1-9a-f]??????:*) # (L2 = ecx >> 16) >= 256 + ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;; + *) ax_gcc_arch="athlon-4 athlon k7" ;; + esac ;; + ?00??f[4cef8b]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; + ?00??f5?:*:*:*) ax_gcc_arch="opteron k8" ;; + ?00??f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; + ?00??f??:*:*:*) ax_gcc_arch="k8" ;; + ?05??f??:*:*:*) ax_gcc_arch="btver1 amdfam10 k8" ;; + ?06??f??:*:*:*) ax_gcc_arch="bdver1 amdfam10 k8" ;; + *f??:*:*:*) ax_gcc_arch="amdfam10 k8" ;; + esac ;; + *:746e6543:*:*) # IDT + case $ax_cv_gcc_x86_cpuid_1 in + *54?:*:*:*) ax_gcc_arch=winchip-c6 ;; + *58?:*:*:*) ax_gcc_arch=winchip2 ;; + *6[78]?:*:*:*) ax_gcc_arch=c3 ;; + *69?:*:*:*) ax_gcc_arch="c3-2 c3" ;; + esac ;; + esac + if test x"$ax_gcc_arch" = x; then # fallback + case $host_cpu in + i586*) ax_gcc_arch=pentium ;; + i686*) ax_gcc_arch=pentiumpro ;; + esac + fi + ;; + + sparc*) + # Extract the first word of "prtdiag", so it can be a program name with args. +set dummy prtdiag; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PRTDIAG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PRTDIAG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PRTDIAG="$PRTDIAG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/platform/`uname -i`/sbin/:/usr/platform/`uname -m`/sbin/" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PRTDIAG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PRTDIAG" && ac_cv_path_PRTDIAG="prtdiag" + ;; +esac +fi +PRTDIAG=$ac_cv_path_PRTDIAG +if test -n "$PRTDIAG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PRTDIAG" >&5 +$as_echo "$PRTDIAG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null` + cputype=`echo "$cputype" | tr -d ' -' |tr $as_cr_LETTERS $as_cr_letters` + case $cputype in + *ultrasparciv*) ax_gcc_arch="ultrasparc4 ultrasparc3 ultrasparc v9" ;; + *ultrasparciii*) ax_gcc_arch="ultrasparc3 ultrasparc v9" ;; + *ultrasparc*) ax_gcc_arch="ultrasparc v9" ;; + *supersparc*|*tms390z5[05]*) ax_gcc_arch="supersparc v8" ;; + *hypersparc*|*rt62[056]*) ax_gcc_arch="hypersparc v8" ;; + *cypress*) ax_gcc_arch=cypress ;; + esac ;; + + alphaev5) ax_gcc_arch=ev5 ;; + alphaev56) ax_gcc_arch=ev56 ;; + alphapca56) ax_gcc_arch="pca56 ev56" ;; + alphapca57) ax_gcc_arch="pca57 pca56 ev56" ;; + alphaev6) ax_gcc_arch=ev6 ;; + alphaev67) ax_gcc_arch=ev67 ;; + alphaev68) ax_gcc_arch="ev68 ev67" ;; + alphaev69) ax_gcc_arch="ev69 ev68 ev67" ;; + alphaev7) ax_gcc_arch="ev7 ev69 ev68 ev67" ;; + alphaev79) ax_gcc_arch="ev79 ev7 ev69 ev68 ev67" ;; + + powerpc*) + cputype=`((grep cpu /proc/cpuinfo | head -n 1 | cut -d: -f2 | cut -d, -f1 | sed 's/ //g') ; /usr/bin/machine ; /bin/machine; grep CPU /var/run/dmesg.boot | head -n 1 | cut -d" " -f2) 2> /dev/null` + cputype=`echo $cputype | sed -e 's/ppc//g;s/ *//g'` + case $cputype in + *750*) ax_gcc_arch="750 G3" ;; + *740[0-9]*) ax_gcc_arch="$cputype 7400 G4" ;; + *74[4-5][0-9]*) ax_gcc_arch="$cputype 7450 G4" ;; + *74[0-9][0-9]*) ax_gcc_arch="$cputype G4" ;; + *970*) ax_gcc_arch="970 G5 power4";; + *POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";; + *POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";; + 603ev|8240) ax_gcc_arch="$cputype 603e 603";; + *) ax_gcc_arch=$cputype ;; + esac + ax_gcc_arch="$ax_gcc_arch powerpc" + ;; +esac +fi # not cross-compiling +fi # guess arch + +if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then +for arch in $ax_gcc_arch; do + if test "x$acx_maxopt_portable" = xyes; then # if we require portable code + flags="-mtune=$arch" + # -mcpu=$arch and m$arch generate nonportable code on every arch except + # x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr. + case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac + else + flags="-march=$arch -mcpu=$arch -m$arch" + fi + for flag in $flags; do + as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$flag" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 +$as_echo_n "checking whether C compiler accepts $flag... " >&6; } +if eval \${$as_CACHEVAR+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS $flag" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_CACHEVAR=yes" +else + eval "$as_CACHEVAR=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +eval ac_res=\$$as_CACHEVAR + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : + ax_cv_gcc_archflag=$flag; break +else + : +fi + + done + test "x$ax_cv_gcc_archflag" = xunknown || break +done +fi + +fi # $GCC=yes + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc architecture flag" >&5 +$as_echo_n "checking for gcc architecture flag... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_archflag" >&5 +$as_echo "$ax_cv_gcc_archflag" >&6; } +if test "x$ax_cv_gcc_archflag" = xunknown; then + : +else + CFLAGS="$CFLAGS $ax_cv_gcc_archflag" +fi + + ;; + esac + + if test -z "$CFLAGS"; then + echo "" + echo "********************************************************" + echo "* WARNING: Don't know the best CFLAGS for this system *" + echo "* Use ./configure CFLAGS=... to specify your own flags *" + echo "* (otherwise, a default of CFLAGS=-O3 will be used) *" + echo "********************************************************" + echo "" + CFLAGS="-O3" + fi + + as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$CFLAGS" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $CFLAGS" >&5 +$as_echo_n "checking whether C compiler accepts $CFLAGS... " >&6; } +if eval \${$as_CACHEVAR+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS $CFLAGS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_CACHEVAR=yes" +else + eval "$as_CACHEVAR=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +eval ac_res=\$$as_CACHEVAR + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : + : +else + + echo "" + echo "********************************************************" + echo "* WARNING: The guessed CFLAGS don't seem to work with *" + echo "* your compiler. *" + echo "* Use ./configure CFLAGS=... to specify your own flags *" + echo "********************************************************" + echo "" + CFLAGS="" + +fi + + +fi + +# The AX_CFLAGS_WARN_ALL macro doesn't currently work for sunpro +# compiler. +if test "$ax_cv_c_compiler_vendor" != "sun"; then + if ${CFLAGS+:} false; then : + case " $CFLAGS " in + *" "*) + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains "; } >&5 + (: CFLAGS already contains ) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + ;; + *) + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \""; } >&5 + (: CFLAGS="$CFLAGS ") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + CFLAGS="$CFLAGS " + ;; + esac +else + CFLAGS="" +fi + +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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking CFLAGS for maximum warnings" >&5 +$as_echo_n "checking CFLAGS for maximum warnings... " >&6; } +if ${ac_cv_cflags_warn_all+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_cflags_warn_all="no, unknown" +ac_save_CFLAGS="$CFLAGS" +for ac_arg in "-warn all % -warn all" "-pedantic % -Wall" "-xstrconst % -v" "-std1 % -verbose -w0 -warnprotos" "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" "-ansi -ansiE % -fullwarn" "+ESlit % +w1" "-Xc % -pvctl,fullmsg" "-h conform % -h msglevel 2" # +do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_cflags_warn_all=`echo $ac_arg | sed -e 's,.*% *,,'` ; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +CFLAGS="$ac_save_CFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags_warn_all" >&5 +$as_echo "$ac_cv_cflags_warn_all" >&6; } + +case ".$ac_cv_cflags_warn_all" in + .ok|.ok,*) ;; + .|.no|.no,*) ;; + *) if ${CFLAGS+:} false; then : + case " $CFLAGS " in + *" $ac_cv_cflags_warn_all "*) + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$ac_cv_cflags_warn_all"; } >&5 + (: CFLAGS already contains $ac_cv_cflags_warn_all) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + ;; + *) + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_warn_all\""; } >&5 + (: CFLAGS="$CFLAGS $ac_cv_cflags_warn_all") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + CFLAGS="$CFLAGS $ac_cv_cflags_warn_all" + ;; + esac +else + CFLAGS="$ac_cv_cflags_warn_all" +fi + ;; +esac + +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 + +if test "x$GCC" = "xyes"; then + CFLAGS="$CFLAGS -fexceptions" + touch local.exp +else + cat > local.exp <&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } @@ -11005,7 +13116,7 @@ for ac_header in sys/mman.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mman_h" = x""yes; then : +if test "x$ac_cv_header_sys_mman_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_MMAN_H 1 _ACEOF @@ -11017,7 +13128,7 @@ for ac_func in mmap do : ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" -if test "x$ac_cv_func_mmap" = x""yes; then : +if test "x$ac_cv_func_mmap" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MMAP 1 _ACEOF @@ -11027,7 +13138,7 @@ ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mman_h" = x""yes; then : +if test "x$ac_cv_header_sys_mman_h" = xyes; then : libffi_header_sys_mman_h=yes else libffi_header_sys_mman_h=no @@ -11035,7 +13146,7 @@ ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" -if test "x$ac_cv_func_mmap" = x""yes; then : +if test "x$ac_cv_func_mmap" = xyes; then : libffi_func_mmap=yes else libffi_func_mmap=no @@ -11049,7 +13160,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether read-only mmap of a plain file works" >&5 $as_echo_n "checking whether read-only mmap of a plain file works... " >&6; } -if test "${ac_cv_func_mmap_file+set}" = set; then : +if ${ac_cv_func_mmap_file+:} false; then : $as_echo_n "(cached) " >&6 else # Add a system to this blacklist if @@ -11068,7 +13179,7 @@ $as_echo "$ac_cv_func_mmap_file" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mmap from /dev/zero works" >&5 $as_echo_n "checking whether mmap from /dev/zero works... " >&6; } -if test "${ac_cv_func_mmap_dev_zero+set}" = set; then : +if ${ac_cv_func_mmap_dev_zero+:} false; then : $as_echo_n "(cached) " >&6 else # Add a system to this blacklist if it has mmap() but /dev/zero @@ -11094,7 +13205,7 @@ # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANON(YMOUS)" >&5 $as_echo_n "checking for MAP_ANON(YMOUS)... " >&6; } -if test "${ac_cv_decl_map_anon+set}" = set; then : +if ${ac_cv_decl_map_anon+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11130,7 +13241,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mmap with MAP_ANON(YMOUS) works" >&5 $as_echo_n "checking whether mmap with MAP_ANON(YMOUS) works... " >&6; } -if test "${ac_cv_func_mmap_anon+set}" = set; then : +if ${ac_cv_func_mmap_anon+:} false; then : $as_echo_n "(cached) " >&6 else # Add a system to this blacklist if it has mmap() and MAP_ANON or @@ -11178,9 +13289,13 @@ TARGETDIR="unknown" case "$host" in + aarch64*-*-*) + TARGET=AARCH64; TARGETDIR=aarch64 + ;; + alpha*-*-*) TARGET=ALPHA; TARGETDIR=alpha; - # Support 128-bit long double, changable via command-line switch. + # Support 128-bit long double, changeable via command-line switch. HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)' ;; @@ -11194,12 +13309,20 @@ amd64-*-freebsd*) TARGET=X86_64; TARGETDIR=x86 + ;; + + amd64-*-freebsd*) + TARGET=X86_64; TARGETDIR=x86 ;; avr32*-*-*) TARGET=AVR32; TARGETDIR=avr32 ;; + bfin*) + TARGET=BFIN; TARGETDIR=bfin + ;; + cris-*-*) TARGET=LIBFFI_CRIS; TARGETDIR=cris ;; @@ -11208,7 +13331,7 @@ TARGET=FRV; TARGETDIR=frv ;; - hppa*-*-linux* | parisc*-*-linux*) + hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*) TARGET=PA_LINUX; TARGETDIR=pa ;; hppa*64-*-hpux*) @@ -11221,22 +13344,65 @@ i?86-*-freebsd* | i?86-*-openbsd*) TARGET=X86_FREEBSD; TARGETDIR=x86 ;; - i?86-win32* | i?86-*-cygwin* | i?86-*-mingw*) + i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2* | i?86-*-interix*) TARGET=X86_WIN32; TARGETDIR=x86 - # All mingw/cygwin/win32 builds require this for sharedlib - AM_LTLDFLAGS="-no-undefined" + # All mingw/cygwin/win32 builds require -no-undefined for sharedlib. + # We must also check with_cross_host to decide if this is a native + # or cross-build and select where to install dlls appropriately. + if test -n "$with_cross_host" && + test x"$with_cross_host" != x"no"; then + AM_LTLDFLAGS='-no-undefined -bindir "$(toolexeclibdir)"'; + else + AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"'; + fi ;; i?86-*-darwin*) TARGET=X86_DARWIN; TARGETDIR=x86 ;; i?86-*-solaris2.1[0-9]*) - TARGET=X86_64; TARGETDIR=x86 - ;; + TARGETDIR=x86 + if test $ac_cv_sizeof_size_t = 4; then + TARGET=X86; + else + TARGET=X86_64; + fi + ;; + i*86-*-nto-qnx*) TARGET=X86; TARGETDIR=x86 ;; - i?86-*-*) - TARGET=X86; TARGETDIR=x86 + + x86_64-*-darwin*) + TARGET=X86_DARWIN; TARGETDIR=x86 + ;; + + x86_64-*-cygwin* | x86_64-*-mingw*) + TARGET=X86_WIN64; TARGETDIR=x86 + # All mingw/cygwin/win32 builds require -no-undefined for sharedlib. + # We must also check with_cross_host to decide if this is a native + # or cross-build and select where to install dlls appropriately. + if test -n "$with_cross_host" && + test x"$with_cross_host" != x"no"; then + AM_LTLDFLAGS='-no-undefined -bindir "$(toolexeclibdir)"'; + else + AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"'; + fi + ;; + + i?86-*-* | x86_64-*-*) + TARGETDIR=x86 + if test $ac_cv_sizeof_size_t = 4; then + case "$host" in + *-gnux32) + TARGET=X86_64 + ;; + *) + TARGET=X86 + ;; + esac + else + TARGET=X86_64; + fi ;; ia64*-*-*) @@ -11251,10 +13417,22 @@ TARGET=M68K; TARGETDIR=m68k ;; - mips-sgi-irix5.* | mips-sgi-irix6.*) + microblaze*-*-*) + TARGET=MICROBLAZE; TARGETDIR=microblaze + ;; + + moxie-*-*) + TARGET=MOXIE; TARGETDIR=moxie + ;; + + metag-*-*) + TARGET=METAG; TARGETDIR=metag + ;; + + mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) TARGET=MIPS_IRIX; TARGETDIR=mips ;; - mips*-*-linux*) + mips*-*-linux* | mips*-*-openbsd*) # Support 128-bit long double for NewABI. HAVE_LONG_DOUBLE='defined(__mips64)' TARGET=MIPS_IRIX; TARGETDIR=mips @@ -11263,18 +13441,24 @@ powerpc*-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc ;; + powerpc-*-amigaos*) + TARGET=POWERPC; TARGETDIR=powerpc + ;; powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc ;; - powerpc-*-darwin*) + powerpc-*-darwin* | powerpc64-*-darwin*) TARGET=POWERPC_DARWIN; TARGETDIR=powerpc ;; powerpc-*-aix* | rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc ;; - powerpc-*-freebsd*) + powerpc-*-freebsd* | powerpc-*-openbsd*) TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc ;; + powerpc64-*-freebsd*) + TARGET=POWERPC; TARGETDIR=powerpc + ;; powerpc*-*-rtems*) TARGET=POWERPC; TARGETDIR=powerpc ;; @@ -11294,24 +13478,21 @@ TARGET=SPARC; TARGETDIR=sparc ;; - x86_64-*-darwin*) - TARGET=X86_DARWIN; TARGETDIR=x86 - ;; - - x86_64-*-cygwin* | x86_64-*-mingw*) - TARGET=X86_WIN64; TARGETDIR=x86 - ;; - - x86_64-*-*) - TARGET=X86_64; TARGETDIR=x86 - ;; + tile*-*) + TARGET=TILE; TARGETDIR=tile + ;; + + xtensa*-*) + TARGET=XTENSA; TARGETDIR=xtensa + ;; + esac if test $TARGETDIR = unknown; then - as_fn_error "\"libffi has not been ported to $host.\"" "$LINENO" 5 + as_fn_error $? "\"libffi has not been ported to $host.\"" "$LINENO" 5 fi if expr x$TARGET : 'xMIPS' > /dev/null; then @@ -11322,6 +13503,14 @@ MIPS_FALSE= fi + if test x$TARGET = xBFIN; then + BFIN_TRUE= + BFIN_FALSE='#' +else + BFIN_TRUE='#' + BFIN_FALSE= +fi + if test x$TARGET = xSPARC; then SPARC_TRUE= SPARC_FALSE='#' @@ -11402,6 +13591,30 @@ M68K_FALSE= fi + if test x$TARGET = xMICROBLAZE; then + MICROBLAZE_TRUE= + MICROBLAZE_FALSE='#' +else + MICROBLAZE_TRUE='#' + MICROBLAZE_FALSE= +fi + + if test x$TARGET = xMETAG; then + METAG_TRUE= + METAG_FALSE='#' +else + METAG_TRUE='#' + METAG_FALSE= +fi + + if test x$TARGET = xMOXIE; then + MOXIE_TRUE= + MOXIE_FALSE='#' +else + MOXIE_TRUE='#' + MOXIE_FALSE= +fi + if test x$TARGET = xPOWERPC; then POWERPC_TRUE= POWERPC_FALSE='#' @@ -11434,6 +13647,14 @@ POWERPC_FREEBSD_FALSE= fi + if test x$TARGET = xAARCH64; then + AARCH64_TRUE= + AARCH64_FALSE='#' +else + AARCH64_TRUE='#' + AARCH64_FALSE= +fi + if test x$TARGET = xARM; then ARM_TRUE= ARM_FALSE='#' @@ -11522,10 +13743,26 @@ PA64_HPUX_FALSE= fi + if test x$TARGET = xTILE; then + TILE_TRUE= + TILE_FALSE='#' +else + TILE_TRUE='#' + TILE_FALSE= +fi + + if test x$TARGET = xXTENSA; then + XTENSA_TRUE= + XTENSA_FALSE='#' +else + XTENSA_TRUE='#' + XTENSA_FALSE= +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11638,7 +13875,7 @@ for ac_func in memcpy do : ac_fn_c_check_func "$LINENO" "memcpy" "ac_cv_func_memcpy" -if test "x$ac_cv_func_memcpy" = x""yes; then : +if test "x$ac_cv_func_memcpy" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MEMCPY 1 _ACEOF @@ -11646,11 +13883,22 @@ fi done +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } -if test "${ac_cv_working_alloca_h+set}" = set; then : +if ${ac_cv_working_alloca_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11683,7 +13931,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } -if test "${ac_cv_func_alloca_works+set}" = set; then : +if ${ac_cv_func_alloca_works+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11702,7 +13950,7 @@ #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ -char *alloca (); +void *alloca (size_t); # endif # endif # endif @@ -11746,7 +13994,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } -if test "${ac_cv_os_cray+set}" = set; then : +if ${ac_cv_os_cray+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11773,8 +14021,7 @@ for ac_func in _getb67 GETB67 getb67; do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func @@ -11788,7 +14035,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } -if test "${ac_cv_c_stack_direction+set}" = set; then : +if ${ac_cv_c_stack_direction+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -11798,23 +14045,20 @@ /* end confdefs.h. */ $ac_includes_default int -find_stack_direction () -{ - static char *addr = 0; - auto char dummy; - if (addr == 0) - { - addr = &dummy; - return find_stack_direction (); - } - else - return (&dummy > addr) ? 1 : -1; -} - -int -main () -{ - return find_stack_direction () < 0; +find_stack_direction (int *addr, int depth) +{ + int dir, dummy = 0; + if (! addr) + addr = &dummy; + *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; + dir = depth ? find_stack_direction (addr, depth - 1) : 0; + return dir + dummy; +} + +int +main (int argc, char **argv) +{ + return find_stack_direction (0, argc + !argv + 20) < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : @@ -11843,7 +14087,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 $as_echo_n "checking size of double... " >&6; } -if test "${ac_cv_sizeof_double+set}" = set; then : +if ${ac_cv_sizeof_double+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : @@ -11852,9 +14096,8 @@ if test "$ac_cv_type_double" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (double) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (double) +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_double=0 fi @@ -11877,7 +14120,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long double" >&5 $as_echo_n "checking size of long double... " >&6; } -if test "${ac_cv_sizeof_long_double+set}" = set; then : +if ${ac_cv_sizeof_long_double+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long double))" "ac_cv_sizeof_long_double" "$ac_includes_default"; then : @@ -11886,9 +14129,8 @@ if test "$ac_cv_type_long_double" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (long double) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (long double) +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_double=0 fi @@ -11922,7 +14164,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then : +if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown @@ -12140,18 +14382,18 @@ ;; #( *) - as_fn_error "unknown endianness + as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .cfi pseudo-op support" >&5 $as_echo_n "checking assembler .cfi pseudo-op support... " >&6; } -if test "${libffi_cv_as_cfi_pseudo_op+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - libffi_cv_as_cfi_pseudo_op=unknown +if ${gcc_cv_as_cfi_pseudo_op+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gcc_cv_as_cfi_pseudo_op=unknown cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ asm (".cfi_startproc\n\t.cfi_endproc"); @@ -12164,25 +14406,26 @@ } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - libffi_cv_as_cfi_pseudo_op=yes -else - libffi_cv_as_cfi_pseudo_op=no + gcc_cv_as_cfi_pseudo_op=yes +else + gcc_cv_as_cfi_pseudo_op=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_cfi_pseudo_op" >&5 -$as_echo "$libffi_cv_as_cfi_pseudo_op" >&6; } -if test "x$libffi_cv_as_cfi_pseudo_op" = xyes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_cfi_pseudo_op" >&5 +$as_echo "$gcc_cv_as_cfi_pseudo_op" >&6; } + if test "x$gcc_cv_as_cfi_pseudo_op" = xyes; then $as_echo "#define HAVE_AS_CFI_PSEUDO_OP 1" >>confdefs.h -fi + fi + if test x$TARGET = xSPARC; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler and linker support unaligned pc related relocs" >&5 $as_echo_n "checking assembler and linker support unaligned pc related relocs... " >&6; } -if test "${libffi_cv_as_sparc_ua_pcrel+set}" = set; then : +if ${libffi_cv_as_sparc_ua_pcrel+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12221,7 +14464,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .register pseudo-op support" >&5 $as_echo_n "checking assembler .register pseudo-op support... " >&6; } -if test "${libffi_cv_as_register_pseudo_op+set}" = set; then : +if ${libffi_cv_as_register_pseudo_op+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12229,11 +14472,11 @@ # Check if we have .register cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + +int +main () +{ asm (".register %g2, #scratch"); -int -main () -{ - ; return 0; } @@ -12258,7 +14501,7 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports pc related relocs" >&5 $as_echo_n "checking assembler supports pc related relocs... " >&6; } -if test "${libffi_cv_as_x86_pcrel+set}" = set; then : +if ${libffi_cv_as_x86_pcrel+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12276,77 +14519,255 @@ $as_echo "#define HAVE_AS_X86_PCREL 1" >>confdefs.h fi -fi - + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .ascii pseudo-op support" >&5 +$as_echo_n "checking assembler .ascii pseudo-op support... " >&6; } +if ${libffi_cv_as_ascii_pseudo_op+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libffi_cv_as_ascii_pseudo_op=unknown + # Check if we have .ascii + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +asm (".ascii \\"string\\""); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libffi_cv_as_ascii_pseudo_op=yes +else + libffi_cv_as_ascii_pseudo_op=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_ascii_pseudo_op" >&5 +$as_echo "$libffi_cv_as_ascii_pseudo_op" >&6; } + if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then + +$as_echo "#define HAVE_AS_ASCII_PSEUDO_OP 1" >>confdefs.h + + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .string pseudo-op support" >&5 +$as_echo_n "checking assembler .string pseudo-op support... " >&6; } +if ${libffi_cv_as_string_pseudo_op+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libffi_cv_as_string_pseudo_op=unknown + # Check if we have .string + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +asm (".string \\"string\\""); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libffi_cv_as_string_pseudo_op=yes +else + libffi_cv_as_string_pseudo_op=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_string_pseudo_op" >&5 +$as_echo "$libffi_cv_as_string_pseudo_op" >&6; } + if test "x$libffi_cv_as_string_pseudo_op" = xyes; then + +$as_echo "#define HAVE_AS_STRING_PSEUDO_OP 1" >>confdefs.h + + fi +fi + +# On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. +# Check whether --enable-pax_emutramp was given. +if test "${enable_pax_emutramp+set}" = set; then : + enableval=$enable_pax_emutramp; if test "$enable_pax_emutramp" = "yes"; then + +$as_echo "#define FFI_MMAP_EXEC_EMUTRAMP_PAX 1" >>confdefs.h + + fi +fi + + +if test x$TARGET = xX86_WIN64; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _ prefix in compiled symbols" >&5 +$as_echo_n "checking for _ prefix in compiled symbols... " >&6; } +if ${lt_cv_sys_symbol_underscore+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sys_symbol_underscore=no + cat > conftest.$ac_ext <<_LT_EOF +void nm_test_func(){} +int main(){nm_test_func;return 0;} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + ac_nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$ac_nlist"; then + # See whether the symbols have a leading underscore. + if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then + lt_cv_sys_symbol_underscore=yes + else + if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then + : + else + echo "configure: cannot find nm_test_func in $ac_nlist" >&5 + fi + fi + else + echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "configure: failed program was:" >&5 + cat conftest.c >&5 + fi + rm -rf conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_symbol_underscore" >&5 +$as_echo "$lt_cv_sys_symbol_underscore" >&6; } + sys_symbol_underscore=$lt_cv_sys_symbol_underscore + + + if test "x$sys_symbol_underscore" = xyes; then + +$as_echo "#define SYMBOL_UNDERSCORE 1" >>confdefs.h + + fi +fi + +FFI_EXEC_TRAMPOLINE_TABLE=0 case "$target" in - *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*) + *arm*-apple-darwin*) + FFI_EXEC_TRAMPOLINE_TABLE=1 + +$as_echo "#define FFI_EXEC_TRAMPOLINE_TABLE 1" >>confdefs.h + + ;; + *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) $as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h ;; esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .eh_frame section should be read-only" >&5 + if test x$FFI_EXEC_TRAMPOLINE_TABLE = x1; then + FFI_EXEC_TRAMPOLINE_TABLE_TRUE= + FFI_EXEC_TRAMPOLINE_TABLE_FALSE='#' +else + FFI_EXEC_TRAMPOLINE_TABLE_TRUE='#' + FFI_EXEC_TRAMPOLINE_TABLE_FALSE= +fi + + + +if test x$TARGET = xX86_64; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports unwind section type" >&5 +$as_echo_n "checking assembler supports unwind section type... " >&6; } +if ${libffi_cv_as_x86_64_unwind_section_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libffi_cv_as_x86_64_unwind_section_type=yes + echo '.section .eh_frame,"a", at unwind' > conftest.s + if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then + libffi_cv_as_x86_64_unwind_section_type=no + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_x86_64_unwind_section_type" >&5 +$as_echo "$libffi_cv_as_x86_64_unwind_section_type" >&6; } + if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then + +$as_echo "#define HAVE_AS_X86_64_UNWIND_SECTION_TYPE 1" >>confdefs.h + + fi +fi + +if test "x$GCC" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .eh_frame section should be read-only" >&5 $as_echo_n "checking whether .eh_frame section should be read-only... " >&6; } -if test "${libffi_cv_ro_eh_frame+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - libffi_cv_ro_eh_frame=no - echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c - if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then - if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then - libffi_cv_ro_eh_frame=yes - elif grep '.section.*eh_frame.*#alloc' conftest.c \ - | grep -v '#write' > /dev/null; then - libffi_cv_ro_eh_frame=yes - fi - fi - rm -f conftest.* +if ${libffi_cv_ro_eh_frame+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libffi_cv_ro_eh_frame=no + echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c + if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then + objdump -h conftest.o > conftest.dump 2>&1 + libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1` + libffi_test_line=`expr $libffi_eh_frame_line + 1`p + sed -n $libffi_test_line conftest.dump > conftest.line + if grep READONLY conftest.line > /dev/null; then + libffi_cv_ro_eh_frame=yes + fi + fi + rm -f conftest.* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_ro_eh_frame" >&5 $as_echo "$libffi_cv_ro_eh_frame" >&6; } -if test "x$libffi_cv_ro_eh_frame" = xyes; then + if test "x$libffi_cv_ro_eh_frame" = xyes; then $as_echo "#define HAVE_RO_EH_FRAME 1" >>confdefs.h $as_echo "#define EH_FRAME_FLAGS \"a\"" >>confdefs.h -else + else $as_echo "#define EH_FRAME_FLAGS \"aw\"" >>confdefs.h -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((visibility(\"hidden\")))" >&5 + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((visibility(\"hidden\")))" >&5 $as_echo_n "checking for __attribute__((visibility(\"hidden\")))... " >&6; } -if test "${libffi_cv_hidden_visibility_attribute+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c - libffi_cv_hidden_visibility_attribute=no - if { ac_try='${CC-cc} -Werror -S conftest.c -o conftest.s 1>&5' +if ${libffi_cv_hidden_visibility_attribute+:} false; then : + $as_echo_n "(cached) " >&6 +else + + echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1 ; }' > conftest.c + libffi_cv_hidden_visibility_attribute=no + if { ac_try='${CC-cc} -Werror -S conftest.c -o conftest.s 1>&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then - if grep '\.hidden.*foo' conftest.s >/dev/null; then - libffi_cv_hidden_visibility_attribute=yes - fi - fi - rm -f conftest.* + if grep '\.hidden.*foo' conftest.s >/dev/null; then + libffi_cv_hidden_visibility_attribute=yes + fi + fi + rm -f conftest.* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_hidden_visibility_attribute" >&5 $as_echo "$libffi_cv_hidden_visibility_attribute" >&6; } -if test $libffi_cv_hidden_visibility_attribute = yes; then + if test $libffi_cv_hidden_visibility_attribute = yes; then $as_echo "#define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1" >>confdefs.h + fi fi @@ -12365,6 +14786,14 @@ fi fi + if test "$enable_debug" = "yes"; then + FFI_DEBUG_TRUE= + FFI_DEBUG_FALSE='#' +else + FFI_DEBUG_TRUE='#' + FFI_DEBUG_FALSE= +fi + # Check whether --enable-structs was given. if test "${enable_structs+set}" = set; then : @@ -12375,6 +14804,14 @@ fi fi + if test "$enable_debug" = "yes"; then + FFI_DEBUG_TRUE= + FFI_DEBUG_FALSE='#' +else + FFI_DEBUG_TRUE='#' + FFI_DEBUG_FALSE= +fi + # Check whether --enable-raw-api was given. if test "${enable_raw_api+set}" = set; then : @@ -12396,27 +14833,27 @@ fi -if test -n "$with_cross_host" && - test x"$with_cross_host" != x"no"; then - toolexecdir='$(exec_prefix)/$(target_alias)' - toolexeclibdir='$(toolexecdir)/lib' -else - toolexecdir='$(libdir)/gcc-lib/$(target_alias)' +# These variables are only ever used when we cross-build to X86_WIN32. +# And we only support this with GCC, so... +if test "x$GCC" = "xyes"; then + if test -n "$with_cross_host" && + test x"$with_cross_host" != x"no"; then + toolexecdir='$(exec_prefix)/$(target_alias)' + toolexeclibdir='$(toolexecdir)/lib' + else + toolexecdir='$(libdir)/gcc-lib/$(target_alias)' + toolexeclibdir='$(libdir)' + fi + multi_os_directory=`$CC -print-multi-os-directory` + case $multi_os_directory in + .) ;; # Avoid trailing /. + ../*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; + esac + +else toolexeclibdir='$(libdir)' fi -multi_os_directory=`$CC -print-multi-os-directory` -case $multi_os_directory in - .) ;; # Avoid trailing /. - *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; -esac - - - -if test "${multilib}" = "yes"; then - multilib_arg="--enable-multilib" -else - multilib_arg= -fi + ac_config_commands="$ac_config_commands include" @@ -12499,10 +14936,21 @@ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -12518,6 +14966,7 @@ ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' @@ -12532,6 +14981,14 @@ LTLIBOBJS=$ac_ltlibobjs +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -12541,132 +14998,172 @@ fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error "conditional \"AMDEP\" was never defined. + as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error "conditional \"am__fastdepCC\" was never defined. + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then - as_fn_error "conditional \"am__fastdepCCAS\" was never defined. + as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then - as_fn_error "conditional \"MAINTAINER_MODE\" was never defined. + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${TESTSUBDIR_TRUE}" && test -z "${TESTSUBDIR_FALSE}"; then - as_fn_error "conditional \"TESTSUBDIR\" was never defined. + as_fn_error $? "conditional \"TESTSUBDIR\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${MIPS_TRUE}" && test -z "${MIPS_FALSE}"; then - as_fn_error "conditional \"MIPS\" was never defined. + as_fn_error $? "conditional \"MIPS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${BFIN_TRUE}" && test -z "${BFIN_FALSE}"; then + as_fn_error $? "conditional \"BFIN\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${SPARC_TRUE}" && test -z "${SPARC_FALSE}"; then - as_fn_error "conditional \"SPARC\" was never defined. + as_fn_error $? "conditional \"SPARC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_TRUE}" && test -z "${X86_FALSE}"; then - as_fn_error "conditional \"X86\" was never defined. + as_fn_error $? "conditional \"X86\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_FREEBSD_TRUE}" && test -z "${X86_FREEBSD_FALSE}"; then - as_fn_error "conditional \"X86_FREEBSD\" was never defined. + as_fn_error $? "conditional \"X86_FREEBSD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_WIN32_TRUE}" && test -z "${X86_WIN32_FALSE}"; then - as_fn_error "conditional \"X86_WIN32\" was never defined. + as_fn_error $? "conditional \"X86_WIN32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_WIN64_TRUE}" && test -z "${X86_WIN64_FALSE}"; then - as_fn_error "conditional \"X86_WIN64\" was never defined. + as_fn_error $? "conditional \"X86_WIN64\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_DARWIN_TRUE}" && test -z "${X86_DARWIN_FALSE}"; then - as_fn_error "conditional \"X86_DARWIN\" was never defined. + as_fn_error $? "conditional \"X86_DARWIN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ALPHA_TRUE}" && test -z "${ALPHA_FALSE}"; then - as_fn_error "conditional \"ALPHA\" was never defined. + as_fn_error $? "conditional \"ALPHA\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${IA64_TRUE}" && test -z "${IA64_FALSE}"; then - as_fn_error "conditional \"IA64\" was never defined. + as_fn_error $? "conditional \"IA64\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${M32R_TRUE}" && test -z "${M32R_FALSE}"; then - as_fn_error "conditional \"M32R\" was never defined. + as_fn_error $? "conditional \"M32R\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${M68K_TRUE}" && test -z "${M68K_FALSE}"; then - as_fn_error "conditional \"M68K\" was never defined. + as_fn_error $? "conditional \"M68K\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${MICROBLAZE_TRUE}" && test -z "${MICROBLAZE_FALSE}"; then + as_fn_error $? "conditional \"MICROBLAZE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${METAG_TRUE}" && test -z "${METAG_FALSE}"; then + as_fn_error $? "conditional \"METAG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MOXIE_TRUE}" && test -z "${MOXIE_FALSE}"; then + as_fn_error $? "conditional \"MOXIE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${POWERPC_TRUE}" && test -z "${POWERPC_FALSE}"; then - as_fn_error "conditional \"POWERPC\" was never defined. + as_fn_error $? "conditional \"POWERPC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${POWERPC_AIX_TRUE}" && test -z "${POWERPC_AIX_FALSE}"; then - as_fn_error "conditional \"POWERPC_AIX\" was never defined. + as_fn_error $? "conditional \"POWERPC_AIX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${POWERPC_DARWIN_TRUE}" && test -z "${POWERPC_DARWIN_FALSE}"; then - as_fn_error "conditional \"POWERPC_DARWIN\" was never defined. + as_fn_error $? "conditional \"POWERPC_DARWIN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${POWERPC_FREEBSD_TRUE}" && test -z "${POWERPC_FREEBSD_FALSE}"; then - as_fn_error "conditional \"POWERPC_FREEBSD\" was never defined. + as_fn_error $? "conditional \"POWERPC_FREEBSD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${AARCH64_TRUE}" && test -z "${AARCH64_FALSE}"; then + as_fn_error $? "conditional \"AARCH64\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${ARM_TRUE}" && test -z "${ARM_FALSE}"; then - as_fn_error "conditional \"ARM\" was never defined. + as_fn_error $? "conditional \"ARM\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AVR32_TRUE}" && test -z "${AVR32_FALSE}"; then - as_fn_error "conditional \"AVR32\" was never defined. + as_fn_error $? "conditional \"AVR32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${LIBFFI_CRIS_TRUE}" && test -z "${LIBFFI_CRIS_FALSE}"; then - as_fn_error "conditional \"LIBFFI_CRIS\" was never defined. + as_fn_error $? "conditional \"LIBFFI_CRIS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${FRV_TRUE}" && test -z "${FRV_FALSE}"; then - as_fn_error "conditional \"FRV\" was never defined. + as_fn_error $? "conditional \"FRV\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${S390_TRUE}" && test -z "${S390_FALSE}"; then - as_fn_error "conditional \"S390\" was never defined. + as_fn_error $? "conditional \"S390\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_64_TRUE}" && test -z "${X86_64_FALSE}"; then - as_fn_error "conditional \"X86_64\" was never defined. + as_fn_error $? "conditional \"X86_64\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${SH_TRUE}" && test -z "${SH_FALSE}"; then - as_fn_error "conditional \"SH\" was never defined. + as_fn_error $? "conditional \"SH\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${SH64_TRUE}" && test -z "${SH64_FALSE}"; then - as_fn_error "conditional \"SH64\" was never defined. + as_fn_error $? "conditional \"SH64\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${PA_LINUX_TRUE}" && test -z "${PA_LINUX_FALSE}"; then - as_fn_error "conditional \"PA_LINUX\" was never defined. + as_fn_error $? "conditional \"PA_LINUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${PA_HPUX_TRUE}" && test -z "${PA_HPUX_FALSE}"; then - as_fn_error "conditional \"PA_HPUX\" was never defined. + as_fn_error $? "conditional \"PA_HPUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${PA64_HPUX_TRUE}" && test -z "${PA64_HPUX_FALSE}"; then - as_fn_error "conditional \"PA64_HPUX\" was never defined. + as_fn_error $? "conditional \"PA64_HPUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi - - -: ${CONFIG_STATUS=./config.status} +if test -z "${TILE_TRUE}" && test -z "${TILE_FALSE}"; then + as_fn_error $? "conditional \"TILE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${XTENSA_TRUE}" && test -z "${XTENSA_FALSE}"; then + as_fn_error $? "conditional \"XTENSA\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +if test -z "${FFI_EXEC_TRAMPOLINE_TABLE_TRUE}" && test -z "${FFI_EXEC_TRAMPOLINE_TABLE_FALSE}"; then + as_fn_error $? "conditional \"FFI_EXEC_TRAMPOLINE_TABLE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${FFI_DEBUG_TRUE}" && test -z "${FFI_DEBUG_FALSE}"; then + as_fn_error $? "conditional \"FFI_DEBUG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${FFI_DEBUG_TRUE}" && test -z "${FFI_DEBUG_FALSE}"; then + as_fn_error $? "conditional \"FFI_DEBUG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -12767,6 +15264,7 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -12812,19 +15310,19 @@ (unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 - fi - $as_echo "$as_me: error: $1" >&2 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -12962,16 +15460,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -13020,7 +15518,7 @@ test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -13031,28 +15529,16 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -13073,8 +15559,8 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libffi $as_me 3.0.10rc0, which was -generated by GNU Autoconf 2.65. Invocation command line was +This file was extended by libffi $as_me 3.0.13, which was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -13137,17 +15623,17 @@ Configuration commands: $config_commands -Report bugs to ." +Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libffi config.status 3.0.10rc0 -configured by $0, generated by GNU Autoconf 2.65, +libffi config.status 3.0.13 +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -13165,11 +15651,16 @@ while test $# != 0 do case $1 in - --*=*) + --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; *) ac_option=$1 ac_optarg=$2 @@ -13191,6 +15682,7 @@ $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; @@ -13203,7 +15695,7 @@ ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - as_fn_error "ambiguous option: \`$1' + as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; @@ -13212,7 +15704,7 @@ ac_cs_silent=: ;; # This is an error. - -*) as_fn_error "unrecognized option: \`$1' + -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" @@ -13232,7 +15724,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' @@ -13256,6 +15748,14 @@ # # INIT-COMMANDS # +ax_enable_builddir_srcdir="$srcdir" # $srcdir +ax_enable_builddir_host="$HOST" # $HOST / $host +ax_enable_builddir_version="$VERSION" # $VERSION +ax_enable_builddir_package="$PACKAGE" # $PACKAGE +ax_enable_builddir_auxdir="$ax_enable_builddir_auxdir" # $AUX +ax_enable_builddir_sed="$ax_enable_builddir_sed" # $SED +ax_enable_builddir="$ax_enable_builddir" # $SUB + AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" @@ -13266,131 +15766,154 @@ sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' -macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' -macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' -enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' -pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' -host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' -host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' -host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' -build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' -build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' -build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' -SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' -Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' -GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' -EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' -FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' -LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' -NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' -LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' -ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' -exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' -lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' -reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' -AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' -STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' -RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' -CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' -compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' -GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' -objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' -SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' -ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' -need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' -LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' -OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' -libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' -module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' -fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' -need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' -version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' -runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' -libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' -soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' -finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' -old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' -striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + # Quote evaled strings. -for var in SED \ +for var in SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ GREP \ EGREP \ FGREP \ @@ -13403,8 +15926,13 @@ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ +archiver_list_spec \ STRIP \ RANLIB \ CC \ @@ -13414,14 +15942,14 @@ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -SHELL \ -ECHO \ +nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ lt_prog_compiler_wl \ -lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ +MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ @@ -13435,9 +15963,7 @@ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ -hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ -fix_srcfile_path \ exclude_expsyms \ include_expsyms \ file_list_spec \ @@ -13445,12 +15971,13 @@ libname_spec \ library_names_spec \ soname_spec \ +install_override_mode \ finish_eval \ old_striplib \ striplib; do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -13472,14 +15999,15 @@ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ +postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -13487,12 +16015,6 @@ esac done -# Fix-up fallback echo if it was mangled by the above quoting rules. -case \$lt_ECHO in -*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` - ;; -esac - ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' @@ -13523,6 +16045,7 @@ do case $ac_config_target in "fficonfig.h") CONFIG_HEADERS="$CONFIG_HEADERS fficonfig.h" ;; + "buildir") CONFIG_COMMANDS="$CONFIG_COMMANDS buildir" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "include") CONFIG_COMMANDS="$CONFIG_COMMANDS include" ;; @@ -13537,7 +16060,7 @@ "include/ffi_common.h") CONFIG_LINKS="$CONFIG_LINKS include/ffi_common.h:include/ffi_common.h" ;; "fficonfig.py") CONFIG_FILES="$CONFIG_FILES fficonfig.py" ;; - *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -13561,9 +16084,10 @@ # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -13571,12 +16095,13 @@ { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -13593,12 +16118,12 @@ fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' + ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -13607,18 +16132,18 @@ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -13626,7 +16151,7 @@ rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -13674,7 +16199,7 @@ rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -13706,21 +16231,29 @@ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// s/^[^=]*=[ ]*$// }' fi @@ -13732,7 +16265,7 @@ # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || +cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -13744,11 +16277,11 @@ # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -13833,7 +16366,7 @@ _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error "could not setup config headers machinery" "$LINENO" 5 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" @@ -13846,7 +16379,7 @@ esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -13865,7 +16398,7 @@ for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -13874,7 +16407,7 @@ [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -13900,8 +16433,8 @@ esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -14037,23 +16570,24 @@ s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 +which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # @@ -14062,21 +16596,21 @@ if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error "could not create -" "$LINENO" 5 + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" @@ -14130,19 +16664,19 @@ $as_echo "$as_me: linking $ac_source to $ac_file" >&6;} if test ! -r "$ac_source"; then - as_fn_error "$ac_source: file not found" "$LINENO" 5 + as_fn_error $? "$ac_source: file not found" "$LINENO" 5 fi rm -f "$ac_file" # Try a relative symlink, then a hard link, then a copy. - case $srcdir in + case $ac_source in [\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;; *) ac_rel_source=$ac_top_build_prefix$ac_source ;; esac ln -s "$ac_rel_source" "$ac_file" 2>/dev/null || ln "$ac_source" "$ac_file" 2>/dev/null || cp -p "$ac_source" "$ac_file" || - as_fn_error "cannot link or copy $ac_source to $ac_file" "$LINENO" 5 + as_fn_error $? "cannot link or copy $ac_source to $ac_file" "$LINENO" 5 fi ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 @@ -14152,6 +16686,150 @@ case $ac_file$ac_mode in + "buildir":C) ac_top_srcdir="$ax_enable_builddir_srcdir" + if test ".$ax_enable_builddir" = ".." ; then + if test -f "$top_srcdir/Makefile" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: skipping top_srcdir/Makefile - left untouched" >&5 +$as_echo "$as_me: skipping top_srcdir/Makefile - left untouched" >&6;} + else + { $as_echo "$as_me:${as_lineno-$LINENO}: skipping top_srcdir/Makefile - not created" >&5 +$as_echo "$as_me: skipping top_srcdir/Makefile - not created" >&6;} + fi + else + if test -f "$ac_top_srcdir/Makefile" ; then + a=`grep "^VERSION " "$ac_top_srcdir/Makefile"` ; b=`grep "^VERSION " Makefile` + test "$a" != "$b" && rm "$ac_top_srcdir/Makefile" + fi + if test -f "$ac_top_srcdir/Makefile" ; then + echo "$ac_top_srcdir/Makefile : $ac_top_srcdir/Makefile.in" > $tmp/conftemp.mk + echo " @ echo 'REMOVED,,,' >\$@" >> $tmp/conftemp.mk + eval "${MAKE-make} -f $tmp/conftemp.mk 2>/dev/null >/dev/null" + if grep '^REMOVED,,,' "$ac_top_srcdir/Makefile" >/dev/null + then rm $ac_top_srcdir/Makefile ; fi + cp $tmp/conftemp.mk $ac_top_srcdir/makefiles.mk~ ## DEBUGGING + fi + if test ! -f "$ac_top_srcdir/Makefile" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: create top_srcdir/Makefile guessed from local Makefile" >&5 +$as_echo "$as_me: create top_srcdir/Makefile guessed from local Makefile" >&6;} + x='`' ; cat >$tmp/conftemp.sed <<_EOF +/^\$/n +x +/^\$/bS +x +/\\\\\$/{H;d;} +{H;s/.*//;x;} +bM +:S +x +/\\\\\$/{h;d;} +{h;s/.*//;x;} +:M +s/\\(\\n\\) /\\1 /g +/^ /d +/^[ ]*[\\#]/d +/^VPATH *=/d +s/^srcdir *=.*/srcdir = ./ +s/^top_srcdir *=.*/top_srcdir = ./ +/[:=]/!d +/^\\./d +/ = /b +/ .= /b +/:/!b +s/:.*/:/ +s/ / /g +s/ \\([a-z][a-z-]*[a-zA-Z0-9]\\)\\([ :]\\)/ \\1 \\1-all\\2/g +s/^\\([a-z][a-z-]*[a-zA-Z0-9]\\)\\([ :]\\)/\\1 \\1-all\\2/ +s/ / /g +/^all all-all[ :]/i\\ +all-configured : all-all +s/ [a-zA-Z0-9-]*-all [a-zA-Z0-9-]*-all-all//g +/-all-all/d +a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $ax_enable_builddir_auxdir/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; use=$x basename "\$\@" -all $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$n * \$\@"; if test "\$\$n" -eq "0" ; then : \\\\\\ + ; BUILD=$x grep "^####.*|" Makefile |tail -1| sed -e 's/.*|//' $x ; fi \\\\\\ + ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ + ; test "\$\$use" = "\$\@" && BUILD=$x echo "\$\$BUILD" | tail -1 $x \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; (cd "\$\$i" && test ! -f configure && \$(MAKE) \$\$use) || exit; done +/dist-all *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $ax_enable_builddir_auxdir/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; found=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).tar.*" \\\\\\ + ; if test "\$\$found" -eq "0" ; then : \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\ + ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).tar.* \\\\\\ + ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done +/dist-[a-zA-Z0-9]*-all *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh ./config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; found=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).*" \\\\\\ + ; if test "\$\$found" -eq "0" ; then : \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\ + ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).* \\\\\\ + ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done +/distclean-all *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $ax_enable_builddir_auxdir/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile | sed -e 's/.*|//' $x \\\\\\ + ; use=$x basename "\$\@" -all $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$n * \$\@ (all local builds)" \\\\\\ + ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; echo "# rm -r \$\$i"; done ; echo "# (sleep 3)" ; sleep 3 \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; echo "\$\$i" | grep "^/" > /dev/null && continue \\\\\\ + ; echo "\$\$i" | grep "^../" > /dev/null && continue \\\\\\ + ; echo "rm -r \$\$i"; (rm -r "\$\$i") ; done ; rm Makefile +_EOF + cp "$tmp/conftemp.sed" "$ac_top_srcdir/makefile.sed~" ## DEBUGGING + $ax_enable_builddir_sed -f $tmp/conftemp.sed Makefile >$ac_top_srcdir/Makefile + if test -f "$ac_top_srcdir/Makefile.mk" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: extend top_srcdir/Makefile with top_srcdir/Makefile.mk" >&5 +$as_echo "$as_me: extend top_srcdir/Makefile with top_srcdir/Makefile.mk" >&6;} + cat $ac_top_srcdir/Makefile.mk >>$ac_top_srcdir/Makefile + fi ; xxxx="####" + echo "$xxxx CONFIGURATIONS FOR TOPLEVEL MAKEFILE: " >>$ac_top_srcdir/Makefile + # sanity check + if grep '^; echo "MAKE ' $ac_top_srcdir/Makefile >/dev/null ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: buggy sed found - it deletes tab in \"a\" text parts" >&5 +$as_echo "$as_me: buggy sed found - it deletes tab in \"a\" text parts" >&6;} + $ax_enable_builddir_sed -e '/^@ HOST=/s/^/ /' -e '/^; /s/^/ /' $ac_top_srcdir/Makefile \ + >$ac_top_srcdir/Makefile~ + (test -s $ac_top_srcdir/Makefile~ && mv $ac_top_srcdir/Makefile~ $ac_top_srcdir/Makefile) 2>/dev/null + fi + else + xxxx="\\#\\#\\#\\#" + # echo "/^$xxxx *$ax_enable_builddir_host /d" >$tmp/conftemp.sed + echo "s!^$xxxx [^|]* | *$ax_enable_builddir *\$!$xxxx ...... $ax_enable_builddir!" >$tmp/conftemp.sed + $ax_enable_builddir_sed -f "$tmp/conftemp.sed" "$ac_top_srcdir/Makefile" >$tmp/mkfile.tmp + cp "$tmp/conftemp.sed" "$ac_top_srcdir/makefiles.sed~" ## DEBUGGING + cp "$tmp/mkfile.tmp" "$ac_top_srcdir/makefiles.out~" ## DEBUGGING + if cmp -s "$ac_top_srcdir/Makefile" "$tmp/mkfile.tmp" 2>/dev/null ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: keeping top_srcdir/Makefile from earlier configure" >&5 +$as_echo "$as_me: keeping top_srcdir/Makefile from earlier configure" >&6;} + rm "$tmp/mkfile.tmp" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: reusing top_srcdir/Makefile from earlier configure" >&5 +$as_echo "$as_me: reusing top_srcdir/Makefile from earlier configure" >&6;} + mv "$tmp/mkfile.tmp" "$ac_top_srcdir/Makefile" + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: build in $ax_enable_builddir (HOST=$ax_enable_builddir_host)" >&5 +$as_echo "$as_me: build in $ax_enable_builddir (HOST=$ax_enable_builddir_host)" >&6;} + xxxx="####" + echo "$xxxx" "$ax_enable_builddir_host" "|$ax_enable_builddir" >>$ac_top_srcdir/Makefile + fi + ;; "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval @@ -14166,7 +16844,7 @@ # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but + # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. @@ -14200,21 +16878,19 @@ continue fi # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || @@ -14268,7 +16944,8 @@ # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. @@ -14316,6 +16993,15 @@ # Whether or not to optimize for fast installation. fast_install=$enable_fast_install +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + # The host system. host_alias=$host_alias host=$host @@ -14365,9 +17051,11 @@ # turn newlines into spaces. NL2SP=$lt_lt_NL2SP -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP @@ -14375,13 +17063,30 @@ # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method -# Command to use when deplibs_check_method == "file_magic". +# Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + # The archiver. AR=$lt_AR + +# Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + # A symbol stripping program. STRIP=$lt_STRIP @@ -14390,6 +17095,9 @@ old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + # A C compiler. LTCC=$lt_CC @@ -14408,21 +17116,24 @@ # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and in which our libraries should be installed. +lt_sysroot=$lt_sysroot + # The name of the directory that contains temporary libtool files. objdir=$objdir -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that does not interpret backslashes. -ECHO=$lt_ECHO - # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL @@ -14479,6 +17190,9 @@ # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds @@ -14518,6 +17232,10 @@ # The linker used to build libraries. LD=$lt_LD +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds @@ -14530,12 +17248,12 @@ # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic - # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static @@ -14585,10 +17303,6 @@ # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec -# If ld is used when linking, flag to hardcode \$libdir into a binary -# during linking. This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator @@ -14622,9 +17336,6 @@ # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path - # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols @@ -14640,6 +17351,9 @@ # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + # Specify filename containing input files. file_list_spec=$lt_file_list_spec @@ -14672,212 +17386,169 @@ # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $* )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} - -_LT_EOF - ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; - esac -} - -# sed scripts: -my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[^=]*=//' - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` -} - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$@"` -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` -} - -_LT_EOF -esac - -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1+=\$2" -} -_LT_EOF - ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1=\$$1\$2" -} - -_LT_EOF - ;; - esac - - - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + + mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" @@ -14897,7 +17568,7 @@ ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. @@ -14918,7 +17589,7 @@ exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit $? + $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 diff --git a/Modules/_ctypes/libffi/configure.ac b/Modules/_ctypes/libffi/configure.ac --- a/Modules/_ctypes/libffi/configure.ac +++ b/Modules/_ctypes/libffi/configure.ac @@ -1,11 +1,11 @@ dnl Process this with autoconf to create configure # -# file from libffi - slightly patched for ctypes +# file from libffi - slightly patched for Python's ctypes # -AC_PREREQ(2.63) +AC_PREREQ(2.68) -AC_INIT([libffi], [3.0.10rc0], [http://gcc.gnu.org/bugs.html]) +AC_INIT([libffi], [3.0.13], [http://github.com/atgreen/libffi/issues]) AC_CONFIG_HEADERS([fficonfig.h]) AC_CANONICAL_SYSTEM @@ -13,18 +13,24 @@ . ${srcdir}/configure.host +AX_ENABLE_BUILDDIR + AM_INIT_AUTOMAKE # The same as in boehm-gc and libstdc++. Have to borrow it from there. # We must force CC to /not/ be precious variables; otherwise # the wrong, non-multilib-adjusted value will be used in multilibs. # As a side effect, we have to subst CFLAGS ourselves. +# Also save and restore CFLAGS, since AC_PROG_CC will come up with +# defaults of its own if none are provided. m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) m4_define([_AC_ARG_VAR_PRECIOUS],[]) +save_CFLAGS=$CFLAGS AC_PROG_CC +CFLAGS=$save_CFLAGS m4_undefine([_AC_ARG_VAR_PRECIOUS]) -m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) +m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) AC_SUBST(CFLAGS) @@ -33,6 +39,26 @@ AC_PROG_LIBTOOL AC_CONFIG_MACRO_DIR([m4]) +# Test for 64-bit build. +AC_CHECK_SIZEOF([size_t]) + +AX_COMPILER_VENDOR +AX_CC_MAXOPT +# The AX_CFLAGS_WARN_ALL macro doesn't currently work for sunpro +# compiler. +if test "$ax_cv_c_compiler_vendor" != "sun"; then + AX_CFLAGS_WARN_ALL +fi + +if test "x$GCC" = "xyes"; then + CFLAGS="$CFLAGS -fexceptions" + touch local.exp +else + cat > local.exp < /dev/null]) +AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN) AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) AM_CONDITIONAL(X86, test x$TARGET = xX86) AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD) @@ -191,10 +288,14 @@ AM_CONDITIONAL(IA64, test x$TARGET = xIA64) AM_CONDITIONAL(M32R, test x$TARGET = xM32R) AM_CONDITIONAL(M68K, test x$TARGET = xM68K) +AM_CONDITIONAL(MICROBLAZE, test x$TARGET = xMICROBLAZE) +AM_CONDITIONAL(METAG, test x$TARGET = xMETAG) +AM_CONDITIONAL(MOXIE, test x$TARGET = xMOXIE) AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC) AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX) AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN) AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD) +AM_CONDITIONAL(AARCH64, test x$TARGET = xAARCH64) AM_CONDITIONAL(ARM, test x$TARGET = xARM) AM_CONDITIONAL(AVR32, test x$TARGET = xAVR32) AM_CONDITIONAL(LIBFFI_CRIS, test x$TARGET = xLIBFFI_CRIS) @@ -206,6 +307,8 @@ AM_CONDITIONAL(PA_LINUX, test x$TARGET = xPA_LINUX) AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX) AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX) +AM_CONDITIONAL(TILE, test x$TARGET = xTILE) +AM_CONDITIONAL(XTENSA, test x$TARGET = xXTENSA) AC_HEADER_STDC AC_CHECK_FUNCS(memcpy) @@ -228,17 +331,7 @@ AC_C_BIGENDIAN -AC_CACHE_CHECK([assembler .cfi pseudo-op support], - libffi_cv_as_cfi_pseudo_op, [ - libffi_cv_as_cfi_pseudo_op=unknown - AC_TRY_COMPILE([asm (".cfi_startproc\n\t.cfi_endproc");],, - [libffi_cv_as_cfi_pseudo_op=yes], - [libffi_cv_as_cfi_pseudo_op=no]) -]) -if test "x$libffi_cv_as_cfi_pseudo_op" = xyes; then - AC_DEFINE(HAVE_AS_CFI_PSEUDO_OP, 1, - [Define if your assembler supports .cfi_* directives.]) -fi +GCC_AS_CFI_PSEUDO_OP if test x$TARGET = xSPARC; then AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs], @@ -261,7 +354,7 @@ libffi_cv_as_register_pseudo_op, [ libffi_cv_as_register_pseudo_op=unknown # Check if we have .register - AC_TRY_COMPILE([asm (".register %g2, #scratch");],, + AC_TRY_COMPILE(,[asm (".register %g2, #scratch");], [libffi_cv_as_register_pseudo_op=yes], [libffi_cv_as_register_pseudo_op=no]) ]) @@ -284,54 +377,122 @@ AC_DEFINE(HAVE_AS_X86_PCREL, 1, [Define if your assembler supports PC relative relocs.]) fi + + AC_CACHE_CHECK([assembler .ascii pseudo-op support], + libffi_cv_as_ascii_pseudo_op, [ + libffi_cv_as_ascii_pseudo_op=unknown + # Check if we have .ascii + AC_TRY_COMPILE(,[asm (".ascii \\"string\\"");], + [libffi_cv_as_ascii_pseudo_op=yes], + [libffi_cv_as_ascii_pseudo_op=no]) + ]) + if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then + AC_DEFINE(HAVE_AS_ASCII_PSEUDO_OP, 1, + [Define if your assembler supports .ascii.]) + fi + + AC_CACHE_CHECK([assembler .string pseudo-op support], + libffi_cv_as_string_pseudo_op, [ + libffi_cv_as_string_pseudo_op=unknown + # Check if we have .string + AC_TRY_COMPILE(,[asm (".string \\"string\\"");], + [libffi_cv_as_string_pseudo_op=yes], + [libffi_cv_as_string_pseudo_op=no]) + ]) + if test "x$libffi_cv_as_string_pseudo_op" = xyes; then + AC_DEFINE(HAVE_AS_STRING_PSEUDO_OP, 1, + [Define if your assembler supports .string.]) + fi fi +# On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. +AC_ARG_ENABLE(pax_emutramp, + [ --enable-pax_emutramp enable pax emulated trampolines, for we can't use PROT_EXEC], + if test "$enable_pax_emutramp" = "yes"; then + AC_DEFINE(FFI_MMAP_EXEC_EMUTRAMP_PAX, 1, + [Define this if you want to enable pax emulated trampolines]) + fi) + +if test x$TARGET = xX86_WIN64; then + LT_SYS_SYMBOL_USCORE + if test "x$sys_symbol_underscore" = xyes; then + AC_DEFINE(SYMBOL_UNDERSCORE, 1, [Define if symbols are underscored.]) + fi +fi + +FFI_EXEC_TRAMPOLINE_TABLE=0 case "$target" in - *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*) + *arm*-apple-darwin*) + FFI_EXEC_TRAMPOLINE_TABLE=1 + AC_DEFINE(FFI_EXEC_TRAMPOLINE_TABLE, 1, + [Cannot use PROT_EXEC on this target, so, we revert to + alternative means]) + ;; + *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1, [Cannot use malloc on this target, so, we revert to alternative means]) ;; esac +AM_CONDITIONAL(FFI_EXEC_TRAMPOLINE_TABLE, test x$FFI_EXEC_TRAMPOLINE_TABLE = x1) +AC_SUBST(FFI_EXEC_TRAMPOLINE_TABLE) -AC_CACHE_CHECK([whether .eh_frame section should be read-only], - libffi_cv_ro_eh_frame, [ - libffi_cv_ro_eh_frame=no - echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c - if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then - if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then - libffi_cv_ro_eh_frame=yes - elif grep '.section.*eh_frame.*#alloc' conftest.c \ - | grep -v '#write' > /dev/null; then - libffi_cv_ro_eh_frame=yes - fi +if test x$TARGET = xX86_64; then + AC_CACHE_CHECK([assembler supports unwind section type], + libffi_cv_as_x86_64_unwind_section_type, [ + libffi_cv_as_x86_64_unwind_section_type=yes + echo '.section .eh_frame,"a", at unwind' > conftest.s + if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then + libffi_cv_as_x86_64_unwind_section_type=no fi - rm -f conftest.* - ]) -if test "x$libffi_cv_ro_eh_frame" = xyes; then - AC_DEFINE(HAVE_RO_EH_FRAME, 1, - [Define if .eh_frame sections should be read-only.]) - AC_DEFINE(EH_FRAME_FLAGS, "a", - [Define to the flags needed for the .section .eh_frame directive.]) -else - AC_DEFINE(EH_FRAME_FLAGS, "aw", - [Define to the flags needed for the .section .eh_frame directive.]) + ]) + if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then + AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1, + [Define if your assembler supports unwind section type.]) + fi fi -AC_CACHE_CHECK([for __attribute__((visibility("hidden")))], - libffi_cv_hidden_visibility_attribute, [ - echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c - libffi_cv_hidden_visibility_attribute=no - if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then - if grep '\.hidden.*foo' conftest.s >/dev/null; then - libffi_cv_hidden_visibility_attribute=yes - fi - fi - rm -f conftest.* - ]) -if test $libffi_cv_hidden_visibility_attribute = yes; then - AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1, - [Define if __attribute__((visibility("hidden"))) is supported.]) +if test "x$GCC" = "xyes"; then + AC_CACHE_CHECK([whether .eh_frame section should be read-only], + libffi_cv_ro_eh_frame, [ + libffi_cv_ro_eh_frame=no + echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c + if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then + objdump -h conftest.o > conftest.dump 2>&1 + libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1` + libffi_test_line=`expr $libffi_eh_frame_line + 1`p + sed -n $libffi_test_line conftest.dump > conftest.line + if grep READONLY conftest.line > /dev/null; then + libffi_cv_ro_eh_frame=yes + fi + fi + rm -f conftest.* + ]) + if test "x$libffi_cv_ro_eh_frame" = xyes; then + AC_DEFINE(HAVE_RO_EH_FRAME, 1, + [Define if .eh_frame sections should be read-only.]) + AC_DEFINE(EH_FRAME_FLAGS, "a", + [Define to the flags needed for the .section .eh_frame directive. ]) + else + AC_DEFINE(EH_FRAME_FLAGS, "aw", + [Define to the flags needed for the .section .eh_frame directive. ]) + fi + + AC_CACHE_CHECK([for __attribute__((visibility("hidden")))], + libffi_cv_hidden_visibility_attribute, [ + echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1 ; }' > conftest.c + libffi_cv_hidden_visibility_attribute=no + if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then + if grep '\.hidden.*foo' conftest.s >/dev/null; then + libffi_cv_hidden_visibility_attribute=yes + fi + fi + rm -f conftest.* + ]) + if test $libffi_cv_hidden_visibility_attribute = yes; then + AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1, + [Define if __attribute__((visibility("hidden"))) is supported.]) + fi fi AH_BOTTOM([ @@ -360,12 +521,14 @@ if test "$enable_debug" = "yes"; then AC_DEFINE(FFI_DEBUG, 1, [Define this if you want extra debugging.]) fi) +AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes") AC_ARG_ENABLE(structs, [ --disable-structs omit code for struct support], if test "$enable_structs" = "no"; then AC_DEFINE(FFI_NO_STRUCTS, 1, [Define this is you do not want support for aggregate types.]) fi) +AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes") AC_ARG_ENABLE(raw-api, [ --disable-raw-api make the raw api unavailable], @@ -379,28 +542,28 @@ AC_DEFINE(USING_PURIFY, 1, [Define this if you are using Purify and want to suppress spurious messages.]) fi) -if test -n "$with_cross_host" && - test x"$with_cross_host" != x"no"; then - toolexecdir='$(exec_prefix)/$(target_alias)' - toolexeclibdir='$(toolexecdir)/lib' +# These variables are only ever used when we cross-build to X86_WIN32. +# And we only support this with GCC, so... +if test "x$GCC" = "xyes"; then + if test -n "$with_cross_host" && + test x"$with_cross_host" != x"no"; then + toolexecdir='$(exec_prefix)/$(target_alias)' + toolexeclibdir='$(toolexecdir)/lib' + else + toolexecdir='$(libdir)/gcc-lib/$(target_alias)' + toolexeclibdir='$(libdir)' + fi + multi_os_directory=`$CC -print-multi-os-directory` + case $multi_os_directory in + .) ;; # Avoid trailing /. + ../*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; + esac + AC_SUBST(toolexecdir) else - toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' fi -multi_os_directory=`$CC -print-multi-os-directory` -case $multi_os_directory in - .) ;; # Avoid trailing /. - *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; -esac -AC_SUBST(toolexecdir) AC_SUBST(toolexeclibdir) -if test "${multilib}" = "yes"; then - multilib_arg="--enable-multilib" -else - multilib_arg= -fi - AC_CONFIG_COMMANDS(include, [test -d include || mkdir include]) AC_CONFIG_COMMANDS(src, [ test -d src || mkdir src diff --git a/Modules/_ctypes/libffi/depcomp b/Modules/_ctypes/libffi/depcomp --- a/Modules/_ctypes/libffi/depcomp +++ b/Modules/_ctypes/libffi/depcomp @@ -1,10 +1,10 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2006-10-15.18 +scriptversion=2009-04-28.21; # UTC -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software -# Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free +# Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,9 +17,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -87,6 +85,15 @@ depmode=dashmstdout fi +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u="sed s,\\\\\\\\,/,g" + depmode=msvisualcpp +fi + case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what @@ -192,14 +199,14 @@ ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' -' ' ' >> $depfile - echo >> $depfile +' ' ' >> "$depfile" + echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile + >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile @@ -215,34 +222,39 @@ # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. - stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u "$@" -M fi stat=$? - if test -f "$tmpdepfile"; then : - else - stripped=`echo "$stripped" | sed 's,^.*/,,'` - tmpdepfile="$stripped.u" - fi - if test $stat -eq 0; then : else - rm -f "$tmpdepfile" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done if test -f "$tmpdepfile"; then - outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile @@ -323,7 +335,12 @@ if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. - sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi @@ -399,7 +416,7 @@ # Remove the call to Libtool. if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do + while test "X$1" != 'X--mode=compile'; do shift done shift @@ -450,32 +467,39 @@ "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do + while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift - cleared=no - for arg in "$@"; do + cleared=no eat=no + for arg + do case $cleared in no) set ""; shift cleared=yes ;; esac + if test $eat = yes; then + eat=no + continue + fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done - obj_suffix="`echo $object | sed 's/^.*\././'`" + obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" @@ -495,7 +519,7 @@ # Remove the call to Libtool. if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do + while test "X$1" != 'X--mode=compile'; do shift done shift @@ -533,13 +557,27 @@ msvisualcpp) # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. + # always write the preprocessed file to stdout. "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + IFS=" " for arg do case "$arg" in + -o) + shift + ;; + $object) + shift + ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift @@ -552,16 +590,23 @@ ;; esac done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + none) exec "$@" ;; @@ -580,5 +625,6 @@ # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: diff --git a/Modules/_ctypes/libffi/doc/libffi.info b/Modules/_ctypes/libffi/doc/libffi.info index 896a5ec0f1efe6231df04e22e25ec1e280b5e077..6d5acf830ac97ec0f11923d3e9808477900c8e29 GIT binary patch [stripped] diff --git a/Modules/_ctypes/libffi/doc/libffi.texi b/Modules/_ctypes/libffi/doc/libffi.texi --- a/Modules/_ctypes/libffi/doc/libffi.texi +++ b/Modules/_ctypes/libffi/doc/libffi.texi @@ -19,7 +19,7 @@ This manual is for Libffi, a portable foreign-function interface library. -Copyright @copyright{} 2008, 2010 Red Hat, Inc. +Copyright @copyright{} 2008, 2010, 2011 Red Hat, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -133,8 +133,6 @@ you want. @ref{Multiple ABIs} for more information. @var{nargs} is the number of arguments that this function accepts. - at samp{libffi} does not yet handle varargs functions; see @ref{Missing -Features} for more information. @var{rtype} is a pointer to an @code{ffi_type} structure that describes the return type of the function. @xref{Types}. @@ -150,6 +148,30 @@ is invalid. @end defun +If the function being called is variadic (varargs) then + at code{ffi_prep_cif_var} must be used instead of @code{ffi_prep_cif}. + + at findex ffi_prep_cif_var + at defun ffi_status ffi_prep_cif_var (ffi_cif *@var{cif}, ffi_abi var{abi}, unsigned int @var{nfixedargs}, unsigned int var{ntotalargs}, ffi_type *@var{rtype}, ffi_type **@var{argtypes}) +This initializes @var{cif} according to the given parameters for +a call to a variadic function. In general it's operation is the +same as for @code{ffi_prep_cif} except that: + + at var{nfixedargs} is the number of fixed arguments, prior to any +variadic arguments. It must be greater than zero. + + at var{ntotalargs} the total number of arguments, including variadic +and fixed arguments. + +Note that, different cif's must be prepped for calls to the same +function when different numbers of arguments are passed. + +Also note that a call to @code{ffi_prep_cif_var} with + at var{nfixedargs}=@var{nototalargs} is NOT equivalent to a call to + at code{ffi_prep_cif}. + + at end defun + To call a function using an initialized @code{ffi_cif}, use the @code{ffi_call} function: @@ -171,7 +193,9 @@ @var{avalues} is a vector of @code{void *} pointers that point to the memory locations holding the argument values for a call. If @var{cif} declares that the function has no arguments (i.e., @var{nargs} was 0), -then @var{avalues} is ignored. +then @var{avalues} is ignored. Note that argument values may be +modified by the callee (for instance, structs passed by value); the +burden of copying pass-by-value arguments is placed on the caller. @end defun @@ -336,7 +360,7 @@ new @code{ffi_type} object for it. @tindex ffi_type - at deftp ffi_type + at deftp {Data type} ffi_type The @code{ffi_type} has the following members: @table @code @item size_t size @@ -438,7 +462,7 @@ heap. Memory management for closures is handled by a pair of functions: - at findex ffi_closure_alloca + at findex ffi_closure_alloc @defun void *ffi_closure_alloc (size_t @var{size}, void **@var{code}) Allocate a chunk of memory holding @var{size} bytes. This returns a pointer to the writable address, and sets *@var{code} to the @@ -570,9 +594,7 @@ @itemize @bullet @item -There is no support for calling varargs functions. This may work on -some platforms, depending on how the ABI is defined, but it is not -reliable. +Variadic closures. @item There is no support for bit fields in structures. @@ -589,6 +611,8 @@ @c anything else? @end itemize +Note that variadic support is very new and tested on a relatively +small number of platforms. @node Index @unnumbered Index diff --git a/Modules/_ctypes/libffi/doc/stamp-vti b/Modules/_ctypes/libffi/doc/stamp-vti --- a/Modules/_ctypes/libffi/doc/stamp-vti +++ b/Modules/_ctypes/libffi/doc/stamp-vti @@ -1,4 +1,4 @@ - at set UPDATED 14 February 2008 - at set UPDATED-MONTH February 2008 - at set EDITION 3.0.8 - at set VERSION 3.0.8 + at set UPDATED 16 March 2013 + at set UPDATED-MONTH March 2013 + at set EDITION 3.0.13 + at set VERSION 3.0.13 diff --git a/Modules/_ctypes/libffi/doc/version.texi b/Modules/_ctypes/libffi/doc/version.texi --- a/Modules/_ctypes/libffi/doc/version.texi +++ b/Modules/_ctypes/libffi/doc/version.texi @@ -1,4 +1,4 @@ - at set UPDATED 14 February 2008 - at set UPDATED-MONTH February 2008 - at set EDITION 3.0.8 - at set VERSION 3.0.8 + at set UPDATED 16 March 2013 + at set UPDATED-MONTH March 2013 + at set EDITION 3.0.13 + at set VERSION 3.0.13 diff --git a/Modules/_ctypes/libffi/fficonfig.h.in b/Modules/_ctypes/libffi/fficonfig.h.in --- a/Modules/_ctypes/libffi/fficonfig.h.in +++ b/Modules/_ctypes/libffi/fficonfig.h.in @@ -17,6 +17,12 @@ /* Define this if you want extra debugging. */ #undef FFI_DEBUG +/* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ +#undef FFI_EXEC_TRAMPOLINE_TABLE + +/* Define this if you want to enable pax emulated trampolines */ +#undef FFI_MMAP_EXEC_EMUTRAMP_PAX + /* Cannot use malloc on this target, so, we revert to alternative means */ #undef FFI_MMAP_EXEC_WRIT @@ -33,6 +39,9 @@ */ #undef HAVE_ALLOCA_H +/* Define if your assembler supports .ascii. */ +#undef HAVE_AS_ASCII_PSEUDO_OP + /* Define if your assembler supports .cfi_* directives. */ #undef HAVE_AS_CFI_PSEUDO_OP @@ -43,6 +52,12 @@ */ #undef HAVE_AS_SPARC_UA_PCREL +/* Define if your assembler supports .string. */ +#undef HAVE_AS_STRING_PSEUDO_OP + +/* Define if your assembler supports unwind section type. */ +#undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE + /* Define if your assembler supports PC relative relocs. */ #undef HAVE_AS_X86_PCREL @@ -148,6 +163,9 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Define if symbols are underscored. */ +#undef SYMBOL_UNDERSCORE + /* Define this if you are using Purify and want to suppress spurious messages. */ #undef USING_PURIFY @@ -167,6 +185,9 @@ # endif #endif +/* Define to `unsigned int' if does not define. */ +#undef size_t + #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE #ifdef LIBFFI_ASM diff --git a/Modules/_ctypes/libffi/generate-ios-source-and-headers.py b/Modules/_ctypes/libffi/generate-ios-source-and-headers.py new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/generate-ios-source-and-headers.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python + +import subprocess +import re +import os +import errno +import collections +import sys + +class Platform(object): + pass + +sdk_re = re.compile(r'.*-sdk ([a-zA-Z0-9.]*)') + +def sdkinfo(sdkname): + ret = {} + for line in subprocess.Popen(['xcodebuild', '-sdk', sdkname, '-version'], stdout=subprocess.PIPE).stdout: + kv = line.strip().split(': ', 1) + if len(kv) == 2: + k,v = kv + ret[k] = v + return ret + +sim_sdk_info = sdkinfo('iphonesimulator') +device_sdk_info = sdkinfo('iphoneos') + +def latest_sdks(): + latest_sim = None + latest_device = None + for line in subprocess.Popen(['xcodebuild', '-showsdks'], stdout=subprocess.PIPE).stdout: + match = sdk_re.match(line) + if match: + if 'Simulator' in line: + latest_sim = match.group(1) + elif 'iOS' in line: + latest_device = match.group(1) + + return latest_sim, latest_device + +sim_sdk, device_sdk = latest_sdks() + +class simulator_platform(Platform): + sdk='iphonesimulator' + arch = 'i386' + name = 'simulator' + triple = 'i386-apple-darwin10' + sdkroot = sim_sdk_info['Path'] + + prefix = "#if !defined(__arm__) && defined(__i386__)\n\n" + suffix = "\n\n#endif" + +class device_platform(Platform): + sdk='iphoneos' + name = 'ios' + arch = 'armv7' + triple = 'arm-apple-darwin10' + sdkroot = device_sdk_info['Path'] + + prefix = "#ifdef __arm__\n\n" + suffix = "\n\n#endif" + + +def move_file(src_dir, dst_dir, filename, file_suffix=None, prefix='', suffix=''): + if not os.path.exists(dst_dir): + os.makedirs(dst_dir) + + out_filename = filename + + if file_suffix: + split_name = os.path.splitext(filename) + out_filename = "%s_%s%s" % (split_name[0], file_suffix, split_name[1]) + + with open(os.path.join(src_dir, filename)) as in_file: + with open(os.path.join(dst_dir, out_filename), 'w') as out_file: + if prefix: + out_file.write(prefix) + + out_file.write(in_file.read()) + + if suffix: + out_file.write(suffix) + +headers_seen = collections.defaultdict(set) + +def move_source_tree(src_dir, dest_dir, dest_include_dir, arch=None, prefix=None, suffix=None): + for root, dirs, files in os.walk(src_dir, followlinks=True): + relroot = os.path.relpath(root,src_dir) + + def move_dir(arch, prefix='', suffix='', files=[]): + for file in files: + file_suffix = None + if file.endswith('.h'): + if dest_include_dir: + file_suffix = arch + if arch: + headers_seen[file].add(arch) + move_file(root, dest_include_dir, file, arch, prefix=prefix, suffix=suffix) + + elif dest_dir: + outroot = os.path.join(dest_dir, relroot) + move_file(root, outroot, file, prefix=prefix, suffix=suffix) + + if relroot == '.': + move_dir(arch=arch, + files=files, + prefix=prefix, + suffix=suffix) + elif relroot == 'arm': + move_dir(arch='arm', + prefix="#ifdef __arm__\n\n", + suffix="\n\n#endif", + files=files) + elif relroot == 'x86': + move_dir(arch='i386', + prefix="#if !defined(__arm__) && defined(__i386__)\n\n", + suffix="\n\n#endif", + files=files) + +def build_target(platform): + def xcrun_cmd(cmd): + return subprocess.check_output(['xcrun', '-sdk', platform.sdkroot, '-find', cmd]).strip() + + build_dir = 'build_' + platform.name + if not os.path.exists(build_dir): + os.makedirs(build_dir) + env = dict(CC=xcrun_cmd('clang'), + LD=xcrun_cmd('ld'), + CFLAGS='-arch %s -isysroot %s -miphoneos-version-min=4.0' % (platform.arch, platform.sdkroot)) + working_dir=os.getcwd() + try: + os.chdir(build_dir) + subprocess.check_call(['../configure', '-host', platform.triple], env=env) + move_source_tree('.', None, '../ios/include', + arch=platform.arch, + prefix=platform.prefix, + suffix=platform.suffix) + move_source_tree('./include', None, '../ios/include', + arch=platform.arch, + prefix=platform.prefix, + suffix=platform.suffix) + finally: + os.chdir(working_dir) + + for header_name, archs in headers_seen.iteritems(): + basename, suffix = os.path.splitext(header_name) + +def main(): + move_source_tree('src', 'ios/src', 'ios/include') + move_source_tree('include', None, 'ios/include') + build_target(simulator_platform) + build_target(device_platform) + + for header_name, archs in headers_seen.iteritems(): + basename, suffix = os.path.splitext(header_name) + with open(os.path.join('ios/include', header_name), 'w') as header: + for arch in archs: + header.write('#include <%s_%s%s>\n' % (basename, arch, suffix)) + +if __name__ == '__main__': + main() diff --git a/Modules/_ctypes/libffi/generate-osx-source-and-headers.py b/Modules/_ctypes/libffi/generate-osx-source-and-headers.py new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/generate-osx-source-and-headers.py @@ -0,0 +1,153 @@ +#!/usr/bin/env python +import subprocess +import re +import os +import errno +import collections +import sys + +class Platform(object): + pass + +sdk_re = re.compile(r'.*-sdk ([a-zA-Z0-9.]*)') + +def sdkinfo(sdkname): + ret = {} + for line in subprocess.Popen(['xcodebuild', '-sdk', sdkname, '-version'], stdout=subprocess.PIPE).stdout: + kv = line.strip().split(': ', 1) + if len(kv) == 2: + k,v = kv + ret[k] = v + return ret + +desktop_sdk_info = sdkinfo('macosx') + +def latest_sdks(): + latest_desktop = None + for line in subprocess.Popen(['xcodebuild', '-showsdks'], stdout=subprocess.PIPE).stdout: + match = sdk_re.match(line) + if match: + if 'OS X' in line: + latest_desktop = match.group(1) + + return latest_desktop + +desktop_sdk = latest_sdks() + +class desktop_platform_32(Platform): + sdk='macosx' + arch = 'i386' + name = 'mac32' + triple = 'i386-apple-darwin10' + sdkroot = desktop_sdk_info['Path'] + + prefix = "#if defined(__i386__) && !defined(__x86_64__)\n\n" + suffix = "\n\n#endif" + +class desktop_platform_64(Platform): + sdk='macosx' + arch = 'x86_64' + name = 'mac' + triple = 'x86_64-apple-darwin10' + sdkroot = desktop_sdk_info['Path'] + + prefix = "#if !defined(__i386__) && defined(__x86_64__)\n\n" + suffix = "\n\n#endif" + +def move_file(src_dir, dst_dir, filename, file_suffix=None, prefix='', suffix=''): + if not os.path.exists(dst_dir): + os.makedirs(dst_dir) + + out_filename = filename + + if file_suffix: + split_name = os.path.splitext(filename) + out_filename = "%s_%s%s" % (split_name[0], file_suffix, split_name[1]) + + with open(os.path.join(src_dir, filename)) as in_file: + with open(os.path.join(dst_dir, out_filename), 'w') as out_file: + if prefix: + out_file.write(prefix) + + out_file.write(in_file.read()) + + if suffix: + out_file.write(suffix) + +headers_seen = collections.defaultdict(set) + +def move_source_tree(src_dir, dest_dir, dest_include_dir, arch=None, prefix=None, suffix=None): + for root, dirs, files in os.walk(src_dir, followlinks=True): + relroot = os.path.relpath(root,src_dir) + + def move_dir(arch, prefix='', suffix='', files=[]): + for file in files: + file_suffix = None + if file.endswith('.h'): + if dest_include_dir: + file_suffix = arch + if arch: + headers_seen[file].add(arch) + move_file(root, dest_include_dir, file, arch, prefix=prefix, suffix=suffix) + + elif dest_dir: + outroot = os.path.join(dest_dir, relroot) + move_file(root, outroot, file, prefix=prefix, suffix=suffix) + + if relroot == '.': + move_dir(arch=arch, + files=files, + prefix=prefix, + suffix=suffix) + elif relroot == 'x86': + move_dir(arch='i386', + prefix="#if defined(__i386__) && !defined(__x86_64__)\n\n", + suffix="\n\n#endif", + files=files) + move_dir(arch='x86_64', + prefix="#if !defined(__i386__) && defined(__x86_64__)\n\n", + suffix="\n\n#endif", + files=files) + +def build_target(platform): + def xcrun_cmd(cmd): + return subprocess.check_output(['xcrun', '-sdk', platform.sdkroot, '-find', cmd]).strip() + + build_dir = 'build_' + platform.name + if not os.path.exists(build_dir): + os.makedirs(build_dir) + env = dict(CC=xcrun_cmd('clang'), + LD=xcrun_cmd('ld'), + CFLAGS='-arch %s -isysroot %s -mmacosx-version-min=10.6' % (platform.arch, platform.sdkroot)) + working_dir=os.getcwd() + try: + os.chdir(build_dir) + subprocess.check_call(['../configure', '-host', platform.triple], env=env) + move_source_tree('.', None, '../osx/include', + arch=platform.arch, + prefix=platform.prefix, + suffix=platform.suffix) + move_source_tree('./include', None, '../osx/include', + arch=platform.arch, + prefix=platform.prefix, + suffix=platform.suffix) + finally: + os.chdir(working_dir) + + for header_name, archs in headers_seen.iteritems(): + basename, suffix = os.path.splitext(header_name) + +def main(): + move_source_tree('src', 'osx/src', 'osx/include') + move_source_tree('include', None, 'osx/include') + build_target(desktop_platform_32) + build_target(desktop_platform_64) + + for header_name, archs in headers_seen.iteritems(): + basename, suffix = os.path.splitext(header_name) + with open(os.path.join('osx/include', header_name), 'w') as header: + for arch in archs: + header.write('#include <%s_%s%s>\n' % (basename, arch, suffix)) + +if __name__ == '__main__': + main() diff --git a/Modules/_ctypes/libffi/include/Makefile.in b/Modules/_ctypes/libffi/include/Makefile.in --- a/Modules/_ctypes/libffi/include/Makefile.in +++ b/Modules/_ctypes/libffi/include/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.12.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,6 +15,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -39,7 +55,19 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/ffi.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_cc_maxopt.m4 \ + $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_configure_args.m4 \ + $(top_srcdir)/m4/ax_enable_builddir.m4 \ + $(top_srcdir)/m4/ax_gcc_archflag.m4 \ + $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -49,6 +77,11 @@ CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -70,6 +103,12 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } am__installdirs = "$(DESTDIR)$(includesdir)" HEADERS = $(nodist_includes_HEADERS) ETAGS = etags @@ -78,6 +117,7 @@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ +AM_LTLDFLAGS = @AM_LTLDFLAGS@ AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -95,6 +135,7 @@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -102,6 +143,7 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ FGREP = @FGREP@ GREP = @GREP@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ @@ -120,6 +162,7 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -132,8 +175,10 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PRTDIAG = @PRTDIAG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -146,6 +191,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -153,6 +199,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -178,7 +225,6 @@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -189,6 +235,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ @@ -248,8 +295,11 @@ -rm -rf .libs _libs install-nodist_includesHEADERS: $(nodist_includes_HEADERS) @$(NORMAL_INSTALL) - test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includesdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includesdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -263,9 +313,7 @@ @$(NORMAL_UNINSTALL) @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(includesdir)" && rm -f $$files + dir='$(DESTDIR)$(includesdir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -316,6 +364,20 @@ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -366,10 +428,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -451,7 +518,7 @@ .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool ctags distclean distclean-generic \ + clean-libtool cscopelist ctags distclean distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ diff --git a/Modules/_ctypes/libffi/include/ffi.h.in b/Modules/_ctypes/libffi/include/ffi.h.in --- a/Modules/_ctypes/libffi/include/ffi.h.in +++ b/Modules/_ctypes/libffi/include/ffi.h.in @@ -1,16 +1,17 @@ /* -----------------------------------------------------------------*-C-*- - libffi @VERSION@ - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. + libffi @VERSION@ - Copyright (c) 2011 Anthony Green + - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the ``Software''), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF @@ -57,7 +58,9 @@ #endif /* Specify which architecture libffi is configured for. */ +#ifndef @TARGET@ #define @TARGET@ +#endif /* ---- System configuration information --------------------------------- */ @@ -75,15 +78,31 @@ /* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). But we can find it either under the correct ANSI name, or under GNU C's internal name. */ + +#define FFI_64_BIT_MAX 9223372036854775807 + #ifdef LONG_LONG_MAX # define FFI_LONG_LONG_MAX LONG_LONG_MAX #else # ifdef LLONG_MAX # define FFI_LONG_LONG_MAX LLONG_MAX +# ifdef _AIX52 /* or newer has C99 LLONG_MAX */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif /* _AIX52 or newer */ # else # ifdef __GNUC__ # define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ # endif +# ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */ +# ifndef __PPC64__ +# if defined (__IBMC__) || defined (__IBMCPP__) +# define FFI_LONG_LONG_MAX LONGLONG_MAX +# endif +# endif /* __PPC64__ */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif # endif #endif @@ -130,39 +149,53 @@ #endif #if LONG_MAX == 2147483647 -# if FFI_LONG_LONG_MAX != 9223372036854775807 +# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX #error "no 64-bit data type supported" # endif -#elif LONG_MAX != 9223372036854775807 +#elif LONG_MAX != FFI_64_BIT_MAX #error "long size not supported" #endif #if LONG_MAX == 2147483647 # define ffi_type_ulong ffi_type_uint32 # define ffi_type_slong ffi_type_sint32 -#elif LONG_MAX == 9223372036854775807 +#elif LONG_MAX == FFI_64_BIT_MAX # define ffi_type_ulong ffi_type_uint64 # define ffi_type_slong ffi_type_sint64 #else #error "long size not supported" #endif +/* Need minimal decorations for DLLs to works on Windows. */ +/* GCC has autoimport and autoexport. Rely on Libtool to */ +/* help MSVC export from a DLL, but always declare data */ +/* to be imported for MSVC clients. This costs an extra */ +/* indirection for MSVC clients using the static version */ +/* of the library, but don't worry about that. Besides, */ +/* as a workaround, they can define FFI_BUILDING if they */ +/* *know* they are going to link with the static library. */ +#if defined _MSC_VER && !defined FFI_BUILDING +#define FFI_EXTERN extern __declspec(dllimport) +#else +#define FFI_EXTERN extern +#endif + /* These are defined in types.c */ -extern ffi_type ffi_type_void; -extern ffi_type ffi_type_uint8; -extern ffi_type ffi_type_sint8; -extern ffi_type ffi_type_uint16; -extern ffi_type ffi_type_sint16; -extern ffi_type ffi_type_uint32; -extern ffi_type ffi_type_sint32; -extern ffi_type ffi_type_uint64; -extern ffi_type ffi_type_sint64; -extern ffi_type ffi_type_float; -extern ffi_type ffi_type_double; -extern ffi_type ffi_type_pointer; +FFI_EXTERN ffi_type ffi_type_void; +FFI_EXTERN ffi_type ffi_type_uint8; +FFI_EXTERN ffi_type ffi_type_sint8; +FFI_EXTERN ffi_type ffi_type_uint16; +FFI_EXTERN ffi_type ffi_type_sint16; +FFI_EXTERN ffi_type ffi_type_uint32; +FFI_EXTERN ffi_type ffi_type_sint32; +FFI_EXTERN ffi_type ffi_type_uint64; +FFI_EXTERN ffi_type ffi_type_sint64; +FFI_EXTERN ffi_type ffi_type_float; +FFI_EXTERN ffi_type ffi_type_double; +FFI_EXTERN ffi_type ffi_type_pointer; #if @HAVE_LONG_DOUBLE@ -extern ffi_type ffi_type_longdouble; +FFI_EXTERN ffi_type ffi_type_longdouble; #else #define ffi_type_longdouble ffi_type_double #endif @@ -188,12 +221,21 @@ #endif } ffi_cif; +/* Used internally, but overridden by some architectures */ +ffi_status ffi_prep_cif_core(ffi_cif *cif, + ffi_abi abi, + unsigned int isvariadic, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type *rtype, + ffi_type **atypes); + /* ---- Definitions for the raw API -------------------------------------- */ #ifndef FFI_SIZEOF_ARG # if LONG_MAX == 2147483647 # define FFI_SIZEOF_ARG 4 -# elif LONG_MAX == 9223372036854775807 +# elif LONG_MAX == FFI_64_BIT_MAX # define FFI_SIZEOF_ARG 8 # endif #endif @@ -255,7 +297,12 @@ __declspec(align(8)) #endif typedef struct { +#if @FFI_EXEC_TRAMPOLINE_TABLE@ + void *trampoline_table; + void *trampoline_table_entry; +#else char tramp[FFI_TRAMPOLINE_SIZE]; +#endif ffi_cif *cif; void (*fun)(ffi_cif*,void*,void**,void*); void *user_data; @@ -263,6 +310,9 @@ } ffi_closure __attribute__((aligned (8))); #else } ffi_closure; +# ifdef __sgi +# pragma pack 0 +# endif #endif void *ffi_closure_alloc (size_t size, void **code); @@ -281,9 +331,16 @@ void *user_data, void*codeloc); +#ifdef __sgi +# pragma pack 8 +#endif typedef struct { +#if @FFI_EXEC_TRAMPOLINE_TABLE@ + void *trampoline_table; + void *trampoline_table_entry; +#else char tramp[FFI_TRAMPOLINE_SIZE]; - +#endif ffi_cif *cif; #if !FFI_NATIVE_RAW_API @@ -303,7 +360,12 @@ } ffi_raw_closure; typedef struct { +#if @FFI_EXEC_TRAMPOLINE_TABLE@ + void *trampoline_table; + void *trampoline_table_entry; +#else char tramp[FFI_TRAMPOLINE_SIZE]; +#endif ffi_cif *cif; @@ -359,6 +421,13 @@ ffi_type *rtype, ffi_type **atypes); +ffi_status ffi_prep_cif_var(ffi_cif *cif, + ffi_abi abi, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type *rtype, + ffi_type **atypes); + void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, diff --git a/Modules/_ctypes/libffi/include/ffi_common.h b/Modules/_ctypes/libffi/include/ffi_common.h --- a/Modules/_ctypes/libffi/include/ffi_common.h +++ b/Modules/_ctypes/libffi/include/ffi_common.h @@ -1,7 +1,8 @@ /* ----------------------------------------------------------------------- - ffi_common.h - Copyright (c) 1996 Red Hat, Inc. - Copyright (C) 2007 Free Software Foundation, Inc - + ffi_common.h - Copyright (C) 2011, 2012 Anthony Green + Copyright (C) 2007 Free Software Foundation, Inc + Copyright (c) 1996 Red Hat, Inc. + Common internal definitions and macros. Only necessary for building libffi. ----------------------------------------------------------------------- */ @@ -74,6 +75,8 @@ /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif); +ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif, + unsigned int nfixedargs, unsigned int ntotalargs); /* Extended cif, used in callback from assembly routine */ typedef struct @@ -84,7 +87,7 @@ } extended_cif; /* Terse sized type definitions. */ -#if defined(_MSC_VER) || defined(__sgi) +#if defined(_MSC_VER) || defined(__sgi) || defined(__SUNPRO_C) typedef unsigned char UINT8; typedef signed char SINT8; typedef unsigned short UINT16; @@ -112,11 +115,14 @@ typedef float FLOAT32; +#ifndef __GNUC__ +#define __builtin_expect(x, expected_value) (x) +#endif +#define LIKELY(x) __builtin_expect(!!(x),1) +#define UNLIKELY(x) __builtin_expect((x)!=0,0) #ifdef __cplusplus } #endif #endif - - diff --git a/Modules/_ctypes/libffi/install-sh b/Modules/_ctypes/libffi/install-sh --- a/Modules/_ctypes/libffi/install-sh +++ b/Modules/_ctypes/libffi/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2004-12-17.09 +scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -39,38 +39,68 @@ # when there is no Makefile. # # This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. +# from scratch. + +nl=' +' +IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi -# put in absolute paths if you don't have them in your path; or use env. vars. +# Put in absolute file names if you don't have them in your path; +# or use environment vars. -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} -chmodcmd="$chmodprog 0755" +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog chowncmd= -chgrpcmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" + src= dst= dir_arg= -dstarg= +dst_arg= + +copy_on_change=false no_target_directory= -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... @@ -80,81 +110,86 @@ In the 4th, create DIRECTORIES. Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG " -while test -n "$1"; do +while test $# -ne 0; do case $1 in - -c) shift - continue;; + -c) ;; - -d) dir_arg=true - shift - continue;; + -C) copy_on_change=true;; + + -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; + shift;; - --help) echo "$usage"; exit 0;; + --help) echo "$usage"; exit $?;; - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; -o) chowncmd="$chownprog $2" - shift - shift - continue;; + shift;; - -s) stripcmd=$stripprog - shift - continue;; + -s) stripcmd=$stripprog;; - -t) dstarg=$2 - shift - shift - continue;; + -t) dst_arg=$2 + shift;; - -T) no_target_directory=true - shift - continue;; + -T) no_target_directory=true;; - --version) echo "$0 $scriptversion"; exit 0;; + --version) echo "$0 $scriptversion"; exit $?;; - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done + --) shift break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; esac + shift done -if test -z "$1"; then +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 @@ -164,24 +199,47 @@ exit 0 fi +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + for src do # Protect names starting with `-'. case $src in - -*) src=./$src ;; + -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src - src= + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. @@ -190,71 +248,199 @@ exit 1 fi - if test -z "$dstarg"; then + if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi - dst=$dstarg + dst=$dst_arg # Protect names starting with `-'. case $dst in - -*) dst=./$dst ;; + -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 + echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi - dst=$dst/`basename "$src"` + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? fi fi - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + obsolete_mkdir_used=false - # Make sure that the destination directory exists. + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi - pathcomp= + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true fi - pathcomp=$pathcomp/ - done + fi fi if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else - dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ @@ -262,10 +448,9 @@ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # @@ -273,51 +458,63 @@ # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 - } - else - : - fi - } && + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit 1; } + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi done -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} - # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: diff --git a/Modules/_ctypes/libffi/libffi.xcodeproj/project.pbxproj b/Modules/_ctypes/libffi/libffi.xcodeproj/project.pbxproj new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/libffi.xcodeproj/project.pbxproj @@ -0,0 +1,579 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 6C43CBDC1534F76F00162364 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBBD1534F76F00162364 /* ffi.c */; }; + 6C43CBDD1534F76F00162364 /* sysv.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBBF1534F76F00162364 /* sysv.S */; }; + 6C43CBDE1534F76F00162364 /* trampoline.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBC01534F76F00162364 /* trampoline.S */; }; + 6C43CBE61534F76F00162364 /* darwin.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBC91534F76F00162364 /* darwin.S */; }; + 6C43CBE81534F76F00162364 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBCB1534F76F00162364 /* ffi.c */; }; + 6C43CC1F1534F77800162364 /* darwin.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC051534F77800162364 /* darwin.S */; }; + 6C43CC201534F77800162364 /* darwin64.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC061534F77800162364 /* darwin64.S */; }; + 6C43CC211534F77800162364 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC071534F77800162364 /* ffi.c */; }; + 6C43CC221534F77800162364 /* ffi64.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC081534F77800162364 /* ffi64.c */; }; + 6C43CC2F1534F7BE00162364 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC281534F7BE00162364 /* closures.c */; }; + 6C43CC301534F7BE00162364 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC281534F7BE00162364 /* closures.c */; }; + 6C43CC351534F7BE00162364 /* java_raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2B1534F7BE00162364 /* java_raw_api.c */; }; + 6C43CC361534F7BE00162364 /* java_raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2B1534F7BE00162364 /* java_raw_api.c */; }; + 6C43CC371534F7BE00162364 /* prep_cif.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2C1534F7BE00162364 /* prep_cif.c */; }; + 6C43CC381534F7BE00162364 /* prep_cif.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2C1534F7BE00162364 /* prep_cif.c */; }; + 6C43CC391534F7BE00162364 /* raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2D1534F7BE00162364 /* raw_api.c */; }; + 6C43CC3A1534F7BE00162364 /* raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2D1534F7BE00162364 /* raw_api.c */; }; + 6C43CC3B1534F7BE00162364 /* types.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2E1534F7BE00162364 /* types.c */; }; + 6C43CC3C1534F7BE00162364 /* types.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2E1534F7BE00162364 /* types.c */; }; + 6C43CC971535032600162364 /* ffi.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC8D1535032600162364 /* ffi.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CC981535032600162364 /* ffi_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC8E1535032600162364 /* ffi_common.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CC991535032600162364 /* ffi_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC8F1535032600162364 /* ffi_i386.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CC9A1535032600162364 /* ffi_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC901535032600162364 /* ffi_x86_64.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CC9B1535032600162364 /* fficonfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC911535032600162364 /* fficonfig.h */; }; + 6C43CC9C1535032600162364 /* fficonfig_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC921535032600162364 /* fficonfig_i386.h */; }; + 6C43CC9D1535032600162364 /* fficonfig_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC931535032600162364 /* fficonfig_x86_64.h */; }; + 6C43CC9E1535032600162364 /* ffitarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC941535032600162364 /* ffitarget.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CC9F1535032600162364 /* ffitarget_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC951535032600162364 /* ffitarget_i386.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCA01535032600162364 /* ffitarget_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC961535032600162364 /* ffitarget_x86_64.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCAD1535039600162364 /* ffi.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA21535039600162364 /* ffi.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCAE1535039600162364 /* ffi_armv7.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA31535039600162364 /* ffi_armv7.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCAF1535039600162364 /* ffi_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA41535039600162364 /* ffi_common.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCB01535039600162364 /* ffi_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA51535039600162364 /* ffi_i386.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCB11535039600162364 /* fficonfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA61535039600162364 /* fficonfig.h */; }; + 6C43CCB21535039600162364 /* fficonfig_armv7.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA71535039600162364 /* fficonfig_armv7.h */; }; + 6C43CCB31535039600162364 /* fficonfig_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA81535039600162364 /* fficonfig_i386.h */; }; + 6C43CCB41535039600162364 /* ffitarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA91535039600162364 /* ffitarget.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCB51535039600162364 /* ffitarget_arm.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCAA1535039600162364 /* ffitarget_arm.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCB61535039600162364 /* ffitarget_armv7.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCAB1535039600162364 /* ffitarget_armv7.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCB71535039600162364 /* ffitarget_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCAC1535039600162364 /* ffitarget_i386.h */; settings = {ATTRIBUTES = (Public, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 6C43CB3D1534E9D100162364 /* libffi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libffi.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 6C43CBBD1534F76F00162364 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = ""; }; + 6C43CBBF1534F76F00162364 /* sysv.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = sysv.S; sourceTree = ""; }; + 6C43CBC01534F76F00162364 /* trampoline.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = trampoline.S; sourceTree = ""; }; + 6C43CBC91534F76F00162364 /* darwin.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin.S; sourceTree = ""; }; + 6C43CBCB1534F76F00162364 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = ""; }; + 6C43CC051534F77800162364 /* darwin.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin.S; sourceTree = ""; }; + 6C43CC061534F77800162364 /* darwin64.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin64.S; sourceTree = ""; }; + 6C43CC071534F77800162364 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = ""; }; + 6C43CC081534F77800162364 /* ffi64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi64.c; sourceTree = ""; }; + 6C43CC281534F7BE00162364 /* closures.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = closures.c; path = src/closures.c; sourceTree = SOURCE_ROOT; }; + 6C43CC2B1534F7BE00162364 /* java_raw_api.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = java_raw_api.c; path = src/java_raw_api.c; sourceTree = SOURCE_ROOT; }; + 6C43CC2C1534F7BE00162364 /* prep_cif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = prep_cif.c; path = src/prep_cif.c; sourceTree = SOURCE_ROOT; }; + 6C43CC2D1534F7BE00162364 /* raw_api.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = raw_api.c; path = src/raw_api.c; sourceTree = SOURCE_ROOT; }; + 6C43CC2E1534F7BE00162364 /* types.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = types.c; path = src/types.c; sourceTree = SOURCE_ROOT; }; + 6C43CC8D1535032600162364 /* ffi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi.h; sourceTree = ""; }; + 6C43CC8E1535032600162364 /* ffi_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_common.h; sourceTree = ""; }; + 6C43CC8F1535032600162364 /* ffi_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_i386.h; sourceTree = ""; }; + 6C43CC901535032600162364 /* ffi_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_x86_64.h; sourceTree = ""; }; + 6C43CC911535032600162364 /* fficonfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig.h; sourceTree = ""; }; + 6C43CC921535032600162364 /* fficonfig_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_i386.h; sourceTree = ""; }; + 6C43CC931535032600162364 /* fficonfig_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_x86_64.h; sourceTree = ""; }; + 6C43CC941535032600162364 /* ffitarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget.h; sourceTree = ""; }; + 6C43CC951535032600162364 /* ffitarget_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_i386.h; sourceTree = ""; }; + 6C43CC961535032600162364 /* ffitarget_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_x86_64.h; sourceTree = ""; }; + 6C43CCA21535039600162364 /* ffi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi.h; sourceTree = ""; }; + 6C43CCA31535039600162364 /* ffi_armv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_armv7.h; sourceTree = ""; }; + 6C43CCA41535039600162364 /* ffi_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_common.h; sourceTree = ""; }; + 6C43CCA51535039600162364 /* ffi_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_i386.h; sourceTree = ""; }; + 6C43CCA61535039600162364 /* fficonfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig.h; sourceTree = ""; }; + 6C43CCA71535039600162364 /* fficonfig_armv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_armv7.h; sourceTree = ""; }; + 6C43CCA81535039600162364 /* fficonfig_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_i386.h; sourceTree = ""; }; + 6C43CCA91535039600162364 /* ffitarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget.h; sourceTree = ""; }; + 6C43CCAA1535039600162364 /* ffitarget_arm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_arm.h; sourceTree = ""; }; + 6C43CCAB1535039600162364 /* ffitarget_armv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_armv7.h; sourceTree = ""; }; + 6C43CCAC1535039600162364 /* ffitarget_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_i386.h; sourceTree = ""; }; + F6F980BA147386130008F121 /* libffi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libffi.a; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 6C43CB3A1534E9D100162364 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F6F980B7147386130008F121 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 6C43CBAF1534F76F00162364 /* iOS */ = { + isa = PBXGroup; + children = ( + 6C43CCA11535039600162364 /* include */, + 6C43CBBB1534F76F00162364 /* src */, + ); + name = iOS; + path = ios; + sourceTree = ""; + }; + 6C43CBBB1534F76F00162364 /* src */ = { + isa = PBXGroup; + children = ( + 6C43CBC81534F76F00162364 /* x86 */, + 6C43CBBC1534F76F00162364 /* arm */, + ); + path = src; + sourceTree = ""; + }; + 6C43CBBC1534F76F00162364 /* arm */ = { + isa = PBXGroup; + children = ( + 6C43CBBD1534F76F00162364 /* ffi.c */, + 6C43CBBF1534F76F00162364 /* sysv.S */, + 6C43CBC01534F76F00162364 /* trampoline.S */, + ); + path = arm; + sourceTree = ""; + }; + 6C43CBC81534F76F00162364 /* x86 */ = { + isa = PBXGroup; + children = ( + 6C43CBC91534F76F00162364 /* darwin.S */, + 6C43CBCB1534F76F00162364 /* ffi.c */, + ); + path = x86; + sourceTree = ""; + }; + 6C43CBF01534F77800162364 /* OS X */ = { + isa = PBXGroup; + children = ( + 6C43CC8C1535032600162364 /* include */, + 6C43CBFC1534F77800162364 /* src */, + ); + name = "OS X"; + path = osx; + sourceTree = ""; + }; + 6C43CBFC1534F77800162364 /* src */ = { + isa = PBXGroup; + children = ( + 6C43CC041534F77800162364 /* x86 */, + ); + path = src; + sourceTree = ""; + }; + 6C43CC041534F77800162364 /* x86 */ = { + isa = PBXGroup; + children = ( + 6C43CC051534F77800162364 /* darwin.S */, + 6C43CC061534F77800162364 /* darwin64.S */, + 6C43CC071534F77800162364 /* ffi.c */, + 6C43CC081534F77800162364 /* ffi64.c */, + ); + path = x86; + sourceTree = ""; + }; + 6C43CC3D1534F7C400162364 /* src */ = { + isa = PBXGroup; + children = ( + 6C43CC281534F7BE00162364 /* closures.c */, + 6C43CC2B1534F7BE00162364 /* java_raw_api.c */, + 6C43CC2C1534F7BE00162364 /* prep_cif.c */, + 6C43CC2D1534F7BE00162364 /* raw_api.c */, + 6C43CC2E1534F7BE00162364 /* types.c */, + ); + name = src; + path = ios; + sourceTree = ""; + }; + 6C43CC8C1535032600162364 /* include */ = { + isa = PBXGroup; + children = ( + 6C43CC8D1535032600162364 /* ffi.h */, + 6C43CC8E1535032600162364 /* ffi_common.h */, + 6C43CC8F1535032600162364 /* ffi_i386.h */, + 6C43CC901535032600162364 /* ffi_x86_64.h */, + 6C43CC911535032600162364 /* fficonfig.h */, + 6C43CC921535032600162364 /* fficonfig_i386.h */, + 6C43CC931535032600162364 /* fficonfig_x86_64.h */, + 6C43CC941535032600162364 /* ffitarget.h */, + 6C43CC951535032600162364 /* ffitarget_i386.h */, + 6C43CC961535032600162364 /* ffitarget_x86_64.h */, + ); + path = include; + sourceTree = ""; + }; + 6C43CCA11535039600162364 /* include */ = { + isa = PBXGroup; + children = ( + 6C43CCA21535039600162364 /* ffi.h */, + 6C43CCA31535039600162364 /* ffi_armv7.h */, + 6C43CCA41535039600162364 /* ffi_common.h */, + 6C43CCA51535039600162364 /* ffi_i386.h */, + 6C43CCA61535039600162364 /* fficonfig.h */, + 6C43CCA71535039600162364 /* fficonfig_armv7.h */, + 6C43CCA81535039600162364 /* fficonfig_i386.h */, + 6C43CCA91535039600162364 /* ffitarget.h */, + 6C43CCAA1535039600162364 /* ffitarget_arm.h */, + 6C43CCAB1535039600162364 /* ffitarget_armv7.h */, + 6C43CCAC1535039600162364 /* ffitarget_i386.h */, + ); + path = include; + sourceTree = ""; + }; + F6B0839514721EE50031D8A1 = { + isa = PBXGroup; + children = ( + 6C43CC3D1534F7C400162364 /* src */, + 6C43CBAF1534F76F00162364 /* iOS */, + 6C43CBF01534F77800162364 /* OS X */, + F6F980C6147386260008F121 /* Products */, + ); + sourceTree = ""; + }; + F6F980C6147386260008F121 /* Products */ = { + isa = PBXGroup; + children = ( + F6F980BA147386130008F121 /* libffi.a */, + 6C43CB3D1534E9D100162364 /* libffi.a */, + ); + name = Products; + path = ../..; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 6C43CB3B1534E9D100162364 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 6C43CC971535032600162364 /* ffi.h in Headers */, + 6C43CC981535032600162364 /* ffi_common.h in Headers */, + 6C43CC991535032600162364 /* ffi_i386.h in Headers */, + 6C43CC9A1535032600162364 /* ffi_x86_64.h in Headers */, + 6C43CC9E1535032600162364 /* ffitarget.h in Headers */, + 6C43CC9F1535032600162364 /* ffitarget_i386.h in Headers */, + 6C43CCA01535032600162364 /* ffitarget_x86_64.h in Headers */, + 6C43CC9B1535032600162364 /* fficonfig.h in Headers */, + 6C43CC9C1535032600162364 /* fficonfig_i386.h in Headers */, + 6C43CC9D1535032600162364 /* fficonfig_x86_64.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F6F980B8147386130008F121 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 6C43CCAD1535039600162364 /* ffi.h in Headers */, + 6C43CCAE1535039600162364 /* ffi_armv7.h in Headers */, + 6C43CCAF1535039600162364 /* ffi_common.h in Headers */, + 6C43CCB01535039600162364 /* ffi_i386.h in Headers */, + 6C43CCB41535039600162364 /* ffitarget.h in Headers */, + 6C43CCB51535039600162364 /* ffitarget_arm.h in Headers */, + 6C43CCB61535039600162364 /* ffitarget_armv7.h in Headers */, + 6C43CCB71535039600162364 /* ffitarget_i386.h in Headers */, + 6C43CCB11535039600162364 /* fficonfig.h in Headers */, + 6C43CCB21535039600162364 /* fficonfig_armv7.h in Headers */, + 6C43CCB31535039600162364 /* fficonfig_i386.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 6C43CB3C1534E9D100162364 /* libffi OS X */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6C43CB4A1534E9D100162364 /* Build configuration list for PBXNativeTarget "libffi OS X" */; + buildPhases = ( + 6C43CC401534FF3B00162364 /* Generate Source and Headers */, + 6C43CB391534E9D100162364 /* Sources */, + 6C43CB3A1534E9D100162364 /* Frameworks */, + 6C43CB3B1534E9D100162364 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "libffi OS X"; + productName = "ffi OS X"; + productReference = 6C43CB3D1534E9D100162364 /* libffi.a */; + productType = "com.apple.product-type.library.static"; + }; + F6F980B9147386130008F121 /* libffi iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = F6F980C4147386130008F121 /* Build configuration list for PBXNativeTarget "libffi iOS" */; + buildPhases = ( + 6C43CC3E1534F8E200162364 /* Generate Trampoline */, + 6C43CC3F1534FF1B00162364 /* Generate Source and Headers */, + F6F980B6147386130008F121 /* Sources */, + F6F980B7147386130008F121 /* Frameworks */, + F6F980B8147386130008F121 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "libffi iOS"; + productName = ffi; + productReference = F6F980BA147386130008F121 /* libffi.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + F6B0839714721EE50031D8A1 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0430; + }; + buildConfigurationList = F6B0839A14721EE50031D8A1 /* Build configuration list for PBXProject "libffi" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = F6B0839514721EE50031D8A1; + productRefGroup = F6B0839514721EE50031D8A1; + projectDirPath = ""; + projectRoot = ""; + targets = ( + F6F980B9147386130008F121 /* libffi iOS */, + 6C43CB3C1534E9D100162364 /* libffi OS X */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXShellScriptBuildPhase section */ + 6C43CC3E1534F8E200162364 /* Generate Trampoline */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Generate Trampoline"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /usr/bin/python; + shellScript = "import subprocess\nimport re\nimport os\nimport errno\nimport sys\n\ndef main():\n with open('src/arm/trampoline.S', 'w') as tramp_out:\n p = subprocess.Popen(['bash', 'src/arm/gentramp.sh'], stdout=tramp_out)\n p.wait()\n\nif __name__ == '__main__':\n main()"; + }; + 6C43CC3F1534FF1B00162364 /* Generate Source and Headers */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Generate Source and Headers"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/usr/bin/python generate-ios-source-and-headers.py"; + }; + 6C43CC401534FF3B00162364 /* Generate Source and Headers */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Generate Source and Headers"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/usr/bin/python generate-osx-source-and-headers.py"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 6C43CB391534E9D100162364 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6C43CC1F1534F77800162364 /* darwin.S in Sources */, + 6C43CC201534F77800162364 /* darwin64.S in Sources */, + 6C43CC211534F77800162364 /* ffi.c in Sources */, + 6C43CC221534F77800162364 /* ffi64.c in Sources */, + 6C43CC301534F7BE00162364 /* closures.c in Sources */, + 6C43CC361534F7BE00162364 /* java_raw_api.c in Sources */, + 6C43CC381534F7BE00162364 /* prep_cif.c in Sources */, + 6C43CC3A1534F7BE00162364 /* raw_api.c in Sources */, + 6C43CC3C1534F7BE00162364 /* types.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F6F980B6147386130008F121 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6C43CBDC1534F76F00162364 /* ffi.c in Sources */, + 6C43CBDD1534F76F00162364 /* sysv.S in Sources */, + 6C43CBDE1534F76F00162364 /* trampoline.S in Sources */, + 6C43CBE61534F76F00162364 /* darwin.S in Sources */, + 6C43CBE81534F76F00162364 /* ffi.c in Sources */, + 6C43CC2F1534F7BE00162364 /* closures.c in Sources */, + 6C43CC351534F7BE00162364 /* java_raw_api.c in Sources */, + 6C43CC371534F7BE00162364 /* prep_cif.c in Sources */, + 6C43CC391534F7BE00162364 /* raw_api.c in Sources */, + 6C43CC3B1534F7BE00162364 /* types.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 6C43CB4B1534E9D100162364 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + DSTROOT = /tmp/ffi.dst; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\"", + ); + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + MACOSX_DEPLOYMENT_TARGET = 10.6; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = ffi; + SDKROOT = macosx; + }; + name = Debug; + }; + 6C43CB4C1534E9D100162364 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DSTROOT = /tmp/ffi.dst; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\"", + ); + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + MACOSX_DEPLOYMENT_TARGET = 10.6; + PRODUCT_NAME = ffi; + SDKROOT = macosx; + }; + name = Release; + }; + F6B083AB14721EE50031D8A1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VALUE = NO; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ios/include; + SDKROOT = iphoneos; + }; + name = Debug; + }; + F6B083AC14721EE50031D8A1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PREPROCESSOR_DEFINITIONS = ""; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VALUE = NO; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ios/include; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + F6F980C2147386130008F121 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + armv6, + armv7, + ); + DSTROOT = /tmp/ffi.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_THUMB_SUPPORT = NO; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = ffi; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + F6F980C3147386130008F121 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + armv6, + armv7, + ); + DSTROOT = /tmp/ffi.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_THUMB_SUPPORT = NO; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = ffi; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 6C43CB4A1534E9D100162364 /* Build configuration list for PBXNativeTarget "libffi OS X" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6C43CB4B1534E9D100162364 /* Debug */, + 6C43CB4C1534E9D100162364 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + F6B0839A14721EE50031D8A1 /* Build configuration list for PBXProject "libffi" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F6B083AB14721EE50031D8A1 /* Debug */, + F6B083AC14721EE50031D8A1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + F6F980C4147386130008F121 /* Build configuration list for PBXNativeTarget "libffi iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F6F980C2147386130008F121 /* Debug */, + F6F980C3147386130008F121 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = F6B0839714721EE50031D8A1 /* Project object */; +} diff --git a/Modules/_ctypes/libffi/libtool-ldflags b/Modules/_ctypes/libffi/libtool-ldflags new file mode 100755 --- /dev/null +++ b/Modules/_ctypes/libffi/libtool-ldflags @@ -0,0 +1,106 @@ +#! /bin/sh + +# Script to translate LDFLAGS into a form suitable for use with libtool. + +# Copyright (C) 2005 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. + +# Contributed by CodeSourcery, LLC. + +# This script is designed to be used from a Makefile that uses libtool +# to build libraries as follows: +# +# LTLDFLAGS = $(shell libtool-ldflags $(LDFLAGS)) +# +# Then, use (LTLDFLAGS) in place of $(LDFLAGS) in your link line. + +# The output of the script. This string is built up as we process the +# arguments. +result= +prev_arg= + +for arg +do + case $arg in + -f*|--*) + # Libtool does not ascribe any special meaning options + # that begin with -f or with a double-dash. So, it will + # think these options are linker options, and prefix them + # with "-Wl,". Then, the compiler driver will ignore the + # options. So, we prefix these options with -Xcompiler to + # make clear to libtool that they are in fact compiler + # options. + case $prev_arg in + -Xpreprocessor|-Xcompiler|-Xlinker) + # This option is already prefixed; don't prefix it again. + ;; + *) + result="$result -Xcompiler" + ;; + esac + ;; + *) + # We do not want to add -Xcompiler to other options because + # that would prevent libtool itself from recognizing them. + ;; + esac + prev_arg=$arg + + # If $(LDFLAGS) is (say): + # a "b'c d" e + # then the user expects that: + # $(LD) $(LDFLAGS) + # will pass three arguments to $(LD): + # 1) a + # 2) b'c d + # 3) e + # We must ensure, therefore, that the arguments are appropriately + # quoted so that using: + # libtool --mode=link ... $(LTLDFLAGS) + # will result in the same number of arguments being passed to + # libtool. In other words, when this script was invoked, the shell + # removed one level of quoting, present in $(LDFLAGS); we have to put + # it back. + + # Quote any embedded single quotes. + case $arg in + *"'"*) + # The following command creates the script: + # 1s,^X,,;s|'|'"'"'|g + # which removes a leading X, and then quotes and embedded single + # quotes. + sed_script="1s,^X,,;s|'|'\"'\"'|g" + # Add a leading "X" so that if $arg starts with a dash, + # the echo command will not try to interpret the argument + # as a command-line option. + arg="X$arg" + # Generate the quoted string. + quoted_arg=`echo "$arg" | sed -e "$sed_script"` + ;; + *) + quoted_arg=$arg + ;; + esac + # Surround the entire argument with single quotes. + quoted_arg="'"$quoted_arg"'" + + # Add it to the string. + result="$result $quoted_arg" +done + +# Output the string we have built up. +echo "$result" diff --git a/Modules/_ctypes/libffi/libtool-version b/Modules/_ctypes/libffi/libtool-version --- a/Modules/_ctypes/libffi/libtool-version +++ b/Modules/_ctypes/libffi/libtool-version @@ -26,4 +26,4 @@ # release, then set age to 0. # # CURRENT:REVISION:AGE -5:10:0 +6:1:0 diff --git a/Modules/_ctypes/libffi/ltmain.sh b/Modules/_ctypes/libffi/ltmain.sh old mode 100755 new mode 100644 --- a/Modules/_ctypes/libffi/ltmain.sh +++ b/Modules/_ctypes/libffi/ltmain.sh @@ -1,9 +1,9 @@ -# Generated from ltmain.m4sh. - -# ltmain.sh (GNU libtool) 2.2.6 + +# libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -32,50 +32,57 @@ # # Provide generalized library-building support services. # -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print informational messages (default) -# --version print version information -# -h, --help print short or long help message +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --no-quiet, --no-silent +# print informational messages (default) +# --no-warn don't display warning messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print more informational messages than default +# --no-verbose don't print the extra informational messages +# --version print version information +# -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory # -# MODE-ARGS vary depending on the MODE. +# MODE-ARGS vary depending on the MODE. When passed as first option, +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.2.6 -# automake: $automake_version -# autoconf: $autoconf_version +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.4.2 +# automake: $automake_version +# autoconf: $autoconf_version # # Report bugs to . - -PROGRAM=ltmain.sh +# GNU libtool home page: . +# General help using GNU software: . + +PROGRAM=libtool PACKAGE=libtool -VERSION=2.2.6 +VERSION=2.4.2 TIMESTAMP="" -package_revision=1.3012 +package_revision=1.3337 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then @@ -91,10 +98,15 @@ BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + # NLS nuisances: We save the old values to restore during execute mode. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES @@ -107,24 +119,28 @@ lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL $lt_unset CDPATH +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" : ${CP="cp -f"} -: ${ECHO="echo"} -: ${EGREP="/bin/grep -E"} -: ${FGREP="/bin/grep -F"} -: ${GREP="/bin/grep"} -: ${LN_S="ln -s"} +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} -: ${SED="/bin/sed"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} @@ -144,6 +160,27 @@ dirname="s,/[^/]*$,," basename="s,^.*/,," +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} # func_dirname may be replaced by extended shell implementation + + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "${1}" | $SED "$basename"` +} # func_basename may be replaced by extended shell implementation + + # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: @@ -158,33 +195,183 @@ # those functions but instead duplicate the functionality here. func_dirname_and_basename () { - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` +} # func_dirname_and_basename may be replaced by extended shell implementation + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname may be replaced by extended shell implementation + + +# These SED scripts presuppose an absolute path with a trailing slash. +pathcar='s,^/\([^/]*\).*$,\1,' +pathcdr='s,^/[^/]*,,' +removedotparts=':dotsl + s@/\./@/@g + t dotsl + s,/\.$,/,' +collapseslashes='s@/\{1,\}@/@g' +finalslash='s,/*$,/,' + +# func_normal_abspath PATH +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +# value returned in "$func_normal_abspath_result" +func_normal_abspath () +{ + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` + while :; do + # Processed it all yet? + if test "$func_normal_abspath_tpath" = / ; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result" ; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + +# func_relative_path SRCDIR DSTDIR +# generates a relative path from SRCDIR to DSTDIR, with a trailing +# slash if non-empty, suitable for immediately appending a filename +# without needing to append a separator. +# value returned in "$func_relative_path_result" +func_relative_path () +{ + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=${func_dirname_result} + if test "x$func_relative_path_tlibdir" = x ; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test "x$func_stripname_result" != x ; then + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} - -# Generated shell functions inserted here. - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" + + # Normalisation. If bindir is libdir, return empty string, + # else relative path ending with a slash; either way, target + # file name can be directly appended. + if test ! -z "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result/" + func_relative_path_result=$func_stripname_result + fi +} # The name of this program: -# In the unlikely event $progname began with a '-', it would play havoc with -# func_echo (imagine progname=-n), so we prepend ./ in that case: func_dirname_and_basename "$progpath" progname=$func_basename_result -case $progname in - -*) progname=./$progname ;; -esac # Make sure we have an absolute path for reexecution: case $progpath in @@ -196,7 +383,7 @@ ;; *) save_IFS="$IFS" - IFS=: + IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break @@ -215,6 +402,15 @@ # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' + +# Sed substitution that converts a w32 file name or path +# which contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. @@ -243,7 +439,7 @@ # name if it has been set yet. func_echo () { - $ECHO "$progname${mode+: }$mode: $*" + $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... @@ -258,18 +454,25 @@ : } +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + # func_error arg... # Echo program name prefixed message to standard error. func_error () { - $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 + $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { - $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 + $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : @@ -326,9 +529,9 @@ case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done - my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do @@ -378,7 +581,7 @@ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi - $ECHO "X$my_tmpdir" | $Xsed + $ECHO "$my_tmpdir" } @@ -392,7 +595,7 @@ { case $1 in *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac @@ -419,7 +622,7 @@ { case $1 in *[\\\`\"]*) - my_arg=`$ECHO "X$1" | $Xsed \ + my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; @@ -488,15 +691,39 @@ fi } - - +# func_tr_sh +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} # func_version # Echo version message to standard output and exit. func_version () { - $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { + $opt_debug + + $SED -n '/(C)/!b go + :more + /\./!{ + N + s/\n# / / + b more + } + :go + /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ @@ -509,22 +736,28 @@ # Echo short help message to standard output and exit. func_usage () { - $SED -n '/^# Usage:/,/# -h/ { + $opt_debug + + $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" - $ECHO + echo $ECHO "run \`$progname --help | more' for full usage" exit $? } -# func_help -# Echo long help message to standard output and exit. +# func_help [NOEXIT] +# Echo long help message to standard output and exit, +# unless 'noexit' is passed as argument. func_help () { + $opt_debug + $SED -n '/^# Usage:/,/# Report bugs to/ { + :print s/^# // s/^# *$// s*\$progname*'$progname'* @@ -534,11 +767,18 @@ s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ + s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p - }' < "$progpath" - exit $? + d + } + /^# .* home page:/b print + /^# General help using/b print + ' < "$progpath" + ret=$? + if test -z "$1"; then + exit $ret + fi } # func_missing_arg argname @@ -546,63 +786,106 @@ # exit_cmd. func_missing_arg () { - func_error "missing argument for $1" + $opt_debug + + func_error "missing argument for $1." exit_cmd=exit } + +# func_split_short_opt shortopt +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +func_split_short_opt () +{ + my_sed_short_opt='1s/^\(..\).*$/\1/;q' + my_sed_short_rest='1s/^..\(.*\)$/\1/;q' + + func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` + func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` +} # func_split_short_opt may be replaced by extended shell implementation + + +# func_split_long_opt longopt +# Set func_split_long_opt_name and func_split_long_opt_arg shell +# variables after splitting LONGOPT at the `=' sign. +func_split_long_opt () +{ + my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' + my_sed_long_arg='1s/^--[^=]*=//' + + func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` + func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` +} # func_split_long_opt may be replaced by extended shell implementation + exit_cmd=: -# Check that we have a working $ECHO. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell, and then maybe $ECHO will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null || echo $max_cmd_len` +} # func_len may be replaced by extended shell implementation + + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` +} # func_lo2o may be replaced by extended shell implementation + + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` +} # func_xform may be replaced by extended shell implementation + + # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. @@ -636,16 +919,16 @@ # Display the features supported by this script. func_features () { - $ECHO "host: $host" + echo "host: $host" if test "$build_libtool_libs" = yes; then - $ECHO "enable shared libraries" + echo "enable shared libraries" else - $ECHO "disable shared libraries" + echo "disable shared libraries" fi if test "$build_old_libs" = yes; then - $ECHO "enable static libraries" + echo "enable static libraries" else - $ECHO "disable static libraries" + echo "disable static libraries" fi exit $? @@ -692,133 +975,6 @@ esac } -# Parse options once, thoroughly. This comes as soon as possible in -# the script to make things like `libtool --version' happen quickly. -{ - - # Shorthand for --mode=foo, only valid as the first argument - case $1 in - clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; - compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; - execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; - finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; - install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; - link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; - uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; - esac - - # Parse non-mode specific arguments: - while test "$#" -gt 0; do - opt="$1" - shift - - case $opt in - --config) func_config ;; - - --debug) preserve_args="$preserve_args $opt" - func_echo "enabling shell trace mode" - opt_debug='set -x' - $opt_debug - ;; - - -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break - execute_dlfiles="$execute_dlfiles $1" - shift - ;; - - --dry-run | -n) opt_dry_run=: ;; - --features) func_features ;; - --finish) mode="finish" ;; - - --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break - case $1 in - # Valid mode arguments: - clean) ;; - compile) ;; - execute) ;; - finish) ;; - install) ;; - link) ;; - relink) ;; - uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; - esac - - mode="$1" - shift - ;; - - --preserve-dup-deps) - opt_duplicate_deps=: ;; - - --quiet|--silent) preserve_args="$preserve_args $opt" - opt_silent=: - ;; - - --verbose| -v) preserve_args="$preserve_args $opt" - opt_silent=false - ;; - - --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break - preserve_args="$preserve_args $opt $1" - func_enable_tag "$1" # tagname is set here - shift - ;; - - # Separate optargs to long options: - -dlopen=*|--mode=*|--tag=*) - func_opt_split "$opt" - set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} - shift - ;; - - -\?|-h) func_usage ;; - --help) opt_help=: ;; - --version) func_version ;; - - -*) func_fatal_help "unrecognized option \`$opt'" ;; - - *) nonopt="$opt" - break - ;; - esac - done - - - case $host in - *cygwin* | *mingw* | *pw32* | *cegcc*) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: - ;; - *) - opt_duplicate_compiler_generated_deps=$opt_duplicate_deps - ;; - esac - - # Having warned about all mis-specified options, bail out if - # anything was wrong. - $exit_cmd $EXIT_FAILURE -} - # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. @@ -855,38 +1011,219 @@ } +# Shorthand for --mode=foo, only valid as the first argument +case $1 in +clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; +compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; +execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; +finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; +install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; +link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; +uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; +esac + + + +# Option defaults: +opt_debug=: +opt_dry_run=false +opt_config=false +opt_preserve_dup_deps=false +opt_features=false +opt_finish=false +opt_help=false +opt_help_all=false +opt_silent=: +opt_warning=: +opt_verbose=: +opt_silent=false +opt_verbose=false + + +# Parse options once, thoroughly. This comes as soon as possible in the +# script to make things like `--version' happen as quickly as we can. +{ + # this just eases exit handling + while test $# -gt 0; do + opt="$1" + shift + case $opt in + --debug|-x) opt_debug='set -x' + func_echo "enabling shell trace mode" + $opt_debug + ;; + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + --config) + opt_config=: +func_config + ;; + --dlopen|-dlopen) + optarg="$1" + opt_dlopen="${opt_dlopen+$opt_dlopen +}$optarg" + shift + ;; + --preserve-dup-deps) + opt_preserve_dup_deps=: + ;; + --features) + opt_features=: +func_features + ;; + --finish) + opt_finish=: +set dummy --mode finish ${1+"$@"}; shift + ;; + --help) + opt_help=: + ;; + --help-all) + opt_help_all=: +opt_help=': help-all' + ;; + --mode) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_mode="$optarg" +case $optarg in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; +esac + shift + ;; + --no-silent|--no-quiet) + opt_silent=false +func_append preserve_args " $opt" + ;; + --no-warning|--no-warn) + opt_warning=false +func_append preserve_args " $opt" + ;; + --no-verbose) + opt_verbose=false +func_append preserve_args " $opt" + ;; + --silent|--quiet) + opt_silent=: +func_append preserve_args " $opt" + opt_verbose=false + ;; + --verbose|-v) + opt_verbose=: +func_append preserve_args " $opt" +opt_silent=false + ;; + --tag) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_tag="$optarg" +func_append preserve_args " $opt $optarg" +func_enable_tag "$optarg" + shift + ;; + + -\?|-h) func_usage ;; + --help) func_help ;; + --version) func_version ;; + + # Separate optargs to long options: + --*=*) + func_split_long_opt "$opt" + set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-n*|-v*) + func_split_short_opt "$opt" + set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognized option \`$opt'" ;; + *) set dummy "$opt" ${1+"$@"}; shift; break ;; + esac + done + + # Validate options: + + # save first non-option argument + if test "$#" -gt 0; then + nonopt="$opt" + shift + fi + + # preserve --debug + test "$opt_debug" = : || func_append preserve_args " --debug" + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test "$opt_mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$opt_mode' for more information." + } + + + # Bail if the options were screwed + $exit_cmd $EXIT_FAILURE +} + + + + ## ----------- ## ## Main. ## ## ----------- ## -$opt_help || { - # Sanity checks first: - func_check_version_match - - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi - - test -z "$mode" && func_fatal_error "error: you must specify a MODE." - - - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" - - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$mode' for more information." -} - - # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out @@ -950,12 +1287,9 @@ # temporary ltwrapper_script. func_ltwrapper_scriptname () { - func_ltwrapper_scriptname_result="" - if func_ltwrapper_executable_p "$1"; then - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" - fi + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file @@ -1001,6 +1335,37 @@ } +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case "$lt_sysroot:$1" in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result="=$func_stripname_result" + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. @@ -1013,13 +1378,15 @@ if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" + func_append_quoted CC_quoted "$arg" done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) @@ -1030,11 +1397,13 @@ CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" + func_append_quoted CC_quoted "$arg" done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in - " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. @@ -1097,6 +1466,486 @@ } } + +################################################## +# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # +################################################## + +# func_convert_core_file_wine_to_w32 ARG +# Helper function used by file name conversion functions when $build is *nix, +# and $host is mingw, cygwin, or some other w32 environment. Relies on a +# correctly configured wine environment available, with the winepath program +# in $build's $PATH. +# +# ARG is the $build file name to be converted to w32 format. +# Result is available in $func_convert_core_file_wine_to_w32_result, and will +# be empty on error (or when ARG is empty) +func_convert_core_file_wine_to_w32 () +{ + $opt_debug + func_convert_core_file_wine_to_w32_result="$1" + if test -n "$1"; then + # Unfortunately, winepath does not exit with a non-zero error code, so we + # are forced to check the contents of stdout. On the other hand, if the + # command is not found, the shell will set an exit code of 127 and print + # *an error message* to stdout. So we must check for both error code of + # zero AND non-empty stdout, which explains the odd construction: + func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` + if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$lt_sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $opt_debug + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result="" + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result" ; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $opt_debug + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $opt_debug + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $opt_debug + if test -z "$2" && test -n "$1" ; then + func_error "Could not determine host file name corresponding to" + func_error " \`$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result="$1" + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $opt_debug + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " \`$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result="$3" + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $opt_debug + case $4 in + $1 ) func_to_host_path_result="$3$func_to_host_path_result" + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via `$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $opt_debug + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $opt_debug + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result="$1" +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result="$func_convert_core_msys_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via `$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $opt_debug + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd="func_convert_path_${func_stripname_result}" + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $opt_debug + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result="$1" +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_msys_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + # func_mode_compile arg... func_mode_compile () { @@ -1137,12 +1986,12 @@ ;; -pie | -fpie | -fPIE) - pie_flag="$pie_flag $arg" + func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) - later="$later $arg" + func_append later " $arg" continue ;; @@ -1163,15 +2012,14 @@ save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" - func_quote_for_eval "$arg" - lastarg="$lastarg $func_quote_for_eval_result" + func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. - base_compile="$base_compile $lastarg" + func_append base_compile " $lastarg" continue ;; @@ -1187,8 +2035,7 @@ esac # case $arg_mode # Aesthetically quote the previous argument. - func_quote_for_eval "$lastarg" - base_compile="$base_compile $func_quote_for_eval_result" + func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in @@ -1213,7 +2060,7 @@ *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ - *.[fF][09]? | *.for | *.java | *.obj | *.sx) + *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; @@ -1288,7 +2135,7 @@ # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then - output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= @@ -1319,17 +2166,16 @@ $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi - removelist="$removelist $output_obj" + func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist - removelist="$removelist $lockfile" + func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result @@ -1349,7 +2195,7 @@ if test -z "$output_obj"; then # Place PIC objects in $objdir - command="$command -o $lobj" + func_append command " -o $lobj" fi func_show_eval_locale "$command" \ @@ -1396,11 +2242,11 @@ command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then - command="$command -o $obj" + func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" + func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' @@ -1445,13 +2291,13 @@ } $opt_help || { -test "$mode" = compile && func_mode_compile ${1+"$@"} + test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. - case $mode in + case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. @@ -1482,10 +2328,11 @@ -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. @@ -1538,7 +2385,7 @@ The following components of INSTALL-COMMAND are treated specially: - -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." @@ -1558,6 +2405,8 @@ -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) @@ -1586,6 +2435,11 @@ -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. @@ -1619,18 +2473,44 @@ ;; *) - func_fatal_help "invalid operation mode \`$mode'" + func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac - $ECHO + echo $ECHO "Try \`$progname --help' for more information about other modes." - - exit $? -} - - # Now that we've collected a possible --mode arg, show help if necessary - $opt_help && func_mode_help +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test "$opt_help" = :; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | sed -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + sed '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi # func_mode_execute arg... @@ -1643,13 +2523,16 @@ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do + for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" @@ -1671,7 +2554,7 @@ dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" + func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" @@ -1712,7 +2595,7 @@ for file do case $file in - -*) ;; + -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then @@ -1728,8 +2611,7 @@ ;; esac # Quote arguments (to preserve shell metacharacters). - func_quote_for_eval "$file" - args="$args $func_quote_for_eval_result" + func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then @@ -1754,29 +2636,66 @@ # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - $ECHO "export $shlibpath_var" + echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } -test "$mode" = execute && func_mode_execute ${1+"$@"} +test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug - libdirs="$nonopt" + libs= + libdirs= admincmds= + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "\`$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument \`$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and \`=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. @@ -1786,7 +2705,7 @@ if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || admincmds="$admincmds + $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done @@ -1795,53 +2714,55 @@ # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS - $ECHO "X----------------------------------------------------------------------" | $Xsed - $ECHO "Libraries have been installed in:" - for libdir in $libdirs; do - $ECHO " $libdir" - done - $ECHO - $ECHO "If you ever happen to want to link against installed libraries" - $ECHO "in a given directory, LIBDIR, you must either use libtool, and" - $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" - $ECHO "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" - $ECHO " during execution" + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" fi - if test -n "$runpath_var"; then - $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" - $ECHO " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $ECHO " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $ECHO " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - $ECHO - - $ECHO "See any operating system documentation about shared libraries for" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" - $ECHO "pages." - ;; - *) - $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - $ECHO "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS } -test "$mode" = finish && func_mode_finish ${1+"$@"} +test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... @@ -1852,7 +2773,7 @@ # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. - $ECHO "X$nonopt" | $GREP shtool >/dev/null; then + case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " @@ -1866,7 +2787,12 @@ # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" - install_prog="$install_prog$func_quote_for_eval_result" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac # We need to accept at least all the BSD install flags. dest= @@ -1876,10 +2802,12 @@ install_type= isdir=no stripme= + no_mode=: for arg do + arg2= if test -n "$dest"; then - files="$files $dest" + func_append files " $dest" dest=$arg continue fi @@ -1887,10 +2815,9 @@ case $arg in -d) isdir=yes ;; -f) - case " $install_prog " in - *[\\\ /]cp\ *) ;; - *) prev=$arg ;; - esac + if $install_cp; then :; else + prev=$arg + fi ;; -g | -m | -o) prev=$arg @@ -1904,6 +2831,10 @@ *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then + if test "x$prev" = x-m && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi prev= else dest=$arg @@ -1914,7 +2845,11 @@ # Aesthetically quote the argument. func_quote_for_eval "$arg" - install_prog="$install_prog $func_quote_for_eval_result" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ @@ -1923,6 +2858,13 @@ test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" @@ -1977,10 +2919,13 @@ case $file in *.$libext) # Do the static libraries later. - staticlibs="$staticlibs $file" + func_append staticlibs " $file" ;; *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" @@ -1994,23 +2939,23 @@ if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; + *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; + *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" - dir="$dir$objdir" + func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that @@ -2023,9 +2968,9 @@ if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else - relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" @@ -2043,7 +2988,7 @@ test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. - func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in @@ -2083,7 +3028,7 @@ func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) @@ -2183,7 +3128,7 @@ if test -f "$lib"; then func_source "$lib" fi - libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no @@ -2202,7 +3147,7 @@ file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. - relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" @@ -2221,7 +3166,7 @@ } else # Install the binary that we compiled earlier. - file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi @@ -2257,11 +3202,13 @@ # Set up the ranlib parameters. oldlib="$destdir/$name" + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then - func_show_eval "$old_striplib $oldlib" 'exit $?' + func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. @@ -2280,7 +3227,7 @@ fi } -test "$mode" = install && func_mode_install ${1+"$@"} +test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p @@ -2323,6 +3270,22 @@ extern \"C\" { #endif +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + /* External symbol declarations for the compiler. */\ " @@ -2332,10 +3295,11 @@ $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. - progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do - func_verbose "extracting global C symbols from \`$progfile'" - $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then @@ -2371,7 +3335,7 @@ eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in - *cygwin | *mingw* | *cegcc* ) + *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; @@ -2384,10 +3348,52 @@ func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename="" + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname" ; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename="$func_basename_result" + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename" ; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac done $opt_dry_run || { @@ -2415,36 +3421,19 @@ if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else - $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi - $ECHO >> "$output_objdir/$my_dlsyms" "\ + echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; -" - case $host in - *cygwin* | *mingw* | *cegcc* ) - $ECHO >> "$output_objdir/$my_dlsyms" "\ -/* DATA imports from DLLs on WIN32 con't be const, because - runtime relocations are performed -- see ld's documentation - on pseudo-relocs. */" - lt_dlsym_const= ;; - *osf5*) - echo >> "$output_objdir/$my_dlsyms" "\ -/* This system does not cope well with relocations in const data */" - lt_dlsym_const= ;; - *) - lt_dlsym_const=const ;; - esac - - $ECHO >> "$output_objdir/$my_dlsyms" "\ -extern $lt_dlsym_const lt_dlsymlist +extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; -$lt_dlsym_const lt_dlsymlist +LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," @@ -2457,7 +3446,7 @@ eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac - $ECHO >> "$output_objdir/$my_dlsyms" "\ + echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; @@ -2484,7 +3473,7 @@ # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; @@ -2500,7 +3489,7 @@ for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; - *) symtab_cflags="$symtab_cflags $arg" ;; + *) func_append symtab_cflags " $arg" ;; esac done @@ -2515,16 +3504,16 @@ case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; @@ -2538,8 +3527,8 @@ # really was required. # Nullify the symbol file. - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } @@ -2549,6 +3538,7 @@ # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug @@ -2559,9 +3549,11 @@ win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ @@ -2590,6 +3582,131 @@ $ECHO "$win32_libid_type" } +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $opt_debug + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $opt_debug + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive which possess that section. Heuristic: eliminate + # all those which have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $opt_debug + if func_cygming_gnu_implib_p "$1" ; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1" ; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result="" + fi +} # func_extract_an_archive dir oldlib @@ -2598,7 +3715,18 @@ $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' + if test "$lock_old_archive_extraction" = yes; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test "$lock_old_archive_extraction" = yes; then + $opt_dry_run || rm -f "$lockfile" + fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else @@ -2669,7 +3797,7 @@ darwin_file= darwin_files= for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ @@ -2684,248 +3812,13 @@ func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } - -# func_emit_wrapper_part1 [arg=no] -# -# Emit the first part of a libtool wrapper script on stdout. -# For more information, see the description associated with -# func_emit_wrapper(), below. -func_emit_wrapper_part1 () -{ - func_emit_wrapper_part1_arg1=no - if test -n "$1" ; then - func_emit_wrapper_part1_arg1=$1 - fi - - $ECHO "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# Be Bourne compatible -if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: - generated_by_libtool_version='$macro_version' - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$ECHO are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - ECHO=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$ECHO works! - : - else - # Restart under the correct shell, and then maybe \$ECHO will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $ECHO "\ - - # Find the directory that this script lives in. - thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` - done -" -} -# end: func_emit_wrapper_part1 - -# func_emit_wrapper_part2 [arg=no] -# -# Emit the second part of a libtool wrapper script on stdout. -# For more information, see the description associated with -# func_emit_wrapper(), below. -func_emit_wrapper_part2 () -{ - func_emit_wrapper_part2_arg1=no - if test -n "$1" ; then - func_emit_wrapper_part2_arg1=$1 - fi - - $ECHO "\ - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 - if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then - # special case for '.' - if test \"\$thisdir\" = \".\"; then - thisdir=\`pwd\` - fi - # remove .libs from thisdir - case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; - $objdir ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $ECHO "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $MKDIR \"\$progdir\" - else - $RM \"\$progdir/\$file\" - fi" - - $ECHO "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $ECHO \"\$relink_command_output\" >&2 - $RM \"\$progdir/\$file\" - exit 1 - fi - fi - - $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $RM \"\$progdir/\$program\"; - $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $RM \"\$progdir/\$file\" - fi" - else - $ECHO "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $ECHO "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $ECHO "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $ECHO "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 - fi - else - # The program doesn't exist. - \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 - $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" -} -# end: func_emit_wrapper_part2 - - # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. @@ -2942,188 +3835,301 @@ # behavior. func_emit_wrapper () { - func_emit_wrapper_arg1=no - if test -n "$1" ; then - func_emit_wrapper_arg1=$1 - fi - - # split this up so that func_emit_cwrapperexe_src - # can call each part independently. - func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" - func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" -} - - -# func_to_host_path arg + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # -# Convert paths to host format when used with build tools. -# Intended for use with "native" mingw (where libtool itself -# is running under the msys shell), or in the following cross- -# build environments: -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# where wine is equipped with the `winepath' executable. -# In the native mingw case, the (msys) shell automatically -# converts paths for any non-msys applications it launches, -# but that facility isn't available from inside the cwrapper. -# Similar accommodations are necessary for $host mingw and -# $build cygwin. Calling this function does no harm for other -# $host/$build combinations not listed above. +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. # -# ARG is the path (on $build) that should be converted to -# the proper representation for $host. The result is stored -# in $func_to_host_path_result. -func_to_host_path () -{ - func_to_host_path_result="$1" - if test -n "$1" ; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - case $build in - *mingw* ) # actually, msys - # awkward: cmd appends spaces to result - lt_sed_strip_trailing_spaces="s/[ ]*\$//" - func_to_host_path_tmp1=`( cmd //c echo "$1" |\ - $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_path_tmp1=`cygpath -w "$1"` - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # Unfortunately, winepath does not exit with a non-zero - # error code, so we are forced to check the contents of - # stdout. On the other hand, if the command is not - # found, the shell will set an exit code of 127 and print - # *an error message* to stdout. So we must check for both - # error code of zero AND non-empty stdout, which explains - # the odd construction: - func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` - if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` - else - # Allow warning below. - func_to_host_path_result="" - fi - ;; - esac - if test -z "$func_to_host_path_result" ; then - func_error "Could not determine host path corresponding to" - func_error " '$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_path_result="$1" - fi - ;; +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ which is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options which match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + case \" \$* \" in + *\\ --lt-*) + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done ;; + esac + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; esac fi -} -# end: func_to_host_path - -# func_to_host_pathlist arg -# -# Convert pathlists to host format when used with build tools. -# See func_to_host_path(), above. This function supports the -# following $build/$host combinations (but does no harm for -# combinations not listed here): -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# -# Path separators are also converted from $build format to -# $host format. If ARG begins or ends with a path separator -# character, it is preserved (but converted to $host format) -# on output. -# -# ARG is a pathlist (on $build) that should be converted to -# the proper representation on $host. The result is stored -# in $func_to_host_pathlist_result. -func_to_host_pathlist () -{ - func_to_host_pathlist_result="$1" - if test -n "$1" ; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_to_host_pathlist_tmp2="$1" - # Once set for this call, this variable should not be - # reassigned. It is used in tha fallback case. - func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e 's|^:*||' -e 's|:*$||'` - case $build in - *mingw* ) # Actually, msys. - # Awkward: cmd appends spaces to result. - lt_sed_strip_trailing_spaces="s/[ ]*\$//" - func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ - $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # unfortunately, winepath doesn't convert pathlists - func_to_host_pathlist_result="" - func_to_host_pathlist_oldIFS=$IFS - IFS=: - for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do - IFS=$func_to_host_pathlist_oldIFS - if test -n "$func_to_host_pathlist_f" ; then - func_to_host_path "$func_to_host_pathlist_f" - if test -n "$func_to_host_path_result" ; then - if test -z "$func_to_host_pathlist_result" ; then - func_to_host_pathlist_result="$func_to_host_path_result" - else - func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" - fi - fi - fi - IFS=: - done - IFS=$func_to_host_pathlist_oldIFS - ;; - esac - if test -z "$func_to_host_pathlist_result" ; then - func_error "Could not determine the host path(s) corresponding to" - func_error " '$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This may break if $1 contains DOS-style drive - # specifications. The fix is not to complicate the expression - # below, but for the user to provide a working wine installation - # with winepath so that path translation in the cross-to-mingw - # case works properly. - lt_replace_pathsep_nix_to_dos="s|:|;|g" - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ - $SED -e "$lt_replace_pathsep_nix_to_dos"` - fi - # Now, add the leading and trailing path separators back - case "$1" in - :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" - ;; - esac - case "$1" in - *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" - ;; - esac - ;; - esac + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 fi -} -# end: func_to_host_pathlist +fi\ +" +} + # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout @@ -3141,31 +4147,23 @@ This wrapper executable should never be moved out of the build directory. If it is, it will not operate correctly. - - Currently, it simply execs the wrapper *script* "$SHELL $output", - but could eventually absorb all of the scripts functionality and - exec $objdir/$outputname directly. */ EOF cat <<"EOF" +#ifdef _MSC_VER +# define _CRT_SECURE_NO_DEPRECATE 1 +#endif #include #include #ifdef _MSC_VER # include # include # include -# define setmode _setmode #else # include # include # ifdef __CYGWIN__ # include -# define HAVE_SETENV -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif # endif #endif #include @@ -3177,6 +4175,44 @@ #include #include +/* declarations of non-ANSI functions */ +#if defined(__MINGW32__) +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined(__CYGWIN__) +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined (other platforms) ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined(_MSC_VER) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +# ifndef _INTPTR_T_DEFINED +# define _INTPTR_T_DEFINED +# define intptr_t int +# endif +#elif defined(__MINGW32__) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined(__CYGWIN__) +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined (other platforms) ... */ +#endif + #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) @@ -3192,14 +4228,7 @@ # define S_IXGRP 0 #endif -#ifdef _MSC_VER -# define S_IXUSR _S_IEXEC -# define stat _stat -# ifndef _INTPTR_T_DEFINED -# define intptr_t int -# endif -#endif - +/* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' @@ -3230,10 +4259,6 @@ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ -#ifdef __CYGWIN__ -# define FOPEN_WB "wb" -#endif - #ifndef FOPEN_WB # define FOPEN_WB "w" #endif @@ -3246,22 +4271,13 @@ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) -#undef LTWRAPPER_DEBUGPRINTF -#if defined DEBUGWRAPPER -# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args -static void -ltwrapper_debugprintf (const char *fmt, ...) -{ - va_list args; - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); -} +#if defined(LT_DEBUGWRAPPER) +static int lt_debug = 1; #else -# define LTWRAPPER_DEBUGPRINTF(args) +static int lt_debug = 0; #endif -const char *program_name = NULL; +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); @@ -3271,41 +4287,27 @@ int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); -void lt_fatal (const char *message, ...); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); -void lt_opt_process_env_set (const char *arg); -void lt_opt_process_env_prepend (const char *arg); -void lt_opt_process_env_append (const char *arg); -int lt_split_name_value (const char *arg, char** name, char** value); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); - -static const char *script_text_part1 = +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); EOF - func_emit_wrapper_part1 yes | - $SED -e 's/\([\\"]\)/\\\1/g' \ - -e 's/^/ "/' -e 's/$/\\n"/' - echo ";" cat <"))); + + lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", + nonnull (lt_argv_zero)); for (i = 0; i < newargc; i++) { - LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); + lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", + i, nonnull (newargz[i])); } EOF @@ -3560,11 +4523,14 @@ mingw*) cat <<"EOF" /* execv doesn't actually work on mingw as expected on unix */ + newargz = prepare_spawn (newargz); rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); if (rval == -1) { /* failed to start process */ - LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); + lt_debugprintf (__FILE__, __LINE__, + "(main) failed to launch target \"%s\": %s\n", + lt_argv_zero, nonnull (strerror (errno))); return 127; } return rval; @@ -3586,7 +4552,7 @@ { void *p = (void *) malloc (num); if (!p) - lt_fatal ("Memory exhausted"); + lt_fatal (__FILE__, __LINE__, "memory exhausted"); return p; } @@ -3620,8 +4586,8 @@ { struct stat st; - LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", - path ? (*path ? path : "EMPTY!") : "NULL!")); + lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", + nonempty (path)); if ((!path) || (!*path)) return 0; @@ -3638,8 +4604,8 @@ int rval = 0; struct stat st; - LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", - path ? (*path ? path : "EMPTY!") : "NULL!")); + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); if ((!path) || (!*path)) return 0; @@ -3665,8 +4631,8 @@ int tmp_len; char *concat_name; - LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", - wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; @@ -3719,7 +4685,8 @@ { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); @@ -3744,7 +4711,8 @@ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); @@ -3770,8 +4738,9 @@ int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { - LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", - tmp_pathspec)); + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) @@ -3793,8 +4762,9 @@ } else { - char *errstr = strerror (errno); - lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); @@ -3807,7 +4777,8 @@ tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { - lt_fatal ("Could not follow symlinks for %s", pathspec); + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif @@ -3833,11 +4804,25 @@ return str; } +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + static void -lt_error_core (int exit_status, const char *mode, +lt_error_core (int exit_status, const char *file, + int line, const char *mode, const char *message, va_list ap) { - fprintf (stderr, "%s: %s: ", program_name, mode); + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); @@ -3846,20 +4831,32 @@ } void -lt_fatal (const char *message, ...) +lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + void lt_setenv (const char *name, const char *value) { - LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", - (name ? name : ""), - (value ? value : ""))); + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ @@ -3904,95 +4901,12 @@ return new_value; } -int -lt_split_name_value (const char *arg, char** name, char** value) -{ - const char *p; - int len; - if (!arg || !*arg) - return 1; - - p = strchr (arg, (int)'='); - - if (!p) - return 1; - - *value = xstrdup (++p); - - len = strlen (arg) - strlen (*value); - *name = XMALLOC (char, len); - strncpy (*name, arg, len-1); - (*name)[len - 1] = '\0'; - - return 0; -} - -void -lt_opt_process_env_set (const char *arg) -{ - char *name = NULL; - char *value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); - } - - lt_setenv (name, value); - XFREE (name); - XFREE (value); -} - -void -lt_opt_process_env_prepend (const char *arg) -{ - char *name = NULL; - char *value = NULL; - char *new_value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); - } - - new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - XFREE (name); - XFREE (value); -} - -void -lt_opt_process_env_append (const char *arg) -{ - char *name = NULL; - char *value = NULL; - char *new_value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); - } - - new_value = lt_extend_str (getenv (name), value, 1); - lt_setenv (name, new_value); - XFREE (new_value); - XFREE (name); - XFREE (value); -} - void lt_update_exe_path (const char *name, const char *value) { - LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - (name ? name : ""), - (value ? value : ""))); + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); if (name && *name && value && *value) { @@ -4011,9 +4925,9 @@ void lt_update_lib_path (const char *name, const char *value) { - LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - (name ? name : ""), - (value ? value : ""))); + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); if (name && *name && value && *value) { @@ -4023,11 +4937,158 @@ } } - EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -n -e ' +s/^\(.\{79\}\)\(..*\)/\1\ +\2/ +h +s/\([\\"]\)/\\\1/g +s/$/\\n/ +s/\([^\n]*\).*/ fputs ("\1", f);/p +g +D' + cat <<"EOF" +} +EOF } # end: func_emit_cwrapperexe_src +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $opt_debug + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + # func_mode_link arg... func_mode_link () { @@ -4072,6 +5133,7 @@ new_inherited_linker_flags= avoid_version=no + bindir= dlfiles= dlprefiles= dlself=no @@ -4164,6 +5226,11 @@ esac case $prev in + bindir) + bindir="$arg" + prev= + continue + ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. @@ -4195,9 +5262,9 @@ ;; *) if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" + func_append dlfiles " $arg" else - dlprefiles="$dlprefiles $arg" + func_append dlprefiles " $arg" fi prev= continue @@ -4221,7 +5288,7 @@ *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; - *) deplibs="$deplibs $qarg.ltframework" # this is fixed later + *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; @@ -4240,7 +5307,7 @@ moreargs= for fil in `cat "$save_arg"` do -# moreargs="$moreargs $fil" +# func_append moreargs " $fil" arg=$fil # A libtool-controlled object. @@ -4269,7 +5336,7 @@ if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" + func_append dlfiles " $pic_object" prev= continue else @@ -4281,7 +5348,7 @@ # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" + func_append dlprefiles " $pic_object" prev= fi @@ -4351,12 +5418,12 @@ if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; - *) rpath="$rpath $arg" ;; + *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; + *) func_append xrpath " $arg" ;; esac fi prev= @@ -4368,28 +5435,28 @@ continue ;; weak) - weak_libs="$weak_libs $arg" + func_append weak_libs " $arg" prev= continue ;; xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) - compiler_flags="$compiler_flags $qarg" + func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" @@ -4425,6 +5492,11 @@ continue ;; + -bindir) + prev=bindir + continue + ;; + -dlopen) prev=dlfiles continue @@ -4475,15 +5547,16 @@ ;; -L*) - func_stripname '-L' '' "$arg" - dir=$func_stripname_result - if test -z "$dir"; then + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; @@ -4495,24 +5568,30 @@ ;; esac case "$deplibs " in - *" -L$dir "*) ;; + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; - *) dllsearchpath="$dllsearchpath:$dir";; + *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; + *) func_append dllsearchpath ":$testbindir";; esac ;; esac @@ -4522,7 +5601,7 @@ -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; @@ -4536,7 +5615,7 @@ ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs System.ltframework" + func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) @@ -4556,7 +5635,7 @@ ;; esac fi - deplibs="$deplibs $arg" + func_append deplibs " $arg" continue ;; @@ -4568,21 +5647,22 @@ # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot) - compiler_flags="$compiler_flags $arg" + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - compiler_flags="$compiler_flags $arg" + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; + * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; @@ -4649,13 +5729,17 @@ # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; + *) func_append xrpath " $dir" ;; esac continue ;; @@ -4708,8 +5792,8 @@ for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" - arg="$arg $wl$func_quote_for_eval_result" - compiler_flags="$compiler_flags $func_quote_for_eval_result" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" @@ -4724,9 +5808,9 @@ for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" - arg="$arg $wl$func_quote_for_eval_result" - compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" - linker_flags="$linker_flags $func_quote_for_eval_result" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" @@ -4754,23 +5838,27 @@ arg="$func_quote_for_eval_result" ;; - # -64, -mips[0-9] enable 64-bit mode on the SGI compiler - # -r[0-9][0-9]* specifies the processor on the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler - # +DA*, +DD* enable 64-bit mode on the HP compiler - # -q* pass through compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* pass through architecture-specific - # compiler args for GCC - # -F/path gives path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC - # @file GCC response files + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" - compiler_flags="$compiler_flags $arg" + func_append compiler_flags " $arg" continue ;; @@ -4782,7 +5870,7 @@ *.$objext) # A standard object. - objs="$objs $arg" + func_append objs " $arg" ;; *.lo) @@ -4813,7 +5901,7 @@ if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" + func_append dlfiles " $pic_object" prev= continue else @@ -4825,7 +5913,7 @@ # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" + func_append dlprefiles " $pic_object" prev= fi @@ -4870,24 +5958,25 @@ *.$libext) # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" + func_append deplibs " $arg" + func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. + func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" + func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" + func_append dlprefiles " $func_resolve_sysroot_result" prev= else - deplibs="$deplibs $arg" + func_append deplibs " $func_resolve_sysroot_result" fi continue ;; @@ -4925,7 +6014,7 @@ if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi @@ -4934,6 +6023,8 @@ func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" @@ -4954,12 +6045,12 @@ # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do - if $opt_duplicate_deps ; then + if $opt_preserve_dup_deps ; then case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi - libs="$libs $deplib" + func_append libs " $deplib" done if test "$linkmode" = lib; then @@ -4972,9 +6063,9 @@ if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac - pre_post_deps="$pre_post_deps $pre_post_dep" + func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= @@ -5041,17 +6132,19 @@ for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= + func_resolve_sysroot "$lib" case $lib in - *.la) func_source "$lib" ;; + *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do - deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` + func_basename "$deplib" + deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; - *) deplibs="$deplibs $deplib" ;; + *) func_append deplibs " $deplib" ;; esac done done @@ -5067,16 +6160,17 @@ lib= found=no case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else - compiler_flags="$compiler_flags $deplib" + func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi @@ -5161,7 +6255,7 @@ if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi @@ -5174,7 +6268,8 @@ test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then @@ -5188,7 +6283,8 @@ finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" @@ -5199,17 +6295,21 @@ -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" - dir=$func_stripname_result + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; + *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; - *.la) lib="$deplib" ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" @@ -5227,7 +6327,7 @@ match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi @@ -5237,15 +6337,15 @@ ;; esac if test "$valid_a_lib" != yes; then - $ECHO + echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because the file extensions .$libext of this argument makes me believe" - $ECHO "*** that it is just a static archive that I should not use here." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." else - $ECHO + echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" @@ -5272,11 +6372,11 @@ if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. - newdlprefiles="$newdlprefiles $deplib" + func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else - newdlfiles="$newdlfiles $deplib" + func_append newdlfiles " $deplib" fi fi continue @@ -5318,20 +6418,20 @@ # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; - *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi - dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then @@ -5342,20 +6442,20 @@ func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" - if $opt_duplicate_deps ; then + if $opt_preserve_dup_deps ; then case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi - tmp_libs="$tmp_libs $deplib" + func_append tmp_libs " $deplib" done continue fi # $pass = conv @@ -5363,9 +6463,15 @@ # Get the name of the library we link against. linklib= - for l in $old_library $library_names; do - linklib="$l" - done + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || + test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi @@ -5382,9 +6488,9 @@ # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" + func_append dlprefiles " $lib $dependency_libs" else - newdlfiles="$newdlfiles $lib" + func_append newdlfiles " $lib" fi continue fi # $pass = dlopen @@ -5406,14 +6512,14 @@ # Find the relevant object directory and library name. if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else - dir="$libdir" - absdir="$libdir" + dir="$lt_sysroot$libdir" + absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else @@ -5421,12 +6527,12 @@ dir="$ladir" absdir="$abs_ladir" # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" @@ -5437,20 +6543,46 @@ if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi + case "$host" in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac fi # $pass = dlpreopen if test -z "$libdir"; then @@ -5468,7 +6600,7 @@ if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" + func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no @@ -5481,7 +6613,8 @@ for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? @@ -5492,12 +6625,12 @@ # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi - if $opt_duplicate_deps ; then + if $opt_preserve_dup_deps ; then case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi - tmp_libs="$tmp_libs $deplib" + func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... @@ -5512,7 +6645,7 @@ # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; - *) temp_rpath="$temp_rpath$absdir:" ;; + *) func_append temp_rpath "$absdir:" ;; esac fi @@ -5524,7 +6657,7 @@ *) case "$compile_rpath " in *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" + *) func_append compile_rpath " $absdir" ;; esac ;; esac @@ -5533,7 +6666,7 @@ *) case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" + *) func_append finalize_rpath " $libdir" ;; esac ;; esac @@ -5558,12 +6691,12 @@ case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded - notinst_deplibs="$notinst_deplibs $lib" + func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" + func_append notinst_deplibs " $lib" need_relink=yes fi ;; @@ -5580,7 +6713,7 @@ fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - $ECHO + echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else @@ -5598,7 +6731,7 @@ *) case "$compile_rpath " in *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" + *) func_append compile_rpath " $absdir" ;; esac ;; esac @@ -5607,7 +6740,7 @@ *) case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" + *) func_append finalize_rpath " $libdir" ;; esac ;; esac @@ -5661,7 +6794,7 @@ linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" - if test "$linkmode" = prog || test "$mode" != relink; then + if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= @@ -5683,9 +6816,9 @@ if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then - $ECHO - $ECHO "*** And there doesn't seem to be a static archive available" - $ECHO "*** The link will probably fail, sorry" + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi @@ -5712,12 +6845,12 @@ test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" + add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" + func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi @@ -5739,7 +6872,7 @@ if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then @@ -5753,13 +6886,13 @@ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi - if test "$linkmode" = prog || test "$mode" = relink; then + if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= @@ -5773,7 +6906,7 @@ elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then @@ -5790,7 +6923,7 @@ if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" + func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi @@ -5825,21 +6958,21 @@ # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - $ECHO + echo $ECHO "*** Warning: This system can not link to static lib archive $lib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then - $ECHO "*** But as you try to build a module library, libtool will still create " - $ECHO "*** a static module, that should work as long as the dlopening application" - $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - $ECHO - $ECHO "*** However, this would only work if libtool was able to extract symbol" - $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" - $ECHO "*** not find such a program. So, this module is probably useless." - $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module @@ -5867,37 +7000,46 @@ temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; + *) func_append xrpath " $temp_xrpath";; esac;; - *) temp_deplibs="$temp_deplibs $libdir";; + *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi - newlib_search_path="$newlib_search_path $absdir" + func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" - if $opt_duplicate_deps ; then + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps ; then case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi - tmp_libs="$tmp_libs $deplib" + func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do + path= case $deplib in -L*) path="$deplib" ;; *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." - dir="$func_dirname_result" + dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; @@ -5924,8 +7066,8 @@ if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi - compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" + func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi @@ -5958,7 +7100,7 @@ compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else - compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" @@ -5975,7 +7117,7 @@ for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; + *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= @@ -6033,10 +7175,10 @@ -L*) case " $tmp_libs " in *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; + *) func_append tmp_libs " $deplib" ;; esac ;; - *) tmp_libs="$tmp_libs $deplib" ;; + *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" @@ -6052,7 +7194,7 @@ ;; esac if test -n "$i" ; then - tmp_libs="$tmp_libs $i" + func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs @@ -6093,7 +7235,7 @@ # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" - objs="$objs$old_deplibs" + func_append objs "$old_deplibs" ;; lib) @@ -6126,10 +7268,10 @@ if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else - $ECHO + echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" - libobjs="$libobjs $objs" + func_append libobjs " $objs" fi fi @@ -6188,13 +7330,14 @@ # which has an extra 1 added just for fun # case $version_type in + # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; - freebsd-aout|freebsd-elf|sunos) + freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" @@ -6304,7 +7447,7 @@ versuffix="$major.$revision" ;; - linux) + linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" @@ -6327,7 +7470,7 @@ done # Make executables depend on our current version. - verstring="$verstring:${current}.0" + func_append verstring ":${current}.0" ;; qnx) @@ -6395,10 +7538,10 @@ fi func_generate_dlsyms "$libname" "$libname" "yes" - libobjs="$libobjs $symfileobj" + func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= - if test "$mode" != relink; then + if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= @@ -6414,7 +7557,7 @@ continue fi fi - removelist="$removelist $p" + func_append removelist " $p" ;; *) ;; esac @@ -6425,27 +7568,28 @@ # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" + func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do - # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` - # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` - # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; + *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then @@ -6459,7 +7603,7 @@ for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; + *) func_append dlfiles " $lib" ;; esac done @@ -6469,19 +7613,19 @@ for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; + *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework - deplibs="$deplibs System.ltframework" + func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. @@ -6498,7 +7642,7 @@ *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" + func_append deplibs " -lc" fi ;; esac @@ -6547,7 +7691,7 @@ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" i="" ;; esac @@ -6558,21 +7702,21 @@ set dummy $deplib_matches; shift deplib_match=$1 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" else droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: dynamic linker does not accept needed library $i." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which I believe you do not have" - $ECHO "*** because a test_compile did reveal that the linker did not use it for" - $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which I believe you do not have" + echo "*** because a test_compile did reveal that the linker did not use it for" + echo "*** its dynamic dependency list that programs get resolved with at runtime." fi fi ;; *) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" ;; esac done @@ -6590,7 +7734,7 @@ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" i="" ;; esac @@ -6601,29 +7745,29 @@ set dummy $deplib_matches; shift deplib_match=$1 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" else droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: dynamic linker does not accept needed library $i." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because a test_compile did reveal that the linker did not use this one" - $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because a test_compile did reveal that the linker did not use this one" + echo "*** as a dynamic dependency that programs can get resolved with at runtime." fi fi else droppeddeps=yes - $ECHO + echo $ECHO "*** Warning! Library $i is needed by this library but I was not able to" - $ECHO "*** make it link in! You will probably need to install it or some" - $ECHO "*** library that it depends on before this library will be fully" - $ECHO "*** functional. Installing it before continuing would be even better." + echo "*** make it link in! You will probably need to install it or some" + echo "*** library that it depends on before this library will be fully" + echo "*** functional. Installing it before continuing would be even better." fi ;; *) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" ;; esac done @@ -6640,15 +7784,27 @@ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` + if test -n "$file_magic_glob"; then + libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` + else + libnameglob=$libname + fi + test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + if test "$want_nocaseglob" = yes; then + shopt -s nocaseglob + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | @@ -6665,13 +7821,13 @@ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi @@ -6680,12 +7836,12 @@ fi if test -n "$a_deplib" ; then droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because I did check the linker path looking for a file starting" + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else @@ -6696,7 +7852,7 @@ ;; *) # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. @@ -6712,7 +7868,7 @@ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" ;; esac @@ -6723,9 +7879,9 @@ potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test - if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi @@ -6734,12 +7890,12 @@ fi if test -n "$a_deplib" ; then droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because I did check the linker path looking for a file starting" + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else @@ -6750,32 +7906,32 @@ ;; *) # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" - tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ - -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi - if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | - $GREP . >/dev/null; then - $ECHO + case $tmp_deplibs in + *[!\ \ ]*) + echo if test "X$deplibs_check_method" = "Xnone"; then - $ECHO "*** Warning: inter-library dependencies are not supported in this platform." + echo "*** Warning: inter-library dependencies are not supported in this platform." else - $ECHO "*** Warning: inter-library dependencies are not known to be supported." + echo "*** Warning: inter-library dependencies are not known to be supported." fi - $ECHO "*** All declared inter-library dependencies are being dropped." + echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes - fi + ;; + esac ;; esac versuffix=$versuffix_save @@ -6787,23 +7943,23 @@ case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then - $ECHO - $ECHO "*** Warning: libtool could not satisfy all declared inter-library" + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" - $ECHO "*** a static module, that should work as long as the dlopening" - $ECHO "*** application is linked with the -dlopen flag." + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - $ECHO - $ECHO "*** However, this would only work if libtool was able to extract symbol" - $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" - $ECHO "*** not find such a program. So, this module is probably useless." - $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" @@ -6813,16 +7969,16 @@ build_libtool_libs=no fi else - $ECHO "*** The inter-library dependencies that have been dropped here will be" - $ECHO "*** automatically added whenever a program is linked with this library" - $ECHO "*** or is declared to -dlopen it." + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then - $ECHO - $ECHO "*** Since this library must not contain undefined symbols," - $ECHO "*** because either the platform does not support them or" - $ECHO "*** it was explicitly requested with -no-undefined," - $ECHO "*** libtool will only create a static version of it." + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module @@ -6839,9 +7995,9 @@ # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) - newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac @@ -6854,7 +8010,7 @@ *) case " $deplibs " in *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; + func_append new_libs " -L$path/$objdir" ;; esac ;; esac @@ -6864,10 +8020,10 @@ -L*) case " $new_libs " in *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" @@ -6879,15 +8035,22 @@ # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then + # Remove ${wl} instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" + test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else @@ -6896,18 +8059,18 @@ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" + func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; + *) func_append perm_rpath " $libdir" ;; esac fi done @@ -6915,17 +8078,13 @@ if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi + eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do - rpath="$rpath$dir:" + func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi @@ -6933,7 +8092,7 @@ fi shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi @@ -6959,18 +8118,18 @@ linknames= for link do - linknames="$linknames $link" + func_append linknames " $link" done # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" - delfiles="$delfiles $export_symbols" + func_append delfiles " $export_symbols" fi orig_export_symbols= @@ -7001,14 +8160,46 @@ $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do + for cmd1 in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" - func_len " $cmd" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test "$try_normal_branch" = yes \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then func_show_eval "$cmd" 'exit $?' skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=${output_objdir}/${output_la}.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." @@ -7029,7 +8220,7 @@ if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then @@ -7041,7 +8232,7 @@ # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi @@ -7051,7 +8242,7 @@ case " $convenience " in *" $test_deplib "*) ;; *) - tmp_deplibs="$tmp_deplibs $test_deplib" + func_append tmp_deplibs " $test_deplib" ;; esac done @@ -7071,21 +8262,21 @@ test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" + func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" + func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then + if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi @@ -7130,7 +8321,8 @@ save_libobjs=$libobjs fi save_output=$output - output_la=`$ECHO "X$output" | $Xsed -e "$basename"` + func_basename "$output" + output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. @@ -7143,13 +8335,16 @@ if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" - $ECHO 'INPUT (' > $output + echo 'INPUT (' > $output for obj in $save_libobjs do - $ECHO "$obj" >> $output + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output done - $ECHO ')' >> $output - delfiles="$delfiles $output" + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" @@ -7163,10 +8358,12 @@ fi for obj do - $ECHO "$obj" >> $output + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output done - delfiles="$delfiles $output" - output=$firstobj\"$file_list_spec$output\" + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." @@ -7190,17 +8387,19 @@ # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext - objlist=$obj + objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result @@ -7210,11 +8409,12 @@ # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi - delfiles="$delfiles $output" + func_append delfiles " $output" else output= @@ -7248,7 +8448,7 @@ lt_exit=$? # Restore the uninstalled library and exit - if test "$mode" = relink; then + if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) @@ -7269,7 +8469,7 @@ if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then @@ -7281,7 +8481,7 @@ # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi @@ -7322,10 +8522,10 @@ # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $dlprefiles - libobjs="$libobjs $func_extract_archives_result" + func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi @@ -7341,7 +8541,7 @@ lt_exit=$? # Restore the uninstalled library and exit - if test "$mode" = relink; then + if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) @@ -7353,7 +8553,7 @@ IFS="$save_ifs" # Restore the uninstalled library and exit - if test "$mode" = relink; then + if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then @@ -7434,18 +8634,21 @@ if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` + reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi + # If we're not building shared, we need to use non_pic_objs + test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" + # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' @@ -7505,8 +8708,8 @@ case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac @@ -7517,14 +8720,14 @@ if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" + func_append compile_command " ${wl}-bind_at_load" + func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac @@ -7538,7 +8741,7 @@ *) case " $compile_deplibs " in *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; + func_append new_libs " -L$path/$objdir" ;; esac ;; esac @@ -7548,17 +8751,17 @@ -L*) case " $new_libs " in *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. @@ -7566,7 +8769,7 @@ # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; + *) func_append finalize_rpath " $libdir" ;; esac done fi @@ -7585,18 +8788,18 @@ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" + func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; + *) func_append perm_rpath " $libdir" ;; esac fi case $host in @@ -7605,12 +8808,12 @@ case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; - *) dllsearchpath="$dllsearchpath:$libdir";; + *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; + *) func_append dllsearchpath ":$testbindir";; esac ;; esac @@ -7636,18 +8839,18 @@ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" + func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + *) func_append finalize_perm_rpath " $libdir" ;; esac fi done @@ -7661,8 +8864,8 @@ if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. - compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" @@ -7674,15 +8877,15 @@ wrappers_required=yes case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=no + ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; - *cegcc) - # Disable wrappers for cegcc, we are cross compiling anyway. - wrappers_required=no - ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no @@ -7691,13 +8894,19 @@ esac if test "$wrappers_required" = no; then # Replace the output file specification. - compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' @@ -7720,7 +8929,7 @@ # We should set the runpath_var. rpath= for dir in $perm_rpath; do - rpath="$rpath$dir:" + func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi @@ -7728,7 +8937,7 @@ # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" + func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi @@ -7738,11 +8947,18 @@ # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. - link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + exit $EXIT_SUCCESS fi @@ -7757,7 +8973,7 @@ if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then - relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= @@ -7769,13 +8985,19 @@ fi # Replace the output file specification. - link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + # Now create the wrapper script. func_verbose "creating $output" @@ -7793,18 +9015,7 @@ fi done relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $ECHO for shipping. - if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then - case $progpath in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; - *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; - esac - qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. @@ -7884,7 +9095,7 @@ else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then - oldobjs="$oldobjs $symfileobj" + func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" @@ -7892,10 +9103,10 @@ if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $addlibs - oldobjs="$oldobjs $func_extract_archives_result" + func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. @@ -7906,10 +9117,10 @@ # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $dlprefiles - oldobjs="$oldobjs $func_extract_archives_result" + func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have @@ -7925,9 +9136,9 @@ done | sort | sort -uc >/dev/null 2>&1); then : else - $ECHO "copying selected object files to avoid basename conflicts..." + echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= @@ -7951,18 +9162,30 @@ esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" ;; - *) oldobjs="$oldobjs $obj" ;; + *) func_append oldobjs " $obj" ;; esac done fi + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." @@ -8036,7 +9259,7 @@ done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi @@ -8056,12 +9279,23 @@ *.la) func_basename "$deplib" name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + func_resolve_sysroot "$deplib" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" - newdependency_libs="$newdependency_libs $libdir/$name" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" @@ -8075,9 +9309,9 @@ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" - newdlfiles="$newdlfiles $libdir/$name" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; - *) newdlfiles="$newdlfiles $lib" ;; + *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" @@ -8094,7 +9328,7 @@ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" - newdlprefiles="$newdlprefiles $libdir/$name" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done @@ -8106,7 +9340,7 @@ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac - newdlfiles="$newdlfiles $abs" + func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= @@ -8115,15 +9349,33 @@ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac - newdlprefiles="$newdlprefiles $abs" + func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test "x$bindir" != x ; + then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; esac $ECHO > $output "\ # $outputname - a libtool library file @@ -8182,7 +9434,7 @@ exit $EXIT_SUCCESS } -{ test "$mode" = link || test "$mode" = relink; } && +{ test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} @@ -8202,9 +9454,9 @@ for arg do case $arg in - -f) RM="$RM $arg"; rmforce=yes ;; - -*) RM="$RM $arg" ;; - *) files="$files $arg" ;; + -f) func_append RM " $arg"; rmforce=yes ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; esac done @@ -8213,24 +9465,23 @@ rmdirs= - origobjdir="$objdir" for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then - objdir="$origobjdir" + odir="$objdir" else - objdir="$dir/$origobjdir" + odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" - test "$mode" = uninstall && objdir="$dir" - - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then + test "$opt_mode" = uninstall && odir="$dir" + + # Remember odir for removal later, being careful to avoid duplicates + if test "$opt_mode" = clean; then case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; esac fi @@ -8256,18 +9507,17 @@ # Delete the libtool libraries and symlinks. for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" + func_append rmfiles " $odir/$n" done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - - case "$mode" in + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case "$opt_mode" in clean) - case " $library_names " in - # " " in the beginning catches empty $dlname + case " $library_names " in *" $dlname "*) ;; - *) rmfiles="$rmfiles $objdir/$dlname" ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac - test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then @@ -8295,19 +9545,19 @@ # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" + func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" + func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) - if test "$mode" = clean ; then + if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) @@ -8317,7 +9567,7 @@ noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe - rmfiles="$rmfiles $file" + func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. @@ -8326,7 +9576,7 @@ func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result - rmfiles="$rmfiles $func_ltwrapper_scriptname_result" + func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename @@ -8334,12 +9584,12 @@ # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" + func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" + func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi @@ -8347,7 +9597,6 @@ esac func_show_eval "$RM $rmfiles" 'exit_status=1' done - objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do @@ -8359,16 +9608,16 @@ exit $exit_status } -{ test "$mode" = uninstall || test "$mode" = clean; } && +{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} -test -z "$mode" && { +test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$mode'" + func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" diff --git a/Modules/_ctypes/libffi/m4/asmcfi.m4 b/Modules/_ctypes/libffi/m4/asmcfi.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/asmcfi.m4 @@ -0,0 +1,13 @@ +AC_DEFUN([GCC_AS_CFI_PSEUDO_OP], +[AC_CACHE_CHECK([assembler .cfi pseudo-op support], + gcc_cv_as_cfi_pseudo_op, [ + gcc_cv_as_cfi_pseudo_op=unknown + AC_TRY_COMPILE([asm (".cfi_startproc\n\t.cfi_endproc");],, + [gcc_cv_as_cfi_pseudo_op=yes], + [gcc_cv_as_cfi_pseudo_op=no]) + ]) + if test "x$gcc_cv_as_cfi_pseudo_op" = xyes; then + AC_DEFINE(HAVE_AS_CFI_PSEUDO_OP, 1, + [Define if your assembler supports .cfi_* directives.]) + fi +]) diff --git a/Modules/_ctypes/libffi/m4/ax_append_flag.m4 b/Modules/_ctypes/libffi/m4/ax_append_flag.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_append_flag.m4 @@ -0,0 +1,69 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) +# +# DESCRIPTION +# +# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space +# added in between. +# +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. +# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains +# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly +# FLAG. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 2 + +AC_DEFUN([AX_APPEND_FLAG], +[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX +AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])dnl +AS_VAR_SET_IF(FLAGS, + [case " AS_VAR_GET(FLAGS) " in + *" $1 "*) + AC_RUN_LOG([: FLAGS already contains $1]) + ;; + *) + AC_RUN_LOG([: FLAGS="$FLAGS $1"]) + AS_VAR_SET(FLAGS, ["AS_VAR_GET(FLAGS) $1"]) + ;; + esac], + [AS_VAR_SET(FLAGS,["$1"])]) +AS_VAR_POPDEF([FLAGS])dnl +])dnl AX_APPEND_FLAG diff --git a/Modules/_ctypes/libffi/m4/ax_cc_maxopt.m4 b/Modules/_ctypes/libffi/m4/ax_cc_maxopt.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_cc_maxopt.m4 @@ -0,0 +1,181 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_cc_maxopt.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CC_MAXOPT +# +# DESCRIPTION +# +# Try to turn on "good" C optimization flags for various compilers and +# architectures, for some definition of "good". (In our case, good for +# FFTW and hopefully for other scientific codes. Modify as needed.) +# +# The user can override the flags by setting the CFLAGS environment +# variable. The user can also specify --enable-portable-binary in order to +# disable any optimization flags that might result in a binary that only +# runs on the host architecture. +# +# Note also that the flags assume that ANSI C aliasing rules are followed +# by the code (e.g. for gcc's -fstrict-aliasing), and that floating-point +# computations can be re-ordered as needed. +# +# Requires macros: AX_CHECK_COMPILE_FLAG, AX_COMPILER_VENDOR, +# AX_GCC_ARCHFLAG, AX_GCC_X86_CPUID. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 13 + +AC_DEFUN([AX_CC_MAXOPT], +[ +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AX_COMPILER_VENDOR]) +AC_REQUIRE([AC_CANONICAL_HOST]) + +AC_ARG_ENABLE(portable-binary, [AS_HELP_STRING([--enable-portable-binary], [disable compiler optimizations that would produce unportable binaries])], + acx_maxopt_portable=$enableval, acx_maxopt_portable=no) + +# Try to determine "good" native compiler flags if none specified via CFLAGS +if test "$ac_test_CFLAGS" != "set"; then + CFLAGS="" + case $ax_cv_c_compiler_vendor in + dec) CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host" + if test "x$acx_maxopt_portable" = xno; then + CFLAGS="$CFLAGS -arch host" + fi;; + + sun) CFLAGS="-native -fast -xO5 -dalign" + if test "x$acx_maxopt_portable" = xyes; then + CFLAGS="$CFLAGS -xarch=generic" + fi;; + + hp) CFLAGS="+Oall +Optrs_ansi +DSnative" + if test "x$acx_maxopt_portable" = xyes; then + CFLAGS="$CFLAGS +DAportable" + fi;; + + ibm) if test "x$acx_maxopt_portable" = xno; then + xlc_opt="-qarch=auto -qtune=auto" + else + xlc_opt="-qtune=auto" + fi + AX_CHECK_COMPILE_FLAG($xlc_opt, + CFLAGS="-O3 -qansialias -w $xlc_opt", + [CFLAGS="-O3 -qansialias -w" + echo "******************************************************" + echo "* You seem to have the IBM C compiler. It is *" + echo "* recommended for best performance that you use: *" + echo "* *" + echo "* CFLAGS=-O3 -qarch=xxx -qtune=xxx -qansialias -w *" + echo "* ^^^ ^^^ *" + echo "* where xxx is pwr2, pwr3, 604, or whatever kind of *" + echo "* CPU you have. (Set the CFLAGS environment var. *" + echo "* and re-run configure.) For more info, man cc. *" + echo "******************************************************"]) + ;; + + intel) CFLAGS="-O3 -ansi_alias" + if test "x$acx_maxopt_portable" = xno; then + icc_archflag=unknown + icc_flags="" + case $host_cpu in + i686*|x86_64*) + # icc accepts gcc assembly syntax, so these should work: + AX_GCC_X86_CPUID(0) + AX_GCC_X86_CPUID(1) + case $ax_cv_gcc_x86_cpuid_0 in # see AX_GCC_ARCHFLAG + *:756e6547:*:*) # Intel + case $ax_cv_gcc_x86_cpuid_1 in + *6a?:*[[234]]:*:*|*6[[789b]]?:*:*:*) icc_flags="-xK";; + *f3[[347]]:*:*:*|*f4[1347]:*:*:*) icc_flags="-xP -xN -xW -xK";; + *f??:*:*:*) icc_flags="-xN -xW -xK";; + esac ;; + esac ;; + esac + if test "x$icc_flags" != x; then + for flag in $icc_flags; do + AX_CHECK_COMPILE_FLAG($flag, [icc_archflag=$flag; break]) + done + fi + AC_MSG_CHECKING([for icc architecture flag]) + AC_MSG_RESULT($icc_archflag) + if test "x$icc_archflag" != xunknown; then + CFLAGS="$CFLAGS $icc_archflag" + fi + fi + ;; + + gnu) + # default optimization flags for gcc on all systems + CFLAGS="-O3 -fomit-frame-pointer" + + # -malign-double for x86 systems + # LIBFFI -- DON'T DO THIS - CHANGES ABI + # AX_CHECK_COMPILE_FLAG(-malign-double, CFLAGS="$CFLAGS -malign-double") + + # -fstrict-aliasing for gcc-2.95+ + AX_CHECK_COMPILE_FLAG(-fstrict-aliasing, + CFLAGS="$CFLAGS -fstrict-aliasing") + + # note that we enable "unsafe" fp optimization with other compilers, too + AX_CHECK_COMPILE_FLAG(-ffast-math, CFLAGS="$CFLAGS -ffast-math") + + AX_GCC_ARCHFLAG($acx_maxopt_portable) + ;; + esac + + if test -z "$CFLAGS"; then + echo "" + echo "********************************************************" + echo "* WARNING: Don't know the best CFLAGS for this system *" + echo "* Use ./configure CFLAGS=... to specify your own flags *" + echo "* (otherwise, a default of CFLAGS=-O3 will be used) *" + echo "********************************************************" + echo "" + CFLAGS="-O3" + fi + + AX_CHECK_COMPILE_FLAG($CFLAGS, [], [ + echo "" + echo "********************************************************" + echo "* WARNING: The guessed CFLAGS don't seem to work with *" + echo "* your compiler. *" + echo "* Use ./configure CFLAGS=... to specify your own flags *" + echo "********************************************************" + echo "" + CFLAGS="" + ]) + +fi +]) diff --git a/Modules/_ctypes/libffi/m4/ax_cflags_warn_all.m4 b/Modules/_ctypes/libffi/m4/ax_cflags_warn_all.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_cflags_warn_all.m4 @@ -0,0 +1,122 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] +# AX_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] +# AX_FCFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] +# +# DESCRIPTION +# +# Try to find a compiler option that enables most reasonable warnings. +# +# For the GNU compiler it will be -Wall (and -ansi -pedantic) The result +# is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default. +# +# Currently this macro knows about the GCC, Solaris, Digital Unix, AIX, +# HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and +# Intel compilers. For a given compiler, the Fortran flags are much more +# experimental than their C equivalents. +# +# - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS +# - $2 add-value-if-not-found : nothing +# - $3 action-if-found : add value to shellvariable +# - $4 action-if-not-found : nothing +# +# NOTE: These macros depend on AX_APPEND_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2010 Rhys Ulerich +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 14 + +AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl +AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl +AS_VAR_PUSHDEF([VAR],[ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl +AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], +VAR,[VAR="no, unknown" +ac_save_[]FLAGS="$[]FLAGS" +for ac_arg dnl +in "-warn all % -warn all" dnl Intel + "-pedantic % -Wall" dnl GCC + "-xstrconst % -v" dnl Solaris C + "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix + "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX + "-ansi -ansiE % -fullwarn" dnl IRIX + "+ESlit % +w1" dnl HP-UX C + "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) + "-h conform % -h msglevel 2" dnl Cray C (Unicos) + # +do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) +done +FLAGS="$ac_save_[]FLAGS" +]) +AS_VAR_POPDEF([FLAGS])dnl +AC_REQUIRE([AX_APPEND_FLAG]) +case ".$VAR" in + .ok|.ok,*) m4_ifvaln($3,$3) ;; + .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;; + *) m4_default($3,[AX_APPEND_FLAG([$VAR], [$1])]) ;; +esac +AS_VAR_POPDEF([VAR])dnl +])dnl AX_FLAGS_WARN_ALL +dnl implementation tactics: +dnl the for-argument contains a list of options. The first part of +dnl these does only exist to detect the compiler - usually it is +dnl a global option to enable -ansi or -extrawarnings. All other +dnl compilers will fail about it. That was needed since a lot of +dnl compilers will give false positives for some option-syntax +dnl like -Woption or -Xoption as they think of it is a pass-through +dnl to later compile stages or something. The "%" is used as a +dnl delimiter. A non-option comment can be given after "%%" marks +dnl which will be shown but not added to the respective C/CXXFLAGS. + +AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl +AC_LANG_PUSH([C]) +AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) +AC_LANG_POP([C]) +]) + +AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl +AC_LANG_PUSH([C++]) +AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) +AC_LANG_POP([C++]) +]) + +AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl +AC_LANG_PUSH([Fortran]) +AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) +AC_LANG_POP([Fortran]) +]) diff --git a/Modules/_ctypes/libffi/m4/ax_check_compile_flag.m4 b/Modules/_ctypes/libffi/m4/ax_check_compile_flag.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_check_compile_flag.m4 @@ -0,0 +1,72 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 2 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS diff --git a/Modules/_ctypes/libffi/m4/ax_compiler_vendor.m4 b/Modules/_ctypes/libffi/m4/ax_compiler_vendor.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_compiler_vendor.m4 @@ -0,0 +1,84 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPILER_VENDOR +# +# DESCRIPTION +# +# Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun, +# hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft, +# watcom, etc. The vendor is returned in the cache variable +# $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 11 + +AC_DEFUN([AX_COMPILER_VENDOR], +[AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, + [# note: don't check for gcc first since some other compilers define __GNUC__ + vendors="intel: __ICC,__ECC,__INTEL_COMPILER + ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__ + pathscale: __PATHCC__,__PATHSCALE__ + clang: __clang__ + gnu: __GNUC__ + sun: __SUNPRO_C,__SUNPRO_CC + hp: __HP_cc,__HP_aCC + dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER + borland: __BORLANDC__,__TURBOC__ + comeau: __COMO__ + cray: _CRAYC + kai: __KCC + lcc: __LCC__ + sgi: __sgi,sgi + microsoft: _MSC_VER + metrowerks: __MWERKS__ + watcom: __WATCOMC__ + portland: __PGI + unknown: UNKNOWN" + for ventest in $vendors; do + case $ventest in + *:) vendor=$ventest; continue ;; + *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;; + esac + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ + #if !($vencpp) + thisisanerror; + #endif + ])], [break]) + done + ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1` + ]) +]) diff --git a/Modules/_ctypes/libffi/m4/ax_configure_args.m4 b/Modules/_ctypes/libffi/m4/ax_configure_args.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_configure_args.m4 @@ -0,0 +1,70 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_configure_args.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CONFIGURE_ARGS +# +# DESCRIPTION +# +# Helper macro for AX_ENABLE_BUILDDIR. +# +# The traditional way of starting a subdir-configure is running the script +# with ${1+"$@"} but since autoconf 2.60 this is broken. Instead we have +# to rely on eval'ing $ac_configure_args however some old autoconf +# versions do not provide that. To ensure maximum portability of autoconf +# extension macros this helper can be AC_REQUIRE'd so that +# $ac_configure_args will alsways be present. +# +# Sadly, the traditional "exec $SHELL" of the enable_builddir macros is +# spoiled now and must be replaced by "eval + exit $?". +# +# Example: +# +# AC_DEFUN([AX_ENABLE_SUBDIR],[dnl +# AC_REQUIRE([AX_CONFIGURE_ARGS])dnl +# eval $SHELL $ac_configure_args || exit $? +# ...]) +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 9 + +AC_DEFUN([AX_CONFIGURE_ARGS],[ + # [$]@ is unsable in 2.60+ but earlier autoconf had no ac_configure_args + if test "${ac_configure_args+set}" != "set" ; then + ac_configure_args= + for ac_arg in ${1+"[$]@"}; do + ac_configure_args="$ac_configure_args '$ac_arg'" + done + fi +]) diff --git a/Modules/_ctypes/libffi/m4/ax_enable_builddir.m4 b/Modules/_ctypes/libffi/m4/ax_enable_builddir.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_enable_builddir.m4 @@ -0,0 +1,300 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_enable_builddir.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_ENABLE_BUILDDIR [(dirstring-or-command [,Makefile.mk [,-all]])] +# +# DESCRIPTION +# +# If the current configure was run within the srcdir then we move all +# configure-files into a subdir and let the configure steps continue +# there. We provide an option --disable-builddir to suppress the move into +# a separate builddir. +# +# Defaults: +# +# $1 = $host (overridden with $HOST) +# $2 = Makefile.mk +# $3 = -all +# +# This macro must be called before AM_INIT_AUTOMAKE. It creates a default +# toplevel srcdir Makefile from the information found in the created +# toplevel builddir Makefile. It just copies the variables and +# rule-targets, each extended with a default rule-execution that recurses +# into the build directory of the current "HOST". You can override the +# auto-dection through `config.guess` and build-time of course, as in +# +# make HOST=i386-mingw-cross +# +# which can of course set at configure time as well using +# +# configure --host=i386-mingw-cross +# +# After the default has been created, additional rules can be appended +# that will not just recurse into the subdirectories and only ever exist +# in the srcdir toplevel makefile - these parts are read from the $2 = +# Makefile.mk file +# +# The automatic rules are usually scanning the toplevel Makefile for lines +# like '#### $host |$builddir' to recognize the place where to recurse +# into. Usually, the last one is the only one used. However, almost all +# targets have an additional "*-all" rule which makes the script to +# recurse into _all_ variants of the current HOST (!!) setting. The "-all" +# suffix can be overriden for the macro as well. +# +# a special rule is only given for things like "dist" that will copy the +# tarball from the builddir to the sourcedir (or $(PUB)) for reason of +# convenience. +# +# LICENSE +# +# Copyright (c) 2009 Guido U. Draheim +# Copyright (c) 2009 Alan Jenkins +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 23 + +AC_DEFUN([AX_ENABLE_BUILDDIR],[ +AC_REQUIRE([AC_CANONICAL_HOST])[]dnl +AC_REQUIRE([AX_CONFIGURE_ARGS])[]dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])[]dnl +AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl +AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl +AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl +AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl +SUB="." +AC_ARG_ENABLE([builddir], AS_HELP_STRING( + [--disable-builddir],[disable automatic build in subdir of sources]) + ,[SUB="$enableval"], [SUB="auto"]) +if test ".$ac_srcdir_defaulted" != ".no" ; then +if test ".$srcdir" = ".." ; then + if test -f config.status ; then + AC_MSG_NOTICE(toplevel srcdir already configured... skipping subdir build) + else + test ".$SUB" = "." && SUB="." + test ".$SUB" = ".no" && SUB="." + test ".$TARGET" = "." && TARGET="$target" + test ".$SUB" = ".auto" && SUB="m4_ifval([$1], [$1],[$TARGET])" + if test ".$SUB" != ".." ; then # we know where to go and + AS_MKDIR_P([$SUB]) + echo __.$SUB.__ > $SUB/conftest.tmp + cd $SUB + if grep __.$SUB.__ conftest.tmp >/dev/null 2>/dev/null ; then + rm conftest.tmp + AC_MSG_RESULT([continue configure in default builddir "./$SUB"]) + else + AC_MSG_ERROR([could not change to default builddir "./$SUB"]) + fi + srcdir=`echo "$SUB" | + sed -e 's,^\./,,;s,[[^/]]$,&/,;s,[[^/]]*/,../,g;s,[[/]]$,,;'` + # going to restart from subdirectory location + test -f $srcdir/config.log && mv $srcdir/config.log . + test -f $srcdir/confdefs.h && mv $srcdir/confdefs.h . + test -f $srcdir/conftest.log && mv $srcdir/conftest.log . + test -f $srcdir/$cache_file && mv $srcdir/$cache_file . + AC_MSG_RESULT(....exec $SHELL $srcdir/[$]0 "--srcdir=$srcdir" "--enable-builddir=$SUB" ${1+"[$]@"}) + case "[$]0" in # restart + [/\\]*) eval $SHELL "'[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;; + *) eval $SHELL "'$srcdir/[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;; + esac ; exit $? + fi + fi +fi fi +test ".$SUB" = ".auto" && SUB="." +dnl ac_path_prog uses "set dummy" to override $@ which would defeat the "exec" +AC_PATH_PROG(SED,gsed sed, sed) +AUX="$am_aux_dir" +AS_VAR_POPDEF([SED])dnl +AS_VAR_POPDEF([AUX])dnl +AS_VAR_POPDEF([SUB])dnl +AC_CONFIG_COMMANDS([buildir],[dnl .............. config.status .............. +AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl +AS_VAR_PUSHDEF([TOP],[top_srcdir])dnl +AS_VAR_PUSHDEF([SRC],[ac_top_srcdir])dnl +AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl +AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl +pushdef([END],[Makefile.mk])dnl +pushdef([_ALL],[ifelse([$3],,[-all],[$3])])dnl + SRC="$ax_enable_builddir_srcdir" + if test ".$SUB" = ".." ; then + if test -f "$TOP/Makefile" ; then + AC_MSG_NOTICE([skipping TOP/Makefile - left untouched]) + else + AC_MSG_NOTICE([skipping TOP/Makefile - not created]) + fi + else + if test -f "$SRC/Makefile" ; then + a=`grep "^VERSION " "$SRC/Makefile"` ; b=`grep "^VERSION " Makefile` + test "$a" != "$b" && rm "$SRC/Makefile" + fi + if test -f "$SRC/Makefile" ; then + echo "$SRC/Makefile : $SRC/Makefile.in" > $tmp/conftemp.mk + echo " []@ echo 'REMOVED,,,' >\$[]@" >> $tmp/conftemp.mk + eval "${MAKE-make} -f $tmp/conftemp.mk 2>/dev/null >/dev/null" + if grep '^REMOVED,,,' "$SRC/Makefile" >/dev/null + then rm $SRC/Makefile ; fi + cp $tmp/conftemp.mk $SRC/makefiles.mk~ ## DEBUGGING + fi + if test ! -f "$SRC/Makefile" ; then + AC_MSG_NOTICE([create TOP/Makefile guessed from local Makefile]) + x='`' ; cat >$tmp/conftemp.sed <<_EOF +/^\$/n +x +/^\$/bS +x +/\\\\\$/{H;d;} +{H;s/.*//;x;} +bM +:S +x +/\\\\\$/{h;d;} +{h;s/.*//;x;} +:M +s/\\(\\n\\) /\\1 /g +/^ /d +/^[[ ]]*[[\\#]]/d +/^VPATH *=/d +s/^srcdir *=.*/srcdir = ./ +s/^top_srcdir *=.*/top_srcdir = ./ +/[[:=]]/!d +/^\\./d +dnl Now handle rules (i.e. lines containing ":" but not " = "). +/ = /b +/ .= /b +/:/!b +s/:.*/:/ +s/ / /g +s/ \\([[a-z]][[a-z-]]*[[a-zA-Z0-9]]\\)\\([[ :]]\\)/ \\1 \\1[]_ALL\\2/g +s/^\\([[a-z]][[a-z-]]*[[a-zA-Z0-9]]\\)\\([[ :]]\\)/\\1 \\1[]_ALL\\2/ +s/ / /g +/^all all[]_ALL[[ :]]/i\\ +all-configured : all[]_ALL +dnl dist-all exists... and would make for dist-all-all +s/ [[a-zA-Z0-9-]]*[]_ALL [[a-zA-Z0-9-]]*[]_ALL[]_ALL//g +/[]_ALL[]_ALL/d +a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$n * \$\@"; if test "\$\$n" -eq "0" ; then : \\\\\\ + ; BUILD=$x grep "^####.*|" Makefile |tail -1| sed -e 's/.*|//' $x ; fi \\\\\\ + ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ + ; test "\$\$use" = "\$\@" && BUILD=$x echo "\$\$BUILD" | tail -1 $x \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; (cd "\$\$i" && test ! -f configure && \$(MAKE) \$\$use) || exit; done +dnl special rule add-on: "dist" copies the tarball to $(PUB). (source tree) +/dist[]_ALL *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; found=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).tar.*" \\\\\\ + ; if test "\$\$found" -eq "0" ; then : \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\ + ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).tar.* \\\\\\ + ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done +dnl special rule add-on: "dist-foo" copies all the archives to $(PUB). (source tree) +/dist-[[a-zA-Z0-9]]*[]_ALL *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh ./config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; found=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).*" \\\\\\ + ; if test "\$\$found" -eq "0" ; then : \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\ + ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).* \\\\\\ + ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done +dnl special rule add-on: "distclean" removes all local builddirs completely +/distclean[]_ALL *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile | sed -e 's/.*|//' $x \\\\\\ + ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$n * \$\@ (all local builds)" \\\\\\ + ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; echo "# rm -r \$\$i"; done ; echo "# (sleep 3)" ; sleep 3 \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; echo "\$\$i" | grep "^/" > /dev/null && continue \\\\\\ + ; echo "\$\$i" | grep "^../" > /dev/null && continue \\\\\\ + ; echo "rm -r \$\$i"; (rm -r "\$\$i") ; done ; rm Makefile +_EOF + cp "$tmp/conftemp.sed" "$SRC/makefile.sed~" ## DEBUGGING + $SED -f $tmp/conftemp.sed Makefile >$SRC/Makefile + if test -f "$SRC/m4_ifval([$2],[$2],[END])" ; then + AC_MSG_NOTICE([extend TOP/Makefile with TOP/m4_ifval([$2],[$2],[END])]) + cat $SRC/END >>$SRC/Makefile + fi ; xxxx="####" + echo "$xxxx CONFIGURATIONS FOR TOPLEVEL MAKEFILE: " >>$SRC/Makefile + # sanity check + if grep '^; echo "MAKE ' $SRC/Makefile >/dev/null ; then + AC_MSG_NOTICE([buggy sed found - it deletes tab in "a" text parts]) + $SED -e '/^@ HOST=/s/^/ /' -e '/^; /s/^/ /' $SRC/Makefile \ + >$SRC/Makefile~ + (test -s $SRC/Makefile~ && mv $SRC/Makefile~ $SRC/Makefile) 2>/dev/null + fi + else + xxxx="\\#\\#\\#\\#" + # echo "/^$xxxx *$ax_enable_builddir_host /d" >$tmp/conftemp.sed + echo "s!^$xxxx [[^|]]* | *$SUB *\$!$xxxx ...... $SUB!" >$tmp/conftemp.sed + $SED -f "$tmp/conftemp.sed" "$SRC/Makefile" >$tmp/mkfile.tmp + cp "$tmp/conftemp.sed" "$SRC/makefiles.sed~" ## DEBUGGING + cp "$tmp/mkfile.tmp" "$SRC/makefiles.out~" ## DEBUGGING + if cmp -s "$SRC/Makefile" "$tmp/mkfile.tmp" 2>/dev/null ; then + AC_MSG_NOTICE([keeping TOP/Makefile from earlier configure]) + rm "$tmp/mkfile.tmp" + else + AC_MSG_NOTICE([reusing TOP/Makefile from earlier configure]) + mv "$tmp/mkfile.tmp" "$SRC/Makefile" + fi + fi + AC_MSG_NOTICE([build in $SUB (HOST=$ax_enable_builddir_host)]) + xxxx="####" + echo "$xxxx" "$ax_enable_builddir_host" "|$SUB" >>$SRC/Makefile + fi +popdef([END])dnl +AS_VAR_POPDEF([SED])dnl +AS_VAR_POPDEF([AUX])dnl +AS_VAR_POPDEF([SRC])dnl +AS_VAR_POPDEF([TOP])dnl +AS_VAR_POPDEF([SUB])dnl +],[dnl +ax_enable_builddir_srcdir="$srcdir" # $srcdir +ax_enable_builddir_host="$HOST" # $HOST / $host +ax_enable_builddir_version="$VERSION" # $VERSION +ax_enable_builddir_package="$PACKAGE" # $PACKAGE +ax_enable_builddir_auxdir="$ax_enable_builddir_auxdir" # $AUX +ax_enable_builddir_sed="$ax_enable_builddir_sed" # $SED +ax_enable_builddir="$ax_enable_builddir" # $SUB +])dnl +]) diff --git a/Modules/_ctypes/libffi/m4/ax_gcc_archflag.m4 b/Modules/_ctypes/libffi/m4/ax_gcc_archflag.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_gcc_archflag.m4 @@ -0,0 +1,225 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_gcc_archflag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_ARCHFLAG([PORTABLE?], [ACTION-SUCCESS], [ACTION-FAILURE]) +# +# DESCRIPTION +# +# This macro tries to guess the "native" arch corresponding to the target +# architecture for use with gcc's -march=arch or -mtune=arch flags. If +# found, the cache variable $ax_cv_gcc_archflag is set to this flag and +# ACTION-SUCCESS is executed; otherwise $ax_cv_gcc_archflag is set to +# "unknown" and ACTION-FAILURE is executed. The default ACTION-SUCCESS is +# to add $ax_cv_gcc_archflag to the end of $CFLAGS. +# +# PORTABLE? should be either [yes] (default) or [no]. In the former case, +# the flag is set to -mtune (or equivalent) so that the architecture is +# only used for tuning, but the instruction set used is still portable. In +# the latter case, the flag is set to -march (or equivalent) so that +# architecture-specific instructions are enabled. +# +# The user can specify --with-gcc-arch= in order to override the +# macro's choice of architecture, or --without-gcc-arch to disable this. +# +# When cross-compiling, or if $CC is not gcc, then ACTION-FAILURE is +# called unless the user specified --with-gcc-arch manually. +# +# Requires macros: AX_CHECK_COMPILE_FLAG, AX_GCC_X86_CPUID +# +# (The main emphasis here is on recent CPUs, on the principle that doing +# high-performance computing on old hardware is uncommon.) +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# Copyright (c) 2012 Tsukasa Oi +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 11 + +AC_DEFUN([AX_GCC_ARCHFLAG], +[AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_CANONICAL_HOST]) + +AC_ARG_WITH(gcc-arch, [AS_HELP_STRING([--with-gcc-arch=], [use architecture for gcc -march/-mtune, instead of guessing])], + ax_gcc_arch=$withval, ax_gcc_arch=yes) + +AC_MSG_CHECKING([for gcc architecture flag]) +AC_MSG_RESULT([]) +AC_CACHE_VAL(ax_cv_gcc_archflag, +[ +ax_cv_gcc_archflag="unknown" + +if test "$GCC" = yes; then + +if test "x$ax_gcc_arch" = xyes; then +ax_gcc_arch="" +if test "$cross_compiling" = no; then +case $host_cpu in + i[[3456]]86*|x86_64*) # use cpuid codes + AX_GCC_X86_CPUID(0) + AX_GCC_X86_CPUID(1) + case $ax_cv_gcc_x86_cpuid_0 in + *:756e6547:*:*) # Intel + case $ax_cv_gcc_x86_cpuid_1 in + *5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;; + *5??:*:*:*) ax_gcc_arch=pentium ;; + *0?6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *0?6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *0?6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *0?6[[9de]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; + *0?6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *0?6f?:*:*:*|*1?66?:*:*:*) ax_gcc_arch="core2 pentium-m pentium3 pentiumpro" ;; + *1?6[[7d]]?:*:*:*) ax_gcc_arch="penryn core2 pentium-m pentium3 pentiumpro" ;; + *1?6[[aef]]?:*:*:*|*2?6[[5cef]]?:*:*:*) ax_gcc_arch="corei7 core2 pentium-m pentium3 pentiumpro" ;; + *1?6c?:*:*:*|*[[23]]?66?:*:*:*) ax_gcc_arch="atom core2 pentium-m pentium3 pentiumpro" ;; + *2?6[[ad]]?:*:*:*) ax_gcc_arch="corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;; + *0?6??:*:*:*) ax_gcc_arch=pentiumpro ;; + *6??:*:*:*) ax_gcc_arch="core2 pentiumpro" ;; + ?000?f3[[347]]:*:*:*|?000?f4[1347]:*:*:*|?000?f6?:*:*:*) + case $host_cpu in + x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; + *) ax_gcc_arch="prescott pentium4 pentiumpro" ;; + esac ;; + ?000?f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; + esac ;; + *:68747541:*:*) # AMD + case $ax_cv_gcc_x86_cpuid_1 in + *5[[67]]?:*:*:*) ax_gcc_arch=k6 ;; + *5[[8d]]?:*:*:*) ax_gcc_arch="k6-2 k6" ;; + *5[[9]]?:*:*:*) ax_gcc_arch="k6-3 k6" ;; + *60?:*:*:*) ax_gcc_arch=k7 ;; + *6[[12]]?:*:*:*) ax_gcc_arch="athlon k7" ;; + *6[[34]]?:*:*:*) ax_gcc_arch="athlon-tbird k7" ;; + *67?:*:*:*) ax_gcc_arch="athlon-4 athlon k7" ;; + *6[[68a]]?:*:*:*) + AX_GCC_X86_CPUID(0x80000006) # L2 cache size + case $ax_cv_gcc_x86_cpuid_0x80000006 in + *:*:*[[1-9a-f]]??????:*) # (L2 = ecx >> 16) >= 256 + ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;; + *) ax_gcc_arch="athlon-4 athlon k7" ;; + esac ;; + ?00??f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; + ?00??f5?:*:*:*) ax_gcc_arch="opteron k8" ;; + ?00??f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; + ?00??f??:*:*:*) ax_gcc_arch="k8" ;; + ?05??f??:*:*:*) ax_gcc_arch="btver1 amdfam10 k8" ;; + ?06??f??:*:*:*) ax_gcc_arch="bdver1 amdfam10 k8" ;; + *f??:*:*:*) ax_gcc_arch="amdfam10 k8" ;; + esac ;; + *:746e6543:*:*) # IDT + case $ax_cv_gcc_x86_cpuid_1 in + *54?:*:*:*) ax_gcc_arch=winchip-c6 ;; + *58?:*:*:*) ax_gcc_arch=winchip2 ;; + *6[[78]]?:*:*:*) ax_gcc_arch=c3 ;; + *69?:*:*:*) ax_gcc_arch="c3-2 c3" ;; + esac ;; + esac + if test x"$ax_gcc_arch" = x; then # fallback + case $host_cpu in + i586*) ax_gcc_arch=pentium ;; + i686*) ax_gcc_arch=pentiumpro ;; + esac + fi + ;; + + sparc*) + AC_PATH_PROG([PRTDIAG], [prtdiag], [prtdiag], [$PATH:/usr/platform/`uname -i`/sbin/:/usr/platform/`uname -m`/sbin/]) + cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null` + cputype=`echo "$cputype" | tr -d ' -' |tr $as_cr_LETTERS $as_cr_letters` + case $cputype in + *ultrasparciv*) ax_gcc_arch="ultrasparc4 ultrasparc3 ultrasparc v9" ;; + *ultrasparciii*) ax_gcc_arch="ultrasparc3 ultrasparc v9" ;; + *ultrasparc*) ax_gcc_arch="ultrasparc v9" ;; + *supersparc*|*tms390z5[[05]]*) ax_gcc_arch="supersparc v8" ;; + *hypersparc*|*rt62[[056]]*) ax_gcc_arch="hypersparc v8" ;; + *cypress*) ax_gcc_arch=cypress ;; + esac ;; + + alphaev5) ax_gcc_arch=ev5 ;; + alphaev56) ax_gcc_arch=ev56 ;; + alphapca56) ax_gcc_arch="pca56 ev56" ;; + alphapca57) ax_gcc_arch="pca57 pca56 ev56" ;; + alphaev6) ax_gcc_arch=ev6 ;; + alphaev67) ax_gcc_arch=ev67 ;; + alphaev68) ax_gcc_arch="ev68 ev67" ;; + alphaev69) ax_gcc_arch="ev69 ev68 ev67" ;; + alphaev7) ax_gcc_arch="ev7 ev69 ev68 ev67" ;; + alphaev79) ax_gcc_arch="ev79 ev7 ev69 ev68 ev67" ;; + + powerpc*) + cputype=`((grep cpu /proc/cpuinfo | head -n 1 | cut -d: -f2 | cut -d, -f1 | sed 's/ //g') ; /usr/bin/machine ; /bin/machine; grep CPU /var/run/dmesg.boot | head -n 1 | cut -d" " -f2) 2> /dev/null` + cputype=`echo $cputype | sed -e 's/ppc//g;s/ *//g'` + case $cputype in + *750*) ax_gcc_arch="750 G3" ;; + *740[[0-9]]*) ax_gcc_arch="$cputype 7400 G4" ;; + *74[[4-5]][[0-9]]*) ax_gcc_arch="$cputype 7450 G4" ;; + *74[[0-9]][[0-9]]*) ax_gcc_arch="$cputype G4" ;; + *970*) ax_gcc_arch="970 G5 power4";; + *POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";; + *POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";; + 603ev|8240) ax_gcc_arch="$cputype 603e 603";; + *) ax_gcc_arch=$cputype ;; + esac + ax_gcc_arch="$ax_gcc_arch powerpc" + ;; +esac +fi # not cross-compiling +fi # guess arch + +if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then +for arch in $ax_gcc_arch; do + if test "x[]m4_default([$1],yes)" = xyes; then # if we require portable code + flags="-mtune=$arch" + # -mcpu=$arch and m$arch generate nonportable code on every arch except + # x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr. + case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac + else + flags="-march=$arch -mcpu=$arch -m$arch" + fi + for flag in $flags; do + AX_CHECK_COMPILE_FLAG($flag, [ax_cv_gcc_archflag=$flag; break]) + done + test "x$ax_cv_gcc_archflag" = xunknown || break +done +fi + +fi # $GCC=yes +]) +AC_MSG_CHECKING([for gcc architecture flag]) +AC_MSG_RESULT($ax_cv_gcc_archflag) +if test "x$ax_cv_gcc_archflag" = xunknown; then + m4_default([$3],:) +else + m4_default([$2], [CFLAGS="$CFLAGS $ax_cv_gcc_archflag"]) +fi +]) diff --git a/Modules/_ctypes/libffi/m4/ax_gcc_x86_cpuid.m4 b/Modules/_ctypes/libffi/m4/ax_gcc_x86_cpuid.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_gcc_x86_cpuid.m4 @@ -0,0 +1,79 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_gcc_x86_cpuid.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_X86_CPUID(OP) +# +# DESCRIPTION +# +# On Pentium and later x86 processors, with gcc or a compiler that has a +# compatible syntax for inline assembly instructions, run a small program +# that executes the cpuid instruction with input OP. This can be used to +# detect the CPU type. +# +# On output, the values of the eax, ebx, ecx, and edx registers are stored +# as hexadecimal strings as "eax:ebx:ecx:edx" in the cache variable +# ax_cv_gcc_x86_cpuid_OP. +# +# If the cpuid instruction fails (because you are running a +# cross-compiler, or because you are not using gcc, or because you are on +# a processor that doesn't have this instruction), ax_cv_gcc_x86_cpuid_OP +# is set to the string "unknown". +# +# This macro mainly exists to be used in AX_GCC_ARCHFLAG. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 7 + +AC_DEFUN([AX_GCC_X86_CPUID], +[AC_REQUIRE([AC_PROG_CC]) +AC_LANG_PUSH([C]) +AC_CACHE_CHECK(for x86 cpuid $1 output, ax_cv_gcc_x86_cpuid_$1, + [AC_RUN_IFELSE([AC_LANG_PROGRAM([#include ], [ + int op = $1, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; +])], + [ax_cv_gcc_x86_cpuid_$1=`cat conftest_cpuid`; rm -f conftest_cpuid], + [ax_cv_gcc_x86_cpuid_$1=unknown; rm -f conftest_cpuid], + [ax_cv_gcc_x86_cpuid_$1=unknown])]) +AC_LANG_POP([C]) +]) diff --git a/Modules/_ctypes/libffi/m4/libtool.m4 b/Modules/_ctypes/libffi/m4/libtool.m4 --- a/Modules/_ctypes/libffi/m4/libtool.m4 +++ b/Modules/_ctypes/libffi/m4/libtool.m4 @@ -1,7 +1,8 @@ # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives @@ -10,7 +11,8 @@ m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. @@ -37,7 +39,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) -# serial 56 LT_INIT +# serial 57 LT_INIT # LT_PREREQ(VERSION) @@ -66,6 +68,7 @@ # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl @@ -82,6 +85,8 @@ AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) @@ -118,7 +123,7 @@ *) break;; esac done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) @@ -138,6 +143,11 @@ m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl +dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl @@ -160,10 +170,13 @@ dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our @@ -179,7 +192,6 @@ _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl -_LT_PROG_ECHO_BACKSLASH case $host_os in aix3*) @@ -193,23 +205,6 @@ ;; esac -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([["`\\]]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - # Global variables: ofile=libtool can_build_shared=yes @@ -250,6 +245,28 @@ ])# _LT_SETUP +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' @@ -408,7 +425,7 @@ # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS @@ -418,7 +435,7 @@ # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # -# ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) @@ -517,12 +534,20 @@ LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -533,9 +558,9 @@ # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -543,16 +568,38 @@ esac done -# Fix-up fallback echo if it was mangled by the above quoting rules. -case \$lt_ECHO in -*'\\\[$]0 --fallback-echo"')dnl " - lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` - ;; -esac - _LT_OUTPUT_LIBTOOL_INIT ]) +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# `#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test $lt_write_fail = 0 && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- @@ -562,20 +609,11 @@ AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) -cat >"$CONFIG_LT" <<_LTEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate a libtool stub with the current configuration. - +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AS_SHELL_SANITIZE -_AS_PREPARE - -exec AS_MESSAGE_FD>&1 exec AS_MESSAGE_LOG_FD>>config.log { echo @@ -601,7 +639,7 @@ m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. -Copyright (C) 2008 Free Software Foundation, Inc. +Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." @@ -646,15 +684,13 @@ # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. -if test "$no_create" != yes; then - lt_cl_success=: - test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" - exec AS_MESSAGE_LOG_FD>/dev/null - $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false - exec AS_MESSAGE_LOG_FD>>config.log - $lt_cl_success || AS_EXIT(1) -fi +lt_cl_success=: +test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT @@ -717,15 +753,12 @@ # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - _LT_PROG_XSI_SHELLFNS - - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + _LT_PROG_REPLACE_SHELLFNS + + mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], @@ -770,6 +803,7 @@ m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], @@ -791,6 +825,31 @@ ])# _LT_LANG +m4_ifndef([AC_PROG_GO], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GOC], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GOC, gccgo) +if test -z "$GOC"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GOC"; then + AC_CHECK_PROG(GOC, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef + + # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], @@ -821,6 +880,10 @@ m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) @@ -831,11 +894,13 @@ AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER @@ -921,7 +986,13 @@ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD @@ -929,6 +1000,7 @@ rm -rf libconftest.dylib* rm -f conftest.* fi]) + AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no @@ -940,6 +1012,34 @@ [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) + + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; @@ -967,7 +1067,7 @@ else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - if test "$DSYMUTIL" != ":"; then + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= @@ -977,8 +1077,8 @@ ]) -# _LT_DARWIN_LINKER_FEATURES -# -------------------------- +# _LT_DARWIN_LINKER_FEATURES([TAG]) +# --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ @@ -987,7 +1087,13 @@ _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(whole_archive_flag_spec, $1)='' + if test "$lt_cv_ld_force_load" = "yes"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], + [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in @@ -995,7 +1101,7 @@ *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=echo + output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" @@ -1011,203 +1117,142 @@ fi ]) -# _LT_SYS_MODULE_PATH_AIX -# ----------------------- +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl -AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_SHELL_INIT +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + # _LT_PROG_ECHO_BACKSLASH # ----------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script which will find a shell with a builtin +# printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], -[_LT_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$lt_ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case "$ECHO" in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; esac -ECHO=${lt_ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<_LT_EOF -[$]* -_LT_EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$lt_ECHO"; then - if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if { echo_test_string=`eval $cmd`; } 2>/dev/null && - { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null - then - break - fi - done - fi - - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : - else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$ECHO" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - ECHO='print -r' - elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - ECHO='printf %s\n' - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - ECHO="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - ECHO=echo - fi - fi - fi - fi - fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -lt_ECHO=$ECHO -if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(lt_ECHO) -]) +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], - [An echo program that does not interpret backslashes]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[ --with-sysroot[=DIR] Search for dependent libraries within DIR + (or the compiler's sysroot if not specified).], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([${with_sysroot}]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and in which our libraries should be installed.])]) + # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], @@ -1236,7 +1281,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in @@ -1279,7 +1324,14 @@ LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -1329,14 +1381,27 @@ CFLAGS="$SAVE_CFLAGS" fi ;; -sparc*-*solaris*) +*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" @@ -1354,14 +1419,47 @@ ])# _LT_ENABLE_LOCK +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], -[AC_CHECK_TOOL(AR, ar, false) -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1]) +[_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: @@ -1380,18 +1478,27 @@ if test -n "$RANLIB"; then case $host_os in openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE @@ -1416,15 +1523,15 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes @@ -1464,7 +1571,7 @@ if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes @@ -1527,6 +1634,11 @@ lt_cv_sys_max_cmd_len=8192; ;; + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. @@ -1552,6 +1664,11 @@ lt_cv_sys_max_cmd_len=196608 ;; + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not @@ -1578,7 +1695,8 @@ ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -1591,8 +1709,8 @@ # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ - = "XX$teststring$teststring"; } >/dev/null 2>&1 && + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` @@ -1643,7 +1761,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -[#line __oline__ "configure" +[#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -1684,7 +1802,13 @@ # endif #endif -void fnord() { int i=42;} +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -1693,7 +1817,11 @@ if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } /* dlclose (self); */ } else @@ -1869,16 +1997,16 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes @@ -2037,6 +2165,7 @@ m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ @@ -2045,16 +2174,23 @@ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` - else - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= @@ -2067,7 +2203,7 @@ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done - lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; @@ -2087,7 +2223,13 @@ if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` - sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) @@ -2113,7 +2255,7 @@ case $host_os in aix3*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH @@ -2122,7 +2264,7 @@ ;; aix[[4-9]]*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes @@ -2175,7 +2317,7 @@ m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; @@ -2187,7 +2329,7 @@ ;; bsdi[[45]]*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' @@ -2206,8 +2348,9 @@ need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + case $GCC,$cc_basename in + yes,*) + # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ @@ -2228,36 +2371,83 @@ cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac + dynamic_linker='Win32 ld.exe' ;; + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + *) + # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' ;; esac - dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -2278,7 +2468,7 @@ ;; dgux*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' @@ -2286,10 +2476,6 @@ shlibpath_var=LD_LIBRARY_PATH ;; -freebsd1*) - dynamic_linker=no - ;; - freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. @@ -2297,7 +2483,7 @@ objformat=`/usr/bin/objformat` else case $host_os in - freebsd[[123]]*) objformat=aout ;; + freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi @@ -2315,7 +2501,7 @@ esac shlibpath_var=LD_LIBRARY_PATH case $host_os in - freebsd2*) + freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) @@ -2335,12 +2521,26 @@ ;; gnu*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; @@ -2386,12 +2586,14 @@ soname_spec='${libname}${release}${shared_ext}$major' ;; esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 ;; interix[[3-9]]*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' @@ -2407,7 +2609,7 @@ nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; @@ -2444,9 +2646,9 @@ dynamic_linker=no ;; -# This must be Linux ELF. -linux* | k*bsd*-gnu) - version_type=linux +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -2454,16 +2656,21 @@ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install @@ -2475,8 +2682,9 @@ # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -2507,7 +2715,7 @@ ;; newsos6) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -2576,7 +2784,7 @@ ;; solaris*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -2601,7 +2809,7 @@ ;; sysv4 | sysv4.3*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH @@ -2625,7 +2833,7 @@ sysv4*MP*) if test -d /usr/nec ;then - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH @@ -2656,7 +2864,7 @@ tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -2666,7 +2874,7 @@ ;; uts4*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH @@ -2708,6 +2916,8 @@ The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], @@ -2820,6 +3030,7 @@ AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], @@ -2941,6 +3152,11 @@ esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' @@ -2949,8 +3165,8 @@ fi ;; esac -_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl -_LT_DECL([], [reload_cmds], [2])dnl +_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl +_LT_TAGDECL([], [reload_cmds], [2])dnl ])# _LT_CMD_RELOAD @@ -3002,16 +3218,18 @@ # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -cegcc) +cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' @@ -3041,6 +3259,10 @@ lt_cv_deplibs_check_method=pass_all ;; +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in @@ -3049,11 +3271,11 @@ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac @@ -3074,8 +3296,8 @@ lt_cv_deplibs_check_method=pass_all ;; -# This must be Linux ELF. -linux* | k*bsd*-gnu) +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; @@ -3153,6 +3375,21 @@ ;; esac ]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -3160,7 +3397,11 @@ _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method == "file_magic"]) + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD @@ -3217,7 +3458,19 @@ NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. - AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" @@ -3230,13 +3483,13 @@ AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -3251,6 +3504,67 @@ dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + # LT_LIB_M # -------- @@ -3259,7 +3573,7 @@ [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) @@ -3287,7 +3601,12 @@ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, @@ -3304,6 +3623,7 @@ m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl @@ -3371,8 +3691,8 @@ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= @@ -3396,6 +3716,7 @@ # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ @@ -3408,6 +3729,7 @@ else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no @@ -3429,7 +3751,7 @@ if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -3441,6 +3763,18 @@ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t at _DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT@&t at _DLSYM_CONST +#else +# define LT@&t at _DLSYM_CONST const +#endif + #ifdef __cplusplus extern "C" { #endif @@ -3452,7 +3786,7 @@ cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ -const struct { +LT@&t at _DLSYM_CONST struct { const char *name; void *address; } @@ -3478,15 +3812,15 @@ _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi @@ -3519,6 +3853,13 @@ AC_MSG_RESULT(ok) fi +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], @@ -3529,6 +3870,8 @@ _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS @@ -3540,7 +3883,6 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= -AC_MSG_CHECKING([for $compiler option to produce PIC]) m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then @@ -3591,6 +3933,11 @@ # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. @@ -3640,6 +3987,12 @@ ;; esac ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; dgux*) case $cc_basename in ec++*) @@ -3696,7 +4049,7 @@ ;; esac ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler @@ -3729,8 +4082,8 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - xlc* | xlC*) - # IBM XL 8.0 on PPC + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' @@ -3792,7 +4145,7 @@ ;; solaris*) case $cc_basename in - CC*) + CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' @@ -3896,6 +4249,12 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag @@ -3938,6 +4297,15 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi + ;; + esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in @@ -3980,7 +4348,7 @@ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -4001,7 +4369,13 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; - pgcc* | pgf77* | pgf90* | pgf95*) + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4013,25 +4387,40 @@ # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - xl*) - # IBM XL C 8.0/Fortran 10.1 on PPC + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ F* | *Sun*Fortran*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + *Intel*\ [[CF]]*Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *Portland\ Group*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; esac ;; @@ -4063,7 +4452,7 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in - f77* | f90* | f95*) + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; @@ -4120,9 +4509,11 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac -AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. @@ -4141,6 +4532,8 @@ _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # @@ -4161,6 +4554,7 @@ m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl @@ -4169,27 +4563,37 @@ AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; + ;; cygwin* | mingw* | cegcc*) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - ;; + case $cc_basename in + cl*) + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; + ;; esac - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= @@ -4204,7 +4608,6 @@ _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported @@ -4252,7 +4655,33 @@ esac _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' @@ -4270,6 +4699,7 @@ fi supports_anon_versioning=no case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... @@ -4285,11 +4715,12 @@ _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 -*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. _LT_EOF fi @@ -4325,10 +4756,12 @@ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -4346,6 +4779,11 @@ fi ;; + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -4361,7 +4799,7 @@ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - gnu* | linux* | tpf* | k*bsd*-gnu) + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in @@ -4371,15 +4809,16 @@ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then - tmp_addflag= + tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -4390,13 +4829,17 @@ lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; - xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 @@ -4412,17 +4855,16 @@ fi case $cc_basename in - xlf*) + xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac @@ -4436,8 +4878,8 @@ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; @@ -4455,8 +4897,8 @@ _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -4502,8 +4944,8 @@ *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -4543,8 +4985,10 @@ else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi @@ -4631,9 +5075,9 @@ _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' @@ -4642,14 +5086,19 @@ else # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' @@ -4681,20 +5130,64 @@ # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac ;; darwin* | rhapsody*) @@ -4707,10 +5200,6 @@ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; - freebsd1*) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little @@ -4723,7 +5212,7 @@ ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) + freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes @@ -4732,7 +5221,7 @@ # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -4740,7 +5229,7 @@ hpux9*) if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi @@ -4755,14 +5244,13 @@ ;; hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes @@ -4774,16 +5262,16 @@ ;; hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then + if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else @@ -4795,7 +5283,14 @@ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi @@ -4823,19 +5318,34 @@ irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE(int foo(void) {}, - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - ) - LDFLAGS="$save_LDFLAGS" + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS="$save_LDFLAGS"]) + if test "$lt_cv_irix_exported_symbol" = yes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' @@ -4897,17 +5407,17 @@ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' @@ -4917,13 +5427,13 @@ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -4936,9 +5446,9 @@ _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) @@ -5114,36 +5624,38 @@ # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi @@ -5180,9 +5692,6 @@ _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], - [[If ld is used when linking, flag to hardcode $libdir into a binary - during linking. This must work even if $libdir does not exist]]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], @@ -5208,8 +5717,6 @@ to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [fix_srcfile_path], [1], - [Fix the shell variable $srcfile for the compiler]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], @@ -5220,6 +5727,8 @@ [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented @@ -5313,14 +5822,15 @@ ])# _LT_LANG_C_CONFIG -# _LT_PROG_CXX -# ------------ -# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ -# compiler, we have our own version here. -m4_defun([_LT_PROG_CXX], -[ -pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) -AC_PROG_CXX +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then @@ -5328,22 +5838,6 @@ else _lt_caught_CXX_error=yes fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_CXX - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_CXX], []) - - -# _LT_LANG_CXX_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a C++ compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_CXX_CONFIG], -[AC_REQUIRE([_LT_PROG_CXX])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no @@ -5355,7 +5849,6 @@ _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported @@ -5365,6 +5858,8 @@ _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no @@ -5396,6 +5891,7 @@ # Allow CC to be a program name with arguments. lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX @@ -5413,6 +5909,7 @@ fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -5434,8 +5931,8 @@ # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -5467,7 +5964,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no @@ -5576,10 +6073,10 @@ _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' @@ -5588,14 +6085,19 @@ else # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. @@ -5625,28 +6127,75 @@ ;; cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; @@ -5669,7 +6218,7 @@ esac ;; - freebsd[[12]]*) + freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no @@ -5688,6 +6237,11 @@ gnu*) ;; + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: @@ -5712,11 +6266,11 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no @@ -5777,7 +6331,7 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then @@ -5787,10 +6341,10 @@ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi @@ -5820,7 +6374,7 @@ case $cc_basename in CC*) # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -5831,9 +6385,9 @@ *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -5844,7 +6398,7 @@ _LT_TAGVAR(inherit_rpath, $1)=yes ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler @@ -5862,7 +6416,7 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -5899,26 +6453,26 @@ pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in - *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; - *) # Version 6 will use weak symbols + *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; @@ -5926,7 +6480,7 @@ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ @@ -5945,9 +6499,9 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; - xl*) + xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -5967,13 +6521,13 @@ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. - output_verbose_link_cmd='echo' + output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is @@ -6042,7 +6596,7 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi - output_verbose_link_cmd=echo + output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -6077,15 +6631,15 @@ case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; @@ -6101,17 +6655,17 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac @@ -6121,7 +6675,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support @@ -6157,7 +6711,7 @@ solaris*) case $cc_basename in - CC*) + CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' @@ -6178,7 +6732,7 @@ esac _LT_TAGVAR(link_all_deplibs, $1)=yes - output_verbose_link_cmd='echo' + output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is @@ -6198,14 +6752,14 @@ if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. @@ -6216,7 +6770,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' @@ -6270,6 +6824,10 @@ CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' @@ -6325,6 +6883,7 @@ fi # test -n "$compiler" CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC @@ -6339,6 +6898,29 @@ ])# _LT_LANG_CXX_CONFIG +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose @@ -6347,6 +6929,7 @@ # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= @@ -6396,7 +6979,20 @@ } }; _LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF ]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then @@ -6408,7 +7004,7 @@ pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do - case $p in + case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. @@ -6417,13 +7013,22 @@ test $p = "-R"; then prev=$p continue - else - prev= fi + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) + case ${prev} in + -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. @@ -6443,8 +7048,10 @@ _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi + prev= ;; + *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. @@ -6480,6 +7087,7 @@ fi $RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], @@ -6516,7 +7124,7 @@ solaris*) case $cc_basename in - CC*) + CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as @@ -6560,32 +7168,16 @@ ])# _LT_SYS_HIDDEN_LIBDEPS -# _LT_PROG_F77 -# ------------ -# Since AC_PROG_F77 is broken, in that it returns the empty string -# if there is no fortran compiler, we have our own version here. -m4_defun([_LT_PROG_F77], -[ -pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) -AC_PROG_F77 -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_F77 - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_F77], []) - - # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], -[AC_REQUIRE([_LT_PROG_F77])dnl -AC_LANG_PUSH(Fortran 77) +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= @@ -6595,7 +7187,6 @@ _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no @@ -6604,6 +7195,8 @@ _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no @@ -6643,7 +7236,9 @@ # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} + CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -6697,38 +7292,24 @@ GCC=$lt_save_GCC CC="$lt_save_CC" + CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG -# _LT_PROG_FC -# ----------- -# Since AC_PROG_FC is broken, in that it returns the empty string -# if there is no fortran compiler, we have our own version here. -m4_defun([_LT_PROG_FC], -[ -pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) -AC_PROG_FC -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_FC - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_FC], []) - - # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], -[AC_REQUIRE([_LT_PROG_FC])dnl -AC_LANG_PUSH(Fortran) +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= @@ -6738,7 +7319,6 @@ _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no @@ -6747,6 +7327,8 @@ _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no @@ -6786,7 +7368,9 @@ # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} + CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu @@ -6842,7 +7426,8 @@ fi # test -n "$compiler" GCC=$lt_save_GCC - CC="$lt_save_CC" + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP @@ -6879,10 +7464,12 @@ _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. -lt_save_CC="$CC" +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" @@ -6892,6 +7479,8 @@ _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change @@ -6911,10 +7500,82 @@ AC_LANG_RESTORE GCC=$lt_save_GCC -CC="$lt_save_CC" +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GOC-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG + + # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler @@ -6946,9 +7607,11 @@ # Allow CC to be a program name with arguments. lt_save_CC="$CC" +lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} +CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -6961,7 +7624,8 @@ GCC=$lt_save_GCC AC_LANG_RESTORE -CC="$lt_save_CC" +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG @@ -6981,6 +7645,13 @@ dnl AC_DEFUN([LT_AC_PROG_GCJ], []) +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GOC, gccgo,) +]) + + # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], @@ -7020,6 +7691,15 @@ AC_SUBST([OBJDUMP]) ]) +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) # _LT_DECL_SED # ------------ @@ -7113,8 +7793,8 @@ # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes @@ -7153,208 +7833,162 @@ ])# _LT_CHECK_SHELL_FEATURES -# _LT_PROG_XSI_SHELLFNS -# --------------------- -# Bourne and XSI compatible variants of some useful shell functions. -m4_defun([_LT_PROG_XSI_SHELLFNS], -[case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $[*] )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} - -_LT_EOF +# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) +# ------------------------------------------------------ +# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and +# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. +m4_defun([_LT_PROG_FUNCTION_REPLACE], +[dnl { +sed -e '/^$1 ()$/,/^} # $1 /c\ +$1 ()\ +{\ +m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) +} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: +]) + + +# _LT_PROG_REPLACE_SHELLFNS +# ------------------------- +# Replace existing portable implementations of several shell functions with +# equivalent extended shell implementations where those features are available.. +m4_defun([_LT_PROG_REPLACE_SHELLFNS], +[if test x"$xsi_shell" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl + func_split_long_opt_name=${1%%=*} + func_split_long_opt_arg=${1#*=}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) + + _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) + + _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) + + _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) +fi + +if test x"$lt_shell_append" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) + + _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl + func_quote_for_eval "${2}" +dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ + eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) +fi +]) + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine which file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} - -dnl func_dirname_and_basename -dnl A portable version of this function is already defined in general.m4sh -dnl so there is no need for it here. - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; - esac -} - -# sed scripts: -my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[[^=]]*=//' - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` -} - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$[@]"` -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` -} - -_LT_EOF + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; esac - -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]+=\$[2]" -} -_LT_EOF +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]=\$$[1]\$[2]" -} - -_LT_EOF - ;; - esac +esac ]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/Modules/_ctypes/libffi/m4/ltoptions.m4 b/Modules/_ctypes/libffi/m4/ltoptions.m4 --- a/Modules/_ctypes/libffi/m4/ltoptions.m4 +++ b/Modules/_ctypes/libffi/m4/ltoptions.m4 @@ -1,13 +1,14 @@ # Helper functions for option handling. -*- Autoconf -*- # -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, +# Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 6 ltoptions.m4 +# serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) @@ -125,7 +126,7 @@ [enable_win32_dll=yes case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) @@ -133,13 +134,13 @@ esac test -z "$AS" && AS=as -_LT_DECL([], [AS], [0], [Assembler program])dnl +_LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], @@ -325,9 +326,24 @@ # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic], + [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) diff --git a/Modules/_ctypes/libffi/m4/ltversion.m4 b/Modules/_ctypes/libffi/m4/ltversion.m4 --- a/Modules/_ctypes/libffi/m4/ltversion.m4 +++ b/Modules/_ctypes/libffi/m4/ltversion.m4 @@ -7,17 +7,17 @@ # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# Generated from ltversion.in. +# @configure_input@ -# serial 3012 ltversion.m4 +# serial 3337 ltversion.m4 # This file is part of GNU Libtool -m4_define([LT_PACKAGE_VERSION], [2.2.6]) -m4_define([LT_PACKAGE_REVISION], [1.3012]) +m4_define([LT_PACKAGE_VERSION], [2.4.2]) +m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.2.6' -macro_revision='1.3012' +[macro_version='2.4.2' +macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) diff --git a/Modules/_ctypes/libffi/m4/lt~obsolete.m4 b/Modules/_ctypes/libffi/m4/lt~obsolete.m4 --- a/Modules/_ctypes/libffi/m4/lt~obsolete.m4 +++ b/Modules/_ctypes/libffi/m4/lt~obsolete.m4 @@ -1,13 +1,13 @@ # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # -# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 4 lt~obsolete.m4 +# serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # @@ -77,7 +77,6 @@ m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) @@ -90,3 +89,10 @@ m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/Modules/_ctypes/libffi/man/Makefile.am b/Modules/_ctypes/libffi/man/Makefile.am --- a/Modules/_ctypes/libffi/man/Makefile.am +++ b/Modules/_ctypes/libffi/man/Makefile.am @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS=foreign -EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 +EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 -man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 +man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 diff --git a/Modules/_ctypes/libffi/man/Makefile.in b/Modules/_ctypes/libffi/man/Makefile.in --- a/Modules/_ctypes/libffi/man/Makefile.in +++ b/Modules/_ctypes/libffi/man/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.12.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,6 +14,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -37,7 +53,19 @@ subdir = man DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_cc_maxopt.m4 \ + $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_configure_args.m4 \ + $(top_srcdir)/m4/ax_enable_builddir.m4 \ + $(top_srcdir)/m4/ax_gcc_archflag.m4 \ + $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -47,6 +75,11 @@ CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -68,6 +101,12 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } man3dir = $(mandir)/man3 am__installdirs = "$(DESTDIR)$(man3dir)" NROFF = nroff @@ -76,6 +115,7 @@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ +AM_LTLDFLAGS = @AM_LTLDFLAGS@ AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -93,6 +133,7 @@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -100,6 +141,7 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ FGREP = @FGREP@ GREP = @GREP@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ @@ -118,6 +160,7 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -130,8 +173,10 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PRTDIAG = @PRTDIAG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -144,6 +189,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -151,6 +197,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -176,7 +223,6 @@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -187,6 +233,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ @@ -199,8 +246,8 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign -EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 -man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 +EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 +man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 all: all-am .SUFFIXES: @@ -242,11 +289,18 @@ -rm -rf .libs _libs install-man3: $(man_MANS) @$(NORMAL_INSTALL) - test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" - @list=''; test -n "$(man3dir)" || exit 0; \ - { for i in $$list; do echo "$$i"; done; \ - l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.3[a-z]*$$/p'; \ + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man3dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.3[a-z]*$$/p'; \ + fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ @@ -275,15 +329,15 @@ sed -n '/\.3[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ - test -z "$$files" || { \ - echo " ( cd '$(DESTDIR)$(man3dir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(man3dir)" && rm -f $$files; } + dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: +cscope cscopelist: + distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ @@ -292,10 +346,10 @@ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ - echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ + echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ - echo " typically \`make maintainer-clean' will remove them" >&2; \ + echo " typically 'make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @@ -345,10 +399,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: diff --git a/Modules/_ctypes/libffi/man/ffi.3 b/Modules/_ctypes/libffi/man/ffi.3 --- a/Modules/_ctypes/libffi/man/ffi.3 +++ b/Modules/_ctypes/libffi/man/ffi.3 @@ -16,6 +16,15 @@ .Fa "ffi_type **atypes" .Fc .Ft void +.Fo ffi_prep_cif_var +.Fa "ffi_cif *cif" +.Fa "ffi_abi abi" +.Fa "unsigned int nfixedargs" +.Fa "unsigned int ntotalargs" +.Fa "ffi_type *rtype" +.Fa "ffi_type **atypes" +.Fc +.Ft void .Fo ffi_call .Fa "ffi_cif *cif" .Fa "void (*fn)(void)" @@ -28,4 +37,5 @@ the called function's interface at compile time. .Sh SEE ALSO .Xr ffi_prep_cif 3 , +.Xr ffi_prep_cif_var 3 , .Xr ffi_call 3 diff --git a/Modules/_ctypes/libffi/man/ffi_prep_cif.3 b/Modules/_ctypes/libffi/man/ffi_prep_cif.3 --- a/Modules/_ctypes/libffi/man/ffi_prep_cif.3 +++ b/Modules/_ctypes/libffi/man/ffi_prep_cif.3 @@ -37,7 +37,9 @@ points to an .Nm ffi_type that describes the data type, size and alignment of the -return value. +return value. Note that to call a variadic function +.Nm ffi_prep_cif_var +must be used instead. .Sh RETURN VALUES Upon successful completion, .Nm ffi_prep_cif @@ -59,8 +61,8 @@ .Nm FFI_BAD_ABI will be returned. Available ABIs are defined in -.Nm -. +.Nm . .Sh SEE ALSO .Xr ffi 3 , -.Xr ffi_call 3 +.Xr ffi_call 3 , +.Xr ffi_prep_cif_var 3 diff --git a/Modules/_ctypes/libffi/man/ffi_prep_cif_var.3 b/Modules/_ctypes/libffi/man/ffi_prep_cif_var.3 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/man/ffi_prep_cif_var.3 @@ -0,0 +1,73 @@ +.Dd January 25, 2011 +.Dt ffi_prep_cif_var 3 +.Sh NAME +.Nm ffi_prep_cif_var +.Nd Prepare a +.Nm ffi_cif +structure for use with +.Nm ffi_call +for variadic functions. +.Sh SYNOPSIS +.In ffi.h +.Ft ffi_status +.Fo ffi_prep_cif_var +.Fa "ffi_cif *cif" +.Fa "ffi_abi abi" +.Fa "unsigned int nfixedargs" +.Fa "unsigned int ntotalargs" +.Fa "ffi_type *rtype" +.Fa "ffi_type **atypes" +.Fc +.Sh DESCRIPTION +The +.Nm ffi_prep_cif_var +function prepares a +.Nm ffi_cif +structure for use with +.Nm ffi_call +for variadic functions. +.Fa abi +specifies a set of calling conventions to use. +.Fa atypes +is an array of +.Fa ntotalargs +pointers to +.Nm ffi_type +structs that describe the data type, size and alignment of each argument. +.Fa rtype +points to an +.Nm ffi_type +that describes the data type, size and alignment of the +return value. +.Fa nfixedargs +must contain the number of fixed (non-variadic) arguments. +Note that to call a non-variadic function +.Nm ffi_prep_cif +must be used. +.Sh RETURN VALUES +Upon successful completion, +.Nm ffi_prep_cif_var +returns +.Nm FFI_OK . +It will return +.Nm FFI_BAD_TYPEDEF +if +.Fa cif +is +.Nm NULL +or +.Fa atypes +or +.Fa rtype +is malformed. If +.Fa abi +does not refer to a valid ABI, +.Nm FFI_BAD_ABI +will be returned. Available ABIs are +defined in +.Nm +. +.Sh SEE ALSO +.Xr ffi 3 , +.Xr ffi_call 3 , +.Xr ffi_prep_cif 3 diff --git a/Modules/_ctypes/libffi/mdate-sh b/Modules/_ctypes/libffi/mdate-sh old mode 100755 new mode 100644 diff --git a/Modules/_ctypes/libffi/missing b/Modules/_ctypes/libffi/missing --- a/Modules/_ctypes/libffi/missing +++ b/Modules/_ctypes/libffi/missing @@ -1,10 +1,10 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2005-06-08.21 +scriptversion=2009-04-28.21; # UTC -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify @@ -18,9 +18,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -33,6 +31,8 @@ fi run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. @@ -44,7 +44,7 @@ msg="missing on your system" -case "$1" in +case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= @@ -77,6 +77,7 @@ aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c @@ -86,6 +87,9 @@ tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. + Send bug reports to ." exit $? ;; @@ -103,15 +107,22 @@ esac +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect -# the program). -case "$1" in - lex|yacc) +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) # Not GNU programs, they don't have --version. ;; - tar) + tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 @@ -135,7 +146,7 @@ # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. -case "$1" in +case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if @@ -145,7 +156,7 @@ touch aclocal.m4 ;; - autoconf) + autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the @@ -154,7 +165,7 @@ touch configure ;; - autoheader) + autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want @@ -164,7 +175,7 @@ test -z "$files" && files="config.h" touch_files= for f in $files; do - case "$f" in + case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; @@ -184,7 +195,7 @@ while read f; do touch "$f"; done ;; - autom4te) + autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the @@ -192,8 +203,8 @@ You can get \`$1' as part of \`Autoconf' from any GNU archive site." - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else @@ -207,80 +218,78 @@ fi ;; - bison|yacc) + bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then + if test $# -ne 1; then eval LASTARG="\${$#}" - case "$LASTARG" in + case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi - if [ ! -f y.tab.h ]; then + if test ! -f y.tab.h; then echo >y.tab.h fi - if [ ! -f y.tab.c ]; then + if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; - lex|flex) + lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c - if [ $# -ne 1 ]; then + if test $# -ne 1; then eval LASTARG="\${$#}" - case "$LASTARG" in + case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi - if [ ! -f lex.yy.c ]; then + if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; - help2man) + help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" - exit 1 + exit $? fi ;; - makeinfo) + makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file @@ -289,11 +298,17 @@ DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi @@ -303,7 +318,7 @@ touch $file ;; - tar) + tar*) shift # We have already tried tar in the generic part. @@ -317,13 +332,13 @@ fi firstarg="$1" if shift; then - case "$firstarg" in + case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac - case "$firstarg" in + case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 @@ -356,5 +371,6 @@ # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: diff --git a/Modules/_ctypes/libffi/msvcc.sh b/Modules/_ctypes/libffi/msvcc.sh old mode 100644 new mode 100755 --- a/Modules/_ctypes/libffi/msvcc.sh +++ b/Modules/_ctypes/libffi/msvcc.sh @@ -42,13 +42,11 @@ # format and translated into something sensible for cl or ml. # -# Disable specific warnings, and enable warnings-as-errors so we catch any -# mistranslated args. -nowarn="-wd4127 -wd4820 -wd4706 -wd4100 -wd4255 -wd4668 -wd4053 -wd4324" -args="-nologo -W3 -WX $nowarn" +args="-nologo -W3" md=-MD cl="cl" ml="ml" +safeseh="-safeseh" output= while [ $# -gt 0 ] @@ -66,15 +64,28 @@ -m64) cl="cl" # "$MSVC/x86_amd64/cl" ml="ml64" # "$MSVC/x86_amd64/ml64" + safeseh= + shift 1 + ;; + -O0) + args="$args -Od" shift 1 ;; -O*) - args="$args $1" + # If we're optimizing, make sure we explicitly turn on some optimizations + # that are implicitly disabled by debug symbols (-Zi). + args="$args $1 -OPT:REF -OPT:ICF -INCREMENTAL:NO" shift 1 ;; -g) - # Can't specify -RTC1 or -Zi in opt. -Gy is ok. Use -OPT:REF? - args="$args -D_DEBUG -RTC1 -Zi" + # Enable debug symbol generation. + args="$args -Zi -DEBUG" + shift 1 + ;; + -DFFI_DEBUG) + # Link against debug CRT and enable runtime error checks. + args="$args -RTC1" + defines="$defines $1" md=-MDd shift 1 ;; @@ -111,7 +122,8 @@ shift 1 ;; -Wall) - args="$args -Wall" + # -Wall on MSVC is overzealous, and we already build with -W3. Nothing + # to do here. shift 1 ;; -Werror) @@ -166,7 +178,7 @@ echo "$cl -nologo -EP $includes $defines $src > $ppsrc" "$cl" -nologo -EP $includes $defines $src > $ppsrc || exit $? output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')" - args="-nologo -safeseh $single $output $ppsrc" + args="-nologo $safeseh $single $output $ppsrc" echo "$ml $args" eval "\"$ml\" $args" diff --git a/Modules/_ctypes/libffi/src/aarch64/ffi.c b/Modules/_ctypes/libffi/src/aarch64/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/aarch64/ffi.c @@ -0,0 +1,1076 @@ +/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include +#include + +#include + +/* Stack alignment requirement in bytes */ +#define AARCH64_STACK_ALIGN 16 + +#define N_X_ARG_REG 8 +#define N_V_ARG_REG 8 + +#define AARCH64_FFI_WITH_V (1 << AARCH64_FFI_WITH_V_BIT) + +union _d +{ + UINT64 d; + UINT32 s[2]; +}; + +struct call_context +{ + UINT64 x [AARCH64_N_XREG]; + struct + { + union _d d[2]; + } v [AARCH64_N_VREG]; +}; + +static void * +get_x_addr (struct call_context *context, unsigned n) +{ + return &context->x[n]; +} + +static void * +get_s_addr (struct call_context *context, unsigned n) +{ +#if defined __AARCH64EB__ + return &context->v[n].d[1].s[1]; +#else + return &context->v[n].d[0].s[0]; +#endif +} + +static void * +get_d_addr (struct call_context *context, unsigned n) +{ +#if defined __AARCH64EB__ + return &context->v[n].d[1]; +#else + return &context->v[n].d[0]; +#endif +} + +static void * +get_v_addr (struct call_context *context, unsigned n) +{ + return &context->v[n]; +} + +/* Return the memory location at which a basic type would reside + were it to have been stored in register n. */ + +static void * +get_basic_type_addr (unsigned short type, struct call_context *context, + unsigned n) +{ + switch (type) + { + case FFI_TYPE_FLOAT: + return get_s_addr (context, n); + case FFI_TYPE_DOUBLE: + return get_d_addr (context, n); + case FFI_TYPE_LONGDOUBLE: + return get_v_addr (context, n); + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_INT: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + return get_x_addr (context, n); + default: + FFI_ASSERT (0); + return NULL; + } +} + +/* Return the alignment width for each of the basic types. */ + +static size_t +get_basic_type_alignment (unsigned short type) +{ + switch (type) + { + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + return sizeof (UINT64); + case FFI_TYPE_LONGDOUBLE: + return sizeof (long double); + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + return sizeof (UINT64); + + default: + FFI_ASSERT (0); + return 0; + } +} + +/* Return the size in bytes for each of the basic types. */ + +static size_t +get_basic_type_size (unsigned short type) +{ + switch (type) + { + case FFI_TYPE_FLOAT: + return sizeof (UINT32); + case FFI_TYPE_DOUBLE: + return sizeof (UINT64); + case FFI_TYPE_LONGDOUBLE: + return sizeof (long double); + case FFI_TYPE_UINT8: + return sizeof (UINT8); + case FFI_TYPE_SINT8: + return sizeof (SINT8); + case FFI_TYPE_UINT16: + return sizeof (UINT16); + case FFI_TYPE_SINT16: + return sizeof (SINT16); + case FFI_TYPE_UINT32: + return sizeof (UINT32); + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + return sizeof (SINT32); + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + return sizeof (UINT64); + case FFI_TYPE_SINT64: + return sizeof (SINT64); + + default: + FFI_ASSERT (0); + return 0; + } +} + +extern void +ffi_call_SYSV (unsigned (*)(struct call_context *context, unsigned char *, + extended_cif *), + struct call_context *context, + extended_cif *, + unsigned, + void (*fn)(void)); + +extern void +ffi_closure_SYSV (ffi_closure *); + +/* Test for an FFI floating point representation. */ + +static unsigned +is_floating_type (unsigned short type) +{ + return (type == FFI_TYPE_FLOAT || type == FFI_TYPE_DOUBLE + || type == FFI_TYPE_LONGDOUBLE); +} + +/* Test for a homogeneous structure. */ + +static unsigned short +get_homogeneous_type (ffi_type *ty) +{ + if (ty->type == FFI_TYPE_STRUCT && ty->elements) + { + unsigned i; + unsigned short candidate_type + = get_homogeneous_type (ty->elements[0]); + for (i =1; ty->elements[i]; i++) + { + unsigned short iteration_type = 0; + /* If we have a nested struct, we must find its homogeneous type. + If that fits with our candidate type, we are still + homogeneous. */ + if (ty->elements[i]->type == FFI_TYPE_STRUCT + && ty->elements[i]->elements) + { + iteration_type = get_homogeneous_type (ty->elements[i]); + } + else + { + iteration_type = ty->elements[i]->type; + } + + /* If we are not homogeneous, return FFI_TYPE_STRUCT. */ + if (candidate_type != iteration_type) + return FFI_TYPE_STRUCT; + } + return candidate_type; + } + + /* Base case, we have no more levels of nesting, so we + are a basic type, and so, trivially homogeneous in that type. */ + return ty->type; +} + +/* Determine the number of elements within a STRUCT. + + Note, we must handle nested structs. + + If ty is not a STRUCT this function will return 0. */ + +static unsigned +element_count (ffi_type *ty) +{ + if (ty->type == FFI_TYPE_STRUCT && ty->elements) + { + unsigned n; + unsigned elems = 0; + for (n = 0; ty->elements[n]; n++) + { + if (ty->elements[n]->type == FFI_TYPE_STRUCT + && ty->elements[n]->elements) + elems += element_count (ty->elements[n]); + else + elems++; + } + return elems; + } + return 0; +} + +/* Test for a homogeneous floating point aggregate. + + A homogeneous floating point aggregate is a homogeneous aggregate of + a half- single- or double- precision floating point type with one + to four elements. Note that this includes nested structs of the + basic type. */ + +static int +is_hfa (ffi_type *ty) +{ + if (ty->type == FFI_TYPE_STRUCT + && ty->elements[0] + && is_floating_type (get_homogeneous_type (ty))) + { + unsigned n = element_count (ty); + return n >= 1 && n <= 4; + } + return 0; +} + +/* Test if an ffi_type is a candidate for passing in a register. + + This test does not check that sufficient registers of the + appropriate class are actually available, merely that IFF + sufficient registers are available then the argument will be passed + in register(s). + + Note that an ffi_type that is deemed to be a register candidate + will always be returned in registers. + + Returns 1 if a register candidate else 0. */ + +static int +is_register_candidate (ffi_type *ty) +{ + switch (ty->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + case FFI_TYPE_UINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_UINT64: + case FFI_TYPE_POINTER: + case FFI_TYPE_SINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_SINT32: + case FFI_TYPE_INT: + case FFI_TYPE_SINT64: + return 1; + + case FFI_TYPE_STRUCT: + if (is_hfa (ty)) + { + return 1; + } + else if (ty->size > 16) + { + /* Too large. Will be replaced with a pointer to memory. The + pointer MAY be passed in a register, but the value will + not. This test specifically fails since the argument will + never be passed by value in registers. */ + return 0; + } + else + { + /* Might be passed in registers depending on the number of + registers required. */ + return (ty->size + 7) / 8 < N_X_ARG_REG; + } + break; + + default: + FFI_ASSERT (0); + break; + } + + return 0; +} + +/* Test if an ffi_type argument or result is a candidate for a vector + register. */ + +static int +is_v_register_candidate (ffi_type *ty) +{ + return is_floating_type (ty->type) + || (ty->type == FFI_TYPE_STRUCT && is_hfa (ty)); +} + +/* Representation of the procedure call argument marshalling + state. + + The terse state variable names match the names used in the AARCH64 + PCS. */ + +struct arg_state +{ + unsigned ngrn; /* Next general-purpose register number. */ + unsigned nsrn; /* Next vector register number. */ + unsigned nsaa; /* Next stack offset. */ +}; + +/* Initialize a procedure call argument marshalling state. */ +static void +arg_init (struct arg_state *state, unsigned call_frame_size) +{ + state->ngrn = 0; + state->nsrn = 0; + state->nsaa = 0; +} + +/* Return the number of available consecutive core argument + registers. */ + +static unsigned +available_x (struct arg_state *state) +{ + return N_X_ARG_REG - state->ngrn; +} + +/* Return the number of available consecutive vector argument + registers. */ + +static unsigned +available_v (struct arg_state *state) +{ + return N_V_ARG_REG - state->nsrn; +} + +static void * +allocate_to_x (struct call_context *context, struct arg_state *state) +{ + FFI_ASSERT (state->ngrn < N_X_ARG_REG) + return get_x_addr (context, (state->ngrn)++); +} + +static void * +allocate_to_s (struct call_context *context, struct arg_state *state) +{ + FFI_ASSERT (state->nsrn < N_V_ARG_REG) + return get_s_addr (context, (state->nsrn)++); +} + +static void * +allocate_to_d (struct call_context *context, struct arg_state *state) +{ + FFI_ASSERT (state->nsrn < N_V_ARG_REG) + return get_d_addr (context, (state->nsrn)++); +} + +static void * +allocate_to_v (struct call_context *context, struct arg_state *state) +{ + FFI_ASSERT (state->nsrn < N_V_ARG_REG) + return get_v_addr (context, (state->nsrn)++); +} + +/* Allocate an aligned slot on the stack and return a pointer to it. */ +static void * +allocate_to_stack (struct arg_state *state, void *stack, unsigned alignment, + unsigned size) +{ + void *allocation; + + /* Round up the NSAA to the larger of 8 or the natural + alignment of the argument's type. */ + state->nsaa = ALIGN (state->nsaa, alignment); + state->nsaa = ALIGN (state->nsaa, alignment); + state->nsaa = ALIGN (state->nsaa, 8); + + allocation = stack + state->nsaa; + + state->nsaa += size; + return allocation; +} + +static void +copy_basic_type (void *dest, void *source, unsigned short type) +{ + /* This is neccessary to ensure that basic types are copied + sign extended to 64-bits as libffi expects. */ + switch (type) + { + case FFI_TYPE_FLOAT: + *(float *) dest = *(float *) source; + break; + case FFI_TYPE_DOUBLE: + *(double *) dest = *(double *) source; + break; + case FFI_TYPE_LONGDOUBLE: + *(long double *) dest = *(long double *) source; + break; + case FFI_TYPE_UINT8: + *(ffi_arg *) dest = *(UINT8 *) source; + break; + case FFI_TYPE_SINT8: + *(ffi_sarg *) dest = *(SINT8 *) source; + break; + case FFI_TYPE_UINT16: + *(ffi_arg *) dest = *(UINT16 *) source; + break; + case FFI_TYPE_SINT16: + *(ffi_sarg *) dest = *(SINT16 *) source; + break; + case FFI_TYPE_UINT32: + *(ffi_arg *) dest = *(UINT32 *) source; + break; + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + *(ffi_sarg *) dest = *(SINT32 *) source; + break; + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + *(ffi_arg *) dest = *(UINT64 *) source; + break; + case FFI_TYPE_SINT64: + *(ffi_sarg *) dest = *(SINT64 *) source; + break; + + default: + FFI_ASSERT (0); + } +} + +static void +copy_hfa_to_reg_or_stack (void *memory, + ffi_type *ty, + struct call_context *context, + unsigned char *stack, + struct arg_state *state) +{ + unsigned elems = element_count (ty); + if (available_v (state) < elems) + { + /* There are insufficient V registers. Further V register allocations + are prevented, the NSAA is adjusted (by allocate_to_stack ()) + and the argument is copied to memory at the adjusted NSAA. */ + state->nsrn = N_V_ARG_REG; + memcpy (allocate_to_stack (state, stack, ty->alignment, ty->size), + memory, + ty->size); + } + else + { + int i; + unsigned short type = get_homogeneous_type (ty); + unsigned elems = element_count (ty); + for (i = 0; i < elems; i++) + { + void *reg = allocate_to_v (context, state); + copy_basic_type (reg, memory, type); + memory += get_basic_type_size (type); + } + } +} + +/* Either allocate an appropriate register for the argument type, or if + none are available, allocate a stack slot and return a pointer + to the allocated space. */ + +static void * +allocate_to_register_or_stack (struct call_context *context, + unsigned char *stack, + struct arg_state *state, + unsigned short type) +{ + size_t alignment = get_basic_type_alignment (type); + size_t size = alignment; + switch (type) + { + case FFI_TYPE_FLOAT: + /* This is the only case for which the allocated stack size + should not match the alignment of the type. */ + size = sizeof (UINT32); + /* Fall through. */ + case FFI_TYPE_DOUBLE: + if (state->nsrn < N_V_ARG_REG) + return allocate_to_d (context, state); + state->nsrn = N_V_ARG_REG; + break; + case FFI_TYPE_LONGDOUBLE: + if (state->nsrn < N_V_ARG_REG) + return allocate_to_v (context, state); + state->nsrn = N_V_ARG_REG; + break; + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_INT: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + if (state->ngrn < N_X_ARG_REG) + return allocate_to_x (context, state); + state->ngrn = N_X_ARG_REG; + break; + default: + FFI_ASSERT (0); + } + + return allocate_to_stack (state, stack, alignment, size); +} + +/* Copy a value to an appropriate register, or if none are + available, to the stack. */ + +static void +copy_to_register_or_stack (struct call_context *context, + unsigned char *stack, + struct arg_state *state, + void *value, + unsigned short type) +{ + copy_basic_type ( + allocate_to_register_or_stack (context, stack, state, type), + value, + type); +} + +/* Marshall the arguments from FFI representation to procedure call + context and stack. */ + +static unsigned +aarch64_prep_args (struct call_context *context, unsigned char *stack, + extended_cif *ecif) +{ + int i; + struct arg_state state; + + arg_init (&state, ALIGN(ecif->cif->bytes, 16)); + + for (i = 0; i < ecif->cif->nargs; i++) + { + ffi_type *ty = ecif->cif->arg_types[i]; + switch (ty->type) + { + case FFI_TYPE_VOID: + FFI_ASSERT (0); + break; + + /* If the argument is a basic type the argument is allocated to an + appropriate register, or if none are available, to the stack. */ + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + copy_to_register_or_stack (context, stack, &state, + ecif->avalue[i], ty->type); + break; + + case FFI_TYPE_STRUCT: + if (is_hfa (ty)) + { + copy_hfa_to_reg_or_stack (ecif->avalue[i], ty, context, + stack, &state); + } + else if (ty->size > 16) + { + /* If the argument is a composite type that is larger than 16 + bytes, then the argument has been copied to memory, and + the argument is replaced by a pointer to the copy. */ + + copy_to_register_or_stack (context, stack, &state, + &(ecif->avalue[i]), FFI_TYPE_POINTER); + } + else if (available_x (&state) >= (ty->size + 7) / 8) + { + /* If the argument is a composite type and the size in + double-words is not more than the number of available + X registers, then the argument is copied into consecutive + X registers. */ + int j; + for (j = 0; j < (ty->size + 7) / 8; j++) + { + memcpy (allocate_to_x (context, &state), + &(((UINT64 *) ecif->avalue[i])[j]), + sizeof (UINT64)); + } + } + else + { + /* Otherwise, there are insufficient X registers. Further X + register allocations are prevented, the NSAA is adjusted + (by allocate_to_stack ()) and the argument is copied to + memory at the adjusted NSAA. */ + state.ngrn = N_X_ARG_REG; + + memcpy (allocate_to_stack (&state, stack, ty->alignment, + ty->size), ecif->avalue + i, ty->size); + } + break; + + default: + FFI_ASSERT (0); + break; + } + } + + return ecif->cif->aarch64_flags; +} + +ffi_status +ffi_prep_cif_machdep (ffi_cif *cif) +{ + /* Round the stack up to a multiple of the stack alignment requirement. */ + cif->bytes = + (cif->bytes + (AARCH64_STACK_ALIGN - 1)) & ~ (AARCH64_STACK_ALIGN - 1); + + /* Initialize our flags. We are interested if this CIF will touch a + vector register, if so we will enable context save and load to + those registers, otherwise not. This is intended to be friendly + to lazy float context switching in the kernel. */ + cif->aarch64_flags = 0; + + if (is_v_register_candidate (cif->rtype)) + { + cif->aarch64_flags |= AARCH64_FFI_WITH_V; + } + else + { + int i; + for (i = 0; i < cif->nargs; i++) + if (is_v_register_candidate (cif->arg_types[i])) + { + cif->aarch64_flags |= AARCH64_FFI_WITH_V; + break; + } + } + + return FFI_OK; +} + +/* Call a function with the provided arguments and capture the return + value. */ +void +ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + ecif.rvalue = rvalue; + + switch (cif->abi) + { + case FFI_SYSV: + { + struct call_context context; + unsigned stack_bytes; + + /* Figure out the total amount of stack space we need, the + above call frame space needs to be 16 bytes aligned to + ensure correct alignment of the first object inserted in + that space hence the ALIGN applied to cif->bytes.*/ + stack_bytes = ALIGN(cif->bytes, 16); + + memset (&context, 0, sizeof (context)); + if (is_register_candidate (cif->rtype)) + { + ffi_call_SYSV (aarch64_prep_args, &context, &ecif, stack_bytes, fn); + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_INT: + case FFI_TYPE_SINT64: + { + void *addr = get_basic_type_addr (cif->rtype->type, + &context, 0); + copy_basic_type (rvalue, addr, cif->rtype->type); + break; + } + + case FFI_TYPE_STRUCT: + if (is_hfa (cif->rtype)) + { + int j; + unsigned short type = get_homogeneous_type (cif->rtype); + unsigned elems = element_count (cif->rtype); + for (j = 0; j < elems; j++) + { + void *reg = get_basic_type_addr (type, &context, j); + copy_basic_type (rvalue, reg, type); + rvalue += get_basic_type_size (type); + } + } + else if ((cif->rtype->size + 7) / 8 < N_X_ARG_REG) + { + unsigned size = ALIGN (cif->rtype->size, sizeof (UINT64)); + memcpy (rvalue, get_x_addr (&context, 0), size); + } + else + { + FFI_ASSERT (0); + } + break; + + default: + FFI_ASSERT (0); + break; + } + } + else + { + memcpy (get_x_addr (&context, 8), &rvalue, sizeof (UINT64)); + ffi_call_SYSV (aarch64_prep_args, &context, &ecif, + stack_bytes, fn); + } + break; + } + + default: + FFI_ASSERT (0); + break; + } +} + +static unsigned char trampoline [] = +{ 0x70, 0x00, 0x00, 0x58, /* ldr x16, 1f */ + 0x91, 0x00, 0x00, 0x10, /* adr x17, 2f */ + 0x00, 0x02, 0x1f, 0xd6 /* br x16 */ +}; + +/* Build a trampoline. */ + +#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX,FLAGS) \ + ({unsigned char *__tramp = (unsigned char*)(TRAMP); \ + UINT64 __fun = (UINT64)(FUN); \ + UINT64 __ctx = (UINT64)(CTX); \ + UINT64 __flags = (UINT64)(FLAGS); \ + memcpy (__tramp, trampoline, sizeof (trampoline)); \ + memcpy (__tramp + 12, &__fun, sizeof (__fun)); \ + memcpy (__tramp + 20, &__ctx, sizeof (__ctx)); \ + memcpy (__tramp + 28, &__flags, sizeof (__flags)); \ + __clear_cache(__tramp, __tramp + FFI_TRAMPOLINE_SIZE); \ + }) + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; + + FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_SYSV, codeloc, + cif->aarch64_flags); + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + +/* Primary handler to setup and invoke a function within a closure. + + A closure when invoked enters via the assembler wrapper + ffi_closure_SYSV(). The wrapper allocates a call context on the + stack, saves the interesting registers (from the perspective of + the calling convention) into the context then passes control to + ffi_closure_SYSV_inner() passing the saved context and a pointer to + the stack at the point ffi_closure_SYSV() was invoked. + + On the return path the assembler wrapper will reload call context + regsiters. + + ffi_closure_SYSV_inner() marshalls the call context into ffi value + desriptors, invokes the wrapped function, then marshalls the return + value back into the call context. */ + +void +ffi_closure_SYSV_inner (ffi_closure *closure, struct call_context *context, + void *stack) +{ + ffi_cif *cif = closure->cif; + void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); + void *rvalue = NULL; + int i; + struct arg_state state; + + arg_init (&state, ALIGN(cif->bytes, 16)); + + for (i = 0; i < cif->nargs; i++) + { + ffi_type *ty = cif->arg_types[i]; + + switch (ty->type) + { + case FFI_TYPE_VOID: + FFI_ASSERT (0); + break; + + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_INT: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + avalue[i] = allocate_to_register_or_stack (context, stack, + &state, ty->type); + break; + + case FFI_TYPE_STRUCT: + if (is_hfa (ty)) + { + unsigned n = element_count (ty); + if (available_v (&state) < n) + { + state.nsrn = N_V_ARG_REG; + avalue[i] = allocate_to_stack (&state, stack, ty->alignment, + ty->size); + } + else + { + switch (get_homogeneous_type (ty)) + { + case FFI_TYPE_FLOAT: + { + /* Eeek! We need a pointer to the structure, + however the homogeneous float elements are + being passed in individual S registers, + therefore the structure is not represented as + a contiguous sequence of bytes in our saved + register context. We need to fake up a copy + of the structure layed out in memory + correctly. The fake can be tossed once the + closure function has returned hence alloca() + is sufficient. */ + int j; + UINT32 *p = avalue[i] = alloca (ty->size); + for (j = 0; j < element_count (ty); j++) + memcpy (&p[j], + allocate_to_s (context, &state), + sizeof (*p)); + break; + } + + case FFI_TYPE_DOUBLE: + { + /* Eeek! We need a pointer to the structure, + however the homogeneous float elements are + being passed in individual S registers, + therefore the structure is not represented as + a contiguous sequence of bytes in our saved + register context. We need to fake up a copy + of the structure layed out in memory + correctly. The fake can be tossed once the + closure function has returned hence alloca() + is sufficient. */ + int j; + UINT64 *p = avalue[i] = alloca (ty->size); + for (j = 0; j < element_count (ty); j++) + memcpy (&p[j], + allocate_to_d (context, &state), + sizeof (*p)); + break; + } + + case FFI_TYPE_LONGDOUBLE: + memcpy (&avalue[i], + allocate_to_v (context, &state), + sizeof (*avalue)); + break; + + default: + FFI_ASSERT (0); + break; + } + } + } + else if (ty->size > 16) + { + /* Replace Composite type of size greater than 16 with a + pointer. */ + memcpy (&avalue[i], + allocate_to_register_or_stack (context, stack, + &state, FFI_TYPE_POINTER), + sizeof (avalue[i])); + } + else if (available_x (&state) >= (ty->size + 7) / 8) + { + avalue[i] = get_x_addr (context, state.ngrn); + state.ngrn += (ty->size + 7) / 8; + } + else + { + state.ngrn = N_X_ARG_REG; + + avalue[i] = allocate_to_stack (&state, stack, ty->alignment, + ty->size); + } + break; + + default: + FFI_ASSERT (0); + break; + } + } + + /* Figure out where the return value will be passed, either in + registers or in a memory block allocated by the caller and passed + in x8. */ + + if (is_register_candidate (cif->rtype)) + { + /* Register candidates are *always* returned in registers. */ + + /* Allocate a scratchpad for the return value, we will let the + callee scrible the result into the scratch pad then move the + contents into the appropriate return value location for the + call convention. */ + rvalue = alloca (cif->rtype->size); + (closure->fun) (cif, rvalue, avalue, closure->user_data); + + /* Copy the return value into the call context so that it is returned + as expected to our caller. */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + break; + + case FFI_TYPE_UINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + case FFI_TYPE_SINT64: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + { + void *addr = get_basic_type_addr (cif->rtype->type, context, 0); + copy_basic_type (addr, rvalue, cif->rtype->type); + break; + } + case FFI_TYPE_STRUCT: + if (is_hfa (cif->rtype)) + { + int i; + unsigned short type = get_homogeneous_type (cif->rtype); + unsigned elems = element_count (cif->rtype); + for (i = 0; i < elems; i++) + { + void *reg = get_basic_type_addr (type, context, i); + copy_basic_type (reg, rvalue, type); + rvalue += get_basic_type_size (type); + } + } + else if ((cif->rtype->size + 7) / 8 < N_X_ARG_REG) + { + unsigned size = ALIGN (cif->rtype->size, sizeof (UINT64)) ; + memcpy (get_x_addr (context, 0), rvalue, size); + } + else + { + FFI_ASSERT (0); + } + break; + default: + FFI_ASSERT (0); + break; + } + } + else + { + memcpy (&rvalue, get_x_addr (context, 8), sizeof (UINT64)); + (closure->fun) (cif, rvalue, avalue, closure->user_data); + } +} + diff --git a/Modules/_ctypes/libffi/src/aarch64/ffitarget.h b/Modules/_ctypes/libffi/src/aarch64/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/aarch64/ffitarget.h @@ -0,0 +1,59 @@ +/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi + { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV + } ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 36 +#define FFI_NATIVE_RAW_API 0 + +/* ---- Internal ---- */ + + +#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_flags + +#define AARCH64_FFI_WITH_V_BIT 0 + +#define AARCH64_N_XREG 32 +#define AARCH64_N_VREG 32 +#define AARCH64_CALL_CONTEXT_SIZE (AARCH64_N_XREG * 8 + AARCH64_N_VREG * 16) + +#endif diff --git a/Modules/_ctypes/libffi/src/aarch64/sysv.S b/Modules/_ctypes/libffi/src/aarch64/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/aarch64/sysv.S @@ -0,0 +1,307 @@ +/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#define LIBFFI_ASM +#include +#include + +#define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off +#define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off +#define cfi_restore(reg) .cfi_restore reg +#define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg + + .text + .globl ffi_call_SYSV + .type ffi_call_SYSV, #function + +/* ffi_call_SYSV() + + Create a stack frame, setup an argument context, call the callee + and extract the result. + + The maximum required argument stack size is provided, + ffi_call_SYSV() allocates that stack space then calls the + prepare_fn to populate register context and stack. The + argument passing registers are loaded from the register + context and the callee called, on return the register passing + register are saved back to the context. Our caller will + extract the return value from the final state of the saved + register context. + + Prototype: + + extern unsigned + ffi_call_SYSV (void (*)(struct call_context *context, unsigned char *, + extended_cif *), + struct call_context *context, + extended_cif *, + unsigned required_stack_size, + void (*fn)(void)); + + Therefore on entry we have: + + x0 prepare_fn + x1 &context + x2 &ecif + x3 bytes + x4 fn + + This function uses the following stack frame layout: + + == + saved x30(lr) + x29(fp)-> saved x29(fp) + saved x24 + saved x23 + saved x22 + sp' -> saved x21 + ... + sp -> (constructed callee stack arguments) + == + + Voila! */ + +#define ffi_call_SYSV_FS (8 * 4) + + .cfi_startproc +ffi_call_SYSV: + stp x29, x30, [sp, #-16]! + cfi_adjust_cfa_offset (16) + cfi_rel_offset (x29, 0) + cfi_rel_offset (x30, 8) + + mov x29, sp + cfi_def_cfa_register (x29) + sub sp, sp, #ffi_call_SYSV_FS + + stp x21, x22, [sp, 0] + cfi_rel_offset (x21, 0 - ffi_call_SYSV_FS) + cfi_rel_offset (x22, 8 - ffi_call_SYSV_FS) + + stp x23, x24, [sp, 16] + cfi_rel_offset (x23, 16 - ffi_call_SYSV_FS) + cfi_rel_offset (x24, 24 - ffi_call_SYSV_FS) + + mov x21, x1 + mov x22, x2 + mov x24, x4 + + /* Allocate the stack space for the actual arguments, many + arguments will be passed in registers, but we assume + worst case and allocate sufficient stack for ALL of + the arguments. */ + sub sp, sp, x3 + + /* unsigned (*prepare_fn) (struct call_context *context, + unsigned char *stack, extended_cif *ecif); + */ + mov x23, x0 + mov x0, x1 + mov x1, sp + /* x2 already in place */ + blr x23 + + /* Preserve the flags returned. */ + mov x23, x0 + + /* Figure out if we should touch the vector registers. */ + tbz x23, #AARCH64_FFI_WITH_V_BIT, 1f + + /* Load the vector argument passing registers. */ + ldp q0, q1, [x21, #8*32 + 0] + ldp q2, q3, [x21, #8*32 + 32] + ldp q4, q5, [x21, #8*32 + 64] + ldp q6, q7, [x21, #8*32 + 96] +1: + /* Load the core argument passing registers. */ + ldp x0, x1, [x21, #0] + ldp x2, x3, [x21, #16] + ldp x4, x5, [x21, #32] + ldp x6, x7, [x21, #48] + + /* Don't forget x8 which may be holding the address of a return buffer. + */ + ldr x8, [x21, #8*8] + + blr x24 + + /* Save the core argument passing registers. */ + stp x0, x1, [x21, #0] + stp x2, x3, [x21, #16] + stp x4, x5, [x21, #32] + stp x6, x7, [x21, #48] + + /* Note nothing useful ever comes back in x8! */ + + /* Figure out if we should touch the vector registers. */ + tbz x23, #AARCH64_FFI_WITH_V_BIT, 1f + + /* Save the vector argument passing registers. */ + stp q0, q1, [x21, #8*32 + 0] + stp q2, q3, [x21, #8*32 + 32] + stp q4, q5, [x21, #8*32 + 64] + stp q6, q7, [x21, #8*32 + 96] +1: + /* All done, unwind our stack frame. */ + ldp x21, x22, [x29, # - ffi_call_SYSV_FS] + cfi_restore (x21) + cfi_restore (x22) + + ldp x23, x24, [x29, # - ffi_call_SYSV_FS + 16] + cfi_restore (x23) + cfi_restore (x24) + + mov sp, x29 + cfi_def_cfa_register (sp) + + ldp x29, x30, [sp], #16 + cfi_adjust_cfa_offset (-16) + cfi_restore (x29) + cfi_restore (x30) + + ret + + .cfi_endproc + .size ffi_call_SYSV, .-ffi_call_SYSV + +#define ffi_closure_SYSV_FS (8 * 2 + AARCH64_CALL_CONTEXT_SIZE) + +/* ffi_closure_SYSV + + Closure invocation glue. This is the low level code invoked directly by + the closure trampoline to setup and call a closure. + + On entry x17 points to a struct trampoline_data, x16 has been clobbered + all other registers are preserved. + + We allocate a call context and save the argument passing registers, + then invoked the generic C ffi_closure_SYSV_inner() function to do all + the real work, on return we load the result passing registers back from + the call context. + + On entry + + extern void + ffi_closure_SYSV (struct trampoline_data *); + + struct trampoline_data + { + UINT64 *ffi_closure; + UINT64 flags; + }; + + This function uses the following stack frame layout: + + == + saved x30(lr) + x29(fp)-> saved x29(fp) + saved x22 + saved x21 + ... + sp -> call_context + == + + Voila! */ + + .text + .globl ffi_closure_SYSV + .cfi_startproc +ffi_closure_SYSV: + stp x29, x30, [sp, #-16]! + cfi_adjust_cfa_offset (16) + cfi_rel_offset (x29, 0) + cfi_rel_offset (x30, 8) + + mov x29, sp + + sub sp, sp, #ffi_closure_SYSV_FS + cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) + + stp x21, x22, [x29, #-16] + cfi_rel_offset (x21, 0) + cfi_rel_offset (x22, 8) + + /* Load x21 with &call_context. */ + mov x21, sp + /* Preserve our struct trampoline_data * */ + mov x22, x17 + + /* Save the rest of the argument passing registers. */ + stp x0, x1, [x21, #0] + stp x2, x3, [x21, #16] + stp x4, x5, [x21, #32] + stp x6, x7, [x21, #48] + /* Don't forget we may have been given a result scratch pad address. + */ + str x8, [x21, #64] + + /* Figure out if we should touch the vector registers. */ + ldr x0, [x22, #8] + tbz x0, #AARCH64_FFI_WITH_V_BIT, 1f + + /* Save the argument passing vector registers. */ + stp q0, q1, [x21, #8*32 + 0] + stp q2, q3, [x21, #8*32 + 32] + stp q4, q5, [x21, #8*32 + 64] + stp q6, q7, [x21, #8*32 + 96] +1: + /* Load &ffi_closure.. */ + ldr x0, [x22, #0] + mov x1, x21 + /* Compute the location of the stack at the point that the + trampoline was called. */ + add x2, x29, #16 + + bl ffi_closure_SYSV_inner + + /* Figure out if we should touch the vector registers. */ + ldr x0, [x22, #8] + tbz x0, #AARCH64_FFI_WITH_V_BIT, 1f + + /* Load the result passing vector registers. */ + ldp q0, q1, [x21, #8*32 + 0] + ldp q2, q3, [x21, #8*32 + 32] + ldp q4, q5, [x21, #8*32 + 64] + ldp q6, q7, [x21, #8*32 + 96] +1: + /* Load the result passing core registers. */ + ldp x0, x1, [x21, #0] + ldp x2, x3, [x21, #16] + ldp x4, x5, [x21, #32] + ldp x6, x7, [x21, #48] + /* Note nothing usefull is returned in x8. */ + + /* We are done, unwind our frame. */ + ldp x21, x22, [x29, #-16] + cfi_restore (x21) + cfi_restore (x22) + + mov sp, x29 + cfi_adjust_cfa_offset (-ffi_closure_SYSV_FS) + + ldp x29, x30, [sp], #16 + cfi_adjust_cfa_offset (-16) + cfi_restore (x29) + cfi_restore (x30) + + ret + .cfi_endproc + .size ffi_closure_SYSV, .-ffi_closure_SYSV diff --git a/Modules/_ctypes/libffi/src/alpha/ffi.c b/Modules/_ctypes/libffi/src/alpha/ffi.c --- a/Modules/_ctypes/libffi/src/alpha/ffi.c +++ b/Modules/_ctypes/libffi/src/alpha/ffi.c @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998, 2001, 2007, 2008 Red Hat, Inc. + ffi.c - Copyright (c) 2012 Anthony Green + Copyright (c) 1998, 2001, 2007, 2008 Red Hat, Inc. Alpha Foreign Function Interface @@ -178,6 +179,9 @@ { unsigned int *tramp; + if (cif->abi != FFI_OSF) + return FFI_BAD_ABI; + tramp = (unsigned int *) &closure->tramp[0]; tramp[0] = 0x47fb0401; /* mov $27,$1 */ tramp[1] = 0xa77b0010; /* ldq $27,16($27) */ diff --git a/Modules/_ctypes/libffi/src/alpha/ffitarget.h b/Modules/_ctypes/libffi/src/alpha/ffitarget.h --- a/Modules/_ctypes/libffi/src/alpha/ffitarget.h +++ b/Modules/_ctypes/libffi/src/alpha/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for Alpha. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; diff --git a/Modules/_ctypes/libffi/src/alpha/osf.S b/Modules/_ctypes/libffi/src/alpha/osf.S --- a/Modules/_ctypes/libffi/src/alpha/osf.S +++ b/Modules/_ctypes/libffi/src/alpha/osf.S @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - osf.S - Copyright (c) 1998, 2001, 2007, 2008 Red Hat + osf.S - Copyright (c) 1998, 2001, 2007, 2008, 2011 Red Hat Alpha/OSF Foreign Function Interface @@ -299,33 +299,51 @@ #endif #ifdef __ELF__ +# define UA_SI .4byte +# define FDE_ENCODING 0x1b /* pcrel sdata4 */ +# define FDE_ENCODE(X) .4byte X-. +# define FDE_ARANGE(X) .4byte X +#elif defined __osf__ +# define UA_SI .align 0; .long +# define FDE_ENCODING 0x50 /* aligned absolute */ +# define FDE_ENCODE(X) .align 3; .quad X +# define FDE_ARANGE(X) .align 0; .quad X +#endif + +#ifdef __ELF__ .section .eh_frame,EH_FRAME_FLAGS, at progbits +#elif defined __osf__ + .data + .align 3 + .globl _GLOBAL__F_ffi_call_osf +_GLOBAL__F_ffi_call_osf: +#endif __FRAME_BEGIN__: - .4byte $LECIE1-$LSCIE1 # Length of Common Information Entry + UA_SI $LECIE1-$LSCIE1 # Length of Common Information Entry $LSCIE1: - .4byte 0x0 # CIE Identifier Tag + UA_SI 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .byte 0x1 # uleb128 0x1; CIE Code Alignment Factor .byte 0x78 # sleb128 -8; CIE Data Alignment Factor .byte 26 # CIE RA Column .byte 0x1 # uleb128 0x1; Augmentation size - .byte 0x1b # FDE Encoding (pcrel sdata4) + .byte FDE_ENCODING # FDE Encoding .byte 0xc # DW_CFA_def_cfa .byte 30 # uleb128 column 30 .byte 0 # uleb128 offset 0 .align 3 $LECIE1: $LSFDE1: - .4byte $LEFDE1-$LASFDE1 # FDE Length + UA_SI $LEFDE1-$LASFDE1 # FDE Length $LASFDE1: - .4byte $LASFDE1-__FRAME_BEGIN__ # FDE CIE offset - .4byte $LFB1-. # FDE initial location - .4byte $LFE1-$LFB1 # FDE address range + UA_SI $LASFDE1-__FRAME_BEGIN__ # FDE CIE offset + FDE_ENCODE($LFB1) # FDE initial location + FDE_ARANGE($LFE1-$LFB1) # FDE address range .byte 0x0 # uleb128 0x0; Augmentation size .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI1-$LFB1 + UA_SI $LCFI1-$LFB1 .byte 0x9a # DW_CFA_offset, column 26 .byte 4 # uleb128 4*-8 .byte 0x8f # DW_CFA_offset, column 15 @@ -335,32 +353,35 @@ .byte 32 # uleb128 offset 32 .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI2-$LCFI1 + UA_SI $LCFI2-$LCFI1 .byte 0xda # DW_CFA_restore, column 26 .align 3 $LEFDE1: $LSFDE3: - .4byte $LEFDE3-$LASFDE3 # FDE Length + UA_SI $LEFDE3-$LASFDE3 # FDE Length $LASFDE3: - .4byte $LASFDE3-__FRAME_BEGIN__ # FDE CIE offset - .4byte $LFB2-. # FDE initial location - .4byte $LFE2-$LFB2 # FDE address range + UA_SI $LASFDE3-__FRAME_BEGIN__ # FDE CIE offset + FDE_ENCODE($LFB2) # FDE initial location + FDE_ARANGE($LFE2-$LFB2) # FDE address range .byte 0x0 # uleb128 0x0; Augmentation size .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI5-$LFB2 + UA_SI $LCFI5-$LFB2 .byte 0xe # DW_CFA_def_cfa_offset .byte 0x80,0x1 # uleb128 128 .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI6-$LCFI5 + UA_SI $LCFI6-$LCFI5 .byte 0x9a # DW_CFA_offset, column 26 .byte 16 # uleb128 offset 16*-8 .align 3 $LEFDE3: +#if defined __osf__ + .align 0 + .long 0 # End of Table +#endif -#ifdef __linux__ +#if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"", at progbits #endif -#endif diff --git a/Modules/_ctypes/libffi/src/arm/ffi.c b/Modules/_ctypes/libffi/src/arm/ffi.c --- a/Modules/_ctypes/libffi/src/arm/ffi.c +++ b/Modules/_ctypes/libffi/src/arm/ffi.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998, 2008 Red Hat, Inc. - + ffi.c - Copyright (c) 2011 Timothy Wall + Copyright (c) 2011 Plausible Labs Cooperative, Inc. + Copyright (c) 2011 Anthony Green + Copyright (c) 2011 Free Software Foundation + Copyright (c) 1998, 2008, 2011 Red Hat, Inc. + ARM Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining @@ -29,12 +33,20 @@ #include +/* Forward declares. */ +static int vfp_type_p (ffi_type *); +static void layout_vfp_args (ffi_cif *); + /* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments */ - -void ffi_prep_args(char *stack, extended_cif *ecif) + has been allocated for the function's arguments + + The vfp_space parameter is the load area for VFP regs, the return + value is cif->vfp_used (word bitset of VFP regs used for passing + arguments). These are only used for the VFP hard-float ABI. +*/ +int ffi_prep_args(char *stack, extended_cif *ecif, float *vfp_space) { - register unsigned int i; + register unsigned int i, vi = 0; register void **p_argv; register char *argp; register ffi_type **p_arg; @@ -53,10 +65,31 @@ i--, p_arg++) { size_t z; + size_t alignment; + + /* Allocated in VFP registers. */ + if (ecif->cif->abi == FFI_VFP + && vi < ecif->cif->vfp_nargs && vfp_type_p (*p_arg)) + { + float* vfp_slot = vfp_space + ecif->cif->vfp_args[vi++]; + if ((*p_arg)->type == FFI_TYPE_FLOAT) + *((float*)vfp_slot) = *((float*)*p_argv); + else if ((*p_arg)->type == FFI_TYPE_DOUBLE) + *((double*)vfp_slot) = *((double*)*p_argv); + else + memcpy(vfp_slot, *p_argv, (*p_arg)->size); + p_argv++; + continue; + } /* Align if necessary */ - if (((*p_arg)->alignment - 1) & (unsigned) argp) { - argp = (char *) ALIGN(argp, (*p_arg)->alignment); + alignment = (*p_arg)->alignment; +#ifdef _WIN32_WCE + if (alignment > 4) + alignment = 4; +#endif + if ((alignment - 1) & (unsigned) argp) { + argp = (char *) ALIGN(argp, alignment); } if ((*p_arg)->type == FFI_TYPE_STRUCT) @@ -103,13 +136,15 @@ p_argv++; argp += z; } - - return; + + /* Indicate the VFP registers used. */ + return ecif->cif->vfp_used; } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { + int type_code; /* Round the stack up to a multiple of 8 bytes. This isn't needed everywhere, but it is on some platforms, and it doesn't harm anything when it isn't needed. */ @@ -130,7 +165,14 @@ break; case FFI_TYPE_STRUCT: - if (cif->rtype->size <= 4) + if (cif->abi == FFI_VFP + && (type_code = vfp_type_p (cif->rtype)) != 0) + { + /* A Composite Type passed in VFP registers, either + FFI_TYPE_STRUCT_VFP_FLOAT or FFI_TYPE_STRUCT_VFP_DOUBLE. */ + cif->flags = (unsigned) type_code; + } + else if (cif->rtype->size <= 4) /* A Composite Type not larger than 4 bytes is returned in r0. */ cif->flags = (unsigned)FFI_TYPE_INT; else @@ -145,11 +187,30 @@ break; } + /* Map out the register placements of VFP register args. + The VFP hard-float calling conventions are slightly more sophisticated than + the base calling conventions, so we do it here instead of in ffi_prep_args(). */ + if (cif->abi == FFI_VFP) + layout_vfp_args (cif); + return FFI_OK; } -extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, - unsigned, unsigned, unsigned *, void (*fn)(void)); +/* Perform machine dependent cif processing for variadic calls */ +ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif, + unsigned int nfixedargs, + unsigned int ntotalargs) +{ + /* VFP variadic calls actually use the SYSV ABI */ + if (cif->abi == FFI_VFP) + cif->abi = FFI_SYSV; + + return ffi_prep_cif_machdep(cif); +} + +/* Prototypes for assembly functions, in sysv.S */ +extern void ffi_call_SYSV (void (*fn)(void), extended_cif *, unsigned, unsigned, unsigned *); +extern void ffi_call_VFP (void (*fn)(void), extended_cif *, unsigned, unsigned, unsigned *); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { @@ -157,6 +218,8 @@ int small_struct = (cif->flags == FFI_TYPE_INT && cif->rtype->type == FFI_TYPE_STRUCT); + int vfp_struct = (cif->flags == FFI_TYPE_STRUCT_VFP_FLOAT + || cif->flags == FFI_TYPE_STRUCT_VFP_DOUBLE); ecif.cif = cif; ecif.avalue = avalue; @@ -173,38 +236,53 @@ } else if (small_struct) ecif.rvalue = &temp; + else if (vfp_struct) + { + /* Largest case is double x 4. */ + ecif.rvalue = alloca(32); + } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: - ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, - fn); + ffi_call_SYSV (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); + break; + case FFI_VFP: +#ifdef __ARM_EABI__ + ffi_call_VFP (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); break; +#endif + default: FFI_ASSERT(0); break; } if (small_struct) memcpy (rvalue, &temp, cif->rtype->size); + else if (vfp_struct) + memcpy (rvalue, ecif.rvalue, cif->rtype->size); } /** private members **/ static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, - void** args, ffi_cif* cif); + void** args, ffi_cif* cif, float *vfp_stack); void ffi_closure_SYSV (ffi_closure *); +void ffi_closure_VFP (ffi_closure *); + /* This function is jumped to by the trampoline */ unsigned int -ffi_closure_SYSV_inner (closure, respp, args) +ffi_closure_SYSV_inner (closure, respp, args, vfp_args) ffi_closure *closure; void **respp; void *args; + void *vfp_args; { // our various things... ffi_cif *cif; @@ -219,7 +297,7 @@ * a structure, it will re-set RESP to point to the * structure return address. */ - ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif, vfp_args); (closure->fun) (cif, *respp, arg_area, closure->user_data); @@ -229,10 +307,12 @@ /*@-exportheader@*/ static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, - void **avalue, ffi_cif *cif) + void **avalue, ffi_cif *cif, + /* Used only under VFP hard-float ABI. */ + float *vfp_stack) /*@=exportheader@*/ { - register unsigned int i; + register unsigned int i, vi = 0; register void **p_argv; register char *argp; register ffi_type **p_arg; @@ -249,10 +329,23 @@ for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { size_t z; + size_t alignment; + + if (cif->abi == FFI_VFP + && vi < cif->vfp_nargs && vfp_type_p (*p_arg)) + { + *p_argv++ = (void*)(vfp_stack + cif->vfp_args[vi++]); + continue; + } - size_t alignment = (*p_arg)->alignment; + alignment = (*p_arg)->alignment; if (alignment < 4) alignment = 4; +#ifdef _WIN32_WCE + else + if (alignment > 4) + alignment = 4; +#endif /* Align if necessary */ if ((alignment - 1) & (unsigned) argp) { argp = (char *) ALIGN(argp, alignment); @@ -273,18 +366,237 @@ /* How to make a trampoline. */ +extern unsigned int ffi_arm_trampoline[3]; + +#if FFI_EXEC_TRAMPOLINE_TABLE + +#include +#include +#include +#include + +extern void *ffi_closure_trampoline_table_page; + +typedef struct ffi_trampoline_table ffi_trampoline_table; +typedef struct ffi_trampoline_table_entry ffi_trampoline_table_entry; + +struct ffi_trampoline_table { + /* contigious writable and executable pages */ + vm_address_t config_page; + vm_address_t trampoline_page; + + /* free list tracking */ + uint16_t free_count; + ffi_trampoline_table_entry *free_list; + ffi_trampoline_table_entry *free_list_pool; + + ffi_trampoline_table *prev; + ffi_trampoline_table *next; +}; + +struct ffi_trampoline_table_entry { + void *(*trampoline)(); + ffi_trampoline_table_entry *next; +}; + +/* Override the standard architecture trampoline size */ +// XXX TODO - Fix +#undef FFI_TRAMPOLINE_SIZE +#define FFI_TRAMPOLINE_SIZE 12 + +/* The trampoline configuration is placed at 4080 bytes prior to the trampoline's entry point */ +#define FFI_TRAMPOLINE_CODELOC_CONFIG(codeloc) ((void **) (((uint8_t *) codeloc) - 4080)); + +/* The first 16 bytes of the config page are unused, as they are unaddressable from the trampoline page. */ +#define FFI_TRAMPOLINE_CONFIG_PAGE_OFFSET 16 + +/* Total number of trampolines that fit in one trampoline table */ +#define FFI_TRAMPOLINE_COUNT ((PAGE_SIZE - FFI_TRAMPOLINE_CONFIG_PAGE_OFFSET) / FFI_TRAMPOLINE_SIZE) + +static pthread_mutex_t ffi_trampoline_lock = PTHREAD_MUTEX_INITIALIZER; +static ffi_trampoline_table *ffi_trampoline_tables = NULL; + +static ffi_trampoline_table * +ffi_trampoline_table_alloc () +{ + ffi_trampoline_table *table = NULL; + + /* Loop until we can allocate two contigious pages */ + while (table == NULL) { + vm_address_t config_page = 0x0; + kern_return_t kt; + + /* Try to allocate two pages */ + kt = vm_allocate (mach_task_self (), &config_page, PAGE_SIZE*2, VM_FLAGS_ANYWHERE); + if (kt != KERN_SUCCESS) { + fprintf(stderr, "vm_allocate() failure: %d at %s:%d\n", kt, __FILE__, __LINE__); + break; + } + + /* Now drop the second half of the allocation to make room for the trampoline table */ + vm_address_t trampoline_page = config_page+PAGE_SIZE; + kt = vm_deallocate (mach_task_self (), trampoline_page, PAGE_SIZE); + if (kt != KERN_SUCCESS) { + fprintf(stderr, "vm_deallocate() failure: %d at %s:%d\n", kt, __FILE__, __LINE__); + break; + } + + /* Remap the trampoline table to directly follow the config page */ + vm_prot_t cur_prot; + vm_prot_t max_prot; + + kt = vm_remap (mach_task_self (), &trampoline_page, PAGE_SIZE, 0x0, FALSE, mach_task_self (), (vm_address_t) &ffi_closure_trampoline_table_page, FALSE, &cur_prot, &max_prot, VM_INHERIT_SHARE); + + /* If we lost access to the destination trampoline page, drop our config allocation mapping and retry */ + if (kt != KERN_SUCCESS) { + /* Log unexpected failures */ + if (kt != KERN_NO_SPACE) { + fprintf(stderr, "vm_remap() failure: %d at %s:%d\n", kt, __FILE__, __LINE__); + } + + vm_deallocate (mach_task_self (), config_page, PAGE_SIZE); + continue; + } + + /* We have valid trampoline and config pages */ + table = calloc (1, sizeof(ffi_trampoline_table)); + table->free_count = FFI_TRAMPOLINE_COUNT; + table->config_page = config_page; + table->trampoline_page = trampoline_page; + + /* Create and initialize the free list */ + table->free_list_pool = calloc(FFI_TRAMPOLINE_COUNT, sizeof(ffi_trampoline_table_entry)); + + uint16_t i; + for (i = 0; i < table->free_count; i++) { + ffi_trampoline_table_entry *entry = &table->free_list_pool[i]; + entry->trampoline = (void *) (table->trampoline_page + (i * FFI_TRAMPOLINE_SIZE)); + + if (i < table->free_count - 1) + entry->next = &table->free_list_pool[i+1]; + } + + table->free_list = table->free_list_pool; + } + + return table; +} + +void * +ffi_closure_alloc (size_t size, void **code) +{ + /* Create the closure */ + ffi_closure *closure = malloc(size); + if (closure == NULL) + return NULL; + + pthread_mutex_lock(&ffi_trampoline_lock); + + /* Check for an active trampoline table with available entries. */ + ffi_trampoline_table *table = ffi_trampoline_tables; + if (table == NULL || table->free_list == NULL) { + table = ffi_trampoline_table_alloc (); + if (table == NULL) { + free(closure); + return NULL; + } + + /* Insert the new table at the top of the list */ + table->next = ffi_trampoline_tables; + if (table->next != NULL) + table->next->prev = table; + + ffi_trampoline_tables = table; + } + + /* Claim the free entry */ + ffi_trampoline_table_entry *entry = ffi_trampoline_tables->free_list; + ffi_trampoline_tables->free_list = entry->next; + ffi_trampoline_tables->free_count--; + entry->next = NULL; + + pthread_mutex_unlock(&ffi_trampoline_lock); + + /* Initialize the return values */ + *code = entry->trampoline; + closure->trampoline_table = table; + closure->trampoline_table_entry = entry; + + return closure; +} + +void +ffi_closure_free (void *ptr) +{ + ffi_closure *closure = ptr; + + pthread_mutex_lock(&ffi_trampoline_lock); + + /* Fetch the table and entry references */ + ffi_trampoline_table *table = closure->trampoline_table; + ffi_trampoline_table_entry *entry = closure->trampoline_table_entry; + + /* Return the entry to the free list */ + entry->next = table->free_list; + table->free_list = entry; + table->free_count++; + + /* If all trampolines within this table are free, and at least one other table exists, deallocate + * the table */ + if (table->free_count == FFI_TRAMPOLINE_COUNT && ffi_trampoline_tables != table) { + /* Remove from the list */ + if (table->prev != NULL) + table->prev->next = table->next; + + if (table->next != NULL) + table->next->prev = table->prev; + + /* Deallocate pages */ + kern_return_t kt; + kt = vm_deallocate (mach_task_self (), table->config_page, PAGE_SIZE); + if (kt != KERN_SUCCESS) + fprintf(stderr, "vm_deallocate() failure: %d at %s:%d\n", kt, __FILE__, __LINE__); + + kt = vm_deallocate (mach_task_self (), table->trampoline_page, PAGE_SIZE); + if (kt != KERN_SUCCESS) + fprintf(stderr, "vm_deallocate() failure: %d at %s:%d\n", kt, __FILE__, __LINE__); + + /* Deallocate free list */ + free (table->free_list_pool); + free (table); + } else if (ffi_trampoline_tables != table) { + /* Otherwise, bump this table to the top of the list */ + table->prev = NULL; + table->next = ffi_trampoline_tables; + if (ffi_trampoline_tables != NULL) + ffi_trampoline_tables->prev = table; + + ffi_trampoline_tables = table; + } + + pthread_mutex_unlock (&ffi_trampoline_lock); + + /* Free the closure */ + free (closure); +} + +#else + #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ ({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ unsigned int __fun = (unsigned int)(FUN); \ unsigned int __ctx = (unsigned int)(CTX); \ - *(unsigned int*) &__tramp[0] = 0xe92d000f; /* stmfd sp!, {r0-r3} */ \ - *(unsigned int*) &__tramp[4] = 0xe59f0000; /* ldr r0, [pc] */ \ - *(unsigned int*) &__tramp[8] = 0xe59ff000; /* ldr pc, [pc] */ \ + unsigned char *insns = (unsigned char *)(CTX); \ + memcpy (__tramp, ffi_arm_trampoline, sizeof ffi_arm_trampoline); \ *(unsigned int*) &__tramp[12] = __ctx; \ *(unsigned int*) &__tramp[16] = __fun; \ - __clear_cache((&__tramp[0]), (&__tramp[19])); \ + __clear_cache((&__tramp[0]), (&__tramp[19])); /* Clear data mapping. */ \ + __clear_cache(insns, insns + 3 * sizeof (unsigned int)); \ + /* Clear instruction \ + mapping. */ \ }) +#endif /* the cif must already be prep'ed */ @@ -295,15 +607,150 @@ void *user_data, void *codeloc) { - FFI_ASSERT (cif->abi == FFI_SYSV); + void (*closure_func)(ffi_closure*) = NULL; + if (cif->abi == FFI_SYSV) + closure_func = &ffi_closure_SYSV; +#ifdef __ARM_EABI__ + else if (cif->abi == FFI_VFP) + closure_func = &ffi_closure_VFP; +#endif + else + return FFI_BAD_ABI; + +#if FFI_EXEC_TRAMPOLINE_TABLE + void **config = FFI_TRAMPOLINE_CODELOC_CONFIG(codeloc); + config[0] = closure; + config[1] = closure_func; +#else FFI_INIT_TRAMPOLINE (&closure->tramp[0], \ - &ffi_closure_SYSV, \ + closure_func, \ codeloc); - +#endif + closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } + +/* Below are routines for VFP hard-float support. */ + +static int rec_vfp_type_p (ffi_type *t, int *elt, int *elnum) +{ + switch (t->type) + { + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + *elt = (int) t->type; + *elnum = 1; + return 1; + + case FFI_TYPE_STRUCT_VFP_FLOAT: + *elt = FFI_TYPE_FLOAT; + *elnum = t->size / sizeof (float); + return 1; + + case FFI_TYPE_STRUCT_VFP_DOUBLE: + *elt = FFI_TYPE_DOUBLE; + *elnum = t->size / sizeof (double); + return 1; + + case FFI_TYPE_STRUCT:; + { + int base_elt = 0, total_elnum = 0; + ffi_type **el = t->elements; + while (*el) + { + int el_elt = 0, el_elnum = 0; + if (! rec_vfp_type_p (*el, &el_elt, &el_elnum) + || (base_elt && base_elt != el_elt) + || total_elnum + el_elnum > 4) + return 0; + base_elt = el_elt; + total_elnum += el_elnum; + el++; + } + *elnum = total_elnum; + *elt = base_elt; + return 1; + } + default: ; + } + return 0; +} + +static int vfp_type_p (ffi_type *t) +{ + int elt, elnum; + if (rec_vfp_type_p (t, &elt, &elnum)) + { + if (t->type == FFI_TYPE_STRUCT) + { + if (elnum == 1) + t->type = elt; + else + t->type = (elt == FFI_TYPE_FLOAT + ? FFI_TYPE_STRUCT_VFP_FLOAT + : FFI_TYPE_STRUCT_VFP_DOUBLE); + } + return (int) t->type; + } + return 0; +} + +static void place_vfp_arg (ffi_cif *cif, ffi_type *t) +{ + int reg = cif->vfp_reg_free; + int nregs = t->size / sizeof (float); + int align = ((t->type == FFI_TYPE_STRUCT_VFP_FLOAT + || t->type == FFI_TYPE_FLOAT) ? 1 : 2); + /* Align register number. */ + if ((reg & 1) && align == 2) + reg++; + while (reg + nregs <= 16) + { + int s, new_used = 0; + for (s = reg; s < reg + nregs; s++) + { + new_used |= (1 << s); + if (cif->vfp_used & (1 << s)) + { + reg += align; + goto next_reg; + } + } + /* Found regs to allocate. */ + cif->vfp_used |= new_used; + cif->vfp_args[cif->vfp_nargs++] = reg; + + /* Update vfp_reg_free. */ + if (cif->vfp_used & (1 << cif->vfp_reg_free)) + { + reg += nregs; + while (cif->vfp_used & (1 << reg)) + reg += 1; + cif->vfp_reg_free = reg; + } + return; + next_reg: ; + } +} + +static void layout_vfp_args (ffi_cif *cif) +{ + int i; + /* Init VFP fields */ + cif->vfp_used = 0; + cif->vfp_nargs = 0; + cif->vfp_reg_free = 0; + memset (cif->vfp_args, -1, 16); /* Init to -1. */ + + for (i = 0; i < cif->nargs; i++) + { + ffi_type *t = cif->arg_types[i]; + if (vfp_type_p (t)) + place_vfp_arg (cif, t); + } +} diff --git a/Modules/_ctypes/libffi/src/arm/ffitarget.h b/Modules/_ctypes/libffi/src/arm/ffitarget.h --- a/Modules/_ctypes/libffi/src/arm/ffitarget.h +++ b/Modules/_ctypes/libffi/src/arm/ffitarget.h @@ -1,5 +1,8 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 2010 CodeSourcery + Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for ARM. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +30,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; @@ -34,11 +41,27 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, + FFI_VFP, + FFI_LAST_ABI, +#ifdef __ARM_PCS_VFP + FFI_DEFAULT_ABI = FFI_VFP, +#else FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 +#endif } ffi_abi; #endif +#define FFI_EXTRA_CIF_FIELDS \ + int vfp_used; \ + short vfp_reg_free, vfp_nargs; \ + signed char vfp_args[16] \ + +/* Internally used. */ +#define FFI_TYPE_STRUCT_VFP_FLOAT (FFI_TYPE_LAST + 1) +#define FFI_TYPE_STRUCT_VFP_DOUBLE (FFI_TYPE_LAST + 2) + +#define FFI_TARGET_SPECIFIC_VARIADIC + /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 @@ -46,4 +69,3 @@ #define FFI_NATIVE_RAW_API 0 #endif - diff --git a/Modules/_ctypes/libffi/src/arm/gentramp.sh b/Modules/_ctypes/libffi/src/arm/gentramp.sh new file mode 100755 --- /dev/null +++ b/Modules/_ctypes/libffi/src/arm/gentramp.sh @@ -0,0 +1,118 @@ +#!/bin/sh + +# ----------------------------------------------------------------------- +# gentramp.sh - Copyright (c) 2010, Plausible Labs Cooperative, Inc. +# +# ARM Trampoline Page Generator +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# ``Software''), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# ----------------------------------------------------------------------- + +PROGNAME=$0 + +# Each trampoline is exactly 3 instructions, or 12 bytes. If any of these values change, +# the entire arm trampoline implementation must be updated to match, too. + +# Size of an individual trampoline, in bytes +TRAMPOLINE_SIZE=12 + +# Page size, in bytes +PAGE_SIZE=4096 + +# Compute the size of the reachable config page; The first 16 bytes of the config page +# are unreachable due to our maximum pc-relative ldr offset. +PAGE_AVAIL=`expr $PAGE_SIZE - 16` + +# Compute the number of of available trampolines. +TRAMPOLINE_COUNT=`expr $PAGE_AVAIL / $TRAMPOLINE_SIZE` + +header () { + echo "# GENERATED CODE - DO NOT EDIT" + echo "# This file was generated by $PROGNAME" + echo "" + + # Write out the license header +cat << EOF +# Copyright (c) 2010, Plausible Labs Cooperative, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# ``Software''), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# ----------------------------------------------------------------------- + +EOF + + # Write out the trampoline table, aligned to the page boundary + echo ".text" + echo ".align 12" + echo ".globl _ffi_closure_trampoline_table_page" + echo "_ffi_closure_trampoline_table_page:" +} + + +# WARNING - Don't modify the trampoline code size without also updating the relevent libffi code +trampoline () { + cat << END + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + +END +} + +main () { + # Write out the header + header + + # Write out the trampolines + local i=0 + while [ $i -lt ${TRAMPOLINE_COUNT} ]; do + trampoline + local i=`expr $i + 1` + done +} + +main diff --git a/Modules/_ctypes/libffi/src/arm/sysv.S b/Modules/_ctypes/libffi/src/arm/sysv.S --- a/Modules/_ctypes/libffi/src/arm/sysv.S +++ b/Modules/_ctypes/libffi/src/arm/sysv.S @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 1998, 2008 Red Hat, Inc. + sysv.S - Copyright (c) 1998, 2008, 2011 Red Hat, Inc. + Copyright (c) 2011 Plausible Labs Cooperative, Inc. ARM Foreign Function Interface @@ -39,7 +40,11 @@ #else #define CNAME(x) x #endif +#ifdef __APPLE__ +#define ENTRY(x) .globl _##x; _##x: +#else #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): +#endif /* __APPLE__ */ #endif #ifdef __ELF__ @@ -48,6 +53,12 @@ #define LSYM(x) x #endif +/* Use the SOFTFP return value ABI on Mac OS X, as per the iOS ABI + Function Call Guide */ +#ifdef __APPLE__ +#define __SOFTFP__ +#endif + /* We need a better way of testing for this, but for now, this is all we can do. */ @ This selects the minimum architecture level required. @@ -105,21 +116,33 @@ .align 0 .thumb .thumb_func +#ifdef __APPLE__ + ENTRY($0) +#else ENTRY(\name) +#endif bx pc nop .arm UNWIND .fnstart /* A hook to tell gdb that we've switched to ARM mode. Also used to call directly from other local arm routines. */ -_L__\name: +#ifdef __APPLE__ +_L__$0: +#else +_L__\name: +#endif .endm #else .macro ARM_FUNC_START name .text .align 0 .arm +#ifdef __APPLE__ + ENTRY($0) +#else ENTRY(\name) +#endif UNWIND .fnstart .endm #endif @@ -141,13 +164,11 @@ #endif .endm - @ r0: ffi_prep_args @ r1: &ecif @ r2: cif->bytes @ r3: fig->flags @ sp+0: ecif.rvalue - @ sp+4: fn @ This assumes we are using gas. ARM_FUNC_START ffi_call_SYSV @@ -162,24 +183,23 @@ sub sp, fp, r2 @ Place all of the ffi_prep_args in position - mov ip, r0 mov r0, sp @ r1 already set @ Call ffi_prep_args(stack, &ecif) - call_reg(ip) + bl CNAME(ffi_prep_args) @ move first 4 parameters in registers ldmia sp, {r0-r3} @ and adjust stack - ldr ip, [fp, #8] - cmp ip, #16 - movhs ip, #16 - add sp, sp, ip + sub lr, fp, sp @ cif->bytes == fp - sp + ldr ip, [fp] @ load fn() in advance + cmp lr, #16 + movhs lr, #16 + add sp, sp, lr @ call (fn) (...) - ldr ip, [fp, #28] call_reg(ip) @ Remove the space we pushed for the args @@ -224,11 +244,19 @@ #endif LSYM(Lepilogue): - RETLDM "r0-r3,fp" +#if defined (__INTERWORKING__) + ldmia sp!, {r0-r3,fp, lr} + bx lr +#else + ldmia sp!, {r0-r3,fp, pc} +#endif .ffi_call_SYSV_end: UNWIND .fnend +#ifdef __ELF__ .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) +#endif + /* unsigned int FFI_HIDDEN @@ -244,11 +272,11 @@ stmfd sp!, {ip, lr} UNWIND .save {r0, lr} add r2, sp, #8 - .pad #16 + UNWIND .pad #16 sub sp, sp, #16 str sp, [sp, #8] add r1, sp, #8 - bl ffi_closure_SYSV_inner + bl CNAME(ffi_closure_SYSV_inner) cmp r0, #FFI_TYPE_INT beq .Lretint @@ -300,7 +328,177 @@ .ffi_closure_SYSV_end: UNWIND .fnend +#ifdef __ELF__ .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) +#endif + + +/* Below are VFP hard-float ABI call and closure implementations. + Add VFP FPU directive here. This is only compiled into the library + under EABI. */ +#ifdef __ARM_EABI__ + .fpu vfp + + @ r0: fn + @ r1: &ecif + @ r2: cif->bytes + @ r3: fig->flags + @ sp+0: ecif.rvalue + +ARM_FUNC_START ffi_call_VFP + @ Save registers + stmfd sp!, {r0-r3, fp, lr} + UNWIND .save {r0-r3, fp, lr} + mov fp, sp + UNWIND .setfp fp, sp + + @ Make room for all of the new args. + sub sp, sp, r2 + + @ Make room for loading VFP args + sub sp, sp, #64 + + @ Place all of the ffi_prep_args in position + mov r0, sp + @ r1 already set + sub r2, fp, #64 @ VFP scratch space + + @ Call ffi_prep_args(stack, &ecif, vfp_space) + bl CNAME(ffi_prep_args) + + @ Load VFP register args if needed + cmp r0, #0 + beq LSYM(Lbase_args) + + @ Load only d0 if possible + cmp r0, #3 + sub ip, fp, #64 + flddle d0, [ip] + fldmiadgt ip, {d0-d7} + +LSYM(Lbase_args): + @ move first 4 parameters in registers + ldmia sp, {r0-r3} + + @ and adjust stack + sub lr, ip, sp @ cif->bytes == (fp - 64) - sp + ldr ip, [fp] @ load fn() in advance + cmp lr, #16 + movhs lr, #16 + add sp, sp, lr + + @ call (fn) (...) + call_reg(ip) + + @ Remove the space we pushed for the args + mov sp, fp + + @ Load r2 with the pointer to storage for + @ the return value + ldr r2, [sp, #24] + + @ Load r3 with the return type code + ldr r3, [sp, #12] + + @ If the return value pointer is NULL, + @ assume no return value. + cmp r2, #0 + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_INT + streq r0, [r2] + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_SINT64 + stmeqia r2, {r0, r1} + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_FLOAT + fstseq s0, [r2] + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_DOUBLE + fstdeq d0, [r2] + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_STRUCT_VFP_FLOAT + cmpne r3, #FFI_TYPE_STRUCT_VFP_DOUBLE + fstmiadeq r2, {d0-d3} + +LSYM(Lepilogue_vfp): + RETLDM "r0-r3,fp" + +.ffi_call_VFP_end: + UNWIND .fnend + .size CNAME(ffi_call_VFP),.ffi_call_VFP_end-CNAME(ffi_call_VFP) + + +ARM_FUNC_START ffi_closure_VFP + fstmfdd sp!, {d0-d7} + @ r0-r3, then d0-d7 + UNWIND .pad #80 + add ip, sp, #80 + stmfd sp!, {ip, lr} + UNWIND .save {r0, lr} + add r2, sp, #72 + add r3, sp, #8 + UNWIND .pad #72 + sub sp, sp, #72 + str sp, [sp, #64] + add r1, sp, #64 + bl CNAME(ffi_closure_SYSV_inner) + + cmp r0, #FFI_TYPE_INT + beq .Lretint_vfp + + cmp r0, #FFI_TYPE_FLOAT + beq .Lretfloat_vfp + + cmp r0, #FFI_TYPE_DOUBLE + cmpne r0, #FFI_TYPE_LONGDOUBLE + beq .Lretdouble_vfp + + cmp r0, #FFI_TYPE_SINT64 + beq .Lretlonglong_vfp + + cmp r0, #FFI_TYPE_STRUCT_VFP_FLOAT + beq .Lretfloat_struct_vfp + + cmp r0, #FFI_TYPE_STRUCT_VFP_DOUBLE + beq .Lretdouble_struct_vfp + +.Lclosure_epilogue_vfp: + add sp, sp, #72 + ldmfd sp, {sp, pc} + +.Lretfloat_vfp: + flds s0, [sp] + b .Lclosure_epilogue_vfp +.Lretdouble_vfp: + fldd d0, [sp] + b .Lclosure_epilogue_vfp +.Lretint_vfp: + ldr r0, [sp] + b .Lclosure_epilogue_vfp +.Lretlonglong_vfp: + ldmia sp, {r0, r1} + b .Lclosure_epilogue_vfp +.Lretfloat_struct_vfp: + fldmiad sp, {d0-d1} + b .Lclosure_epilogue_vfp +.Lretdouble_struct_vfp: + fldmiad sp, {d0-d3} + b .Lclosure_epilogue_vfp + +.ffi_closure_VFP_end: + UNWIND .fnend + .size CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP) +#endif + +ENTRY(ffi_arm_trampoline) + stmfd sp!, {r0-r3} + ldr r0, [pc] + ldr pc, [pc] #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",%progbits diff --git a/Modules/_ctypes/libffi/src/arm/trampoline.S b/Modules/_ctypes/libffi/src/arm/trampoline.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/arm/trampoline.S @@ -0,0 +1,4450 @@ +# GENERATED CODE - DO NOT EDIT +# This file was generated by src/arm/gentramp.sh + +# Copyright (c) 2010, Plausible Labs Cooperative, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# Software''), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED AS IS'', WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# ----------------------------------------------------------------------- + +.text +.align 12 +.globl _ffi_closure_trampoline_table_page +_ffi_closure_trampoline_table_page: + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + diff --git a/Modules/_ctypes/libffi/src/avr32/ffi.c b/Modules/_ctypes/libffi/src/avr32/ffi.c --- a/Modules/_ctypes/libffi/src/avr32/ffi.c +++ b/Modules/_ctypes/libffi/src/avr32/ffi.c @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2009 Bradley Smith + ffi.c - Copyright (c) 2011 Anthony Green + Copyright (c) 2009 Bradley Smith AVR32 Foreign Function Interface @@ -394,7 +395,8 @@ void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { - FFI_ASSERT(cif->abi == FFI_SYSV); + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; unsigned char *__tramp = (unsigned char*)(&closure->tramp[0]); unsigned int __fun = (unsigned int)(&ffi_closure_SYSV); diff --git a/Modules/_ctypes/libffi/src/avr32/ffitarget.h b/Modules/_ctypes/libffi/src/avr32/ffitarget.h --- a/Modules/_ctypes/libffi/src/avr32/ffitarget.h +++ b/Modules/_ctypes/libffi/src/avr32/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2009 Bradley Smith + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 2009 Bradley Smith Target configuration macros for AVR32. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; @@ -34,8 +39,8 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/bfin/ffi.c b/Modules/_ctypes/libffi/src/bfin/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/bfin/ffi.c @@ -0,0 +1,195 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2012 Alexandre K. I. de Mendonca + + Blackfin Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ +#include +#include + +#include +#include + +/* Maximum number of GPRs available for argument passing. */ +#define MAX_GPRARGS 3 + +/* + * Return types + */ +#define FFIBFIN_RET_VOID 0 +#define FFIBFIN_RET_BYTE 1 +#define FFIBFIN_RET_HALFWORD 2 +#define FFIBFIN_RET_INT64 3 +#define FFIBFIN_RET_INT32 4 + +/*====================================================================*/ +/* PROTOTYPE * + /*====================================================================*/ +void ffi_prep_args(unsigned char *, extended_cif *); + +/*====================================================================*/ +/* Externals */ +/* (Assembly) */ +/*====================================================================*/ + +extern void ffi_call_SYSV(unsigned, extended_cif *, void(*)(unsigned char *, extended_cif *), unsigned, void *, void(*fn)(void)); + +/*====================================================================*/ +/* Implementation */ +/* */ +/*====================================================================*/ + + +/* + * This function calculates the return type (size) based on type. + */ + +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + /* --------------------------------------* + * Return handling * + * --------------------------------------*/ + switch (cif->rtype->type) { + case FFI_TYPE_VOID: + cif->flags = FFIBFIN_RET_VOID; + break; + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + cif->flags = FFIBFIN_RET_HALFWORD; + break; + case FFI_TYPE_UINT8: + cif->flags = FFIBFIN_RET_BYTE; + break; + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_FLOAT: + case FFI_TYPE_POINTER: + case FFI_TYPE_SINT8: + cif->flags = FFIBFIN_RET_INT32; + break; + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_DOUBLE: + cif->flags = FFIBFIN_RET_INT64; + break; + case FFI_TYPE_STRUCT: + if (cif->rtype->size <= 4){ + cif->flags = FFIBFIN_RET_INT32; + }else if (cif->rtype->size == 8){ + cif->flags = FFIBFIN_RET_INT64; + }else{ + //it will return via a hidden pointer in P0 + cif->flags = FFIBFIN_RET_VOID; + } + break; + default: + FFI_ASSERT(0); + break; + } + return FFI_OK; +} + +/* + * This will prepare the arguments and will call the assembly routine + * cif = the call interface + * fn = the function to be called + * rvalue = the return value + * avalue = the arguments + */ +void ffi_call(ffi_cif *cif, void(*fn)(void), void *rvalue, void **avalue) +{ + int ret_type = cif->flags; + extended_cif ecif; + ecif.cif = cif; + ecif.avalue = avalue; + ecif.rvalue = rvalue; + + switch (cif->abi) { + case FFI_SYSV: + ffi_call_SYSV(cif->bytes, &ecif, ffi_prep_args, ret_type, ecif.rvalue, fn); + break; + default: + FFI_ASSERT(0); + break; + } +} + + +/* +* This function prepares the parameters (copies them from the ecif to the stack) +* to call the function (ffi_prep_args is called by the assembly routine in file +* sysv.S, which also calls the actual function) +*/ +void ffi_prep_args(unsigned char *stack, extended_cif *ecif) +{ + register unsigned int i = 0; + void **p_argv; + unsigned char *argp; + ffi_type **p_arg; + argp = stack; + p_argv = ecif->avalue; + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; + (i != 0); + i--, p_arg++) { + size_t z; + z = (*p_arg)->size; + if (z < sizeof(int)) { + z = sizeof(int); + switch ((*p_arg)->type) { + case FFI_TYPE_SINT8: { + signed char v = *(SINT8 *)(* p_argv); + signed int t = v; + *(signed int *) argp = t; + } + break; + case FFI_TYPE_UINT8: { + unsigned char v = *(UINT8 *)(* p_argv); + unsigned int t = v; + *(unsigned int *) argp = t; + } + break; + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int) * (SINT16 *)(* p_argv); + break; + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int) * (UINT16 *)(* p_argv); + break; + case FFI_TYPE_STRUCT: + memcpy(argp, *p_argv, (*p_arg)->size); + break; + default: + FFI_ASSERT(0); + break; + } + } else if (z == sizeof(int)) { + *(unsigned int *) argp = (unsigned int) * (UINT32 *)(* p_argv); + } else { + memcpy(argp, *p_argv, z); + } + p_argv++; + argp += z; + } +} + + + diff --git a/Modules/_ctypes/libffi/src/bfin/ffitarget.h b/Modules/_ctypes/libffi/src/bfin/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/bfin/ffitarget.h @@ -0,0 +1,43 @@ +/* ----------------------------------------------------------------------- + ffitarget.h - Copyright (c) 2012 Alexandre K. I. de Mendonca + + Blackfin Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV +} ffi_abi; +#endif + +#endif + diff --git a/Modules/_ctypes/libffi/src/bfin/sysv.S b/Modules/_ctypes/libffi/src/bfin/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/bfin/sysv.S @@ -0,0 +1,177 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2012 Alexandre K. I. de Mendonca + + Blackfin Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + +.text +.align 4 + + /* + There is a "feature" in the bfin toolchain that it puts a _ before funcion names + that's why the function here it's called _ffi_call_SYSV and not ffi_call_SYSV + */ + .global _ffi_call_SYSV; + .type _ffi_call_SYSV, STT_FUNC; + .func ffi_call_SYSV + + /* + cif->bytes = R0 (fp+8) + &ecif = R1 (fp+12) + ffi_prep_args = R2 (fp+16) + ret_type = stack (fp+20) + ecif.rvalue = stack (fp+24) + fn = stack (fp+28) + got (fp+32) + There is room for improvement here (we can use temporary registers + instead of saving the values in the memory) + REGS: + P5 => Stack pointer (function arguments) + R5 => cif->bytes + R4 => ret->type + + FP-20 = P3 + FP-16 = SP (parameters area) + FP-12 = SP (temp) + FP-08 = function return part 1 [R0] + FP-04 = function return part 2 [R1] + */ + +_ffi_call_SYSV: +.prologue: + LINK 20; + [FP-20] = P3; + [FP+8] = R0; + [FP+12] = R1; + [FP+16] = R2; + +.allocate_stack: + //alocate cif->bytes into the stack + R1 = [FP+8]; + R0 = SP; + R0 = R0 - R1; + R1 = 4; + R0 = R0 - R1; + [FP-12] = SP; + SP = R0; + [FP-16] = SP; + +.call_prep_args: + //get the addr of prep_args + P0 = [P3 + _ffi_prep_args at FUNCDESC_GOT17M4]; + P1 = [P0]; + P3 = [P0+4]; + R0 = [FP-16];//SP (parameter area) + R1 = [FP+12];//ecif + call (P1); + +.call_user_function: + //ajust SP so as to allow the user function access the parameters on the stack + SP = [FP-16]; //point to function parameters + R0 = [SP]; + R1 = [SP+4]; + R2 = [SP+8]; + //load user function address + P0 = FP; + P0 +=28; + P1 = [P0]; + P1 = [P1]; + P3 = [P0+4]; + /* + For functions returning aggregate values (struct) occupying more than 8 bytes, + the caller allocates the return value object on the stack and the address + of this object is passed to the callee as a hidden argument in register P0. + */ + P0 = [FP+24]; + + call (P1); + SP = [FP-12]; +.compute_return: + P2 = [FP-20]; + [FP-8] = R0; + [FP-4] = R1; + + R0 = [FP+20]; + R1 = R0 << 2; + + R0 = [P2+.rettable at GOT17M4]; + R0 = R1 + R0; + P2 = R0; + R1 = [P2]; + + P2 = [FP+-20]; + R0 = [P2+.rettable at GOT17M4]; + R0 = R1 + R0; + P2 = R0; + R0 = [FP-8]; + R1 = [FP-4]; + jump (P2); + +/* +#define FFIBFIN_RET_VOID 0 +#define FFIBFIN_RET_BYTE 1 +#define FFIBFIN_RET_HALFWORD 2 +#define FFIBFIN_RET_INT64 3 +#define FFIBFIN_RET_INT32 4 +*/ +.align 4 +.align 4 +.rettable: + .dd .epilogue - .rettable + .dd .rbyte - .rettable; + .dd .rhalfword - .rettable; + .dd .rint64 - .rettable; + .dd .rint32 - .rettable; + +.rbyte: + P0 = [FP+24]; + R0 = R0.B (Z); + [P0] = R0; + JUMP .epilogue +.rhalfword: + P0 = [FP+24]; + R0 = R0.L; + [P0] = R0; + JUMP .epilogue +.rint64: + P0 = [FP+24];// &rvalue + [P0] = R0; + [P0+4] = R1; + JUMP .epilogue +.rint32: + P0 = [FP+24]; + [P0] = R0; +.epilogue: + R0 = [FP+8]; + R1 = [FP+12]; + R2 = [FP+16]; + P3 = [FP-20]; + UNLINK; + RTS; + +.size _ffi_call_SYSV,.-_ffi_call_SYSV; +.endfunc diff --git a/Modules/_ctypes/libffi/src/closures.c b/Modules/_ctypes/libffi/src/closures.c --- a/Modules/_ctypes/libffi/src/closures.c +++ b/Modules/_ctypes/libffi/src/closures.c @@ -1,6 +1,7 @@ /* ----------------------------------------------------------------------- - closures.c - Copyright (c) 2007 Red Hat, Inc. - Copyright (C) 2007, 2009 Free Software Foundation, Inc + closures.c - Copyright (c) 2007, 2009, 2010 Red Hat, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc + Copyright (c) 2011 Plausible Labs Cooperative, Inc. Code to allocate and deallocate memory for closures. @@ -32,7 +33,7 @@ #include #include -#ifndef FFI_MMAP_EXEC_WRIT +#if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE # if __gnu_linux__ /* This macro indicates it may be forbidden to map anonymous memory with both write and execute permission. Code compiled when this @@ -44,7 +45,7 @@ # define FFI_MMAP_EXEC_WRIT 1 # define HAVE_MNTENT 1 # endif -# if defined(X86_WIN32) || defined(X86_WIN64) +# if defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__) /* Windows systems may have Data Execution Protection (DEP) enabled, which requires the use of VirtualMalloc/VirtualFree to alloc/free executable memory. */ @@ -63,7 +64,11 @@ #if FFI_CLOSURES -# if FFI_MMAP_EXEC_WRIT +# if FFI_EXEC_TRAMPOLINE_TABLE + +// Per-target implementation; It's unclear what can reasonable be shared between two OS/architecture implementations. + +# elif FFI_MMAP_EXEC_WRIT /* !FFI_EXEC_TRAMPOLINE_TABLE */ #define USE_LOCKS 1 #define USE_DL_PREFIX 1 @@ -146,7 +151,7 @@ p = strchr (p + 1, ' '); if (p == NULL) break; - if (strncmp (p + 1, "selinuxfs ", 10) != 0) + if (strncmp (p + 1, "selinuxfs ", 10) == 0) { free (buf); fclose (f); @@ -167,7 +172,26 @@ #endif /* !FFI_MMAP_EXEC_SELINUX */ -#elif defined (__CYGWIN__) +/* On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. */ +#ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX +#include + +static int emutramp_enabled = -1; + +static int +emutramp_enabled_check (void) +{ + if (getenv ("FFI_DISABLE_EMUTRAMP") == NULL) + return 1; + else + return 0; +} + +#define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \ + : (emutramp_enabled = emutramp_enabled_check ())) +#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */ + +#elif defined (__CYGWIN__) || defined(__INTERIX) #include @@ -176,6 +200,10 @@ #endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */ +#ifndef FFI_MMAP_EXEC_EMUTRAMP_PAX +#define is_emutramp_enabled() 0 +#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */ + /* Declare all functions defined in dlmalloc.c as static. */ static void *dlmalloc(size_t); static void dlfree(void*); @@ -193,11 +221,11 @@ static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED; static void dlmalloc_stats(void) MAYBE_UNUSED; -#if !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__) +#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) /* Use these for mmap and munmap within dlmalloc.c. */ static void *dlmmap(void *, size_t, int, int, int, off_t); static int dlmunmap(void *, size_t); -#endif /* !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__) */ +#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */ #define mmap dlmmap #define munmap dlmunmap @@ -207,7 +235,7 @@ #undef mmap #undef munmap -#if !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__) +#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) /* A mutex used to synchronize access to *exec* variables in this file. */ static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -294,7 +322,7 @@ struct mntent mnt; char buf[MAXPATHLEN * 3]; - if (getmntent_r (last_mntent, &mnt, buf, sizeof (buf))) + if (getmntent_r (last_mntent, &mnt, buf, sizeof (buf)) == NULL) return -1; if (hasmntopt (&mnt, "ro") @@ -453,6 +481,12 @@ printf ("mapping in %zi\n", length); #endif + if (execfd == -1 && is_emutramp_enabled ()) + { + ptr = mmap (start, length, prot & ~PROT_EXEC, flags, fd, offset); + return ptr; + } + if (execfd == -1 && !is_selinux_enabled ()) { ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset); @@ -522,7 +556,7 @@ } #endif -#endif /* !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__) */ +#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */ /* Allocate a chunk of memory with the given size. Returns a pointer to the writable address, and sets *CODE to the executable diff --git a/Modules/_ctypes/libffi/src/cris/ffi.c b/Modules/_ctypes/libffi/src/cris/ffi.c --- a/Modules/_ctypes/libffi/src/cris/ffi.c +++ b/Modules/_ctypes/libffi/src/cris/ffi.c @@ -153,21 +153,24 @@ return (struct_count); } -ffi_status -ffi_prep_cif (ffi_cif * cif, - ffi_abi abi, unsigned int nargs, - ffi_type * rtype, ffi_type ** atypes) +ffi_status FFI_HIDDEN +ffi_prep_cif_core (ffi_cif * cif, + ffi_abi abi, unsigned int isvariadic, + unsigned int nfixedargs, unsigned int ntotalargs, + ffi_type * rtype, ffi_type ** atypes) { unsigned bytes = 0; unsigned int i; ffi_type **ptr; FFI_ASSERT (cif != NULL); - FFI_ASSERT ((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI)); + FFI_ASSERT((!isvariadic) || (nfixedargs >= 1)); + FFI_ASSERT(nfixedargs <= ntotalargs); + FFI_ASSERT (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI); cif->abi = abi; cif->arg_types = atypes; - cif->nargs = nargs; + cif->nargs = ntotalargs; cif->rtype = rtype; cif->flags = 0; diff --git a/Modules/_ctypes/libffi/src/cris/ffitarget.h b/Modules/_ctypes/libffi/src/cris/ffitarget.h --- a/Modules/_ctypes/libffi/src/cris/ffitarget.h +++ b/Modules/_ctypes/libffi/src/cris/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for CRIS. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; @@ -34,8 +39,8 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/dlmalloc.c b/Modules/_ctypes/libffi/src/dlmalloc.c --- a/Modules/_ctypes/libffi/src/dlmalloc.c +++ b/Modules/_ctypes/libffi/src/dlmalloc.c @@ -100,7 +100,7 @@ If you don't like either of these options, you can define CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything - else. And if you are sure that your program using malloc has + else. And if if you are sure that your program using malloc has no errors or vulnerabilities, you can define INSECURE to 1, which might (or might not) provide a small performance improvement. @@ -457,13 +457,16 @@ #define LACKS_ERRNO_H #define MALLOC_FAILURE_ACTION #define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */ -#elif !defined _GNU_SOURCE -/* mremap() on Linux requires this via sys/mman.h - * See roundup issue 10309 - */ -#define _GNU_SOURCE 1 #endif /* WIN32 */ +#ifdef __OS2__ +#define INCL_DOS +#include +#define HAVE_MMAP 1 +#define HAVE_MORECORE 0 +#define LACKS_SYS_MMAN_H +#endif /* __OS2__ */ + #if defined(DARWIN) || defined(_DARWIN) /* Mac OSX docs advise not to use sbrk; it seems better to use mmap */ #ifndef HAVE_MORECORE @@ -599,7 +602,7 @@ declaration needed is the mallinfo struct that is returned (by-copy) by mallinfo(). The malloinfo struct contains a bunch of fields that are not even meaningful in this version of malloc. These fields are - instead filled by mallinfo() with other numbers that might be of + are instead filled by mallinfo() with other numbers that might be of interest. HAVE_USR_INCLUDE_MALLOC_H should be set if you have a @@ -619,6 +622,9 @@ #include "/usr/include/malloc.h" #else /* HAVE_USR_INCLUDE_MALLOC_H */ +/* HP-UX's stdlib.h redefines mallinfo unless _STRUCT_MALLINFO is defined */ +#define _STRUCT_MALLINFO + struct mallinfo { MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */ MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */ @@ -1293,7 +1299,7 @@ #define IS_MMAPPED_BIT (SIZE_T_ONE) #define USE_MMAP_BIT (SIZE_T_ONE) -#ifndef WIN32 +#if !defined(WIN32) && !defined (__OS2__) #define CALL_MUNMAP(a, s) munmap((a), (s)) #define MMAP_PROT (PROT_READ|PROT_WRITE) #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) @@ -1316,6 +1322,42 @@ #endif /* MAP_ANONYMOUS */ #define DIRECT_MMAP(s) CALL_MMAP(s) + +#elif defined(__OS2__) + +/* OS/2 MMAP via DosAllocMem */ +static void* os2mmap(size_t size) { + void* ptr; + if (DosAllocMem(&ptr, size, OBJ_ANY|PAG_COMMIT|PAG_READ|PAG_WRITE) && + DosAllocMem(&ptr, size, PAG_COMMIT|PAG_READ|PAG_WRITE)) + return MFAIL; + return ptr; +} + +#define os2direct_mmap(n) os2mmap(n) + +/* This function supports releasing coalesed segments */ +static int os2munmap(void* ptr, size_t size) { + while (size) { + ULONG ulSize = size; + ULONG ulFlags = 0; + if (DosQueryMem(ptr, &ulSize, &ulFlags) != 0) + return -1; + if ((ulFlags & PAG_BASE) == 0 ||(ulFlags & PAG_COMMIT) == 0 || + ulSize > size) + return -1; + if (DosFreeMem(ptr) != 0) + return -1; + ptr = ( void * ) ( ( char * ) ptr + ulSize ); + size -= ulSize; + } + return 0; +} + +#define CALL_MMAP(s) os2mmap(s) +#define CALL_MUNMAP(a, s) os2munmap((a), (s)) +#define DIRECT_MMAP(s) os2direct_mmap(s) + #else /* WIN32 */ /* Win32 MMAP via VirtualAlloc */ @@ -1392,7 +1434,7 @@ unique mparams values are initialized only once. */ -#ifndef WIN32 +#if !defined(WIN32) && !defined(__OS2__) /* By default use posix locks */ #include #define MLOCK_T pthread_mutex_t @@ -1406,6 +1448,16 @@ static MLOCK_T magic_init_mutex = PTHREAD_MUTEX_INITIALIZER; +#elif defined(__OS2__) +#define MLOCK_T HMTX +#define INITIAL_LOCK(l) DosCreateMutexSem(0, l, 0, FALSE) +#define ACQUIRE_LOCK(l) DosRequestMutexSem(*l, SEM_INDEFINITE_WAIT) +#define RELEASE_LOCK(l) DosReleaseMutexSem(*l) +#if HAVE_MORECORE +static MLOCK_T morecore_mutex; +#endif /* HAVE_MORECORE */ +static MLOCK_T magic_init_mutex; + #else /* WIN32 */ /* Because lock-protected regions have bounded times, and there @@ -1564,7 +1616,7 @@ Each freshly allocated chunk must have both cinuse and pinuse set. That is, each allocated chunk borders either a previously allocated and still in-use chunk, or the base of its memory arena. This is - ensured by making all allocations from the `lowest' part of any + ensured by making all allocations from the the `lowest' part of any found chunk. Further, no free chunk physically borders another one, so each free chunk is known to be preceded and followed by either inuse chunks or the ends of memory. @@ -1770,12 +1822,12 @@ of the same size are arranged in a circularly-linked list, with only the oldest chunk (the next to be used, in our FIFO ordering) actually in the tree. (Tree members are distinguished by a non-null - parent pointer.) If a chunk with the same size as an existing node + parent pointer.) If a chunk with the same size an an existing node is inserted, it is linked off the existing node using pointers that work in the same way as fd/bk pointers of small chunks. Each tree contains a power of 2 sized range of chunk sizes (the - smallest is 0x100 <= x < 0x180), which is divided in half at each + smallest is 0x100 <= x < 0x180), which is is divided in half at each tree level, with the chunks in the smaller half of the range (0x100 <= x < 0x140 for the top nose) in the left subtree and the larger half (0x140 <= x < 0x180) in the right subtree. This is, of course, @@ -2497,10 +2549,15 @@ } RELEASE_MAGIC_INIT_LOCK(); -#ifndef WIN32 +#if !defined(WIN32) && !defined(__OS2__) mparams.page_size = malloc_getpagesize; mparams.granularity = ((DEFAULT_GRANULARITY != 0)? DEFAULT_GRANULARITY : mparams.page_size); +#elif defined (__OS2__) + /* if low-memory is used, os2munmap() would break + if it were anything other than 64k */ + mparams.page_size = 4096u; + mparams.granularity = 65536u; #else /* WIN32 */ { SYSTEM_INFO system_info; @@ -3380,7 +3437,7 @@ least-preferred order): 1. A call to MORECORE that can normally contiguously extend memory. (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or - main space is mmapped or a previous contiguous call failed) + or main space is mmapped or a previous contiguous call failed) 2. A call to MMAP new space (disabled if not HAVE_MMAP). Note that under the default settings, if MORECORE is unable to fulfill a request, and HAVE_MMAP is true, then mmap is @@ -4197,7 +4254,7 @@ void dlfree(void* mem) { /* - Consolidate freed chunks with preceeding or succeeding bordering + Consolidate freed chunks with preceding or succeeding bordering free chunks, if they exist, and then place in a bin. Intermixed with special cases for top, dv, mmapped chunks, and usage errors. */ diff --git a/Modules/_ctypes/libffi/src/frv/ffitarget.h b/Modules/_ctypes/libffi/src/frv/ffitarget.h --- a/Modules/_ctypes/libffi/src/frv/ffitarget.h +++ b/Modules/_ctypes/libffi/src/frv/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2004 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2004 Red Hat, Inc. Target configuration macros for FR-V Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- System specific configurations ----------------------------------- */ #ifndef LIBFFI_ASM @@ -35,13 +40,9 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, - -#ifdef FRV FFI_EABI, - FFI_DEFAULT_ABI = FFI_EABI, -#endif - - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_EABI } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/ia64/ffi.c b/Modules/_ctypes/libffi/src/ia64/ffi.c --- a/Modules/_ctypes/libffi/src/ia64/ffi.c +++ b/Modules/_ctypes/libffi/src/ia64/ffi.c @@ -1,6 +1,7 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998, 2007, 2008 Red Hat, Inc. + ffi.c - Copyright (c) 1998, 2007, 2008, 2012 Red Hat, Inc. Copyright (c) 2000 Hewlett Packard Company + Copyright (c) 2011 Anthony Green IA64 Foreign Function Interface @@ -84,7 +85,7 @@ #define ldf_fill(result, addr) \ asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr)); -/* Return the size of the C type associated with TYPE, which will +/* Return the size of the C type associated with with TYPE. Which will be one of the FFI_IA64_TYPE_HFA_* values. */ static size_t @@ -184,7 +185,7 @@ break; case FFI_TYPE_LONGDOUBLE: - /* Similarly, except that HFA is true for double extended, + /* Similarly, except that that HFA is true for double extended, but not quad precision. Both have sizeof == 16, so tell the difference based on the precision. */ if (LDBL_MANT_DIG == 64 && nested) @@ -225,7 +226,7 @@ int flags; /* Adjust cif->bytes to include space for the bits of the ia64_args frame - that preceeds the integer register portion. The estimate that the + that precedes the integer register portion. The estimate that the generic bits did for the argument space required is good enough for the integer component. */ cif->bytes += offsetof(struct ia64_args, gp_regs[0]); @@ -324,13 +325,17 @@ case FFI_TYPE_FLOAT: if (gpcount < 8 && fpcount < 8) stf_spill (&stack->fp_regs[fpcount++], *(float *)avalue[i]); - stack->gp_regs[gpcount++] = *(UINT32 *)avalue[i]; + { + UINT32 tmp; + memcpy (&tmp, avalue[i], sizeof (UINT32)); + stack->gp_regs[gpcount++] = tmp; + } break; case FFI_TYPE_DOUBLE: if (gpcount < 8 && fpcount < 8) stf_spill (&stack->fp_regs[fpcount++], *(double *)avalue[i]); - stack->gp_regs[gpcount++] = *(UINT64 *)avalue[i]; + memcpy (&stack->gp_regs[gpcount++], avalue[i], sizeof (UINT64)); break; case FFI_TYPE_LONGDOUBLE: @@ -425,7 +430,8 @@ struct ffi_ia64_trampoline_struct *tramp; struct ia64_fd *fd; - FFI_ASSERT (cif->abi == FFI_UNIX); + if (cif->abi != FFI_UNIX) + return FFI_BAD_ABI; tramp = (struct ffi_ia64_trampoline_struct *)closure->tramp; fd = (struct ia64_fd *)(void *)ffi_closure_unix; diff --git a/Modules/_ctypes/libffi/src/ia64/ffitarget.h b/Modules/_ctypes/libffi/src/ia64/ffitarget.h --- a/Modules/_ctypes/libffi/src/ia64/ffitarget.h +++ b/Modules/_ctypes/libffi/src/ia64/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for IA-64. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #ifndef LIBFFI_ASM typedef unsigned long long ffi_arg; typedef signed long long ffi_sarg; @@ -34,8 +39,8 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_UNIX, /* Linux and all Unix variants use the same conventions */ - FFI_DEFAULT_ABI = FFI_UNIX, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_UNIX } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/java_raw_api.c b/Modules/_ctypes/libffi/src/java_raw_api.c --- a/Modules/_ctypes/libffi/src/java_raw_api.c +++ b/Modules/_ctypes/libffi/src/java_raw_api.c @@ -311,7 +311,7 @@ ffi_raw_closure *cl = (ffi_raw_closure*)user_data; ffi_java_ptrarray_to_raw (cif, avalue, raw); - (*cl->fun) (cif, rvalue, raw, cl->user_data); + (*cl->fun) (cif, rvalue, (ffi_raw*)raw, cl->user_data); ffi_java_raw_to_rvalue (cif, rvalue); } diff --git a/Modules/_ctypes/libffi/src/m32r/ffitarget.h b/Modules/_ctypes/libffi/src/m32r/ffitarget.h --- a/Modules/_ctypes/libffi/src/m32r/ffitarget.h +++ b/Modules/_ctypes/libffi/src/m32r/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2004 Renesas Technology. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 2004 Renesas Technology. Target configuration macros for M32R. Permission is hereby granted, free of charge, to any person obtaining @@ -26,6 +27,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM @@ -36,8 +41,8 @@ { FFI_FIRST_ABI = 0, FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/m68k/ffi.c b/Modules/_ctypes/libffi/src/m68k/ffi.c --- a/Modules/_ctypes/libffi/src/m68k/ffi.c +++ b/Modules/_ctypes/libffi/src/m68k/ffi.c @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- ffi.c - - m68k Foreign Function Interface + + m68k Foreign Function Interface ----------------------------------------------------------------------- */ #include @@ -9,8 +9,17 @@ #include #include +#ifdef __rtems__ +void rtems_cache_flush_multiple_data_lines( const void *, size_t ); +#else #include +#ifdef __MINT__ +#include +#include +#else #include +#endif +#endif void ffi_call_SYSV (extended_cif *, unsigned, unsigned, @@ -35,8 +44,12 @@ argp = stack; - if (ecif->cif->rtype->type == FFI_TYPE_STRUCT - && !ecif->cif->flags) + if ( +#ifdef __MINT__ + (ecif->cif->rtype->type == FFI_TYPE_LONGDOUBLE) || +#endif + (((ecif->cif->rtype->type == FFI_TYPE_STRUCT) + && !ecif->cif->flags))) struct_value_ptr = ecif->rvalue; else struct_value_ptr = NULL; @@ -47,12 +60,12 @@ i != 0; i--, p_arg++) { - size_t z; + size_t z = (*p_arg)->size; + int type = (*p_arg)->type; - z = (*p_arg)->size; if (z < sizeof (int)) { - switch ((*p_arg)->type) + switch (type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int) *(SINT8 *) *p_argv; @@ -71,7 +84,14 @@ break; case FFI_TYPE_STRUCT: +#ifdef __MINT__ + if (z == 1 || z == 2) + memcpy (argp + 2, *p_argv, z); + else + memcpy (argp, *p_argv, z); +#else memcpy (argp + sizeof (int) - z, *p_argv, z); +#endif break; default: @@ -103,6 +123,8 @@ #define CIF_FLAGS_POINTER 32 #define CIF_FLAGS_STRUCT1 64 #define CIF_FLAGS_STRUCT2 128 +#define CIF_FLAGS_SINT8 256 +#define CIF_FLAGS_SINT16 512 /* Perform machine dependent cif processing */ ffi_status @@ -116,17 +138,34 @@ break; case FFI_TYPE_STRUCT: + if (cif->rtype->elements[0]->type == FFI_TYPE_STRUCT && + cif->rtype->elements[1]) + { + cif->flags = 0; + break; + } + switch (cif->rtype->size) { case 1: +#ifdef __MINT__ + cif->flags = CIF_FLAGS_STRUCT2; +#else cif->flags = CIF_FLAGS_STRUCT1; +#endif break; case 2: cif->flags = CIF_FLAGS_STRUCT2; break; +#ifdef __MINT__ + case 3: +#endif case 4: cif->flags = CIF_FLAGS_INT; break; +#ifdef __MINT__ + case 7: +#endif case 8: cif->flags = CIF_FLAGS_DINT; break; @@ -144,9 +183,15 @@ cif->flags = CIF_FLAGS_DOUBLE; break; +#if (FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE) case FFI_TYPE_LONGDOUBLE: +#ifdef __MINT__ + cif->flags = 0; +#else cif->flags = CIF_FLAGS_LDOUBLE; +#endif break; +#endif case FFI_TYPE_POINTER: cif->flags = CIF_FLAGS_POINTER; @@ -157,6 +202,14 @@ cif->flags = CIF_FLAGS_DINT; break; + case FFI_TYPE_SINT16: + cif->flags = CIF_FLAGS_SINT16; + break; + + case FFI_TYPE_SINT8: + cif->flags = CIF_FLAGS_SINT8; + break; + default: cif->flags = CIF_FLAGS_INT; break; @@ -212,6 +265,26 @@ size_t z; z = (*p_arg)->size; +#ifdef __MINT__ + if (cif->flags && + cif->rtype->type == FFI_TYPE_STRUCT && + (z == 1 || z == 2)) + { + *p_argv = (void *) (argp + 2); + + z = 4; + } + else + if (cif->flags && + cif->rtype->type == FFI_TYPE_STRUCT && + (z == 3 || z == 4)) + { + *p_argv = (void *) (argp); + + z = 4; + } + else +#endif if (z <= 4) { *p_argv = (void *) (argp + 4 - z); @@ -255,19 +328,31 @@ void *user_data, void *codeloc) { - FFI_ASSERT (cif->abi == FFI_SYSV); + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; *(unsigned short *)closure->tramp = 0x207c; *(void **)(closure->tramp + 2) = codeloc; *(unsigned short *)(closure->tramp + 6) = 0x4ef9; - if (cif->rtype->type == FFI_TYPE_STRUCT - && !cif->flags) + + if ( +#ifdef __MINT__ + (cif->rtype->type == FFI_TYPE_LONGDOUBLE) || +#endif + (((cif->rtype->type == FFI_TYPE_STRUCT) + && !cif->flags))) *(void **)(closure->tramp + 8) = ffi_closure_struct_SYSV; else *(void **)(closure->tramp + 8) = ffi_closure_SYSV; +#ifdef __rtems__ + rtems_cache_flush_multiple_data_lines( codeloc, FFI_TRAMPOLINE_SIZE ); +#elif defined(__MINT__) + Ssystem(S_FLUSHCACHE, codeloc, FFI_TRAMPOLINE_SIZE); +#else syscall(SYS_cacheflush, codeloc, FLUSH_SCOPE_LINE, FLUSH_CACHE_BOTH, FFI_TRAMPOLINE_SIZE); +#endif closure->cif = cif; closure->user_data = user_data; @@ -275,4 +360,3 @@ return FFI_OK; } - diff --git a/Modules/_ctypes/libffi/src/m68k/ffitarget.h b/Modules/_ctypes/libffi/src/m68k/ffitarget.h --- a/Modules/_ctypes/libffi/src/m68k/ffitarget.h +++ b/Modules/_ctypes/libffi/src/m68k/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for Motorola 68K. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; @@ -34,8 +39,8 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/m68k/sysv.S b/Modules/_ctypes/libffi/src/m68k/sysv.S --- a/Modules/_ctypes/libffi/src/m68k/sysv.S +++ b/Modules/_ctypes/libffi/src/m68k/sysv.S @@ -1,8 +1,11 @@ /* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 1998 Andreas Schwab - Copyright (c) 2008 Red Hat, Inc. - - m68k Foreign Function Interface + + sysv.S - Copyright (c) 2012 Alan Hourihane + Copyright (c) 1998, 2012 Andreas Schwab + Copyright (c) 2008 Red Hat, Inc. + Copyright (c) 2012 Thorsten Glaser + + m68k Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -41,13 +44,19 @@ #define CFI_ENDPROC() #endif +#ifdef __MINT__ +#define CALLFUNC(funcname) _ ## funcname +#else +#define CALLFUNC(funcname) funcname +#endif + .text - .globl ffi_call_SYSV - .type ffi_call_SYSV, at function + .globl CALLFUNC(ffi_call_SYSV) + .type CALLFUNC(ffi_call_SYSV), at function .align 4 -ffi_call_SYSV: +CALLFUNC(ffi_call_SYSV): CFI_STARTPROC() link %fp,#0 CFI_OFFSET(14,-8) @@ -62,14 +71,18 @@ move.l 8(%fp),-(%sp) pea 4(%sp) #if !defined __PIC__ - jsr ffi_prep_args + jsr CALLFUNC(ffi_prep_args) #else - bsr.l ffi_prep_args at PLTPC + bsr.l CALLFUNC(ffi_prep_args at PLTPC) #endif addq.l #8,%sp | Pass pointer to struct value, if any +#ifdef __MINT__ + move.l %d0,%a1 +#else move.l %a0,%a1 +#endif | Call the function move.l 24(%fp),%a0 @@ -85,7 +98,12 @@ move.l 16(%fp),%d2 | If the return value pointer is NULL, assume no return value. + | NOTE: On the mc68000, tst on an address register is not supported. +#if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__) + cmp.w #0, %a1 +#else tst.l %a1 +#endif jbeq noretval btst #0,%d2 @@ -103,25 +121,44 @@ retfloat: btst #2,%d2 jbeq retdouble +#if defined(__MC68881__) || defined(__HAVE_68881__) fmove.s %fp0,(%a1) +#else + move.l %d0,(%a1) +#endif jbra epilogue retdouble: btst #3,%d2 jbeq retlongdouble +#if defined(__MC68881__) || defined(__HAVE_68881__) fmove.d %fp0,(%a1) +#else + move.l %d0,(%a1)+ + move.l %d1,(%a1) +#endif jbra epilogue retlongdouble: btst #4,%d2 jbeq retpointer +#if defined(__MC68881__) || defined(__HAVE_68881__) fmove.x %fp0,(%a1) +#else + move.l %d0,(%a1)+ + move.l %d1,(%a1)+ + move.l %d2,(%a1) +#endif jbra epilogue retpointer: btst #5,%d2 jbeq retstruct1 +#ifdef __MINT__ + move.l %d0,(%a1) +#else move.l %a0,(%a1) +#endif jbra epilogue retstruct1: @@ -132,8 +169,28 @@ retstruct2: btst #7,%d2 + jbeq retsint8 + move.w %d0,(%a1) + jbra epilogue + +retsint8: + btst #8,%d2 + jbeq retsint16 + | NOTE: On the mc68000, extb is not supported. 8->16, then 16->32. +#if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__) + ext.w %d0 + ext.l %d0 +#else + extb.l %d0 +#endif + move.l %d0,(%a1) + jbra epilogue + +retsint16: + btst #9,%d2 jbeq noretval - move.w %d0,(%a1) + ext.l %d0 + move.l %d0,(%a1) noretval: epilogue: @@ -141,13 +198,13 @@ unlk %fp rts CFI_ENDPROC() - .size ffi_call_SYSV,.-ffi_call_SYSV + .size CALLFUNC(ffi_call_SYSV),.-CALLFUNC(ffi_call_SYSV) - .globl ffi_closure_SYSV - .type ffi_closure_SYSV, @function + .globl CALLFUNC(ffi_closure_SYSV) + .type CALLFUNC(ffi_closure_SYSV), @function .align 4 -ffi_closure_SYSV: +CALLFUNC(ffi_closure_SYSV): CFI_STARTPROC() link %fp,#-12 CFI_OFFSET(14,-8) @@ -157,16 +214,18 @@ pea -12(%fp) move.l %a0,-(%sp) #if !defined __PIC__ - jsr ffi_closure_SYSV_inner + jsr CALLFUNC(ffi_closure_SYSV_inner) #else - bsr.l ffi_closure_SYSV_inner at PLTPC + bsr.l CALLFUNC(ffi_closure_SYSV_inner at PLTPC) #endif lsr.l #1,%d0 jne 1f jcc .Lcls_epilogue + | CIF_FLAGS_INT move.l -12(%fp),%d0 .Lcls_epilogue: + | no CIF_FLAGS_* unlk %fp rts 1: @@ -174,43 +233,80 @@ lsr.l #2,%d0 jne 1f jcs .Lcls_ret_float + | CIF_FLAGS_DINT move.l (%a0)+,%d0 move.l (%a0),%d1 jra .Lcls_epilogue .Lcls_ret_float: +#if defined(__MC68881__) || defined(__HAVE_68881__) fmove.s (%a0),%fp0 +#else + move.l (%a0),%d0 +#endif jra .Lcls_epilogue 1: lsr.l #2,%d0 jne 1f jcs .Lcls_ret_ldouble + | CIF_FLAGS_DOUBLE +#if defined(__MC68881__) || defined(__HAVE_68881__) fmove.d (%a0),%fp0 +#else + move.l (%a0)+,%d0 + move.l (%a0),%d1 +#endif jra .Lcls_epilogue .Lcls_ret_ldouble: +#if defined(__MC68881__) || defined(__HAVE_68881__) fmove.x (%a0),%fp0 +#else + move.l (%a0)+,%d0 + move.l (%a0)+,%d1 + move.l (%a0),%d2 +#endif jra .Lcls_epilogue 1: lsr.l #2,%d0 - jne .Lcls_ret_struct2 + jne 1f jcs .Lcls_ret_struct1 + | CIF_FLAGS_POINTER move.l (%a0),%a0 move.l %a0,%d0 jra .Lcls_epilogue .Lcls_ret_struct1: move.b (%a0),%d0 jra .Lcls_epilogue -.Lcls_ret_struct2: +1: + lsr.l #2,%d0 + jne 1f + jcs .Lcls_ret_sint8 + | CIF_FLAGS_STRUCT2 move.w (%a0),%d0 jra .Lcls_epilogue +.Lcls_ret_sint8: + move.l (%a0),%d0 + | NOTE: On the mc68000, extb is not supported. 8->16, then 16->32. +#if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__) + ext.w %d0 + ext.l %d0 +#else + extb.l %d0 +#endif + jra .Lcls_epilogue +1: + | CIF_FLAGS_SINT16 + move.l (%a0),%d0 + ext.l %d0 + jra .Lcls_epilogue CFI_ENDPROC() - .size ffi_closure_SYSV,.-ffi_closure_SYSV + .size CALLFUNC(ffi_closure_SYSV),.-CALLFUNC(ffi_closure_SYSV) - .globl ffi_closure_struct_SYSV - .type ffi_closure_struct_SYSV, @function + .globl CALLFUNC(ffi_closure_struct_SYSV) + .type CALLFUNC(ffi_closure_struct_SYSV), @function .align 4 -ffi_closure_struct_SYSV: +CALLFUNC(ffi_closure_struct_SYSV): CFI_STARTPROC() link %fp,#0 CFI_OFFSET(14,-8) @@ -220,14 +316,14 @@ move.l %a1,-(%sp) move.l %a0,-(%sp) #if !defined __PIC__ - jsr ffi_closure_SYSV_inner + jsr CALLFUNC(ffi_closure_SYSV_inner) #else - bsr.l ffi_closure_SYSV_inner at PLTPC + bsr.l CALLFUNC(ffi_closure_SYSV_inner at PLTPC) #endif unlk %fp rts CFI_ENDPROC() - .size ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV + .size CALLFUNC(ffi_closure_struct_SYSV),.-CALLFUNC(ffi_closure_struct_SYSV) #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"", at progbits diff --git a/Modules/_ctypes/libffi/src/metag/ffi.c b/Modules/_ctypes/libffi/src/metag/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/metag/ffi.c @@ -0,0 +1,330 @@ +/* ---------------------------------------------------------------------- + ffi.c - Copyright (c) 2013 Imagination Technologies + + Meta Foreign Function Interface + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + `Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED `AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +----------------------------------------------------------------------- */ + +#include +#include + +#include + +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) + +/* + * ffi_prep_args is called by the assembly routine once stack space has been + * allocated for the function's arguments + */ + +unsigned int ffi_prep_args(char *stack, extended_cif *ecif) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + + /* Store return value */ + if ( ecif->cif->flags == FFI_TYPE_STRUCT ) { + argp -= 4; + *(void **) argp = ecif->rvalue; + } + + p_argv = ecif->avalue; + + /* point to next location */ + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++, p_argv++) + { + size_t z; + + /* Move argp to address of argument */ + z = (*p_arg)->size; + argp -= z; + + /* Align if necessary */ + argp = (char *) ALIGN_DOWN(ALIGN_DOWN(argp, (*p_arg)->alignment), 4); + + if (z < sizeof(int)) { + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); + break; + case FFI_TYPE_UINT8: + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); + break; + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); + break; + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); + case FFI_TYPE_STRUCT: + memcpy(argp, *p_argv, (*p_arg)->size); + break; + default: + FFI_ASSERT(0); + } + } else if ( z == sizeof(int)) { + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + } else { + memcpy(argp, *p_argv, z); + } + } + + /* return the size of the arguments to be passed in registers, + padded to an 8 byte boundary to preserve stack alignment */ + return ALIGN(MIN(stack - argp, 6*4), 8); +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + ffi_type **ptr; + unsigned i, bytes = 0; + + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { + if ((*ptr)->size == 0) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the argument type, do this + check after the initialization. */ + FFI_ASSERT_VALID_TYPE(*ptr); + + /* Add any padding if necessary */ + if (((*ptr)->alignment - 1) & bytes) + bytes = ALIGN(bytes, (*ptr)->alignment); + + bytes += ALIGN((*ptr)->size, 4); + } + + /* Ensure arg space is aligned to an 8-byte boundary */ + bytes = ALIGN(bytes, 8); + + /* Make space for the return structure pointer */ + if (cif->rtype->type == FFI_TYPE_STRUCT) { + bytes += sizeof(void*); + + /* Ensure stack is aligned to an 8-byte boundary */ + bytes = ALIGN(bytes, 8); + } + + cif->bytes = bytes; + + /* Set the return type flag */ + switch (cif->rtype->type) { + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + cif->flags = (unsigned) cif->rtype->type; + break; + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + cif->flags = (unsigned) FFI_TYPE_SINT64; + break; + case FFI_TYPE_STRUCT: + /* Meta can store return values which are <= 64 bits */ + if (cif->rtype->size <= 4) + /* Returned to D0Re0 as 32-bit value */ + cif->flags = (unsigned)FFI_TYPE_INT; + else if ((cif->rtype->size > 4) && (cif->rtype->size <= 8)) + /* Returned valued is stored to D1Re0|R0Re0 */ + cif->flags = (unsigned)FFI_TYPE_DOUBLE; + else + /* value stored in memory */ + cif->flags = (unsigned)FFI_TYPE_STRUCT; + break; + default: + cif->flags = (unsigned)FFI_TYPE_INT; + break; + } + return FFI_OK; +} + +extern void ffi_call_SYSV(void (*fn)(void), extended_cif *, unsigned, unsigned, double *); + +/* + * Exported in API. Entry point + * cif -> ffi_cif object + * fn -> function pointer + * rvalue -> pointer to return value + * avalue -> vector of void * pointers pointing to memory locations holding the + * arguments + */ +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + int small_struct = (((cif->flags == FFI_TYPE_INT) || (cif->flags == FFI_TYPE_DOUBLE)) && (cif->rtype->type == FFI_TYPE_STRUCT)); + ecif.cif = cif; + ecif.avalue = avalue; + + double temp; + + /* + * If the return value is a struct and we don't have a return value address + * then we need to make one + */ + + if ((rvalue == NULL ) && (cif->flags == FFI_TYPE_STRUCT)) + ecif.rvalue = alloca(cif->rtype->size); + else if (small_struct) + ecif.rvalue = &temp; + else + ecif.rvalue = rvalue; + + switch (cif->abi) { + case FFI_SYSV: + ffi_call_SYSV(fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); + break; + default: + FFI_ASSERT(0); + break; + } + + if (small_struct) + memcpy (rvalue, &temp, cif->rtype->size); +} + +/* private members */ + +static void ffi_prep_incoming_args_SYSV (char *, void **, void **, + ffi_cif*, float *); + +void ffi_closure_SYSV (ffi_closure *); + +/* Do NOT change that without changing the FFI_TRAMPOLINE_SIZE */ +extern unsigned int ffi_metag_trampoline[10]; /* 10 instructions */ + +/* end of private members */ + +/* + * __tramp: trampoline memory location + * __fun: assembly routine + * __ctx: memory location for wrapper + * + * At this point, tramp[0] == __ctx ! + */ +void ffi_init_trampoline(unsigned char *__tramp, unsigned int __fun, unsigned int __ctx) { + memcpy (__tramp, ffi_metag_trampoline, sizeof(ffi_metag_trampoline)); + *(unsigned int*) &__tramp[40] = __ctx; + *(unsigned int*) &__tramp[44] = __fun; + /* This will flush the instruction cache */ + __builtin_meta2_cachewd(&__tramp[0], 1); + __builtin_meta2_cachewd(&__tramp[47], 1); +} + + + +/* the cif must already be prepared */ + +ffi_status +ffi_prep_closure_loc (ffi_closure *closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + void (*closure_func)(ffi_closure*) = NULL; + + if (cif->abi == FFI_SYSV) + closure_func = &ffi_closure_SYSV; + else + return FFI_BAD_ABI; + + ffi_init_trampoline( + (unsigned char*)&closure->tramp[0], + (unsigned int)closure_func, + (unsigned int)codeloc); + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + + +/* This function is jumped to by the trampoline */ +unsigned int ffi_closure_SYSV_inner (closure, respp, args, vfp_args) + ffi_closure *closure; + void **respp; + void *args; + void *vfp_args; +{ + ffi_cif *cif; + void **arg_area; + + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + + /* + * This call will initialize ARG_AREA, such that each + * element in that array points to the corresponding + * value on the stack; and if the function returns + * a structure, it will re-set RESP to point to the + * structure return address. + */ + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif, vfp_args); + + (closure->fun) ( cif, *respp, arg_area, closure->user_data); + + return cif->flags; +} + +static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, + void **avalue, ffi_cif *cif, + float *vfp_stack) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + /* stack points to original arguments */ + argp = stack; + + /* Store return value */ + if ( cif->flags == FFI_TYPE_STRUCT ) { + argp -= 4; + *rvalue = *(void **) argp; + } + + p_argv = avalue; + + for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { + size_t z; + size_t alignment; + + alignment = (*p_arg)->alignment; + if (alignment < 4) + alignment = 4; + if ((alignment - 1) & (unsigned)argp) + argp = (char *) ALIGN(argp, alignment); + + z = (*p_arg)->size; + *p_argv = (void*) argp; + p_argv++; + argp -= z; + } + return; +} diff --git a/Modules/_ctypes/libffi/src/metag/ffitarget.h b/Modules/_ctypes/libffi/src/metag/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/metag/ffitarget.h @@ -0,0 +1,53 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2013 Imagination Technologies Ltd. + Target configuration macros for Meta + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_DEFAULT_ABI = FFI_SYSV, + FFI_LAST_ABI = FFI_DEFAULT_ABI + 1, +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 48 +#define FFI_NATIVE_RAW_API 0 + +#endif + diff --git a/Modules/_ctypes/libffi/src/metag/sysv.S b/Modules/_ctypes/libffi/src/metag/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/metag/sysv.S @@ -0,0 +1,311 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2013 Imagination Technologies Ltd. + + Meta Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include +#ifdef HAVE_MACHINE_ASM_H +#include +#else +#ifdef __USER_LABEL_PREFIX__ +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b + +/* Use the right prefix for global labels. */ +#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x) +#else +#define CNAME(x) x +#endif +#define ENTRY(x) .globl CNAME(x); .type CNAME(x), %function; CNAME(x): +#endif + +#ifdef __ELF__ +#define LSYM(x) .x +#else +#define LSYM(x) x +#endif + +.macro call_reg x= + .text + .balign 4 + mov D1RtP, \x + swap D1RtP, PC +.endm + +! Save register arguments +.macro SAVE_ARGS + .text + .balign 4 + setl [A0StP++], D0Ar6, D1Ar5 + setl [A0StP++], D0Ar4, D1Ar3 + setl [A0StP++], D0Ar2, D1Ar1 +.endm + +! Save retrun, frame pointer and other regs +.macro SAVE_REGS regs= + .text + .balign 4 + setl [A0StP++], D0FrT, D1RtP + ! Needs to be a pair of regs + .ifnc "\regs","" + setl [A0StP++], \regs + .endif +.endm + +! Declare a global function +.macro METAG_FUNC_START name + .text + .balign 4 + ENTRY(\name) +.endm + +! Return registers from the stack. Reverse SAVE_REGS operation +.macro RET_REGS regs=, cond= + .ifnc "\regs", "" + getl \regs, [--A0StP] + .endif + getl D0FrT, D1RtP, [--A0StP] +.endm + +! Return arguments +.macro RET_ARGS + getl D0Ar2, D1Ar1, [--A0StP] + getl D0Ar4, D1Ar3, [--A0StP] + getl D0Ar6, D1Ar5, [--A0StP] +.endm + + + ! D1Ar1: fn + ! D0Ar2: &ecif + ! D1Ar3: cif->bytes + ! D0Ar4: fig->flags + ! D1Ar5: ecif.rvalue + + ! This assumes we are using GNU as +METAG_FUNC_START ffi_call_SYSV + ! Save argument registers + + SAVE_ARGS + + ! new frame + mov D0FrT, A0FrP + add A0FrP, A0StP, #0 + + ! Preserve the old frame pointer + SAVE_REGS "D1.5, D0.5" + + ! Make room for new args. cifs->bytes is the total space for input + ! and return arguments + + add A0StP, A0StP, D1Ar3 + + ! Preserve cifs->bytes & fn + mov D0.5, D1Ar3 + mov D1.5, D1Ar1 + + ! Place all of the ffi_prep_args in position + mov D1Ar1, A0StP + + ! Call ffi_prep_args(stack, &ecif) +#ifdef __PIC__ + callr D1RtP, CNAME(ffi_prep_args at PLT) +#else + callr D1RtP, CNAME(ffi_prep_args) +#endif + + ! Restore fn pointer + + ! The foreign stack should look like this + ! XXXXX XXXXXX <--- stack pointer + ! FnArgN rvalue + ! FnArgN+2 FnArgN+1 + ! FnArgN+4 FnArgN+3 + ! .... + ! + + ! A0StP now points to the first (or return) argument + 4 + + ! Preserve cif->bytes + getl D0Ar2, D1Ar1, [--A0StP] + getl D0Ar4, D1Ar3, [--A0StP] + getl D0Ar6, D1Ar5, [--A0StP] + + ! Place A0StP to the first argument again + add A0StP, A0StP, #24 ! That's because we loaded 6 regs x 4 byte each + + ! A0FrP points to the initial stack without the reserved space for the + ! cifs->bytes, whilst A0StP points to the stack after the space allocation + + ! fn was the first argument of ffi_call_SYSV. + ! The stack at this point looks like this: + ! + ! A0StP(on entry to _SYSV) -> Arg6 Arg5 | low + ! Arg4 Arg3 | + ! Arg2 Arg1 | + ! A0FrP ----> D0FrtP D1RtP | + ! D1.5 D0.5 | + ! A0StP(bf prep_args) -> FnArgn FnArgn-1 | + ! FnArgn-2FnArgn-3 | + ! ................ | <= cifs->bytes + ! FnArg4 FnArg3 | + ! A0StP (prv_A0StP+cifs->bytes) FnArg2 FnArg1 | high + ! + ! fn was in Arg1 so it's located in in A0FrP+#-0xC + ! + + ! D0Re0 contains the size of arguments stored in registers + sub A0StP, A0StP, D0Re0 + + ! Arg1 is the function pointer for the foreign call. This has been + ! preserved in D1.5 + + ! Time to call (fn). Arguments should be like this: + ! Arg1-Arg6 are loaded to regs + ! The rest of the arguments are stored in stack pointed by A0StP + + call_reg D1.5 + + ! Reset stack. + + mov A0StP, A0FrP + + ! Load Arg1 with the pointer to storage for the return type + ! This was stored in Arg5 + + getd D1Ar1, [A0FrP+#-20] + + ! Load D0Ar2 with the return type code. This was stored in Arg4 (flags) + + getd D0Ar2, [A0FrP+#-16] + + ! We are ready to start processing the return value + ! D0Re0 (and D1Re0) hold the return value + + ! If the return value is NULL, assume no return value + cmp D1Ar1, #0 + beq LSYM(Lepilogue) + + ! return INT + cmp D0Ar2, #FFI_TYPE_INT + ! Sadly, there is no setd{cc} instruction so we need to workaround that + bne .INT64 + setd [D1Ar1], D0Re0 + b LSYM(Lepilogue) + + ! return INT64 +.INT64: + cmp D0Ar2, #FFI_TYPE_SINT64 + setleq [D1Ar1], D0Re0, D1Re0 + + ! return DOUBLE + cmp D0Ar2, #FFI_TYPE_DOUBLE + setl [D1AR1++], D0Re0, D1Re0 + +LSYM(Lepilogue): + ! At this point, the stack pointer points right after the argument + ! saved area. We need to restore 4 regs, therefore we need to move + ! 16 bytes ahead. + add A0StP, A0StP, #16 + RET_REGS "D1.5, D0.5" + RET_ARGS + getd D0Re0, [A0StP] + mov A0FrP, D0FrT + swap D1RtP, PC + +.ffi_call_SYSV_end: + .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) + + +/* + (called by ffi_metag_trampoline) + void ffi_closure_SYSV (ffi_closure*) + + (called by ffi_closure_SYSV) + unsigned int FFI_HIDDEN + ffi_closure_SYSV_inner (closure,respp, args) + ffi_closure *closure; + void **respp; + void *args; +*/ + +METAG_FUNC_START ffi_closure_SYSV + ! We assume that D1Ar1 holds the address of the + ! ffi_closure struct. We will use that to fetch the + ! arguments. The stack pointer points to an empty space + ! and it is ready to store more data. + + ! D1Ar1 is ready + ! Allocate stack space for return value + add A0StP, A0StP, #8 + ! Store it to D0Ar2 + sub D0Ar2, A0StP, #8 + + sub D1Ar3, A0FrP, #4 + + ! D1Ar3 contains the address of the original D1Ar1 argument + ! We need to subtract #4 later on + + ! Preverve D0Ar2 + mov D0.5, D0Ar2 + +#ifdef __PIC__ + callr D1RtP, CNAME(ffi_closure_SYSV_inner at PLT) +#else + callr D1RtP, CNAME(ffi_closure_SYSV_inner) +#endif + + ! Check the return value and store it to D0.5 + cmp D0Re0, #FFI_TYPE_INT + beq .Lretint + cmp D0Re0, #FFI_TYPE_DOUBLE + beq .Lretdouble +.Lclosure_epilogue: + sub A0StP, A0StP, #8 + RET_REGS "D1.5, D0.5" + RET_ARGS + swap D1RtP, PC + +.Lretint: + setd [D0.5], D0Re0 + b .Lclosure_epilogue +.Lretdouble: + setl [D0.5++], D0Re0, D1Re0 + b .Lclosure_epilogue +.ffi_closure_SYSV_end: +.size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) + + +ENTRY(ffi_metag_trampoline) + SAVE_ARGS + ! New frame + mov A0FrP, A0StP + SAVE_REGS "D1.5, D0.5" + mov D0.5, PC + ! Load D1Ar1 the value of ffi_metag_trampoline + getd D1Ar1, [D0.5 + #8] + ! Jump to ffi_closure_SYSV + getd PC, [D0.5 + #12] diff --git a/Modules/_ctypes/libffi/src/microblaze/ffi.c b/Modules/_ctypes/libffi/src/microblaze/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/microblaze/ffi.c @@ -0,0 +1,321 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2012, 2013 Xilinx, Inc + + MicroBlaze Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +extern void ffi_call_SYSV(void (*)(void*, extended_cif*), extended_cif*, + unsigned int, unsigned int, unsigned int*, void (*fn)(void), + unsigned int, unsigned int); + +extern void ffi_closure_SYSV(void); + +#define WORD_SIZE sizeof(unsigned int) +#define ARGS_REGISTER_SIZE (WORD_SIZE * 6) +#define WORD_ALIGN(x) ALIGN(x, WORD_SIZE) + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ +void ffi_prep_args(void* stack, extended_cif* ecif) +{ + unsigned int i; + ffi_type** p_arg; + void** p_argv; + void* stack_args_p = stack; + + p_argv = ecif->avalue; + + if (ecif == NULL || ecif->cif == NULL) { + return; /* no description to prepare */ + } + + if ((ecif->cif->rtype != NULL) && + (ecif->cif->rtype->type == FFI_TYPE_STRUCT)) + { + /* if return type is a struct which is referenced on the stack/reg5, + * by a pointer. Stored the return value pointer in r5. + */ + char* addr = stack_args_p; + memcpy(addr, &(ecif->rvalue), WORD_SIZE); + stack_args_p += WORD_SIZE; + } + + if (ecif->avalue == NULL) { + return; /* no arguments to prepare */ + } + + for (i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; + i++, p_arg++) + { + size_t size = (*p_arg)->size; + int type = (*p_arg)->type; + void* value = p_argv[i]; + char* addr = stack_args_p; + int aligned_size = WORD_ALIGN(size); + + /* force word alignment on the stack */ + stack_args_p += aligned_size; + + switch (type) + { + case FFI_TYPE_UINT8: + *(unsigned int *)addr = (unsigned int)*(UINT8*)(value); + break; + case FFI_TYPE_SINT8: + *(signed int *)addr = (signed int)*(SINT8*)(value); + break; + case FFI_TYPE_UINT16: + *(unsigned int *)addr = (unsigned int)*(UINT16*)(value); + break; + case FFI_TYPE_SINT16: + *(signed int *)addr = (signed int)*(SINT16*)(value); + break; + case FFI_TYPE_STRUCT: +#if __BIG_ENDIAN__ + /* + * MicroBlaze toolchain appears to emit: + * bsrli r5, r5, 8 (caller) + * ... + * + * ... + * bslli r5, r5, 8 (callee) + * + * For structs like "struct a { uint8_t a[3]; };", when passed + * by value. + * + * Structs like "struct b { uint16_t a; };" are also expected + * to be packed strangely in registers. + * + * This appears to be because the microblaze toolchain expects + * "struct b == uint16_t", which is only any issue for big + * endian. + * + * The following is a work around for big-endian only, for the + * above mentioned case, it will re-align the contents of a + * <= 3-byte struct value. + */ + if (size < WORD_SIZE) + { + memcpy (addr + (WORD_SIZE - size), value, size); + break; + } +#endif + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + case FFI_TYPE_FLOAT: + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_DOUBLE: + default: + memcpy(addr, value, aligned_size); + } + } +} + +ffi_status ffi_prep_cif_machdep(ffi_cif* cif) +{ + /* check ABI */ + switch (cif->abi) + { + case FFI_SYSV: + break; + default: + return FFI_BAD_ABI; + } + return FFI_OK; +} + +void ffi_call(ffi_cif* cif, void (*fn)(void), void* rvalue, void** avalue) +{ + extended_cif ecif; + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { + ecif.rvalue = alloca(cif->rtype->size); + } else { + ecif.rvalue = rvalue; + } + + switch (cif->abi) + { + case FFI_SYSV: + ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, + ecif.rvalue, fn, cif->rtype->type, cif->rtype->size); + break; + default: + FFI_ASSERT(0); + break; + } +} + +void ffi_closure_call_SYSV(void* register_args, void* stack_args, + ffi_closure* closure, void* rvalue, + unsigned int* rtype, unsigned int* rsize) +{ + /* prepare arguments for closure call */ + ffi_cif* cif = closure->cif; + ffi_type** arg_types = cif->arg_types; + + /* re-allocate data for the args. This needs to be done in order to keep + * multi-word objects (e.g. structs) in contigious memory. Callers are not + * required to store the value of args in the lower 6 words in the stack + * (although they are allocated in the stack). + */ + char* stackclone = alloca(cif->bytes); + void** avalue = alloca(cif->nargs * sizeof(void*)); + void* struct_rvalue = NULL; + char* ptr = stackclone; + int i; + + /* copy registers into stack clone */ + int registers_used = cif->bytes; + if (registers_used > ARGS_REGISTER_SIZE) { + registers_used = ARGS_REGISTER_SIZE; + } + memcpy(stackclone, register_args, registers_used); + + /* copy stack allocated args into stack clone */ + if (cif->bytes > ARGS_REGISTER_SIZE) { + int stack_used = cif->bytes - ARGS_REGISTER_SIZE; + memcpy(stackclone + ARGS_REGISTER_SIZE, stack_args, stack_used); + } + + /* preserve struct type return pointer passing */ + if ((cif->rtype != NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { + struct_rvalue = *((void**)ptr); + ptr += WORD_SIZE; + } + + /* populate arg pointer list */ + for (i = 0; i < cif->nargs; i++) + { + switch (arg_types[i]->type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: +#ifdef __BIG_ENDIAN__ + avalue[i] = ptr + 3; +#else + avalue[i] = ptr; +#endif + break; + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: +#ifdef __BIG_ENDIAN__ + avalue[i] = ptr + 2; +#else + avalue[i] = ptr; +#endif + break; + case FFI_TYPE_STRUCT: +#if __BIG_ENDIAN__ + /* + * Work around strange ABI behaviour. + * (see info in ffi_prep_args) + */ + if (arg_types[i]->size < WORD_SIZE) + { + memcpy (ptr, ptr + (WORD_SIZE - arg_types[i]->size), arg_types[i]->size); + } +#endif + avalue[i] = (void*)ptr; + break; + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_DOUBLE: + avalue[i] = ptr; + break; + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + case FFI_TYPE_FLOAT: + default: + /* default 4-byte argument */ + avalue[i] = ptr; + break; + } + ptr += WORD_ALIGN(arg_types[i]->size); + } + + /* set the return type info passed back to the wrapper */ + *rsize = cif->rtype->size; + *rtype = cif->rtype->type; + if (struct_rvalue != NULL) { + closure->fun(cif, struct_rvalue, avalue, closure->user_data); + /* copy struct return pointer value into function return value */ + *((void**)rvalue) = struct_rvalue; + } else { + closure->fun(cif, rvalue, avalue, closure->user_data); + } +} + +ffi_status ffi_prep_closure_loc( + ffi_closure* closure, ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void* user_data, void* codeloc) +{ + unsigned long* tramp = (unsigned long*)&(closure->tramp[0]); + unsigned long cls = (unsigned long)codeloc; + unsigned long fn = 0; + unsigned long fn_closure_call_sysv = (unsigned long)ffi_closure_call_SYSV; + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + switch (cif->abi) + { + case FFI_SYSV: + fn = (unsigned long)ffi_closure_SYSV; + + /* load r11 (temp) with fn */ + /* imm fn(upper) */ + tramp[0] = 0xb0000000 | ((fn >> 16) & 0xffff); + /* addik r11, r0, fn(lower) */ + tramp[1] = 0x31600000 | (fn & 0xffff); + + /* load r12 (temp) with cls */ + /* imm cls(upper) */ + tramp[2] = 0xb0000000 | ((cls >> 16) & 0xffff); + /* addik r12, r0, cls(lower) */ + tramp[3] = 0x31800000 | (cls & 0xffff); + + /* load r3 (temp) with ffi_closure_call_SYSV */ + /* imm fn_closure_call_sysv(upper) */ + tramp[4] = 0xb0000000 | ((fn_closure_call_sysv >> 16) & 0xffff); + /* addik r3, r0, fn_closure_call_sysv(lower) */ + tramp[5] = 0x30600000 | (fn_closure_call_sysv & 0xffff); + /* branch/jump to address stored in r11 (fn) */ + tramp[6] = 0x98085800; /* bra r11 */ + + break; + default: + return FFI_BAD_ABI; + } + return FFI_OK; +} diff --git a/Modules/_ctypes/libffi/src/microblaze/ffitarget.h b/Modules/_ctypes/libffi/src/microblaze/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/microblaze/ffitarget.h @@ -0,0 +1,53 @@ +/* ----------------------------------------------------------------------- + ffitarget.h - Copyright (c) 2012, 2013 Xilinx, Inc + + Target configuration macros for MicroBlaze. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV +} ffi_abi; +#endif + +/* Definitions for closures */ + +#define FFI_CLOSURES 1 +#define FFI_NATIVE_RAW_API 0 + +#define FFI_TRAMPOLINE_SIZE (4*8) + +#endif diff --git a/Modules/_ctypes/libffi/src/microblaze/sysv.S b/Modules/_ctypes/libffi/src/microblaze/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/microblaze/sysv.S @@ -0,0 +1,302 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2012, 2013 Xilinx, Inc + + MicroBlaze Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + + /* + * arg[0] (r5) = ffi_prep_args, + * arg[1] (r6) = &ecif, + * arg[2] (r7) = cif->bytes, + * arg[3] (r8) = cif->flags, + * arg[4] (r9) = ecif.rvalue, + * arg[5] (r10) = fn + * arg[6] (sp[0]) = cif->rtype->type + * arg[7] (sp[4]) = cif->rtype->size + */ + .text + .globl ffi_call_SYSV + .type ffi_call_SYSV, @function +ffi_call_SYSV: + /* push callee saves */ + addik r1, r1, -20 + swi r19, r1, 0 /* Frame Pointer */ + swi r20, r1, 4 /* PIC register */ + swi r21, r1, 8 /* PIC register */ + swi r22, r1, 12 /* save for locals */ + swi r23, r1, 16 /* save for locals */ + + /* save the r5-r10 registers in the stack */ + addik r1, r1, -24 /* increment sp to store 6x 32-bit words */ + swi r5, r1, 0 + swi r6, r1, 4 + swi r7, r1, 8 + swi r8, r1, 12 + swi r9, r1, 16 + swi r10, r1, 20 + + /* save function pointer */ + addik r3, r5, 0 /* copy ffi_prep_args into r3 */ + addik r22, r1, 0 /* save sp for unallocated args into r22 (callee-saved) */ + addik r23, r10, 0 /* save function address into r23 (callee-saved) */ + + /* prepare stack with allocation for n (bytes = r7) args */ + rsub r1, r7, r1 /* subtract bytes from sp */ + + /* prep args for ffi_prep_args call */ + addik r5, r1, 0 /* store stack pointer into arg[0] */ + /* r6 still holds ecif for arg[1] */ + + /* Call ffi_prep_args(stack, &ecif). */ + addik r1, r1, -4 + swi r15, r1, 0 /* store the link register in the frame */ + brald r15, r3 + nop /* branch has delay slot */ + lwi r15, r1, 0 + addik r1, r1, 4 /* restore the link register from the frame */ + /* returns calling stack pointer location */ + + /* prepare args for fn call, prep_args populates them onto the stack */ + lwi r5, r1, 0 /* arg[0] */ + lwi r6, r1, 4 /* arg[1] */ + lwi r7, r1, 8 /* arg[2] */ + lwi r8, r1, 12 /* arg[3] */ + lwi r9, r1, 16 /* arg[4] */ + lwi r10, r1, 20 /* arg[5] */ + + /* call (fn) (...). */ + addik r1, r1, -4 + swi r15, r1, 0 /* store the link register in the frame */ + brald r15, r23 + nop /* branch has delay slot */ + lwi r15, r1, 0 + addik r1, r1, 4 /* restore the link register from the frame */ + + /* Remove the space we pushed for the args. */ + addik r1, r22, 0 /* restore old SP */ + + /* restore this functions parameters */ + lwi r5, r1, 0 /* arg[0] */ + lwi r6, r1, 4 /* arg[1] */ + lwi r7, r1, 8 /* arg[2] */ + lwi r8, r1, 12 /* arg[3] */ + lwi r9, r1, 16 /* arg[4] */ + lwi r10, r1, 20 /* arg[5] */ + addik r1, r1, 24 /* decrement sp to de-allocate 6x 32-bit words */ + + /* If the return value pointer is NULL, assume no return value. */ + beqi r9, ffi_call_SYSV_end + + lwi r22, r1, 48 /* get return type (20 for locals + 28 for arg[6]) */ + lwi r23, r1, 52 /* get return size (20 for locals + 32 for arg[7]) */ + + /* Check if return type is actually a struct, do nothing */ + rsubi r11, r22, FFI_TYPE_STRUCT + beqi r11, ffi_call_SYSV_end + + /* Return 8bit */ + rsubi r11, r23, 1 + beqi r11, ffi_call_SYSV_store8 + + /* Return 16bit */ + rsubi r11, r23, 2 + beqi r11, ffi_call_SYSV_store16 + + /* Return 32bit */ + rsubi r11, r23, 4 + beqi r11, ffi_call_SYSV_store32 + + /* Return 64bit */ + rsubi r11, r23, 8 + beqi r11, ffi_call_SYSV_store64 + + /* Didnt match anything */ + bri ffi_call_SYSV_end + +ffi_call_SYSV_store64: + swi r3, r9, 0 /* store word r3 into return value */ + swi r4, r9, 4 /* store word r4 into return value */ + bri ffi_call_SYSV_end + +ffi_call_SYSV_store32: + swi r3, r9, 0 /* store word r3 into return value */ + bri ffi_call_SYSV_end + +ffi_call_SYSV_store16: +#ifdef __BIG_ENDIAN__ + shi r3, r9, 2 /* store half-word r3 into return value */ +#else + shi r3, r9, 0 /* store half-word r3 into return value */ +#endif + bri ffi_call_SYSV_end + +ffi_call_SYSV_store8: +#ifdef __BIG_ENDIAN__ + sbi r3, r9, 3 /* store byte r3 into return value */ +#else + sbi r3, r9, 0 /* store byte r3 into return value */ +#endif + bri ffi_call_SYSV_end + +ffi_call_SYSV_end: + /* callee restores */ + lwi r19, r1, 0 /* frame pointer */ + lwi r20, r1, 4 /* PIC register */ + lwi r21, r1, 8 /* PIC register */ + lwi r22, r1, 12 + lwi r23, r1, 16 + addik r1, r1, 20 + + /* return from sub-routine (with delay slot) */ + rtsd r15, 8 + nop + + .size ffi_call_SYSV, . - ffi_call_SYSV + +/* ------------------------------------------------------------------------- */ + + /* + * args passed into this function, are passed down to the callee. + * this function is the target of the closure trampoline, as such r12 is + * a pointer to the closure object. + */ + .text + .globl ffi_closure_SYSV + .type ffi_closure_SYSV, @function +ffi_closure_SYSV: + /* push callee saves */ + addik r11, r1, 28 /* save stack args start location (excluding regs/link) */ + addik r1, r1, -12 + swi r19, r1, 0 /* Frame Pointer */ + swi r20, r1, 4 /* PIC register */ + swi r21, r1, 8 /* PIC register */ + + /* store register args on stack */ + addik r1, r1, -24 + swi r5, r1, 0 + swi r6, r1, 4 + swi r7, r1, 8 + swi r8, r1, 12 + swi r9, r1, 16 + swi r10, r1, 20 + + /* setup args */ + addik r5, r1, 0 /* register_args */ + addik r6, r11, 0 /* stack_args */ + addik r7, r12, 0 /* closure object */ + addik r1, r1, -8 /* allocate return value */ + addik r8, r1, 0 /* void* rvalue */ + addik r1, r1, -8 /* allocate for reutrn type/size values */ + addik r9, r1, 0 /* void* rtype */ + addik r10, r1, 4 /* void* rsize */ + + /* call the wrap_call function */ + addik r1, r1, -28 /* allocate args + link reg */ + swi r15, r1, 0 /* store the link register in the frame */ + brald r15, r3 + nop /* branch has delay slot */ + lwi r15, r1, 0 + addik r1, r1, 28 /* restore the link register from the frame */ + +ffi_closure_SYSV_prepare_return: + lwi r9, r1, 0 /* rtype */ + lwi r10, r1, 4 /* rsize */ + addik r1, r1, 8 /* de-allocate return info values */ + + /* Check if return type is actually a struct, store 4 bytes */ + rsubi r11, r9, FFI_TYPE_STRUCT + beqi r11, ffi_closure_SYSV_store32 + + /* Return 8bit */ + rsubi r11, r10, 1 + beqi r11, ffi_closure_SYSV_store8 + + /* Return 16bit */ + rsubi r11, r10, 2 + beqi r11, ffi_closure_SYSV_store16 + + /* Return 32bit */ + rsubi r11, r10, 4 + beqi r11, ffi_closure_SYSV_store32 + + /* Return 64bit */ + rsubi r11, r10, 8 + beqi r11, ffi_closure_SYSV_store64 + + /* Didnt match anything */ + bri ffi_closure_SYSV_end + +ffi_closure_SYSV_store64: + lwi r3, r1, 0 /* store word r3 into return value */ + lwi r4, r1, 4 /* store word r4 into return value */ + /* 64 bits == 2 words, no sign extend occurs */ + bri ffi_closure_SYSV_end + +ffi_closure_SYSV_store32: + lwi r3, r1, 0 /* store word r3 into return value */ + /* 32 bits == 1 word, no sign extend occurs */ + bri ffi_closure_SYSV_end + +ffi_closure_SYSV_store16: +#ifdef __BIG_ENDIAN__ + lhui r3, r1, 2 /* store half-word r3 into return value */ +#else + lhui r3, r1, 0 /* store half-word r3 into return value */ +#endif + rsubi r11, r9, FFI_TYPE_SINT16 + bnei r11, ffi_closure_SYSV_end + sext16 r3, r3 /* fix sign extend of sint8 */ + bri ffi_closure_SYSV_end + +ffi_closure_SYSV_store8: +#ifdef __BIG_ENDIAN__ + lbui r3, r1, 3 /* store byte r3 into return value */ +#else + lbui r3, r1, 0 /* store byte r3 into return value */ +#endif + rsubi r11, r9, FFI_TYPE_SINT8 + bnei r11, ffi_closure_SYSV_end + sext8 r3, r3 /* fix sign extend of sint8 */ + bri ffi_closure_SYSV_end + +ffi_closure_SYSV_end: + addik r1, r1, 8 /* de-allocate return value */ + + /* de-allocate stored args */ + addik r1, r1, 24 + + /* callee restores */ + lwi r19, r1, 0 /* frame pointer */ + lwi r20, r1, 4 /* PIC register */ + lwi r21, r1, 8 /* PIC register */ + addik r1, r1, 12 + + /* return from sub-routine (with delay slot) */ + rtsd r15, 8 + nop + + .size ffi_closure_SYSV, . - ffi_closure_SYSV diff --git a/Modules/_ctypes/libffi/src/mips/ffi.c b/Modules/_ctypes/libffi/src/mips/ffi.c --- a/Modules/_ctypes/libffi/src/mips/ffi.c +++ b/Modules/_ctypes/libffi/src/mips/ffi.c @@ -1,6 +1,7 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1996, 2007, 2008 Red Hat, Inc. - Copyright (c) 2008 David Daney + ffi.c - Copyright (c) 2011 Anthony Green + Copyright (c) 2008 David Daney + Copyright (c) 1996, 2007, 2008, 2011 Red Hat, Inc. MIPS Foreign Function Interface @@ -37,7 +38,11 @@ #endif #ifndef USE__BUILTIN___CLEAR_CACHE -#include +# if defined(__OpenBSD__) +# include +# else +# include +# endif #endif #ifdef FFI_DEBUG @@ -662,10 +667,19 @@ char *clear_location = (char *) codeloc; #if defined(FFI_MIPS_O32) - FFI_ASSERT(cif->abi == FFI_O32 || cif->abi == FFI_O32_SOFT_FLOAT); + if (cif->abi != FFI_O32 && cif->abi != FFI_O32_SOFT_FLOAT) + return FFI_BAD_ABI; fn = ffi_closure_O32; -#else /* FFI_MIPS_N32 */ - FFI_ASSERT(cif->abi == FFI_N32 || cif->abi == FFI_N64); +#else +#if _MIPS_SIM ==_ABIN32 + if (cif->abi != FFI_N32 + && cif->abi != FFI_N32_SOFT_FLOAT) + return FFI_BAD_ABI; +#else + if (cif->abi != FFI_N64 + && cif->abi != FFI_N64_SOFT_FLOAT) + return FFI_BAD_ABI; +#endif fn = ffi_closure_N32; #endif /* FFI_MIPS_O32 */ diff --git a/Modules/_ctypes/libffi/src/mips/ffitarget.h b/Modules/_ctypes/libffi/src/mips/ffitarget.h --- a/Modules/_ctypes/libffi/src/mips/ffitarget.h +++ b/Modules/_ctypes/libffi/src/mips/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for MIPS. Permission is hereby granted, free of charge, to any person obtaining @@ -27,11 +28,23 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #ifdef linux # include -#else +#elif defined(__rtems__) +/* + * Subprogram calling convention - copied from sgidefs.h + */ +#define _MIPS_SIM_ABI32 1 +#define _MIPS_SIM_NABI32 2 +#define _MIPS_SIM_ABI64 3 +#elif !defined(__OpenBSD__) # include #endif + # ifndef _ABIN32 # define _ABIN32 _MIPS_SIM_NABI32 # endif @@ -43,7 +56,7 @@ # endif #if !defined(_MIPS_SIM) --- something is very wrong -- +# error -- something is very wrong -- #else # if (_MIPS_SIM==_ABIN32 && defined(_ABIN32)) || (_MIPS_SIM==_ABI64 && defined(_ABI64)) # define FFI_MIPS_N32 @@ -51,7 +64,7 @@ # if (_MIPS_SIM==_ABIO32 && defined(_ABIO32)) # define FFI_MIPS_O32 # else --- this is an unsupported platform -- +# error -- this is an unsupported platform -- # endif # endif #endif @@ -186,30 +199,29 @@ FFI_O32_SOFT_FLOAT, FFI_N32_SOFT_FLOAT, FFI_N64_SOFT_FLOAT, + FFI_LAST_ABI, #ifdef FFI_MIPS_O32 #ifdef __mips_soft_float - FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT, + FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT #else - FFI_DEFAULT_ABI = FFI_O32, + FFI_DEFAULT_ABI = FFI_O32 #endif #else # if _MIPS_SIM==_ABI64 # ifdef __mips_soft_float - FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT, + FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT # else - FFI_DEFAULT_ABI = FFI_N64, + FFI_DEFAULT_ABI = FFI_N64 # endif # else # ifdef __mips_soft_float - FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT, + FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT # else - FFI_DEFAULT_ABI = FFI_N32, + FFI_DEFAULT_ABI = FFI_N32 # endif # endif #endif - - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 } ffi_abi; #define FFI_EXTRA_CIF_FIELDS unsigned rstruct_flag diff --git a/Modules/_ctypes/libffi/src/mips/n32.S b/Modules/_ctypes/libffi/src/mips/n32.S --- a/Modules/_ctypes/libffi/src/mips/n32.S +++ b/Modules/_ctypes/libffi/src/mips/n32.S @@ -43,6 +43,7 @@ #ifdef __GNUC__ .abicalls #endif + .set mips4 .text .align 2 .globl ffi_call_N32 diff --git a/Modules/_ctypes/libffi/src/moxie/eabi.S b/Modules/_ctypes/libffi/src/moxie/eabi.S --- a/Modules/_ctypes/libffi/src/moxie/eabi.S +++ b/Modules/_ctypes/libffi/src/moxie/eabi.S @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- - eabi.S - Copyright (c) 2004 Anthony Green + eabi.S - Copyright (c) 2012, 2013 Anthony Green - FR-V Assembly glue. + Moxie Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -34,95 +34,68 @@ .globl ffi_call_EABI .type ffi_call_EABI, @function - # gr8 : ffi_prep_args - # gr9 : &ecif - # gr10: cif->bytes - # gr11: fig->flags - # gr12: ecif.rvalue - # gr13: fn + # $r0 : ffi_prep_args + # $r1 : &ecif + # $r2 : cif->bytes + # $r3 : fig->flags + # $r4 : ecif.rvalue + # $r5 : fn -ffi_call_EABI: - addi sp, #-80, sp - sti fp, @(sp, #24) - addi sp, #24, fp - movsg lr, gr5 +ffi_call_EABI: + push $sp, $r6 + push $sp, $r7 + push $sp, $r8 + dec $sp, 24 - /* Make room for the new arguments. */ - /* subi sp, fp, gr10 */ - - /* Store return address and incoming args on stack. */ - sti gr5, @(fp, #8) - sti gr8, @(fp, #-4) - sti gr9, @(fp, #-8) - sti gr10, @(fp, #-12) - sti gr11, @(fp, #-16) - sti gr12, @(fp, #-20) - sti gr13, @(fp, #-24) - - sub sp, gr10, sp + /* Store incoming args on stack. */ + sto.l 0($sp), $r0 /* ffi_prep_args */ + sto.l 4($sp), $r1 /* ecif */ + sto.l 8($sp), $r2 /* bytes */ + sto.l 12($sp), $r3 /* flags */ + sto.l 16($sp), $r4 /* &rvalue */ + sto.l 20($sp), $r5 /* fn */ /* Call ffi_prep_args. */ - ldi @(fp, #-4), gr4 - addi sp, #0, gr8 - ldi @(fp, #-8), gr9 -#ifdef __FRV_FDPIC__ - ldd @(gr4, gr0), gr14 - calll @(gr14, gr0) -#else - calll @(gr4, gr0) -#endif + mov $r6, $r4 /* Save result buffer */ + mov $r7, $r5 /* Save the target fn */ + mov $r8, $r3 /* Save the flags */ + sub.l $sp, $r2 /* Allocate stack space */ + mov $r0, $sp /* We can stomp over $r0 */ + /* $r1 is already set up */ + jsra ffi_prep_args - /* ffi_prep_args returns the new stack pointer. */ - mov gr8, gr4 - - ldi @(sp, #0), gr8 - ldi @(sp, #4), gr9 - ldi @(sp, #8), gr10 - ldi @(sp, #12), gr11 - ldi @(sp, #16), gr12 - ldi @(sp, #20), gr13 - - /* Always copy the return value pointer into the hidden - parameter register. This is only strictly necessary - when we're returning an aggregate type, but it doesn't - hurt to do this all the time, and it saves a branch. */ - ldi @(fp, #-20), gr3 - - /* Use the ffi_prep_args return value for the new sp. */ - mov gr4, sp + /* Load register arguments. */ + ldo.l $r0, 0($sp) + ldo.l $r1, 4($sp) + ldo.l $r2, 8($sp) + ldo.l $r3, 12($sp) + ldo.l $r4, 16($sp) + ldo.l $r5, 20($sp) /* Call the target function. */ - ldi @(fp, -24), gr4 -#ifdef __FRV_FDPIC__ - ldd @(gr4, gr0), gr14 - calll @(gr14, gr0) -#else - calll @(gr4, gr0) -#endif + jsr $r7 - /* Store the result. */ - ldi @(fp, #-16), gr10 /* fig->flags */ - ldi @(fp, #-20), gr4 /* ecif.rvalue */ + ldi.l $r7, 0xffffffff + cmp $r8, $r7 + beq retstruct - /* Is the return value stored in two registers? */ - cmpi gr10, #8, icc0 - bne icc0, 0, .L2 - /* Yes, save them. */ - sti gr8, @(gr4, #0) - sti gr9, @(gr4, #4) - bra .L3 -.L2: - /* Is the return value a structure? */ - cmpi gr10, #-1, icc0 - beq icc0, 0, .L3 - /* No, save a 4 byte return value. */ - sti gr8, @(gr4, #0) -.L3: + ldi.l $r7, 4 + cmp $r8, $r7 + bgt ret2reg - /* Restore the stack, and return. */ - ldi @(fp, 8), gr5 - ld @(fp, gr0), fp - addi sp,#80,sp - jmpl @(gr5,gr0) + st.l ($r6), $r0 + jmpa retdone + +ret2reg: + st.l ($r6), $r0 + sto.l 4($r6), $r1 + +retstruct: +retdone: + /* Return. */ + ldo.l $r6, -4($fp) + ldo.l $r7, -8($fp) + ldo.l $r8, -12($fp) + ret .size ffi_call_EABI, .-ffi_call_EABI diff --git a/Modules/_ctypes/libffi/src/moxie/ffi.c b/Modules/_ctypes/libffi/src/moxie/ffi.c --- a/Modules/_ctypes/libffi/src/moxie/ffi.c +++ b/Modules/_ctypes/libffi/src/moxie/ffi.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (C) 2009 Anthony Green + ffi.c - Copyright (C) 2012, 2013 Anthony Green Moxie Foreign Function Interface @@ -43,6 +43,12 @@ p_argv = ecif->avalue; argp = stack; + if (ecif->cif->rtype->type == FFI_TYPE_STRUCT) + { + *(void **) argp = ecif->rvalue; + argp += 4; + } + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++) @@ -56,17 +62,6 @@ z = sizeof(void*); *(void **) argp = *p_argv; } - /* if ((*p_arg)->type == FFI_TYPE_FLOAT) - { - if (count > 24) - { - // This is going on the stack. Turn it into a double. - *(double *) argp = (double) *(float*)(* p_argv); - z = sizeof(double); - } - else - *(void **) argp = *(void **)(* p_argv); - } */ else if (z < sizeof(int)) { z = sizeof(int); @@ -147,8 +142,7 @@ } else ecif.rvalue = rvalue; - - + switch (cif->abi) { case FFI_EABI: @@ -165,19 +159,25 @@ unsigned arg4, unsigned arg5, unsigned arg6) { /* This function is called by a trampoline. The trampoline stows a - pointer to the ffi_closure object in gr7. We must save this + pointer to the ffi_closure object in $r7. We must save this pointer in a place that will persist while we do our work. */ - register ffi_closure *creg __asm__ ("gr7"); + register ffi_closure *creg __asm__ ("$r12"); ffi_closure *closure = creg; /* Arguments that don't fit in registers are found on the stack at a fixed offset above the current frame pointer. */ - register char *frame_pointer __asm__ ("fp"); - char *stack_args = frame_pointer + 16; + register char *frame_pointer __asm__ ("$fp"); + + /* Pointer to a struct return value. */ + void *struct_rvalue = (void *) arg1; + + /* 6 words reserved for register args + 3 words from jsr */ + char *stack_args = frame_pointer + 9*4; /* Lay the register arguments down in a continuous chunk of memory. */ unsigned register_args[6] = { arg1, arg2, arg3, arg4, arg5, arg6 }; + char *register_args_ptr = (char *) register_args; ffi_cif *cif = closure->cif; ffi_type **arg_types = cif->arg_types; @@ -185,6 +185,12 @@ char *ptr = (char *) register_args; int i; + /* preserve struct type return pointer passing */ + if ((cif->rtype != NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { + ptr += 4; + register_args_ptr = (char *)®ister_args[1]; + } + /* Find the address of each argument. */ for (i = 0; i < cif->nargs; i++) { @@ -201,6 +207,7 @@ case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_FLOAT: + case FFI_TYPE_POINTER: avalue[i] = ptr; break; case FFI_TYPE_STRUCT: @@ -216,30 +223,21 @@ /* If we've handled more arguments than fit in registers, start looking at the those passed on the stack. */ - if (ptr == ((char *)register_args + (6*4))) + if (ptr == ®ister_args[6]) ptr = stack_args; } /* Invoke the closure. */ - if (cif->rtype->type == FFI_TYPE_STRUCT) + if (cif->rtype && (cif->rtype->type == FFI_TYPE_STRUCT)) { - /* The caller allocates space for the return structure, and - passes a pointer to this space in gr3. Use this value directly - as the return value. */ - register void *return_struct_ptr __asm__("gr3"); - (closure->fun) (cif, return_struct_ptr, avalue, closure->user_data); + (closure->fun) (cif, struct_rvalue, avalue, closure->user_data); } else { /* Allocate space for the return value and call the function. */ long long rvalue; (closure->fun) (cif, &rvalue, avalue, closure->user_data); - - /* Functions return 4-byte or smaller results in gr8. 8-byte - values also use gr9. We fill the both, even for small return - values, just to avoid a branch. */ - asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue)); - asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1])); + asm ("mov $r12, %0\n ld.l $r0, ($r12)\n ldo.l $r1, 4($r12)" : : "r" (&rvalue)); } } @@ -250,27 +248,25 @@ void *user_data, void *codeloc) { - unsigned int *tramp = (unsigned int *) &closure->tramp[0]; + unsigned short *tramp = (unsigned short *) &closure->tramp[0]; unsigned long fn = (long) ffi_closure_eabi; unsigned long cls = (long) codeloc; - int i; + + if (cif->abi != FFI_EABI) + return FFI_BAD_ABI; fn = (unsigned long) ffi_closure_eabi; - tramp[0] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ - tramp[1] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ - tramp[2] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ - tramp[3] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ - tramp[4] = 0x80300006; /* jmpl @(gr0, gr6) */ + tramp[0] = 0x01e0; /* ldi.l $r7, .... */ + tramp[1] = cls >> 16; + tramp[2] = cls & 0xffff; + tramp[3] = 0x1a00; /* jmpa .... */ + tramp[4] = fn >> 16; + tramp[5] = fn & 0xffff; closure->cif = cif; closure->fun = fun; closure->user_data = user_data; - /* Cache flushing. */ - for (i = 0; i < FFI_TRAMPOLINE_SIZE; i++) - __asm__ volatile ("dcf @(%0,%1)\n\tici @(%2,%1)" :: "r" (tramp), "r" (i), - "r" (codeloc)); - return FFI_OK; } diff --git a/Modules/_ctypes/libffi/src/moxie/ffitarget.h b/Modules/_ctypes/libffi/src/moxie/ffitarget.h --- a/Modules/_ctypes/libffi/src/moxie/ffitarget.h +++ b/Modules/_ctypes/libffi/src/moxie/ffitarget.h @@ -1,5 +1,5 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2009 Anthony Green + ffitarget.h - Copyright (c) 2012, 2013 Anthony Green Target configuration macros for Moxie Permission is hereby granted, free of charge, to any person obtaining @@ -35,22 +35,18 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, - -#ifdef MOXIE FFI_EABI, FFI_DEFAULT_ABI = FFI_EABI, -#endif - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ -#define FFI_CLOSURES 0 +#define FFI_CLOSURES 1 #define FFI_NATIVE_RAW_API 0 -/* Trampolines are 5 4-byte instructions long. */ -#define FFI_TRAMPOLINE_SIZE (5*4) +/* Trampolines are 12-bytes long. See ffi_prep_closure_loc. */ +#define FFI_TRAMPOLINE_SIZE (12) #endif diff --git a/Modules/_ctypes/libffi/src/pa/ffi.c b/Modules/_ctypes/libffi/src/pa/ffi.c --- a/Modules/_ctypes/libffi/src/pa/ffi.c +++ b/Modules/_ctypes/libffi/src/pa/ffi.c @@ -1,9 +1,11 @@ /* ----------------------------------------------------------------------- - ffi.c - (c) 2003-2004 Randolph Chung + ffi.c - (c) 2011 Anthony Green (c) 2008 Red Hat, Inc. - + (c) 2006 Free Software Foundation, Inc. + (c) 2003-2004 Randolph Chung + HPPA Foreign Function Interface - HP-UX PA ABI support (c) 2006 Free Software Foundation, Inc. + HP-UX PA ABI support Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -633,7 +635,8 @@ UINT32 *tmp; #endif - FFI_ASSERT (cif->abi == FFI_PA32); + if (cif->abi != FFI_PA32) + return FFI_BAD_ABI; /* Make a small trampoline that will branch to our handler function. Use PC-relative addressing. */ diff --git a/Modules/_ctypes/libffi/src/pa/ffitarget.h b/Modules/_ctypes/libffi/src/pa/ffitarget.h --- a/Modules/_ctypes/libffi/src/pa/ffitarget.h +++ b/Modules/_ctypes/libffi/src/pa/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for hppa. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- System specific configurations ----------------------------------- */ #ifndef LIBFFI_ASM @@ -38,21 +43,22 @@ #ifdef PA_LINUX FFI_PA32, - FFI_DEFAULT_ABI = FFI_PA32, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_PA32 #endif #ifdef PA_HPUX FFI_PA32, - FFI_DEFAULT_ABI = FFI_PA32, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_PA32 #endif #ifdef PA64_HPUX #error "PA64_HPUX FFI is not yet implemented" FFI_PA64, - FFI_DEFAULT_ABI = FFI_PA64, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_PA64 #endif - - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/powerpc/aix.S b/Modules/_ctypes/libffi/src/powerpc/aix.S --- a/Modules/_ctypes/libffi/src/powerpc/aix.S +++ b/Modules/_ctypes/libffi/src/powerpc/aix.S @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - aix.S - Copyright (c) 2002,2009 Free Software Foundation, Inc. + aix.S - Copyright (c) 2002, 2009 Free Software Foundation, Inc. based on darwin.S by John Hornkvist PowerPC Assembly glue. @@ -79,6 +79,8 @@ .set f20,20 .set f21,21 + .extern .ffi_prep_args + #define LIBFFI_ASM #include #include @@ -125,6 +127,7 @@ /* Call ffi_prep_args. */ mr r4, r1 bl .ffi_prep_args + nop /* Now do the call. */ ld r0, 0(r29) @@ -134,7 +137,7 @@ mtcrf 0x40, r31 mtctr r0 /* Load all those argument registers. */ - // We have set up a nice stack frame, just load it into registers. + /* We have set up a nice stack frame, just load it into registers. */ ld r3, 40+(1*8)(r1) ld r4, 40+(2*8)(r1) ld r5, 40+(3*8)(r1) @@ -147,7 +150,7 @@ L1: /* Load all the FP registers. */ - bf 6,L2 // 2f + 0x18 + bf 6,L2 /* 2f + 0x18 */ lfd f1,-32-(13*8)(r28) lfd f2,-32-(12*8)(r28) lfd f3,-32-(11*8)(r28) @@ -226,6 +229,7 @@ /* Call ffi_prep_args. */ mr r4, r1 bl .ffi_prep_args + nop /* Now do the call. */ lwz r0, 0(r29) @@ -235,7 +239,7 @@ mtcrf 0x40, r31 mtctr r0 /* Load all those argument registers. */ - // We have set up a nice stack frame, just load it into registers. + /* We have set up a nice stack frame, just load it into registers. */ lwz r3, 20+(1*4)(r1) lwz r4, 20+(2*4)(r1) lwz r5, 20+(3*4)(r1) @@ -248,7 +252,7 @@ L1: /* Load all the FP registers. */ - bf 6,L2 // 2f + 0x18 + bf 6,L2 /* 2f + 0x18 */ lfd f1,-16-(13*8)(r28) lfd f2,-16-(12*8)(r28) lfd f3,-16-(11*8)(r28) @@ -303,7 +307,7 @@ #endif .long 0 .byte 0,0,0,1,128,4,0,0 -//END(ffi_call_AIX) +/* END(ffi_call_AIX) */ .csect .text[PR] .align 2 @@ -321,4 +325,4 @@ blr .long 0 .byte 0,0,0,0,0,0,0,0 -//END(ffi_call_DARWIN) +/* END(ffi_call_DARWIN) */ diff --git a/Modules/_ctypes/libffi/src/powerpc/aix_closure.S b/Modules/_ctypes/libffi/src/powerpc/aix_closure.S --- a/Modules/_ctypes/libffi/src/powerpc/aix_closure.S +++ b/Modules/_ctypes/libffi/src/powerpc/aix_closure.S @@ -79,6 +79,8 @@ .set f20,20 .set f21,21 + .extern .ffi_closure_helper_DARWIN + #define LIBFFI_ASM #define JUMPTARGET(name) name #define L(x) x @@ -165,6 +167,7 @@ /* look up the proper starting point in table */ /* by using return type as offset */ + lhz r3, 10(r3) /* load type from return type */ ld r4, LC..60(2) /* get address of jump table */ sldi r3, r3, 4 /* now multiply return type by 16 */ ld r0, 240+16(r1) /* load return address */ @@ -337,8 +340,9 @@ /* look up the proper starting point in table */ /* by using return type as offset */ + lhz r3, 6(r3) /* load type from return type */ lwz r4, LC..60(2) /* get address of jump table */ - slwi r3, r3, 4 /* now multiply return type by 4 */ + slwi r3, r3, 4 /* now multiply return type by 16 */ lwz r0, 176+8(r1) /* load return address */ add r3, r3, r4 /* add contents of table to table address */ mtctr r3 diff --git a/Modules/_ctypes/libffi/src/powerpc/asm.h b/Modules/_ctypes/libffi/src/powerpc/asm.h --- a/Modules/_ctypes/libffi/src/powerpc/asm.h +++ b/Modules/_ctypes/libffi/src/powerpc/asm.h @@ -42,7 +42,7 @@ /* If compiled for profiling, call `_mcount' at the start of each function. */ #ifdef PROF -/* The mcount code relies on a the return address being on the stack +/* The mcount code relies on the return address being on the stack to locate our caller and so it can restore it; so store one just for its benefit. */ #ifdef PIC diff --git a/Modules/_ctypes/libffi/src/powerpc/darwin.S b/Modules/_ctypes/libffi/src/powerpc/darwin.S --- a/Modules/_ctypes/libffi/src/powerpc/darwin.S +++ b/Modules/_ctypes/libffi/src/powerpc/darwin.S @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- darwin.S - Copyright (c) 2000 John Hornkvist - Copyright (c) 2004 Free Software Foundation, Inc. + Copyright (c) 2004, 2010 Free Software Foundation, Inc. PowerPC Assembly glue. @@ -24,51 +24,92 @@ OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ +#define LIBFFI_ASM #if defined(__ppc64__) #define MODE_CHOICE(x, y) y #else #define MODE_CHOICE(x, y) x #endif -#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ +#define machine_choice MODE_CHOICE(ppc7400,ppc64) -#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ +; Define some pseudo-opcodes for size-independent load & store of GPRs ... +#define lgu MODE_CHOICE(lwzu, ldu) +#define lg MODE_CHOICE(lwz,ld) +#define sg MODE_CHOICE(stw,std) +#define sgu MODE_CHOICE(stwu,stdu) +#define sgux MODE_CHOICE(stwux,stdux) -#define LIBFFI_ASM +; ... and the size of GPRs and their storage indicator. +#define GPR_BYTES MODE_CHOICE(4,8) +#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ +#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ + +; From the ABI doc: "Mac OS X ABI Function Call Guide" Version 2009-02-04. +#define LINKAGE_SIZE MODE_CHOICE(24,48) +#define PARAM_AREA MODE_CHOICE(32,64) +#define SAVED_LR_OFFSET MODE_CHOICE(8,16) /* save position for lr */ + +/* If there is any FP stuff we make space for all of the regs. */ +#define SAVED_FPR_COUNT 13 +#define FPR_SIZE 8 +#define RESULT_BYTES 16 + +/* This should be kept in step with the same value in ffi_darwin.c. */ +#define ASM_NEEDS_REGISTERS 4 +#define SAVE_REGS_SIZE (ASM_NEEDS_REGISTERS * GPR_BYTES) + #include #include + #define JUMPTARGET(name) name #define L(x) x -.text + + .text .align 2 -.globl _ffi_prep_args + .globl _ffi_prep_args -.text .align 2 -.globl _ffi_call_DARWIN -.text - .align 2 + .globl _ffi_call_DARWIN + + /* We arrive here with: + r3 = ptr to extended cif. + r4 = -bytes. + r5 = cif flags. + r6 = ptr to return value. + r7 = fn pointer (user func). + r8 = fn pointer (ffi_prep_args). + r9 = ffi_type* for the ret val. */ + _ffi_call_DARWIN: -LFB0: +Lstartcode: mr r12,r8 /* We only need r12 until the call, - so it doesn't have to be saved. */ + so it does not have to be saved. */ LFB1: /* Save the old stack pointer as AP. */ mr r8,r1 LCFI0: + + /* Save the retval type in parents frame. */ + sg r9,(LINKAGE_SIZE+6*GPR_BYTES)(r8) + /* Allocate the stack space we need. */ - stwux r1,r1,r4 + sgux r1,r1,r4 /* Save registers we use. */ mflr r9 + sg r9,SAVED_LR_OFFSET(r8) - stw r28,-16(r8) - stw r29,-12(r8) - stw r30,-8(r8) - stw r31,-4(r8) + sg r28,-(4 * GPR_BYTES)(r8) + sg r29,-(3 * GPR_BYTES)(r8) + sg r30,-(2 * GPR_BYTES)(r8) + sg r31,-( GPR_BYTES)(r8) - stw r9,8(r8) - stw r2,20(r1) +#if !defined(POWERPC_DARWIN) + /* The TOC slot is reserved in the Darwin ABI and r2 is volatile. */ + sg r2,(5 * GPR_BYTES)(r1) +#endif + LCFI1: /* Save arguments over call. */ @@ -77,14 +118,17 @@ mr r29,r7 /* function address, */ mr r28,r8 /* our AP. */ LCFI2: - /* Call ffi_prep_args. */ + /* Call ffi_prep_args. r3 = extended cif, r4 = stack ptr copy. */ mr r4,r1 li r9,0 mtctr r12 /* r12 holds address of _ffi_prep_args. */ bctrl - lwz r2,20(r1) +#if !defined(POWERPC_DARWIN) + /* The TOC slot is reserved in the Darwin ABI and r2 is volatile. */ + lg r2,(5 * GPR_BYTES)(r1) +#endif /* Now do the call. Set up cr1 with bits 4-7 of the flags. */ mtcrf 0x40,r31 @@ -92,71 +136,130 @@ mtctr r29 /* Load all those argument registers. We have set up a nice stack frame, just load it into registers. */ - lwz r3,20+(1*4)(r1) - lwz r4,20+(2*4)(r1) - lwz r5,20+(3*4)(r1) - lwz r6,20+(4*4)(r1) + lg r3, (LINKAGE_SIZE )(r1) + lg r4, (LINKAGE_SIZE + GPR_BYTES)(r1) + lg r5, (LINKAGE_SIZE + 2 * GPR_BYTES)(r1) + lg r6, (LINKAGE_SIZE + 3 * GPR_BYTES)(r1) nop - lwz r7,20+(5*4)(r1) - lwz r8,20+(6*4)(r1) - lwz r9,20+(7*4)(r1) - lwz r10,20+(8*4)(r1) + lg r7, (LINKAGE_SIZE + 4 * GPR_BYTES)(r1) + lg r8, (LINKAGE_SIZE + 5 * GPR_BYTES)(r1) + lg r9, (LINKAGE_SIZE + 6 * GPR_BYTES)(r1) + lg r10,(LINKAGE_SIZE + 7 * GPR_BYTES)(r1) L1: - /* Load all the FP registers. */ + /* ... Load all the FP registers. */ bf 6,L2 /* No floats to load. */ - lfd f1,-16-(13*8)(r28) - lfd f2,-16-(12*8)(r28) - lfd f3,-16-(11*8)(r28) - lfd f4,-16-(10*8)(r28) + lfd f1, -SAVE_REGS_SIZE-(13*FPR_SIZE)(r28) + lfd f2, -SAVE_REGS_SIZE-(12*FPR_SIZE)(r28) + lfd f3, -SAVE_REGS_SIZE-(11*FPR_SIZE)(r28) + lfd f4, -SAVE_REGS_SIZE-(10*FPR_SIZE)(r28) nop - lfd f5,-16-(9*8)(r28) - lfd f6,-16-(8*8)(r28) - lfd f7,-16-(7*8)(r28) - lfd f8,-16-(6*8)(r28) + lfd f5, -SAVE_REGS_SIZE-( 9*FPR_SIZE)(r28) + lfd f6, -SAVE_REGS_SIZE-( 8*FPR_SIZE)(r28) + lfd f7, -SAVE_REGS_SIZE-( 7*FPR_SIZE)(r28) + lfd f8, -SAVE_REGS_SIZE-( 6*FPR_SIZE)(r28) nop - lfd f9,-16-(5*8)(r28) - lfd f10,-16-(4*8)(r28) - lfd f11,-16-(3*8)(r28) - lfd f12,-16-(2*8)(r28) + lfd f9, -SAVE_REGS_SIZE-( 5*FPR_SIZE)(r28) + lfd f10,-SAVE_REGS_SIZE-( 4*FPR_SIZE)(r28) + lfd f11,-SAVE_REGS_SIZE-( 3*FPR_SIZE)(r28) + lfd f12,-SAVE_REGS_SIZE-( 2*FPR_SIZE)(r28) nop - lfd f13,-16-(1*8)(r28) + lfd f13,-SAVE_REGS_SIZE-( 1*FPR_SIZE)(r28) L2: mr r12,r29 /* Put the target address in r12 as specified. */ mtctr r12 nop nop + /* Make the call. */ bctrl /* Now, deal with the return value. */ - mtcrf 0x01,r31 - bt 30,L(done_return_value) - bt 29,L(fp_return_value) - stw r3,0(r30) - bf 28,L(done_return_value) - stw r4,4(r30) + /* m64 structure returns can occupy the same set of registers as + would be used to pass such a structure as arg0 - so take care + not to step on any possibly hot regs. */ - /* Fall through. */ + /* Get the flags.. */ + mtcrf 0x03,r31 ; we need c6 & cr7 now. + ; FLAG_RETURNS_NOTHING also covers struct ret-by-ref. + bt 30,L(done_return_value) ; FLAG_RETURNS_NOTHING + bf 27,L(scalar_return_value) ; not FLAG_RETURNS_STRUCT + + /* OK, so we have a struct. */ +#if defined(__ppc64__) + bt 31,L(maybe_return_128) ; FLAG_RETURNS_128BITS, special case -L(done_return_value): - /* Restore the registers we used and return. */ - lwz r9,8(r28) - lwz r31,-4(r28) - mtlr r9 - lwz r30,-8(r28) - lwz r29,-12(r28) - lwz r28,-16(r28) - lwz r1,0(r1) - blr + /* OK, we have to map the return back to a mem struct. + We are about to trample the parents param area, so recover the + return type. r29 is free, since the call is done. */ + lg r29,(LINKAGE_SIZE + 6 * GPR_BYTES)(r28) + + sg r3, (LINKAGE_SIZE )(r28) + sg r4, (LINKAGE_SIZE + GPR_BYTES)(r28) + sg r5, (LINKAGE_SIZE + 2 * GPR_BYTES)(r28) + sg r6, (LINKAGE_SIZE + 3 * GPR_BYTES)(r28) + nop + sg r7, (LINKAGE_SIZE + 4 * GPR_BYTES)(r28) + sg r8, (LINKAGE_SIZE + 5 * GPR_BYTES)(r28) + sg r9, (LINKAGE_SIZE + 6 * GPR_BYTES)(r28) + sg r10,(LINKAGE_SIZE + 7 * GPR_BYTES)(r28) + /* OK, so do the block move - we trust that memcpy will not trample + the fprs... */ + mr r3,r30 ; dest + addi r4,r28,LINKAGE_SIZE ; source + /* The size is a size_t, should be long. */ + lg r5,0(r29) + /* Figure out small structs */ + cmpi 0,r5,4 + bgt L3 ; 1, 2 and 4 bytes have special rules. + cmpi 0,r5,3 + beq L3 ; not 3 + addi r4,r4,8 + subf r4,r5,r4 +L3: + bl _memcpy + + /* ... do we need the FP registers? - recover the flags.. */ + mtcrf 0x03,r31 ; we need c6 & cr7 now. + bf 29,L(done_return_value) /* No floats in the struct. */ + stfd f1, -SAVE_REGS_SIZE-(13*FPR_SIZE)(r28) + stfd f2, -SAVE_REGS_SIZE-(12*FPR_SIZE)(r28) + stfd f3, -SAVE_REGS_SIZE-(11*FPR_SIZE)(r28) + stfd f4, -SAVE_REGS_SIZE-(10*FPR_SIZE)(r28) + nop + stfd f5, -SAVE_REGS_SIZE-( 9*FPR_SIZE)(r28) + stfd f6, -SAVE_REGS_SIZE-( 8*FPR_SIZE)(r28) + stfd f7, -SAVE_REGS_SIZE-( 7*FPR_SIZE)(r28) + stfd f8, -SAVE_REGS_SIZE-( 6*FPR_SIZE)(r28) + nop + stfd f9, -SAVE_REGS_SIZE-( 5*FPR_SIZE)(r28) + stfd f10,-SAVE_REGS_SIZE-( 4*FPR_SIZE)(r28) + stfd f11,-SAVE_REGS_SIZE-( 3*FPR_SIZE)(r28) + stfd f12,-SAVE_REGS_SIZE-( 2*FPR_SIZE)(r28) + nop + stfd f13,-SAVE_REGS_SIZE-( 1*FPR_SIZE)(r28) + + mr r3,r29 ; ffi_type * + mr r4,r30 ; dest + addi r5,r28,-SAVE_REGS_SIZE-(13*FPR_SIZE) ; fprs + xor r6,r6,r6 + sg r6,(LINKAGE_SIZE + 7 * GPR_BYTES)(r28) + addi r6,r28,(LINKAGE_SIZE + 7 * GPR_BYTES) ; point to a zeroed counter. + bl _darwin64_struct_floats_to_mem + + b L(done_return_value) +#else + stw r3,0(r30) ; m32 the only struct return in reg is 4 bytes. +#endif + b L(done_return_value) L(fp_return_value): /* Do we have long double to store? */ - bf 31,L(fd_return_value) + bf 31,L(fd_return_value) ; FLAG_RETURNS_128BITS stfd f1,0(r30) - stfd f2,8(r30) + stfd f2,FPR_SIZE(r30) b L(done_return_value) L(fd_return_value): @@ -170,21 +273,57 @@ stfs f1,0(r30) b L(done_return_value) +L(scalar_return_value): + bt 29,L(fp_return_value) ; FLAG_RETURNS_FP + ; ffi_arg is defined as unsigned long. + sg r3,0(r30) ; Save the reg. + bf 28,L(done_return_value) ; not FLAG_RETURNS_64BITS + +#if defined(__ppc64__) +L(maybe_return_128): + std r3,0(r30) + bf 31,L(done_return_value) ; not FLAG_RETURNS_128BITS + std r4,8(r30) +#else + stw r4,4(r30) +#endif + + /* Fall through. */ + /* We want this at the end to simplify eh epilog computation. */ + +L(done_return_value): + /* Restore the registers we used and return. */ + lg r29,SAVED_LR_OFFSET(r28) + ; epilog + lg r31,-(1 * GPR_BYTES)(r28) + mtlr r29 + lg r30,-(2 * GPR_BYTES)(r28) + lg r29,-(3 * GPR_BYTES)(r28) + lg r28,-(4 * GPR_BYTES)(r28) + lg r1,0(r1) + blr LFE1: + .align 1 /* END(_ffi_call_DARWIN) */ /* Provide a null definition of _ffi_call_AIX. */ -.text - .align 2 -.globl _ffi_call_AIX -.text + .text + .globl _ffi_call_AIX .align 2 _ffi_call_AIX: blr /* END(_ffi_call_AIX) */ -.data -.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms +/* EH stuff. */ + +#define EH_DATA_ALIGN_FACT MODE_CHOICE(0x7c,0x78) + + .static_data + .align LOG2_GPR_BYTES +LLFB0$non_lazy_ptr: + .g_long Lstartcode + + .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support EH_frame1: .set L$set$0,LECIE1-LSCIE1 .long L$set$0 ; Length of Common Information Entry @@ -193,16 +332,17 @@ .byte 0x1 ; CIE Version .ascii "zR\0" ; CIE Augmentation .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor - .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor + .byte EH_DATA_ALIGN_FACT ; sleb128 -4; CIE Data Alignment Factor .byte 0x41 ; CIE RA Column .byte 0x1 ; uleb128 0x1; Augmentation size - .byte 0x90 ; FDE Encoding (indirect pcrel) + .byte 0x10 ; FDE Encoding (indirect pcrel) .byte 0xc ; DW_CFA_def_cfa .byte 0x1 ; uleb128 0x1 .byte 0x0 ; uleb128 0x0 .align LOG2_GPR_BYTES LECIE1: -.globl _ffi_call_DARWIN.eh + + .globl _ffi_call_DARWIN.eh _ffi_call_DARWIN.eh: LSFDE1: .set L$set$1,LEFDE1-LASFDE1 @@ -210,11 +350,11 @@ LASFDE1: .long LASFDE1-EH_frame1 ; FDE CIE offset .g_long LLFB0$non_lazy_ptr-. ; FDE initial location - .set L$set$3,LFE1-LFB0 + .set L$set$3,LFE1-Lstartcode .g_long L$set$3 ; FDE address range .byte 0x0 ; uleb128 0x0; Augmentation size .byte 0x4 ; DW_CFA_advance_loc4 - .set L$set$4,LCFI0-LFB1 + .set L$set$4,LCFI0-Lstartcode .long L$set$4 .byte 0xd ; DW_CFA_def_cfa_register .byte 0x08 ; uleb128 0x08 @@ -239,7 +379,5 @@ .byte 0x1c ; uleb128 0x1c .align LOG2_GPR_BYTES LEFDE1: -.data - .align LOG2_GPR_BYTES -LLFB0$non_lazy_ptr: - .g_long LFB0 + .align 1 + diff --git a/Modules/_ctypes/libffi/src/powerpc/darwin_closure.S b/Modules/_ctypes/libffi/src/powerpc/darwin_closure.S --- a/Modules/_ctypes/libffi/src/powerpc/darwin_closure.S +++ b/Modules/_ctypes/libffi/src/powerpc/darwin_closure.S @@ -1,6 +1,7 @@ /* ----------------------------------------------------------------------- - darwin_closure.S - Copyright (c) 2002, 2003, 2004, Free Software Foundation, - Inc. based on ppc_closure.S + darwin_closure.S - Copyright (c) 2002, 2003, 2004, 2010, + Free Software Foundation, Inc. + based on ppc_closure.S PowerPC Assembly glue. @@ -33,91 +34,177 @@ #define MODE_CHOICE(x, y) x #endif -#define lgu MODE_CHOICE(lwzu, ldu) +#define machine_choice MODE_CHOICE(ppc7400,ppc64) -#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ +; Define some pseudo-opcodes for size-independent load & store of GPRs ... +#define lgu MODE_CHOICE(lwzu, ldu) +#define lg MODE_CHOICE(lwz,ld) +#define sg MODE_CHOICE(stw,std) +#define sgu MODE_CHOICE(stwu,stdu) -#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ +; ... and the size of GPRs and their storage indicator. +#define GPR_BYTES MODE_CHOICE(4,8) +#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ +#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ + +; From the ABI doc: "Mac OS X ABI Function Call Guide" Version 2009-02-04. +#define LINKAGE_SIZE MODE_CHOICE(24,48) +#define PARAM_AREA MODE_CHOICE(32,64) + +#define SAVED_CR_OFFSET MODE_CHOICE(4,8) /* save position for CR */ +#define SAVED_LR_OFFSET MODE_CHOICE(8,16) /* save position for lr */ + +/* WARNING: if ffi_type is changed... here be monsters. + Offsets of items within the result type. */ +#define FFI_TYPE_TYPE MODE_CHOICE(6,10) +#define FFI_TYPE_ELEM MODE_CHOICE(8,16) + +#define SAVED_FPR_COUNT 13 +#define FPR_SIZE 8 +/* biggest m64 struct ret is 8GPRS + 13FPRS = 168 bytes - rounded to 16bytes = 176. */ +#define RESULT_BYTES MODE_CHOICE(16,176) + +; The whole stack frame **MUST** be 16byte-aligned. +#define SAVE_SIZE (((LINKAGE_SIZE+PARAM_AREA+SAVED_FPR_COUNT*FPR_SIZE+RESULT_BYTES)+15) & -16LL) +#define PAD_SIZE (SAVE_SIZE-(LINKAGE_SIZE+PARAM_AREA+SAVED_FPR_COUNT*FPR_SIZE+RESULT_BYTES)) + +#define PARENT_PARM_BASE (SAVE_SIZE+LINKAGE_SIZE) +#define FP_SAVE_BASE (LINKAGE_SIZE+PARAM_AREA) + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 +; We no longer need the pic symbol stub for Darwin >= 9. +#define BLCLS_HELP _ffi_closure_helper_DARWIN +#define STRUCT_RETVALUE_P _darwin64_struct_ret_by_value_p +#define PASS_STR_FLOATS _darwin64_pass_struct_floats +#undef WANT_STUB +#else +#define BLCLS_HELP L_ffi_closure_helper_DARWIN$stub +#define STRUCT_RETVALUE_P L_darwin64_struct_ret_by_value_p$stub +#define PASS_STR_FLOATS L_darwin64_pass_struct_floats$stub +#define WANT_STUB +#endif + +/* m32/m64 + + The stack layout looks like this: + + | Additional params... | | Higher address + ~ ~ ~ + | Parameters (at least 8*4/8=32/64) | | NUM_GPR_ARG_REGISTERS + |--------------------------------------------| | + | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | + |--------------------------------------------| | + | Reserved 2*4/8 | | + |--------------------------------------------| | + | Space for callee`s LR 4/8 | | + |--------------------------------------------| | + | Saved CR [low word for m64] 4/8 | | + |--------------------------------------------| | + | Current backchain pointer 4/8 |-/ Parent`s frame. + |--------------------------------------------| <+ <<< on entry to + | Result Bytes 16/176 | | + |--------------------------------------------| | + ~ padding to 16-byte alignment ~ ~ + |--------------------------------------------| | + | NUM_FPR_ARG_REGISTERS slots | | + | here fp13 .. fp1 13*8 | | + |--------------------------------------------| | + | R3..R10 8*4/8=32/64 | | NUM_GPR_ARG_REGISTERS + |--------------------------------------------| | + | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | + |--------------------------------------------| | stack | + | Reserved [compiler,binder] 2*4/8 | | grows | + |--------------------------------------------| | down V + | Space for callees LR 4/8 | | + |--------------------------------------------| | lower addresses + | Saved CR [low word for m64] 4/8 | | + |--------------------------------------------| | stack pointer here + | Current backchain pointer 4/8 |-/ during + |--------------------------------------------| <<< call. + +*/ .file "darwin_closure.S" -.text - .align LOG2_GPR_BYTES -.globl _ffi_closure_ASM -.text + .machine machine_choice + + .text + .globl _ffi_closure_ASM .align LOG2_GPR_BYTES _ffi_closure_ASM: LFB1: - mflr r0 /* extract return address */ - stw r0,8(r1) /* save the return address */ +Lstartcode: + mflr r0 /* extract return address */ + sg r0,SAVED_LR_OFFSET(r1) /* save the return address */ LCFI0: - /* 24 Bytes (Linkage Area) - 32 Bytes (outgoing parameter area, always reserved) - 104 Bytes (13*8 from FPR) - 16 Bytes (result) - 176 Bytes */ - - stwu r1,-176(r1) /* skip over caller save area - keep stack aligned to 16. */ + sgu r1,-SAVE_SIZE(r1) /* skip over caller save area + keep stack aligned to 16. */ LCFI1: /* We want to build up an area for the parameters passed in registers. (both floating point and integer) */ - /* We store gpr 3 to gpr 10 (aligned to 4) - in the parents outgoing area. */ - stw r3,200(r1) - stw r4,204(r1) - stw r5,208(r1) - stw r6,212(r1) - stw r7,216(r1) - stw r8,220(r1) - stw r9,224(r1) - stw r10,228(r1) + /* Put gpr 3 to gpr 10 in the parents outgoing area... + ... the remainder of any params that overflowed the regs will + follow here. */ + sg r3, (PARENT_PARM_BASE )(r1) + sg r4, (PARENT_PARM_BASE + GPR_BYTES )(r1) + sg r5, (PARENT_PARM_BASE + GPR_BYTES * 2)(r1) + sg r6, (PARENT_PARM_BASE + GPR_BYTES * 3)(r1) + sg r7, (PARENT_PARM_BASE + GPR_BYTES * 4)(r1) + sg r8, (PARENT_PARM_BASE + GPR_BYTES * 5)(r1) + sg r9, (PARENT_PARM_BASE + GPR_BYTES * 6)(r1) + sg r10,(PARENT_PARM_BASE + GPR_BYTES * 7)(r1) - /* We save fpr 1 to fpr 13. (aligned to 8) */ - stfd f1,56(r1) - stfd f2,64(r1) - stfd f3,72(r1) - stfd f4,80(r1) - stfd f5,88(r1) - stfd f6,96(r1) - stfd f7,104(r1) - stfd f8,112(r1) - stfd f9,120(r1) - stfd f10,128(r1) - stfd f11,136(r1) - stfd f12,144(r1) - stfd f13,152(r1) + /* We save fpr 1 to fpr 14 in our own save frame. */ + stfd f1, (FP_SAVE_BASE )(r1) + stfd f2, (FP_SAVE_BASE + FPR_SIZE )(r1) + stfd f3, (FP_SAVE_BASE + FPR_SIZE * 2 )(r1) + stfd f4, (FP_SAVE_BASE + FPR_SIZE * 3 )(r1) + stfd f5, (FP_SAVE_BASE + FPR_SIZE * 4 )(r1) + stfd f6, (FP_SAVE_BASE + FPR_SIZE * 5 )(r1) + stfd f7, (FP_SAVE_BASE + FPR_SIZE * 6 )(r1) + stfd f8, (FP_SAVE_BASE + FPR_SIZE * 7 )(r1) + stfd f9, (FP_SAVE_BASE + FPR_SIZE * 8 )(r1) + stfd f10,(FP_SAVE_BASE + FPR_SIZE * 9 )(r1) + stfd f11,(FP_SAVE_BASE + FPR_SIZE * 10)(r1) + stfd f12,(FP_SAVE_BASE + FPR_SIZE * 11)(r1) + stfd f13,(FP_SAVE_BASE + FPR_SIZE * 12)(r1) /* Set up registers for the routine that actually does the work get the context pointer from the trampoline. */ - mr r3,r11 + mr r3,r11 /* Now load up the pointer to the result storage. */ - addi r4,r1,160 + addi r4,r1,(SAVE_SIZE-RESULT_BYTES) /* Now load up the pointer to the saved gpr registers. */ - addi r5,r1,200 + addi r5,r1,PARENT_PARM_BASE /* Now load up the pointer to the saved fpr registers. */ - addi r6,r1,56 + addi r6,r1,FP_SAVE_BASE /* Make the call. */ - bl Lffi_closure_helper_DARWIN$stub + bl BLCLS_HELP - /* Now r3 contains the return type - so use it to look up in a table + /* r3 contains the rtype pointer... save it since we will need + it later. */ + sg r3,LINKAGE_SIZE(r1) ; ffi_type * result_type + lg r0,0(r3) ; size => r0 + lhz r3,FFI_TYPE_TYPE(r3) ; type => r3 + + /* The helper will have intercepted struture returns and inserted + the caller`s destination address for structs returned by ref. */ + + /* r3 contains the return type so use it to look up in a table so we know how to deal with each type. */ - /* Look up the proper starting point in table - by using return type as offset. */ - addi r5,r1,160 /* Get pointer to results area. */ - bl Lget_ret_type0_addr /* Get pointer to Lret_type0 into LR. */ - mflr r4 /* Move to r4. */ - slwi r3,r3,4 /* Now multiply return type by 16. */ - add r3,r3,r4 /* Add contents of table to table address. */ - mtctr r3 - bctr /* Jump to it. */ + addi r5,r1,(SAVE_SIZE-RESULT_BYTES) /* Otherwise, our return is here. */ + bl Lget_ret_type0_addr /* Get pointer to Lret_type0 into LR. */ + mflr r4 /* Move to r4. */ + slwi r3,r3,4 /* Now multiply return type by 16. */ + add r3,r3,r4 /* Add contents of table to table address. */ + mtctr r3 + bctr /* Jump to it. */ LFE1: /* Each of the ret_typeX code fragments has to be exactly 16 bytes long (4 instructions). For cache effectiveness we align to a 16 byte boundary @@ -140,7 +227,7 @@ /* case FFI_TYPE_INT */ Lret_type1: - lwz r3,0(r5) + lg r3,0(r5) b Lfinish nop nop @@ -168,85 +255,224 @@ /* case FFI_TYPE_UINT8 */ Lret_type5: +#if defined(__ppc64__) + lbz r3,7(r5) +#else lbz r3,3(r5) +#endif b Lfinish nop nop /* case FFI_TYPE_SINT8 */ Lret_type6: +#if defined(__ppc64__) + lbz r3,7(r5) +#else lbz r3,3(r5) +#endif extsb r3,r3 b Lfinish nop /* case FFI_TYPE_UINT16 */ Lret_type7: +#if defined(__ppc64__) + lhz r3,6(r5) +#else lhz r3,2(r5) +#endif b Lfinish nop nop /* case FFI_TYPE_SINT16 */ Lret_type8: +#if defined(__ppc64__) + lha r3,6(r5) +#else lha r3,2(r5) +#endif b Lfinish nop nop /* case FFI_TYPE_UINT32 */ Lret_type9: +#if defined(__ppc64__) + lwz r3,4(r5) +#else lwz r3,0(r5) +#endif b Lfinish nop nop /* case FFI_TYPE_SINT32 */ Lret_type10: +#if defined(__ppc64__) + lwz r3,4(r5) +#else lwz r3,0(r5) +#endif b Lfinish nop nop /* case FFI_TYPE_UINT64 */ Lret_type11: +#if defined(__ppc64__) + lg r3,0(r5) + b Lfinish + nop +#else lwz r3,0(r5) lwz r4,4(r5) b Lfinish +#endif nop /* case FFI_TYPE_SINT64 */ Lret_type12: +#if defined(__ppc64__) + lg r3,0(r5) + b Lfinish + nop +#else lwz r3,0(r5) lwz r4,4(r5) b Lfinish +#endif nop /* case FFI_TYPE_STRUCT */ Lret_type13: +#if defined(__ppc64__) + lg r3,0(r5) ; we need at least this... + cmpi 0,r0,4 + bgt Lstructend ; not a special small case + b Lsmallstruct ; see if we need more. +#else + cmpi 0,r0,4 + bgt Lfinish ; not by value + lg r3,0(r5) + b Lfinish +#endif +/* case FFI_TYPE_POINTER */ +Lret_type14: + lg r3,0(r5) b Lfinish nop nop - nop -/* case FFI_TYPE_POINTER */ -Lret_type14: - lwz r3,0(r5) - b Lfinish - nop - nop +#if defined(__ppc64__) +Lsmallstruct: + beq Lfour ; continuation of Lret13. + cmpi 0,r0,3 + beq Lfinish ; don`t adjust this - can`t be any floats here... + srdi r3,r3,48 + cmpi 0,r0,2 + beq Lfinish ; .. or here .. + srdi r3,r3,8 + b Lfinish ; .. or here. + +Lfour: + lg r6,LINKAGE_SIZE(r1) ; get the result type + lg r6,FFI_TYPE_ELEM(r6) ; elements array pointer + lg r6,0(r6) ; first element + lhz r0,FFI_TYPE_TYPE(r6) ; OK go the type + cmpi 0,r0,2 ; FFI_TYPE_FLOAT + bne Lfourint + lfs f1,0(r5) ; just one float in the struct. + b Lfinish + +Lfourint: + srdi r3,r3,32 ; four bytes. + b Lfinish + +Lstructend: + lg r3,LINKAGE_SIZE(r1) ; get the result type + bl STRUCT_RETVALUE_P + cmpi 0,r3,0 + beq Lfinish ; nope. + /* Recover a pointer to the results. */ + addi r11,r1,(SAVE_SIZE-RESULT_BYTES) + lg r3,0(r11) ; we need at least this... + lg r4,8(r11) + cmpi 0,r0,16 + beq Lfinish ; special case 16 bytes we don't consider floats. + + /* OK, frustratingly, the process of saving the struct to mem might have + messed with the FPRs, so we have to re-load them :(. + We`ll use our FPRs space again - calling: + void darwin64_pass_struct_floats (ffi_type *s, char *src, + unsigned *nfpr, double **fprs) + We`ll temporarily pinch the first two slots of the param area for local + vars used by the routine. */ + xor r6,r6,r6 + addi r5,r1,PARENT_PARM_BASE ; some space + sg r6,0(r5) ; *nfpr zeroed. + addi r6,r5,8 ; **fprs + addi r3,r1,FP_SAVE_BASE ; pointer to FPRs space + sg r3,0(r6) + mr r4,r11 ; the struct is here... + lg r3,LINKAGE_SIZE(r1) ; ffi_type * result_type. + bl PASS_STR_FLOATS ; get struct floats into FPR save space. + /* See if we used any floats */ + lwz r0,(SAVE_SIZE-RESULT_BYTES)(r1) + cmpi 0,r0,0 + beq Lstructints ; nope. + /* OK load `em up... */ + lfd f1, (FP_SAVE_BASE )(r1) + lfd f2, (FP_SAVE_BASE + FPR_SIZE )(r1) + lfd f3, (FP_SAVE_BASE + FPR_SIZE * 2 )(r1) + lfd f4, (FP_SAVE_BASE + FPR_SIZE * 3 )(r1) + lfd f5, (FP_SAVE_BASE + FPR_SIZE * 4 )(r1) + lfd f6, (FP_SAVE_BASE + FPR_SIZE * 5 )(r1) + lfd f7, (FP_SAVE_BASE + FPR_SIZE * 6 )(r1) + lfd f8, (FP_SAVE_BASE + FPR_SIZE * 7 )(r1) + lfd f9, (FP_SAVE_BASE + FPR_SIZE * 8 )(r1) + lfd f10,(FP_SAVE_BASE + FPR_SIZE * 9 )(r1) + lfd f11,(FP_SAVE_BASE + FPR_SIZE * 10)(r1) + lfd f12,(FP_SAVE_BASE + FPR_SIZE * 11)(r1) + lfd f13,(FP_SAVE_BASE + FPR_SIZE * 12)(r1) + + /* point back at our saved struct. */ +Lstructints: + addi r11,r1,(SAVE_SIZE-RESULT_BYTES) + lg r3,0(r11) ; we end up picking the + lg r4,8(r11) ; first two again. + lg r5,16(r11) + lg r6,24(r11) + lg r7,32(r11) + lg r8,40(r11) + lg r9,48(r11) + lg r10,56(r11) +#endif /* case done */ Lfinish: - addi r1,r1,176 /* Restore stack pointer. */ - lwz r0,8(r1) /* Get return address. */ - mtlr r0 /* Reset link register. */ + addi r1,r1,SAVE_SIZE /* Restore stack pointer. */ + lg r0,SAVED_LR_OFFSET(r1) /* Get return address. */ + mtlr r0 /* Reset link register. */ blr - +Lendcode: + .align 1 + /* END(ffi_closure_ASM) */ -.data -.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support +/* EH frame stuff. */ +#define EH_DATA_ALIGN_FACT MODE_CHOICE(0x7c,0x78) +/* 176, 400 */ +#define EH_FRAME_OFFSETA MODE_CHOICE(176,0x90) +#define EH_FRAME_OFFSETB MODE_CHOICE(1,3) + + .static_data + .align LOG2_GPR_BYTES +LLFB1$non_lazy_ptr: + .g_long Lstartcode + + .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support EH_frame1: .set L$set$0,LECIE1-LSCIE1 .long L$set$0 ; Length of Common Information Entry @@ -255,16 +481,16 @@ .byte 0x1 ; CIE Version .ascii "zR\0" ; CIE Augmentation .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor - .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor + .byte EH_DATA_ALIGN_FACT ; sleb128 -4; CIE Data Alignment Factor .byte 0x41 ; CIE RA Column .byte 0x1 ; uleb128 0x1; Augmentation size - .byte 0x90 ; FDE Encoding (indirect pcrel) + .byte 0x10 ; FDE Encoding (indirect pcrel) .byte 0xc ; DW_CFA_def_cfa .byte 0x1 ; uleb128 0x1 .byte 0x0 ; uleb128 0x0 .align LOG2_GPR_BYTES LECIE1: -.globl _ffi_closure_ASM.eh + .globl _ffi_closure_ASM.eh _ffi_closure_ASM.eh: LSFDE1: .set L$set$1,LEFDE1-LASFDE1 @@ -273,45 +499,78 @@ LASFDE1: .long LASFDE1-EH_frame1 ; FDE CIE offset .g_long LLFB1$non_lazy_ptr-. ; FDE initial location - .set L$set$3,LFE1-LFB1 + .set L$set$3,LFE1-Lstartcode .g_long L$set$3 ; FDE address range .byte 0x0 ; uleb128 0x0; Augmentation size .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$3,LCFI1-LCFI0 .long L$set$3 .byte 0xe ; DW_CFA_def_cfa_offset - .byte 176,1 ; uleb128 176 + .byte EH_FRAME_OFFSETA,EH_FRAME_OFFSETB ; uleb128 176,1/190,3 .byte 0x4 ; DW_CFA_advance_loc4 - .set L$set$4,LCFI0-LFB1 + .set L$set$4,LCFI0-Lstartcode .long L$set$4 .byte 0x11 ; DW_CFA_offset_extended_sf .byte 0x41 ; uleb128 0x41 .byte 0x7e ; sleb128 -2 .align LOG2_GPR_BYTES LEFDE1: -.data - .align LOG2_GPR_BYTES -LDFCM0: -.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 - .align LOG2_GPR_BYTES -Lffi_closure_helper_DARWIN$stub: -#if 1 + .align 1 + +#ifdef WANT_STUB + .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 + .align 5 +L_ffi_closure_helper_DARWIN$stub: .indirect_symbol _ffi_closure_helper_DARWIN - mflr r0 - bcl 20,31,LO$ffi_closure_helper_DARWIN -LO$ffi_closure_helper_DARWIN: - mflr r11 - addis r11,r11,ha16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN) - mtlr r0 - lgu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN)(r11) - mtctr r12 + mflr r0 + bcl 20,31,"L00000000001$spb" +"L00000000001$spb": + mflr r11 + addis r11,r11,ha16(L_ffi_closure_helper_DARWIN$lazy_ptr-"L00000000001$spb") + mtlr r0 + lwzu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr-"L00000000001$spb")(r11) + mtctr r12 bctr -.lazy_symbol_pointer + .lazy_symbol_pointer L_ffi_closure_helper_DARWIN$lazy_ptr: .indirect_symbol _ffi_closure_helper_DARWIN - .g_long dyld_stub_binding_helper + .g_long dyld_stub_binding_helper + +#if defined(__ppc64__) + .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 + .align 5 +L_darwin64_struct_ret_by_value_p$stub: + .indirect_symbol _darwin64_struct_ret_by_value_p + mflr r0 + bcl 20,31,"L00000000002$spb" +"L00000000002$spb": + mflr r11 + addis r11,r11,ha16(L_darwin64_struct_ret_by_value_p$lazy_ptr-"L00000000002$spb") + mtlr r0 + lwzu r12,lo16(L_darwin64_struct_ret_by_value_p$lazy_ptr-"L00000000002$spb")(r11) + mtctr r12 + bctr + .lazy_symbol_pointer +L_darwin64_struct_ret_by_value_p$lazy_ptr: + .indirect_symbol _darwin64_struct_ret_by_value_p + .g_long dyld_stub_binding_helper + + .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 + .align 5 +L_darwin64_pass_struct_floats$stub: + .indirect_symbol _darwin64_pass_struct_floats + mflr r0 + bcl 20,31,"L00000000003$spb" +"L00000000003$spb": + mflr r11 + addis r11,r11,ha16(L_darwin64_pass_struct_floats$lazy_ptr-"L00000000003$spb") + mtlr r0 + lwzu r12,lo16(L_darwin64_pass_struct_floats$lazy_ptr-"L00000000003$spb")(r11) + mtctr r12 + bctr + .lazy_symbol_pointer +L_darwin64_pass_struct_floats$lazy_ptr: + .indirect_symbol _darwin64_pass_struct_floats + .g_long dyld_stub_binding_helper +# endif #endif -.data - .align LOG2_GPR_BYTES -LLFB1$non_lazy_ptr: - .g_long LFB1 diff --git a/Modules/_ctypes/libffi/src/powerpc/ffi.c b/Modules/_ctypes/libffi/src/powerpc/ffi.c --- a/Modules/_ctypes/libffi/src/powerpc/ffi.c +++ b/Modules/_ctypes/libffi/src/powerpc/ffi.c @@ -1,7 +1,9 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998 Geoffrey Keating - Copyright (C) 2007, 2008 Free Software Foundation, Inc - Copyright (C) 2008 Red Hat, Inc + ffi.c - Copyright (C) 2011 Anthony Green + Copyright (C) 2011 Kyle Moffett + Copyright (C) 2008 Red Hat, Inc + Copyright (C) 2007, 2008 Free Software Foundation, Inc + Copyright (c) 1998 Geoffrey Keating PowerPC Foreign Function Interface @@ -39,32 +41,33 @@ /* The assembly depends on these exact flags. */ FLAG_RETURNS_SMST = 1 << (31-31), /* Used for FFI_SYSV small structs. */ FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */ +#ifndef __NO_FPRS__ FLAG_RETURNS_FP = 1 << (31-29), +#endif FLAG_RETURNS_64BITS = 1 << (31-28), FLAG_RETURNS_128BITS = 1 << (31-27), /* cr6 */ + FLAG_SYSV_SMST_R4 = 1 << (31-26), /* use r4 for FFI_SYSV 8 byte structs. */ FLAG_SYSV_SMST_R3 = 1 << (31-25), /* use r3 for FFI_SYSV 4 byte structs. */ - /* Bits (31-24) through (31-19) store shift value for SMST */ FLAG_ARG_NEEDS_COPY = 1 << (31- 7), +#ifndef __NO_FPRS__ FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ +#endif FLAG_4_GPR_ARGUMENTS = 1 << (31- 5), FLAG_RETVAL_REFERENCE = 1 << (31- 4) }; /* About the SYSV ABI. */ -unsigned int NUM_GPR_ARG_REGISTERS = 8; +#define ASM_NEEDS_REGISTERS 4 +#define NUM_GPR_ARG_REGISTERS 8 #ifndef __NO_FPRS__ -unsigned int NUM_FPR_ARG_REGISTERS = 8; -#else -unsigned int NUM_FPR_ARG_REGISTERS = 0; +# define NUM_FPR_ARG_REGISTERS 8 #endif -enum { ASM_NEEDS_REGISTERS = 4 }; - /* ffi_prep_args_SYSV is called by the assembly routine once stack space has been allocated for the function's arguments. @@ -113,10 +116,12 @@ valp gpr_base; int intarg_count; +#ifndef __NO_FPRS__ /* 'fpr_base' points at the space for fpr1, and grows upwards as we use FPR registers. */ valp fpr_base; int fparg_count; +#endif /* 'copy_space' grows down as we put structures in it. It should stay 16-byte aligned. */ @@ -125,9 +130,8 @@ /* 'next_arg' grows up as we put parameters in it. */ valp next_arg; - int i, ii MAYBE_UNUSED; + int i; ffi_type **ptr; - double double_tmp; union { void **v; char **c; @@ -143,21 +147,23 @@ size_t struct_copy_size; unsigned gprvalue; - if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) - NUM_FPR_ARG_REGISTERS = 0; - stacktop.c = (char *) stack + bytes; gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS; intarg_count = 0; +#ifndef __NO_FPRS__ + double double_tmp; fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS; fparg_count = 0; copy_space.c = ((flags & FLAG_FP_ARGUMENTS) ? fpr_base.c : gpr_base.c); +#else + copy_space.c = gpr_base.c; +#endif next_arg.u = stack + 2; /* Check that everything starts aligned properly. */ - FFI_ASSERT (((unsigned) (char *) stack & 0xF) == 0); - FFI_ASSERT (((unsigned) copy_space.c & 0xF) == 0); - FFI_ASSERT (((unsigned) stacktop.c & 0xF) == 0); + FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0); + FFI_ASSERT (((unsigned long) copy_space.c & 0xF) == 0); + FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0); FFI_ASSERT ((bytes & 0xF) == 0); FFI_ASSERT (copy_space.c >= next_arg.c); @@ -174,12 +180,28 @@ i > 0; i--, ptr++, p_argv.v++) { - switch ((*ptr)->type) - { + unsigned short typenum = (*ptr)->type; + + /* We may need to handle some values depending on ABI */ + if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) { + if (typenum == FFI_TYPE_FLOAT) + typenum = FFI_TYPE_UINT32; + if (typenum == FFI_TYPE_DOUBLE) + typenum = FFI_TYPE_UINT64; + if (typenum == FFI_TYPE_LONGDOUBLE) + typenum = FFI_TYPE_UINT128; + } else if (ecif->cif->abi != FFI_LINUX) { +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + if (typenum == FFI_TYPE_LONGDOUBLE) + typenum = FFI_TYPE_STRUCT; +#endif + } + + /* Now test the translated value */ + switch (typenum) { +#ifndef __NO_FPRS__ case FFI_TYPE_FLOAT: /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ - if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) - goto soft_float_prep; double_tmp = **p_argv.f; if (fparg_count >= NUM_FPR_ARG_REGISTERS) { @@ -195,8 +217,6 @@ case FFI_TYPE_DOUBLE: /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ - if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) - goto soft_double_prep; double_tmp = **p_argv.d; if (fparg_count >= NUM_FPR_ARG_REGISTERS) @@ -218,43 +238,6 @@ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: - if ((ecif->cif->abi != FFI_LINUX) - && (ecif->cif->abi != FFI_LINUX_SOFT_FLOAT)) - goto do_struct; - /* The soft float ABI for long doubles works like this, - a long double is passed in four consecutive gprs if available. - A maximum of 2 long doubles can be passed in gprs. - If we do not have 4 gprs left, the long double is passed on the - stack, 4-byte aligned. */ - if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) - { - unsigned int int_tmp = (*p_argv.ui)[0]; - if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3) - { - if (intarg_count < NUM_GPR_ARG_REGISTERS) - intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; - *next_arg.u = int_tmp; - next_arg.u++; - for (ii = 1; ii < 4; ii++) - { - int_tmp = (*p_argv.ui)[ii]; - *next_arg.u = int_tmp; - next_arg.u++; - } - } - else - { - *gpr_base.u++ = int_tmp; - for (ii = 1; ii < 4; ii++) - { - int_tmp = (*p_argv.ui)[ii]; - *gpr_base.u++ = int_tmp; - } - } - intarg_count +=4; - } - else - { double_tmp = (*p_argv.d)[0]; if (fparg_count >= NUM_FPR_ARG_REGISTERS - 1) @@ -280,13 +263,40 @@ fparg_count += 2; FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); - } break; #endif +#endif /* have FPRs */ + + /* + * The soft float ABI for long doubles works like this, a long double + * is passed in four consecutive GPRs if available. A maximum of 2 + * long doubles can be passed in gprs. If we do not have 4 GPRs + * left, the long double is passed on the stack, 4-byte aligned. + */ + case FFI_TYPE_UINT128: { + unsigned int int_tmp = (*p_argv.ui)[0]; + unsigned int ii; + if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3) { + if (intarg_count < NUM_GPR_ARG_REGISTERS) + intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; + *(next_arg.u++) = int_tmp; + for (ii = 1; ii < 4; ii++) { + int_tmp = (*p_argv.ui)[ii]; + *(next_arg.u++) = int_tmp; + } + } else { + *(gpr_base.u++) = int_tmp; + for (ii = 1; ii < 4; ii++) { + int_tmp = (*p_argv.ui)[ii]; + *(gpr_base.u++) = int_tmp; + } + } + intarg_count += 4; + break; + } case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: - soft_double_prep: if (intarg_count == NUM_GPR_ARG_REGISTERS-1) intarg_count++; if (intarg_count >= NUM_GPR_ARG_REGISTERS) @@ -319,9 +329,6 @@ break; case FFI_TYPE_STRUCT: -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - do_struct: -#endif struct_copy_size = ((*ptr)->size + 15) & ~0xF; copy_space.c -= struct_copy_size; memcpy (copy_space.c, *p_argv.c, (*ptr)->size); @@ -349,7 +356,6 @@ case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: case FFI_TYPE_POINTER: - soft_float_prep: gprvalue = **p_argv.ui; @@ -366,8 +372,16 @@ /* Check that we didn't overrun the stack... */ FFI_ASSERT (copy_space.c >= next_arg.c); FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS); + /* The assert below is testing that the number of integer arguments agrees + with the number found in ffi_prep_cif_machdep(). However, intarg_count + is incremeneted whenever we place an FP arg on the stack, so account for + that before our assert test. */ +#ifndef __NO_FPRS__ + if (fparg_count > NUM_FPR_ARG_REGISTERS) + intarg_count -= fparg_count - NUM_FPR_ARG_REGISTERS; FFI_ASSERT (fpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); +#endif FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); } @@ -604,9 +618,6 @@ unsigned type = cif->rtype->type; unsigned size = cif->rtype->size; - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - NUM_FPR_ARG_REGISTERS = 0; - if (cif->abi != FFI_LINUX64) { /* All the machine-independent calculation of cif->bytes will be wrong. @@ -646,13 +657,26 @@ - Single/double FP values in fpr1, long double in fpr1,fpr2. - soft-float float/doubles are treated as UINT32/UINT64 respectivley. - soft-float long doubles are returned in gpr3-gpr6. */ + /* First translate for softfloat/nonlinux */ + if (cif->abi == FFI_LINUX_SOFT_FLOAT) { + if (type == FFI_TYPE_FLOAT) + type = FFI_TYPE_UINT32; + if (type == FFI_TYPE_DOUBLE) + type = FFI_TYPE_UINT64; + if (type == FFI_TYPE_LONGDOUBLE) + type = FFI_TYPE_UINT128; + } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) { +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + if (type == FFI_TYPE_LONGDOUBLE) + type = FFI_TYPE_STRUCT; +#endif + } + switch (type) { +#ifndef __NO_FPRS__ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: - if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64 - && cif->abi != FFI_LINUX_SOFT_FLOAT) - goto byref; flags |= FLAG_RETURNS_128BITS; /* Fall through. */ #endif @@ -660,11 +684,13 @@ flags |= FLAG_RETURNS_64BITS; /* Fall through. */ case FFI_TYPE_FLOAT: - /* With FFI_LINUX_SOFT_FLOAT no fp registers are used. */ - if (cif->abi != FFI_LINUX_SOFT_FLOAT) - flags |= FLAG_RETURNS_FP; + flags |= FLAG_RETURNS_FP; break; +#endif + case FFI_TYPE_UINT128: + flags |= FLAG_RETURNS_128BITS; + /* Fall through. */ case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: flags |= FLAG_RETURNS_64BITS; @@ -699,9 +725,7 @@ } } } -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - byref: -#endif + intarg_count++; flags |= FLAG_RETVAL_REFERENCE; /* Fall through. */ @@ -722,39 +746,36 @@ Stuff on the stack needs to keep proper alignment. */ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { - switch ((*ptr)->type) - { + unsigned short typenum = (*ptr)->type; + + /* We may need to handle some values depending on ABI */ + if (cif->abi == FFI_LINUX_SOFT_FLOAT) { + if (typenum == FFI_TYPE_FLOAT) + typenum = FFI_TYPE_UINT32; + if (typenum == FFI_TYPE_DOUBLE) + typenum = FFI_TYPE_UINT64; + if (typenum == FFI_TYPE_LONGDOUBLE) + typenum = FFI_TYPE_UINT128; + } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) { +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + if (typenum == FFI_TYPE_LONGDOUBLE) + typenum = FFI_TYPE_STRUCT; +#endif + } + + switch (typenum) { +#ifndef __NO_FPRS__ case FFI_TYPE_FLOAT: - /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - goto soft_float_cif; fparg_count++; /* floating singles are not 8-aligned on stack */ break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: - if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) - goto do_struct; - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - { - if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3 - || intarg_count < NUM_GPR_ARG_REGISTERS) - /* A long double in FFI_LINUX_SOFT_FLOAT can use only - a set of four consecutive gprs. If we have not enough, - we have to adjust the intarg_count value. */ - intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; - intarg_count += 4; - break; - } - else - fparg_count++; + fparg_count++; /* Fall thru */ #endif case FFI_TYPE_DOUBLE: - /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - goto soft_double_cif; fparg_count++; /* If this FP arg is going on the stack, it must be 8-byte-aligned. */ @@ -763,10 +784,21 @@ && intarg_count % 2 != 0) intarg_count++; break; +#endif + case FFI_TYPE_UINT128: + /* + * A long double in FFI_LINUX_SOFT_FLOAT can use only a set + * of four consecutive gprs. If we do not have enough, we + * have to adjust the intarg_count value. + */ + if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3 + && intarg_count < NUM_GPR_ARG_REGISTERS) + intarg_count = NUM_GPR_ARG_REGISTERS; + intarg_count += 4; + break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: - soft_double_cif: /* 'long long' arguments are passed as two words, but either both words must fit in registers or both go on the stack. If they go on the stack, they must @@ -783,9 +815,6 @@ break; case FFI_TYPE_STRUCT: -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - do_struct: -#endif /* We must allocate space for a copy of these to enforce pass-by-value. Pad the space up to a multiple of 16 bytes (the maximum alignment required for anything under @@ -793,12 +822,20 @@ struct_copy_size += ((*ptr)->size + 15) & ~0xF; /* Fall through (allocate space for the pointer). */ - default: - soft_float_cif: + case FFI_TYPE_POINTER: + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: /* Everything else is passed as a 4-byte word in a GPR, either the object itself or a pointer to it. */ intarg_count++; break; + default: + FFI_ASSERT (0); } } else @@ -827,16 +864,29 @@ intarg_count += ((*ptr)->size + 7) / 8; break; - default: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: /* Everything else is passed as a 8-byte word in a GPR, either the object itself or a pointer to it. */ intarg_count++; break; + default: + FFI_ASSERT (0); } } +#ifndef __NO_FPRS__ if (fparg_count != 0) flags |= FLAG_FP_ARGUMENTS; +#endif if (intarg_count > 4) flags |= FLAG_4_GPR_ARGUMENTS; if (struct_copy_size != 0) @@ -844,21 +894,27 @@ if (cif->abi != FFI_LINUX64) { +#ifndef __NO_FPRS__ /* Space for the FPR registers, if needed. */ if (fparg_count != 0) bytes += NUM_FPR_ARG_REGISTERS * sizeof (double); +#endif /* Stack space. */ if (intarg_count > NUM_GPR_ARG_REGISTERS) bytes += (intarg_count - NUM_GPR_ARG_REGISTERS) * sizeof (int); +#ifndef __NO_FPRS__ if (fparg_count > NUM_FPR_ARG_REGISTERS) bytes += (fparg_count - NUM_FPR_ARG_REGISTERS) * sizeof (double); +#endif } else { +#ifndef __NO_FPRS__ /* Space for the FPR registers, if needed. */ if (fparg_count != 0) bytes += NUM_FPR_ARG_REGISTERS64 * sizeof (double); +#endif /* Stack space. */ if (intarg_count > NUM_GPR_ARG_REGISTERS64) @@ -886,28 +942,41 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { + /* + * The final SYSV ABI says that structures smaller or equal 8 bytes + * are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them + * in memory. + * + * Just to keep things simple for the assembly code, we will always + * bounce-buffer struct return values less than or equal to 8 bytes. + * This allows the ASM to handle SYSV small structures by directly + * writing r3 and r4 to memory without worrying about struct size. + */ + unsigned int smst_buffer[2]; extended_cif ecif; + unsigned int rsize = 0; ecif.cif = cif; ecif.avalue = avalue; - /* If the return value is a struct and we don't have a return */ - /* value address then we need to make one */ - - if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) - { - ecif.rvalue = alloca(cif->rtype->size); - } - else - ecif.rvalue = rvalue; - + /* Ensure that we have a valid struct return value */ + ecif.rvalue = rvalue; + if (cif->rtype->type == FFI_TYPE_STRUCT) { + rsize = cif->rtype->size; + if (rsize <= 8) + ecif.rvalue = smst_buffer; + else if (!rvalue) + ecif.rvalue = alloca(rsize); + } switch (cif->abi) { #ifndef POWERPC64 +# ifndef __NO_FPRS__ case FFI_SYSV: case FFI_GCC_SYSV: case FFI_LINUX: +# endif case FFI_LINUX_SOFT_FLOAT: ffi_call_SYSV (&ecif, -cif->bytes, cif->flags, ecif.rvalue, fn); break; @@ -920,6 +989,10 @@ FFI_ASSERT (0); break; } + + /* Check for a bounce-buffered return value */ + if (rvalue && ecif.rvalue == smst_buffer) + memcpy(rvalue, smst_buffer, rsize); } @@ -949,14 +1022,19 @@ #ifdef POWERPC64 void **tramp = (void **) &closure->tramp[0]; - FFI_ASSERT (cif->abi == FFI_LINUX64); + if (cif->abi != FFI_LINUX64) + return FFI_BAD_ABI; /* Copy function address and TOC from ffi_closure_LINUX64. */ memcpy (tramp, (char *) ffi_closure_LINUX64, 16); tramp[2] = codeloc; #else unsigned int *tramp; - FFI_ASSERT (cif->abi == FFI_GCC_SYSV || cif->abi == FFI_SYSV); + if (! (cif->abi == FFI_GCC_SYSV + || cif->abi == FFI_SYSV + || cif->abi == FFI_LINUX + || cif->abi == FFI_LINUX_SOFT_FLOAT)) + return FFI_BAD_ABI; tramp = (unsigned int *) &closure->tramp[0]; tramp[0] = 0x7c0802a6; /* mflr r0 */ @@ -1011,32 +1089,38 @@ void ** avalue; ffi_type ** arg_types; long i, avn; - long nf; /* number of floating registers already used */ - long ng; /* number of general registers already used */ - ffi_cif * cif; - double temp; - unsigned size; +#ifndef __NO_FPRS__ + long nf = 0; /* number of floating registers already used */ +#endif + long ng = 0; /* number of general registers already used */ - cif = closure->cif; + ffi_cif *cif = closure->cif; + unsigned size = cif->rtype->size; + unsigned short rtypenum = cif->rtype->type; + avalue = alloca (cif->nargs * sizeof (void *)); - size = cif->rtype->size; - nf = 0; - ng = 0; + /* First translate for softfloat/nonlinux */ + if (cif->abi == FFI_LINUX_SOFT_FLOAT) { + if (rtypenum == FFI_TYPE_FLOAT) + rtypenum = FFI_TYPE_UINT32; + if (rtypenum == FFI_TYPE_DOUBLE) + rtypenum = FFI_TYPE_UINT64; + if (rtypenum == FFI_TYPE_LONGDOUBLE) + rtypenum = FFI_TYPE_UINT128; + } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) { +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + if (rtypenum == FFI_TYPE_LONGDOUBLE) + rtypenum = FFI_TYPE_STRUCT; +#endif + } + /* Copy the caller's structure return value address so that the closure returns the data directly to the caller. For FFI_SYSV the result is passed in r3/r4 if the struct size is less or equal 8 bytes. */ - - if ((cif->rtype->type == FFI_TYPE_STRUCT - && !((cif->abi == FFI_SYSV) && (size <= 8))) -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - || (cif->rtype->type == FFI_TYPE_LONGDOUBLE - && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) -#endif - ) - { + if (rtypenum == FFI_TYPE_STRUCT && ((cif->abi != FFI_SYSV) || (size > 8))) { rvalue = (void *) *pgr; ng++; pgr++; @@ -1047,10 +1131,109 @@ arg_types = cif->arg_types; /* Grab the addresses of the arguments from the stack frame. */ - while (i < avn) - { - switch (arg_types[i]->type) - { + while (i < avn) { + unsigned short typenum = arg_types[i]->type; + + /* We may need to handle some values depending on ABI */ + if (cif->abi == FFI_LINUX_SOFT_FLOAT) { + if (typenum == FFI_TYPE_FLOAT) + typenum = FFI_TYPE_UINT32; + if (typenum == FFI_TYPE_DOUBLE) + typenum = FFI_TYPE_UINT64; + if (typenum == FFI_TYPE_LONGDOUBLE) + typenum = FFI_TYPE_UINT128; + } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) { +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + if (typenum == FFI_TYPE_LONGDOUBLE) + typenum = FFI_TYPE_STRUCT; +#endif + } + + switch (typenum) { +#ifndef __NO_FPRS__ + case FFI_TYPE_FLOAT: + /* unfortunately float values are stored as doubles + * in the ffi_closure_SYSV code (since we don't check + * the type in that routine). + */ + + /* there are 8 64bit floating point registers */ + + if (nf < 8) + { + double temp = pfr->d; + pfr->f = (float) temp; + avalue[i] = pfr; + nf++; + pfr++; + } + else + { + /* FIXME? here we are really changing the values + * stored in the original calling routines outgoing + * parameter stack. This is probably a really + * naughty thing to do but... + */ + avalue[i] = pst; + pst += 1; + } + break; + + case FFI_TYPE_DOUBLE: + /* On the outgoing stack all values are aligned to 8 */ + /* there are 8 64bit floating point registers */ + + if (nf < 8) + { + avalue[i] = pfr; + nf++; + pfr++; + } + else + { + if (((long) pst) & 4) + pst++; + avalue[i] = pst; + pst += 2; + } + break; + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: + if (nf < 7) + { + avalue[i] = pfr; + pfr += 2; + nf += 2; + } + else + { + if (((long) pst) & 4) + pst++; + avalue[i] = pst; + pst += 4; + nf = 8; + } + break; +#endif +#endif /* have FPRS */ + + case FFI_TYPE_UINT128: + /* + * Test if for the whole long double, 4 gprs are available. + * otherwise the stuff ends up on the stack. + */ + if (ng < 5) { + avalue[i] = pgr; + pgr += 4; + ng += 4; + } else { + avalue[i] = pst; + pst += 4; + ng = 8+4; + } + break; + case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: /* there are 8 gpr registers used to pass values */ @@ -1086,7 +1269,6 @@ case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_POINTER: - soft_float_closure: /* there are 8 gpr registers used to pass values */ if (ng < 8) { @@ -1102,9 +1284,6 @@ break; case FFI_TYPE_STRUCT: -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - do_struct: -#endif /* Structs are passed by reference. The address will appear in a gpr if it is one of the first 8 arguments. */ if (ng < 8) @@ -1122,7 +1301,6 @@ case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: - soft_double_closure: /* passing long long ints are complex, they must * be passed in suitable register pairs such as * (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10) @@ -1154,99 +1332,8 @@ } break; - case FFI_TYPE_FLOAT: - /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - goto soft_float_closure; - /* unfortunately float values are stored as doubles - * in the ffi_closure_SYSV code (since we don't check - * the type in that routine). - */ - - /* there are 8 64bit floating point registers */ - - if (nf < 8) - { - temp = pfr->d; - pfr->f = (float) temp; - avalue[i] = pfr; - nf++; - pfr++; - } - else - { - /* FIXME? here we are really changing the values - * stored in the original calling routines outgoing - * parameter stack. This is probably a really - * naughty thing to do but... - */ - avalue[i] = pst; - pst += 1; - } - break; - - case FFI_TYPE_DOUBLE: - /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - goto soft_double_closure; - /* On the outgoing stack all values are aligned to 8 */ - /* there are 8 64bit floating point registers */ - - if (nf < 8) - { - avalue[i] = pfr; - nf++; - pfr++; - } - else - { - if (((long) pst) & 4) - pst++; - avalue[i] = pst; - pst += 2; - } - break; - -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) - goto do_struct; - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - { /* Test if for the whole long double, 4 gprs are available. - otherwise the stuff ends up on the stack. */ - if (ng < 5) - { - avalue[i] = pgr; - pgr += 4; - ng += 4; - } - else - { - avalue[i] = pst; - pst += 4; - ng = 8; - } - break; - } - if (nf < 7) - { - avalue[i] = pfr; - pfr += 2; - nf += 2; - } - else - { - if (((long) pst) & 4) - pst++; - avalue[i] = pst; - pst += 4; - nf = 8; - } - break; -#endif - default: - FFI_ASSERT (0); + FFI_ASSERT (0); } i++; @@ -1263,39 +1350,9 @@ already used and we never have a struct with size zero. That is the reason for the subtraction of 1. See the comment in ffitarget.h about ordering. */ - if (cif->abi == FFI_SYSV && cif->rtype->type == FFI_TYPE_STRUCT - && size <= 8) + if (cif->abi == FFI_SYSV && rtypenum == FFI_TYPE_STRUCT && size <= 8) return (FFI_SYSV_TYPE_SMALL_STRUCT - 1) + size; -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - else if (cif->rtype->type == FFI_TYPE_LONGDOUBLE - && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) - return FFI_TYPE_STRUCT; -#endif - /* With FFI_LINUX_SOFT_FLOAT floats and doubles are handled like UINT32 - respectivley UINT64. */ - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - { - switch (cif->rtype->type) - { - case FFI_TYPE_FLOAT: - return FFI_TYPE_UINT32; - break; - case FFI_TYPE_DOUBLE: - return FFI_TYPE_UINT64; - break; -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - return FFI_TYPE_UINT128; - break; -#endif - default: - return cif->rtype->type; - } - } - else - { - return cif->rtype->type; - } + return rtypenum; } int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_closure *, void *, diff --git a/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c b/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c --- a/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c +++ b/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c @@ -3,7 +3,7 @@ Copyright (C) 1998 Geoffrey Keating Copyright (C) 2001 John Hornkvist - Copyright (C) 2002, 2006, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. FFI support for Darwin and AIX. @@ -35,11 +35,17 @@ extern void ffi_closure_ASM (void); enum { - /* The assembly depends on these exact flags. */ - FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */ - FLAG_RETURNS_FP = 1 << (31-29), - FLAG_RETURNS_64BITS = 1 << (31-28), - FLAG_RETURNS_128BITS = 1 << (31-31), + /* The assembly depends on these exact flags. + For Darwin64 (when FLAG_RETURNS_STRUCT is set): + FLAG_RETURNS_FP indicates that the structure embeds FP data. + FLAG_RETURNS_128BITS signals a special struct size that is not + expanded for float content. */ + FLAG_RETURNS_128BITS = 1 << (31-31), /* These go in cr7 */ + FLAG_RETURNS_NOTHING = 1 << (31-30), + FLAG_RETURNS_FP = 1 << (31-29), + FLAG_RETURNS_64BITS = 1 << (31-28), + + FLAG_RETURNS_STRUCT = 1 << (31-27), /* This goes in cr6 */ FLAG_ARG_NEEDS_COPY = 1 << (31- 7), FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ @@ -50,43 +56,61 @@ /* About the DARWIN ABI. */ enum { NUM_GPR_ARG_REGISTERS = 8, - NUM_FPR_ARG_REGISTERS = 13 + NUM_FPR_ARG_REGISTERS = 13, + LINKAGE_AREA_GPRS = 6 }; -enum { ASM_NEEDS_REGISTERS = 4 }; + +enum { ASM_NEEDS_REGISTERS = 4 }; /* r28-r31 */ /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments. + + m32/m64 The stack layout we want looks like this: | Return address from ffi_call_DARWIN | higher addresses |--------------------------------------------| - | Previous backchain pointer 4 | stack pointer here + | Previous backchain pointer 4/8 | stack pointer here |--------------------------------------------|<+ <<< on entry to - | Saved r28-r31 4*4 | | ffi_call_DARWIN + | ASM_NEEDS_REGISTERS=r28-r31 4*(4/8) | | ffi_call_DARWIN |--------------------------------------------| | - | Parameters (at least 8*4=32) | | + | When we have any FP activity... the | | + | FPRs occupy NUM_FPR_ARG_REGISTERS slots | | + | here fp13 .. fp1 from high to low addr. | | + ~ ~ ~ + | Parameters (at least 8*4/8=32/64) | | NUM_GPR_ARG_REGISTERS |--------------------------------------------| | - | Space for GPR2 4 | | + | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | |--------------------------------------------| | stack | - | Reserved 2*4 | | grows | + | Reserved 2*4/8 | | grows | |--------------------------------------------| | down V - | Space for callee's LR 4 | | + | Space for callee's LR 4/8 | | |--------------------------------------------| | lower addresses - | Saved CR 4 | | + | Saved CR [low word for m64] 4/8 | | |--------------------------------------------| | stack pointer here - | Current backchain pointer 4 |-/ during + | Current backchain pointer 4/8 |-/ during |--------------------------------------------| <<< ffi_call_DARWIN */ +#if defined(POWERPC_DARWIN64) +static void +darwin64_pass_struct_by_value + (ffi_type *, char *, unsigned, unsigned *, double **, unsigned long **); +#endif + +/* This depends on GPR_SIZE = sizeof (unsigned long) */ + void ffi_prep_args (extended_cif *ecif, unsigned long *const stack) { const unsigned bytes = ecif->cif->bytes; const unsigned flags = ecif->cif->flags; const unsigned nargs = ecif->cif->nargs; +#if !defined(POWERPC_DARWIN64) const ffi_abi abi = ecif->cif->abi; +#endif /* 'stacktop' points at the previous backchain pointer. */ unsigned long *const stacktop = stack + (bytes / sizeof(unsigned long)); @@ -94,18 +118,19 @@ /* 'fpr_base' points at the space for fpr1, and grows upwards as we use FPR registers. */ double *fpr_base = (double *) (stacktop - ASM_NEEDS_REGISTERS) - NUM_FPR_ARG_REGISTERS; - int fparg_count = 0; - + int gp_count = 0, fparg_count = 0; /* 'next_arg' grows up as we put parameters in it. */ - unsigned long *next_arg = stack + 6; /* 6 reserved positions. */ + unsigned long *next_arg = stack + LINKAGE_AREA_GPRS; /* 6 reserved positions. */ int i; double double_tmp; void **p_argv = ecif->avalue; unsigned long gprvalue; ffi_type** ptr = ecif->cif->arg_types; +#if !defined(POWERPC_DARWIN64) char *dest_cpy; +#endif unsigned size_al = 0; /* Check that everything starts aligned properly. */ @@ -130,25 +155,30 @@ the size of the floating-point parameter are skipped. */ case FFI_TYPE_FLOAT: double_tmp = *(float *) *p_argv; - if (fparg_count >= NUM_FPR_ARG_REGISTERS) - *(double *)next_arg = double_tmp; - else + if (fparg_count < NUM_FPR_ARG_REGISTERS) *fpr_base++ = double_tmp; +#if defined(POWERPC_DARWIN) + *(float *)next_arg = *(float *) *p_argv; +#else + *(double *)next_arg = double_tmp; +#endif next_arg++; + gp_count++; fparg_count++; FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); break; case FFI_TYPE_DOUBLE: double_tmp = *(double *) *p_argv; - if (fparg_count >= NUM_FPR_ARG_REGISTERS) - *(double *)next_arg = double_tmp; - else + if (fparg_count < NUM_FPR_ARG_REGISTERS) *fpr_base++ = double_tmp; + *(double *)next_arg = double_tmp; #ifdef POWERPC64 next_arg++; + gp_count++; #else next_arg += 2; + gp_count += 2; #endif fparg_count++; FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); @@ -157,30 +187,41 @@ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: -#ifdef POWERPC64 +# if defined(POWERPC64) && !defined(POWERPC_DARWIN64) + /* ??? This will exceed the regs count when the value starts at fp13 + and it will not put the extra bit on the stack. */ if (fparg_count < NUM_FPR_ARG_REGISTERS) *(long double *) fpr_base++ = *(long double *) *p_argv; else *(long double *) next_arg = *(long double *) *p_argv; next_arg += 2; fparg_count += 2; -#else +# else double_tmp = ((double *) *p_argv)[0]; if (fparg_count < NUM_FPR_ARG_REGISTERS) *fpr_base++ = double_tmp; - else - *(double *) next_arg = double_tmp; + *(double *) next_arg = double_tmp; +# if defined(POWERPC_DARWIN64) + next_arg++; + gp_count++; +# else next_arg += 2; + gp_count += 2; +# endif fparg_count++; - double_tmp = ((double *) *p_argv)[1]; if (fparg_count < NUM_FPR_ARG_REGISTERS) *fpr_base++ = double_tmp; - else - *(double *) next_arg = double_tmp; + *(double *) next_arg = double_tmp; +# if defined(POWERPC_DARWIN64) + next_arg++; + gp_count++; +# else next_arg += 2; + gp_count += 2; +# endif fparg_count++; -#endif +# endif FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); break; #endif @@ -192,6 +233,7 @@ #else *(long long *) next_arg = *(long long *) *p_argv; next_arg += 2; + gp_count += 2; #endif break; case FFI_TYPE_POINTER: @@ -211,32 +253,35 @@ goto putgpr; case FFI_TYPE_STRUCT: -#ifdef POWERPC64 - dest_cpy = (char *) next_arg; size_al = (*ptr)->size; - if ((*ptr)->elements[0]->type == 3) - size_al = ALIGN((*ptr)->size, 8); - if (size_al < 3 && abi == FFI_DARWIN) - dest_cpy += 4 - size_al; - - memcpy ((char *) dest_cpy, (char *) *p_argv, size_al); - next_arg += (size_al + 7) / 8; +#if defined(POWERPC_DARWIN64) + next_arg = (unsigned long *)ALIGN((char *)next_arg, (*ptr)->alignment); + darwin64_pass_struct_by_value (*ptr, (char *) *p_argv, + (unsigned) size_al, + (unsigned int *) &fparg_count, + &fpr_base, &next_arg); #else dest_cpy = (char *) next_arg; + /* If the first member of the struct is a double, then include enough + padding in the struct size to align it to double-word. */ + if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) + size_al = ALIGN((*ptr)->size, 8); + +# if defined(POWERPC64) + FFI_ASSERT (abi != FFI_DARWIN); + memcpy ((char *) dest_cpy, (char *) *p_argv, size_al); + next_arg += (size_al + 7) / 8; +# else /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, SI 4 bytes) are aligned as if they were those modes. Structures with 3 byte in size are padded upwards. */ - size_al = (*ptr)->size; - /* If the first member of the struct is a double, then align - the struct to double-word. */ - if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) - size_al = ALIGN((*ptr)->size, 8); if (size_al < 3 && abi == FFI_DARWIN) dest_cpy += 4 - size_al; memcpy((char *) dest_cpy, (char *) *p_argv, size_al); next_arg += (size_al + 3) / 4; +# endif #endif break; @@ -249,6 +294,7 @@ gprvalue = *(unsigned int *) *p_argv; putgpr: *next_arg++ = gprvalue; + gp_count++; break; default: break; @@ -256,14 +302,275 @@ } /* Check that we didn't overrun the stack... */ - //FFI_ASSERT(gpr_base <= stacktop - ASM_NEEDS_REGISTERS); - //FFI_ASSERT((unsigned *)fpr_base - // <= stacktop - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); - //FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); + /* FFI_ASSERT(gpr_base <= stacktop - ASM_NEEDS_REGISTERS); + FFI_ASSERT((unsigned *)fpr_base + <= stacktop - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); + FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); */ } +#if defined(POWERPC_DARWIN64) + +/* See if we can put some of the struct into fprs. + This should not be called for structures of size 16 bytes, since these are not + broken out this way. */ +static void +darwin64_scan_struct_for_floats (ffi_type *s, unsigned *nfpr) +{ + int i; + + FFI_ASSERT (s->type == FFI_TYPE_STRUCT) + + for (i = 0; s->elements[i] != NULL; i++) + { + ffi_type *p = s->elements[i]; + switch (p->type) + { + case FFI_TYPE_STRUCT: + darwin64_scan_struct_for_floats (p, nfpr); + break; + case FFI_TYPE_LONGDOUBLE: + (*nfpr) += 2; + break; + case FFI_TYPE_DOUBLE: + case FFI_TYPE_FLOAT: + (*nfpr) += 1; + break; + default: + break; + } + } +} + +static int +darwin64_struct_size_exceeds_gprs_p (ffi_type *s, char *src, unsigned *nfpr) +{ + unsigned struct_offset=0, i; + + for (i = 0; s->elements[i] != NULL; i++) + { + char *item_base; + ffi_type *p = s->elements[i]; + /* Find the start of this item (0 for the first one). */ + if (i > 0) + struct_offset = ALIGN(struct_offset, p->alignment); + + item_base = src + struct_offset; + + switch (p->type) + { + case FFI_TYPE_STRUCT: + if (darwin64_struct_size_exceeds_gprs_p (p, item_base, nfpr)) + return 1; + break; + case FFI_TYPE_LONGDOUBLE: + if (*nfpr >= NUM_FPR_ARG_REGISTERS) + return 1; + (*nfpr) += 1; + item_base += 8; + /* FALL THROUGH */ + case FFI_TYPE_DOUBLE: + if (*nfpr >= NUM_FPR_ARG_REGISTERS) + return 1; + (*nfpr) += 1; + break; + case FFI_TYPE_FLOAT: + if (*nfpr >= NUM_FPR_ARG_REGISTERS) + return 1; + (*nfpr) += 1; + break; + default: + /* If we try and place any item, that is non-float, once we've + exceeded the 8 GPR mark, then we can't fit the struct. */ + if ((unsigned long)item_base >= 8*8) + return 1; + break; + } + /* now count the size of what we just used. */ + struct_offset += p->size; + } + return 0; +} + +/* Can this struct be returned by value? */ +int +darwin64_struct_ret_by_value_p (ffi_type *s) +{ + unsigned nfp = 0; + + FFI_ASSERT (s && s->type == FFI_TYPE_STRUCT); + + /* The largest structure we can return is 8long + 13 doubles. */ + if (s->size > 168) + return 0; + + /* We can't pass more than 13 floats. */ + darwin64_scan_struct_for_floats (s, &nfp); + if (nfp > 13) + return 0; + + /* If there are not too many floats, and the struct is + small enough to accommodate in the GPRs, then it must be OK. */ + if (s->size <= 64) + return 1; + + /* Well, we have to look harder. */ + nfp = 0; + if (darwin64_struct_size_exceeds_gprs_p (s, NULL, &nfp)) + return 0; + + return 1; +} + +void +darwin64_pass_struct_floats (ffi_type *s, char *src, + unsigned *nfpr, double **fprs) +{ + int i; + double *fpr_base = *fprs; + unsigned struct_offset = 0; + + /* We don't assume anything about the alignment of the source. */ + for (i = 0; s->elements[i] != NULL; i++) + { + char *item_base; + ffi_type *p = s->elements[i]; + /* Find the start of this item (0 for the first one). */ + if (i > 0) + struct_offset = ALIGN(struct_offset, p->alignment); + item_base = src + struct_offset; + + switch (p->type) + { + case FFI_TYPE_STRUCT: + darwin64_pass_struct_floats (p, item_base, nfpr, + &fpr_base); + break; + case FFI_TYPE_LONGDOUBLE: + if (*nfpr < NUM_FPR_ARG_REGISTERS) + *fpr_base++ = *(double *)item_base; + (*nfpr) += 1; + item_base += 8; + /* FALL THROUGH */ + case FFI_TYPE_DOUBLE: + if (*nfpr < NUM_FPR_ARG_REGISTERS) + *fpr_base++ = *(double *)item_base; + (*nfpr) += 1; + break; + case FFI_TYPE_FLOAT: + if (*nfpr < NUM_FPR_ARG_REGISTERS) + *fpr_base++ = (double) *(float *)item_base; + (*nfpr) += 1; + break; + default: + break; + } + /* now count the size of what we just used. */ + struct_offset += p->size; + } + /* Update the scores. */ + *fprs = fpr_base; +} + +/* Darwin64 special rules. + Break out a struct into params and float registers. */ +static void +darwin64_pass_struct_by_value (ffi_type *s, char *src, unsigned size, + unsigned *nfpr, double **fprs, unsigned long **arg) +{ + unsigned long *next_arg = *arg; + char *dest_cpy = (char *)next_arg; + + FFI_ASSERT (s->type == FFI_TYPE_STRUCT) + + if (!size) + return; + + /* First... special cases. */ + if (size < 3 + || (size == 4 + && s->elements[0] + && s->elements[0]->type != FFI_TYPE_FLOAT)) + { + /* Must be at least one GPR, padding is unspecified in value, + let's make it zero. */ + *next_arg = 0UL; + dest_cpy += 8 - size; + memcpy ((char *) dest_cpy, src, size); + next_arg++; + } + else if (size == 16) + { + memcpy ((char *) dest_cpy, src, size); + next_arg += 2; + } + else + { + /* now the general case, we consider embedded floats. */ + memcpy ((char *) dest_cpy, src, size); + darwin64_pass_struct_floats (s, src, nfpr, fprs); + next_arg += (size+7)/8; + } + + *arg = next_arg; +} + +double * +darwin64_struct_floats_to_mem (ffi_type *s, char *dest, double *fprs, unsigned *nf) +{ + int i; + unsigned struct_offset = 0; + + /* We don't assume anything about the alignment of the source. */ + for (i = 0; s->elements[i] != NULL; i++) + { + char *item_base; + ffi_type *p = s->elements[i]; + /* Find the start of this item (0 for the first one). */ + if (i > 0) + struct_offset = ALIGN(struct_offset, p->alignment); + item_base = dest + struct_offset; + + switch (p->type) + { + case FFI_TYPE_STRUCT: + fprs = darwin64_struct_floats_to_mem (p, item_base, fprs, nf); + break; + case FFI_TYPE_LONGDOUBLE: + if (*nf < NUM_FPR_ARG_REGISTERS) + { + *(double *)item_base = *fprs++ ; + (*nf) += 1; + } + item_base += 8; + /* FALL THROUGH */ + case FFI_TYPE_DOUBLE: + if (*nf < NUM_FPR_ARG_REGISTERS) + { + *(double *)item_base = *fprs++ ; + (*nf) += 1; + } + break; + case FFI_TYPE_FLOAT: + if (*nf < NUM_FPR_ARG_REGISTERS) + { + *(float *)item_base = (float) *fprs++ ; + (*nf) += 1; + } + break; + default: + break; + } + /* now count the size of what we just used. */ + struct_offset += p->size; + } + return fprs; +} + +#endif + /* Adjust the size of S to be correct for Darwin. - On Darwin, the first field of a structure has natural alignment. */ + On Darwin m32, the first field of a structure has natural alignment. + On Darwin m64, all fields have natural alignment. */ static void darwin_adjust_aggregate_sizes (ffi_type *s) @@ -280,22 +587,29 @@ int align; p = s->elements[i]; - darwin_adjust_aggregate_sizes (p); - if (i == 0 - && (p->type == FFI_TYPE_UINT64 - || p->type == FFI_TYPE_SINT64 - || p->type == FFI_TYPE_DOUBLE - || p->alignment == 8)) - align = 8; + if (p->type == FFI_TYPE_STRUCT) + darwin_adjust_aggregate_sizes (p); +#if defined(POWERPC_DARWIN64) + /* Natural alignment for all items. */ + align = p->alignment; +#else + /* Natrual alignment for the first item... */ + if (i == 0) + align = p->alignment; else if (p->alignment == 16 || p->alignment < 4) + /* .. subsequent items with vector or align < 4 have natural align. */ align = p->alignment; else + /* .. or align is 4. */ align = 4; +#endif + /* Pad, if necessary, before adding the current item. */ s->size = ALIGN(s->size, align) + p->size; } s->size = ALIGN(s->size, s->alignment); + /* This should not be necessary on m64, but harmless. */ if (s->elements[0]->type == FFI_TYPE_UINT64 || s->elements[0]->type == FFI_TYPE_SINT64 || s->elements[0]->type == FFI_TYPE_DOUBLE @@ -344,10 +658,10 @@ ffi_prep_cif_machdep (ffi_cif *cif) { /* All this is for the DARWIN ABI. */ - int i; + unsigned i; ffi_type **ptr; unsigned bytes; - int fparg_count = 0, intarg_count = 0; + unsigned fparg_count = 0, intarg_count = 0; unsigned flags = 0; unsigned size_al = 0; @@ -372,16 +686,25 @@ /* Space for the frame pointer, callee's LR, CR, etc, and for the asm's temp regs. */ - bytes = (6 + ASM_NEEDS_REGISTERS) * sizeof(long); + bytes = (LINKAGE_AREA_GPRS + ASM_NEEDS_REGISTERS) * sizeof(unsigned long); - /* Return value handling. The rules are as follows: + /* Return value handling. + The rules m32 are as follows: - 32-bit (or less) integer values are returned in gpr3; - - Structures of size <= 4 bytes also returned in gpr3; - - 64-bit integer values and structures between 5 and 8 bytes are returned - in gpr3 and gpr4; + - structures of size <= 4 bytes also returned in gpr3; + - 64-bit integer values [??? and structures between 5 and 8 bytes] are + returned in gpr3 and gpr4; - Single/double FP values are returned in fpr1; - Long double FP (if not equivalent to double) values are returned in fpr1 and fpr2; + m64: + - 64-bit or smaller integral values are returned in GPR3 + - Single/double FP values are returned in fpr1; + - Long double FP values are returned in fpr1 and fpr2; + m64 Structures: + - If the structure could be accommodated in registers were it to be the + first argument to a routine, then it is returned in those registers. + m32/m64 structures otherwise: - Larger structures values are allocated space and a pointer is passed as the first argument. */ switch (cif->rtype->type) @@ -410,9 +733,42 @@ break; case FFI_TYPE_STRUCT: +#if defined(POWERPC_DARWIN64) + { + /* Can we fit the struct into regs? */ + if (darwin64_struct_ret_by_value_p (cif->rtype)) + { + unsigned nfpr = 0; + flags |= FLAG_RETURNS_STRUCT; + if (cif->rtype->size != 16) + darwin64_scan_struct_for_floats (cif->rtype, &nfpr) ; + else + flags |= FLAG_RETURNS_128BITS; + /* Will be 0 for 16byte struct. */ + if (nfpr) + flags |= FLAG_RETURNS_FP; + } + else /* By ref. */ + { + flags |= FLAG_RETVAL_REFERENCE; + flags |= FLAG_RETURNS_NOTHING; + intarg_count++; + } + } +#elif defined(DARWIN_PPC) + if (cif->rtype->size <= 4) + flags |= FLAG_RETURNS_STRUCT; + else /* else by reference. */ + { + flags |= FLAG_RETVAL_REFERENCE; + flags |= FLAG_RETURNS_NOTHING; + intarg_count++; + } +#else /* assume we pass by ref. */ flags |= FLAG_RETVAL_REFERENCE; flags |= FLAG_RETURNS_NOTHING; intarg_count++; +#endif break; case FFI_TYPE_VOID: flags |= FLAG_RETURNS_NOTHING; @@ -425,57 +781,83 @@ /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest - goes on the stack. Structures are passed as a pointer to a copy of - the structure. Stuff on the stack needs to keep proper alignment. */ + goes on the stack. + ??? Structures are passed as a pointer to a copy of the structure. + Stuff on the stack needs to keep proper alignment. + For m64 the count is effectively of half-GPRs. */ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { + unsigned align_words; switch ((*ptr)->type) { case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: fparg_count++; +#if !defined(POWERPC_DARWIN64) /* If this FP arg is going on the stack, it must be 8-byte-aligned. */ if (fparg_count > NUM_FPR_ARG_REGISTERS - && intarg_count%2 != 0) + && (intarg_count & 0x01) != 0) intarg_count++; +#endif break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: fparg_count += 2; /* If this FP arg is going on the stack, it must be - 8-byte-aligned. */ - if (fparg_count > NUM_FPR_ARG_REGISTERS - && intarg_count%2 != 0) - intarg_count++; - intarg_count +=2; + 16-byte-aligned. */ + if (fparg_count >= NUM_FPR_ARG_REGISTERS) +#if defined (POWERPC64) + intarg_count = ALIGN(intarg_count, 2); +#else + intarg_count = ALIGN(intarg_count, 4); +#endif break; #endif case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: +#if defined(POWERPC64) + intarg_count++; +#else /* 'long long' arguments are passed as two words, but either both words must fit in registers or both go on the stack. If they go on the stack, they must be 8-byte-aligned. */ if (intarg_count == NUM_GPR_ARG_REGISTERS-1 - || (intarg_count >= NUM_GPR_ARG_REGISTERS && intarg_count%2 != 0)) + || (intarg_count >= NUM_GPR_ARG_REGISTERS + && (intarg_count & 0x01) != 0)) intarg_count++; intarg_count += 2; +#endif break; case FFI_TYPE_STRUCT: size_al = (*ptr)->size; +#if defined(POWERPC_DARWIN64) + align_words = (*ptr)->alignment >> 3; + if (align_words) + intarg_count = ALIGN(intarg_count, align_words); + /* Base size of the struct. */ + intarg_count += (size_al + 7) / 8; + /* If 16 bytes then don't worry about floats. */ + if (size_al != 16) + /* Scan through for floats to be placed in regs. */ + darwin64_scan_struct_for_floats (*ptr, &fparg_count) ; +#else + align_words = (*ptr)->alignment >> 2; + if (align_words) + intarg_count = ALIGN(intarg_count, align_words); /* If the first member of the struct is a double, then align - the struct to double-word. */ + the struct to double-word. if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) - size_al = ALIGN((*ptr)->size, 8); -#ifdef POWERPC64 + size_al = ALIGN((*ptr)->size, 8); */ +# ifdef POWERPC64 intarg_count += (size_al + 7) / 8; -#else +# else intarg_count += (size_al + 3) / 4; +# endif #endif break; @@ -490,9 +872,18 @@ if (fparg_count != 0) flags |= FLAG_FP_ARGUMENTS; +#if defined(POWERPC_DARWIN64) + /* Space to image the FPR registers, if needed - which includes when they might be + used in a struct return. */ + if (fparg_count != 0 + || ((flags & FLAG_RETURNS_STRUCT) + && (flags & FLAG_RETURNS_FP))) + bytes += NUM_FPR_ARG_REGISTERS * sizeof(double); +#else /* Space for the FPR registers, if needed. */ if (fparg_count != 0) bytes += NUM_FPR_ARG_REGISTERS * sizeof(double); +#endif /* Stack space. */ #ifdef POWERPC64 @@ -506,7 +897,7 @@ bytes += NUM_GPR_ARG_REGISTERS * sizeof(long); /* The stack space allocated needs to be a multiple of 16 bytes. */ - bytes = (bytes + 15) & ~0xF; + bytes = ALIGN(bytes, 16) ; cif->flags = flags; cif->bytes = bytes; @@ -516,8 +907,9 @@ extern void ffi_call_AIX(extended_cif *, long, unsigned, unsigned *, void (*fn)(void), void (*fn2)(void)); + extern void ffi_call_DARWIN(extended_cif *, long, unsigned, unsigned *, - void (*fn)(void), void (*fn2)(void)); + void (*fn)(void), void (*fn2)(void), ffi_type*); void ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) @@ -542,11 +934,11 @@ { case FFI_AIX: ffi_call_AIX(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn, - ffi_prep_args); + FFI_FN(ffi_prep_args)); break; case FFI_DARWIN: ffi_call_DARWIN(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn, - ffi_prep_args); + FFI_FN(ffi_prep_args), cif->rtype); break; default: FFI_ASSERT(0); @@ -566,58 +958,48 @@ } aix_fd; /* here I'd like to add the stack frame layout we use in darwin_closure.S - and aix_clsoure.S + and aix_closure.S - SP previous -> +---------------------------------------+ <--- child frame - | back chain to caller 4 | - +---------------------------------------+ 4 - | saved CR 4 | - +---------------------------------------+ 8 - | saved LR 4 | - +---------------------------------------+ 12 - | reserved for compilers 4 | - +---------------------------------------+ 16 - | reserved for binders 4 | - +---------------------------------------+ 20 - | saved TOC pointer 4 | - +---------------------------------------+ 24 - | always reserved 8*4=32 (previous GPRs)| - | according to the linkage convention | - | from AIX | - +---------------------------------------+ 56 - | our FPR area 13*8=104 | - | f1 | - | . | - | f13 | - +---------------------------------------+ 160 - | result area 8 | - +---------------------------------------+ 168 - | alignement to the next multiple of 16 | -SP current --> +---------------------------------------+ 176 <- parent frame - | back chain to caller 4 | - +---------------------------------------+ 180 - | saved CR 4 | - +---------------------------------------+ 184 - | saved LR 4 | - +---------------------------------------+ 188 - | reserved for compilers 4 | - +---------------------------------------+ 192 - | reserved for binders 4 | - +---------------------------------------+ 196 - | saved TOC pointer 4 | - +---------------------------------------+ 200 - | always reserved 8*4=32 we store our | - | GPRs here | - | r3 | - | . | - | r10 | - +---------------------------------------+ 232 - | overflow part | - +---------------------------------------+ xxx - | ???? | - +---------------------------------------+ xxx + m32/m64 + + The stack layout looks like this: + + | Additional params... | | Higher address + ~ ~ ~ + | Parameters (at least 8*4/8=32/64) | | NUM_GPR_ARG_REGISTERS + |--------------------------------------------| | + | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | + |--------------------------------------------| | + | Reserved 2*4/8 | | + |--------------------------------------------| | + | Space for callee's LR 4/8 | | + |--------------------------------------------| | + | Saved CR [low word for m64] 4/8 | | + |--------------------------------------------| | + | Current backchain pointer 4/8 |-/ Parent's frame. + |--------------------------------------------| <+ <<< on entry to ffi_closure_ASM + | Result Bytes 16 | | + |--------------------------------------------| | + ~ padding to 16-byte alignment ~ ~ + |--------------------------------------------| | + | NUM_FPR_ARG_REGISTERS slots | | + | here fp13 .. fp1 13*8 | | + |--------------------------------------------| | + | R3..R10 8*4/8=32/64 | | NUM_GPR_ARG_REGISTERS + |--------------------------------------------| | + | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | + |--------------------------------------------| | stack | + | Reserved [compiler,binder] 2*4/8 | | grows | + |--------------------------------------------| | down V + | Space for callee's LR 4/8 | | + |--------------------------------------------| | lower addresses + | Saved CR [low word for m64] 4/8 | | + |--------------------------------------------| | stack pointer here + | Current backchain pointer 4/8 |-/ during + |--------------------------------------------| <<< ffi_closure_ASM. */ + ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, @@ -631,30 +1013,44 @@ switch (cif->abi) { - case FFI_DARWIN: + case FFI_DARWIN: - FFI_ASSERT (cif->abi == FFI_DARWIN); + FFI_ASSERT (cif->abi == FFI_DARWIN); - tramp = (unsigned int *) &closure->tramp[0]; - tramp[0] = 0x7c0802a6; /* mflr r0 */ - tramp[1] = 0x429f000d; /* bcl- 20,4*cr7+so,0x10 */ - tramp[4] = 0x7d6802a6; /* mflr r11 */ - tramp[5] = 0x818b0000; /* lwz r12,0(r11) function address */ - tramp[6] = 0x7c0803a6; /* mtlr r0 */ - tramp[7] = 0x7d8903a6; /* mtctr r12 */ - tramp[8] = 0x816b0004; /* lwz r11,4(r11) static chain */ - tramp[9] = 0x4e800420; /* bctr */ - tramp[2] = (unsigned long) ffi_closure_ASM; /* function */ - tramp[3] = (unsigned long) codeloc; /* context */ + tramp = (unsigned int *) &closure->tramp[0]; +#if defined(POWERPC_DARWIN64) + tramp[0] = 0x7c0802a6; /* mflr r0 */ + tramp[1] = 0x429f0015; /* bcl- 20,4*cr7+so, +0x18 (L1) */ + /* We put the addresses here. */ + tramp[6] = 0x7d6802a6; /*L1: mflr r11 */ + tramp[7] = 0xe98b0000; /* ld r12,0(r11) function address */ + tramp[8] = 0x7c0803a6; /* mtlr r0 */ + tramp[9] = 0x7d8903a6; /* mtctr r12 */ + tramp[10] = 0xe96b0008; /* lwz r11,8(r11) static chain */ + tramp[11] = 0x4e800420; /* bctr */ - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; + *((unsigned long *)&tramp[2]) = (unsigned long) ffi_closure_ASM; /* function */ + *((unsigned long *)&tramp[4]) = (unsigned long) codeloc; /* context */ +#else + tramp[0] = 0x7c0802a6; /* mflr r0 */ + tramp[1] = 0x429f000d; /* bcl- 20,4*cr7+so,0x10 */ + tramp[4] = 0x7d6802a6; /* mflr r11 */ + tramp[5] = 0x818b0000; /* lwz r12,0(r11) function address */ + tramp[6] = 0x7c0803a6; /* mtlr r0 */ + tramp[7] = 0x7d8903a6; /* mtctr r12 */ + tramp[8] = 0x816b0004; /* lwz r11,4(r11) static chain */ + tramp[9] = 0x4e800420; /* bctr */ + tramp[2] = (unsigned long) ffi_closure_ASM; /* function */ + tramp[3] = (unsigned long) codeloc; /* context */ +#endif + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; - /* Flush the icache. Only necessary on Darwin. */ - flush_range(codeloc, FFI_TRAMPOLINE_SIZE); + /* Flush the icache. Only necessary on Darwin. */ + flush_range(codeloc, FFI_TRAMPOLINE_SIZE); - break; + break; case FFI_AIX: @@ -669,10 +1065,10 @@ closure->cif = cif; closure->fun = fun; closure->user_data = user_data; + break; default: - - FFI_ASSERT(0); + return FFI_BAD_ABI; break; } return FFI_OK; @@ -708,7 +1104,7 @@ double d; } ffi_dblfl; -int +ffi_type * ffi_closure_helper_DARWIN (ffi_closure *, void *, unsigned long *, ffi_dblfl *); @@ -719,7 +1115,7 @@ up space for a return value, ffi_closure_ASM invokes the following helper function to do most of the work. */ -int +ffi_type * ffi_closure_helper_DARWIN (ffi_closure *closure, void *rvalue, unsigned long *pgr, ffi_dblfl *pfr) { @@ -741,16 +1137,32 @@ ffi_cif * cif; ffi_dblfl * end_pfr = pfr + NUM_FPR_ARG_REGISTERS; unsigned size_al; +#if defined(POWERPC_DARWIN64) + unsigned fpsused = 0; +#endif cif = closure->cif; avalue = alloca (cif->nargs * sizeof(void *)); - /* Copy the caller's structure return value address so that the closure - returns the data directly to the caller. */ if (cif->rtype->type == FFI_TYPE_STRUCT) { +#if defined(POWERPC_DARWIN64) + if (!darwin64_struct_ret_by_value_p (cif->rtype)) + { + /* Won't fit into the regs - return by ref. */ + rvalue = (void *) *pgr; + pgr++; + } +#elif defined(DARWIN_PPC) + if (cif->rtype->size > 4) + { + rvalue = (void *) *pgr; + pgr++; + } +#else /* assume we return by ref. */ rvalue = (void *) *pgr; pgr++; +#endif } i = 0; @@ -764,7 +1176,7 @@ { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: -#ifdef POWERPC64 +#if defined(POWERPC64) avalue[i] = (char *) pgr + 7; #else avalue[i] = (char *) pgr + 3; @@ -774,7 +1186,7 @@ case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: -#ifdef POWERPC64 +#if defined(POWERPC64) avalue[i] = (char *) pgr + 6; #else avalue[i] = (char *) pgr + 2; @@ -784,7 +1196,7 @@ case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: -#ifdef POWERPC64 +#if defined(POWERPC64) avalue[i] = (char *) pgr + 4; #else case FFI_TYPE_POINTER: @@ -794,34 +1206,53 @@ break; case FFI_TYPE_STRUCT: -#ifdef POWERPC64 size_al = arg_types[i]->size; - if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE) - size_al = ALIGN (arg_types[i]->size, 8); - if (size_al < 3 && cif->abi == FFI_DARWIN) - avalue[i] = (void *) pgr + 8 - size_al; - else - avalue[i] = (void *) pgr; +#if defined(POWERPC_DARWIN64) + pgr = (unsigned long *)ALIGN((char *)pgr, arg_types[i]->alignment); + if (size_al < 3 || size_al == 4) + { + avalue[i] = ((char *)pgr)+8-size_al; + if (arg_types[i]->elements[0]->type == FFI_TYPE_FLOAT + && fpsused < NUM_FPR_ARG_REGISTERS) + { + *(float *)pgr = (float) *(double *)pfr; + pfr++; + fpsused++; + } + } + else + { + if (size_al != 16) + pfr = (ffi_dblfl *) + darwin64_struct_floats_to_mem (arg_types[i], (char *)pgr, + (double *)pfr, &fpsused); + avalue[i] = pgr; + } pgr += (size_al + 7) / 8; #else - /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, - SI 4 bytes) are aligned as if they were those modes. */ - size_al = arg_types[i]->size; /* If the first member of the struct is a double, then align the struct to double-word. */ if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE) size_al = ALIGN(arg_types[i]->size, 8); +# if defined(POWERPC64) + FFI_ASSERT (cif->abi != FFI_DARWIN); + avalue[i] = pgr; + pgr += (size_al + 7) / 8; +# else + /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, + SI 4 bytes) are aligned as if they were those modes. */ if (size_al < 3 && cif->abi == FFI_DARWIN) - avalue[i] = (void*) pgr + 4 - size_al; + avalue[i] = (char*) pgr + 4 - size_al; else - avalue[i] = (void*) pgr; + avalue[i] = pgr; pgr += (size_al + 3) / 4; +# endif #endif break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: -#ifdef POWERPC64 +#if defined(POWERPC64) case FFI_TYPE_POINTER: avalue[i] = pgr; pgr++; @@ -924,5 +1355,5 @@ (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_ASM to perform return type promotions. */ - return cif->rtype->type; + return cif->rtype; } diff --git a/Modules/_ctypes/libffi/src/powerpc/ffitarget.h b/Modules/_ctypes/libffi/src/powerpc/ffitarget.h --- a/Modules/_ctypes/libffi/src/powerpc/ffitarget.h +++ b/Modules/_ctypes/libffi/src/powerpc/ffitarget.h @@ -1,6 +1,8 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. - Copyright (C) 2007, 2008 Free Software Foundation, Inc + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (C) 2007, 2008, 2010 Free Software Foundation, Inc + Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for PowerPC. Permission is hereby granted, free of charge, to any person obtaining @@ -28,15 +30,28 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- System specific configurations ----------------------------------- */ #if defined (POWERPC) && defined (__powerpc64__) /* linux64 */ +#ifndef POWERPC64 #define POWERPC64 -#elif defined (POWERPC_DARWIN) && defined (__ppc64__) /* Darwin */ +#endif +#elif defined (POWERPC_DARWIN) && defined (__ppc64__) /* Darwin64 */ +#ifndef POWERPC64 #define POWERPC64 +#endif +#ifndef POWERPC_DARWIN64 +#define POWERPC_DARWIN64 +#endif #elif defined (POWERPC_AIX) && defined (__64BIT__) /* AIX64 */ +#ifndef POWERPC64 #define POWERPC64 #endif +#endif #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; @@ -51,18 +66,14 @@ FFI_LINUX64, FFI_LINUX, FFI_LINUX_SOFT_FLOAT, -# ifdef POWERPC64 +# if defined(POWERPC64) FFI_DEFAULT_ABI = FFI_LINUX64, +# elif defined(__NO_FPRS__) + FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT, +# elif (__LDBL_MANT_DIG__ == 106) + FFI_DEFAULT_ABI = FFI_LINUX, # else -# if (!defined(__NO_FPRS__) && (__LDBL_MANT_DIG__ == 106)) - FFI_DEFAULT_ABI = FFI_LINUX, -# else -# ifdef __NO_FPRS__ - FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT, -# else FFI_DEFAULT_ABI = FFI_GCC_SYSV, -# endif -# endif # endif #endif @@ -108,9 +119,13 @@ #define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2) #if defined(POWERPC64) || defined(POWERPC_AIX) -#define FFI_TRAMPOLINE_SIZE 24 +# if defined(POWERPC_DARWIN64) +# define FFI_TRAMPOLINE_SIZE 48 +# else +# define FFI_TRAMPOLINE_SIZE 24 +# endif #else /* POWERPC || POWERPC_AIX */ -#define FFI_TRAMPOLINE_SIZE 40 +# define FFI_TRAMPOLINE_SIZE 40 #endif #ifndef LIBFFI_ASM diff --git a/Modules/_ctypes/libffi/src/powerpc/linux64.S b/Modules/_ctypes/libffi/src/powerpc/linux64.S --- a/Modules/_ctypes/libffi/src/powerpc/linux64.S +++ b/Modules/_ctypes/libffi/src/powerpc/linux64.S @@ -30,16 +30,25 @@ #include #ifdef __powerpc64__ - .hidden ffi_call_LINUX64, .ffi_call_LINUX64 - .globl ffi_call_LINUX64, .ffi_call_LINUX64 + .hidden ffi_call_LINUX64 + .globl ffi_call_LINUX64 .section ".opd","aw" .align 3 ffi_call_LINUX64: +#ifdef _CALL_LINUX + .quad .L.ffi_call_LINUX64,.TOC. at tocbase,0 + .type ffi_call_LINUX64, at function + .text +.L.ffi_call_LINUX64: +#else + .hidden .ffi_call_LINUX64 + .globl .ffi_call_LINUX64 .quad .ffi_call_LINUX64,.TOC. at tocbase,0 .size ffi_call_LINUX64,24 .type .ffi_call_LINUX64, at function .text .ffi_call_LINUX64: +#endif .LFB1: mflr %r0 std %r28, -32(%r1) @@ -58,7 +67,11 @@ /* Call ffi_prep_args64. */ mr %r4, %r1 +#ifdef _CALL_LINUX + bl ffi_prep_args64 +#else bl .ffi_prep_args64 +#endif ld %r0, 0(%r29) ld %r2, 8(%r29) @@ -137,7 +150,11 @@ .LFE1: .long 0 .byte 0,12,0,1,128,4,0,0 +#ifdef _CALL_LINUX + .size ffi_call_LINUX64,.-.L.ffi_call_LINUX64 +#else .size .ffi_call_LINUX64,.-.ffi_call_LINUX64 +#endif .section .eh_frame,EH_FRAME_FLAGS, at progbits .Lframe1: diff --git a/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S b/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S --- a/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S +++ b/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S @@ -32,16 +32,24 @@ #ifdef __powerpc64__ FFI_HIDDEN (ffi_closure_LINUX64) - FFI_HIDDEN (.ffi_closure_LINUX64) - .globl ffi_closure_LINUX64, .ffi_closure_LINUX64 + .globl ffi_closure_LINUX64 .section ".opd","aw" .align 3 ffi_closure_LINUX64: +#ifdef _CALL_LINUX + .quad .L.ffi_closure_LINUX64,.TOC. at tocbase,0 + .type ffi_closure_LINUX64, at function + .text +.L.ffi_closure_LINUX64: +#else + FFI_HIDDEN (.ffi_closure_LINUX64) + .globl .ffi_closure_LINUX64 .quad .ffi_closure_LINUX64,.TOC. at tocbase,0 .size ffi_closure_LINUX64,24 .type .ffi_closure_LINUX64, at function .text .ffi_closure_LINUX64: +#endif .LFB1: # save general regs into parm save area std %r3, 48(%r1) @@ -91,7 +99,11 @@ addi %r6, %r1, 128 # make the call +#ifdef _CALL_LINUX + bl ffi_closure_helper_LINUX64 +#else bl .ffi_closure_helper_LINUX64 +#endif .Lret: # now r3 contains the return type @@ -194,7 +206,11 @@ .LFE1: .long 0 .byte 0,12,0,1,128,0,0,0 +#ifdef _CALL_LINUX + .size ffi_closure_LINUX64,.-.L.ffi_closure_LINUX64 +#else .size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64 +#endif .section .eh_frame,EH_FRAME_FLAGS, at progbits .Lframe1: diff --git a/Modules/_ctypes/libffi/src/powerpc/ppc_closure.S b/Modules/_ctypes/libffi/src/powerpc/ppc_closure.S --- a/Modules/_ctypes/libffi/src/powerpc/ppc_closure.S +++ b/Modules/_ctypes/libffi/src/powerpc/ppc_closure.S @@ -122,22 +122,41 @@ blr # case FFI_TYPE_FLOAT +#ifndef __NO_FPRS__ lfs %f1,112+0(%r1) mtlr %r0 addi %r1,%r1,144 +#else + nop + nop + nop +#endif blr # case FFI_TYPE_DOUBLE +#ifndef __NO_FPRS__ lfd %f1,112+0(%r1) mtlr %r0 addi %r1,%r1,144 +#else + nop + nop + nop +#endif blr # case FFI_TYPE_LONGDOUBLE +#ifndef __NO_FPRS__ lfd %f1,112+0(%r1) lfd %f2,112+8(%r1) mtlr %r0 b .Lfinish +#else + nop + nop + nop + blr +#endif # case FFI_TYPE_UINT8 lbz %r3,112+3(%r1) diff --git a/Modules/_ctypes/libffi/src/powerpc/sysv.S b/Modules/_ctypes/libffi/src/powerpc/sysv.S --- a/Modules/_ctypes/libffi/src/powerpc/sysv.S +++ b/Modules/_ctypes/libffi/src/powerpc/sysv.S @@ -83,6 +83,7 @@ nop 1: +#ifndef __NO_FPRS__ /* Load all the FP registers. */ bf- 6,2f lfd %f1,-16-(8*4)-(8*8)(%r28) @@ -94,6 +95,7 @@ lfd %f6,-16-(8*4)-(3*8)(%r28) lfd %f7,-16-(8*4)-(2*8)(%r28) lfd %f8,-16-(8*4)-(1*8)(%r28) +#endif 2: /* Make the call. */ @@ -103,7 +105,9 @@ mtcrf 0x01,%r31 /* cr7 */ bt- 31,L(small_struct_return_value) bt- 30,L(done_return_value) +#ifndef __NO_FPRS__ bt- 29,L(fp_return_value) +#endif stw %r3,0(%r30) bf+ 28,L(done_return_value) stw %r4,4(%r30) @@ -124,6 +128,7 @@ lwz %r1,0(%r1) blr +#ifndef __NO_FPRS__ L(fp_return_value): bf 28,L(float_return_value) stfd %f1,0(%r30) @@ -134,6 +139,7 @@ L(float_return_value): stfs %f1,0(%r30) b L(done_return_value) +#endif L(small_struct_return_value): extrwi %r6,%r31,2,19 /* number of bytes padding = shift/8 */ diff --git a/Modules/_ctypes/libffi/src/prep_cif.c b/Modules/_ctypes/libffi/src/prep_cif.c --- a/Modules/_ctypes/libffi/src/prep_cif.c +++ b/Modules/_ctypes/libffi/src/prep_cif.c @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - prep_cif.c - Copyright (c) 1996, 1998, 2007 Red Hat, Inc. + prep_cif.c - Copyright (c) 2011, 2012 Anthony Green + Copyright (c) 1996, 1998, 2007 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -37,17 +38,21 @@ { ffi_type **ptr; - FFI_ASSERT(arg != NULL); + if (UNLIKELY(arg == NULL || arg->elements == NULL)) + return FFI_BAD_TYPEDEF; - FFI_ASSERT(arg->elements != NULL); - FFI_ASSERT(arg->size == 0); - FFI_ASSERT(arg->alignment == 0); + arg->size = 0; + arg->alignment = 0; ptr = &(arg->elements[0]); + if (UNLIKELY(ptr == 0)) + return FFI_BAD_TYPEDEF; + while ((*ptr) != NULL) { - if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) + if (UNLIKELY(((*ptr)->size == 0) + && (initialize_aggregate((*ptr)) != FFI_OK))) return FFI_BAD_TYPEDEF; /* Perform a sanity check on the argument type */ @@ -85,19 +90,38 @@ /* Perform machine independent ffi_cif preparation, then call machine dependent routine. */ -ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, - ffi_type *rtype, ffi_type **atypes) +/* For non variadic functions isvariadic should be 0 and + nfixedargs==ntotalargs. + + For variadic calls, isvariadic should be 1 and nfixedargs + and ntotalargs set as appropriate. nfixedargs must always be >=1 */ + + +ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi, + unsigned int isvariadic, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type *rtype, ffi_type **atypes) { unsigned bytes = 0; unsigned int i; ffi_type **ptr; FFI_ASSERT(cif != NULL); - FFI_ASSERT((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI)); + FFI_ASSERT((!isvariadic) || (nfixedargs >= 1)); + FFI_ASSERT(nfixedargs <= ntotalargs); + +#ifndef X86_WIN32 + if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI)) + return FFI_BAD_ABI; +#else + if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI || abi == FFI_THISCALL)) + return FFI_BAD_ABI; +#endif cif->abi = abi; cif->arg_types = atypes; - cif->nargs = nargs; + cif->nargs = ntotalargs; cif->rtype = rtype; cif->flags = 0; @@ -110,12 +134,19 @@ FFI_ASSERT_VALID_TYPE(cif->rtype); /* x86, x86-64 and s390 stack space allocation is handled in prep_machdep. */ -#if !defined M68K && !defined __i386__ && !defined __x86_64__ && !defined S390 && !defined PA +#if !defined M68K && !defined X86_ANY && !defined S390 && !defined PA /* Make space for the return structure pointer */ if (cif->rtype->type == FFI_TYPE_STRUCT #ifdef SPARC && (cif->abi != FFI_V9 || cif->rtype->size > 32) #endif +#ifdef TILE + && (cif->rtype->size > 10 * FFI_SIZEOF_ARG) +#endif +#ifdef XTENSA + && (cif->rtype->size > 16) +#endif + ) bytes = STACK_ARG_SIZE(sizeof(void*)); #endif @@ -131,7 +162,7 @@ check after the initialization. */ FFI_ASSERT_VALID_TYPE(*ptr); -#if !defined __i386__ && !defined __x86_64__ && !defined S390 && !defined PA +#if !defined X86_ANY && !defined S390 && !defined PA #ifdef SPARC if (((*ptr)->type == FFI_TYPE_STRUCT && ((*ptr)->size > 16 || cif->abi != FFI_V9)) @@ -145,6 +176,20 @@ if (((*ptr)->alignment - 1) & bytes) bytes = ALIGN(bytes, (*ptr)->alignment); +#ifdef TILE + if (bytes < 10 * FFI_SIZEOF_ARG && + bytes + STACK_ARG_SIZE((*ptr)->size) > 10 * FFI_SIZEOF_ARG) + { + /* An argument is never split between the 10 parameter + registers and the stack. */ + bytes = 10 * FFI_SIZEOF_ARG; + } +#endif +#ifdef XTENSA + if (bytes <= 6*4 && bytes + STACK_ARG_SIZE((*ptr)->size) > 6*4) + bytes = 6*4; +#endif + bytes += STACK_ARG_SIZE((*ptr)->size); } #endif @@ -153,10 +198,31 @@ cif->bytes = bytes; /* Perform machine dependent cif processing */ +#ifdef FFI_TARGET_SPECIFIC_VARIADIC + if (isvariadic) + return ffi_prep_cif_machdep_var(cif, nfixedargs, ntotalargs); +#endif + return ffi_prep_cif_machdep(cif); } #endif /* not __CRIS__ */ +ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, + ffi_type *rtype, ffi_type **atypes) +{ + return ffi_prep_cif_core(cif, abi, 0, nargs, nargs, rtype, atypes); +} + +ffi_status ffi_prep_cif_var(ffi_cif *cif, + ffi_abi abi, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type *rtype, + ffi_type **atypes) +{ + return ffi_prep_cif_core(cif, abi, 1, nfixedargs, ntotalargs, rtype, atypes); +} + #if FFI_CLOSURES ffi_status diff --git a/Modules/_ctypes/libffi/src/s390/ffi.c b/Modules/_ctypes/libffi/src/s390/ffi.c --- a/Modules/_ctypes/libffi/src/s390/ffi.c +++ b/Modules/_ctypes/libffi/src/s390/ffi.c @@ -750,7 +750,8 @@ void *user_data, void *codeloc) { - FFI_ASSERT (cif->abi == FFI_SYSV); + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; #ifndef __s390x__ *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */ diff --git a/Modules/_ctypes/libffi/src/s390/ffitarget.h b/Modules/_ctypes/libffi/src/s390/ffitarget.h --- a/Modules/_ctypes/libffi/src/s390/ffitarget.h +++ b/Modules/_ctypes/libffi/src/s390/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for S390. Permission is hereby granted, free of charge, to any person obtaining @@ -27,9 +28,15 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #if defined (__s390x__) +#ifndef S390X #define S390X #endif +#endif /* ---- System specific configurations ----------------------------------- */ @@ -40,8 +47,8 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/sh/ffi.c b/Modules/_ctypes/libffi/src/sh/ffi.c --- a/Modules/_ctypes/libffi/src/sh/ffi.c +++ b/Modules/_ctypes/libffi/src/sh/ffi.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Kaz Kojima + ffi.c - Copyright (c) 2002-2008, 2012 Kaz Kojima Copyright (c) 2008 Red Hat, Inc. SuperH Foreign Function Interface @@ -463,7 +463,8 @@ unsigned int *tramp; unsigned int insn; - FFI_ASSERT (cif->abi == FFI_GCC_SYSV); + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; tramp = (unsigned int *) &closure->tramp[0]; /* Set T bit if the function returns a struct pointed with R2. */ diff --git a/Modules/_ctypes/libffi/src/sh/ffitarget.h b/Modules/_ctypes/libffi/src/sh/ffitarget.h --- a/Modules/_ctypes/libffi/src/sh/ffitarget.h +++ b/Modules/_ctypes/libffi/src/sh/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for SuperH. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM @@ -36,8 +41,8 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/sh64/ffi.c b/Modules/_ctypes/libffi/src/sh64/ffi.c --- a/Modules/_ctypes/libffi/src/sh64/ffi.c +++ b/Modules/_ctypes/libffi/src/sh64/ffi.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2003, 2004, 2006, 2007 Kaz Kojima + ffi.c - Copyright (c) 2003, 2004, 2006, 2007, 2012 Kaz Kojima Copyright (c) 2008 Anthony Green SuperH SHmedia Foreign Function Interface @@ -302,7 +302,8 @@ { unsigned int *tramp; - FFI_ASSERT (cif->abi == FFI_GCC_SYSV); + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; tramp = (unsigned int *) &closure->tramp[0]; /* Since ffi_closure is an aligned object, the ffi trampoline is diff --git a/Modules/_ctypes/libffi/src/sh64/ffitarget.h b/Modules/_ctypes/libffi/src/sh64/ffitarget.h --- a/Modules/_ctypes/libffi/src/sh64/ffitarget.h +++ b/Modules/_ctypes/libffi/src/sh64/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for SuperH - SHmedia. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM @@ -36,8 +41,8 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #define FFI_EXTRA_CIF_FIELDS long long flags2 diff --git a/Modules/_ctypes/libffi/src/sparc/ffi.c b/Modules/_ctypes/libffi/src/sparc/ffi.c --- a/Modules/_ctypes/libffi/src/sparc/ffi.c +++ b/Modules/_ctypes/libffi/src/sparc/ffi.c @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1996, 2003, 2004, 2007, 2008 Red Hat, Inc. + ffi.c - Copyright (c) 2011, 2013 Anthony Green + Copyright (c) 1996, 2003-2004, 2007-2008 Red Hat, Inc. SPARC Foreign Function Interface @@ -375,6 +376,10 @@ unsigned, unsigned *, void (*fn)(void)); #endif +#ifndef __GNUC__ +void ffi_flush_icache (void *, size_t); +#endif + void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; @@ -406,8 +411,54 @@ /* We don't yet support calling 32bit code from 64bit */ FFI_ASSERT(0); #else - ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes, - cif->flags, rvalue, fn); + if (rvalue && (cif->rtype->type == FFI_TYPE_STRUCT +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + || cif->flags == FFI_TYPE_LONGDOUBLE +#endif + )) + { + /* For v8, we need an "unimp" with size of returning struct */ + /* behind "call", so we alloc some executable space for it. */ + /* l7 is used, we need to make sure v8.S doesn't use %l7. */ + unsigned int *call_struct = NULL; + ffi_closure_alloc(32, (void **)&call_struct); + if (call_struct) + { + unsigned long f = (unsigned long)fn; + call_struct[0] = 0xae10001f; /* mov %i7, %l7 */ + call_struct[1] = 0xbe10000f; /* mov %o7, %i7 */ + call_struct[2] = 0x03000000 | f >> 10; /* sethi %hi(fn), %g1 */ + call_struct[3] = 0x9fc06000 | (f & 0x3ff); /* jmp %g1+%lo(fn), %o7 */ + call_struct[4] = 0x01000000; /* nop */ + if (cif->rtype->size < 0x7f) + call_struct[5] = cif->rtype->size; /* unimp */ + else + call_struct[5] = 0x01000000; /* nop */ + call_struct[6] = 0x81c7e008; /* ret */ + call_struct[7] = 0xbe100017; /* mov %l7, %i7 */ +#ifdef __GNUC__ + asm volatile ("iflush %0; iflush %0+8; iflush %0+16; iflush %0+24" : : + "r" (call_struct) : "memory"); + /* SPARC v8 requires 5 instructions for flush to be visible */ + asm volatile ("nop; nop; nop; nop; nop"); +#else + ffi_flush_icache (call_struct, 32); +#endif + ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes, + cif->flags, rvalue, call_struct); + ffi_closure_free(call_struct); + } + else + { + ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes, + cif->flags, rvalue, fn); + } + } + else + { + ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes, + cif->flags, rvalue, fn); + } #endif break; case FFI_V9: @@ -425,7 +476,6 @@ FFI_ASSERT(0); break; } - } @@ -447,7 +497,8 @@ #ifdef SPARC64 /* Trampoline address is equal to the closure address. We take advantage of that to reduce the trampoline size by 8 bytes. */ - FFI_ASSERT (cif->abi == FFI_V9); + if (cif->abi != FFI_V9) + return FFI_BAD_ABI; fn = (unsigned long) ffi_closure_v9; tramp[0] = 0x83414000; /* rd %pc, %g1 */ tramp[1] = 0xca586010; /* ldx [%g1+16], %g5 */ @@ -456,7 +507,8 @@ *((unsigned long *) &tramp[4]) = fn; #else unsigned long ctx = (unsigned long) codeloc; - FFI_ASSERT (cif->abi == FFI_V8); + if (cif->abi != FFI_V8) + return FFI_BAD_ABI; fn = (unsigned long) ffi_closure_v8; tramp[0] = 0x03000000 | fn >> 10; /* sethi %hi(fn), %g1 */ tramp[1] = 0x05000000 | ctx >> 10; /* sethi %hi(ctx), %g2 */ @@ -468,13 +520,17 @@ closure->fun = fun; closure->user_data = user_data; - /* Flush the Icache. FIXME: alignment isn't certain, assume 8 bytes */ + /* Flush the Icache. closure is 8 bytes aligned. */ +#ifdef __GNUC__ #ifdef SPARC64 - asm volatile ("flush %0" : : "r" (closure) : "memory"); - asm volatile ("flush %0" : : "r" (((char *) closure) + 8) : "memory"); + asm volatile ("flush %0; flush %0+8" : : "r" (closure) : "memory"); #else - asm volatile ("iflush %0" : : "r" (closure) : "memory"); - asm volatile ("iflush %0" : : "r" (((char *) closure) + 8) : "memory"); + asm volatile ("iflush %0; iflush %0+8" : : "r" (closure) : "memory"); + /* SPARC v8 requires 5 instructions for flush to be visible */ + asm volatile ("nop; nop; nop; nop; nop"); +#endif +#else + ffi_flush_icache (closure, 16); #endif return FFI_OK; diff --git a/Modules/_ctypes/libffi/src/sparc/ffitarget.h b/Modules/_ctypes/libffi/src/sparc/ffitarget.h --- a/Modules/_ctypes/libffi/src/sparc/ffitarget.h +++ b/Modules/_ctypes/libffi/src/sparc/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for SPARC. Permission is hereby granted, free of charge, to any person obtaining @@ -27,11 +28,17 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- System specific configurations ----------------------------------- */ #if defined(__arch64__) || defined(__sparcv9) +#ifndef SPARC64 #define SPARC64 #endif +#endif #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; @@ -42,12 +49,12 @@ FFI_V8, FFI_V8PLUS, FFI_V9, + FFI_LAST_ABI, #ifdef SPARC64 - FFI_DEFAULT_ABI = FFI_V9, + FFI_DEFAULT_ABI = FFI_V9 #else - FFI_DEFAULT_ABI = FFI_V8, + FFI_DEFAULT_ABI = FFI_V8 #endif - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/sparc/v8.S b/Modules/_ctypes/libffi/src/sparc/v8.S --- a/Modules/_ctypes/libffi/src/sparc/v8.S +++ b/Modules/_ctypes/libffi/src/sparc/v8.S @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - v8.S - Copyright (c) 1996, 1997, 2003, 2004, 2008 Red Hat, Inc. + v8.S - Copyright (c) 2013 The Written Word, Inc. + Copyright (c) 1996, 1997, 2003, 2004, 2008 Red Hat, Inc. SPARC Foreign Function Interface @@ -31,11 +32,39 @@ #define STACKFRAME 96 /* Minimum stack framesize for SPARC */ #define ARGS (64+4) /* Offset of register area in frame */ -.text +#ifndef __GNUC__ + .text + .align 8 +.globl ffi_flush_icache +.globl _ffi_flush_icache + +ffi_flush_icache: +_ffi_flush_icache: + add %o0, %o1, %o2 +#ifdef SPARC64 +1: flush %o0 +#else +1: iflush %o0 +#endif + add %o0, 8, %o0 + cmp %o0, %o2 + blt 1b + nop + nop + nop + nop + nop + retl + nop +.ffi_flush_icache_end: + .size ffi_flush_icache,.ffi_flush_icache_end-ffi_flush_icache +#endif + + .text .align 8 .globl ffi_call_v8 .globl _ffi_call_v8 - + ffi_call_v8: _ffi_call_v8: .LLFB1: diff --git a/Modules/_ctypes/libffi/src/sparc/v9.S b/Modules/_ctypes/libffi/src/sparc/v9.S --- a/Modules/_ctypes/libffi/src/sparc/v9.S +++ b/Modules/_ctypes/libffi/src/sparc/v9.S @@ -32,7 +32,7 @@ /* Only compile this in for 64bit builds, because otherwise the object file will have inproper architecture due to used instructions. */ -#define STACKFRAME 128 /* Minimum stack framesize for SPARC */ +#define STACKFRAME 176 /* Minimum stack framesize for SPARC 64-bit */ #define STACK_BIAS 2047 #define ARGS (128) /* Offset of register area in frame */ diff --git a/Modules/_ctypes/libffi/src/tile/ffi.c b/Modules/_ctypes/libffi/src/tile/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/tile/ffi.c @@ -0,0 +1,355 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2012 Tilera Corp. + + TILE Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include +#include +#include +#include +#include +#include +#include + + +/* The first 10 registers are used to pass arguments and return values. */ +#define NUM_ARG_REGS 10 + +/* Performs a raw function call with the given NUM_ARG_REGS register arguments + and the specified additional stack arguments (if any). */ +extern void ffi_call_tile(ffi_sarg reg_args[NUM_ARG_REGS], + const ffi_sarg *stack_args, + size_t stack_args_bytes, + void (*fnaddr)(void)) + FFI_HIDDEN; + +/* This handles the raw call from the closure stub, cleaning up the + parameters and delegating to ffi_closure_tile_inner. */ +extern void ffi_closure_tile(void) FFI_HIDDEN; + + +ffi_status +ffi_prep_cif_machdep(ffi_cif *cif) +{ + /* We always allocate room for all registers. Even if we don't + use them as parameters, they get returned in the same array + as struct return values so we need to make room. */ + if (cif->bytes < NUM_ARG_REGS * FFI_SIZEOF_ARG) + cif->bytes = NUM_ARG_REGS * FFI_SIZEOF_ARG; + + if (cif->rtype->size > NUM_ARG_REGS * FFI_SIZEOF_ARG) + cif->flags = FFI_TYPE_STRUCT; + else + cif->flags = FFI_TYPE_INT; + + /* Nothing to do. */ + return FFI_OK; +} + + +static long +assign_to_ffi_arg(ffi_sarg *out, void *in, const ffi_type *type, + int write_to_reg) +{ + switch (type->type) + { + case FFI_TYPE_SINT8: + *out = *(SINT8 *)in; + return 1; + + case FFI_TYPE_UINT8: + *out = *(UINT8 *)in; + return 1; + + case FFI_TYPE_SINT16: + *out = *(SINT16 *)in; + return 1; + + case FFI_TYPE_UINT16: + *out = *(UINT16 *)in; + return 1; + + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: +#ifndef __LP64__ + case FFI_TYPE_POINTER: +#endif + /* Note that even unsigned 32-bit quantities are sign extended + on tilegx when stored in a register. */ + *out = *(SINT32 *)in; + return 1; + + case FFI_TYPE_FLOAT: +#ifdef __tilegx__ + if (write_to_reg) + { + /* Properly sign extend the value. */ + union { float f; SINT32 s32; } val; + val.f = *(float *)in; + *out = val.s32; + } + else +#endif + { + *(float *)out = *(float *)in; + } + return 1; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_DOUBLE: +#ifdef __LP64__ + case FFI_TYPE_POINTER: +#endif + *(UINT64 *)out = *(UINT64 *)in; + return sizeof(UINT64) / FFI_SIZEOF_ARG; + + case FFI_TYPE_STRUCT: + memcpy(out, in, type->size); + return (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG; + + case FFI_TYPE_VOID: + /* Must be a return type. Nothing to do. */ + return 0; + + default: + FFI_ASSERT(0); + return -1; + } +} + + +void +ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + ffi_sarg * const arg_mem = alloca(cif->bytes); + ffi_sarg * const reg_args = arg_mem; + ffi_sarg * const stack_args = ®_args[NUM_ARG_REGS]; + ffi_sarg *argp = arg_mem; + ffi_type ** const arg_types = cif->arg_types; + const long num_args = cif->nargs; + long i; + + if (cif->flags == FFI_TYPE_STRUCT) + { + /* Pass a hidden pointer to the return value. We make sure there + is scratch space for the callee to store the return value even if + our caller doesn't care about it. */ + *argp++ = (intptr_t)(rvalue ? rvalue : alloca(cif->rtype->size)); + + /* No more work needed to return anything. */ + rvalue = NULL; + } + + for (i = 0; i < num_args; i++) + { + ffi_type *type = arg_types[i]; + void * const arg_in = avalue[i]; + ptrdiff_t arg_word = argp - arg_mem; + +#ifndef __tilegx__ + /* Doubleword-aligned values are always in an even-number register + pair, or doubleword-aligned stack slot if out of registers. */ + long align = arg_word & (type->alignment > FFI_SIZEOF_ARG); + argp += align; + arg_word += align; +#endif + + if (type->type == FFI_TYPE_STRUCT) + { + const size_t arg_size_in_words = + (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG; + + if (arg_word < NUM_ARG_REGS && + arg_word + arg_size_in_words > NUM_ARG_REGS) + { + /* Args are not allowed to span registers and the stack. */ + argp = stack_args; + } + + memcpy(argp, arg_in, type->size); + argp += arg_size_in_words; + } + else + { + argp += assign_to_ffi_arg(argp, arg_in, arg_types[i], 1); + } + } + + /* Actually do the call. */ + ffi_call_tile(reg_args, stack_args, + cif->bytes - (NUM_ARG_REGS * FFI_SIZEOF_ARG), fn); + + if (rvalue != NULL) + assign_to_ffi_arg(rvalue, reg_args, cif->rtype, 0); +} + + +/* Template code for closure. */ +extern const UINT64 ffi_template_tramp_tile[] FFI_HIDDEN; + + +ffi_status +ffi_prep_closure_loc (ffi_closure *closure, + ffi_cif *cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) +{ +#ifdef __tilegx__ + /* TILE-Gx */ + SINT64 c; + SINT64 h; + int s; + UINT64 *out; + + if (cif->abi != FFI_UNIX) + return FFI_BAD_ABI; + + out = (UINT64 *)closure->tramp; + + c = (intptr_t)closure; + h = (intptr_t)ffi_closure_tile; + s = 0; + + /* Find the smallest shift count that doesn't lose information + (i.e. no need to explicitly insert high bits of the address that + are just the sign extension of the low bits). */ + while ((c >> s) != (SINT16)(c >> s) || (h >> s) != (SINT16)(h >> s)) + s += 16; + +#define OPS(a, b, shift) \ + (create_Imm16_X0((a) >> (shift)) | create_Imm16_X1((b) >> (shift))) + + /* Emit the moveli. */ + *out++ = ffi_template_tramp_tile[0] | OPS(c, h, s); + for (s -= 16; s >= 0; s -= 16) + *out++ = ffi_template_tramp_tile[1] | OPS(c, h, s); + +#undef OPS + + *out++ = ffi_template_tramp_tile[2]; + +#else + /* TILEPro */ + UINT64 *out; + intptr_t delta; + + if (cif->abi != FFI_UNIX) + return FFI_BAD_ABI; + + out = (UINT64 *)closure->tramp; + delta = (intptr_t)ffi_closure_tile - (intptr_t)codeloc; + + *out++ = ffi_template_tramp_tile[0] | create_JOffLong_X1(delta >> 3); +#endif + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + invalidate_icache(closure->tramp, (char *)out - closure->tramp, + getpagesize()); + + return FFI_OK; +} + + +/* This is called by the assembly wrapper for closures. This does + all of the work. On entry reg_args[0] holds the values the registers + had when the closure was invoked. On return reg_args[1] holds the register + values to be returned to the caller (many of which may be garbage). */ +void FFI_HIDDEN +ffi_closure_tile_inner(ffi_closure *closure, + ffi_sarg reg_args[2][NUM_ARG_REGS], + ffi_sarg *stack_args) +{ + ffi_cif * const cif = closure->cif; + void ** const avalue = alloca(cif->nargs * sizeof(void *)); + void *rvalue; + ffi_type ** const arg_types = cif->arg_types; + ffi_sarg * const reg_args_in = reg_args[0]; + ffi_sarg * const reg_args_out = reg_args[1]; + ffi_sarg * argp; + long i, arg_word, nargs = cif->nargs; + /* Use a union to guarantee proper alignment for double. */ + union { ffi_sarg arg[NUM_ARG_REGS]; double d; UINT64 u64; } closure_ret; + + /* Start out reading register arguments. */ + argp = reg_args_in; + + /* Copy the caller's structure return address to that the closure + returns the data directly to the caller. */ + if (cif->flags == FFI_TYPE_STRUCT) + { + /* Return by reference via hidden pointer. */ + rvalue = (void *)(intptr_t)*argp++; + arg_word = 1; + } + else + { + /* Return the value in registers. */ + rvalue = &closure_ret; + arg_word = 0; + } + + /* Grab the addresses of the arguments. */ + for (i = 0; i < nargs; i++) + { + ffi_type * const type = arg_types[i]; + const size_t arg_size_in_words = + (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG; + +#ifndef __tilegx__ + /* Doubleword-aligned values are always in an even-number register + pair, or doubleword-aligned stack slot if out of registers. */ + long align = arg_word & (type->alignment > FFI_SIZEOF_ARG); + argp += align; + arg_word += align; +#endif + + if (arg_word == NUM_ARG_REGS || + (arg_word < NUM_ARG_REGS && + arg_word + arg_size_in_words > NUM_ARG_REGS)) + { + /* Switch to reading arguments from the stack. */ + argp = stack_args; + arg_word = NUM_ARG_REGS; + } + + avalue[i] = argp; + argp += arg_size_in_words; + arg_word += arg_size_in_words; + } + + /* Invoke the closure. */ + closure->fun(cif, rvalue, avalue, closure->user_data); + + if (cif->flags != FFI_TYPE_STRUCT) + { + /* Canonicalize for register representation. */ + assign_to_ffi_arg(reg_args_out, &closure_ret, cif->rtype, 1); + } +} diff --git a/Modules/_ctypes/libffi/src/tile/ffitarget.h b/Modules/_ctypes/libffi/src/tile/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/tile/ffitarget.h @@ -0,0 +1,65 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2012 Tilera Corp. + Target configuration macros for TILE. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM + +#include + +typedef uint_reg_t ffi_arg; +typedef int_reg_t ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_UNIX, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_UNIX +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ +#define FFI_CLOSURES 1 + +#ifdef __tilegx__ +/* We always pass 8-byte values, even in -m32 mode. */ +# define FFI_SIZEOF_ARG 8 +# ifdef __LP64__ +# define FFI_TRAMPOLINE_SIZE (8 * 5) /* 5 bundles */ +# else +# define FFI_TRAMPOLINE_SIZE (8 * 3) /* 3 bundles */ +# endif +#else +# define FFI_SIZEOF_ARG 4 +# define FFI_TRAMPOLINE_SIZE 8 /* 1 bundle */ +#endif +#define FFI_NATIVE_RAW_API 0 + +#endif diff --git a/Modules/_ctypes/libffi/src/tile/tile.S b/Modules/_ctypes/libffi/src/tile/tile.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/tile/tile.S @@ -0,0 +1,360 @@ +/* ----------------------------------------------------------------------- + tile.S - Copyright (c) 2011 Tilera Corp. + + Tilera TILEPro and TILE-Gx Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + +/* Number of bytes in a register. */ +#define REG_SIZE FFI_SIZEOF_ARG + +/* Number of bytes in stack linkage area for backtracing. + + A note about the ABI: on entry to a procedure, sp points to a stack + slot where it must spill the return address if it's not a leaf. + REG_SIZE bytes beyond that is a slot owned by the caller which + contains the sp value that the caller had when it was originally + entered (i.e. the caller's frame pointer). */ +#define LINKAGE_SIZE (2 * REG_SIZE) + +/* The first 10 registers are used to pass arguments and return values. */ +#define NUM_ARG_REGS 10 + +#ifdef __tilegx__ +#define SW st +#define LW ld +#define BGZT bgtzt +#else +#define SW sw +#define LW lw +#define BGZT bgzt +#endif + + +/* void ffi_call_tile (int_reg_t reg_args[NUM_ARG_REGS], + const int_reg_t *stack_args, + unsigned long stack_args_bytes, + void (*fnaddr)(void)); + + On entry, REG_ARGS contain the outgoing register values, + and STACK_ARGS containts STACK_ARG_BYTES of additional values + to be passed on the stack. If STACK_ARG_BYTES is zero, then + STACK_ARGS is ignored. + + When the invoked function returns, the values of r0-r9 are + blindly stored back into REG_ARGS for the caller to examine. */ + + .section .text.ffi_call_tile, "ax", @progbits + .align 8 + .globl ffi_call_tile + FFI_HIDDEN(ffi_call_tile) +ffi_call_tile: + +/* Incoming arguments. */ +#define REG_ARGS r0 +#define INCOMING_STACK_ARGS r1 +#define STACK_ARG_BYTES r2 +#define ORIG_FNADDR r3 + +/* Temporary values. */ +#define FRAME_SIZE r10 +#define TMP r11 +#define TMP2 r12 +#define OUTGOING_STACK_ARGS r13 +#define REG_ADDR_PTR r14 +#define RETURN_REG_ADDR r15 +#define FNADDR r16 + + .cfi_startproc + { + /* Save return address. */ + SW sp, lr + .cfi_offset lr, 0 + /* Prepare to spill incoming r52. */ + addi TMP, sp, -REG_SIZE + /* Increase frame size to have room to spill r52 and REG_ARGS. + The +7 is to round up mod 8. */ + addi FRAME_SIZE, STACK_ARG_BYTES, \ + REG_SIZE + REG_SIZE + LINKAGE_SIZE + 7 + } + { + /* Round stack frame size to a multiple of 8 to satisfy ABI. */ + andi FRAME_SIZE, FRAME_SIZE, -8 + /* Compute where to spill REG_ARGS value. */ + addi TMP2, sp, -(REG_SIZE * 2) + } + { + /* Spill incoming r52. */ + SW TMP, r52 + .cfi_offset r52, -REG_SIZE + /* Set up our frame pointer. */ + move r52, sp + .cfi_def_cfa_register r52 + /* Push stack frame. */ + sub sp, sp, FRAME_SIZE + } + { + /* Prepare to set up stack linkage. */ + addi TMP, sp, REG_SIZE + /* Prepare to memcpy stack args. */ + addi OUTGOING_STACK_ARGS, sp, LINKAGE_SIZE + /* Save REG_ARGS which we will need after we call the subroutine. */ + SW TMP2, REG_ARGS + } + { + /* Set up linkage info to hold incoming stack pointer. */ + SW TMP, r52 + } + { + /* Skip stack args memcpy if we don't have any stack args (common). */ + blezt STACK_ARG_BYTES, .Ldone_stack_args_memcpy + } + +.Lmemcpy_stack_args: + { + /* Load incoming argument from stack_args. */ + LW TMP, INCOMING_STACK_ARGS + addi INCOMING_STACK_ARGS, INCOMING_STACK_ARGS, REG_SIZE + } + { + /* Store stack argument into outgoing stack argument area. */ + SW OUTGOING_STACK_ARGS, TMP + addi OUTGOING_STACK_ARGS, OUTGOING_STACK_ARGS, REG_SIZE + addi STACK_ARG_BYTES, STACK_ARG_BYTES, -REG_SIZE + } + { + BGZT STACK_ARG_BYTES, .Lmemcpy_stack_args + } +.Ldone_stack_args_memcpy: + + { + /* Copy aside ORIG_FNADDR so we can overwrite its register. */ + move FNADDR, ORIG_FNADDR + /* Prepare to load argument registers. */ + addi REG_ADDR_PTR, r0, REG_SIZE + /* Load outgoing r0. */ + LW r0, r0 + } + + /* Load up argument registers from the REG_ARGS array. */ +#define LOAD_REG(REG, PTR) \ + { \ + LW REG, PTR ; \ + addi PTR, PTR, REG_SIZE \ + } + + LOAD_REG(r1, REG_ADDR_PTR) + LOAD_REG(r2, REG_ADDR_PTR) + LOAD_REG(r3, REG_ADDR_PTR) + LOAD_REG(r4, REG_ADDR_PTR) + LOAD_REG(r5, REG_ADDR_PTR) + LOAD_REG(r6, REG_ADDR_PTR) + LOAD_REG(r7, REG_ADDR_PTR) + LOAD_REG(r8, REG_ADDR_PTR) + LOAD_REG(r9, REG_ADDR_PTR) + + { + /* Call the subroutine. */ + jalr FNADDR + } + + { + /* Restore original lr. */ + LW lr, r52 + /* Prepare to recover ARGS, which we spilled earlier. */ + addi TMP, r52, -(2 * REG_SIZE) + } + { + /* Restore ARGS, so we can fill it in with the return regs r0-r9. */ + LW RETURN_REG_ADDR, TMP + /* Prepare to restore original r52. */ + addi TMP, r52, -REG_SIZE + } + + { + /* Pop stack frame. */ + move sp, r52 + /* Restore original r52. */ + LW r52, TMP + } + +#define STORE_REG(REG, PTR) \ + { \ + SW PTR, REG ; \ + addi PTR, PTR, REG_SIZE \ + } + + /* Return all register values by reference. */ + STORE_REG(r0, RETURN_REG_ADDR) + STORE_REG(r1, RETURN_REG_ADDR) + STORE_REG(r2, RETURN_REG_ADDR) + STORE_REG(r3, RETURN_REG_ADDR) + STORE_REG(r4, RETURN_REG_ADDR) + STORE_REG(r5, RETURN_REG_ADDR) + STORE_REG(r6, RETURN_REG_ADDR) + STORE_REG(r7, RETURN_REG_ADDR) + STORE_REG(r8, RETURN_REG_ADDR) + STORE_REG(r9, RETURN_REG_ADDR) + + { + jrp lr + } + + .cfi_endproc + .size ffi_call_tile, .-ffi_call_tile + +/* ffi_closure_tile(...) + + On entry, lr points to the closure plus 8 bytes, and r10 + contains the actual return address. + + This function simply dumps all register parameters into a stack array + and passes the closure, the registers array, and the stack arguments + to C code that does all of the actual closure processing. */ + + .section .text.ffi_closure_tile, "ax", @progbits + .align 8 + .globl ffi_closure_tile + FFI_HIDDEN(ffi_closure_tile) + + .cfi_startproc +/* Room to spill all NUM_ARG_REGS incoming registers, plus frame linkage. */ +#define CLOSURE_FRAME_SIZE (((NUM_ARG_REGS * REG_SIZE * 2 + LINKAGE_SIZE) + 7) & -8) +ffi_closure_tile: + { +#ifdef __tilegx__ + st sp, lr + .cfi_offset lr, 0 +#else + /* Save return address (in r10 due to closure stub wrapper). */ + SW sp, r10 + .cfi_return_column r10 + .cfi_offset r10, 0 +#endif + /* Compute address for stack frame linkage. */ + addli r10, sp, -(CLOSURE_FRAME_SIZE - REG_SIZE) + } + { + /* Save incoming stack pointer in linkage area. */ + SW r10, sp + .cfi_offset sp, -(CLOSURE_FRAME_SIZE - REG_SIZE) + /* Push a new stack frame. */ + addli sp, sp, -CLOSURE_FRAME_SIZE + .cfi_adjust_cfa_offset CLOSURE_FRAME_SIZE + } + + { + /* Create pointer to where to start spilling registers. */ + addi r10, sp, LINKAGE_SIZE + } + + /* Spill all the incoming registers. */ + STORE_REG(r0, r10) + STORE_REG(r1, r10) + STORE_REG(r2, r10) + STORE_REG(r3, r10) + STORE_REG(r4, r10) + STORE_REG(r5, r10) + STORE_REG(r6, r10) + STORE_REG(r7, r10) + STORE_REG(r8, r10) + { + /* Save r9. */ + SW r10, r9 +#ifdef __tilegx__ + /* Pointer to closure is passed in r11. */ + move r0, r11 +#else + /* Compute pointer to the closure object. Because the closure + starts with a "jal ffi_closure_tile", we can just take the + value of lr (a phony return address pointing into the closure) + and subtract 8. */ + addi r0, lr, -8 +#endif + /* Compute a pointer to the register arguments we just spilled. */ + addi r1, sp, LINKAGE_SIZE + } + { + /* Compute a pointer to the extra stack arguments (if any). */ + addli r2, sp, CLOSURE_FRAME_SIZE + LINKAGE_SIZE + /* Call C code to deal with all of the grotty details. */ + jal ffi_closure_tile_inner + } + { + addli r10, sp, CLOSURE_FRAME_SIZE + } + { + /* Restore the return address. */ + LW lr, r10 + /* Compute pointer to registers array. */ + addli r10, sp, LINKAGE_SIZE + (NUM_ARG_REGS * REG_SIZE) + } + /* Return all the register values, which C code may have set. */ + LOAD_REG(r0, r10) + LOAD_REG(r1, r10) + LOAD_REG(r2, r10) + LOAD_REG(r3, r10) + LOAD_REG(r4, r10) + LOAD_REG(r5, r10) + LOAD_REG(r6, r10) + LOAD_REG(r7, r10) + LOAD_REG(r8, r10) + LOAD_REG(r9, r10) + { + /* Pop the frame. */ + addli sp, sp, CLOSURE_FRAME_SIZE + jrp lr + } + + .cfi_endproc + .size ffi_closure_tile, . - ffi_closure_tile + + +/* What follows are code template instructions that get copied to the + closure trampoline by ffi_prep_closure_loc. The zeroed operands + get replaced by their proper values at runtime. */ + + .section .text.ffi_template_tramp_tile, "ax", @progbits + .align 8 + .globl ffi_template_tramp_tile + FFI_HIDDEN(ffi_template_tramp_tile) +ffi_template_tramp_tile: +#ifdef __tilegx__ + { + moveli r11, 0 /* backpatched to address of containing closure. */ + moveli r10, 0 /* backpatched to ffi_closure_tile. */ + } + /* Note: the following bundle gets generated multiple times + depending on the pointer value (esp. useful for -m32 mode). */ + { shl16insli r11, r11, 0 ; shl16insli r10, r10, 0 } + { info 2+8 /* for backtracer: -> pc in lr, frame size 0 */ ; jr r10 } +#else + /* 'jal .' yields a PC-relative offset of zero so we can OR in the + right offset at runtime. */ + { move r10, lr ; jal . /* ffi_closure_tile */ } +#endif + + .size ffi_template_tramp_tile, . - ffi_template_tramp_tile diff --git a/Modules/_ctypes/libffi/src/x86/ffi.c b/Modules/_ctypes/libffi/src/x86/ffi.c --- a/Modules/_ctypes/libffi/src/x86/ffi.c +++ b/Modules/_ctypes/libffi/src/x86/ffi.c @@ -3,7 +3,7 @@ Copyright (c) 2002 Ranjit Mathew Copyright (c) 2002 Bo Thorsen Copyright (c) 2002 Roger Sayle - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2010 Free Software Foundation, Inc. x86 Foreign Function Interface @@ -48,10 +48,18 @@ register void **p_argv; register char *argp; register ffi_type **p_arg; +#ifdef X86_WIN32 + size_t p_stack_args[2]; + void *p_stack_data[2]; + char *argp2 = stack; + int stack_args_count = 0; + int cabi = ecif->cif->abi; +#endif argp = stack; - if (ecif->cif->flags == FFI_TYPE_STRUCT + if ((ecif->cif->flags == FFI_TYPE_STRUCT + || ecif->cif->flags == FFI_TYPE_MS_STRUCT) #ifdef X86_WIN64 && (ecif->cif->rtype->size != 1 && ecif->cif->rtype->size != 2 && ecif->cif->rtype->size != 4 && ecif->cif->rtype->size != 8) @@ -59,6 +67,16 @@ ) { *(void **) argp = ecif->rvalue; +#ifdef X86_WIN32 + /* For fastcall/thiscall this is first register-passed + argument. */ + if (cabi == FFI_THISCALL || cabi == FFI_FASTCALL) + { + p_stack_args[stack_args_count] = sizeof (void*); + p_stack_data[stack_args_count] = argp; + ++stack_args_count; + } +#endif argp += sizeof(void*); } @@ -134,6 +152,24 @@ { memcpy(argp, *p_argv, z); } + +#ifdef X86_WIN32 + /* For thiscall/fastcall convention register-passed arguments + are the first two none-floating-point arguments with a size + smaller or equal to sizeof (void*). */ + if ((cabi == FFI_THISCALL && stack_args_count < 1) + || (cabi == FFI_FASTCALL && stack_args_count < 2)) + { + if (z <= 4 + && ((*p_arg)->type != FFI_TYPE_FLOAT + && (*p_arg)->type != FFI_TYPE_STRUCT)) + { + p_stack_args[stack_args_count] = z; + p_stack_data[stack_args_count] = argp; + ++stack_args_count; + } + } +#endif p_argv++; #ifdef X86_WIN64 argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); @@ -141,7 +177,45 @@ argp += z; #endif } - + +#ifdef X86_WIN32 + /* We need to move the register-passed arguments for thiscall/fastcall + on top of stack, so that those can be moved to registers ecx/edx by + call-handler. */ + if (stack_args_count > 0) + { + size_t zz = (p_stack_args[0] + 3) & ~3; + char *h; + + /* Move first argument to top-stack position. */ + if (p_stack_data[0] != argp2) + { + h = alloca (zz + 1); + memcpy (h, p_stack_data[0], zz); + memmove (argp2 + zz, argp2, + (size_t) ((char *) p_stack_data[0] - (char*)argp2)); + memcpy (argp2, h, zz); + } + + argp2 += zz; + --stack_args_count; + if (zz > 4) + stack_args_count = 0; + + /* If we have a second argument, then move it on top + after the first one. */ + if (stack_args_count > 0 && p_stack_data[1] != argp2) + { + zz = p_stack_args[1]; + zz = (zz + 3) & ~3; + h = alloca (zz + 1); + h = alloca (zz + 1); + memcpy (h, p_stack_data[1], zz); + memmove (argp2 + zz, argp2, (size_t) ((char*) p_stack_data[1] - (char*)argp2)); + memcpy (argp2, h, zz); + } + } +#endif return; } @@ -155,12 +229,10 @@ switch (cif->rtype->type) { case FFI_TYPE_VOID: -#if defined(X86) || defined (X86_WIN32) || defined(X86_FREEBSD) || defined(X86_DARWIN) || defined(X86_WIN64) case FFI_TYPE_UINT8: case FFI_TYPE_UINT16: case FFI_TYPE_SINT8: case FFI_TYPE_SINT16: -#endif #ifdef X86_WIN64 case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: @@ -208,8 +280,13 @@ else #endif { - cif->flags = FFI_TYPE_STRUCT; - // allocate space for return value pointer +#ifdef X86_WIN32 + if (cif->abi == FFI_MS_CDECL) + cif->flags = FFI_TYPE_MS_STRUCT; + else +#endif + cif->flags = FFI_TYPE_STRUCT; + /* allocate space for return value pointer */ cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG); } break; @@ -234,13 +311,11 @@ } #ifdef X86_WIN64 - // ensure space for storing four registers + /* ensure space for storing four registers */ cif->bytes += 4 * sizeof(ffi_arg); #endif -#ifdef X86_DARWIN cif->bytes = (cif->bytes + 15) & ~0xF; -#endif return FFI_OK; } @@ -252,7 +327,7 @@ #elif defined(X86_WIN32) extern void ffi_call_win32(void (*)(char *, extended_cif *), extended_cif *, - unsigned, unsigned, unsigned *, void (*fn)(void)); + unsigned, unsigned, unsigned, unsigned *, void (*fn)(void)); #else extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); @@ -278,7 +353,8 @@ } #else if (rvalue == NULL - && cif->flags == FFI_TYPE_STRUCT) + && (cif->flags == FFI_TYPE_STRUCT + || cif->flags == FFI_TYPE_MS_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } @@ -291,33 +367,44 @@ { #ifdef X86_WIN64 case FFI_WIN64: - { - // Make copies of all struct arguments - // NOTE: not sure if responsibility should be here or in caller - unsigned int i; - for (i=0; i < cif->nargs;i++) { - size_t size = cif->arg_types[i]->size; - if ((cif->arg_types[i]->type == FFI_TYPE_STRUCT - && (size != 1 && size != 2 && size != 4 && size != 8)) -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - || cif->arg_types[i]->type == FFI_TYPE_LONGDOUBLE -#endif - ) - { - void *local = alloca(size); - memcpy(local, avalue[i], size); - avalue[i] = local; - } - } - ffi_call_win64(ffi_prep_args, &ecif, cif->bytes, - cif->flags, ecif.rvalue, fn); - } + ffi_call_win64(ffi_prep_args, &ecif, cif->bytes, + cif->flags, ecif.rvalue, fn); break; #elif defined(X86_WIN32) case FFI_SYSV: case FFI_STDCALL: - ffi_call_win32(ffi_prep_args, &ecif, cif->bytes, cif->flags, - ecif.rvalue, fn); + case FFI_MS_CDECL: + ffi_call_win32(ffi_prep_args, &ecif, cif->abi, cif->bytes, cif->flags, + ecif.rvalue, fn); + break; + case FFI_THISCALL: + case FFI_FASTCALL: + { + unsigned int abi = cif->abi; + unsigned int i, passed_regs = 0; + + if (cif->flags == FFI_TYPE_STRUCT) + ++passed_regs; + + for (i=0; i < cif->nargs && passed_regs < 2;i++) + { + size_t sz; + + if (cif->arg_types[i]->type == FFI_TYPE_FLOAT + || cif->arg_types[i]->type == FFI_TYPE_STRUCT) + continue; + sz = (cif->arg_types[i]->size + 3) & ~3; + if (sz == 0 || sz > 4) + continue; + ++passed_regs; + } + if (passed_regs < 2 && abi == FFI_FASTCALL) + abi = FFI_THISCALL; + if (passed_regs < 1 && abi == FFI_THISCALL) + abi = FFI_STDCALL; + ffi_call_win32(ffi_prep_args, &ecif, abi, cif->bytes, cif->flags, + ecif.rvalue, fn); + } break; #else case FFI_SYSV: @@ -335,7 +422,7 @@ /** private members **/ /* The following __attribute__((regparm(1))) decorations will have no effect - on MSVC - standard cdecl convention applies. */ + on MSVC or SUNPRO_C -- standard conventions apply. */ static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, void** args, ffi_cif* cif); void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *) @@ -345,8 +432,12 @@ void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *) __attribute__ ((regparm(1))); #ifdef X86_WIN32 +void FFI_HIDDEN ffi_closure_raw_THISCALL (ffi_raw_closure *) + __attribute__ ((regparm(1))); void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *) __attribute__ ((regparm(1))); +void FFI_HIDDEN ffi_closure_THISCALL (ffi_closure *) + __attribute__ ((regparm(1))); #endif #ifdef X86_WIN64 void FFI_HIDDEN ffi_closure_win64 (ffi_closure *); @@ -428,7 +519,8 @@ argp += sizeof(void *); } #else - if ( cif->flags == FFI_TYPE_STRUCT ) { + if ( cif->flags == FFI_TYPE_STRUCT + || cif->flags == FFI_TYPE_MS_STRUCT ) { *rvalue = *(void **) argp; argp += sizeof(void *); } @@ -506,6 +598,33 @@ *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ } +#define FFI_INIT_TRAMPOLINE_THISCALL(TRAMP,FUN,CTX,SIZE) \ +{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + unsigned int __fun = (unsigned int)(FUN); \ + unsigned int __ctx = (unsigned int)(CTX); \ + unsigned int __dis = __fun - (__ctx + 49); \ + unsigned short __size = (unsigned short)(SIZE); \ + *(unsigned int *) &__tramp[0] = 0x8324048b; /* mov (%esp), %eax */ \ + *(unsigned int *) &__tramp[4] = 0x4c890cec; /* sub $12, %esp */ \ + *(unsigned int *) &__tramp[8] = 0x04890424; /* mov %ecx, 4(%esp) */ \ + *(unsigned char*) &__tramp[12] = 0x24; /* mov %eax, (%esp) */ \ + *(unsigned char*) &__tramp[13] = 0xb8; \ + *(unsigned int *) &__tramp[14] = __size; /* mov __size, %eax */ \ + *(unsigned int *) &__tramp[18] = 0x08244c8d; /* lea 8(%esp), %ecx */ \ + *(unsigned int *) &__tramp[22] = 0x4802e8c1; /* shr $2, %eax ; dec %eax */ \ + *(unsigned short*) &__tramp[26] = 0x0b74; /* jz 1f */ \ + *(unsigned int *) &__tramp[28] = 0x8908518b; /* 2b: mov 8(%ecx), %edx */ \ + *(unsigned int *) &__tramp[32] = 0x04c18311; /* mov %edx, (%ecx) ; add $4, %ecx */ \ + *(unsigned char*) &__tramp[36] = 0x48; /* dec %eax */ \ + *(unsigned short*) &__tramp[37] = 0xf575; /* jnz 2b ; 1f: */ \ + *(unsigned char*) &__tramp[39] = 0xb8; \ + *(unsigned int*) &__tramp[40] = __ctx; /* movl __ctx, %eax */ \ + *(unsigned char *) &__tramp[44] = 0xe8; \ + *(unsigned int*) &__tramp[45] = __dis; /* call __fun */ \ + *(unsigned char*) &__tramp[49] = 0xc2; /* ret */ \ + *(unsigned short*) &__tramp[50] = (__size + 8); /* ret (__size + 8) */ \ + } + #define FFI_INIT_TRAMPOLINE_STDCALL(TRAMP,FUN,CTX,SIZE) \ { unsigned char *__tramp = (unsigned char*)(TRAMP); \ unsigned int __fun = (unsigned int)(FUN); \ @@ -548,12 +667,25 @@ (void*)codeloc); } #ifdef X86_WIN32 + else if (cif->abi == FFI_THISCALL) + { + FFI_INIT_TRAMPOLINE_THISCALL (&closure->tramp[0], + &ffi_closure_THISCALL, + (void*)codeloc, + cif->bytes); + } else if (cif->abi == FFI_STDCALL) { FFI_INIT_TRAMPOLINE_STDCALL (&closure->tramp[0], &ffi_closure_STDCALL, (void*)codeloc, cif->bytes); } + else if (cif->abi == FFI_MS_CDECL) + { + FFI_INIT_TRAMPOLINE (&closure->tramp[0], + &ffi_closure_SYSV, + (void*)codeloc); + } #endif /* X86_WIN32 */ #endif /* !X86_WIN64 */ else @@ -582,6 +714,9 @@ int i; if (cif->abi != FFI_SYSV) { +#ifdef X86_WIN32 + if (cif->abi != FFI_THISCALL) +#endif return FFI_BAD_ABI; } @@ -596,10 +731,20 @@ FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE); } - +#ifdef X86_WIN32 + if (cif->abi == FFI_SYSV) + { +#endif FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV, codeloc); - +#ifdef X86_WIN32 + } + else if (cif->abi == FFI_THISCALL) + { + FFI_INIT_TRAMPOLINE_THISCALL (&closure->tramp[0], &ffi_closure_raw_THISCALL, + codeloc, cif->bytes); + } +#endif closure->cif = cif; closure->user_data = user_data; closure->fun = fun; @@ -630,8 +775,9 @@ /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ - if ((rvalue == NULL) && - (cif->rtype->type == FFI_TYPE_STRUCT)) + if (rvalue == NULL + && (cif->flags == FFI_TYPE_STRUCT + || cif->flags == FFI_TYPE_MS_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } @@ -644,8 +790,38 @@ #ifdef X86_WIN32 case FFI_SYSV: case FFI_STDCALL: - ffi_call_win32(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags, - ecif.rvalue, fn); + case FFI_MS_CDECL: + ffi_call_win32(ffi_prep_args_raw, &ecif, cif->abi, cif->bytes, cif->flags, + ecif.rvalue, fn); + break; + case FFI_THISCALL: + case FFI_FASTCALL: + { + unsigned int abi = cif->abi; + unsigned int i, passed_regs = 0; + + if (cif->flags == FFI_TYPE_STRUCT) + ++passed_regs; + + for (i=0; i < cif->nargs && passed_regs < 2;i++) + { + size_t sz; + + if (cif->arg_types[i]->type == FFI_TYPE_FLOAT + || cif->arg_types[i]->type == FFI_TYPE_STRUCT) + continue; + sz = (cif->arg_types[i]->size + 3) & ~3; + if (sz == 0 || sz > 4) + continue; + ++passed_regs; + } + if (passed_regs < 2 && abi == FFI_FASTCALL) + cif->abi = abi = FFI_THISCALL; + if (passed_regs < 1 && abi == FFI_THISCALL) + cif->abi = abi = FFI_STDCALL; + ffi_call_win32(ffi_prep_args_raw, &ecif, abi, cif->bytes, cif->flags, + ecif.rvalue, fn); + } break; #else case FFI_SYSV: diff --git a/Modules/_ctypes/libffi/src/x86/ffi64.c b/Modules/_ctypes/libffi/src/x86/ffi64.c --- a/Modules/_ctypes/libffi/src/x86/ffi64.c +++ b/Modules/_ctypes/libffi/src/x86/ffi64.c @@ -1,7 +1,9 @@ /* ----------------------------------------------------------------------- - ffi64.c - Copyright (c) 2002, 2007 Bo Thorsen - Copyright (c) 2008 Red Hat, Inc. - + ffi64.c - Copyright (c) 2013 The Written Word, Inc. + Copyright (c) 2011 Anthony Green + Copyright (c) 2008, 2010 Red Hat, Inc. + Copyright (c) 2002, 2007 Bo Thorsen + x86-64 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining @@ -36,11 +38,29 @@ #define MAX_GPR_REGS 6 #define MAX_SSE_REGS 8 +#if defined(__INTEL_COMPILER) +#define UINT128 __m128 +#else +#if defined(__SUNPRO_C) +#include +#define UINT128 __m128i +#else +#define UINT128 __int128_t +#endif +#endif + +union big_int_union +{ + UINT32 i32; + UINT64 i64; + UINT128 i128; +}; + struct register_args { /* Registers for argument passing. */ UINT64 gpr[MAX_GPR_REGS]; - __int128_t sse[MAX_SSE_REGS]; + union big_int_union sse[MAX_SSE_REGS]; }; extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, @@ -378,7 +398,7 @@ if (align < 8) align = 8; - bytes = ALIGN(bytes, align); + bytes = ALIGN (bytes, align); bytes += cif->arg_types[i]->size; } else @@ -390,7 +410,7 @@ if (ssecount) flags |= 1 << 11; cif->flags = flags; - cif->bytes = bytes; + cif->bytes = ALIGN (bytes, 8); return FFI_OK; } @@ -426,7 +446,7 @@ /* If the return value is passed in memory, add the pointer as the first integer argument. */ if (ret_in_memory) - reg_args->gpr[gprcount++] = (long) rvalue; + reg_args->gpr[gprcount++] = (unsigned long) rvalue; avn = cif->nargs; arg_types = cif->arg_types; @@ -464,16 +484,33 @@ { case X86_64_INTEGER_CLASS: case X86_64_INTEGERSI_CLASS: - reg_args->gpr[gprcount] = 0; - memcpy (®_args->gpr[gprcount], a, size < 8 ? size : 8); + /* Sign-extend integer arguments passed in general + purpose registers, to cope with the fact that + LLVM incorrectly assumes that this will be done + (the x86-64 PS ABI does not specify this). */ + switch (arg_types[i]->type) + { + case FFI_TYPE_SINT8: + *(SINT64 *)®_args->gpr[gprcount] = (SINT64) *((SINT8 *) a); + break; + case FFI_TYPE_SINT16: + *(SINT64 *)®_args->gpr[gprcount] = (SINT64) *((SINT16 *) a); + break; + case FFI_TYPE_SINT32: + *(SINT64 *)®_args->gpr[gprcount] = (SINT64) *((SINT32 *) a); + break; + default: + reg_args->gpr[gprcount] = 0; + memcpy (®_args->gpr[gprcount], a, size < 8 ? size : 8); + } gprcount++; break; case X86_64_SSE_CLASS: case X86_64_SSEDF_CLASS: - reg_args->sse[ssecount++] = *(UINT64 *) a; + reg_args->sse[ssecount++].i64 = *(UINT64 *) a; break; case X86_64_SSESF_CLASS: - reg_args->sse[ssecount++] = *(UINT32 *) a; + reg_args->sse[ssecount++].i32 = *(UINT32 *) a; break; default: abort(); @@ -498,12 +535,21 @@ { volatile unsigned short *tramp; + /* Sanity check on the cif ABI. */ + { + int abi = cif->abi; + if (UNLIKELY (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI))) + return FFI_BAD_ABI; + } + tramp = (volatile unsigned short *) &closure->tramp[0]; tramp[0] = 0xbb49; /* mov , %r11 */ - *(void * volatile *) &tramp[1] = ffi_closure_unix64; + *((unsigned long long * volatile) &tramp[1]) + = (unsigned long) ffi_closure_unix64; tramp[5] = 0xba49; /* mov , %r10 */ - *(void * volatile *) &tramp[6] = codeloc; + *((unsigned long long * volatile) &tramp[6]) + = (unsigned long) codeloc; /* Set the carry bit iff the function uses any sse registers. This is clc or stc, together with the first byte of the jmp. */ @@ -542,7 +588,7 @@ { /* The return value goes in memory. Arrange for the closure return value to go directly back to the original caller. */ - rvalue = (void *) reg_args->gpr[gprcount++]; + rvalue = (void *) (unsigned long) reg_args->gpr[gprcount++]; /* We don't have to do anything in asm for the return. */ ret = FFI_TYPE_VOID; } diff --git a/Modules/_ctypes/libffi/src/x86/ffitarget.h b/Modules/_ctypes/libffi/src/x86/ffitarget.h --- a/Modules/_ctypes/libffi/src/x86/ffitarget.h +++ b/Modules/_ctypes/libffi/src/x86/ffitarget.h @@ -1,6 +1,7 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003, 2010 Red Hat, Inc. - Copyright (C) 2008 Free Software Foundation, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003, 2010 Red Hat, Inc. + Copyright (C) 2008 Free Software Foundation, Inc. Target configuration macros for x86 and x86-64. @@ -29,8 +30,15 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- System specific configurations ----------------------------------- */ +/* For code common to all platforms on x86 and x86_64. */ +#define X86_ANY + #if defined (X86_64) && defined (__i386__) #undef X86_64 #define X86 @@ -38,7 +46,7 @@ #ifdef X86_WIN64 #define FFI_SIZEOF_ARG 8 -#define USE_BUILTIN_FFS 0 // not yet implemented in mingw-64 +#define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */ #endif /* ---- Generic type definitions ----------------------------------------- */ @@ -53,9 +61,16 @@ typedef long long ffi_sarg; #endif #else +#if defined __x86_64__ && defined __ILP32__ +#define FFI_SIZEOF_ARG 8 +#define FFI_SIZEOF_JAVA_RAW 4 +typedef unsigned long long ffi_arg; +typedef long long ffi_sarg; +#else typedef unsigned long ffi_arg; typedef signed long ffi_sarg; #endif +#endif typedef enum ffi_abi { FFI_FIRST_ABI = 0, @@ -64,28 +79,32 @@ #ifdef X86_WIN32 FFI_SYSV, FFI_STDCALL, - /* TODO: Add fastcall support for the sake of completeness */ - FFI_DEFAULT_ABI = FFI_SYSV, + FFI_THISCALL, + FFI_FASTCALL, + FFI_MS_CDECL, + FFI_LAST_ABI, +#ifdef _MSC_VER + FFI_DEFAULT_ABI = FFI_MS_CDECL +#else + FFI_DEFAULT_ABI = FFI_SYSV #endif -#ifdef X86_WIN64 +#elif defined(X86_WIN64) FFI_WIN64, - FFI_DEFAULT_ABI = FFI_WIN64, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_WIN64 + #else - /* ---- Intel x86 and AMD x86-64 - */ -#if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__) || defined(__i386) || defined(__amd64)) FFI_SYSV, FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */ + FFI_LAST_ABI, #if defined(__i386__) || defined(__i386) - FFI_DEFAULT_ABI = FFI_SYSV, + FFI_DEFAULT_ABI = FFI_SYSV #else - FFI_DEFAULT_ABI = FFI_UNIX64, + FFI_DEFAULT_ABI = FFI_UNIX64 #endif #endif -#endif /* X86_WIN64 */ - - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 } ffi_abi; #endif @@ -95,13 +114,14 @@ #define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1) #define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2) #define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3) +#define FFI_TYPE_MS_STRUCT (FFI_TYPE_LAST + 4) #if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) #define FFI_TRAMPOLINE_SIZE 24 #define FFI_NATIVE_RAW_API 0 #else #ifdef X86_WIN32 -#define FFI_TRAMPOLINE_SIZE 13 +#define FFI_TRAMPOLINE_SIZE 52 #else #ifdef X86_WIN64 #define FFI_TRAMPOLINE_SIZE 29 diff --git a/Modules/_ctypes/libffi/src/x86/sysv.S b/Modules/_ctypes/libffi/src/x86/sysv.S --- a/Modules/_ctypes/libffi/src/x86/sysv.S +++ b/Modules/_ctypes/libffi/src/x86/sysv.S @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 1996, 1998, 2001-2003, 2005, 2008 Red Hat, Inc. + sysv.S - Copyright (c) 2013 The Written Word, Inc. + - Copyright (c) 1996,1998,2001-2003,2005,2008,2010 Red Hat, Inc. X86 Foreign Function Interface @@ -48,6 +49,9 @@ movl 16(%ebp),%ecx subl %ecx,%esp + /* Align the stack pointer to 16-bytes */ + andl $0xfffffff0, %esp + movl %esp,%eax /* Place all of the ffi_prep_args in position */ @@ -178,9 +182,19 @@ leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 8(%ebp), %edx +#ifdef __SUNPRO_C + /* The SUNPRO compiler doesn't support GCC's regparm function + attribute, so we have to pass all three arguments to + ffi_closure_SYSV_inner on the stack. */ + movl %edx, 8(%esp) /* args = __builtin_dwarf_cfa () */ + leal -12(%ebp), %edx + movl %edx, 4(%esp) /* &resp */ + movl %eax, (%esp) /* closure */ +#else movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ +#endif #if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__ call ffi_closure_SYSV_inner #else @@ -325,23 +339,55 @@ .size ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV #endif +#if defined __GNUC__ +/* Only emit dwarf unwind info when building with GNU toolchain. */ + +#if defined __PIC__ +# if defined __sun__ && defined __svr4__ +/* 32-bit Solaris 2/x86 uses datarel encoding for PIC. GNU ld before 2.22 + doesn't correctly sort .eh_frame_hdr with mixed encodings, so match this. */ +# define FDE_ENCODING 0x30 /* datarel */ +# define FDE_ENCODE(X) X at GOTOFF +# else +# define FDE_ENCODING 0x1b /* pcrel sdata4 */ +# if defined HAVE_AS_X86_PCREL +# define FDE_ENCODE(X) X-. +# else +# define FDE_ENCODE(X) X at rel +# endif +# endif +#else +# define FDE_ENCODING 0 /* absolute */ +# define FDE_ENCODE(X) X +#endif + .section .eh_frame,EH_FRAME_FLAGS, at progbits .Lframe1: .long .LECIE1-.LSCIE1 /* Length of Common Information Entry */ .LSCIE1: .long 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ +#ifdef HAVE_AS_ASCII_PSEUDO_OP #ifdef __PIC__ .ascii "zR\0" /* CIE Augmentation */ #else .ascii "\0" /* CIE Augmentation */ #endif +#elif defined HAVE_AS_STRING_PSEUDO_OP +#ifdef __PIC__ + .string "zR" /* CIE Augmentation */ +#else + .string "" /* CIE Augmentation */ +#endif +#else +#error missing .ascii/.string +#endif .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ .byte 0x8 /* CIE RA Column */ #ifdef __PIC__ .byte 0x1 /* .uleb128 0x1; Augmentation size */ - .byte 0x1b /* FDE Encoding (pcrel sdata4) */ + .byte FDE_ENCODING #endif .byte 0xc /* DW_CFA_def_cfa */ .byte 0x4 /* .uleb128 0x4 */ @@ -354,14 +400,8 @@ .long .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .long .LASFDE1-.Lframe1 /* FDE CIE offset */ -#if defined __PIC__ && defined HAVE_AS_X86_PCREL - .long .LFB1-. /* FDE initial location */ -#elif defined __PIC__ - .long .LFB1 at rel -#else - .long .LFB1 -#endif - .long .LFE1-.LFB1 /* FDE address range */ + .long FDE_ENCODE(.LFB1) /* FDE initial location */ + .long .LFE1-.LFB1 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif @@ -381,14 +421,8 @@ .long .LEFDE2-.LASFDE2 /* FDE Length */ .LASFDE2: .long .LASFDE2-.Lframe1 /* FDE CIE offset */ -#if defined __PIC__ && defined HAVE_AS_X86_PCREL - .long .LFB2-. /* FDE initial location */ -#elif defined __PIC__ - .long .LFB2 at rel -#else - .long .LFB2 -#endif - .long .LFE2-.LFB2 /* FDE address range */ + .long FDE_ENCODE(.LFB2) /* FDE initial location */ + .long .LFE2-.LFB2 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif @@ -417,14 +451,8 @@ .long .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: .long .LASFDE3-.Lframe1 /* FDE CIE offset */ -#if defined __PIC__ && defined HAVE_AS_X86_PCREL - .long .LFB3-. /* FDE initial location */ -#elif defined __PIC__ - .long .LFB3 at rel -#else - .long .LFB3 -#endif - .long .LFE3-.LFB3 /* FDE address range */ + .long FDE_ENCODE(.LFB3) /* FDE initial location */ + .long .LFE3-.LFB3 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif @@ -446,6 +474,7 @@ .LEFDE3: #endif +#endif #endif /* ifndef __x86_64__ */ diff --git a/Modules/_ctypes/libffi/src/x86/unix64.S b/Modules/_ctypes/libffi/src/x86/unix64.S --- a/Modules/_ctypes/libffi/src/x86/unix64.S +++ b/Modules/_ctypes/libffi/src/x86/unix64.S @@ -1,6 +1,7 @@ /* ----------------------------------------------------------------------- - unix64.S - Copyright (c) 2002 Bo Thorsen - Copyright (c) 2008 Red Hat, Inc + unix64.S - Copyright (c) 2013 The Written Word, Inc. + - Copyright (c) 2008 Red Hat, Inc + - Copyright (c) 2002 Bo Thorsen x86-64 Foreign Function Interface @@ -324,7 +325,14 @@ .LUW9: .size ffi_closure_unix64,.-ffi_closure_unix64 +#ifdef __GNUC__ +/* Only emit DWARF unwind info when building with the GNU toolchain. */ + +#ifdef HAVE_AS_X86_64_UNWIND_SECTION_TYPE + .section .eh_frame,"a", at unwind +#else .section .eh_frame,"a", at progbits +#endif .Lframe1: .long .LECIE1-.LSCIE1 /* CIE Length */ .LSCIE1: @@ -415,6 +423,8 @@ .align 8 .LEFDE3: +#endif /* __GNUC__ */ + #endif /* __x86_64__ */ #if defined __ELF__ && defined __linux__ diff --git a/Modules/_ctypes/libffi/src/x86/win32.S b/Modules/_ctypes/libffi/src/x86/win32.S --- a/Modules/_ctypes/libffi/src/x86/win32.S +++ b/Modules/_ctypes/libffi/src/x86/win32.S @@ -45,6 +45,7 @@ ffi_call_win32 PROC NEAR, ffi_prep_args : NEAR PTR DWORD, ecif : NEAR PTR DWORD, + cif_abi : DWORD, cif_bytes : DWORD, cif_flags : DWORD, rvalue : NEAR PTR DWORD, @@ -64,6 +65,19 @@ ;; Return stack to previous state and call the function add esp, 8 + ;; Handle thiscall and fastcall + cmp cif_abi, 3 ;; FFI_THISCALL + jz do_thiscall + cmp cif_abi, 4 ;; FFI_FASTCALL + jnz do_stdcall + mov ecx, DWORD PTR [esp] + mov edx, DWORD PTR [esp+4] + add esp, 8 + jmp do_stdcall +do_thiscall: + mov ecx, DWORD PTR [esp] + add esp, 4 +do_stdcall: call fn ;; cdecl: we restore esp in the epilogue, so there's no need to @@ -94,31 +108,37 @@ dd offset ca_retfloat ;; FFI_TYPE_FLOAT dd offset ca_retdouble ;; FFI_TYPE_DOUBLE dd offset ca_retlongdouble ;; FFI_TYPE_LONGDOUBLE - dd offset ca_retint8 ;; FFI_TYPE_UINT8 - dd offset ca_retint8 ;; FFI_TYPE_SINT8 - dd offset ca_retint16 ;; FFI_TYPE_UINT16 - dd offset ca_retint16 ;; FFI_TYPE_SINT16 + dd offset ca_retuint8 ;; FFI_TYPE_UINT8 + dd offset ca_retsint8 ;; FFI_TYPE_SINT8 + dd offset ca_retuint16 ;; FFI_TYPE_UINT16 + dd offset ca_retsint16 ;; FFI_TYPE_SINT16 dd offset ca_retint ;; FFI_TYPE_UINT32 dd offset ca_retint ;; FFI_TYPE_SINT32 dd offset ca_retint64 ;; FFI_TYPE_UINT64 dd offset ca_retint64 ;; FFI_TYPE_SINT64 dd offset ca_epilogue ;; FFI_TYPE_STRUCT dd offset ca_retint ;; FFI_TYPE_POINTER - dd offset ca_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B - dd offset ca_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset ca_retstruct1b ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset ca_retstruct2b ;; FFI_TYPE_SMALL_STRUCT_2B dd offset ca_retint ;; FFI_TYPE_SMALL_STRUCT_4B + dd offset ca_epilogue ;; FFI_TYPE_MS_STRUCT -ca_retint8: - ;; Load %ecx with the pointer to storage for the return value - mov ecx, rvalue - mov [ecx + 0], al - jmp ca_epilogue + /* Sign/zero extend as appropriate. */ +ca_retuint8: + movzx eax, al + jmp ca_retint -ca_retint16: - ;; Load %ecx with the pointer to storage for the return value - mov ecx, rvalue - mov [ecx + 0], ax - jmp ca_epilogue +ca_retsint8: + movsx eax, al + jmp ca_retint + +ca_retuint16: + movzx eax, ax + jmp ca_retint + +ca_retsint16: + movsx eax, ax + jmp ca_retint ca_retint: ;; Load %ecx with the pointer to storage for the return value @@ -151,11 +171,31 @@ fstp TBYTE PTR [ecx] jmp ca_epilogue +ca_retstruct1b: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + mov [ecx + 0], al + jmp ca_epilogue + +ca_retstruct2b: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + mov [ecx + 0], ax + jmp ca_epilogue + ca_epilogue: ;; Epilogue code is autogenerated. ret ffi_call_win32 ENDP +ffi_closure_THISCALL PROC NEAR FORCEFRAME + sub esp, 40 + lea edx, [ebp -24] + mov [ebp - 12], edx /* resp */ + lea edx, [ebp + 12] /* account for stub return address on stack */ + jmp stub +ffi_closure_THISCALL ENDP + ffi_closure_SYSV PROC NEAR FORCEFRAME ;; the ffi_closure ctx is passed in eax by the trampoline. @@ -163,6 +203,7 @@ lea edx, [ebp - 24] mov [ebp - 12], edx ;; resp lea edx, [ebp + 8] +stub:: mov [esp + 8], edx ;; args lea edx, [ebp - 12] mov [esp + 4], edx ;; &resp @@ -179,26 +220,35 @@ dd offset cs_retfloat ;; FFI_TYPE_FLOAT dd offset cs_retdouble ;; FFI_TYPE_DOUBLE dd offset cs_retlongdouble ;; FFI_TYPE_LONGDOUBLE - dd offset cs_retint8 ;; FFI_TYPE_UINT8 - dd offset cs_retint8 ;; FFI_TYPE_SINT8 - dd offset cs_retint16 ;; FFI_TYPE_UINT16 - dd offset cs_retint16 ;; FFI_TYPE_SINT16 + dd offset cs_retuint8 ;; FFI_TYPE_UINT8 + dd offset cs_retsint8 ;; FFI_TYPE_SINT8 + dd offset cs_retuint16 ;; FFI_TYPE_UINT16 + dd offset cs_retsint16 ;; FFI_TYPE_SINT16 dd offset cs_retint ;; FFI_TYPE_UINT32 dd offset cs_retint ;; FFI_TYPE_SINT32 dd offset cs_retint64 ;; FFI_TYPE_UINT64 dd offset cs_retint64 ;; FFI_TYPE_SINT64 dd offset cs_retstruct ;; FFI_TYPE_STRUCT dd offset cs_retint ;; FFI_TYPE_POINTER - dd offset cs_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B - dd offset cs_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset cs_retsint8 ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset cs_retsint16 ;; FFI_TYPE_SMALL_STRUCT_2B dd offset cs_retint ;; FFI_TYPE_SMALL_STRUCT_4B + dd offset cs_retmsstruct ;; FFI_TYPE_MS_STRUCT -cs_retint8: - mov al, [ecx] +cs_retuint8: + movzx eax, BYTE PTR [ecx] jmp cs_epilogue -cs_retint16: - mov ax, [ecx] +cs_retsint8: + movsx eax, BYTE PTR [ecx] + jmp cs_epilogue + +cs_retuint16: + movzx eax, WORD PTR [ecx] + jmp cs_epilogue + +cs_retsint16: + movsx eax, WORD PTR [ecx] jmp cs_epilogue cs_retint: @@ -227,6 +277,12 @@ ;; Epilogue code is autogenerated. ret 4 +cs_retmsstruct: + ;; Caller expects us to return a pointer to the real return value. + mov eax, ecx + ;; Caller doesn't expects us to pop struct return value pointer hidden arg. + jmp cs_epilogue + cs_epilogue: ;; Epilogue code is autogenerated. ret @@ -239,7 +295,16 @@ #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define CIF_FLAGS_OFFSET 20 -ffi_closure_raw_SYSV PROC NEAR USES esi +ffi_closure_raw_THISCALL PROC NEAR USES esi FORCEFRAME + sub esp, 36 + mov esi, [eax + RAW_CLOSURE_CIF_OFFSET] ;; closure->cif + mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data + mov [esp + 12], edx + lea edx, [ebp + 12] + jmp stubraw +ffi_closure_raw_THISCALL ENDP + +ffi_closure_raw_SYSV PROC NEAR USES esi FORCEFRAME ;; the ffi_closure ctx is passed in eax by the trampoline. sub esp, 40 @@ -247,6 +312,7 @@ mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data mov [esp + 12], edx ;; user_data lea edx, [ebp + 8] +stubraw:: mov [esp + 8], edx ;; raw_args lea edx, [ebp - 24] mov [esp + 4], edx ;; &res @@ -264,26 +330,35 @@ dd offset cr_retfloat ;; FFI_TYPE_FLOAT dd offset cr_retdouble ;; FFI_TYPE_DOUBLE dd offset cr_retlongdouble ;; FFI_TYPE_LONGDOUBLE - dd offset cr_retint8 ;; FFI_TYPE_UINT8 - dd offset cr_retint8 ;; FFI_TYPE_SINT8 - dd offset cr_retint16 ;; FFI_TYPE_UINT16 - dd offset cr_retint16 ;; FFI_TYPE_SINT16 + dd offset cr_retuint8 ;; FFI_TYPE_UINT8 + dd offset cr_retsint8 ;; FFI_TYPE_SINT8 + dd offset cr_retuint16 ;; FFI_TYPE_UINT16 + dd offset cr_retsint16 ;; FFI_TYPE_SINT16 dd offset cr_retint ;; FFI_TYPE_UINT32 dd offset cr_retint ;; FFI_TYPE_SINT32 dd offset cr_retint64 ;; FFI_TYPE_UINT64 dd offset cr_retint64 ;; FFI_TYPE_SINT64 dd offset cr_epilogue ;; FFI_TYPE_STRUCT dd offset cr_retint ;; FFI_TYPE_POINTER - dd offset cr_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B - dd offset cr_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset cr_retsint8 ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset cr_retsint16 ;; FFI_TYPE_SMALL_STRUCT_2B dd offset cr_retint ;; FFI_TYPE_SMALL_STRUCT_4B + dd offset cr_epilogue ;; FFI_TYPE_MS_STRUCT -cr_retint8: - mov al, [ecx] +cr_retuint8: + movzx eax, BYTE PTR [ecx] jmp cr_epilogue -cr_retint16: - mov ax, [ecx] +cr_retsint8: + movsx eax, BYTE PTR [ecx] + jmp cr_epilogue + +cr_retuint16: + movzx eax, WORD PTR [ecx] + jmp cr_epilogue + +cr_retsint16: + movsx eax, WORD PTR [ecx] jmp cr_epilogue cr_retint: @@ -337,26 +412,34 @@ dd offset cd_retfloat ;; FFI_TYPE_FLOAT dd offset cd_retdouble ;; FFI_TYPE_DOUBLE dd offset cd_retlongdouble ;; FFI_TYPE_LONGDOUBLE - dd offset cd_retint8 ;; FFI_TYPE_UINT8 - dd offset cd_retint8 ;; FFI_TYPE_SINT8 - dd offset cd_retint16 ;; FFI_TYPE_UINT16 - dd offset cd_retint16 ;; FFI_TYPE_SINT16 + dd offset cd_retuint8 ;; FFI_TYPE_UINT8 + dd offset cd_retsint8 ;; FFI_TYPE_SINT8 + dd offset cd_retuint16 ;; FFI_TYPE_UINT16 + dd offset cd_retsint16 ;; FFI_TYPE_SINT16 dd offset cd_retint ;; FFI_TYPE_UINT32 dd offset cd_retint ;; FFI_TYPE_SINT32 dd offset cd_retint64 ;; FFI_TYPE_UINT64 dd offset cd_retint64 ;; FFI_TYPE_SINT64 dd offset cd_epilogue ;; FFI_TYPE_STRUCT dd offset cd_retint ;; FFI_TYPE_POINTER - dd offset cd_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B - dd offset cd_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset cd_retsint8 ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset cd_retsint16 ;; FFI_TYPE_SMALL_STRUCT_2B dd offset cd_retint ;; FFI_TYPE_SMALL_STRUCT_4B -cd_retint8: - mov al, [ecx] +cd_retuint8: + movzx eax, BYTE PTR [ecx] jmp cd_epilogue -cd_retint16: - mov ax, [ecx] +cd_retsint8: + movsx eax, BYTE PTR [ecx] + jmp cd_epilogue + +cd_retuint16: + movzx eax, WORD PTR [ecx] + jmp cd_epilogue + +cd_retsint16: + movsx eax, WORD PTR [ecx] jmp cd_epilogue cd_retint: @@ -395,7 +478,9 @@ # This assumes we are using gas. .balign 16 .globl _ffi_call_win32 +#ifndef __OS2__ .def _ffi_call_win32; .scl 2; .type 32; .endef +#endif _ffi_call_win32: .LFB1: pushl %ebp @@ -403,7 +488,7 @@ movl %esp,%ebp .LCFI1: # Make room for all of the new args. - movl 16(%ebp),%ecx + movl 20(%ebp),%ecx subl %ecx,%esp movl %esp,%eax @@ -415,19 +500,34 @@ # Return stack to previous state and call the function addl $8,%esp - + + # Handle fastcall and thiscall + cmpl $3, 16(%ebp) # FFI_THISCALL + jz .do_thiscall + cmpl $4, 16(%ebp) # FFI_FASTCALL + jnz .do_fncall + movl (%esp), %ecx + movl 4(%esp), %edx + addl $8, %esp + jmp .do_fncall +.do_thiscall: + movl (%esp), %ecx + addl $4, %esp + +.do_fncall: + # FIXME: Align the stack to a 128-bit boundary to avoid # potential performance hits. - call *28(%ebp) + call *32(%ebp) # stdcall functions pop arguments off the stack themselves # Load %ecx with the return type code - movl 20(%ebp),%ecx + movl 24(%ebp),%ecx # If the return value pointer is NULL, assume no return value. - cmpl $0,24(%ebp) + cmpl $0,28(%ebp) jne 0f # Even if there is no space for the return value, we are @@ -460,6 +560,7 @@ .long .Lretstruct1b /* FFI_TYPE_SMALL_STRUCT_1B */ .long .Lretstruct2b /* FFI_TYPE_SMALL_STRUCT_2B */ .long .Lretstruct4b /* FFI_TYPE_SMALL_STRUCT_4B */ + .long .Lretstruct /* FFI_TYPE_MS_STRUCT */ 1: add %ecx, %ecx add %ecx, %ecx @@ -486,50 +587,50 @@ .Lretint: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx movl %eax,0(%ecx) jmp .Lepilogue .Lretfloat: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx fstps (%ecx) jmp .Lepilogue .Lretdouble: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx fstpl (%ecx) jmp .Lepilogue .Lretlongdouble: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx fstpt (%ecx) jmp .Lepilogue .Lretint64: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx movl %eax,0(%ecx) movl %edx,4(%ecx) jmp .Lepilogue .Lretstruct1b: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx movb %al,0(%ecx) jmp .Lepilogue .Lretstruct2b: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx movw %ax,0(%ecx) jmp .Lepilogue .Lretstruct4b: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx movl %eax,0(%ecx) jmp .Lepilogue @@ -542,12 +643,27 @@ popl %ebp ret .ffi_call_win32_end: + .balign 16 + .globl _ffi_closure_THISCALL +#ifndef __OS2__ + .def _ffi_closure_THISCALL; .scl 2; .type 32; .endef +#endif +_ffi_closure_THISCALL: + pushl %ebp + movl %esp, %ebp + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 12(%ebp), %edx /* account for stub return address on stack */ + jmp .stub .LFE1: # This assumes we are using gas. .balign 16 .globl _ffi_closure_SYSV +#ifndef __OS2__ .def _ffi_closure_SYSV; .scl 2; .type 32; .endef +#endif _ffi_closure_SYSV: .LFB3: pushl %ebp @@ -558,6 +674,7 @@ leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 8(%ebp), %edx +.stub: movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ @@ -586,6 +703,7 @@ .long .Lcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ .long .Lcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ .long .Lcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ + .long .Lcls_retmsstruct /* FFI_TYPE_MS_STRUCT */ 1: add %eax, %eax @@ -650,6 +768,12 @@ popl %ebp ret $0x4 +.Lcls_retmsstruct: + # Caller expects us to return a pointer to the real return value. + mov %ecx, %eax + # Caller doesn't expects us to pop struct return value pointer hidden arg. + jmp .Lcls_epilogue + .Lcls_noretval: .Lcls_epilogue: movl %ebp, %esp @@ -664,11 +788,27 @@ #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define CIF_FLAGS_OFFSET 20 - + .balign 16 + .globl _ffi_closure_raw_THISCALL +#ifndef __OS2__ + .def _ffi_closure_raw_THISCALL; .scl 2; .type 32; .endef +#endif +_ffi_closure_raw_THISCALL: + pushl %ebp + movl %esp, %ebp + pushl %esi + subl $36, %esp + movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ + movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ + movl %edx, 12(%esp) /* user_data */ + leal 12(%ebp), %edx /* __builtin_dwarf_cfa () */ + jmp .stubraw # This assumes we are using gas. .balign 16 .globl _ffi_closure_raw_SYSV +#ifndef __OS2__ .def _ffi_closure_raw_SYSV; .scl 2; .type 32; .endef +#endif _ffi_closure_raw_SYSV: .LFB4: pushl %ebp @@ -682,6 +822,7 @@ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ movl %edx, 12(%esp) /* user_data */ leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ +.stubraw: movl %edx, 8(%esp) /* raw_args */ leal -24(%ebp), %edx movl %edx, 4(%esp) /* &res */ @@ -710,6 +851,7 @@ .long .Lrcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ .long .Lrcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ .long .Lrcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ + .long .Lrcls_retstruct /* FFI_TYPE_MS_STRUCT */ 1: add %eax, %eax add %eax, %eax @@ -784,7 +926,9 @@ # This assumes we are using gas. .balign 16 .globl _ffi_closure_STDCALL +#ifndef __OS2__ .def _ffi_closure_STDCALL; .scl 2; .type 32; .endef +#endif _ffi_closure_STDCALL: .LFB5: pushl %ebp @@ -890,7 +1034,9 @@ .ffi_closure_STDCALL_end: .LFE5: +#ifndef __OS2__ .section .eh_frame,"w" +#endif .Lframe1: .LSCIE1: .long .LECIE1-.LASCIE1 /* Length of Common Information Entry */ diff --git a/Modules/_ctypes/libffi/src/x86/win64.S b/Modules/_ctypes/libffi/src/x86/win64.S --- a/Modules/_ctypes/libffi/src/x86/win64.S +++ b/Modules/_ctypes/libffi/src/x86/win64.S @@ -232,10 +232,18 @@ ffi_call_win64 ENDP _TEXT ENDS END -#else + +#else + +#ifdef SYMBOL_UNDERSCORE +#define SYMBOL_NAME(name) _##name +#else +#define SYMBOL_NAME(name) name +#endif + .text -.extern _ffi_closure_win64_inner +.extern SYMBOL_NAME(ffi_closure_win64_inner) # ffi_closure_win64 will be called with these registers set: # rax points to 'closure' @@ -246,8 +254,8 @@ # call ffi_closure_win64_inner for the actual work, then return the result. # .balign 16 - .globl _ffi_closure_win64 -_ffi_closure_win64: + .globl SYMBOL_NAME(ffi_closure_win64) +SYMBOL_NAME(ffi_closure_win64): # copy register arguments onto stack test $1,%r11 jne .Lfirst_is_float @@ -287,7 +295,7 @@ mov %rax, %rcx # context is first parameter mov %rsp, %rdx # stack is second parameter add $48, %rdx # point to start of arguments - mov $_ffi_closure_win64_inner, %rax + mov $SYMBOL_NAME(ffi_closure_win64_inner), %rax callq *%rax # call the real closure function add $40, %rsp movq %rax, %xmm0 # If the closure returned a float, @@ -296,8 +304,8 @@ .ffi_closure_win64_end: .balign 16 - .globl _ffi_call_win64 -_ffi_call_win64: + .globl SYMBOL_NAME(ffi_call_win64) +SYMBOL_NAME(ffi_call_win64): # copy registers onto stack mov %r9,32(%rsp) mov %r8,24(%rsp) diff --git a/Modules/_ctypes/libffi/src/xtensa/ffi.c b/Modules/_ctypes/libffi/src/xtensa/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/xtensa/ffi.c @@ -0,0 +1,298 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2013 Tensilica, Inc. + + XTENSA Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +/* + |----------------------------------------| + | | + on entry to ffi_call ----> |----------------------------------------| + | caller stack frame for registers a0-a3 | + |----------------------------------------| + | | + | additional arguments | + entry of the function ---> |----------------------------------------| + | copy of function arguments a2-a7 | + | - - - - - - - - - - - - - | + | | + + The area below the entry line becomes the new stack frame for the function. + +*/ + + +#define FFI_TYPE_STRUCT_REGS FFI_TYPE_LAST + + +extern void ffi_call_SYSV(void *rvalue, unsigned rsize, unsigned flags, + void(*fn)(void), unsigned nbytes, extended_cif*); +extern void ffi_closure_SYSV(void) FFI_HIDDEN; + +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + switch(cif->rtype->type) { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + cif->flags = cif->rtype->type; + break; + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + cif->flags = FFI_TYPE_UINT32; + break; + case FFI_TYPE_DOUBLE: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + cif->flags = FFI_TYPE_UINT64; // cif->rtype->type; + break; + case FFI_TYPE_STRUCT: + cif->flags = FFI_TYPE_STRUCT; //_REGS; + /* Up to 16 bytes are returned in registers */ + if (cif->rtype->size > 4 * 4) { + /* returned structure is referenced by a register; use 8 bytes + (including 4 bytes for potential additional alignment) */ + cif->flags = FFI_TYPE_STRUCT; + cif->bytes += 8; + } + break; + + default: + cif->flags = FFI_TYPE_UINT32; + break; + } + + /* Round the stack up to a full 4 register frame, just in case + (we use this size in movsp). This way, it's also a multiple of + 8 bytes for 64-bit arguments. */ + cif->bytes = ALIGN(cif->bytes, 16); + + return FFI_OK; +} + +void ffi_prep_args(extended_cif *ecif, unsigned char* stack) +{ + unsigned int i; + unsigned long *addr; + ffi_type **ptr; + + union { + void **v; + char **c; + signed char **sc; + unsigned char **uc; + signed short **ss; + unsigned short **us; + unsigned int **i; + long long **ll; + float **f; + double **d; + } p_argv; + + /* Verify that everything is aligned up properly */ + FFI_ASSERT (((unsigned long) stack & 0x7) == 0); + + p_argv.v = ecif->avalue; + addr = (unsigned long*)stack; + + /* structures with a size greater than 16 bytes are passed in memory */ + if (ecif->cif->rtype->type == FFI_TYPE_STRUCT && ecif->cif->rtype->size > 16) + { + *addr++ = (unsigned long)ecif->rvalue; + } + + for (i = ecif->cif->nargs, ptr = ecif->cif->arg_types; + i > 0; + i--, ptr++, p_argv.v++) + { + switch ((*ptr)->type) + { + case FFI_TYPE_SINT8: + *addr++ = **p_argv.sc; + break; + case FFI_TYPE_UINT8: + *addr++ = **p_argv.uc; + break; + case FFI_TYPE_SINT16: + *addr++ = **p_argv.ss; + break; + case FFI_TYPE_UINT16: + *addr++ = **p_argv.us; + break; + case FFI_TYPE_FLOAT: + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + *addr++ = **p_argv.i; + break; + case FFI_TYPE_DOUBLE: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + if (((unsigned long)addr & 4) != 0) + addr++; + *(unsigned long long*)addr = **p_argv.ll; + addr += sizeof(unsigned long long) / sizeof (addr); + break; + + case FFI_TYPE_STRUCT: + { + unsigned long offs; + unsigned long size; + + if (((unsigned long)addr & 4) != 0 && (*ptr)->alignment > 4) + addr++; + + offs = (unsigned long) addr - (unsigned long) stack; + size = (*ptr)->size; + + /* Entire structure must fit the argument registers or referenced */ + if (offs < FFI_REGISTER_NARGS * 4 + && offs + size > FFI_REGISTER_NARGS * 4) + addr = (unsigned long*) (stack + FFI_REGISTER_NARGS * 4); + + memcpy((char*) addr, *p_argv.c, size); + addr += (size + 3) / 4; + break; + } + + default: + FFI_ASSERT(0); + } + } +} + + +void ffi_call(ffi_cif* cif, void(*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + unsigned long rsize = cif->rtype->size; + int flags = cif->flags; + void *alloc = NULL; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* Note that for structures that are returned in registers (size <= 16 bytes) + we allocate a temporary buffer and use memcpy to copy it to the final + destination. The reason is that the target address might be misaligned or + the length not a multiple of 4 bytes. Handling all those cases would be + very complex. */ + + if (flags == FFI_TYPE_STRUCT && (rsize <= 16 || rvalue == NULL)) + { + alloc = alloca(ALIGN(rsize, 4)); + ecif.rvalue = alloc; + } + else + { + ecif.rvalue = rvalue; + } + + if (cif->abi != FFI_SYSV) + FFI_ASSERT(0); + + ffi_call_SYSV (ecif.rvalue, rsize, cif->flags, fn, cif->bytes, &ecif); + + if (alloc != NULL && rvalue != NULL) + memcpy(rvalue, alloc, rsize); +} + +extern void ffi_trampoline(); +extern void ffi_cacheflush(void* start, void* end); + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) +{ + /* copye trampoline to stack and patch 'ffi_closure_SYSV' pointer */ + memcpy(closure->tramp, ffi_trampoline, FFI_TRAMPOLINE_SIZE); + *(unsigned int*)(&closure->tramp[8]) = (unsigned int)ffi_closure_SYSV; + + // Do we have this function? + // __builtin___clear_cache(closer->tramp, closer->tramp + FFI_TRAMPOLINE_SIZE) + ffi_cacheflush(closure->tramp, closure->tramp + FFI_TRAMPOLINE_SIZE); + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + return FFI_OK; +} + + +long FFI_HIDDEN +ffi_closure_SYSV_inner(ffi_closure *closure, void **values, void *rvalue) +{ + ffi_cif *cif; + ffi_type **arg_types; + void **avalue; + int i, areg; + + cif = closure->cif; + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; + + areg = 0; + + int rtype = cif->rtype->type; + if (rtype == FFI_TYPE_STRUCT && cif->rtype->size > 4 * 4) + { + rvalue = *values; + areg++; + } + + cif = closure->cif; + arg_types = cif->arg_types; + avalue = alloca(cif->nargs * sizeof(void *)); + + for (i = 0; i < cif->nargs; i++) + { + if (arg_types[i]->alignment == 8 && (areg & 1) != 0) + areg++; + + // skip the entry 16,a1 framework, add 16 bytes (4 registers) + if (areg == FFI_REGISTER_NARGS) + areg += 4; + + if (arg_types[i]->type == FFI_TYPE_STRUCT) + { + int numregs = ((arg_types[i]->size + 3) & ~3) / 4; + if (areg < FFI_REGISTER_NARGS && areg + numregs > FFI_REGISTER_NARGS) + areg = FFI_REGISTER_NARGS + 4; + } + + avalue[i] = &values[areg]; + areg += (arg_types[i]->size + 3) / 4; + } + + (closure->fun)(cif, rvalue, avalue, closure->user_data); + + return rtype; +} diff --git a/Modules/_ctypes/libffi/src/xtensa/ffitarget.h b/Modules/_ctypes/libffi/src/xtensa/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/xtensa/ffitarget.h @@ -0,0 +1,53 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2013 Tensilica, Inc. + Target configuration macros for XTENSA. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV +} ffi_abi; +#endif + +#define FFI_REGISTER_NARGS 6 + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_NATIVE_RAW_API 0 +#define FFI_TRAMPOLINE_SIZE 24 + +#endif diff --git a/Modules/_ctypes/libffi/src/xtensa/sysv.S b/Modules/_ctypes/libffi/src/xtensa/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/xtensa/sysv.S @@ -0,0 +1,253 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2013 Tensilica, Inc. + + XTENSA Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + +#define ENTRY(name) .text; .globl name; .type name, at function; .align 4; name: +#define END(name) .size name , . - name + +/* Assert that the table below is in sync with ffi.h. */ + +#if FFI_TYPE_UINT8 != 5 \ + || FFI_TYPE_SINT8 != 6 \ + || FFI_TYPE_UINT16 != 7 \ + || FFI_TYPE_SINT16 != 8 \ + || FFI_TYPE_UINT32 != 9 \ + || FFI_TYPE_SINT32 != 10 \ + || FFI_TYPE_UINT64 != 11 +#error "xtensa/sysv.S out of sync with ffi.h" +#endif + + +/* ffi_call_SYSV (rvalue, rbytes, flags, (*fnaddr)(), bytes, ecif) + void *rvalue; a2 + unsigned long rbytes; a3 + unsigned flags; a4 + void (*fnaddr)(); a5 + unsigned long bytes; a6 + extended_cif* ecif) a7 +*/ + +ENTRY(ffi_call_SYSV) + + entry a1, 32 # 32 byte frame for using call8 below + + mov a10, a7 # a10(->arg0): ecif + sub a11, a1, a6 # a11(->arg1): stack pointer + mov a7, a1 # fp + movsp a1, a11 # set new sp = old_sp - bytes + + movi a8, ffi_prep_args + callx8 a8 # ffi_prep_args(ecif, stack) + + # prepare to move stack pointer back up to 6 arguments + # note that 'bytes' is already aligned + + movi a10, 6*4 + sub a11, a6, a10 + movgez a6, a10, a11 + add a6, a1, a6 + + + # we can pass up to 6 arguments in registers + # for simplicity, just load 6 arguments + # (the stack size is at least 32 bytes, so no risk to cross boundaries) + + l32i a10, a1, 0 + l32i a11, a1, 4 + l32i a12, a1, 8 + l32i a13, a1, 12 + l32i a14, a1, 16 + l32i a15, a1, 20 + + # move stack pointer + + movsp a1, a6 + + callx8 a5 # (*fn)(args...) + + # Handle return value(s) + + beqz a2, .Lexit + + movi a5, FFI_TYPE_STRUCT + bne a4, a5, .Lstore + movi a5, 16 + blt a5, a3, .Lexit + + s32i a10, a2, 0 + blti a3, 5, .Lexit + addi a3, a3, -1 + s32i a11, a2, 4 + blti a3, 8, .Lexit + s32i a12, a2, 8 + blti a3, 12, .Lexit + s32i a13, a2, 12 + +.Lexit: retw + +.Lstore: + addi a4, a4, -FFI_TYPE_UINT8 + bgei a4, 7, .Lexit # should never happen + movi a6, store_calls + add a4, a4, a4 + addx4 a6, a4, a6 # store_table + idx * 8 + jx a6 + + .align 8 +store_calls: + # UINT8 + s8i a10, a2, 0 + retw + + # SINT8 + .align 8 + s8i a10, a2, 0 + retw + + # UINT16 + .align 8 + s16i a10, a2, 0 + retw + + # SINT16 + .align 8 + s16i a10, a2, 0 + retw + + # UINT32 + .align 8 + s32i a10, a2, 0 + retw + + # SINT32 + .align 8 + s32i a10, a2, 0 + retw + + # UINT64 + .align 8 + s32i a10, a2, 0 + s32i a11, a2, 4 + retw + +END(ffi_call_SYSV) + + +/* + * void ffi_cacheflush (unsigned long start, unsigned long end) + */ + +#define EXTRA_ARGS_SIZE 24 + +ENTRY(ffi_cacheflush) + + entry a1, 16 + +1: dhwbi a2, 0 + ihi a2, 0 + addi a2, a2, 4 + blt a2, a3, 1b + + retw + +END(ffi_cacheflush) + +/* ffi_trampoline is copied to the stack */ + +ENTRY(ffi_trampoline) + + entry a1, 16 + (FFI_REGISTER_NARGS * 4) + (4 * 4) # [ 0] + j 2f # [ 3] + .align 4 # [ 6] +1: .long 0 # [ 8] +2: l32r a15, 1b # [12] + _mov a14, a0 # [15] + callx0 a15 # [18] + # [21] +END(ffi_trampoline) + +/* + * ffi_closure() + * + * a0: closure + 21 + * a14: return address (a0) + */ + +ENTRY(ffi_closure_SYSV) + + /* intentionally omitting entry here */ + + # restore return address (a0) and move pointer to closure to a10 + addi a10, a0, -21 + mov a0, a14 + + # allow up to 4 arguments as return values + addi a11, a1, 4 * 4 + + # save up to 6 arguments to stack (allocated by entry below) + s32i a2, a11, 0 + s32i a3, a11, 4 + s32i a4, a11, 8 + s32i a5, a11, 12 + s32i a6, a11, 16 + s32i a7, a11, 20 + + movi a8, ffi_closure_SYSV_inner + mov a12, a1 + callx8 a8 # .._inner(*closure, **avalue, *rvalue) + + # load up to four return arguments + l32i a2, a1, 0 + l32i a3, a1, 4 + l32i a4, a1, 8 + l32i a5, a1, 12 + + # (sign-)extend return value + movi a11, FFI_TYPE_UINT8 + bne a10, a11, 1f + extui a2, a2, 0, 8 + retw + +1: movi a11, FFI_TYPE_SINT8 + bne a10, a11, 1f + sext a2, a2, 7 + retw + +1: movi a11, FFI_TYPE_UINT16 + bne a10, a11, 1f + extui a2, a2, 0, 16 + retw + +1: movi a11, FFI_TYPE_SINT16 + bne a10, a11, 1f + sext a2, a2, 15 + +1: retw + +END(ffi_closure_SYSV) diff --git a/Modules/_ctypes/libffi/stamp-h.in b/Modules/_ctypes/libffi/stamp-h.in new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/stamp-h.in @@ -0,0 +1,1 @@ +timestamp diff --git a/Modules/_ctypes/libffi/testsuite/Makefile.am b/Modules/_ctypes/libffi/testsuite/Makefile.am --- a/Modules/_ctypes/libffi/testsuite/Makefile.am +++ b/Modules/_ctypes/libffi/testsuite/Makefile.am @@ -13,68 +13,82 @@ AM_RUNTESTFLAGS = +EXTRA_DEJAGNU_SITE_CONFIG=../local.exp + CLEANFILES = *.exe core* *.log *.sum -EXTRA_DIST = libffi.special/special.exp \ -libffi.special/unwindtest_ffi_call.cc libffi.special/unwindtest.cc \ -libffi.special/ffitestcxx.h config/default.exp lib/target-libpath.exp \ -lib/libffi-dg.exp lib/wrapper.exp libffi.call/float.c \ -libffi.call/cls_multi_schar.c libffi.call/float3.c \ -libffi.call/cls_3_1byte.c libffi.call/stret_large2.c \ -libffi.call/cls_5_1_byte.c libffi.call/stret_medium.c \ -libffi.call/promotion.c libffi.call/cls_dbls_struct.c \ -libffi.call/nested_struct.c libffi.call/closure_fn1.c \ -libffi.call/cls_4_1byte.c libffi.call/cls_float.c \ -libffi.call/cls_2byte.c libffi.call/closure_fn4.c \ -libffi.call/return_fl2.c libffi.call/nested_struct7.c \ -libffi.call/cls_uint.c libffi.call/cls_align_sint64.c \ -libffi.call/float1.c libffi.call/cls_19byte.c \ -libffi.call/nested_struct1.c libffi.call/cls_4byte.c \ -libffi.call/return_fl1.c libffi.call/cls_align_pointer.c \ -libffi.call/nested_struct4.c libffi.call/nested_struct3.c \ -libffi.call/struct7.c libffi.call/nested_struct9.c \ -libffi.call/cls_sshort.c libffi.call/cls_ulonglong.c \ -libffi.call/cls_pointer_stack.c libffi.call/cls_multi_uchar.c \ -libffi.call/testclosure.c libffi.call/cls_3byte1.c \ -libffi.call/struct6.c libffi.call/return_uc.c libffi.call/return_ll1.c \ -libffi.call/cls_ushort.c libffi.call/stret_medium2.c \ -libffi.call/cls_multi_ushortchar.c libffi.call/return_dbl2.c \ -libffi.call/closure_loc_fn0.c libffi.call/return_sc.c \ -libffi.call/nested_struct8.c libffi.call/cls_7_1_byte.c \ -libffi.call/return_ll.c libffi.call/cls_pointer.c \ -libffi.call/err_bad_abi.c libffi.call/return_dbl1.c \ -libffi.call/call.exp libffi.call/ffitest.h libffi.call/strlen.c \ -libffi.call/return_sl.c libffi.call/cls_1_1byte.c \ -libffi.call/struct1.c libffi.call/cls_64byte.c libffi.call/return_ul.c \ -libffi.call/cls_double.c libffi.call/many_win32.c \ -libffi.call/cls_16byte.c libffi.call/cls_align_double.c \ -libffi.call/cls_align_uint16.c libffi.call/cls_9byte1.c \ -libffi.call/cls_multi_sshortchar.c libffi.call/cls_multi_ushort.c \ -libffi.call/closure_stdcall.c libffi.call/return_fl.c \ -libffi.call/strlen_win32.c libffi.call/return_ldl.c \ -libffi.call/cls_align_float.c libffi.call/struct3.c \ -libffi.call/cls_uchar.c libffi.call/cls_sint.c libffi.call/float2.c \ -libffi.call/cls_align_longdouble_split.c \ -libffi.call/cls_longdouble_va.c libffi.call/cls_multi_sshort.c \ -libffi.call/stret_large.c libffi.call/cls_align_sint16.c \ -libffi.call/nested_struct6.c libffi.call/cls_5byte.c \ -libffi.call/return_dbl.c libffi.call/cls_20byte.c \ -libffi.call/cls_8byte.c libffi.call/pyobjc-tc.c \ -libffi.call/cls_24byte.c libffi.call/cls_align_longdouble_split2.c \ -libffi.call/cls_6_1_byte.c libffi.call/cls_schar.c \ -libffi.call/cls_18byte.c libffi.call/closure_fn3.c \ -libffi.call/err_bad_typedef.c libffi.call/closure_fn2.c \ -libffi.call/struct2.c libffi.call/cls_3byte2.c \ -libffi.call/cls_align_longdouble.c libffi.call/cls_20byte1.c \ -libffi.call/return_fl3.c libffi.call/cls_align_uint32.c \ -libffi.call/problem1.c libffi.call/float4.c \ -libffi.call/cls_align_uint64.c libffi.call/struct9.c \ -libffi.call/closure_fn5.c libffi.call/cls_align_sint32.c \ -libffi.call/closure_fn0.c libffi.call/closure_fn6.c \ -libffi.call/struct4.c libffi.call/nested_struct2.c \ -libffi.call/cls_6byte.c libffi.call/cls_7byte.c libffi.call/many.c \ -libffi.call/struct8.c libffi.call/negint.c libffi.call/struct5.c \ -libffi.call/cls_12byte.c libffi.call/cls_double_va.c \ -libffi.call/cls_longdouble.c libffi.call/cls_9byte2.c \ -libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ -libffi.call/huge_struct.c +EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \ +libffi.call/cls_align_longdouble_split.c \ +libffi.call/closure_loc_fn0.c libffi.call/cls_schar.c \ +libffi.call/closure_fn1.c libffi.call/many2_win32.c \ +libffi.call/return_ul.c libffi.call/cls_align_double.c \ +libffi.call/return_fl2.c libffi.call/cls_1_1byte.c \ +libffi.call/cls_64byte.c libffi.call/nested_struct7.c \ +libffi.call/cls_align_sint32.c libffi.call/nested_struct2.c \ +libffi.call/ffitest.h libffi.call/nested_struct4.c \ +libffi.call/cls_multi_ushort.c libffi.call/struct3.c \ +libffi.call/cls_3byte1.c libffi.call/cls_16byte.c \ +libffi.call/struct8.c libffi.call/nested_struct8.c \ +libffi.call/cls_multi_sshort.c libffi.call/cls_3byte2.c \ +libffi.call/fastthis2_win32.c libffi.call/cls_pointer.c \ +libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c \ +libffi.call/cls_9byte2.c libffi.call/cls_multi_schar.c \ +libffi.call/stret_medium2.c libffi.call/cls_5_1_byte.c \ +libffi.call/call.exp libffi.call/cls_double.c \ +libffi.call/cls_align_sint16.c libffi.call/cls_uint.c \ +libffi.call/return_ll1.c libffi.call/nested_struct3.c \ +libffi.call/cls_20byte1.c libffi.call/closure_fn4.c \ +libffi.call/cls_uchar.c libffi.call/struct2.c libffi.call/cls_7byte.c \ +libffi.call/strlen.c libffi.call/many.c libffi.call/testclosure.c \ +libffi.call/return_fl.c libffi.call/struct5.c \ +libffi.call/cls_12byte.c libffi.call/cls_multi_sshortchar.c \ +libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \ +libffi.call/return_fl3.c libffi.call/stret_medium.c \ +libffi.call/nested_struct6.c libffi.call/closure_fn3.c \ +libffi.call/float3.c libffi.call/many2.c \ +libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \ +libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \ +libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \ +libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \ +libffi.call/cls_sshort.c libffi.call/many_win32.c \ +libffi.call/nested_struct.c libffi.call/cls_20byte.c \ +libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \ +libffi.call/return_uc.c libffi.call/closure_thiscall.c \ +libffi.call/cls_18byte.c libffi.call/cls_8byte.c \ +libffi.call/promotion.c libffi.call/struct1_win32.c \ +libffi.call/return_dbl.c libffi.call/cls_24byte.c \ +libffi.call/struct4.c libffi.call/cls_6byte.c \ +libffi.call/cls_align_uint32.c libffi.call/float.c \ +libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \ +libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \ +libffi.call/cls_align_float.c libffi.call/return_fl1.c \ +libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ +libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \ +libffi.call/stret_large2.c libffi.call/return_sl.c \ +libffi.call/closure_fn0.c libffi.call/cls_5byte.c \ +libffi.call/cls_2byte.c libffi.call/float2.c \ +libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \ +libffi.call/stret_large.c libffi.call/cls_ulonglong.c \ +libffi.call/cls_ushort.c libffi.call/nested_struct1.c \ +libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \ +libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \ +libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \ +libffi.call/struct1.c libffi.call/nested_struct9.c \ +libffi.call/huge_struct.c libffi.call/problem1.c \ +libffi.call/float4.c libffi.call/fastthis3_win32.c \ +libffi.call/return_ldl.c libffi.call/strlen2_win32.c \ +libffi.call/closure_fn5.c libffi.call/struct2_win32.c \ +libffi.call/struct6.c libffi.call/return_ll.c libffi.call/struct9.c \ +libffi.call/return_sc.c libffi.call/struct7.c \ +libffi.call/cls_align_uint64.c libffi.call/cls_4byte.c \ +libffi.call/strlen_win32.c libffi.call/cls_6_1_byte.c \ +libffi.call/cls_7_1_byte.c libffi.special/unwindtest.cc \ +libffi.special/special.exp libffi.special/unwindtest_ffi_call.cc \ +libffi.special/ffitestcxx.h lib/wrapper.exp lib/target-libpath.exp \ +lib/libffi.exp libffi.call/cls_struct_va1.c \ +libffi.call/cls_uchar_va.c libffi.call/cls_uint_va.c \ +libffi.call/cls_ulong_va.c libffi.call/cls_ushort_va.c \ +libffi.call/nested_struct11.c libffi.call/uninitialized.c \ +libffi.call/va_1.c libffi.call/va_struct1.c libffi.call/va_struct2.c \ +libffi.call/va_struct3.c + diff --git a/Modules/_ctypes/libffi/testsuite/Makefile.in b/Modules/_ctypes/libffi/testsuite/Makefile.in --- a/Modules/_ctypes/libffi/testsuite/Makefile.in +++ b/Modules/_ctypes/libffi/testsuite/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.12.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,6 +14,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -37,7 +53,19 @@ subdir = testsuite DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_cc_maxopt.m4 \ + $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_configure_args.m4 \ + $(top_srcdir)/m4/ax_enable_builddir.m4 \ + $(top_srcdir)/m4/ax_gcc_archflag.m4 \ + $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -47,12 +75,18 @@ CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac DEJATOOL = $(PACKAGE) RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ +AM_LTLDFLAGS = @AM_LTLDFLAGS@ AM_RUNTESTFLAGS = AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -70,6 +104,7 @@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -77,6 +112,7 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ FGREP = @FGREP@ GREP = @GREP@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ @@ -95,6 +131,7 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -107,8 +144,10 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PRTDIAG = @PRTDIAG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -121,6 +160,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -128,6 +168,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -153,7 +194,6 @@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -164,6 +204,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ @@ -186,70 +227,82 @@ echo $(top_srcdir)/../dejagnu/runtest ; \ else echo runtest; fi` +EXTRA_DEJAGNU_SITE_CONFIG = ../local.exp CLEANFILES = *.exe core* *.log *.sum -EXTRA_DIST = libffi.special/special.exp \ -libffi.special/unwindtest_ffi_call.cc libffi.special/unwindtest.cc \ -libffi.special/ffitestcxx.h config/default.exp lib/target-libpath.exp \ -lib/libffi-dg.exp lib/wrapper.exp libffi.call/float.c \ -libffi.call/cls_multi_schar.c libffi.call/float3.c \ -libffi.call/cls_3_1byte.c libffi.call/stret_large2.c \ -libffi.call/cls_5_1_byte.c libffi.call/stret_medium.c \ -libffi.call/promotion.c libffi.call/cls_dbls_struct.c \ -libffi.call/nested_struct.c libffi.call/closure_fn1.c \ -libffi.call/cls_4_1byte.c libffi.call/cls_float.c \ -libffi.call/cls_2byte.c libffi.call/closure_fn4.c \ -libffi.call/return_fl2.c libffi.call/nested_struct7.c \ -libffi.call/cls_uint.c libffi.call/cls_align_sint64.c \ -libffi.call/float1.c libffi.call/cls_19byte.c \ -libffi.call/nested_struct1.c libffi.call/cls_4byte.c \ -libffi.call/return_fl1.c libffi.call/cls_align_pointer.c \ -libffi.call/nested_struct4.c libffi.call/nested_struct3.c \ -libffi.call/struct7.c libffi.call/nested_struct9.c \ -libffi.call/cls_sshort.c libffi.call/cls_ulonglong.c \ -libffi.call/cls_pointer_stack.c libffi.call/cls_multi_uchar.c \ -libffi.call/testclosure.c libffi.call/cls_3byte1.c \ -libffi.call/struct6.c libffi.call/return_uc.c libffi.call/return_ll1.c \ -libffi.call/cls_ushort.c libffi.call/stret_medium2.c \ -libffi.call/cls_multi_ushortchar.c libffi.call/return_dbl2.c \ -libffi.call/closure_loc_fn0.c libffi.call/return_sc.c \ -libffi.call/nested_struct8.c libffi.call/cls_7_1_byte.c \ -libffi.call/return_ll.c libffi.call/cls_pointer.c \ -libffi.call/err_bad_abi.c libffi.call/return_dbl1.c \ -libffi.call/call.exp libffi.call/ffitest.h libffi.call/strlen.c \ -libffi.call/return_sl.c libffi.call/cls_1_1byte.c \ -libffi.call/struct1.c libffi.call/cls_64byte.c libffi.call/return_ul.c \ -libffi.call/cls_double.c libffi.call/many_win32.c \ -libffi.call/cls_16byte.c libffi.call/cls_align_double.c \ -libffi.call/cls_align_uint16.c libffi.call/cls_9byte1.c \ -libffi.call/cls_multi_sshortchar.c libffi.call/cls_multi_ushort.c \ -libffi.call/closure_stdcall.c libffi.call/return_fl.c \ -libffi.call/strlen_win32.c libffi.call/return_ldl.c \ -libffi.call/cls_align_float.c libffi.call/struct3.c \ -libffi.call/cls_uchar.c libffi.call/cls_sint.c libffi.call/float2.c \ -libffi.call/cls_align_longdouble_split.c \ -libffi.call/cls_longdouble_va.c libffi.call/cls_multi_sshort.c \ -libffi.call/stret_large.c libffi.call/cls_align_sint16.c \ -libffi.call/nested_struct6.c libffi.call/cls_5byte.c \ -libffi.call/return_dbl.c libffi.call/cls_20byte.c \ -libffi.call/cls_8byte.c libffi.call/pyobjc-tc.c \ -libffi.call/cls_24byte.c libffi.call/cls_align_longdouble_split2.c \ -libffi.call/cls_6_1_byte.c libffi.call/cls_schar.c \ -libffi.call/cls_18byte.c libffi.call/closure_fn3.c \ -libffi.call/err_bad_typedef.c libffi.call/closure_fn2.c \ -libffi.call/struct2.c libffi.call/cls_3byte2.c \ -libffi.call/cls_align_longdouble.c libffi.call/cls_20byte1.c \ -libffi.call/return_fl3.c libffi.call/cls_align_uint32.c \ -libffi.call/problem1.c libffi.call/float4.c \ -libffi.call/cls_align_uint64.c libffi.call/struct9.c \ -libffi.call/closure_fn5.c libffi.call/cls_align_sint32.c \ -libffi.call/closure_fn0.c libffi.call/closure_fn6.c \ -libffi.call/struct4.c libffi.call/nested_struct2.c \ -libffi.call/cls_6byte.c libffi.call/cls_7byte.c libffi.call/many.c \ -libffi.call/struct8.c libffi.call/negint.c libffi.call/struct5.c \ -libffi.call/cls_12byte.c libffi.call/cls_double_va.c \ -libffi.call/cls_longdouble.c libffi.call/cls_9byte2.c \ -libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ -libffi.call/huge_struct.c +EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \ +libffi.call/cls_align_longdouble_split.c \ +libffi.call/closure_loc_fn0.c libffi.call/cls_schar.c \ +libffi.call/closure_fn1.c libffi.call/many2_win32.c \ +libffi.call/return_ul.c libffi.call/cls_align_double.c \ +libffi.call/return_fl2.c libffi.call/cls_1_1byte.c \ +libffi.call/cls_64byte.c libffi.call/nested_struct7.c \ +libffi.call/cls_align_sint32.c libffi.call/nested_struct2.c \ +libffi.call/ffitest.h libffi.call/nested_struct4.c \ +libffi.call/cls_multi_ushort.c libffi.call/struct3.c \ +libffi.call/cls_3byte1.c libffi.call/cls_16byte.c \ +libffi.call/struct8.c libffi.call/nested_struct8.c \ +libffi.call/cls_multi_sshort.c libffi.call/cls_3byte2.c \ +libffi.call/fastthis2_win32.c libffi.call/cls_pointer.c \ +libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c \ +libffi.call/cls_9byte2.c libffi.call/cls_multi_schar.c \ +libffi.call/stret_medium2.c libffi.call/cls_5_1_byte.c \ +libffi.call/call.exp libffi.call/cls_double.c \ +libffi.call/cls_align_sint16.c libffi.call/cls_uint.c \ +libffi.call/return_ll1.c libffi.call/nested_struct3.c \ +libffi.call/cls_20byte1.c libffi.call/closure_fn4.c \ +libffi.call/cls_uchar.c libffi.call/struct2.c libffi.call/cls_7byte.c \ +libffi.call/strlen.c libffi.call/many.c libffi.call/testclosure.c \ +libffi.call/return_fl.c libffi.call/struct5.c \ +libffi.call/cls_12byte.c libffi.call/cls_multi_sshortchar.c \ +libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \ +libffi.call/return_fl3.c libffi.call/stret_medium.c \ +libffi.call/nested_struct6.c libffi.call/closure_fn3.c \ +libffi.call/float3.c libffi.call/many2.c \ +libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \ +libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \ +libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \ +libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \ +libffi.call/cls_sshort.c libffi.call/many_win32.c \ +libffi.call/nested_struct.c libffi.call/cls_20byte.c \ +libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \ +libffi.call/return_uc.c libffi.call/closure_thiscall.c \ +libffi.call/cls_18byte.c libffi.call/cls_8byte.c \ +libffi.call/promotion.c libffi.call/struct1_win32.c \ +libffi.call/return_dbl.c libffi.call/cls_24byte.c \ +libffi.call/struct4.c libffi.call/cls_6byte.c \ +libffi.call/cls_align_uint32.c libffi.call/float.c \ +libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \ +libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \ +libffi.call/cls_align_float.c libffi.call/return_fl1.c \ +libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ +libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \ +libffi.call/stret_large2.c libffi.call/return_sl.c \ +libffi.call/closure_fn0.c libffi.call/cls_5byte.c \ +libffi.call/cls_2byte.c libffi.call/float2.c \ +libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \ +libffi.call/stret_large.c libffi.call/cls_ulonglong.c \ +libffi.call/cls_ushort.c libffi.call/nested_struct1.c \ +libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \ +libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \ +libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \ +libffi.call/struct1.c libffi.call/nested_struct9.c \ +libffi.call/huge_struct.c libffi.call/problem1.c \ +libffi.call/float4.c libffi.call/fastthis3_win32.c \ +libffi.call/return_ldl.c libffi.call/strlen2_win32.c \ +libffi.call/closure_fn5.c libffi.call/struct2_win32.c \ +libffi.call/struct6.c libffi.call/return_ll.c libffi.call/struct9.c \ +libffi.call/return_sc.c libffi.call/struct7.c \ +libffi.call/cls_align_uint64.c libffi.call/cls_4byte.c \ +libffi.call/strlen_win32.c libffi.call/cls_6_1_byte.c \ +libffi.call/cls_7_1_byte.c libffi.special/unwindtest.cc \ +libffi.special/special.exp libffi.special/unwindtest_ffi_call.cc \ +libffi.special/ffitestcxx.h lib/wrapper.exp lib/target-libpath.exp \ +lib/libffi.exp libffi.call/cls_struct_va1.c \ +libffi.call/cls_uchar_va.c libffi.call/cls_uint_va.c \ +libffi.call/cls_ulong_va.c libffi.call/cls_ushort_va.c \ +libffi.call/nested_struct11.c libffi.call/uninitialized.c \ +libffi.call/va_1.c libffi.call/va_struct1.c libffi.call/va_struct2.c \ +libffi.call/va_struct3.c all: all-am @@ -296,9 +349,11 @@ ctags: CTAGS CTAGS: +cscope cscopelist: + check-DEJAGNU: site.exp - srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \ + srcdir='$(srcdir)'; export srcdir; \ EXPECT=$(EXPECT); export EXPECT; \ runtest=$(RUNTEST); \ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ @@ -306,15 +361,15 @@ if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \ then :; else exit_status=1; fi; \ done; \ - else echo "WARNING: could not find \`runtest'" 1>&2; :;\ + else echo "WARNING: could not find 'runtest'" 1>&2; :;\ fi; \ exit $$exit_status -site.exp: Makefile - @echo 'Making a new site.exp file...' +site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG) + @echo 'Making a new site.exp file ...' @echo '## these variables are automatically generated by make ##' >site.tmp @echo '# Do not edit here. If you wish to override these values' >>site.tmp @echo '# edit the last section' >>site.tmp - @echo 'set srcdir $(srcdir)' >>site.tmp + @echo 'set srcdir "$(srcdir)"' >>site.tmp @echo "set objdir `pwd`" >>site.tmp @echo 'set build_alias "$(build_alias)"' >>site.tmp @echo 'set build_triplet $(build_triplet)' >>site.tmp @@ -322,9 +377,16 @@ @echo 'set host_triplet $(host_triplet)' >>site.tmp @echo 'set target_alias "$(target_alias)"' >>site.tmp @echo 'set target_triplet $(target_triplet)' >>site.tmp - @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp - @test ! -f site.exp || \ - sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp + @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \ + echo "## Begin content included from file $$f. Do not modify. ##" \ + && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \ + && echo "## End content included from file $$f. ##" \ + || exit 1; \ + done >> site.tmp + @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp + @if test -f site.exp; then \ + sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \ + fi @-rm -f site.bak @test ! -f site.exp || mv site.exp site.bak @mv site.tmp site.exp @@ -380,10 +442,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: diff --git a/Modules/_ctypes/libffi/testsuite/lib/libffi-dg.exp b/Modules/_ctypes/libffi/testsuite/lib/libffi-dg.exp deleted file mode 100644 --- a/Modules/_ctypes/libffi/testsuite/lib/libffi-dg.exp +++ /dev/null @@ -1,300 +0,0 @@ -# Copyright (C) 2003, 2005, 2008, 2009, 2010 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -proc load_gcc_lib { filename } { - global srcdir - load_file $srcdir/lib/$filename -} - -load_lib dg.exp -load_lib libgloss.exp -load_gcc_lib target-libpath.exp -load_gcc_lib wrapper.exp - - -# Define libffi callbacks for dg.exp. - -proc libffi-dg-test-1 { target_compile prog do_what extra_tool_flags } { - - # To get all \n in dg-output test strings to match printf output - # in a system that outputs it as \015\012 (i.e. not just \012), we - # need to change all \n into \r?\n. As there is no dejagnu flag - # or hook to do that, we simply change the text being tested. - # Unfortunately, we have to know that the variable is called - # dg-output-text and lives in the caller of libffi-dg-test, which - # is two calls up. Overriding proc dg-output would be longer and - # would necessarily have the same assumption. - upvar 2 dg-output-text output_match - - if { [llength $output_match] > 1 } { - regsub -all "\n" [lindex $output_match 1] "\r?\n" x - set output_match [lreplace $output_match 1 1 $x] - } - - # Set up the compiler flags, based on what we're going to do. - - set options [list] - switch $do_what { - "compile" { - set compile_type "assembly" - set output_file "[file rootname [file tail $prog]].s" - } - "link" { - set compile_type "executable" - set output_file "[file rootname [file tail $prog]].exe" - # The following line is needed for targets like the i960 where - # the default output file is b.out. Sigh. - } - "run" { - set compile_type "executable" - # FIXME: "./" is to cope with "." not being in $PATH. - # Should this be handled elsewhere? - # YES. - set output_file "./[file rootname [file tail $prog]].exe" - # This is the only place where we care if an executable was - # created or not. If it was, dg.exp will try to run it. - remote_file build delete $output_file; - } - default { - perror "$do_what: not a valid dg-do keyword" - return "" - } - } - - if { $extra_tool_flags != "" } { - lappend options "additional_flags=$extra_tool_flags" - } - - set comp_output [libffi_target_compile "$prog" "$output_file" "$compile_type" $options]; - - - return [list $comp_output $output_file] -} - - -proc libffi-dg-test { prog do_what extra_tool_flags } { - return [libffi-dg-test-1 target_compile $prog $do_what $extra_tool_flags] -} - -proc libffi-init { args } { - global gluefile wrap_flags; - global srcdir - global blddirffi - global objdir - global TOOL_OPTIONS - global tool - global libffi_include - global libffi_link_flags - global tool_root_dir - global ld_library_path - - set blddirffi [pwd]/.. - verbose "libffi $blddirffi" - - set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] - if {$gccdir != ""} { - set gccdir [file dirname $gccdir] - } - verbose "gccdir $gccdir" - - set ld_library_path "." - append ld_library_path ":${gccdir}" - - set compiler "${gccdir}/xgcc" - if { [is_remote host] == 0 && [which $compiler] != 0 } { - foreach i "[exec $compiler --print-multi-lib]" { - set mldir "" - regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir - set mldir [string trimright $mldir "\;@"] - if { "$mldir" == "." } { - continue - } - if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } { - append ld_library_path ":${gccdir}/${mldir}" - } - } - } - # add the library path for libffi. - append ld_library_path ":${blddirffi}/.libs" - - verbose "ld_library_path: $ld_library_path" - - # Point to the Libffi headers in libffi. - set libffi_include "${blddirffi}/include" - verbose "libffi_include $libffi_include" - - set libffi_dir "${blddirffi}/.libs" - verbose "libffi_dir $libffi_dir" - if { $libffi_dir != "" } { - set libffi_dir [file dirname ${libffi_dir}] - set libffi_link_flags "-L${libffi_dir}/.libs" - } - - set_ld_library_path_env_vars - libffi_maybe_build_wrapper "${objdir}/testglue.o" -} - -proc libffi_exit { } { - global gluefile; - - if [info exists gluefile] { - file_on_build delete $gluefile; - unset gluefile; - } -} - -proc libffi_target_compile { source dest type options } { - global gluefile wrap_flags; - global srcdir - global blddirffi - global TOOL_OPTIONS - global libffi_link_flags - global libffi_include - global target_triplet - - - if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } { - lappend options "libs=${gluefile}" - lappend options "ldflags=$wrap_flags" - } - - # TOOL_OPTIONS must come first, so that it doesn't override testcase - # specific options. - if [info exists TOOL_OPTIONS] { - lappend options [concat "additional_flags=$TOOL_OPTIONS" $options]; - } - - # search for ffi_mips.h in srcdir, too - lappend options "additional_flags=-I${libffi_include} -I${srcdir}/../include -I${libffi_include}/.." - lappend options "additional_flags=${libffi_link_flags}" - - # Darwin needs a stack execution allowed flag. - - if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"] - || [istarget "*-*-darwin2*"] } { - lappend options "additional_flags=-Wl,-allow_stack_execute" - } - - # If you're building the compiler with --prefix set to a place - # where it's not yet installed, then the linker won't be able to - # find the libgcc used by libffi.dylib. We could pass the - # -dylib_file option, but that's complicated, and it's much easier - # to just make the linker find libgcc using -L options. - if { [string match "*-*-darwin*" $target_triplet] } { - lappend options "libs= -shared-libgcc" - } - - if { [string match "*-*-openbsd*" $target_triplet] } { - lappend options "libs= -lpthread" - } - - lappend options "libs= -lffi" - - verbose "options: $options" - return [target_compile $source $dest $type $options] -} - -# Utility routines. - -# -# search_for -- looks for a string match in a file -# -proc search_for { file pattern } { - set fd [open $file r] - while { [gets $fd cur_line]>=0 } { - if [string match "*$pattern*" $cur_line] then { - close $fd - return 1 - } - } - close $fd - return 0 -} - -# Modified dg-runtest that can cycle through a list of optimization options -# as c-torture does. -proc libffi-dg-runtest { testcases default-extra-flags } { - global runtests - - foreach test $testcases { - # If we're only testing specific files and this isn't one of - # them, skip it. - if ![runtest_file_p $runtests $test] { - continue - } - - # Look for a loop within the source code - if we don't find one, - # don't pass -funroll[-all]-loops. - global torture_with_loops torture_without_loops - if [expr [search_for $test "for*("]+[search_for $test "while*("]] { - set option_list $torture_with_loops - } else { - set option_list $torture_without_loops - } - - set nshort [file tail [file dirname $test]]/[file tail $test] - - foreach flags $option_list { - verbose "Testing $nshort, $flags" 1 - dg-test $test $flags ${default-extra-flags} - } - } -} - - -# Like check_conditional_xfail, but callable from a dg test. - -proc dg-xfail-if { args } { - set args [lreplace $args 0 0] - set selector "target [join [lindex $args 1]]" - if { [dg-process-target $selector] == "S" } { - global compiler_conditional_xfail_data - set compiler_conditional_xfail_data $args - } -} - - -# We need to make sure that additional_files and additional_sources -# are both cleared out after every test. It is not enough to clear -# them out *before* the next test run because gcc-target-compile gets -# run directly from some .exp files (outside of any test). (Those -# uses should eventually be eliminated.) - -# Because the DG framework doesn't provide a hook that is run at the -# end of a test, we must replace dg-test with a wrapper. - -if { [info procs saved-dg-test] == [list] } { - rename dg-test saved-dg-test - - proc dg-test { args } { - global additional_files - global additional_sources - global errorInfo - - if { [ catch { eval saved-dg-test $args } errmsg ] } { - set saved_info $errorInfo - set additional_files "" - set additional_sources "" - error $errmsg $saved_info - } - set additional_files "" - set additional_sources "" - } -} - -# Local Variables: -# tcl-indent-level:4 -# End: diff --git a/Modules/_ctypes/libffi/testsuite/lib/libffi.exp b/Modules/_ctypes/libffi/testsuite/lib/libffi.exp new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/lib/libffi.exp @@ -0,0 +1,369 @@ +# Copyright (C) 2003, 2005, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING3. If not see +# . + +proc load_gcc_lib { filename } { + global srcdir + load_file $srcdir/lib/$filename +} + +load_lib dg.exp +load_lib libgloss.exp +load_gcc_lib target-libpath.exp +load_gcc_lib wrapper.exp + + +# Define libffi callbacks for dg.exp. + +proc libffi-dg-test-1 { target_compile prog do_what extra_tool_flags } { + + # To get all \n in dg-output test strings to match printf output + # in a system that outputs it as \015\012 (i.e. not just \012), we + # need to change all \n into \r?\n. As there is no dejagnu flag + # or hook to do that, we simply change the text being tested. + # Unfortunately, we have to know that the variable is called + # dg-output-text and lives in the caller of libffi-dg-test, which + # is two calls up. Overriding proc dg-output would be longer and + # would necessarily have the same assumption. + upvar 2 dg-output-text output_match + + if { [llength $output_match] > 1 } { + regsub -all "\n" [lindex $output_match 1] "\r?\n" x + set output_match [lreplace $output_match 1 1 $x] + } + + # Set up the compiler flags, based on what we're going to do. + + set options [list] + switch $do_what { + "compile" { + set compile_type "assembly" + set output_file "[file rootname [file tail $prog]].s" + } + "link" { + set compile_type "executable" + set output_file "[file rootname [file tail $prog]].exe" + # The following line is needed for targets like the i960 where + # the default output file is b.out. Sigh. + } + "run" { + set compile_type "executable" + # FIXME: "./" is to cope with "." not being in $PATH. + # Should this be handled elsewhere? + # YES. + set output_file "./[file rootname [file tail $prog]].exe" + # This is the only place where we care if an executable was + # created or not. If it was, dg.exp will try to run it. + remote_file build delete $output_file; + } + default { + perror "$do_what: not a valid dg-do keyword" + return "" + } + } + + if { $extra_tool_flags != "" } { + lappend options "additional_flags=$extra_tool_flags" + } + + set comp_output [libffi_target_compile "$prog" "$output_file" "$compile_type" $options]; + + + return [list $comp_output $output_file] +} + + +proc libffi-dg-test { prog do_what extra_tool_flags } { + return [libffi-dg-test-1 target_compile $prog $do_what $extra_tool_flags] +} + +proc libffi-init { args } { + global gluefile wrap_flags; + global srcdir + global blddirffi + global objdir + global TOOL_OPTIONS + global tool + global libffi_include + global libffi_link_flags + global tool_root_dir + global ld_library_path + + global using_gcc + + set blddirffi [pwd]/.. + verbose "libffi $blddirffi" + + # Are we building with GCC? + set tmp [grep ../config.status "GCC='yes'"] + if { [string match $tmp "GCC='yes'"] } { + + set using_gcc "yes" + + set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] + if {$gccdir != ""} { + set gccdir [file dirname $gccdir] + } + verbose "gccdir $gccdir" + + set ld_library_path "." + append ld_library_path ":${gccdir}" + + set compiler "${gccdir}/xgcc" + if { [is_remote host] == 0 && [which $compiler] != 0 } { + foreach i "[exec $compiler --print-multi-lib]" { + set mldir "" + regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir + set mldir [string trimright $mldir "\;@"] + if { "$mldir" == "." } { + continue + } + if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } { + append ld_library_path ":${gccdir}/${mldir}" + } + } + } + + } else { + + set using_gcc "no" + + } + + # add the library path for libffi. + append ld_library_path ":${blddirffi}/.libs" + + verbose "ld_library_path: $ld_library_path" + + # Point to the Libffi headers in libffi. + set libffi_include "${blddirffi}/include" + verbose "libffi_include $libffi_include" + + set libffi_dir "${blddirffi}/.libs" + verbose "libffi_dir $libffi_dir" + if { $libffi_dir != "" } { + set libffi_dir [file dirname ${libffi_dir}] + set libffi_link_flags "-L${libffi_dir}/.libs" + } + + set_ld_library_path_env_vars + libffi_maybe_build_wrapper "${objdir}/testglue.o" +} + +proc libffi_exit { } { + global gluefile; + + if [info exists gluefile] { + file_on_build delete $gluefile; + unset gluefile; + } +} + +proc libffi_target_compile { source dest type options } { + global gluefile wrap_flags; + global srcdir + global blddirffi + global TOOL_OPTIONS + global libffi_link_flags + global libffi_include + global target_triplet + + + if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } { + lappend options "libs=${gluefile}" + lappend options "ldflags=$wrap_flags" + } + + # TOOL_OPTIONS must come first, so that it doesn't override testcase + # specific options. + if [info exists TOOL_OPTIONS] { + lappend options [concat "additional_flags=$TOOL_OPTIONS" $options]; + } + + # search for ffi_mips.h in srcdir, too + lappend options "additional_flags=-I${libffi_include} -I${srcdir}/../include -I${libffi_include}/.." + lappend options "additional_flags=${libffi_link_flags}" + + # Darwin needs a stack execution allowed flag. + + if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"] + || [istarget "*-*-darwin2*"] } { + lappend options "additional_flags=-Wl,-allow_stack_execute" + } + + # If you're building the compiler with --prefix set to a place + # where it's not yet installed, then the linker won't be able to + # find the libgcc used by libffi.dylib. We could pass the + # -dylib_file option, but that's complicated, and it's much easier + # to just make the linker find libgcc using -L options. + if { [string match "*-*-darwin*" $target_triplet] } { + lappend options "libs= -shared-libgcc" + } + + if { [string match "*-*-openbsd*" $target_triplet] } { + lappend options "libs= -lpthread" + } + + lappend options "libs= -lffi" + + if { [string match "aarch64*-*-linux*" $target_triplet] } { + lappend options "libs= -lpthread" + } + + verbose "options: $options" + return [target_compile $source $dest $type $options] +} + +# Utility routines. + +# +# search_for -- looks for a string match in a file +# +proc search_for { file pattern } { + set fd [open $file r] + while { [gets $fd cur_line]>=0 } { + if [string match "*$pattern*" $cur_line] then { + close $fd + return 1 + } + } + close $fd + return 0 +} + +# Modified dg-runtest that can cycle through a list of optimization options +# as c-torture does. +proc libffi-dg-runtest { testcases default-extra-flags } { + global runtests + + foreach test $testcases { + # If we're only testing specific files and this isn't one of + # them, skip it. + if ![runtest_file_p $runtests $test] { + continue + } + + # Look for a loop within the source code - if we don't find one, + # don't pass -funroll[-all]-loops. + global torture_with_loops torture_without_loops + if [expr [search_for $test "for*("]+[search_for $test "while*("]] { + set option_list $torture_with_loops + } else { + set option_list $torture_without_loops + } + + set nshort [file tail [file dirname $test]]/[file tail $test] + + foreach flags $option_list { + verbose "Testing $nshort, $flags" 1 + dg-test $test $flags ${default-extra-flags} + } + } +} + + +# Like check_conditional_xfail, but callable from a dg test. + +proc dg-xfail-if { args } { + set args [lreplace $args 0 0] + set selector "target [join [lindex $args 1]]" + if { [dg-process-target $selector] == "S" } { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data $args + } +} + +proc check-flags { args } { + + # The args are within another list; pull them out. + set args [lindex $args 0] + + # The next two arguments are optional. If they were not specified, + # use the defaults. + if { [llength $args] == 2 } { + lappend $args [list "*"] + } + if { [llength $args] == 3 } { + lappend $args [list ""] + } + + # If the option strings are the defaults, or the same as the + # defaults, there is no need to call check_conditional_xfail to + # compare them to the actual options. + if { [string compare [lindex $args 2] "*"] == 0 + && [string compare [lindex $args 3] "" ] == 0 } { + set result 1 + } else { + # The target list might be an effective-target keyword, so replace + # the original list with "*-*-*", since we already know it matches. + set result [check_conditional_xfail [lreplace $args 1 1 "*-*-*"]] + } + + return $result +} + +proc dg-skip-if { args } { + # Verify the number of arguments. The last two are optional. + set args [lreplace $args 0 0] + if { [llength $args] < 2 || [llength $args] > 4 } { + error "dg-skip-if 2: need 2, 3, or 4 arguments" + } + + # Don't bother if we're already skipping the test. + upvar dg-do-what dg-do-what + if { [lindex ${dg-do-what} 1] == "N" } { + return + } + + set selector [list target [lindex $args 1]] + if { [dg-process-target $selector] == "S" } { + if [check-flags $args] { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + } + } +} + +# We need to make sure that additional_files and additional_sources +# are both cleared out after every test. It is not enough to clear +# them out *before* the next test run because gcc-target-compile gets +# run directly from some .exp files (outside of any test). (Those +# uses should eventually be eliminated.) + +# Because the DG framework doesn't provide a hook that is run at the +# end of a test, we must replace dg-test with a wrapper. + +if { [info procs saved-dg-test] == [list] } { + rename dg-test saved-dg-test + + proc dg-test { args } { + global additional_files + global additional_sources + global errorInfo + + if { [ catch { eval saved-dg-test $args } errmsg ] } { + set saved_info $errorInfo + set additional_files "" + set additional_sources "" + error $errmsg $saved_info + } + set additional_files "" + set additional_sources "" + } +} + +# Local Variables: +# tcl-indent-level:4 +# End: diff --git a/Modules/_ctypes/libffi/testsuite/lib/target-libpath.exp b/Modules/_ctypes/libffi/testsuite/lib/target-libpath.exp --- a/Modules/_ctypes/libffi/testsuite/lib/target-libpath.exp +++ b/Modules/_ctypes/libffi/testsuite/lib/target-libpath.exp @@ -25,7 +25,7 @@ set orig_ld_library_path_32_saved 0 set orig_ld_library_path_64_saved 0 set orig_dyld_library_path_saved 0 - +set orig_path_saved 0 ####################################### # proc set_ld_library_path_env_vars { } @@ -42,6 +42,7 @@ global orig_ld_library_path_32_saved global orig_ld_library_path_64_saved global orig_dyld_library_path_saved + global orig_path_saved global orig_ld_library_path global orig_ld_run_path global orig_shlib_path @@ -50,6 +51,7 @@ global orig_ld_library_path_32 global orig_ld_library_path_64 global orig_dyld_library_path + global orig_path global GCC_EXEC_PREFIX # Set the relocated compiler prefix, but only if the user hasn't specified one. @@ -100,6 +102,10 @@ set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)" set orig_dyld_library_path_saved 1 } + if [info exists env(PATH)] { + set orig_path "$env(PATH)" + set orig_path_saved 1 + } } # We need to set ld library path in the environment. Currently, @@ -169,6 +175,13 @@ } else { setenv DYLD_LIBRARY_PATH "$ld_library_path" } + if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } { + if { $orig_path_saved } { + setenv PATH "$ld_library_path:$orig_path" + } else { + setenv PATH "$ld_library_path" + } + } verbose -log "set_ld_library_path_env_vars: ld_library_path=$ld_library_path" } @@ -187,6 +200,7 @@ global orig_ld_library_path_32_saved global orig_ld_library_path_64_saved global orig_dyld_library_path_saved + global orig_path_saved global orig_ld_library_path global orig_ld_run_path global orig_shlib_path @@ -195,6 +209,7 @@ global orig_ld_library_path_32 global orig_ld_library_path_64 global orig_dyld_library_path + global orig_path if { $orig_environment_saved == 0 } { return @@ -240,6 +255,11 @@ } elseif [info exists env(DYLD_LIBRARY_PATH)] { unsetenv DYLD_LIBRARY_PATH } + if { $orig_path_saved } { + setenv PATH "$orig_path" + } elseif [info exists env(PATH)] { + unsetenv PATH + } } ####################################### diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/call.exp b/Modules/_ctypes/libffi/testsuite/libffi.call/call.exp --- a/Modules/_ctypes/libffi/testsuite/libffi.call/call.exp +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/call.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2003, 2006, 2009 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006, 2009, 2010 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,20 +14,25 @@ # along with this program; see the file COPYING3. If not see # . -# libffi testsuite that uses the 'dg.exp' driver. - -load_lib libffi-dg.exp - dg-init libffi-init global srcdir subdir -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" "" +if { [string match $using_gcc "yes"] } { + + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" "" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" "" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" "" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" "" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" "" + +} else { + + # Assume we are using the vendor compiler. + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" "" + +} dg-finish diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/closure_stdcall.c b/Modules/_ctypes/libffi/testsuite/libffi.call/closure_stdcall.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/closure_stdcall.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/closure_stdcall.c @@ -49,9 +49,17 @@ CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_stdcall, (void *) 3 /* userdata */, code) == FFI_OK); +#ifdef _MSC_VER + __asm { mov sp_pre, esp } +#else asm volatile (" movl %%esp,%0" : "=g" (sp_pre)); +#endif res = (*(closure_test_type0)code)(0, 1, 2, 3); +#ifdef _MSC_VER + __asm { mov sp_post, esp } +#else asm volatile (" movl %%esp,%0" : "=g" (sp_post)); +#endif /* { dg-output "0 1 2 3: 9" } */ printf("res: %d\n",res); diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/closure_thiscall.c b/Modules/_ctypes/libffi/testsuite/libffi.call/closure_thiscall.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/closure_thiscall.c @@ -0,0 +1,72 @@ +/* Area: closure_call (thiscall convention) + Purpose: Check handling when caller expects thiscall callee + Limitations: none. + PR: none. + Originator: */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ +#include "ffitest.h" + +static void +closure_test_thiscall(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata) +{ + *(ffi_arg*)resp = + (int)*(int *)args[0] + (int)(*(int *)args[1]) + + (int)(*(int *)args[2]) + (int)(*(int *)args[3]) + + (int)(intptr_t)userdata; + + printf("%d %d %d %d: %d\n", + (int)*(int *)args[0], (int)(*(int *)args[1]), + (int)(*(int *)args[2]), (int)(*(int *)args[3]), + (int)*(ffi_arg *)resp); + +} + +typedef int (__thiscall *closure_test_type0)(int, int, int, int); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[17]; + int res; + void* sp_pre; + void* sp_post; + char buf[1024]; + + cl_arg_types[0] = &ffi_type_uint; + cl_arg_types[1] = &ffi_type_uint; + cl_arg_types[2] = &ffi_type_uint; + cl_arg_types[3] = &ffi_type_uint; + cl_arg_types[4] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_THISCALL, 4, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_thiscall, + (void *) 3 /* userdata */, code) == FFI_OK); + +#ifdef _MSC_VER + __asm { mov sp_pre, esp } +#else + asm volatile (" movl %%esp,%0" : "=g" (sp_pre)); +#endif + res = (*(closure_test_type0)code)(0, 1, 2, 3); +#ifdef _MSC_VER + __asm { mov sp_post, esp } +#else + asm volatile (" movl %%esp,%0" : "=g" (sp_post)); +#endif + /* { dg-output "0 1 2 3: 9" } */ + + printf("res: %d\n",res); + /* { dg-output "\nres: 9" } */ + + sprintf(buf, "mismatch: pre=%p vs post=%p", sp_pre, sp_post); + printf("stack pointer %s\n", (sp_pre == sp_post ? "match" : buf)); + /* { dg-output "\nstack pointer match" } */ + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_12byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_12byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_12byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_12byte.c @@ -49,15 +49,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_12byte h_dbl = { 7, 4, 9 }; + struct cls_struct_12byte j_dbl = { 1, 5, 3 }; + struct cls_struct_12byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_12byte h_dbl = { 7, 4, 9 }; - struct cls_struct_12byte j_dbl = { 1, 5, 3 }; - struct cls_struct_12byte res_dbl; - cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_sint; cls_struct_fields[2] = &ffi_type_sint; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_16byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_16byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_16byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_16byte.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_16byte h_dbl = { 7, 8.0, 9 }; + struct cls_struct_16byte j_dbl = { 1, 9.0, 3 }; + struct cls_struct_16byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_16byte h_dbl = { 7, 8.0, 9 }; - struct cls_struct_16byte j_dbl = { 1, 9.0, 3 }; - struct cls_struct_16byte res_dbl; - cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_sint; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_18byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_18byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_18byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_18byte.c @@ -54,15 +54,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; + struct cls_struct_18byte g_dbl = { 1.0, 127, 126, 3.0 }; + struct cls_struct_18byte f_dbl = { 4.0, 125, 124, 5.0 }; + struct cls_struct_18byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_18byte g_dbl = { 1.0, 127, 126, 3.0 }; - struct cls_struct_18byte f_dbl = { 4.0, 125, 124, 5.0 }; - struct cls_struct_18byte res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_19byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_19byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_19byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_19byte.c @@ -57,15 +57,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; + struct cls_struct_19byte g_dbl = { 1.0, 127, 126, 3.0, 120 }; + struct cls_struct_19byte f_dbl = { 4.0, 125, 124, 5.0, 119 }; + struct cls_struct_19byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_19byte g_dbl = { 1.0, 127, 126, 3.0, 120 }; - struct cls_struct_19byte f_dbl = { 4.0, 125, 124, 5.0, 119 }; - struct cls_struct_19byte res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_1_1byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_1_1byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_1_1byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_1_1byte.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_1_1byte g_dbl = { 12 }; + struct cls_struct_1_1byte f_dbl = { 178 }; + struct cls_struct_1_1byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_1_1byte g_dbl = { 12 }; - struct cls_struct_1_1byte f_dbl = { 178 }; - struct cls_struct_1_1byte res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_20byte g_dbl = { 1.0, 2.0, 3 }; + struct cls_struct_20byte f_dbl = { 4.0, 5.0, 7 }; + struct cls_struct_20byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_20byte g_dbl = { 1.0, 2.0, 3 }; - struct cls_struct_20byte f_dbl = { 4.0, 5.0, 7 }; - struct cls_struct_20byte res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_sint; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte1.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte1.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte1.c @@ -52,15 +52,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; + struct cls_struct_20byte g_dbl = { 1, 2.0, 3.0 }; + struct cls_struct_20byte f_dbl = { 4, 5.0, 7.0 }; + struct cls_struct_20byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_20byte g_dbl = { 1, 2.0, 3.0 }; - struct cls_struct_20byte f_dbl = { 4, 5.0, 7.0 }; - struct cls_struct_20byte res_dbl; - cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_24byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_24byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_24byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_24byte.c @@ -61,17 +61,17 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - struct cls_struct_24byte e_dbl = { 9.0, 2.0, 6, 5.0 }; struct cls_struct_24byte f_dbl = { 1.0, 2.0, 3, 7.0 }; struct cls_struct_24byte g_dbl = { 4.0, 5.0, 7, 9.0 }; struct cls_struct_24byte h_dbl = { 8.0, 6.0, 1, 4.0 }; struct cls_struct_24byte res_dbl; + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_sint; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_2byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_2byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_2byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_2byte.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_2byte g_dbl = { 12, 127 }; + struct cls_struct_2byte f_dbl = { 1, 13 }; + struct cls_struct_2byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_2byte g_dbl = { 12, 127 }; - struct cls_struct_2byte f_dbl = { 1, 13 }; - struct cls_struct_2byte res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3_1byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3_1byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3_1byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3_1byte.c @@ -54,15 +54,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_3_1byte g_dbl = { 12, 13, 14 }; + struct cls_struct_3_1byte f_dbl = { 178, 179, 180 }; + struct cls_struct_3_1byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_3_1byte g_dbl = { 12, 13, 14 }; - struct cls_struct_3_1byte f_dbl = { 178, 179, 180 }; - struct cls_struct_3_1byte res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte1.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte1.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte1.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_3byte g_dbl = { 12, 119 }; + struct cls_struct_3byte f_dbl = { 1, 15 }; + struct cls_struct_3byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_3byte g_dbl = { 12, 119 }; - struct cls_struct_3byte f_dbl = { 1, 15 }; - struct cls_struct_3byte res_dbl; - cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte2.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_3byte_1 g_dbl = { 15, 125 }; + struct cls_struct_3byte_1 f_dbl = { 9, 19 }; + struct cls_struct_3byte_1 res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_3byte_1 g_dbl = { 15, 125 }; - struct cls_struct_3byte_1 f_dbl = { 9, 19 }; - struct cls_struct_3byte_1 res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4_1byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4_1byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4_1byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4_1byte.c @@ -56,15 +56,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_4_1byte g_dbl = { 12, 13, 14, 15 }; + struct cls_struct_4_1byte f_dbl = { 178, 179, 180, 181 }; + struct cls_struct_4_1byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_4_1byte g_dbl = { 12, 13, 14, 15 }; - struct cls_struct_4_1byte f_dbl = { 178, 179, 180, 181 }; - struct cls_struct_4_1byte res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4byte.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_4byte g_dbl = { 127, 120 }; + struct cls_struct_4byte f_dbl = { 12, 128 }; + struct cls_struct_4byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_4byte g_dbl = { 127, 120 }; - struct cls_struct_4byte f_dbl = { 12, 128 }; - struct cls_struct_4byte res_dbl; - cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5_1_byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5_1_byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5_1_byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5_1_byte.c @@ -58,15 +58,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_5byte g_dbl = { 127, 120, 1, 3, 4 }; + struct cls_struct_5byte f_dbl = { 12, 128, 9, 3, 4 }; + struct cls_struct_5byte res_dbl = { 0, 0, 0, 0, 0 }; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_5byte g_dbl = { 127, 120, 1, 3, 4 }; - struct cls_struct_5byte f_dbl = { 12, 128, 9, 3, 4 }; - struct cls_struct_5byte res_dbl = { 0, 0, 0, 0, 0 }; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5byte.c @@ -53,15 +53,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_5byte g_dbl = { 127, 120, 1 }; + struct cls_struct_5byte f_dbl = { 12, 128, 9 }; + struct cls_struct_5byte res_dbl = { 0, 0, 0 }; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_5byte g_dbl = { 127, 120, 1 }; - struct cls_struct_5byte f_dbl = { 12, 128, 9 }; - struct cls_struct_5byte res_dbl = { 0, 0, 0 }; - cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_64byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_64byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_64byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_64byte.c @@ -66,17 +66,17 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - struct cls_struct_64byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0 }; struct cls_struct_64byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0 }; struct cls_struct_64byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0 }; struct cls_struct_64byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0 }; struct cls_struct_64byte res_dbl; + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6_1_byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6_1_byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6_1_byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6_1_byte.c @@ -60,15 +60,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_6byte g_dbl = { 127, 120, 1, 3, 4, 5 }; + struct cls_struct_6byte f_dbl = { 12, 128, 9, 3, 4, 5 }; + struct cls_struct_6byte res_dbl = { 0, 0, 0, 0, 0, 0 }; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_6byte g_dbl = { 127, 120, 1, 3, 4, 5 }; - struct cls_struct_6byte f_dbl = { 12, 128, 9, 3, 4, 5 }; - struct cls_struct_6byte res_dbl = { 0, 0, 0, 0, 0, 0 }; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6byte.c @@ -56,15 +56,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_6byte g_dbl = { 127, 120, 1, 128 }; + struct cls_struct_6byte f_dbl = { 12, 128, 9, 127 }; + struct cls_struct_6byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_6byte g_dbl = { 127, 120, 1, 128 }; - struct cls_struct_6byte f_dbl = { 12, 128, 9, 127 }; - struct cls_struct_6byte res_dbl; - cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7_1_byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7_1_byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7_1_byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7_1_byte.c @@ -62,15 +62,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_7byte g_dbl = { 127, 120, 1, 3, 4, 5, 6 }; + struct cls_struct_7byte f_dbl = { 12, 128, 9, 3, 4, 5, 6 }; + struct cls_struct_7byte res_dbl = { 0, 0, 0, 0, 0, 0, 0 }; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_7byte g_dbl = { 127, 120, 1, 3, 4, 5, 6 }; - struct cls_struct_7byte f_dbl = { 12, 128, 9, 3, 4, 5, 6 }; - struct cls_struct_7byte res_dbl = { 0, 0, 0, 0, 0, 0, 0 }; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7byte.c @@ -55,15 +55,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_7byte g_dbl = { 127, 120, 1, 254 }; + struct cls_struct_7byte f_dbl = { 12, 128, 9, 255 }; + struct cls_struct_7byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_7byte g_dbl = { 127, 120, 1, 254 }; - struct cls_struct_7byte f_dbl = { 12, 128, 9, 255 }; - struct cls_struct_7byte res_dbl; - cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_8byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_8byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_8byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_8byte.c @@ -49,15 +49,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_8byte g_dbl = { 1, 2.0 }; + struct cls_struct_8byte f_dbl = { 4, 5.0 }; + struct cls_struct_8byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_8byte g_dbl = { 1, 2.0 }; - struct cls_struct_8byte f_dbl = { 4, 5.0 }; - struct cls_struct_8byte res_dbl; - cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte1.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte1.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte1.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; + struct cls_struct_9byte h_dbl = { 7, 8.0}; + struct cls_struct_9byte j_dbl = { 1, 9.0}; + struct cls_struct_9byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_9byte h_dbl = { 7, 8.0}; - struct cls_struct_9byte j_dbl = { 1, 9.0}; - struct cls_struct_9byte res_dbl; - cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte2.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; + struct cls_struct_9byte h_dbl = { 7.0, 8}; + struct cls_struct_9byte j_dbl = { 1.0, 9}; + struct cls_struct_9byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_9byte h_dbl = { 7.0, 8}; - struct cls_struct_9byte j_dbl = { 1.0, 9}; - struct cls_struct_9byte res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_sint; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_double.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_double.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_double.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_double.c @@ -52,15 +52,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_float.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_float.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_float.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_float.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble.c @@ -51,15 +51,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_longdouble; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split.c @@ -6,7 +6,7 @@ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ -/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" @@ -87,15 +87,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; + struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; + struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; - struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_longdouble; cls_struct_fields[1] = &ffi_type_longdouble; cls_struct_fields[2] = &ffi_type_longdouble; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c @@ -7,7 +7,7 @@ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail strongarm*-*-* } } */ -/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" @@ -67,15 +67,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; + struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; + struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; - struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_longdouble; cls_struct_fields[1] = &ffi_type_longdouble; cls_struct_fields[2] = &ffi_type_longdouble; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_pointer.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_pointer.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_pointer.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_pointer.c @@ -54,15 +54,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, (void *)4951, 127 }; + struct cls_struct_align f_dbl = { 1, (void *)9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, (void *)4951, 127 }; - struct cls_struct_align f_dbl = { 1, (void *)9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_pointer; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint16.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint16.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint16.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint16.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_sshort; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint32.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint32.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint32.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_sint; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint64.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint64.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint64.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint64.c @@ -51,15 +51,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_sint64; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint16.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint16.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint16.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint16.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint32.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint32.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint32.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uint; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint64.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint64.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint64.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint64.c @@ -52,15 +52,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uint64; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_dbls_struct.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_dbls_struct.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_dbls_struct.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_dbls_struct.c @@ -37,6 +37,8 @@ ffi_type ts1_type; ffi_type* ts1_type_elements[4]; + Dbls arg = { 1.0, 2.0 }; + ts1_type.size = 0; ts1_type.alignment = 0; ts1_type.type = FFI_TYPE_STRUCT; @@ -48,8 +50,6 @@ cl_arg_types[0] = &ts1_type; - Dbls arg = { 1.0, 2.0 }; - /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_void, cl_arg_types) == FFI_OK); diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c @@ -6,6 +6,8 @@ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-output "" { xfail avr32*-*-* } } */ +/* { dg-output "" { xfail mips-sgi-irix6* } } PR libffi/46660 */ + #include "ffitest.h" static void @@ -34,7 +36,8 @@ arg_types[1] = &ffi_type_double; arg_types[2] = NULL; - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, + /* This printf call is variadic */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint, arg_types) == FFI_OK); args[0] = &format; @@ -42,16 +45,19 @@ args[2] = NULL; ffi_call(&cif, FFI_FN(printf), &res, args); - // { dg-output "7.0" } + /* { dg-output "7.0" } */ printf("res: %d\n", (int) res); - // { dg-output "\nres: 4" } + /* { dg-output "\nres: 4" } */ + + /* The call to cls_double_va_fn is static, so have to use a normal prep_cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK); res = ((int(*)(char*, double))(code))(format, doubleArg); - // { dg-output "\n7.0" } + /* { dg-output "\n7.0" } */ printf("res: %d\n", (int) res); - // { dg-output "\nres: 4" } + /* { dg-output "\nres: 4" } */ exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c @@ -5,8 +5,10 @@ Originator: Blake Chaffin */ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ -/* { dg-do run { xfail arm*-*-* strongarm*-*-* xscale*-*-* } } */ -/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ +/* This test is known to PASS on armv7l-unknown-linux-gnueabihf, so I have + remove the xfail for arm*-*-* below, until we know more. */ +/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c @@ -6,6 +6,8 @@ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-output "" { xfail avr32*-*-* x86_64-*-mingw* } } */ +/* { dg-output "" { xfail mips-sgi-irix6* } } PR libffi/46660 */ + #include "ffitest.h" static void @@ -34,7 +36,8 @@ arg_types[1] = &ffi_type_longdouble; arg_types[2] = NULL; - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, + /* This printf call is variadic */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint, arg_types) == FFI_OK); args[0] = &format; @@ -42,16 +45,20 @@ args[2] = NULL; ffi_call(&cif, FFI_FN(printf), &res, args); - // { dg-output "7.0" } + /* { dg-output "7.0" } */ printf("res: %d\n", (int) res); - // { dg-output "\nres: 4" } + /* { dg-output "\nres: 4" } */ + + /* The call to cls_longdouble_va_fn is static, so have to use a normal prep_cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, + arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK); res = ((int(*)(char*, long double))(code))(format, ldArg); - // { dg-output "\n7.0" } + /* { dg-output "\n7.0" } */ printf("res: %d\n", (int) res); - // { dg-output "\nres: 4" } + /* { dg-output "\nres: 4" } */ exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c @@ -35,7 +35,7 @@ void *code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; -// ffi_type cls_pointer_type; + /* ffi_type cls_pointer_type; */ ffi_type* arg_types[3]; /* cls_pointer_type.size = sizeof(void*); @@ -65,7 +65,7 @@ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); - res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2); + res = (ffi_arg)(uintptr_t)((void*(*)(void*, void*))(code))(arg1, arg2); /* { dg-output "\n0x12345678 0x89abcdef: 0x9be02467" } */ printf("res: 0x%08x\n", (unsigned int) res); /* { dg-output "\nres: 0x9be02467" } */ diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c @@ -28,11 +28,12 @@ char trample6 = trample4 + ((char*)&a2)[1]; long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; char trample8 = trample6 + trample2; + void* result; dummyVar = dummy_func(trample1, trample2, trample3, trample4, trample5, trample6, trample7, trample8); - void* result = (void*)((intptr_t)a1 + (intptr_t)a2); + result = (void*)((intptr_t)a1 + (intptr_t)a2); printf("0x%08x 0x%08x: 0x%08x\n", (unsigned int)(uintptr_t) a1, @@ -52,11 +53,12 @@ char trample6 = trample4 + ((char*)&a2)[1]; long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; char trample8 = trample6 + trample2; + void* result; dummyVar = dummy_func(trample1, trample2, trample3, trample4, trample5, trample6, trample7, trample8); - void* result = (void*)((intptr_t)a1 + (intptr_t)a2); + result = (void*)((intptr_t)a1 + (intptr_t)a2); printf("0x%08x 0x%08x: 0x%08x\n", (unsigned int)(intptr_t) a1, @@ -96,7 +98,7 @@ void *code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; -// ffi_type cls_pointer_type; + /* ffi_type cls_pointer_type; */ ffi_type* arg_types[3]; /* cls_pointer_type.size = sizeof(void*); @@ -123,18 +125,18 @@ ffi_call(&cif, FFI_FN(cls_pointer_fn1), &res, args); printf("res: 0x%08x\n", (unsigned int) res); - // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } - // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } - // { dg-output "\nres: 0x8bf258bd" } + /* { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } */ + /* { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } */ + /* { dg-output "\nres: 0x8bf258bd" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); - res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2); + res = (ffi_arg)(uintptr_t)((void*(*)(void*, void*))(code))(arg1, arg2); printf("res: 0x%08x\n", (unsigned int) res); - // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } - // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } - // { dg-output "\nres: 0x8bf258bd" } + /* { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } */ + /* { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } */ + /* { dg-output "\nres: 0x8bf258bd" } */ exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_struct_va1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_struct_va1.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_struct_va1.c @@ -0,0 +1,114 @@ +/* Area: ffi_call, closure_call + Purpose: Test doubles passed in variable argument lists. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run } */ +/* { dg-output "" { xfail avr32*-*-* } } */ +#include "ffitest.h" + +struct small_tag +{ + unsigned char a; + unsigned char b; +}; + +struct large_tag +{ + unsigned a; + unsigned b; + unsigned c; + unsigned d; + unsigned e; +}; + +static void +test_fn (ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + int n = *(int*)args[0]; + struct small_tag s1 = * (struct small_tag *) args[1]; + struct large_tag l1 = * (struct large_tag *) args[2]; + struct small_tag s2 = * (struct small_tag *) args[3]; + + printf ("%d %d %d %d %d %d %d %d %d %d\n", n, s1.a, s1.b, + l1.a, l1.b, l1.c, l1.d, l1.e, + s2.a, s2.b); + * (int*) resp = 42; +} + +int +main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc (sizeof (ffi_closure), &code); + ffi_type* arg_types[5]; + + ffi_arg res = 0; + + ffi_type s_type; + ffi_type *s_type_elements[3]; + + ffi_type l_type; + ffi_type *l_type_elements[6]; + + struct small_tag s1; + struct small_tag s2; + struct large_tag l1; + + int si; + + s_type.size = 0; + s_type.alignment = 0; + s_type.type = FFI_TYPE_STRUCT; + s_type.elements = s_type_elements; + + s_type_elements[0] = &ffi_type_uchar; + s_type_elements[1] = &ffi_type_uchar; + s_type_elements[2] = NULL; + + l_type.size = 0; + l_type.alignment = 0; + l_type.type = FFI_TYPE_STRUCT; + l_type.elements = l_type_elements; + + l_type_elements[0] = &ffi_type_uint; + l_type_elements[1] = &ffi_type_uint; + l_type_elements[2] = &ffi_type_uint; + l_type_elements[3] = &ffi_type_uint; + l_type_elements[4] = &ffi_type_uint; + l_type_elements[5] = NULL; + + arg_types[0] = &ffi_type_sint; + arg_types[1] = &s_type; + arg_types[2] = &l_type; + arg_types[3] = &s_type; + arg_types[4] = NULL; + + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint, + arg_types) == FFI_OK); + + si = 4; + s1.a = 5; + s1.b = 6; + + s2.a = 20; + s2.b = 21; + + l1.a = 10; + l1.b = 11; + l1.c = 12; + l1.d = 13; + l1.e = 14; + + CHECK(ffi_prep_closure_loc(pcl, &cif, test_fn, NULL, code) == FFI_OK); + + res = ((int (*)(int, ...))(code))(si, s1, l1, s2); + /* { dg-output "4 5 6 10 11 12 13 14 20 21" } */ + printf("res: %d\n", (int) res); + /* { dg-output "\nres: 42" } */ + + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uchar_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uchar_va.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uchar_va.c @@ -0,0 +1,44 @@ +/* Area: closure_call + Purpose: Test anonymous unsigned char argument. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef unsigned char T; + +static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) + { + *(ffi_arg *)resp = *(T *)args[0]; + + printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]); + } + +typedef T (*cls_ret_T)(T, ...); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[3]; + T res; + + cl_arg_types[0] = &ffi_type_uchar; + cl_arg_types[1] = &ffi_type_uchar; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, + &ffi_type_uchar, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); + res = ((((cls_ret_T)code)(67, 4))); + /* { dg-output "67: 67 4" } */ + printf("res: %d\n", res); + /* { dg-output "\nres: 67" } */ + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uint_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uint_va.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uint_va.c @@ -0,0 +1,45 @@ +/* Area: closure_call + Purpose: Test anonymous unsigned int argument. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ + +#include "ffitest.h" + +typedef unsigned int T; + +static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) + { + *(T *)resp = *(T *)args[0]; + + printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]); + } + +typedef T (*cls_ret_T)(T, ...); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[3]; + T res; + + cl_arg_types[0] = &ffi_type_uint; + cl_arg_types[1] = &ffi_type_uint; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, + &ffi_type_uint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); + res = ((((cls_ret_T)code)(67, 4))); + /* { dg-output "67: 67 4" } */ + printf("res: %d\n", res); + /* { dg-output "\nres: 67" } */ + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulong_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulong_va.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulong_va.c @@ -0,0 +1,45 @@ +/* Area: closure_call + Purpose: Test anonymous unsigned long argument. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ + +#include "ffitest.h" + +typedef unsigned long T; + +static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) + { + *(T *)resp = *(T *)args[0]; + + printf("%ld: %ld %ld\n", *(T *)resp, *(T *)args[0], *(T *)args[1]); + } + +typedef T (*cls_ret_T)(T, ...); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[3]; + T res; + + cl_arg_types[0] = &ffi_type_ulong; + cl_arg_types[1] = &ffi_type_ulong; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, + &ffi_type_ulong, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); + res = ((((cls_ret_T)code)(67, 4))); + /* { dg-output "67: 67 4" } */ + printf("res: %ld\n", res); + /* { dg-output "\nres: 67" } */ + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c @@ -11,7 +11,7 @@ static void cls_ret_ulonglong_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { - *(unsigned long long *)resp= *(unsigned long long *)args[0]; + *(unsigned long long *)resp= 0xfffffffffffffffLL ^ *(unsigned long long *)args[0]; printf("%" PRIuLL ": %" PRIuLL "\n",*(unsigned long long *)args[0], *(unsigned long long *)(resp)); @@ -34,14 +34,14 @@ &ffi_type_uint64, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code) == FFI_OK); res = (*((cls_ret_ulonglong)code))(214LL); - /* { dg-output "214: 214" } */ + /* { dg-output "214: 1152921504606846761" } */ printf("res: %" PRIdLL "\n", res); - /* { dg-output "\nres: 214" } */ + /* { dg-output "\nres: 1152921504606846761" } */ res = (*((cls_ret_ulonglong)code))(9223372035854775808LL); - /* { dg-output "\n9223372035854775808: 9223372035854775808" } */ + /* { dg-output "\n9223372035854775808: 8070450533247928831" } */ printf("res: %" PRIdLL "\n", res); - /* { dg-output "\nres: 9223372035854775808" } */ + /* { dg-output "\nres: 8070450533247928831" } */ exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ushort_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ushort_va.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ushort_va.c @@ -0,0 +1,44 @@ +/* Area: closure_call + Purpose: Test anonymous unsigned short argument. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef unsigned short T; + +static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) + { + *(ffi_arg *)resp = *(T *)args[0]; + + printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]); + } + +typedef T (*cls_ret_T)(T, ...); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[3]; + T res; + + cl_arg_types[0] = &ffi_type_ushort; + cl_arg_types[1] = &ffi_type_ushort; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, + &ffi_type_ushort, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); + res = ((((cls_ret_T)code)(67, 4))); + /* { dg-output "67: 67 4" } */ + printf("res: %d\n", res); + /* { dg-output "\nres: 67" } */ + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_abi.c b/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_abi.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_abi.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_abi.c @@ -4,7 +4,8 @@ PR: none. Originator: Blake Chaffin 6/6/2007 */ -/* { dg-do run { xfail *-*-* } } */ +/* { dg-do run } */ + #include "ffitest.h" static void @@ -17,11 +18,9 @@ ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args[1]; ffi_type* arg_types[1]; arg_types[0] = NULL; - args[0] = NULL; CHECK(ffi_prep_cif(&cif, 255, 0, &ffi_type_void, arg_types) == FFI_BAD_ABI); diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_typedef.c b/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_typedef.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_typedef.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_typedef.c @@ -4,7 +4,8 @@ PR: none. Originator: Blake Chaffin 6/6/2007 */ -/* { dg-do run { xfail *-*-* } } */ +/* { dg-do run } */ + #include "ffitest.h" int main (void) @@ -12,10 +13,10 @@ ffi_cif cif; ffi_type* arg_types[1]; + ffi_type badType = ffi_type_void; + arg_types[0] = NULL; - ffi_type badType = ffi_type_void; - badType.size = 0; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &badType, diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis1_win32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis1_win32.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis1_win32.c @@ -0,0 +1,50 @@ +/* Area: ffi_call + Purpose: Check fastcall fct call on X86_WIN32 systems. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ + +#include "ffitest.h" + +static size_t __FASTCALL__ my_fastcall_f(char *s, float a) +{ + return (size_t) ((int) strlen(s) + (int) a); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + char *s; + float v2; + args[0] = &ffi_type_pointer; + args[1] = &ffi_type_float; + values[0] = (void*) &s; + values[1] = (void*) &v2; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 2, + &ffi_type_sint, args) == FFI_OK); + + s = "a"; + v2 = 0.0; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 1); + + s = "1234567"; + v2 = -1.0; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 6); + + s = "1234567890123456789012345"; + v2 = 1.0; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 26); + + printf("fastcall fct1 tests passed\n"); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis2_win32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis2_win32.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis2_win32.c @@ -0,0 +1,50 @@ +/* Area: ffi_call + Purpose: Check fastcall fct call on X86_WIN32 systems. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ + +#include "ffitest.h" + +static size_t __FASTCALL__ my_fastcall_f(float a, char *s) +{ + return (size_t) ((int) strlen(s) + (int) a); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + char *s; + float v2; + args[1] = &ffi_type_pointer; + args[0] = &ffi_type_float; + values[1] = (void*) &s; + values[0] = (void*) &v2; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 2, + &ffi_type_sint, args) == FFI_OK); + + s = "a"; + v2 = 0.0; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 1); + + s = "1234567"; + v2 = -1.0; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 6); + + s = "1234567890123456789012345"; + v2 = 1.0; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 26); + + printf("fastcall fct2 tests passed\n"); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis3_win32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis3_win32.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis3_win32.c @@ -0,0 +1,56 @@ +/* Area: ffi_call + Purpose: Check fastcall f call on X86_WIN32 systems. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ + +#include "ffitest.h" + +static size_t __FASTCALL__ my_fastcall_f(float a, char *s, int i) +{ + return (size_t) ((int) strlen(s) + (int) a + i); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + char *s; + int v1; + float v2; + args[2] = &ffi_type_sint; + args[1] = &ffi_type_pointer; + args[0] = &ffi_type_float; + values[2] = (void*) &v1; + values[1] = (void*) &s; + values[0] = (void*) &v2; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 3, + &ffi_type_sint, args) == FFI_OK); + + s = "a"; + v1 = 1; + v2 = 0.0; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 2); + + s = "1234567"; + v2 = -1.0; + v1 = -2; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 4); + + s = "1234567890123456789012345"; + v2 = 1.0; + v1 = 2; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 28); + + printf("fastcall fct3 tests passed\n"); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h b/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h --- a/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h @@ -15,7 +15,7 @@ #define MAX_ARGS 256 -#define CHECK(x) !(x) ? abort() : 0 +#define CHECK(x) !(x) ? (abort(), 1) : 0 /* Define __UNUSED__ that also other compilers than gcc can run the tests. */ #undef __UNUSED__ @@ -25,6 +25,14 @@ #define __UNUSED__ #endif +/* Define __FASTCALL__ so that other compilers than gcc can run the tests. */ +#undef __FASTCALL__ +#if defined _MSC_VER +#define __FASTCALL__ __fastcall +#else +#define __FASTCALL__ __attribute__((fastcall)) +#endif + /* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a file open. */ #ifdef HAVE_MMAP_ANON @@ -67,6 +75,8 @@ #define PRIdLL "ld" #undef PRIuLL #define PRIuLL "lu" +#define PRId8 "hd" +#define PRIu8 "hu" #define PRId64 "ld" #define PRIu64 "lu" #define PRIuPTR "lu" @@ -77,6 +87,28 @@ #define PRIuPTR "lu" #endif +/* IRIX kludge. */ +#if defined(__sgi) +/* IRIX 6.5 provides all definitions, but only for C99 + compilations. */ +#define PRId8 "hhd" +#define PRIu8 "hhu" +#if (_MIPS_SZLONG == 32) +#define PRId64 "lld" +#define PRIu64 "llu" +#endif +/* This doesn't match , which always has "lld" here, but the + arguments are uint64_t, int64_t, which are unsigned long, long for + 64-bit in . */ +#if (_MIPS_SZLONG == 64) +#define PRId64 "ld" +#define PRIu64 "lu" +#endif +/* This doesn't match , which has "u" here, but the arguments + are uintptr_t, which is always unsigned long. */ +#define PRIuPTR "lu" +#endif + /* Solaris < 10 kludge. */ #if defined(__sun__) && defined(__svr4__) && !defined(PRIuPTR) #if defined(__arch64__) || defined (__x86_64__) @@ -86,44 +118,15 @@ #endif #endif -#ifdef USING_MMAP -static inline void * -allocate_mmap (size_t size) -{ - void *page; -#if defined (HAVE_MMAP_DEV_ZERO) - static int dev_zero_fd = -1; +/* MSVC kludge. */ +#if defined _MSC_VER +#define PRIuPTR "lu" +#define PRIu8 "u" +#define PRId8 "d" +#define PRIu64 "I64u" +#define PRId64 "I64d" #endif -#ifdef HAVE_MMAP_DEV_ZERO - if (dev_zero_fd == -1) - { - dev_zero_fd = open ("/dev/zero", O_RDONLY); - if (dev_zero_fd == -1) - { - perror ("open /dev/zero: %m"); - exit (1); - } - } +#ifndef PRIuPTR +#define PRIuPTR "u" #endif - - -#ifdef HAVE_MMAP_ANON - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); -#endif -#ifdef HAVE_MMAP_DEV_ZERO - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE, dev_zero_fd, 0); -#endif - - if (page == (void *) MAP_FAILED) - { - perror ("virtual memory exhausted"); - exit (1); - } - - return page; -} - -#endif diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c @@ -0,0 +1,107 @@ +/* Area: fp and variadics + Purpose: check fp inputs and returns work on variadics, even the fixed params + Limitations: None + PR: none + Originator: 2011-01-25 + + Intended to stress the difference in ABI on ARM vfp +*/ + +/* { dg-do run } */ + +#include + +#include "ffitest.h" + +/* prints out all the parameters, and returns the sum of them all. + * 'x' is the number of variadic parameters all of which are double in this test + */ +double float_va_fn(unsigned int x, double y,...) +{ + double total=0.0; + va_list ap; + unsigned int i; + + total+=(double)x; + total+=y; + + printf("%u: %.1f :", x, y); + + va_start(ap, y); + for(i=0;i 20100916 */ + +/* { dg-do run } */ + +#include "ffitest.h" + +#define NARGS 7 + +typedef unsigned char u8; + +#ifdef __GNUC__ +__attribute__((noinline)) +#endif +uint8_t +foo (uint8_t a, uint8_t b, uint8_t c, uint8_t d, + uint8_t e, uint8_t f, uint8_t g) +{ + return a + b + c + d + e + f + g; +} + +uint8_t +bar (uint8_t a, uint8_t b, uint8_t c, uint8_t d, + uint8_t e, uint8_t f, uint8_t g) +{ + return foo (a, b, c, d, e, f, g); +} + +int +main (void) +{ + ffi_type *ffitypes[NARGS]; + int i; + ffi_cif cif; + ffi_arg result = 0; + uint8_t args[NARGS]; + void *argptrs[NARGS]; + + for (i = 0; i < NARGS; ++i) + ffitypes[i] = &ffi_type_uint8; + + CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, NARGS, + &ffi_type_uint8, ffitypes) == FFI_OK); + + for (i = 0; i < NARGS; ++i) + { + args[i] = i; + argptrs[i] = &args[i]; + } + ffi_call (&cif, FFI_FN (bar), &result, argptrs); + + CHECK (result == 21); + return 0; +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/many2_win32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/many2_win32.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/many2_win32.c @@ -0,0 +1,63 @@ +/* Area: ffi_call + Purpose: Check stdcall many call on X86_WIN32 systems. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ + +#include "ffitest.h" +#include + +static float __attribute__((fastcall)) fastcall_many(float f1, + float f2, + float f3, + float f4, + float f5, + float f6, + float f7, + float f8, + float f9, + float f10, + float f11, + float f12, + float f13) +{ + return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[13]; + void *values[13]; + float fa[13]; + float f, ff; + unsigned long ul; + + for (ul = 0; ul < 13; ul++) + { + args[ul] = &ffi_type_float; + values[ul] = &fa[ul]; + fa[ul] = (float) ul; + } + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 13, + &ffi_type_float, args) == FFI_OK); + + ff = fastcall_many(fa[0], fa[1], + fa[2], fa[3], + fa[4], fa[5], + fa[6], fa[7], + fa[8], fa[9], + fa[10], fa[11], fa[12]); + + ffi_call(&cif, FFI_FN(fastcall_many), &f, values); + + if (f - ff < FLT_EPSILON) + printf("fastcall many arg tests ok!\n"); + else + CHECK(0); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/negint.c b/Modules/_ctypes/libffi/testsuite/libffi.call/negint.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/negint.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/negint.c @@ -5,7 +5,6 @@ Originator: From the original ffitest.c */ /* { dg-do run } */ -/* { dg-options -O2 } */ #include "ffitest.h" diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct.c @@ -77,6 +77,12 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[5]; + struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; + struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; + struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, + {3, 1.0, 8.0}}; + struct cls_struct_combined res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -92,12 +98,6 @@ cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; - struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; - struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; - struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, - {3, 1.0, 8.0}}; - struct cls_struct_combined res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = &ffi_type_sint; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct1.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct1.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct1.c @@ -81,6 +81,13 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[5]; + struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; + struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; + struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, + {3, 1.0, 8.0}}; + struct cls_struct_16byte1 h_dbl = { 3.0, 2.0, 4}; + struct cls_struct_combined res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -96,13 +103,6 @@ cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; - struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; - struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; - struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, - {3, 1.0, 8.0}}; - struct cls_struct_16byte1 h_dbl = { 3.0, 2.0, 4}; - struct cls_struct_combined res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = &ffi_type_sint; @@ -156,6 +156,6 @@ CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); - // CHECK( 1 == 0); + /* CHECK( 1 == 0); */ exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct10.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct10.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct10.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct10.c @@ -67,6 +67,12 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; + struct A e_dbl = { 1LL, 7}; + struct B f_dbl = { 99, {12LL , 127}, 255}; + struct C g_dbl = { 2LL, 9}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -82,12 +88,6 @@ cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; - struct A e_dbl = { 1LL, 7}; - struct B f_dbl = { 99, {12LL , 127}, 255}; - struct C g_dbl = { 2LL, 9}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct11.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct11.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct11.c @@ -0,0 +1,121 @@ +/* Area: ffi_call, closure_call + Purpose: Check parameter passing with nested structs + of a single type. This tests the special cases + for homogenous floating-point aggregates in the + AArch64 PCS. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct A { + float a_x; + float a_y; +} A; + +typedef struct B { + float b_x; + float b_y; +} B; + +typedef struct C { + A a; + B b; +} C; + +static C C_fn (int x, int y, int z, C source, int i, int j, int k) +{ + C result; + result.a.a_x = source.a.a_x; + result.a.a_y = source.a.a_y; + result.b.b_x = source.b.b_x; + result.b.b_y = source.b.b_y; + + printf ("%d, %d, %d, %d, %d, %d\n", x, y, z, i, j, k); + + printf ("%.1f, %.1f, %.1f, %.1f, " + "%.1f, %.1f, %.1f, %.1f\n", + source.a.a_x, source.a.a_y, + source.b.b_x, source.b.b_y, + result.a.a_x, result.a.a_y, + result.b.b_x, result.b.b_y); + + return result; +} + +int main (void) +{ + ffi_cif cif; + + ffi_type* struct_fields_source_a[3]; + ffi_type* struct_fields_source_b[3]; + ffi_type* struct_fields_source_c[3]; + ffi_type* arg_types[8]; + + ffi_type struct_type_a, struct_type_b, struct_type_c; + + struct A source_fld_a = {1.0, 2.0}; + struct B source_fld_b = {4.0, 8.0}; + int k = 1; + + struct C result; + struct C source = {source_fld_a, source_fld_b}; + + struct_type_a.size = 0; + struct_type_a.alignment = 0; + struct_type_a.type = FFI_TYPE_STRUCT; + struct_type_a.elements = struct_fields_source_a; + + struct_type_b.size = 0; + struct_type_b.alignment = 0; + struct_type_b.type = FFI_TYPE_STRUCT; + struct_type_b.elements = struct_fields_source_b; + + struct_type_c.size = 0; + struct_type_c.alignment = 0; + struct_type_c.type = FFI_TYPE_STRUCT; + struct_type_c.elements = struct_fields_source_c; + + struct_fields_source_a[0] = &ffi_type_float; + struct_fields_source_a[1] = &ffi_type_float; + struct_fields_source_a[2] = NULL; + + struct_fields_source_b[0] = &ffi_type_float; + struct_fields_source_b[1] = &ffi_type_float; + struct_fields_source_b[2] = NULL; + + struct_fields_source_c[0] = &struct_type_a; + struct_fields_source_c[1] = &struct_type_b; + struct_fields_source_c[2] = NULL; + + arg_types[0] = &ffi_type_sint32; + arg_types[1] = &ffi_type_sint32; + arg_types[2] = &ffi_type_sint32; + arg_types[3] = &struct_type_c; + arg_types[4] = &ffi_type_sint32; + arg_types[5] = &ffi_type_sint32; + arg_types[6] = &ffi_type_sint32; + arg_types[7] = NULL; + + void *args[7]; + args[0] = &k; + args[1] = &k; + args[2] = &k; + args[3] = &source; + args[4] = &k; + args[5] = &k; + args[6] = &k; + CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 7, &struct_type_c, + arg_types) == FFI_OK); + + ffi_call (&cif, FFI_FN (C_fn), &result, args); + /* { dg-output "1, 1, 1, 1, 1, 1\n" } */ + /* { dg-output "1.0, 2.0, 4.0, 8.0, 1.0, 2.0, 4.0, 8.0" } */ + CHECK (result.a.a_x == source.a.a_x); + CHECK (result.a.a_y == source.a.a_y); + CHECK (result.b.b_x == source.b.b_x); + CHECK (result.b.b_y == source.b.b_y); + exit (0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct2.c @@ -57,6 +57,11 @@ ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; + struct A e_dbl = { 1, 7}; + struct B f_dbl = {{12 , 127}, 99}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -67,11 +72,6 @@ cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; - struct A e_dbl = { 1, 7}; - struct B f_dbl = {{12 , 127}, 99}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_ulong; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct3.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct3.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct3.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct3.c @@ -58,6 +58,11 @@ ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; + struct A e_dbl = { 1LL, 7}; + struct B f_dbl = {{12LL , 127}, 99}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -68,11 +73,6 @@ cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; - struct A e_dbl = { 1LL, 7}; - struct B f_dbl = {{12LL , 127}, 99}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct4.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct4.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct4.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct4.c @@ -58,6 +58,11 @@ ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; + struct A e_dbl = { 1.0, 7}; + struct B f_dbl = {{12.0 , 127}, 99}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -68,11 +73,6 @@ cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; - struct A e_dbl = { 1.0, 7}; - struct B f_dbl = {{12.0 , 127}, 99}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct5.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct5.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct5.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct5.c @@ -58,6 +58,11 @@ ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; + struct A e_dbl = { 1.0, 7}; + struct B f_dbl = {{12.0 , 127}, 99}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -68,11 +73,6 @@ cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; - struct A e_dbl = { 1.0, 7}; - struct B f_dbl = {{12.0 , 127}, 99}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_longdouble; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct6.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct6.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct6.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct6.c @@ -66,6 +66,12 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; + struct A e_dbl = { 1.0, 7}; + struct B f_dbl = {{12.0 , 127}, 99}; + struct C g_dbl = { 2, 9}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -81,12 +87,6 @@ cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; - struct A e_dbl = { 1.0, 7}; - struct B f_dbl = {{12.0 , 127}, 99}; - struct C g_dbl = { 2, 9}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct7.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct7.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct7.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct7.c @@ -58,6 +58,11 @@ ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; + struct A e_dbl = { 1LL, 7}; + struct B f_dbl = {{12.0 , 127}, 99}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -68,11 +73,6 @@ cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; - struct A e_dbl = { 1LL, 7}; - struct B f_dbl = {{12.0 , 127}, 99}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct8.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct8.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct8.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct8.c @@ -66,6 +66,12 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; + struct A e_dbl = { 1LL, 7}; + struct B f_dbl = {{12LL , 127}, 99}; + struct C g_dbl = { 2LL, 9}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -81,12 +87,6 @@ cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; - struct A e_dbl = { 1LL, 7}; - struct B f_dbl = {{12LL , 127}, 99}; - struct C g_dbl = { 2LL, 9}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct9.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct9.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct9.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct9.c @@ -66,6 +66,12 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; + struct A e_dbl = { 1, 7LL}; + struct B f_dbl = {{12.0 , 127}, 99}; + struct C g_dbl = { 2, 9}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -81,12 +87,6 @@ cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; - struct A e_dbl = { 1, 7LL}; - struct B f_dbl = {{12.0 , 127}, 99}; - struct C g_dbl = { 2, 9}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uint64; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/return_dbl.c b/Modules/_ctypes/libffi/testsuite/libffi.call/return_dbl.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/return_dbl.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/return_dbl.c @@ -9,6 +9,7 @@ static double return_dbl(double dbl) { + printf ("%f\n", dbl); return 2 * dbl; } int main (void) diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/return_sc.c b/Modules/_ctypes/libffi/testsuite/libffi.call/return_sc.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/return_sc.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/return_sc.c @@ -30,7 +30,7 @@ sc < (signed char) 127; sc++) { ffi_call(&cif, FFI_FN(return_sc), &rint, values); - CHECK(rint == (ffi_arg) sc); + CHECK((signed char)rint == sc); } exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/return_uc.c b/Modules/_ctypes/libffi/testsuite/libffi.call/return_uc.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/return_uc.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/return_uc.c @@ -32,7 +32,7 @@ uc < (unsigned char) '\xff'; uc++) { ffi_call(&cif, FFI_FN(return_uc), &rint, values); - CHECK(rint == (signed int) uc); + CHECK((unsigned char)rint == uc); } exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large.c b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large.c @@ -9,8 +9,8 @@ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" -// 13 FPRs: 104 bytes -// 14 FPRs: 112 bytes +/* 13 FPRs: 104 bytes */ +/* 14 FPRs: 112 bytes */ typedef struct struct_108byte { double a; @@ -82,17 +82,17 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - struct_108byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 7 }; struct_108byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 4 }; struct_108byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 3 }; struct_108byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 2 }; struct_108byte res_dbl; + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large2.c @@ -9,8 +9,8 @@ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" -// 13 FPRs: 104 bytes -// 14 FPRs: 112 bytes +/* 13 FPRs: 104 bytes */ +/* 14 FPRs: 112 bytes */ typedef struct struct_116byte { double a; @@ -84,17 +84,17 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - struct_116byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 7 }; struct_116byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 6.0, 4 }; struct_116byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 7.0, 3 }; struct_116byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 8.0, 2 }; struct_116byte res_dbl; + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium.c b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium.c @@ -68,17 +68,17 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7.0 }; struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0 }; struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3.0 }; struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2.0 }; struct_72byte res_dbl; + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium2.c @@ -69,17 +69,17 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7 }; struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4 }; struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3 }; struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2 }; struct_72byte res_dbl; + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/strlen2_win32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/strlen2_win32.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/strlen2_win32.c @@ -0,0 +1,44 @@ +/* Area: ffi_call + Purpose: Check fastcall strlen call on X86_WIN32 systems. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ + +#include "ffitest.h" + +static size_t __FASTCALL__ my_fastcall_strlen(char *s) +{ + return (strlen(s)); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + char *s; + args[0] = &ffi_type_pointer; + values[0] = (void*) &s; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1, + &ffi_type_sint, args) == FFI_OK); + + s = "a"; + ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values); + CHECK(rint == 1); + + s = "1234567"; + ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values); + CHECK(rint == 7); + + s = "1234567890123456789012345"; + ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values); + CHECK(rint == 25); + + printf("fastcall strlen tests passed\n"); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct1.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct1.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct1.c @@ -30,6 +30,13 @@ void *values[MAX_ARGS]; ffi_type ts1_type; ffi_type *ts1_type_elements[4]; + + test_structure_1 ts1_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_1 *ts1_result = + (test_structure_1 *) malloc (sizeof(test_structure_1)); + ts1_type.size = 0; ts1_type.alignment = 0; ts1_type.type = FFI_TYPE_STRUCT; @@ -39,11 +46,6 @@ ts1_type_elements[2] = &ffi_type_uint; ts1_type_elements[3] = NULL; - test_structure_1 ts1_arg; - /* This is a hack to get a properly aligned result buffer */ - test_structure_1 *ts1_result = - (test_structure_1 *) malloc (sizeof(test_structure_1)); - args[0] = &ts1_type; values[0] = &ts1_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct1_win32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct1_win32.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct1_win32.c @@ -0,0 +1,67 @@ +/* Area: ffi_call + Purpose: Check structures with fastcall/thiscall convention. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ +#include "ffitest.h" + +typedef struct +{ + unsigned char uc; + double d; + unsigned int ui; +} test_structure_1; + +static test_structure_1 __FASTCALL__ struct1(test_structure_1 ts) +{ + ts.uc++; + ts.d--; + ts.ui++; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts1_type; + ffi_type *ts1_type_elements[4]; + + test_structure_1 ts1_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_1 *ts1_result = + (test_structure_1 *) malloc (sizeof(test_structure_1)); + + ts1_type.size = 0; + ts1_type.alignment = 0; + ts1_type.type = FFI_TYPE_STRUCT; + ts1_type.elements = ts1_type_elements; + ts1_type_elements[0] = &ffi_type_uchar; + ts1_type_elements[1] = &ffi_type_double; + ts1_type_elements[2] = &ffi_type_uint; + ts1_type_elements[3] = NULL; + + args[0] = &ts1_type; + values[0] = &ts1_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1, + &ts1_type, args) == FFI_OK); + + ts1_arg.uc = '\x01'; + ts1_arg.d = 3.14159; + ts1_arg.ui = 555; + + ffi_call(&cif, FFI_FN(struct1), ts1_result, values); + + CHECK(ts1_result->ui == 556); + CHECK(ts1_result->d == 3.14159 - 1); + + free (ts1_result); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct2.c @@ -29,6 +29,11 @@ test_structure_2 ts2_arg; ffi_type ts2_type; ffi_type *ts2_type_elements[3]; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_2 *ts2_result = + (test_structure_2 *) malloc (sizeof(test_structure_2)); + ts2_type.size = 0; ts2_type.alignment = 0; ts2_type.type = FFI_TYPE_STRUCT; @@ -37,11 +42,6 @@ ts2_type_elements[1] = &ffi_type_double; ts2_type_elements[2] = NULL; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_2 *ts2_result = - (test_structure_2 *) malloc (sizeof(test_structure_2)); - args[0] = &ts2_type; values[0] = &ts2_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct2_win32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct2_win32.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct2_win32.c @@ -0,0 +1,67 @@ +/* Area: ffi_call + Purpose: Check structures in fastcall/stdcall function + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ +#include "ffitest.h" + +typedef struct +{ + double d1; + double d2; +} test_structure_2; + +static test_structure_2 __FASTCALL__ struct2(test_structure_2 ts) +{ + ts.d1--; + ts.d2--; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + test_structure_2 ts2_arg; + ffi_type ts2_type; + ffi_type *ts2_type_elements[3]; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_2 *ts2_result = + (test_structure_2 *) malloc (sizeof(test_structure_2)); + + ts2_type.size = 0; + ts2_type.alignment = 0; + ts2_type.type = FFI_TYPE_STRUCT; + ts2_type.elements = ts2_type_elements; + ts2_type_elements[0] = &ffi_type_double; + ts2_type_elements[1] = &ffi_type_double; + ts2_type_elements[2] = NULL; + + args[0] = &ts2_type; + values[0] = &ts2_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1, &ts2_type, args) == FFI_OK); + + ts2_arg.d1 = 5.55; + ts2_arg.d2 = 6.66; + + printf ("%g\n", ts2_arg.d1); + printf ("%g\n", ts2_arg.d2); + + ffi_call(&cif, FFI_FN(struct2), ts2_result, values); + + printf ("%g\n", ts2_result->d1); + printf ("%g\n", ts2_result->d2); + + CHECK(ts2_result->d1 == 5.55 - 1); + CHECK(ts2_result->d2 == 6.66 - 1); + + free (ts2_result); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct3.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct3.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct3.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct3.c @@ -27,6 +27,11 @@ int compare_value; ffi_type ts3_type; ffi_type *ts3_type_elements[2]; + + test_structure_3 ts3_arg; + test_structure_3 *ts3_result = + (test_structure_3 *) malloc (sizeof(test_structure_3)); + ts3_type.size = 0; ts3_type.alignment = 0; ts3_type.type = FFI_TYPE_STRUCT; @@ -34,10 +39,6 @@ ts3_type_elements[0] = &ffi_type_sint; ts3_type_elements[1] = NULL; - test_structure_3 ts3_arg; - test_structure_3 *ts3_result = - (test_structure_3 *) malloc (sizeof(test_structure_3)); - args[0] = &ts3_type; values[0] = &ts3_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct4.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct4.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct4.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct4.c @@ -28,21 +28,22 @@ void *values[MAX_ARGS]; ffi_type ts4_type; ffi_type *ts4_type_elements[4]; + + test_structure_4 ts4_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_4 *ts4_result = + (test_structure_4 *) malloc (sizeof(test_structure_4)); + ts4_type.size = 0; ts4_type.alignment = 0; ts4_type.type = FFI_TYPE_STRUCT; - test_structure_4 ts4_arg; ts4_type.elements = ts4_type_elements; ts4_type_elements[0] = &ffi_type_uint; ts4_type_elements[1] = &ffi_type_uint; ts4_type_elements[2] = &ffi_type_uint; ts4_type_elements[3] = NULL; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_4 *ts4_result = - (test_structure_4 *) malloc (sizeof(test_structure_4)); - args[0] = &ts4_type; values[0] = &ts4_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct5.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct5.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct5.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct5.c @@ -27,6 +27,13 @@ void *values[MAX_ARGS]; ffi_type ts5_type; ffi_type *ts5_type_elements[3]; + + test_structure_5 ts5_arg1, ts5_arg2; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_5 *ts5_result = + (test_structure_5 *) malloc (sizeof(test_structure_5)); + ts5_type.size = 0; ts5_type.alignment = 0; ts5_type.type = FFI_TYPE_STRUCT; @@ -35,12 +42,6 @@ ts5_type_elements[1] = &ffi_type_schar; ts5_type_elements[2] = NULL; - test_structure_5 ts5_arg1, ts5_arg2; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_5 *ts5_result = - (test_structure_5 *) malloc (sizeof(test_structure_5)); - args[0] = &ts5_type; args[1] = &ts5_type; values[0] = &ts5_arg1; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct6.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct6.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct6.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct6.c @@ -27,6 +27,13 @@ void *values[MAX_ARGS]; ffi_type ts6_type; ffi_type *ts6_type_elements[3]; + + test_structure_6 ts6_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_6 *ts6_result = + (test_structure_6 *) malloc (sizeof(test_structure_6)); + ts6_type.size = 0; ts6_type.alignment = 0; ts6_type.type = FFI_TYPE_STRUCT; @@ -35,13 +42,6 @@ ts6_type_elements[1] = &ffi_type_double; ts6_type_elements[2] = NULL; - - test_structure_6 ts6_arg; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_6 *ts6_result = - (test_structure_6 *) malloc (sizeof(test_structure_6)); - args[0] = &ts6_type; values[0] = &ts6_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct7.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct7.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct7.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct7.c @@ -29,6 +29,13 @@ void *values[MAX_ARGS]; ffi_type ts7_type; ffi_type *ts7_type_elements[4]; + + test_structure_7 ts7_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_7 *ts7_result = + (test_structure_7 *) malloc (sizeof(test_structure_7)); + ts7_type.size = 0; ts7_type.alignment = 0; ts7_type.type = FFI_TYPE_STRUCT; @@ -38,13 +45,6 @@ ts7_type_elements[2] = &ffi_type_double; ts7_type_elements[3] = NULL; - - test_structure_7 ts7_arg; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_7 *ts7_result = - (test_structure_7 *) malloc (sizeof(test_structure_7)); - args[0] = &ts7_type; values[0] = &ts7_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct8.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct8.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct8.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct8.c @@ -31,6 +31,13 @@ void *values[MAX_ARGS]; ffi_type ts8_type; ffi_type *ts8_type_elements[5]; + + test_structure_8 ts8_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_8 *ts8_result = + (test_structure_8 *) malloc (sizeof(test_structure_8)); + ts8_type.size = 0; ts8_type.alignment = 0; ts8_type.type = FFI_TYPE_STRUCT; @@ -41,12 +48,6 @@ ts8_type_elements[3] = &ffi_type_float; ts8_type_elements[4] = NULL; - test_structure_8 ts8_arg; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_8 *ts8_result = - (test_structure_8 *) malloc (sizeof(test_structure_8)); - args[0] = &ts8_type; values[0] = &ts8_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct9.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct9.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct9.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct9.c @@ -28,6 +28,13 @@ void *values[MAX_ARGS]; ffi_type ts9_type; ffi_type *ts9_type_elements[3]; + + test_structure_9 ts9_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_9 *ts9_result = + (test_structure_9 *) malloc (sizeof(test_structure_9)); + ts9_type.size = 0; ts9_type.alignment = 0; ts9_type.type = FFI_TYPE_STRUCT; @@ -36,12 +43,6 @@ ts9_type_elements[1] = &ffi_type_sint; ts9_type_elements[2] = NULL; - test_structure_9 ts9_arg; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_9 *ts9_result = - (test_structure_9 *) malloc (sizeof(test_structure_9)); - args[0] = &ts9_type; values[0] = &ts9_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/testclosure.c b/Modules/_ctypes/libffi/testsuite/libffi.call/testclosure.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/testclosure.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/testclosure.c @@ -43,13 +43,13 @@ ffi_type cls_struct_type0; ffi_type* dbl_arg_types[5]; + struct cls_struct_combined g_dbl = {4.0, 5.0, 1.0, 8.0}; + cls_struct_type0.size = 0; cls_struct_type0.alignment = 0; cls_struct_type0.type = FFI_TYPE_STRUCT; cls_struct_type0.elements = cls_struct_fields0; - struct cls_struct_combined g_dbl = {4.0, 5.0, 1.0, 8.0}; - cls_struct_fields0[0] = &ffi_type_float; cls_struct_fields0[1] = &ffi_type_float; cls_struct_fields0[2] = &ffi_type_float; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/uninitialized.c b/Modules/_ctypes/libffi/testsuite/libffi.call/uninitialized.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/uninitialized.c @@ -0,0 +1,61 @@ +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct +{ + unsigned char uc; + double d; + unsigned int ui; +} test_structure_1; + +static test_structure_1 struct1(test_structure_1 ts) +{ + ts.uc++; + ts.d--; + ts.ui++; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts1_type; + ffi_type *ts1_type_elements[4]; + + memset(&cif, 1, sizeof(cif)); + ts1_type.size = 0; + ts1_type.alignment = 0; + ts1_type.type = FFI_TYPE_STRUCT; + ts1_type.elements = ts1_type_elements; + ts1_type_elements[0] = &ffi_type_uchar; + ts1_type_elements[1] = &ffi_type_double; + ts1_type_elements[2] = &ffi_type_uint; + ts1_type_elements[3] = NULL; + + test_structure_1 ts1_arg; + /* This is a hack to get a properly aligned result buffer */ + test_structure_1 *ts1_result = + (test_structure_1 *) malloc (sizeof(test_structure_1)); + + args[0] = &ts1_type; + values[0] = &ts1_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ts1_type, args) == FFI_OK); + + ts1_arg.uc = '\x01'; + ts1_arg.d = 3.14159; + ts1_arg.ui = 555; + + ffi_call(&cif, FFI_FN(struct1), ts1_result, values); + + CHECK(ts1_result->ui == 556); + CHECK(ts1_result->d == 3.14159 - 1); + + free (ts1_result); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/va_1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/va_1.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/va_1.c @@ -0,0 +1,196 @@ +/* Area: ffi_call + Purpose: Test passing struct in variable argument lists. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +/* { dg-output "" { xfail avr32*-*-* } } */ + +#include "ffitest.h" +#include + +struct small_tag +{ + unsigned char a; + unsigned char b; +}; + +struct large_tag +{ + unsigned a; + unsigned b; + unsigned c; + unsigned d; + unsigned e; +}; + +static int +test_fn (int n, ...) +{ + va_list ap; + struct small_tag s1; + struct small_tag s2; + struct large_tag l; + unsigned char uc; + signed char sc; + unsigned short us; + signed short ss; + unsigned int ui; + signed int si; + unsigned long ul; + signed long sl; + float f; + double d; + + va_start (ap, n); + s1 = va_arg (ap, struct small_tag); + l = va_arg (ap, struct large_tag); + s2 = va_arg (ap, struct small_tag); + + uc = va_arg (ap, unsigned); + sc = va_arg (ap, signed); + + us = va_arg (ap, unsigned); + ss = va_arg (ap, signed); + + ui = va_arg (ap, unsigned int); + si = va_arg (ap, signed int); + + ul = va_arg (ap, unsigned long); + sl = va_arg (ap, signed long); + + f = va_arg (ap, double); /* C standard promotes float->double + when anonymous */ + d = va_arg (ap, double); + + printf ("%u %u %u %u %u %u %u %u %u uc=%u sc=%d %u %d %u %d %lu %ld %f %f\n", + s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, + s2.a, s2.b, + uc, sc, + us, ss, + ui, si, + ul, sl, + f, d); + va_end (ap); + return n + 1; +} + +int +main (void) +{ + ffi_cif cif; + void* args[15]; + ffi_type* arg_types[15]; + + ffi_type s_type; + ffi_type *s_type_elements[3]; + + ffi_type l_type; + ffi_type *l_type_elements[6]; + + struct small_tag s1; + struct small_tag s2; + struct large_tag l1; + + int n; + int res; + + unsigned char uc; + signed char sc; + unsigned short us; + signed short ss; + unsigned int ui; + signed int si; + unsigned long ul; + signed long sl; + double d1; + double f1; + + s_type.size = 0; + s_type.alignment = 0; + s_type.type = FFI_TYPE_STRUCT; + s_type.elements = s_type_elements; + + s_type_elements[0] = &ffi_type_uchar; + s_type_elements[1] = &ffi_type_uchar; + s_type_elements[2] = NULL; + + l_type.size = 0; + l_type.alignment = 0; + l_type.type = FFI_TYPE_STRUCT; + l_type.elements = l_type_elements; + + l_type_elements[0] = &ffi_type_uint; + l_type_elements[1] = &ffi_type_uint; + l_type_elements[2] = &ffi_type_uint; + l_type_elements[3] = &ffi_type_uint; + l_type_elements[4] = &ffi_type_uint; + l_type_elements[5] = NULL; + + arg_types[0] = &ffi_type_sint; + arg_types[1] = &s_type; + arg_types[2] = &l_type; + arg_types[3] = &s_type; + arg_types[4] = &ffi_type_uchar; + arg_types[5] = &ffi_type_schar; + arg_types[6] = &ffi_type_ushort; + arg_types[7] = &ffi_type_sshort; + arg_types[8] = &ffi_type_uint; + arg_types[9] = &ffi_type_sint; + arg_types[10] = &ffi_type_ulong; + arg_types[11] = &ffi_type_slong; + arg_types[12] = &ffi_type_double; + arg_types[13] = &ffi_type_double; + arg_types[14] = NULL; + + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 14, &ffi_type_sint, arg_types) == FFI_OK); + + s1.a = 5; + s1.b = 6; + + l1.a = 10; + l1.b = 11; + l1.c = 12; + l1.d = 13; + l1.e = 14; + + s2.a = 7; + s2.b = 8; + + n = 41; + + uc = 9; + sc = 10; + us = 11; + ss = 12; + ui = 13; + si = 14; + ul = 15; + sl = 16; + f1 = 2.12; + d1 = 3.13; + + args[0] = &n; + args[1] = &s1; + args[2] = &l1; + args[3] = &s2; + args[4] = &uc; + args[5] = ≻ + args[6] = &us; + args[7] = &ss; + args[8] = &ui; + args[9] = &si; + args[10] = &ul; + args[11] = &sl; + args[12] = &f1; + args[13] = &d1; + args[14] = NULL; + + ffi_call(&cif, FFI_FN(test_fn), &res, args); + /* { dg-output "5 6 10 11 12 13 14 7 8 uc=9 sc=10 11 12 13 14 15 16 2.120000 3.130000" } */ + printf("res: %d\n", (int) res); + /* { dg-output "\nres: 42" } */ + + return 0; +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct1.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct1.c @@ -0,0 +1,121 @@ +/* Area: ffi_call + Purpose: Test passing struct in variable argument lists. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +/* { dg-output "" { xfail avr32*-*-* } } */ + +#include "ffitest.h" +#include + +struct small_tag +{ + unsigned char a; + unsigned char b; +}; + +struct large_tag +{ + unsigned a; + unsigned b; + unsigned c; + unsigned d; + unsigned e; +}; + +static int +test_fn (int n, ...) +{ + va_list ap; + struct small_tag s1; + struct small_tag s2; + struct large_tag l; + + va_start (ap, n); + s1 = va_arg (ap, struct small_tag); + l = va_arg (ap, struct large_tag); + s2 = va_arg (ap, struct small_tag); + printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, + s2.a, s2.b); + va_end (ap); + return n + 1; +} + +int +main (void) +{ + ffi_cif cif; + void* args[5]; + ffi_type* arg_types[5]; + + ffi_type s_type; + ffi_type *s_type_elements[3]; + + ffi_type l_type; + ffi_type *l_type_elements[6]; + + struct small_tag s1; + struct small_tag s2; + struct large_tag l1; + + int n; + int res; + + s_type.size = 0; + s_type.alignment = 0; + s_type.type = FFI_TYPE_STRUCT; + s_type.elements = s_type_elements; + + s_type_elements[0] = &ffi_type_uchar; + s_type_elements[1] = &ffi_type_uchar; + s_type_elements[2] = NULL; + + l_type.size = 0; + l_type.alignment = 0; + l_type.type = FFI_TYPE_STRUCT; + l_type.elements = l_type_elements; + + l_type_elements[0] = &ffi_type_uint; + l_type_elements[1] = &ffi_type_uint; + l_type_elements[2] = &ffi_type_uint; + l_type_elements[3] = &ffi_type_uint; + l_type_elements[4] = &ffi_type_uint; + l_type_elements[5] = NULL; + + arg_types[0] = &ffi_type_sint; + arg_types[1] = &s_type; + arg_types[2] = &l_type; + arg_types[3] = &s_type; + arg_types[4] = NULL; + + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint, arg_types) == FFI_OK); + + s1.a = 5; + s1.b = 6; + + l1.a = 10; + l1.b = 11; + l1.c = 12; + l1.d = 13; + l1.e = 14; + + s2.a = 7; + s2.b = 8; + + n = 41; + + args[0] = &n; + args[1] = &s1; + args[2] = &l1; + args[3] = &s2; + args[4] = NULL; + + ffi_call(&cif, FFI_FN(test_fn), &res, args); + /* { dg-output "5 6 10 11 12 13 14 7 8" } */ + printf("res: %d\n", (int) res); + /* { dg-output "\nres: 42" } */ + + return 0; +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct2.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct2.c @@ -0,0 +1,123 @@ +/* Area: ffi_call + Purpose: Test passing struct in variable argument lists. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +/* { dg-output "" { xfail avr32*-*-* } } */ + +#include "ffitest.h" +#include + +struct small_tag +{ + unsigned char a; + unsigned char b; +}; + +struct large_tag +{ + unsigned a; + unsigned b; + unsigned c; + unsigned d; + unsigned e; +}; + +static struct small_tag +test_fn (int n, ...) +{ + va_list ap; + struct small_tag s1; + struct small_tag s2; + struct large_tag l; + + va_start (ap, n); + s1 = va_arg (ap, struct small_tag); + l = va_arg (ap, struct large_tag); + s2 = va_arg (ap, struct small_tag); + printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, + s2.a, s2.b); + va_end (ap); + s1.a += s2.a; + s1.b += s2.b; + return s1; +} + +int +main (void) +{ + ffi_cif cif; + void* args[5]; + ffi_type* arg_types[5]; + + ffi_type s_type; + ffi_type *s_type_elements[3]; + + ffi_type l_type; + ffi_type *l_type_elements[6]; + + struct small_tag s1; + struct small_tag s2; + struct large_tag l1; + + int n; + struct small_tag res; + + s_type.size = 0; + s_type.alignment = 0; + s_type.type = FFI_TYPE_STRUCT; + s_type.elements = s_type_elements; + + s_type_elements[0] = &ffi_type_uchar; + s_type_elements[1] = &ffi_type_uchar; + s_type_elements[2] = NULL; + + l_type.size = 0; + l_type.alignment = 0; + l_type.type = FFI_TYPE_STRUCT; + l_type.elements = l_type_elements; + + l_type_elements[0] = &ffi_type_uint; + l_type_elements[1] = &ffi_type_uint; + l_type_elements[2] = &ffi_type_uint; + l_type_elements[3] = &ffi_type_uint; + l_type_elements[4] = &ffi_type_uint; + l_type_elements[5] = NULL; + + arg_types[0] = &ffi_type_sint; + arg_types[1] = &s_type; + arg_types[2] = &l_type; + arg_types[3] = &s_type; + arg_types[4] = NULL; + + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &s_type, arg_types) == FFI_OK); + + s1.a = 5; + s1.b = 6; + + l1.a = 10; + l1.b = 11; + l1.c = 12; + l1.d = 13; + l1.e = 14; + + s2.a = 7; + s2.b = 8; + + n = 41; + + args[0] = &n; + args[1] = &s1; + args[2] = &l1; + args[3] = &s2; + args[4] = NULL; + + ffi_call(&cif, FFI_FN(test_fn), &res, args); + /* { dg-output "5 6 10 11 12 13 14 7 8" } */ + printf("res: %d %d\n", res.a, res.b); + /* { dg-output "\nres: 12 14" } */ + + return 0; +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct3.c b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct3.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct3.c @@ -0,0 +1,125 @@ +/* Area: ffi_call + Purpose: Test passing struct in variable argument lists. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +/* { dg-output "" { xfail avr32*-*-* } } */ + +#include "ffitest.h" +#include + +struct small_tag +{ + unsigned char a; + unsigned char b; +}; + +struct large_tag +{ + unsigned a; + unsigned b; + unsigned c; + unsigned d; + unsigned e; +}; + +static struct large_tag +test_fn (int n, ...) +{ + va_list ap; + struct small_tag s1; + struct small_tag s2; + struct large_tag l; + + va_start (ap, n); + s1 = va_arg (ap, struct small_tag); + l = va_arg (ap, struct large_tag); + s2 = va_arg (ap, struct small_tag); + printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, + s2.a, s2.b); + va_end (ap); + l.a += s1.a; + l.b += s1.b; + l.c += s2.a; + l.d += s2.b; + return l; +} + +int +main (void) +{ + ffi_cif cif; + void* args[5]; + ffi_type* arg_types[5]; + + ffi_type s_type; + ffi_type *s_type_elements[3]; + + ffi_type l_type; + ffi_type *l_type_elements[6]; + + struct small_tag s1; + struct small_tag s2; + struct large_tag l1; + + int n; + struct large_tag res; + + s_type.size = 0; + s_type.alignment = 0; + s_type.type = FFI_TYPE_STRUCT; + s_type.elements = s_type_elements; + + s_type_elements[0] = &ffi_type_uchar; + s_type_elements[1] = &ffi_type_uchar; + s_type_elements[2] = NULL; + + l_type.size = 0; + l_type.alignment = 0; + l_type.type = FFI_TYPE_STRUCT; + l_type.elements = l_type_elements; + + l_type_elements[0] = &ffi_type_uint; + l_type_elements[1] = &ffi_type_uint; + l_type_elements[2] = &ffi_type_uint; + l_type_elements[3] = &ffi_type_uint; + l_type_elements[4] = &ffi_type_uint; + l_type_elements[5] = NULL; + + arg_types[0] = &ffi_type_sint; + arg_types[1] = &s_type; + arg_types[2] = &l_type; + arg_types[3] = &s_type; + arg_types[4] = NULL; + + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &l_type, arg_types) == FFI_OK); + + s1.a = 5; + s1.b = 6; + + l1.a = 10; + l1.b = 11; + l1.c = 12; + l1.d = 13; + l1.e = 14; + + s2.a = 7; + s2.b = 8; + + n = 41; + + args[0] = &n; + args[1] = &s1; + args[2] = &l1; + args[3] = &s2; + args[4] = NULL; + + ffi_call(&cif, FFI_FN(test_fn), &res, args); + /* { dg-output "5 6 10 11 12 13 14 7 8" } */ + printf("res: %d %d %d %d %d\n", res.a, res.b, res.c, res.d, res.e); + /* { dg-output "\nres: 15 17 19 21 14" } */ + + return 0; +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.special/ffitestcxx.h b/Modules/_ctypes/libffi/testsuite/libffi.special/ffitestcxx.h --- a/Modules/_ctypes/libffi/testsuite/libffi.special/ffitestcxx.h +++ b/Modules/_ctypes/libffi/testsuite/libffi.special/ffitestcxx.h @@ -53,44 +53,3 @@ #define PRIuLL "llu" #endif -#ifdef USING_MMAP -static inline void * -allocate_mmap (size_t size) -{ - void *page; -#if defined (HAVE_MMAP_DEV_ZERO) - static int dev_zero_fd = -1; -#endif - -#ifdef HAVE_MMAP_DEV_ZERO - if (dev_zero_fd == -1) - { - dev_zero_fd = open ("/dev/zero", O_RDONLY); - if (dev_zero_fd == -1) - { - perror ("open /dev/zero: %m"); - exit (1); - } - } -#endif - - -#ifdef HAVE_MMAP_ANON - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); -#endif -#ifdef HAVE_MMAP_DEV_ZERO - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE, dev_zero_fd, 0); -#endif - - if (page == (char *) MAP_FAILED) - { - perror ("virtual memory exhausted"); - exit (1); - } - - return page; -} - -#endif diff --git a/Modules/_ctypes/libffi/testsuite/libffi.special/special.exp b/Modules/_ctypes/libffi/testsuite/libffi.special/special.exp --- a/Modules/_ctypes/libffi/testsuite/libffi.special/special.exp +++ b/Modules/_ctypes/libffi/testsuite/libffi.special/special.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2003, 2006, 2009 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006, 2009, 2010 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,8 +14,6 @@ # along with this program; see the file COPYING3. If not see # . -load_lib libffi-dg.exp - dg-init libffi-init @@ -25,10 +23,14 @@ set cxx_options " -shared-libgcc -lstdc++" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O0 -W -Wall" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O2" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O3" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-Os" +if { [string match $using_gcc "yes"] } { + + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O0 -W -Wall" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O2" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O3" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-Os" + +} dg-finish diff --git a/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc b/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc --- a/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc +++ b/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc @@ -5,6 +5,7 @@ Originator: Jeff Sturm */ /* { dg-do run } */ + #include "ffitestcxx.h" #if defined HAVE_STDINT_H diff --git a/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc b/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc --- a/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc +++ b/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc @@ -5,6 +5,7 @@ Originator: Andreas Tobler 20061213 */ /* { dg-do run } */ + #include "ffitestcxx.h" static int checking(int a __UNUSED__, short b __UNUSED__, diff --git a/Modules/_ctypes/libffi/texinfo.tex b/Modules/_ctypes/libffi/texinfo.tex --- a/Modules/_ctypes/libffi/texinfo.tex +++ b/Modules/_ctypes/libffi/texinfo.tex @@ -1,18 +1,18 @@ % texinfo.tex -- TeX macros to handle Texinfo files. -% +% % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2005-07-05.19} -% -% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, -% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software -% Foundation, Inc. -% -% This texinfo.tex file is free software; you can redistribute it and/or +\def\texinfoversion{2012-06-05.14} +% +% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +% 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. +% +% This texinfo.tex file is free software: you can redistribute it and/or % modify it under the terms of the GNU General Public License as -% published by the Free Software Foundation; either version 2, or (at -% your option) any later version. +% published by the Free Software Foundation, either version 3 of the +% License, or (at your option) any later version. % % This texinfo.tex file is distributed in the hope that it will be % useful, but WITHOUT ANY WARRANTY; without even the implied warranty @@ -20,9 +20,7 @@ % General Public License for more details. % % You should have received a copy of the GNU General Public License -% along with this texinfo.tex file; see the file COPYING. If not, write -% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -% Boston, MA 02110-1301, USA. +% along with this program. If not, see . % % As a special exception, when this file is read by TeX when processing % a Texinfo source document, you may use the result without @@ -30,9 +28,9 @@ % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: -% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or -% ftp://tug.org/tex/texinfo.tex -% (and all CTAN mirrors, see http://www.ctan.org). +% http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or +% http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or +% http://www.gnu.org/software/texinfo/ (the Texinfo home page) % The texinfo.tex in any given distribution could well be out % of date, so if that's what you're using, please check. % @@ -67,7 +65,6 @@ \everyjob{\message{[Texinfo version \texinfoversion]}% \catcode`+=\active \catcode`\_=\active} -\message{Basics,} \chardef\other=12 % We never want plain's \outer definition of \+ in Texinfo. @@ -95,10 +92,13 @@ \let\ptexnewwrite\newwrite \let\ptexnoindent=\noindent \let\ptexplus=+ +\let\ptexraggedright=\raggedright \let\ptexrbrace=\} \let\ptexslash=\/ \let\ptexstar=\* \let\ptext=\t +\let\ptextop=\top +{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode % If this character appears in an error message or help string, it % starts a new line in the output. @@ -116,10 +116,11 @@ % Set up fixed words for English if not already set. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putworderror\undefined \gdef\putworderror{error}\fi \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi \ifx\putwordin\undefined \gdef\putwordin{in}\fi -\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi -\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi @@ -153,28 +154,25 @@ \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi -% In some macros, we cannot use the `\? notation---the left quote is -% in some cases the escape char. -\chardef\backChar = `\\ +% Since the category of space is not known, we have to be careful. +\chardef\spacecat = 10 +\def\spaceisspace{\catcode`\ =\spacecat} + +% sometimes characters are active, so we need control sequences. +\chardef\ampChar = `\& \chardef\colonChar = `\: \chardef\commaChar = `\, +\chardef\dashChar = `\- \chardef\dotChar = `\. \chardef\exclamChar= `\! -\chardef\plusChar = `\+ +\chardef\hashChar = `\# +\chardef\lquoteChar= `\` \chardef\questChar = `\? +\chardef\rquoteChar= `\' \chardef\semiChar = `\; +\chardef\slashChar = `\/ \chardef\underChar = `\_ -\chardef\spaceChar = `\ % -\chardef\spacecat = 10 -\def\spaceisspace{\catcode\spaceChar=\spacecat} - -{% for help with debugging. - % example usage: \expandafter\show\activebackslash - \catcode`\! = 0 \catcode`\\ = \active - !global!def!activebackslash{\} -} - % Ignore a token. % \def\gobble#1{} @@ -203,36 +201,7 @@ % that mark overfull boxes (in case you have decided % that the text looks ok even though it passes the margin). % -\def\finalout{\overfullrule=0pt} - -% @| inserts a changebar to the left of the current line. It should -% surround any changed text. This approach does *not* work if the -% change spans more than two lines of output. To handle that, we would -% have adopt a much more difficult approach (putting marks into the main -% vertical list for the beginning and end of each change). -% -\def\|{% - % \vadjust can only be used in horizontal mode. - \leavevmode - % - % Append this vertical mode material after the current line in the output. - \vadjust{% - % We want to insert a rule with the height and depth of the current - % leading; that is exactly what \strutbox is supposed to record. - \vskip-\baselineskip - % - % \vadjust-items are inserted at the left edge of the type. So - % the \llap here moves out into the left-hand margin. - \llap{% - % - % For a thicker or thinner bar, change the `1pt'. - \vrule height\baselineskip width1pt - % - % This is the space between the bar and the text. - \hskip 12pt - }% - }% -} +\def\finalout{\overfullrule=0pt } % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, @@ -250,7 +219,7 @@ \tracingmacros2 \tracingrestores1 \showboxbreadth\maxdimen \showboxdepth\maxdimen - \ifx\eTeXversion\undefined\else % etex gives us more logging + \ifx\eTeXversion\thisisundefined\else % etex gives us more logging \tracingscantokens1 \tracingifs1 \tracinggroups1 @@ -261,6 +230,13 @@ \errorcontextlines16 }% +% @errormsg{MSG}. Do the index-like expansions on MSG, but if things +% aren't perfect, it's not the end of the world, being an error message, +% after all. +% +\def\errormsg{\begingroup \indexnofonts \doerrormsg} +\def\doerrormsg#1{\errmessage{#1}} + % add check for \lastpenalty to plain's definitions. If the last thing % we did was a \nobreak, we don't want to insert more space. % @@ -271,7 +247,6 @@ \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount \removelastskip\penalty-200\bigskip\fi\fi} -% For @cropmarks command. % Do @cropmarks to get crop marks. % \newif\ifcropmarks @@ -285,6 +260,50 @@ \newdimen\cornerthick \cornerthick=.3pt \newdimen\topandbottommargin \topandbottommargin=.75in +% Output a mark which sets \thischapter, \thissection and \thiscolor. +% We dump everything together because we only have one kind of mark. +% This works because we only use \botmark / \topmark, not \firstmark. +% +% A mark contains a subexpression of the \ifcase ... \fi construct. +% \get*marks macros below extract the needed part using \ifcase. +% +% Another complication is to let the user choose whether \thischapter +% (\thissection) refers to the chapter (section) in effect at the top +% of a page, or that at the bottom of a page. The solution is +% described on page 260 of The TeXbook. It involves outputting two +% marks for the sectioning macros, one before the section break, and +% one after. I won't pretend I can describe this better than DEK... +\def\domark{% + \toks0=\expandafter{\lastchapterdefs}% + \toks2=\expandafter{\lastsectiondefs}% + \toks4=\expandafter{\prevchapterdefs}% + \toks6=\expandafter{\prevsectiondefs}% + \toks8=\expandafter{\lastcolordefs}% + \mark{% + \the\toks0 \the\toks2 + \noexpand\or \the\toks4 \the\toks6 + \noexpand\else \the\toks8 + }% +} +% \topmark doesn't work for the very first chapter (after the title +% page or the contents), so we use \firstmark there -- this gets us +% the mark with the chapter defs, unless the user sneaks in, e.g., +% @setcolor (or @url, or @link, etc.) between @contents and the very +% first @chapter. +\def\gettopheadingmarks{% + \ifcase0\topmark\fi + \ifx\thischapter\empty \ifcase0\firstmark\fi \fi +} +\def\getbottomheadingmarks{\ifcase1\botmark\fi} +\def\getcolormarks{\ifcase2\topmark\fi} + +% Avoid "undefined control sequence" errors. +\def\lastchapterdefs{} +\def\lastsectiondefs{} +\def\prevchapterdefs{} +\def\prevsectiondefs{} +\def\lastcolordefs{} + % Main output routine. \chardef\PAGE = 255 \output = {\onepageout{\pagecontents\PAGE}} @@ -302,7 +321,9 @@ % % Do this outside of the \shipout so @code etc. will be expanded in % the headline as they should be, not taken literally (outputting ''code). + \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% % {% @@ -311,6 +332,13 @@ % before the \shipout runs. % \indexdummies % don't expand commands in the output. + \normalturnoffactive % \ in index entries must not stay \, e.g., if + % the page break happens to be in the middle of an example. + % We don't want .vr (or whatever) entries like this: + % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} + % "\acronym" won't work when it's read back in; + % it needs to be + % {\code {{\tt \backslashcurfont }acronym} \shipout\vbox{% % Do this early so pdf references go to the beginning of the page. \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi @@ -338,9 +366,9 @@ \pagebody{#1}% \ifdim\ht\footlinebox > 0pt % Only leave this space if the footline is nonempty. - % (We lessened \vsize for it in \oddfootingxxx.) + % (We lessened \vsize for it in \oddfootingyyy.) % The \baselineskip=24pt in plain's \makefootline has no effect. - \vskip 2\baselineskip + \vskip 24pt \unvbox\footlinebox \fi % @@ -374,7 +402,7 @@ % marginal hacks, juha at viisa.uucp (Juha Takala) \ifvoid\margin\else % marginal info is present \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi -\dimen@=\dp#1 \unvbox#1 +\dimen@=\dp#1\relax \unvbox#1\relax \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi \ifr at ggedbottom \kern-\dimen@ \vfil \fi} } @@ -396,7 +424,7 @@ % \def\parsearg{\parseargusing{}} \def\parseargusing#1#2{% - \def\next{#2}% + \def\argtorun{#2}% \begingroup \obeylines \spaceisspace @@ -415,7 +443,7 @@ \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} -% Each occurence of `\^^M' or `\^^M' is replaced by a single space. +% Each occurrence of `\^^M' or `\^^M' is replaced by a single space. % % \argremovec might leave us with trailing space, e.g., % @end itemize @c foo @@ -427,8 +455,7 @@ \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% \def\temp{#3}% \ifx\temp\empty - % We cannot use \next here, as it holds the macro to run; - % thus we reuse \temp. + % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: \let\temp\finishparsearg \else \let\temp\argcheckspaces @@ -440,14 +467,14 @@ % If a _delimited_ argument is enclosed in braces, they get stripped; so % to get _exactly_ the rest of the line, we had to prevent such situation. % We prepended an \empty token at the very beginning and we expand it now, -% just before passing the control to \next. -% (Similarily, we have to think about #3 of \argcheckspacesY above: it is +% just before passing the control to \argtorun. +% (Similarly, we have to think about #3 of \argcheckspacesY above: it is % either the null string, or it ends with \^^M---thus there is no danger % that a pair of braces would be stripped. % % But first, we have to remove the trailing space token. % -\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} +\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} % \parseargdef\foo{...} % is roughly equivalent to @@ -498,12 +525,12 @@ % used to check whether the current environment is the one expected. % % Non-false conditionals (@iftex, @ifset) don't fit into this, so they -% are not treated as enviroments; they don't open a group. (The +% are not treated as environments; they don't open a group. (The % implementation of @end takes care not to call \endgroup in this % special case.) -% At runtime, environments start with this: +% At run-time, environments start with this: \def\startenvironment#1{\begingroup\def\thisenv{#1}} % initialize \let\thisenv\empty @@ -521,7 +548,7 @@ \fi } -% Evironment mismatch, #1 expected: +% Environment mismatch, #1 expected: \def\badenverr{% \errhelp = \EMsimple \errmessage{This command can appear only \inenvironment\temp, @@ -529,7 +556,7 @@ } \def\inenvironment#1{% \ifx#1\empty - out of any environment% + outside of any environment% \else in environment \expandafter\string#1% \fi @@ -541,7 +568,7 @@ \parseargdef\end{% \if 1\csname iscond.#1\endcsname \else - % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 + % The general wording of \badenverr may not be ideal. \expandafter\checkenv\csname#1\endcsname \csname E#1\endcsname \endgroup @@ -551,85 +578,6 @@ \newhelp\EMsimple{Press RETURN to continue.} -%% Simple single-character @ commands - -% @@ prints an @ -% Kludge this until the fonts are right (grr). -\def\@{{\tt\char64}} - -% This is turned off because it was never documented -% and you can use @w{...} around a quote to suppress ligatures. -%% Define @` and @' to be the same as ` and ' -%% but suppressing ligatures. -%\def\`{{`}} -%\def\'{{'}} - -% Used to generate quoted braces. -\def\mylbrace {{\tt\char123}} -\def\myrbrace {{\tt\char125}} -\let\{=\mylbrace -\let\}=\myrbrace -\begingroup - % Definitions to produce \{ and \} commands for indices, - % and @{ and @} for the aux/toc files. - \catcode`\{ = \other \catcode`\} = \other - \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\! = 0 \catcode`\\ = \other - !gdef!lbracecmd[\{]% - !gdef!rbracecmd[\}]% - !gdef!lbraceatcmd[@{]% - !gdef!rbraceatcmd[@}]% -!endgroup - -% @comma{} to avoid , parsing problems. -\let\comma = , - -% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent -% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. -\let\, = \c -\let\dotaccent = \. -\def\ringaccent#1{{\accent23 #1}} -\let\tieaccent = \t -\let\ubaraccent = \b -\let\udotaccent = \d - -% Other special characters: @questiondown @exclamdown @ordf @ordm -% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. -\def\questiondown{?`} -\def\exclamdown{!`} -\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} -\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} - -% Dotless i and dotless j, used for accents. -\def\imacro{i} -\def\jmacro{j} -\def\dotless#1{% - \def\temp{#1}% - \ifx\temp\imacro \ptexi - \else\ifx\temp\jmacro \j - \else \errmessage{@dotless can be used only with i or j}% - \fi\fi -} - -% The \TeX{} logo, as in plain, but resetting the spacing so that a -% period following counts as ending a sentence. (Idea found in latex.) -% -\edef\TeX{\TeX \spacefactor=1000 } - -% @LaTeX{} logo. Not quite the same results as the definition in -% latex.ltx, since we use a different font for the raised A; it's most -% convenient for us to use an explicitly smaller font, rather than using -% the \scriptstyle font (since we don't reset \scriptstyle and -% \scriptscriptstyle). -% -\def\LaTeX{% - L\kern-.36em - {\setbox0=\hbox{T}% - \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% - \kern-.15em - \TeX -} - % Be sure we're in horizontal mode when doing a tie, since we make space % equivalent to this in @example-like environments. Otherwise, a space % at the beginning of a line will start with \penalty -- and @@ -661,7 +609,7 @@ \def\?{?\spacefactor=\endofsentencespacefactor\space} % @frenchspacing on|off says whether to put extra space after punctuation. -% +% \def\onword{on} \def\offword{off} % @@ -671,7 +619,7 @@ \else\ifx\temp\offword \plainnonfrenchspacing \else \errhelp = \EMsimple - \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% + \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% \fi\fi } @@ -753,15 +701,6 @@ \newdimen\mil \mil=0.001in -% Old definition--didn't work. -%\parseargdef\need{\par % -%% This method tries to make TeX break the page naturally -%% if the depth of the box does not fit. -%{\baselineskip=0pt% -%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak -%\prevdepth=-1000pt -%}} - \parseargdef\need{% % Ensure vertical mode, so we don't make a big box in the middle of a % paragraph. @@ -825,7 +764,7 @@ % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current % paragraph. For more general purposes, use the \margin insertion -% class. WHICH is `l' or `r'. +% class. WHICH is `l' or `r'. Not documented, written for gawk manual. % \newskip\inmarginspacing \inmarginspacing=1cm \def\strutdepth{\dp\strutbox} @@ -872,15 +811,51 @@ \temp } -% @include file insert text of that file as input. +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). This command +% is not documented, not supported, and doesn't work. +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + +% @include FILE -- \input text of FILE. % \def\include{\parseargusing\filenamecatcodes\includezzz} \def\includezzz#1{% \pushthisfilestack \def\thisfile{#1}% {% - \makevalueexpandable - \def\temp{\input #1 }% + \makevalueexpandable % we want to expand any @value in FILE. + \turnoffactive % and allow special characters in the expansion + \indexnofonts % Allow `@@' and other weird things in file names. + \wlog{texinfo.tex: doing @include of #1^^J}% + \edef\temp{\noexpand\input #1 }% + % + % This trickery is to read FILE outside of a group, in case it makes + % definitions, etc. \expandafter }\temp \popthisfilestack @@ -895,6 +870,8 @@ \catcode`>=\other \catcode`+=\other \catcode`-=\other + \catcode`\`=\other + \catcode`\'=\other } \def\pushthisfilestack{% @@ -910,7 +887,7 @@ \def\popthisfilestack{\errthisfilestackempty} \def\errthisfilestackempty{\errmessage{Internal error: the stack of filenames is empty.}} - +% \def\thisfile{} % @center line @@ -918,36 +895,46 @@ % \parseargdef\center{% \ifhmode - \let\next\centerH + \let\centersub\centerH \else - \let\next\centerV + \let\centersub\centerV \fi - \next{\hfil \ignorespaces#1\unskip \hfil}% -} -\def\centerH#1{% - {% - \hfil\break - \advance\hsize by -\leftskip - \advance\hsize by -\rightskip - \line{#1}% - \break - }% -} -\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} + \centersub{\hfil \ignorespaces#1\unskip \hfil}% + \let\centersub\relax % don't let the definition persist, just in case +} +\def\centerH#1{{% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break +}} +% +\newcount\centerpenalty +\def\centerV#1{% + % The idea here is the same as in \startdefun, \cartouche, etc.: if + % @center is the first thing after a section heading, we need to wipe + % out the negative parskip inserted by \sectionheading, but still + % prevent a page break here. + \centerpenalty = \lastpenalty + \ifnum\centerpenalty>10000 \vskip\parskip \fi + \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi + \line{\kern\leftskip #1\kern\rightskip}% +} % @sp n outputs n lines of vertical space - +% \parseargdef\sp{\vskip #1\baselineskip} % @comment ...line which is ignored... % @c is the same as @comment % @ignore ... @end ignore is another way to write a comment - +% \def\comment{\begingroup \catcode`\^^M=\other% \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% \commentxxx} {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} - +% \let\c=\comment % @paragraphindent NCHARS @@ -1040,86 +1027,6 @@ } -% @asis just yields its argument. Used with @table, for example. -% -\def\asis#1{#1} - -% @math outputs its argument in math mode. -% -% One complication: _ usually means subscripts, but it could also mean -% an actual _ character, as in @math{@var{some_variable} + 1}. So make -% _ active, and distinguish by seeing if the current family is \slfam, -% which is what @var uses. -{ - \catcode\underChar = \active - \gdef\mathunderscore{% - \catcode\underChar=\active - \def_{\ifnum\fam=\slfam \_\else\sb\fi}% - } -} -% Another complication: we want \\ (and @\) to output a \ character. -% FYI, plain.tex uses \\ as a temporary control sequence (why?), but -% this is not advertised and we don't care. Texinfo does not -% otherwise define @\. -% -% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. -\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} -% -\def\math{% - \tex - \mathunderscore - \let\\ = \mathbackslash - \mathactive - $\finishmath -} -\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. - -% Some active characters (such as <) are spaced differently in math. -% We have to reset their definitions in case the @math was an argument -% to a command which sets the catcodes (such as @item or @section). -% -{ - \catcode`^ = \active - \catcode`< = \active - \catcode`> = \active - \catcode`+ = \active - \gdef\mathactive{% - \let^ = \ptexhat - \let< = \ptexless - \let> = \ptexgtr - \let+ = \ptexplus - } -} - -% @bullet and @minus need the same treatment as @math, just above. -\def\bullet{$\ptexbullet$} -\def\minus{$-$} - -% @dots{} outputs an ellipsis using the current font. -% We do .5em per period so that it has the same spacing in a typewriter -% font as three actual period characters. -% -\def\dots{% - \leavevmode - \hbox to 1.5em{% - \hskip 0pt plus 0.25fil - .\hfil.\hfil.% - \hskip 0pt plus 0.5fil - }% -} - -% @enddots{} is an end-of-sentence ellipsis. -% -\def\enddots{% - \dots - \spacefactor=\endofsentencespacefactor -} - -% @comma{} is so commas can be inserted into text without messing up -% Texinfo's parsing. -% -\let\comma = , - % @refill is a no-op. \let\refill=\relax @@ -1184,9 +1091,8 @@ \newif\ifpdfmakepagedest % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 -% can be set). So we test for \relax and 0 as well as \undefined, -% borrowed from ifpdf.sty. -\ifx\pdfoutput\undefined +% can be set). So we test for \relax and 0 as well as being undefined. +\ifx\pdfoutput\thisisundefined \else \ifx\pdfoutput\relax \else @@ -1197,99 +1103,156 @@ \fi \fi -% PDF uses PostScript string constants for the names of xref targets, to +% PDF uses PostScript string constants for the names of xref targets, % for display in the outlines, and in other places. Thus, we have to % double any backslashes. Otherwise, a name like "\node" will be % interpreted as a newline (\n), followed by o, d, e. Not good. -% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html -% (and related messages, the final outcome is that it is up to the TeX -% user to double the backslashes and otherwise make the string valid, so -% that's we do). - -% double active backslashes. % -{\catcode`\@=0 \catcode`\\=\active - @gdef at activebackslash{@catcode`@\=@active @otherbackslash} - @gdef at activebackslashdouble{% - @catcode at backChar=@active - @let\=@doublebackslash} -} - -% To handle parens, we must adopt a different approach, since parens are -% not active characters. hyperref.dtx (which has the same problem as -% us) handles it with this amazing macro to replace tokens. I've -% tinkered with it a little for texinfo, but it's definitely from there. -% -% #1 is the tokens to replace. -% #2 is the replacement. -% #3 is the control sequence with the string. -% -\def\HyPsdSubst#1#2#3{% - \def\HyPsdReplace##1#1##2\END{% - ##1% - \ifx\\##2\\% - \else - #2% - \HyReturnAfterFi{% - \HyPsdReplace##2\END +% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and +% related messages. The final outcome is that it is up to the TeX user +% to double the backslashes and otherwise make the string valid, so +% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to +% do this reliably, so we use it. + +% #1 is a control sequence in which to do the replacements, +% which we \xdef. +\def\txiescapepdf#1{% + \ifx\pdfescapestring\thisisundefined + % No primitive available; should we give a warning or log? + % Many times it won't matter. + \else + % The expandable \pdfescapestring primitive escapes parentheses, + % backslashes, and other special chars. + \xdef#1{\pdfescapestring{#1}}% + \fi +} + +\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images +with PDF output, and none of those formats could be found. (.eps cannot +be supported due to the design of the PDF format; use regular TeX (DVI +output) for that.)} + +\ifpdf + % + % Color manipulation macros based on pdfcolor.tex, + % except using rgb instead of cmyk; the latter is said to render as a + % very dark gray on-screen and a very dark halftone in print, instead + % of actual black. + \def\rgbDarkRed{0.50 0.09 0.12} + \def\rgbBlack{0 0 0} + % + % k sets the color for filling (usual text, etc.); + % K sets the color for stroking (thin rules, e.g., normal _'s). + \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} + % + % Set color, and create a mark which defines \thiscolor accordingly, + % so that \makeheadline knows which color to restore. + \def\setcolor#1{% + \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% + \domark + \pdfsetcolor{#1}% + } + % + \def\maincolor{\rgbBlack} + \pdfsetcolor{\maincolor} + \edef\thiscolor{\maincolor} + \def\lastcolordefs{} + % + \def\makefootline{% + \baselineskip24pt + \line{\pdfsetcolor{\maincolor}\the\footline}% + } + % + \def\makeheadline{% + \vbox to 0pt{% + \vskip-22.5pt + \line{% + \vbox to8.5pt{}% + % Extract \thiscolor definition from the marks. + \getcolormarks + % Typeset the headline with \maincolor, then restore the color. + \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% }% - \fi - }% - \xdef#3{\expandafter\HyPsdReplace#3#1\END}% -} -\long\def\HyReturnAfterFi#1\fi{\fi#1} - -% #1 is a control sequence in which to do the replacements. -\def\backslashparens#1{% - \xdef#1{#1}% redefine it as its expansion; the definition is simply - % \lastnode when called from \setref -> \pdfmkdest. - \HyPsdSubst{(}{\backslashlparen}{#1}% - \HyPsdSubst{)}{\backslashrparen}{#1}% -} - -{\catcode\exclamChar = 0 \catcode\backChar = \other - !gdef!backslashlparen{\(}% - !gdef!backslashrparen{\)}% -} - -\ifpdf - \input pdfcolor - \pdfcatalog{/PageMode /UseOutlines}% + \vss + }% + \nointerlineskip + } + % + % + \pdfcatalog{/PageMode /UseOutlines} + % + % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). \def\dopdfimage#1#2#3{% - \def\imagewidth{#2}% - \def\imageheight{#3}% - % without \immediate, pdftex seg faults when the same image is + \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% + \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% + % + % pdftex (and the PDF format) support .pdf, .png, .jpg (among + % others). Let's try in that order, PDF first since if + % someone has a scalable image, presumably better to use that than a + % bitmap. + \let\pdfimgext=\empty + \begingroup + \openin 1 #1.pdf \ifeof 1 + \openin 1 #1.PDF \ifeof 1 + \openin 1 #1.png \ifeof 1 + \openin 1 #1.jpg \ifeof 1 + \openin 1 #1.jpeg \ifeof 1 + \openin 1 #1.JPG \ifeof 1 + \errhelp = \nopdfimagehelp + \errmessage{Could not find image file #1 for pdf}% + \else \gdef\pdfimgext{JPG}% + \fi + \else \gdef\pdfimgext{jpeg}% + \fi + \else \gdef\pdfimgext{jpg}% + \fi + \else \gdef\pdfimgext{png}% + \fi + \else \gdef\pdfimgext{PDF}% + \fi + \else \gdef\pdfimgext{pdf}% + \fi + \closein 1 + \endgroup + % + % without \immediate, ancient pdftex seg faults when the same image is % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) \ifnum\pdftexversion < 14 \immediate\pdfimage \else \immediate\pdfximage \fi - \ifx\empty\imagewidth\else width \imagewidth \fi - \ifx\empty\imageheight\else height \imageheight \fi + \ifdim \wd0 >0pt width \pdfimagewidth \fi + \ifdim \wd2 >0pt height \pdfimageheight \fi \ifnum\pdftexversion<13 - #1.pdf% + #1.\pdfimgext \else - {#1.pdf}% + {#1.\pdfimgext}% \fi \ifnum\pdftexversion < 14 \else \pdfrefximage \pdflastximage \fi} + % \def\pdfmkdest#1{{% % We have to set dummies so commands such as @code, and characters % such as \, aren't expanded when present in a section title. - \atdummies - \activebackslashdouble + \indexnofonts + \turnoffactive + \makevalueexpandable \def\pdfdestname{#1}% - \backslashparens\pdfdestname - \pdfdest name{\pdfdestname} xyz% - }}% + \txiescapepdf\pdfdestname + \safewhatsit{\pdfdest name{\pdfdestname} xyz}% + }} % % used to mark target names; must be expandable. - \def\pdfmkpgn#1{#1}% - % - \let\linkcolor = \Blue % was Cyan, but that seems light? - \def\endlink{\Black\pdfendlink} + \def\pdfmkpgn#1{#1} + % + % by default, use a color that is dark enough to print on paper as + % nearly black, but still distinguishable for online viewing. + \def\urlcolor{\rgbDarkRed} + \def\linkcolor{\rgbDarkRed} + \def\endlink{\setcolor{\maincolor}\pdfendlink} + % % Adding outlines to PDF; macros for calculating structure of outlines % come from Petr Olsak \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% @@ -1309,29 +1272,24 @@ % page number. We could generate a destination for the section % text in the case where a section has no node, but it doesn't % seem worth the trouble, since most documents are normally structured. - \def\pdfoutlinedest{#3}% + \edef\pdfoutlinedest{#3}% \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}% \else - % Doubled backslashes in the name. - {\activebackslashdouble \xdef\pdfoutlinedest{#3}% - \backslashparens\pdfoutlinedest}% + \txiescapepdf\pdfoutlinedest \fi % - % Also double the backslashes in the display string. - {\activebackslashdouble \xdef\pdfoutlinetext{#1}% - \backslashparens\pdfoutlinetext}% + % Also escape PDF chars in the display string. + \edef\pdfoutlinetext{#1}% + \txiescapepdf\pdfoutlinetext % \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% } % \def\pdfmakeoutlines{% \begingroup - % Thanh's hack / proper braces in bookmarks - \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace - \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace - % % Read toc silently, to get counts of subentries for \pdfoutline. + \def\partentry##1##2##3##4{}% ignore parts in the outlines \def\numchapentry##1##2##3##4{% \def\thischapnum{##2}% \def\thissecnum{0}% @@ -1385,35 +1343,63 @@ % Latin 2 (0xea) gets translated to a | character. Info from % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. % - % xx to do this right, we have to translate 8-bit characters to - % their "best" equivalent, based on the @documentencoding. Right - % now, I guess we'll just let the pdf reader have its way. + % TODO this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Too + % much work for too little return. Just use the ASCII equivalents + % we use for the index sort strings. + % \indexnofonts \setupdatafile - \activebackslash - \input \jobname.toc + % We can have normal brace characters in the PDF outlines, unlike + % Texinfo index files. So set that up. + \def\{{\lbracecharliteral}% + \def\}{\rbracecharliteral}% + \catcode`\\=\active \otherbackslash + \input \tocreadfilename \endgroup } + {\catcode`[=1 \catcode`]=2 + \catcode`{=\other \catcode`}=\other + \gdef\lbracecharliteral[{]% + \gdef\rbracecharliteral[}]% + ] % \def\skipspaces#1{\def\PP{#1}\def\D{|}% \ifx\PP\D\let\nextsp\relax \else\let\nextsp\skipspaces - \ifx\p\space\else\addtokens{\filename}{\PP}% - \advance\filenamelength by 1 - \fi + \addtokens{\filename}{\PP}% + \advance\filenamelength by 1 \fi \nextsp} - \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + \def\getfilename#1{% + \filenamelength=0 + % If we don't expand the argument now, \skipspaces will get + % snagged on things like "@value{foo}". + \edef\temp{#1}% + \expandafter\skipspaces\temp|\relax + } \ifnum\pdftexversion < 14 \let \startlink \pdfannotlink \else \let \startlink \pdfstartlink \fi + % make a live url in pdf output. \def\pdfurl#1{% \begingroup - \normalturnoffactive\def\@{@}% + % it seems we really need yet another set of dummies; have not + % tried to figure out what each command should do in the context + % of @url. for now, just make @/ a no-op, that's the only one + % people have actually reported a problem with. + % + \normalturnoffactive + \def\@{@}% + \let\/=\empty \makevalueexpandable - \leavevmode\Red + % do we want to go so far as to use \indexnofonts instead of just + % special-casing \var here? + \def\var##1{##1}% + % + \leavevmode\setcolor{\urlcolor}% \startlink attr{/Border [0 0 0]}% user{/Subtype /Link /A << /S /URI /URI (#1) >>}% \endgroup} @@ -1440,13 +1426,15 @@ {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} \def\pdflink#1{% \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} - \linkcolor #1\endlink} + \setcolor{\linkcolor}#1\endlink} \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} \else + % non-pdf mode \let\pdfmkdest = \gobble \let\pdfurl = \gobble \let\endlink = \relax - \let\linkcolor = \relax + \let\setcolor = \gobble + \let\pdfsetcolor = \gobble \let\pdfmakeoutlines = \relax \fi % \ifx\pdfoutput @@ -1472,6 +1460,10 @@ \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} \def\tt{\fam=\ttfam \setfontstyle{tt}} +% Unfortunately, we have to override this for titles and the like, since +% in those cases "rm" is bold. Sigh. +\def\rmisbold{\rm\def\curfontstyle{bf}} + % Texinfo sort of supports the sans serif font style, which plain TeX does not. % So we set up a \sf. \newfam\sffam @@ -1481,8 +1473,6 @@ % We don't need math for this font style. \def\ttsl{\setfontstyle{ttsl}} -% Default leading. -\newdimen\textleading \textleading = 13.2pt % Set the baselineskip to #1, and the lineskip and strut size % correspondingly. There is no deep meaning behind these magic numbers @@ -1492,8 +1482,13 @@ \def\strutheightpercent{.70833} \def\strutdepthpercent {.29167} % +% can get a sort of poor man's double spacing by redefining this. +\def\baselinefactor{1} +% +\newdimen\textleading \def\setleading#1{% - \normalbaselineskip = #1\relax + \dimen0 = #1\relax + \normalbaselineskip = \baselinefactor\dimen0 \normallineskip = \lineskipfactor\normalbaselineskip \normalbaselines \setbox\strutbox =\hbox{% @@ -1502,20 +1497,295 @@ }% } -% Set the font macro #1 to the font named #2, adding on the -% specified font prefix (normally `cm'). -% #3 is the font's design size, #4 is a scale factor -\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} +% PDF CMaps. See also LaTeX's t1.cmap. +% +% do nothing with this by default. +\expandafter\let\csname cmapOT1\endcsname\gobble +\expandafter\let\csname cmapOT1IT\endcsname\gobble +\expandafter\let\csname cmapOT1TT\endcsname\gobble + +% if we are producing pdf, and we have \pdffontattr, then define cmaps. +% (\pdffontattr was introduced many years ago, but people still run +% older pdftex's; it's easy to conditionalize, so we do.) +\ifpdf \ifx\pdffontattr\thisisundefined \else + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1-0) +%%Title: (TeX-OT1-0 TeX OT1 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1) +/Supplement 0 +>> def +/CMapName /TeX-OT1-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<23> <26> <0023> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +40 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1IT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1IT-0) +%%Title: (TeX-OT1IT-0 TeX OT1IT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1IT) +/Supplement 0 +>> def +/CMapName /TeX-OT1IT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<25> <26> <0025> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +42 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<23> <0023> +<24> <00A3> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1IT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1TT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1TT-0) +%%Title: (TeX-OT1TT-0 TeX OT1TT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1TT) +/Supplement 0 +>> def +/CMapName /TeX-OT1TT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +5 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<21> <26> <0021> +<28> <5F> <0028> +<61> <7E> <0061> +endbfrange +32 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <2191> +<0C> <2193> +<0D> <0027> +<0E> <00A1> +<0F> <00BF> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<20> <2423> +<27> <2019> +<60> <2018> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1TT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +\fi\fi + + +% Set the font macro #1 to the font named \fontprefix#2. +% #3 is the font's design size, #4 is a scale factor, #5 is the CMap +% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit). +% Example: +% #1 = \textrm +% #2 = \rmshape +% #3 = 10 +% #4 = \mainmagstep +% #5 = OT1 +% +\def\setfont#1#2#3#4#5{% + \font#1=\fontprefix#2#3 scaled #4 + \csname cmap#5\endcsname#1% +} +% This is what gets called when #5 of \setfont is empty. +\let\cmap\gobble +% +% (end of cmaps) % Use cm as the default font prefix. % To specify the font prefix, you must define \fontprefix % before you read in texinfo.tex. -\ifx\fontprefix\undefined +\ifx\fontprefix\thisisundefined \def\fontprefix{cm} \fi % Support font families that don't use the same naming scheme as CM. \def\rmshape{r} -\def\rmbshape{bx} %where the normal face is bold +\def\rmbshape{bx} % where the normal face is bold \def\bfshape{b} \def\bxshape{bx} \def\ttshape{tt} @@ -1530,118 +1800,291 @@ \def\scshape{csc} \def\scbshape{csc} +% Definitions for a main text size of 11pt. (The default in Texinfo.) +% +\def\definetextfontsizexi{% % Text fonts (11.2pt, magstep1). \def\textnominalsize{11pt} \edef\mainmagstep{\magstephalf} -\setfont\textrm\rmshape{10}{\mainmagstep} -\setfont\texttt\ttshape{10}{\mainmagstep} -\setfont\textbf\bfshape{10}{\mainmagstep} -\setfont\textit\itshape{10}{\mainmagstep} -\setfont\textsl\slshape{10}{\mainmagstep} -\setfont\textsf\sfshape{10}{\mainmagstep} -\setfont\textsc\scshape{10}{\mainmagstep} -\setfont\textttsl\ttslshape{10}{\mainmagstep} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1095} % A few fonts for @defun names and args. -\setfont\defbf\bfshape{10}{\magstep1} -\setfont\deftt\ttshape{10}{\magstep1} -\setfont\defttsl\ttslshape{10}{\magstep1} +\setfont\defbf\bfshape{10}{\magstep1}{OT1} +\setfont\deftt\ttshape{10}{\magstep1}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} -\setfont\smallrm\rmshape{9}{1000} -\setfont\smalltt\ttshape{9}{1000} -\setfont\smallbf\bfshape{10}{900} -\setfont\smallit\itshape{9}{1000} -\setfont\smallsl\slshape{9}{1000} -\setfont\smallsf\sfshape{9}{1000} -\setfont\smallsc\scshape{10}{900} -\setfont\smallttsl\ttslshape{10}{900} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 +\def\smallecsize{0900} % Fonts for small examples (8pt). \def\smallernominalsize{8pt} -\setfont\smallerrm\rmshape{8}{1000} -\setfont\smallertt\ttshape{8}{1000} -\setfont\smallerbf\bfshape{10}{800} -\setfont\smallerit\itshape{8}{1000} -\setfont\smallersl\slshape{8}{1000} -\setfont\smallersf\sfshape{8}{1000} -\setfont\smallersc\scshape{10}{800} -\setfont\smallerttsl\ttslshape{10}{800} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 +\def\smallerecsize{0800} % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} -\setfont\titlerm\rmbshape{12}{\magstep3} -\setfont\titleit\itbshape{10}{\magstep4} -\setfont\titlesl\slbshape{10}{\magstep4} -\setfont\titlett\ttbshape{12}{\magstep3} -\setfont\titlettsl\ttslshape{10}{\magstep4} -\setfont\titlesf\sfbshape{17}{\magstep1} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm -\setfont\titlesc\scbshape{10}{\magstep4} +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 -\def\authorrm{\secrm} -\def\authortt{\sectt} +\def\titleecsize{2074} % Chapter (and unnumbered) fonts (17.28pt). \def\chapnominalsize{17pt} -\setfont\chaprm\rmbshape{12}{\magstep2} -\setfont\chapit\itbshape{10}{\magstep3} -\setfont\chapsl\slbshape{10}{\magstep3} -\setfont\chaptt\ttbshape{12}{\magstep2} -\setfont\chapttsl\ttslshape{10}{\magstep3} -\setfont\chapsf\sfbshape{17}{1000} +\setfont\chaprm\rmbshape{12}{\magstep2}{OT1} +\setfont\chapit\itbshape{10}{\magstep3}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep3}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} +\setfont\chapsf\sfbshape{17}{1000}{OT1} \let\chapbf=\chaprm -\setfont\chapsc\scbshape{10}{\magstep3} +\setfont\chapsc\scbshape{10}{\magstep3}{OT1} \font\chapi=cmmi12 scaled \magstep2 \font\chapsy=cmsy10 scaled \magstep3 +\def\chapecsize{1728} % Section fonts (14.4pt). \def\secnominalsize{14pt} -\setfont\secrm\rmbshape{12}{\magstep1} -\setfont\secit\itbshape{10}{\magstep2} -\setfont\secsl\slbshape{10}{\magstep2} -\setfont\sectt\ttbshape{12}{\magstep1} -\setfont\secttsl\ttslshape{10}{\magstep2} -\setfont\secsf\sfbshape{12}{\magstep1} +\setfont\secrm\rmbshape{12}{\magstep1}{OT1} +\setfont\secit\itbshape{10}{\magstep2}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep2}{OT1} +\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\secsf\sfbshape{12}{\magstep1}{OT1} \let\secbf\secrm -\setfont\secsc\scbshape{10}{\magstep2} +\setfont\secsc\scbshape{10}{\magstep2}{OT1} \font\seci=cmmi12 scaled \magstep1 \font\secsy=cmsy10 scaled \magstep2 +\def\sececsize{1440} % Subsection fonts (13.15pt). \def\ssecnominalsize{13pt} -\setfont\ssecrm\rmbshape{12}{\magstephalf} -\setfont\ssecit\itbshape{10}{1315} -\setfont\ssecsl\slbshape{10}{1315} -\setfont\ssectt\ttbshape{12}{\magstephalf} -\setfont\ssecttsl\ttslshape{10}{1315} -\setfont\ssecsf\sfbshape{12}{\magstephalf} +\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} +\setfont\ssecit\itbshape{10}{1315}{OT1IT} +\setfont\ssecsl\slbshape{10}{1315}{OT1} +\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} +\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} \let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{1315} +\setfont\ssecsc\scbshape{10}{1315}{OT1} \font\sseci=cmmi12 scaled \magstephalf \font\ssecsy=cmsy10 scaled 1315 +\def\ssececsize{1200} % Reduced fonts for @acro in text (10pt). \def\reducednominalsize{10pt} -\setfont\reducedrm\rmshape{10}{1000} -\setfont\reducedtt\ttshape{10}{1000} -\setfont\reducedbf\bfshape{10}{1000} -\setfont\reducedit\itshape{10}{1000} -\setfont\reducedsl\slshape{10}{1000} -\setfont\reducedsf\sfshape{10}{1000} -\setfont\reducedsc\scshape{10}{1000} -\setfont\reducedttsl\ttslshape{10}{1000} +\setfont\reducedrm\rmshape{10}{1000}{OT1} +\setfont\reducedtt\ttshape{10}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{1000}{OT1} +\setfont\reducedit\itshape{10}{1000}{OT1IT} +\setfont\reducedsl\slshape{10}{1000}{OT1} +\setfont\reducedsf\sfshape{10}{1000}{OT1} +\setfont\reducedsc\scshape{10}{1000}{OT1} +\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} \font\reducedi=cmmi10 \font\reducedsy=cmsy10 +\def\reducedecsize{1000} + +\textleading = 13.2pt % line spacing for 11pt CM +\textfonts % reset the current fonts +\rm +} % end of 11pt text font size definitions, \definetextfontsizexi + + +% Definitions to make the main text be 10pt Computer Modern, with +% section, chapter, etc., sizes following suit. This is for the GNU +% Press printing of the Emacs 22 manual. Maybe other manuals in the +% future. Used with @smallbook, which sets the leading to 12pt. +% +\def\definetextfontsizex{% +% Text fonts (10pt). +\def\textnominalsize{10pt} +\edef\mainmagstep{1000} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1000} + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstephalf}{OT1} +\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 +\def\smallecsize{0900} + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 +\def\smallerecsize{0800} + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\titleecsize{2074} + +% Chapter fonts (14.4pt). +\def\chapnominalsize{14pt} +\setfont\chaprm\rmbshape{12}{\magstep1}{OT1} +\setfont\chapit\itbshape{10}{\magstep2}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep2}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\chapsf\sfbshape{12}{\magstep1}{OT1} +\let\chapbf\chaprm +\setfont\chapsc\scbshape{10}{\magstep2}{OT1} +\font\chapi=cmmi12 scaled \magstep1 +\font\chapsy=cmsy10 scaled \magstep2 +\def\chapecsize{1440} + +% Section fonts (12pt). +\def\secnominalsize{12pt} +\setfont\secrm\rmbshape{12}{1000}{OT1} +\setfont\secit\itbshape{10}{\magstep1}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep1}{OT1} +\setfont\sectt\ttbshape{12}{1000}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} +\setfont\secsf\sfbshape{12}{1000}{OT1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep1}{OT1} +\font\seci=cmmi12 +\font\secsy=cmsy10 scaled \magstep1 +\def\sececsize{1200} + +% Subsection fonts (10pt). +\def\ssecnominalsize{10pt} +\setfont\ssecrm\rmbshape{10}{1000}{OT1} +\setfont\ssecit\itbshape{10}{1000}{OT1IT} +\setfont\ssecsl\slbshape{10}{1000}{OT1} +\setfont\ssectt\ttbshape{10}{1000}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} +\setfont\ssecsf\sfbshape{10}{1000}{OT1} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1000}{OT1} +\font\sseci=cmmi10 +\font\ssecsy=cmsy10 +\def\ssececsize{1000} + +% Reduced fonts for @acro in text (9pt). +\def\reducednominalsize{9pt} +\setfont\reducedrm\rmshape{9}{1000}{OT1} +\setfont\reducedtt\ttshape{9}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{900}{OT1} +\setfont\reducedit\itshape{9}{1000}{OT1IT} +\setfont\reducedsl\slshape{9}{1000}{OT1} +\setfont\reducedsf\sfshape{9}{1000}{OT1} +\setfont\reducedsc\scshape{10}{900}{OT1} +\setfont\reducedttsl\ttslshape{10}{900}{OT1TT} +\font\reducedi=cmmi9 +\font\reducedsy=cmsy9 +\def\reducedecsize{0900} + +\divide\parskip by 2 % reduce space between paragraphs +\textleading = 12pt % line spacing for 10pt CM +\textfonts % reset the current fonts +\rm +} % end of 10pt text font size definitions, \definetextfontsizex + + +% We provide the user-level command +% @fonttextsize 10 +% (or 11) to redefine the text font size. pt is assumed. +% +\def\xiword{11} +\def\xword{10} +\def\xwordpt{10pt} +% +\parseargdef\fonttextsize{% + \def\textsizearg{#1}% + %\wlog{doing @fonttextsize \textsizearg}% + % + % Set \globaldefs so that documents can use this inside @tex, since + % makeinfo 4.8 does not support it, but we need it nonetheless. + % + \begingroup \globaldefs=1 + \ifx\textsizearg\xword \definetextfontsizex + \else \ifx\textsizearg\xiword \definetextfontsizexi + \else + \errhelp=\EMsimple + \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} + \fi\fi + \endgroup +} + % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. Since @@ -1681,8 +2124,8 @@ \let\tenttsl=\titlettsl \def\curfontsize{title}% \def\lsize{chap}\def\lllsize{subsec}% - \resetmathfonts \setleading{25pt}} -\def\titlefont#1{{\titlefonts\rm #1}} + \resetmathfonts \setleading{27pt}} +\def\titlefont#1{{\titlefonts\rmisbold #1}} \def\chapfonts{% \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc @@ -1733,6 +2176,16 @@ \def\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{9.5pt}} +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000}{OT1} +\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000}{OT1} +\setfont\shortconttt\ttshape{12}{1000}{OT1TT} + +% Define these just so they can be easily changed for other fonts. +\def\angleleft{$\langle$} +\def\angleright{$\rangle$} + % Set the fonts to use with the @small... environments. \let\smallexamplefonts = \smallfonts @@ -1746,53 +2199,215 @@ % % By the way, for comparison, here's what fits with @example (10pt): % 8.5x11=71 smallbook=60 a4=75 a5=58 -% -% I wish the USA used A4 paper. % --karl, 24jan03. - % Set up the default fonts, so we can use them for creating boxes. % -\textfonts \rm - -% Define these so they can be easily changed for other fonts. -\def\angleleft{$\langle$} -\def\angleright{$\rangle$} +\definetextfontsizexi + + +\message{markup,} + +% Check if we are currently using a typewriter font. Since all the +% Computer Modern typewriter fonts have zero interword stretch (and +% shrink), and it is reasonable to expect all typewriter fonts to have +% this property, we can check that font parameter. +% +\def\ifmonospace{\ifdim\fontdimen3\font=0pt } + +% Markup style infrastructure. \defmarkupstylesetup\INITMACRO will +% define and register \INITMACRO to be called on markup style changes. +% \INITMACRO can check \currentmarkupstyle for the innermost +% style and the set of \ifmarkupSTYLE switches for all styles +% currently in effect. +\newif\ifmarkupvar +\newif\ifmarkupsamp +\newif\ifmarkupkey +%\newif\ifmarkupfile % @file == @samp. +%\newif\ifmarkupoption % @option == @samp. +\newif\ifmarkupcode +\newif\ifmarkupkbd +%\newif\ifmarkupenv % @env == @code. +%\newif\ifmarkupcommand % @command == @code. +\newif\ifmarkuptex % @tex (and part of @math, for now). +\newif\ifmarkupexample +\newif\ifmarkupverb +\newif\ifmarkupverbatim + +\let\currentmarkupstyle\empty + +\def\setupmarkupstyle#1{% + \csname markup#1true\endcsname + \def\currentmarkupstyle{#1}% + \markupstylesetup +} + +\let\markupstylesetup\empty + +\def\defmarkupstylesetup#1{% + \expandafter\def\expandafter\markupstylesetup + \expandafter{\markupstylesetup #1}% + \def#1% +} + +% Markup style setup for left and right quotes. +\defmarkupstylesetup\markupsetuplq{% + \expandafter\let\expandafter \temp + \csname markupsetuplq\currentmarkupstyle\endcsname + \ifx\temp\relax \markupsetuplqdefault \else \temp \fi +} + +\defmarkupstylesetup\markupsetuprq{% + \expandafter\let\expandafter \temp + \csname markupsetuprq\currentmarkupstyle\endcsname + \ifx\temp\relax \markupsetuprqdefault \else \temp \fi +} + +{ +\catcode`\'=\active +\catcode`\`=\active + +\gdef\markupsetuplqdefault{\let`\lq} +\gdef\markupsetuprqdefault{\let'\rq} + +\gdef\markupsetcodequoteleft{\let`\codequoteleft} +\gdef\markupsetcodequoteright{\let'\codequoteright} + +\gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft} +} + +\let\markupsetuplqcode \markupsetcodequoteleft +\let\markupsetuprqcode \markupsetcodequoteright +% +\let\markupsetuplqexample \markupsetcodequoteleft +\let\markupsetuprqexample \markupsetcodequoteright +% +\let\markupsetuplqsamp \markupsetcodequoteleft +\let\markupsetuprqsamp \markupsetcodequoteright +% +\let\markupsetuplqverb \markupsetcodequoteleft +\let\markupsetuprqverb \markupsetcodequoteright +% +\let\markupsetuplqverbatim \markupsetcodequoteleft +\let\markupsetuprqverbatim \markupsetcodequoteright + +\let\markupsetuplqkbd \markupsetnoligaturesquoteleft + +% Allow an option to not use regular directed right quote/apostrophe +% (char 0x27), but instead the undirected quote from cmtt (char 0x0d). +% The undirected quote is ugly, so don't make it the default, but it +% works for pasting with more pdf viewers (at least evince), the +% lilypond developers report. xpdf does work with the regular 0x27. +% +\def\codequoteright{% + \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax + \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax + '% + \else \char'15 \fi + \else \char'15 \fi +} +% +% and a similar option for the left quote char vs. a grave accent. +% Modern fonts display ASCII 0x60 as a grave accent, so some people like +% the code environments to do likewise. +% +\def\codequoteleft{% + \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax + \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax + % [Knuth] pp. 380,381,391 + % \relax disables Spanish ligatures ?` and !` of \tt font. + \relax`% + \else \char'22 \fi + \else \char'22 \fi +} + +% Commands to set the quote options. +% +\parseargdef\codequoteundirected{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxicodequoteundirected\endcsname + = t% + \else\ifx\temp\offword + \expandafter\let\csname SETtxicodequoteundirected\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% + \fi\fi +} +% +\parseargdef\codequotebacktick{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxicodequotebacktick\endcsname + = t% + \else\ifx\temp\offword + \expandafter\let\csname SETtxicodequotebacktick\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% + \fi\fi +} + +% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. +\def\noligaturesquoteleft{\relax\lq} % Count depth in font-changes, for error checks \newcount\fontdepth \fontdepth=0 -% Fonts for short table of contents. -\setfont\shortcontrm\rmshape{12}{1000} -\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 -\setfont\shortcontsl\slshape{12}{1000} -\setfont\shortconttt\ttshape{12}{1000} - -%% Add scribe-like font environments, plus @l for inline lisp (usually sans -%% serif) and @ii for TeX italic - -% \smartitalic{ARG} outputs arg in italics, followed by an italic correction -% unless the following character is such as not to need one. -\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else - \ptexslash\fi\fi\fi} -\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} -\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} - -% like \smartslanted except unconditionally uses \ttsl. +% Font commands. + +% #1 is the font command (\sl or \it), #2 is the text to slant. +% If we are in a monospaced environment, however, 1) always use \ttsl, +% and 2) do not add an italic correction. +\def\dosmartslant#1#2{% + \ifusingtt + {{\ttsl #2}\let\next=\relax}% + {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}% + \next +} +\def\smartslanted{\dosmartslant\sl} +\def\smartitalic{\dosmartslant\it} + +% Output an italic correction unless \next (presumed to be the following +% character) is such as not to need one. +\def\smartitaliccorrection{% + \ifx\next,% + \else\ifx\next-% + \else\ifx\next.% + \else\ptexslash + \fi\fi\fi + \aftersmartic +} + +% like \smartslanted except unconditionally uses \ttsl, and no ic. % @var is set to this for defun arguments. -\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} - -% like \smartslanted except unconditionally use \sl. We never want +\def\ttslanted#1{{\ttsl #1}} + +% @cite is like \smartslanted except unconditionally use \sl. We never want % ttsl for book titles, do we? -\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} +\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection} + +\def\aftersmartic{} +\def\var#1{% + \let\saveaftersmartic = \aftersmartic + \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% + \smartslanted{#1}% +} \let\i=\smartitalic \let\slanted=\smartslanted -\let\var=\smartslanted \let\dfn=\smartslanted \let\emph=\smartitalic -% @b, explicit bold. +% Explicit font changes: @r, @sc, undocumented @ii. +\def\r#1{{\rm #1}} % roman font +\def\sc#1{{\smallcaps#1}} % smallcaps font +\def\ii#1{{\it #1}} % italic font + +% @b, explicit bold. Also @strong. \def\b#1{{\bf #1}} \let\strong=\b @@ -1824,21 +2439,35 @@ \catcode`@=\other \def\endofsentencespacefactor{3000}% default +% @t, explicit typewriter. \def\t#1{% {\tt \rawbackslash \plainfrenchspacing #1}% \null } -\def\samp#1{`\tclose{#1}'\null} -\setfont\keyrm\rmshape{8}{1000} -\font\keysy=cmsy9 -\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% - \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% - \vbox{\hrule\kern-0.4pt - \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% - \kern-0.4pt\hrule}% - \kern-.06em\raise0.4pt\hbox{\angleright}}}} -% The old definition, with no lozenge: -%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} + +% @samp. +\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} + +% definition of @key that produces a lozenge. Doesn't adjust to text size. +%\setfont\keyrm\rmshape{8}{1000}{OT1} +%\font\keysy=cmsy9 +%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% +% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% +% \vbox{\hrule\kern-0.4pt +% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% +% \kern-0.4pt\hrule}% +% \kern-.06em\raise0.4pt\hbox{\angleright}}}} + +% definition of @key with no lozenge. If the current font is already +% monospace, don't change it; that way, we respect @kbdinputstyle. But +% if it isn't monospace, then use \tt. +% +\def\key#1{{\setupmarkupstyle{key}% + \nohyphenation + \ifmonospace\else\tt\fi + #1}\null} + +% ctrl is no longer a Texinfo command. \def\ctrl #1{{\tt \rawbackslash \hat}#1} % @file, @option are the same as @samp. @@ -1865,7 +2494,7 @@ \plainfrenchspacing #1% }% - \null + \null % reset spacefactor to 1000 } % We *must* turn on hyphenation at `-' and `_' in @code. @@ -1878,11 +2507,14 @@ % and arrange explicitly to hyphenate at a dash. % -- rms. { - \catcode`\-=\active - \catcode`\_=\active + \catcode`\-=\active \catcode`\_=\active + \catcode`\'=\active \catcode`\`=\active + \global\let'=\rq \global\let`=\lq % default definitions % \global\def\code{\begingroup - \catcode`\-=\active \catcode`\_=\active + \setupmarkupstyle{code}% + % The following should really be moved into \setupmarkupstyle handlers. + \catcode\dashChar=\active \catcode\underChar=\active \ifallowcodebreaks \let-\codedash \let_\codeunder @@ -1894,6 +2526,8 @@ } } +\def\codex #1{\tclose{#1}\endgroup} + \def\realdash{-} \def\codedash{-\discretionary{}{}{}} \def\codeunder{% @@ -1907,13 +2541,12 @@ \discretionary{}{}{}}% {\_}% } -\def\codex #1{\tclose{#1}\endgroup} % An additional complication: the above will allow breaks after, e.g., % each of the four underscores in __typeof__. This is undesirable in % some manuals, especially if they don't have long identifiers in % general. @allowcodebreaks provides a way to control this. -% +% \newif\ifallowcodebreaks \allowcodebreakstrue \def\keywordtrue{true} @@ -1927,55 +2560,18 @@ \allowcodebreaksfalse \else \errhelp = \EMsimple - \errmessage{Unknown @allowcodebreaks option `\txiarg'}% + \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% \fi\fi } -% @kbd is like @code, except that if the argument is just one @key command, -% then @kbd has no effect. - -% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), -% `example' (@kbd uses ttsl only inside of @example and friends), -% or `code' (@kbd uses normal tty font always). -\parseargdef\kbdinputstyle{% - \def\txiarg{#1}% - \ifx\txiarg\worddistinct - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% - \else\ifx\txiarg\wordexample - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% - \else\ifx\txiarg\wordcode - \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% - \else - \errhelp = \EMsimple - \errmessage{Unknown @kbdinputstyle option `\txiarg'}% - \fi\fi\fi -} -\def\worddistinct{distinct} -\def\wordexample{example} -\def\wordcode{code} - -% Default is `distinct.' -\kbdinputstyle distinct - -\def\xkey{\key} -\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% -\ifx\one\xkey\ifx\threex\three \key{#2}% -\else{\tclose{\kbdfont\look}}\fi -\else{\tclose{\kbdfont\look}}\fi} - -% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. -\let\indicateurl=\code -\let\env=\code -\let\command=\code - % @uref (abbreviation for `urlref') takes an optional (comma-separated) % second argument specifying the text to display and an optional third % arg as text to display instead of (rather than in addition to) the url -% itself. First (mandatory) arg is the url. Perhaps eventually put in -% a hypertex \special here. -% -\def\uref#1{\douref #1,,,\finish} -\def\douref#1,#2,#3,#4\finish{\begingroup +% itself. First (mandatory) arg is the url. +% (This \urefnobreak definition isn't used now, leaving it for a while +% for comparison.) +\def\urefnobreak#1{\dourefnobreak #1,,,\finish} +\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup \unsepspaces \pdfurl{#1}% \setbox0 = \hbox{\ignorespaces #3}% @@ -1996,6 +2592,103 @@ \endlink \endgroup} +% This \urefbreak definition is the active one. +\def\urefbreak{\begingroup \urefcatcodes \dourefbreak} +\let\uref=\urefbreak +\def\dourefbreak#1{\urefbreakfinish #1,,,\finish} +\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \urefcode{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% Allow line breaks around only a few characters (only). +\def\urefcatcodes{% + \catcode\ampChar=\active \catcode\dotChar=\active + \catcode\hashChar=\active \catcode\questChar=\active + \catcode\slashChar=\active +} +{ + \urefcatcodes + % + \global\def\urefcode{\begingroup + \setupmarkupstyle{code}% + \urefcatcodes + \let&\urefcodeamp + \let.\urefcodedot + \let#\urefcodehash + \let?\urefcodequest + \let/\urefcodeslash + \codex + } + % + % By default, they are just regular characters. + \global\def&{\normalamp} + \global\def.{\normaldot} + \global\def#{\normalhash} + \global\def?{\normalquest} + \global\def/{\normalslash} +} + +% we put a little stretch before and after the breakable chars, to help +% line breaking of long url's. The unequal skips make look better in +% cmtt at least, especially for dots. +\def\urefprestretch{\urefprebreak \hskip0pt plus.13em } +\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em } +% +\def\urefcodeamp{\urefprestretch \&\urefpoststretch} +\def\urefcodedot{\urefprestretch .\urefpoststretch} +\def\urefcodehash{\urefprestretch \#\urefpoststretch} +\def\urefcodequest{\urefprestretch ?\urefpoststretch} +\def\urefcodeslash{\futurelet\next\urefcodeslashfinish} +{ + \catcode`\/=\active + \global\def\urefcodeslashfinish{% + \urefprestretch \slashChar + % Allow line break only after the final / in a sequence of + % slashes, to avoid line break between the slashes in http://. + \ifx\next/\else \urefpoststretch \fi + } +} + +% One more complication: by default we'll break after the special +% characters, but some people like to break before the special chars, so +% allow that. Also allow no breaking at all, for manual control. +% +\parseargdef\urefbreakstyle{% + \def\txiarg{#1}% + \ifx\txiarg\wordnone + \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} + \else\ifx\txiarg\wordbefore + \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak} + \else\ifx\txiarg\wordafter + \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak} + \else + \errhelp = \EMsimple + \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% + \fi\fi\fi +} +\def\wordafter{after} +\def\wordbefore{before} +\def\wordnone{none} + +\urefbreakstyle after + % @url synonym for @uref, since that's how everyone uses it. % \let\url=\uref @@ -2017,34 +2710,65 @@ \let\email=\uref \fi -% Check if we are currently using a typewriter font. Since all the -% Computer Modern typewriter fonts have zero interword stretch (and -% shrink), and it is reasonable to expect all typewriter fonts to have -% this property, we can check that font parameter. -% -\def\ifmonospace{\ifdim\fontdimen3\font=0pt } +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. +\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}} + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\parseargdef\kbdinputstyle{% + \def\txiarg{#1}% + \ifx\txiarg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\txiarg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\txiarg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is `distinct'. +\kbdinputstyle distinct + +\def\xkey{\key} +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% +\ifx\one\xkey\ifx\threex\three \key{#2}% +\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi +\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi} + +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code +\let\env=\code +\let\command=\code + +% @clicksequence{File @click{} Open ...} +\def\clicksequence#1{\begingroup #1\endgroup} + +% @clickstyle @arrow (by default) +\parseargdef\clickstyle{\def\click{#1}} +\def\click{\arrow} % Typeset a dimension, e.g., `in' or `pt'. The only reason for the % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. % \def\dmn#1{\thinspace #1} -\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} - % @l was never documented to mean ``switch to the Lisp font'', % and it is not used as such in any manual I can find. We need it for % Polish suppressed-l. --karl, 22sep96. %\def\l#1{{\li #1}\null} -% Explicit font changes: @r, @sc, undocumented @ii. -\def\r#1{{\rm #1}} % roman font -\def\sc#1{{\smallcaps#1}} % smallcaps font -\def\ii#1{{\it #1}} % italic font - % @acronym for "FBI", "NATO", and the like. % We print this one point size smaller, since it's intended for % all-uppercase. -% +% \def\acronym#1{\doacronym #1,,\finish} \def\doacronym#1,#2,#3\finish{% {\selectfonts\lsize #1}% @@ -2052,11 +2776,12 @@ \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi + \null % reset \spacefactor=1000 } % @abbr for "Comput. J." and the like. % No font change, but don't do end-of-sentence spacing. -% +% \def\abbr#1{\doabbr #1,,\finish} \def\doabbr#1,#2,#3\finish{% {\plainfrenchspacing #1}% @@ -2064,7 +2789,254 @@ \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi -} + \null % reset \spacefactor=1000 +} + +% @asis just yields its argument. Used with @table, for example. +% +\def\asis#1{#1} + +% @math outputs its argument in math mode. +% +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode`\_ = \active + \gdef\mathunderscore{% + \catcode`\_=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} +% Another complication: we want \\ (and @\) to output a math (or tt) \. +% FYI, plain.tex uses \\ as a temporary control sequence (for no +% particular reason), but this is not advertised and we don't care. +% +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + % make the texinfo accent commands work in math mode + \let\"=\ddot + \let\'=\acute + \let\==\bar + \let\^=\hat + \let\`=\grave + \let\u=\breve + \let\v=\check + \let\~=\tilde + \let\dotaccent=\dot + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \catcode`' = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + \let' = \ptexquoteright + } +} + +% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. +% Ignore unless FMTNAME == tex; then it is like @iftex and @tex, +% except specified as a normal braced arg, so no newlines to worry about. +% +\def\outfmtnametex{tex} +% +\long\def\inlinefmt#1{\doinlinefmt #1,\finish} +\long\def\doinlinefmt#1,#2,\finish{% + \def\inlinefmtname{#1}% + \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi +} +% For raw, must switch into @tex before parsing the argument, to avoid +% setting catcodes prematurely. Doing it this way means that, for +% example, @inlineraw{html, foo{bar} gets a parse error instead of being +% ignored. But this isn't important because if people want a literal +% *right* brace they would have to use a command anyway, so they may as +% well use a command to get a left brace too. We could re-use the +% delimiter character idea from \verb, but it seems like overkill. +% +\long\def\inlineraw{\tex \doinlineraw} +\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish} +\def\doinlinerawtwo#1,#2,\finish{% + \def\inlinerawname{#1}% + \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi + \endgroup % close group opened by \tex. +} + + +\message{glyphs,} +% and logos. + +% @@ prints an @, as does @atchar{}. +\def\@{\char64 } +\let\atchar=\@ + +% @{ @} @lbracechar{} @rbracechar{} all generate brace characters. +% Unless we're in typewriter, use \ecfont because the CM text fonts do +% not have braces, and we don't want to switch into math. +\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}} +\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}} +\let\{=\mylbrace \let\lbracechar=\{ +\let\}=\myrbrace \let\rbracechar=\} +\begingroup + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux/toc files. + \catcode`\{ = \other \catcode`\} = \other + \catcode`\[ = 1 \catcode`\] = 2 + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup + +% @comma{} to avoid , parsing problems. +\let\comma = , + +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. +\let\, = \ptexc +\let\dotaccent = \ptexdot +\def\ringaccent#1{{\accent23 #1}} +\let\tieaccent = \ptext +\let\ubaraccent = \ptexb +\let\udotaccent = \d + +% Other special characters: @questiondown @exclamdown @ordf @ordm +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. +\def\questiondown{?`} +\def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} + +% Dotless i and dotless j, used for accents. +\def\imacro{i} +\def\jmacro{j} +\def\dotless#1{% + \def\temp{#1}% + \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi + \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi + \else \errmessage{@dotless can be used only with i or j}% + \fi\fi +} + +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=1000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{% + \ifx\textnominalsize\xwordpt + % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX. + % Revert to plain's \scriptsize, which is 7pt. + \count255=\the\fam $\fam\count255 \scriptstyle A$% + \else + % For 11pt, we can use our lllsize. + \selectfonts\lllsize A% + \fi + }% + \vss + }}% + \kern-.15em + \TeX +} + +% Some math mode symbols. +\def\bullet{$\ptexbullet$} +\def\geq{\ifmmode \ge\else $\ge$\fi} +\def\leq{\ifmmode \le\else $\le$\fi} +\def\minus{\ifmmode -\else $-$\fi} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in the cm +% typewriter fonts as three actual period characters; on the other hand, +% in other typewriter fonts three periods are wider than 1.5em. So do +% whichever is larger. +% +\def\dots{% + \leavevmode + \setbox0=\hbox{...}% get width of three periods + \ifdim\wd0 > 1.5em + \dimen0 = \wd0 + \else + \dimen0 = 1.5em + \fi + \hbox to \dimen0{% + \hskip 0pt plus.25fil + .\hskip 0pt plus1fil + .\hskip 0pt plus1fil + .\hskip 0pt plus.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=\endofsentencespacefactor +} + +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% +% Since these characters are used in examples, they should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% +\def\point{$\star$} +\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} +\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} +\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} +\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} + +% The @error{} command. +% Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% +{\tentt \global\dimen0 = 3em}% Width of the box. +\dimen2 = .55pt % Thickness of rules +% The text. (`r' is open on the right, `e' somewhat less so on the left.) +\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} +% +\setbox\errorbox=\hbox to \dimen0{\hfil + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. + \advance\hsize by -2\dimen2 % Rules. + \vbox{% + \hrule height\dimen2 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. + \kern3pt\vrule width\dimen2}% Space to right. + \hrule height\dimen2} + \hfil} +% +\def\error{\leavevmode\lower.7ex\copy\errorbox} % @pounds{} is a sterling sign, which Knuth put in the CM italic font. % @@ -2075,49 +3047,113 @@ % Theiling, which support regular, slanted, bold and bold slanted (and % "outlined" (blackboard board, sort of) versions, which we don't need). % It is available from http://www.ctan.org/tex-archive/fonts/eurosym. -% +% % Although only regular is the truly official Euro symbol, we ignore % that. The Euro is designed to be slightly taller than the regular % font height. -% +% % feymr - regular % feymo - slanted % feybr - bold % feybo - bold slanted -% +% % There is no good (free) typewriter version, to my knowledge. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. % Hmm. -% +% % Also doesn't work in math. Do we need to do math with euro symbols? % Hope not. -% -% +% +% \def\euro{{\eurofont e}} \def\eurofont{% % We set the font at each command, rather than predefining it in % \textfonts and the other font-switching commands, so that % installations which never need the symbol don't have to have the % font installed. - % + % % There is only one designed size (nominal 10pt), so we always scale % that to the current nominal size. - % + % % By the way, simply using "at 1em" works for cmr10 and the like, but % does not work for cmbx10 and other extended/shrunken fonts. - % + % \def\eurosize{\csname\curfontsize nominalsize\endcsname}% % - \ifx\curfontstyle\bfstylename + \ifx\curfontstyle\bfstylename % bold: \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize - \else + \else % regular: \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize \fi \thiseurofont } +% Glyphs from the EC fonts. We don't use \let for the aliases, because +% sometimes we redefine the original macro, and the alias should reflect +% the redefinition. +% +% Use LaTeX names for the Icelandic letters. +\def\DH{{\ecfont \char"D0}} % Eth +\def\dh{{\ecfont \char"F0}} % eth +\def\TH{{\ecfont \char"DE}} % Thorn +\def\th{{\ecfont \char"FE}} % thorn +% +\def\guillemetleft{{\ecfont \char"13}} +\def\guillemotleft{\guillemetleft} +\def\guillemetright{{\ecfont \char"14}} +\def\guillemotright{\guillemetright} +\def\guilsinglleft{{\ecfont \char"0E}} +\def\guilsinglright{{\ecfont \char"0F}} +\def\quotedblbase{{\ecfont \char"12}} +\def\quotesinglbase{{\ecfont \char"0D}} +% +% This positioning is not perfect (see the ogonek LaTeX package), but +% we have the precomposed glyphs for the most common cases. We put the +% tests to use those glyphs in the single \ogonek macro so we have fewer +% dummy definitions to worry about for index entries, etc. +% +% ogonek is also used with other letters in Lithuanian (IOU), but using +% the precomposed glyphs for those is not so easy since they aren't in +% the same EC font. +\def\ogonek#1{{% + \def\temp{#1}% + \ifx\temp\macrocharA\Aogonek + \else\ifx\temp\macrochara\aogonek + \else\ifx\temp\macrocharE\Eogonek + \else\ifx\temp\macrochare\eogonek + \else + \ecfont \setbox0=\hbox{#1}% + \ifdim\ht0=1ex\accent"0C #1% + \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% + \fi + \fi\fi\fi\fi + }% +} +\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} +\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} +\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} +\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} +% +% Use the ec* fonts (cm-super in outline format) for non-CM glyphs. +\def\ecfont{% + % We can't distinguish serif/sans and italic/slanted, but this + % is used for crude hacks anyway (like adding French and German + % quotes to documents typeset with CM, where we lose kerning), so + % hopefully nobody will notice/care. + \edef\ecsize{\csname\curfontsize ecsize\endcsname}% + \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% + \ifx\curfontstyle\bfstylename + % bold: + \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize + \else + % regular: + \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize + \fi + \thisecfont +} + % @registeredsymbol - R in a circle. The font for the R should really % be smaller yet, but lllsize is the best we can do for now. % Adapted from the plain.tex definition of \copyright. @@ -2128,14 +3164,24 @@ }$% } +% @textdegree - the normal degrees sign. +% +\def\textdegree{$^\circ$} + % Laurent Siebenmann reports \Orb undefined with: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 % so we'll define it if necessary. -% -\ifx\Orb\undefined +% +\ifx\Orb\thisisundefined \def\Orb{\mathhexbox20D} \fi +% Quotes. +\chardef\quotedblleft="5C +\chardef\quotedblright=`\" +\chardef\quoteleft=`\` +\chardef\quoteright=`\' + \message{page headings,} @@ -2154,8 +3200,9 @@ \newif\ifsetshortcontentsaftertitlepage \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue -\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% - \endgroup\page\hbox{}\page} +\parseargdef\shorttitlepage{% + \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} \envdef\titlepage{% % Open one extra group, as we want to close it in the middle of \Etitlepage. @@ -2215,17 +3262,14 @@ \finishedtitlepagetrue } -%%% Macros to be used within @titlepage: +% Macros to be used within @titlepage: \let\subtitlerm=\tenrm \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} -\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines - \let\tt=\authortt} - \parseargdef\title{% \checkenv\titlepage - \leftline{\titlefonts\rm #1} + \leftline{\titlefonts\rmisbold #1} % print a rule at the page bottom also. \finishedtitlepagefalse \vskip4pt \hrule height 4pt width \hsize \vskip4pt @@ -2246,12 +3290,12 @@ \else \checkenv\titlepage \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi - {\authorfont \leftline{#1}}% + {\secfonts\rmisbold \leftline{#1}}% \fi } -%%% Set up page headings and footings. +% Set up page headings and footings. \let\thispage=\folio @@ -2299,12 +3343,39 @@ % % Leave some space for the footline. Hopefully ok to assume % @evenfooting will not be used by itself. - \global\advance\pageheight by -\baselineskip - \global\advance\vsize by -\baselineskip + \global\advance\pageheight by -12pt + \global\advance\vsize by -12pt } \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} +% @evenheadingmarks top \thischapter <- chapter at the top of a page +% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page +% +% The same set of arguments for: +% +% @oddheadingmarks +% @evenfootingmarks +% @oddfootingmarks +% @everyheadingmarks +% @everyfootingmarks + +\def\evenheadingmarks{\headingmarks{even}{heading}} +\def\oddheadingmarks{\headingmarks{odd}{heading}} +\def\evenfootingmarks{\headingmarks{even}{footing}} +\def\oddfootingmarks{\headingmarks{odd}{footing}} +\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} + \headingmarks{odd}{heading}{#1} } +\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} + \headingmarks{odd}{footing}{#1} } +% #1 = even/odd, #2 = heading/footing, #3 = top/bottom. +\def\headingmarks#1#2#3 {% + \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname + \global\expandafter\let\csname get#1#2marks\endcsname \temp +} + +\everyheadingmarks bottom +\everyfootingmarks bottom % @headings double turns headings on for double-sided printing. % @headings single turns headings on for single-sided printing. @@ -2318,10 +3389,14 @@ \def\headings #1 {\csname HEADINGS#1\endcsname} -\def\HEADINGSoff{% -\global\evenheadline={\hfil} \global\evenfootline={\hfil} -\global\oddheadline={\hfil} \global\oddfootline={\hfil}} -\HEADINGSoff +\def\headingsoff{% non-global headings elimination + \evenheadline={\hfil}\evenfootline={\hfil}% + \oddheadline={\hfil}\oddfootline={\hfil}% +} + +\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting +\HEADINGSoff % it's the default + % When we turn headings on, set the page number to 1. % For double-sided printing, put current file name in lower left corner, % chapter name on inside top of right hand pages, document @@ -2372,7 +3447,7 @@ % This produces Day Month Year style of output. % Only define if not already defined, in case a txi-??.tex file has set % up a different format (e.g., txi-cs.tex does this). -\ifx\today\undefined +\ifx\today\thisisundefined \def\today{% \number\day\space \ifcase\month @@ -2433,7 +3508,7 @@ \begingroup \advance\leftskip by-\tableindent \advance\hsize by\tableindent - \advance\rightskip by0pt plus1fil + \advance\rightskip by0pt plus1fil\relax \leavevmode\unhbox0\par \endgroup % @@ -2447,7 +3522,7 @@ % cause the example and the item to crash together. So we use this % bizarre value of 10001 as a signal to \aboveenvbreak to insert % \parskip glue after all. Section titles are handled this way also. - % + % \penalty 10001 \endgroup \itemxneedsnegativevskipfalse @@ -2541,9 +3616,18 @@ \parindent=0pt \parskip=\smallskipamount \ifdim\parskip=0pt \parskip=2pt \fi + % + % Try typesetting the item mark that if the document erroneously says + % something like @itemize @samp (intending @table), there's an error + % right away at the @itemize. It's not the best error message in the + % world, but it's better than leaving it to the @item. This means if + % the user wants an empty mark, they have to say @w{} not just @w. \def\itemcontents{#1}% + \setbox0 = \hbox{\itemcontents}% + % % @itemize with no arg is equivalent to @itemize @bullet. \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + % \let\item=\itemizeitem } @@ -2564,6 +3648,7 @@ \ifnum\lastpenalty<10000 \parskip=0in \fi \noindent \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + % \vadjust{\penalty 1200}}% not good to break after first line of item. \flushcr } @@ -2785,12 +3870,19 @@ % % @headitem starts a heading row, which we typeset in bold. % Assignments have to be global since we are inside the implicit group -% of an alignment entry. Note that \everycr resets \everytab. -\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% +% of an alignment entry. \everycr resets \everytab so we don't have to +% undo it ourselves. +\def\headitemfont{\b}% for people to use in the template row; not changeable +\def\headitem{% + \checkenv\multitable + \crcr + \global\everytab={\bf}% can't use \headitemfont since the parsing differs + \the\everytab % for the first item +}% % % A \tab used to include \hskip1sp. But then the space in a template % line is not enough. That is bad. So let's go back to just `&' until -% we encounter the problem it was intended to solve again. +% we again encounter the problem the 1sp was intended to solve. % --karl, nathan at acm.org, 20apr99. \def\tab{\checkenv\multitable &\the\everytab}% @@ -2902,18 +3994,18 @@ \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip \global\advance\multitablelinespace by-\ht0 \fi -%% Test to see if parskip is larger than space between lines of -%% table. If not, do nothing. -%% If so, set to same dimension as multitablelinespace. +% Test to see if parskip is larger than space between lines of +% table. If not, do nothing. +% If so, set to same dimension as multitablelinespace. \ifdim\multitableparskip>\multitablelinespace \global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. +\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller + % than skip between lines in the table. \fi% \ifdim\multitableparskip=0pt \global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. +\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller + % than skip between lines in the table. \fi} @@ -2959,6 +4051,7 @@ \def\doignore#1{\begingroup % Scan in ``verbatim'' mode: + \obeylines \catcode`\@ = \other \catcode`\{ = \other \catcode`\} = \other @@ -2979,16 +4072,16 @@ \gdef\dodoignore#1{% % #1 contains the command name as a string, e.g., `ifinfo'. % - % Define a command to find the next `@end #1', which must be on a line - % by itself. - \long\def\doignoretext##1^^M at end #1{\doignoretextyyy##1^^M@#1\_STOP_}% + % Define a command to find the next `@end #1'. + \long\def\doignoretext##1^^M at end #1{% + \doignoretextyyy##1^^M@#1\_STOP_}% + % % And this command to find another #1 command, at the beginning of a % line. (Otherwise, we would consider a line `@c @ifset', for % example, to count as an @ifset for nesting.) \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% % % And now expand that command. - \obeylines % \doignoretext ^^M% }% } @@ -3018,7 +4111,12 @@ } % Finish off ignored text. -\def\enddoignore{\endgroup\ignorespaces} +{ \obeylines% + % Ignore anything after the last `@end #1'; this matters in verbatim + % environments, where otherwise the newline after an ignored conditional + % would result in a blank line in the output. + \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% +} % @set VAR sets the variable VAR to an empty value. @@ -3183,11 +4281,11 @@ \def\dosynindex#1#2#3{% % Only do \closeout if we haven't already done it, else we'll end up % closing the target index. - \expandafter \ifx\csname donesynindex#2\endcsname \undefined + \expandafter \ifx\csname donesynindex#2\endcsname \relax % The \closeout helps reduce unnecessary open files; the limit on the % Acorn RISC OS is a mere 16 files. \expandafter\closeout\csname#2indfile\endcsname - \expandafter\let\csname\donesynindex#2\endcsname = 1 + \expandafter\let\csname donesynindex#2\endcsname = 1 \fi % redefine \fooindfile: \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname @@ -3221,11 +4319,41 @@ \escapechar = `\\ % use backslash in output files. \def\@{@}% change to @@ when we switch to @ as escape char in index files. \def\ {\realbackslash\space }% - % Need these in case \tex is in effect and \{ is a \delimiter again. - % But can't use \lbracecmd and \rbracecmd because texindex assumes - % braces and backslashes are used only as delimiters. - \let\{ = \mylbrace - \let\} = \myrbrace + % + % Need these unexpandable (because we define \tt as a dummy) + % definitions when @{ or @} appear in index entry text. Also, more + % complicated, when \tex is in effect and \{ is a \delimiter again. + % We can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. Perhaps we + % should define @lbrace and @rbrace commands a la @comma. + \def\{{{\tt\char123}}% + \def\}{{\tt\char125}}% + % + % I don't entirely understand this, but when an index entry is + % generated from a macro call, the \endinput which \scanmacro inserts + % causes processing to be prematurely terminated. This is, + % apparently, because \indexsorttmp is fully expanded, and \endinput + % is an expandable command. The redefinition below makes \endinput + % disappear altogether for that purpose -- although logging shows that + % processing continues to some further point. On the other hand, it + % seems \endinput does not hurt in the printed index arg, since that + % is still getting written without apparent harm. + % + % Sample source (mac-idx3.tex, reported by Graham Percival to + % help-texinfo, 22may06): + % @macro funindex {WORD} + % @findex xyz + % @end macro + % ... + % @funindex commtest + % + % The above is not enough to reproduce the bug, but it gives the flavor. + % + % Sample whatsit resulting: + % . at write3{\entry{xyz}{@folio }{@code {xyz at endinput }}} + % + % So: + \let\endinput = \empty % % Do the redefinitions. \commondummies @@ -3244,6 +4372,7 @@ % % Do the redefinitions. \commondummies + \otherbackslash } % Called from \indexdummies and \atdummies. @@ -3251,7 +4380,7 @@ \def\commondummies{% % % \definedummyword defines \#1 as \string\#1\space, thus effectively - % preventing its expansion. This is used only for control% words, + % preventing its expansion. This is used only for control words, % not control letters, because the \space would be incorrect for % control characters, but is needed to separate the control word % from whatever follows. @@ -3270,23 +4399,28 @@ \commondummiesnofonts % \definedummyletter\_% + \definedummyletter\-% % % Non-English letters. \definedummyword\AA \definedummyword\AE + \definedummyword\DH \definedummyword\L + \definedummyword\O \definedummyword\OE - \definedummyword\O + \definedummyword\TH \definedummyword\aa \definedummyword\ae + \definedummyword\dh + \definedummyword\exclamdown \definedummyword\l + \definedummyword\o \definedummyword\oe - \definedummyword\o - \definedummyword\ss - \definedummyword\exclamdown - \definedummyword\questiondown \definedummyword\ordf \definedummyword\ordm + \definedummyword\questiondown + \definedummyword\ss + \definedummyword\th % % Although these internal commands shouldn't show up, sometimes they do. \definedummyword\bf @@ -3302,21 +4436,39 @@ \definedummyword\TeX % % Assorted special characters. + \definedummyword\arrow \definedummyword\bullet \definedummyword\comma \definedummyword\copyright \definedummyword\registeredsymbol \definedummyword\dots \definedummyword\enddots + \definedummyword\entrybreak \definedummyword\equiv \definedummyword\error \definedummyword\euro \definedummyword\expansion + \definedummyword\geq + \definedummyword\guillemetleft + \definedummyword\guillemetright + \definedummyword\guilsinglleft + \definedummyword\guilsinglright + \definedummyword\lbracechar + \definedummyword\leq \definedummyword\minus + \definedummyword\ogonek \definedummyword\pounds \definedummyword\point \definedummyword\print + \definedummyword\quotedblbase + \definedummyword\quotedblleft + \definedummyword\quotedblright + \definedummyword\quoteleft + \definedummyword\quoteright + \definedummyword\quotesinglbase + \definedummyword\rbracechar \definedummyword\result + \definedummyword\textdegree % % We want to disable all macros so that they are not expanded by \write. \macrolist @@ -3330,63 +4482,72 @@ % \commondummiesnofonts: common to \commondummies and \indexnofonts. % -% Better have this without active chars. -{ - \catcode`\~=\other - \gdef\commondummiesnofonts{% - % Control letters and accents. - \definedummyletter\!% - \definedummyaccent\"% - \definedummyaccent\'% - \definedummyletter\*% - \definedummyaccent\,% - \definedummyletter\.% - \definedummyletter\/% - \definedummyletter\:% - \definedummyaccent\=% - \definedummyletter\?% - \definedummyaccent\^% - \definedummyaccent\`% - \definedummyaccent\~% - \definedummyword\u - \definedummyword\v - \definedummyword\H - \definedummyword\dotaccent - \definedummyword\ringaccent - \definedummyword\tieaccent - \definedummyword\ubaraccent - \definedummyword\udotaccent - \definedummyword\dotless - % - % Texinfo font commands. - \definedummyword\b - \definedummyword\i - \definedummyword\r - \definedummyword\sc - \definedummyword\t - % - % Commands that take arguments. - \definedummyword\acronym - \definedummyword\cite - \definedummyword\code - \definedummyword\command - \definedummyword\dfn - \definedummyword\emph - \definedummyword\env - \definedummyword\file - \definedummyword\kbd - \definedummyword\key - \definedummyword\math - \definedummyword\option - \definedummyword\samp - \definedummyword\strong - \definedummyword\tie - \definedummyword\uref - \definedummyword\url - \definedummyword\var - \definedummyword\verb - \definedummyword\w - } +\def\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter\!% + \definedummyaccent\"% + \definedummyaccent\'% + \definedummyletter\*% + \definedummyaccent\,% + \definedummyletter\.% + \definedummyletter\/% + \definedummyletter\:% + \definedummyaccent\=% + \definedummyletter\?% + \definedummyaccent\^% + \definedummyaccent\`% + \definedummyaccent\~% + \definedummyword\u + \definedummyword\v + \definedummyword\H + \definedummyword\dotaccent + \definedummyword\ogonek + \definedummyword\ringaccent + \definedummyword\tieaccent + \definedummyword\ubaraccent + \definedummyword\udotaccent + \definedummyword\dotless + % + % Texinfo font commands. + \definedummyword\b + \definedummyword\i + \definedummyword\r + \definedummyword\sansserif + \definedummyword\sc + \definedummyword\slanted + \definedummyword\t + % + % Commands that take arguments. + \definedummyword\abbr + \definedummyword\acronym + \definedummyword\anchor + \definedummyword\cite + \definedummyword\code + \definedummyword\command + \definedummyword\dfn + \definedummyword\dmn + \definedummyword\email + \definedummyword\emph + \definedummyword\env + \definedummyword\file + \definedummyword\image + \definedummyword\indicateurl + \definedummyword\inforef + \definedummyword\kbd + \definedummyword\key + \definedummyword\math + \definedummyword\option + \definedummyword\pxref + \definedummyword\ref + \definedummyword\samp + \definedummyword\strong + \definedummyword\tie + \definedummyword\uref + \definedummyword\url + \definedummyword\var + \definedummyword\verb + \definedummyword\w + \definedummyword\xref } % \indexnofonts is used when outputting the strings to sort the index @@ -3399,7 +4560,7 @@ \def\definedummyaccent##1{\let##1\asis}% % We can just ignore other control letters. \def\definedummyletter##1{\let##1\empty}% - % Hopefully, all control words can become @asis. + % All control words become @asis by default; overrides below. \let\definedummyword\definedummyaccent % \commondummiesnofonts @@ -3411,60 +4572,95 @@ % \def\ { }% \def\@{@}% - % how to handle braces? \def\_{\normalunderscore}% + \def\-{}% @- shouldn't affect sorting + % + % Unfortunately, texindex is not prepared to handle braces in the + % content at all. So for index sorting, we map @{ and @} to strings + % starting with |, since that ASCII character is between ASCII { and }. + \def\{{|a}% + \def\lbracechar{|a}% + % + \def\}{|b}% + \def\rbracechar{|b}% % % Non-English letters. \def\AA{AA}% \def\AE{AE}% + \def\DH{DZZ}% \def\L{L}% \def\OE{OE}% \def\O{O}% + \def\TH{ZZZ}% \def\aa{aa}% \def\ae{ae}% + \def\dh{dzz}% + \def\exclamdown{!}% \def\l{l}% \def\oe{oe}% - \def\o{o}% - \def\ss{ss}% - \def\exclamdown{!}% - \def\questiondown{?}% \def\ordf{a}% \def\ordm{o}% + \def\o{o}% + \def\questiondown{?}% + \def\ss{ss}% + \def\th{zzz}% % \def\LaTeX{LaTeX}% \def\TeX{TeX}% % % Assorted special characters. % (The following {} will end up in the sort string, but that's ok.) + \def\arrow{->}% \def\bullet{bullet}% \def\comma{,}% \def\copyright{copyright}% - \def\registeredsymbol{R}% \def\dots{...}% \def\enddots{...}% \def\equiv{==}% \def\error{error}% \def\euro{euro}% \def\expansion{==>}% + \def\geq{>=}% + \def\guillemetleft{<<}% + \def\guillemetright{>>}% + \def\guilsinglleft{<}% + \def\guilsinglright{>}% + \def\leq{<=}% \def\minus{-}% + \def\point{.}% \def\pounds{pounds}% - \def\point{.}% \def\print{-|}% + \def\quotedblbase{"}% + \def\quotedblleft{"}% + \def\quotedblright{"}% + \def\quoteleft{`}% + \def\quoteright{'}% + \def\quotesinglbase{,}% + \def\registeredsymbol{R}% \def\result{=>}% + \def\textdegree{o}% + % + \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax + \else \indexlquoteignore \fi % % We need to get rid of all macros, leaving only the arguments (if present). % Of course this is not nearly correct, but it is the best we can do for now. % makeinfo does not expand macros in the argument to @deffn, which ends up % writing an index entry, and texindex isn't prepared for an index sort entry % that starts with \. - % + % % Since macro invocations are followed by braces, we can just redefine them % to take a single TeX argument. The case of a macro invocation that % goes to end-of-line is not handled. - % + % \macrolist } +% Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us +% ignore left quotes in the sort term. +{\catcode`\`=\active + \gdef\indexlquoteignore{\let`=\empty}} + \let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? @@ -3490,11 +4686,7 @@ % \edef\writeto{\csname#1indfile\endcsname}% % - \ifvmode - \dosubindsanitize - \else - \dosubindwrite - \fi + \safewhatsit\dosubindwrite }% \fi } @@ -3531,13 +4723,13 @@ \temp } -% Take care of unwanted page breaks: +% Take care of unwanted page breaks/skips around a whatsit: % % If a skip is the last thing on the list now, preserve it % by backing up by \lastskip, doing the \write, then inserting % the skip again. Otherwise, the whatsit generated by the -% \write will make \lastskip zero. The result is that sequences -% like this: +% \write or \pdfdest will make \lastskip zero. The result is that +% sequences like this: % @end defun % @tindex whatever % @defun ... @@ -3561,25 +4753,30 @@ % \edef\zeroskipmacro{\expandafter\the\csname z at skip\endcsname} % +\newskip\whatsitskip +\newcount\whatsitpenalty +% % ..., ready, GO: % -\def\dosubindsanitize{% +\def\safewhatsit#1{\ifhmode + #1% + \else % \lastskip and \lastpenalty cannot both be nonzero simultaneously. - \skip0 = \lastskip + \whatsitskip = \lastskip \edef\lastskipmacro{\the\lastskip}% - \count255 = \lastpenalty + \whatsitpenalty = \lastpenalty % % If \lastskip is nonzero, that means the last item was a % skip. And since a skip is discardable, that means this - % -\skip0 glue we're inserting is preceded by a + % -\whatsitskip glue we're inserting is preceded by a % non-discardable item, therefore it is not a potential % breakpoint, therefore no \nobreak needed. \ifx\lastskipmacro\zeroskipmacro \else - \vskip-\skip0 + \vskip-\whatsitskip \fi % - \dosubindwrite + #1% % \ifx\lastskipmacro\zeroskipmacro % If \lastskip was zero, perhaps the last item was a penalty, and @@ -3587,20 +4784,19 @@ % to re-insert the same penalty (values >10000 are used for various % signals); since we just inserted a non-discardable item, any % following glue (such as a \parskip) would be a breakpoint. For example: - % % @deffn deffn-whatever % @vindex index-whatever % Description. % would allow a break between the index-whatever whatsit % and the "Description." paragraph. - \ifnum\count255>9999 \penalty\count255 \fi + \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi \else % On the other hand, if we had a nonzero \lastskip, % this make-up glue would be preceded by a non-discardable item % (the whatsit from the \write), so we must insert a \nobreak. - \nobreak\vskip\skip0 + \nobreak\vskip\whatsitskip \fi -} +\fi} % The index entry written in the file actually looks like % \entry {sortstring}{page}{topic} @@ -3642,6 +4838,7 @@ % \smallfonts \rm \tolerance = 9500 + \plainfrenchspacing \everypar = {}% don't want the \kern\-parindent from indentation suppression. % % See if the index file exists and is nonempty. @@ -3715,10 +4912,9 @@ % % A straightforward implementation would start like this: % \def\entry#1#2{... -% But this frozes the catcodes in the argument, and can cause problems to +% But this freezes the catcodes in the argument, and can cause problems to % @code, which sets - active. This problem was fixed by a kludge--- % ``-'' was active throughout whole index, but this isn't really right. -% % The right solution is to prevent \entry from swallowing the whole text. % --kasal, 21nov03 \def\entry{% @@ -3755,10 +4951,17 @@ % columns. \vskip 0pt plus1pt % + % When reading the text of entry, convert explicit line breaks + % from @* into spaces. The user might give these in long section + % titles, for instance. + \def\*{\unskip\space\ignorespaces}% + \def\entrybreak{\hfil\break}% + % % Swallow the left brace of the text (first parameter): \afterassignment\doentry \let\temp = } +\def\entrybreak{\unskip\space\ignorespaces}% \def\doentry{% \bgroup % Instead of the swallowed brace. \noindent @@ -3771,11 +4974,8 @@ % The following is kludged to not output a line of dots in the index if % there are no page numbers. The next person who breaks this will be % cursed by a Unix daemon. - \def\tempa{{\rm }}% - \def\tempb{#1}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd + \setbox\boxA = \hbox{#1}% + \ifdim\wd\boxA = 0pt \ % \else % @@ -3799,9 +4999,9 @@ \endgroup } -% Like \dotfill except takes at least 1 em. +% Like plain.tex's \dotfill, except uses up at least 1 em. \def\indexdotfill{\cleaders - \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} + \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} \def\primary #1{\line{#1\hfil}} @@ -3911,6 +5111,34 @@ % % All done with double columns. \def\enddoublecolumns{% + % The following penalty ensures that the page builder is exercised + % _before_ we change the output routine. This is necessary in the + % following situation: + % + % The last section of the index consists only of a single entry. + % Before this section, \pagetotal is less than \pagegoal, so no + % break occurs before the last section starts. However, the last + % section, consisting of \initial and the single \entry, does not + % fit on the page and has to be broken off. Without the following + % penalty the page builder will not be exercised until \eject + % below, and by that time we'll already have changed the output + % routine to the \balancecolumns version, so the next-to-last + % double-column page will be processed with \balancecolumns, which + % is wrong: The two columns will go to the main vertical list, with + % the broken-off section in the recent contributions. As soon as + % the output routine finishes, TeX starts reconsidering the page + % break. The two columns and the broken-off section both fit on the + % page, because the two columns now take up only half of the page + % goal. When TeX sees \eject from below which follows the final + % section, it invokes the new output routine that we've set after + % \balancecolumns below; \onepageout will try to fit the two columns + % and the final section into the vbox of \pageheight (see + % \pagebody), causing an overfull box. + % + % Note that glue won't work here, because glue does not exercise the + % page builder, unlike penalties (see The TeXbook, pp. 280-281). + \penalty0 + % \output = {% % Split the last of the double-column material. Leave it on the % current page, no automatic page break. @@ -3966,7 +5194,22 @@ \message{sectioning,} % Chapters, sections, etc. -% \unnumberedno is an oxymoron, of course. But we count the unnumbered +% Let's start with @part. +\outer\parseargdef\part{\partzzz{#1}} +\def\partzzz#1{% + \chapoddpage + \null + \vskip.3\vsize % move it down on the page a bit + \begingroup + \noindent \titlefonts\rmisbold #1\par % the text + \let\lastnode=\empty % no node to associate with + \writetocentry{part}{#1}{}% but put it in the toc + \headingsoff % no headline or footline on the part page + \chapoddpage + \endgroup +} + +% \unnumberedno is an oxymoron. But we count the unnumbered % sections so that we can refer to them unambiguously in the pdf % outlines by their "section number". We avoid collisions with chapter % numbers by starting them at 10000. (If a document ever has 10000 @@ -4020,11 +5263,15 @@ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} -% Each @chapter defines this as the name of the chapter. -% page headings and footings can use it. @section does likewise. -% However, they are not reliable, because we don't use marks. +% Each @chapter defines these (using marks) as the number+name, number +% and name of the chapter. Page headings and footings can use +% these. @section does likewise. \def\thischapter{} +\def\thischapternum{} +\def\thischaptername{} \def\thissection{} +\def\thissectionnum{} +\def\thissectionname{} \newcount\absseclevel % used to calculate proper heading level \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count @@ -4041,8 +5288,8 @@ \chardef\maxseclevel = 3 % % A numbered section within an unnumbered changes to unnumbered too. -% To achive this, remember the "biggest" unnum. sec. we are currently in: -\chardef\unmlevel = \maxseclevel +% To achieve this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unnlevel = \maxseclevel % % Trace whether the current chapter is an appendix or not: % \chapheadtype is "N" or "A", unnumbered chapters are ignored. @@ -4067,8 +5314,8 @@ % The heading type: \def\headtype{#1}% \if \headtype U% - \ifnum \absseclevel < \unmlevel - \chardef\unmlevel = \absseclevel + \ifnum \absseclevel < \unnlevel + \chardef\unnlevel = \absseclevel \fi \else % Check for appendix sections: @@ -4080,10 +5327,10 @@ \fi\fi \fi % Check for numbered within unnumbered: - \ifnum \absseclevel > \unmlevel + \ifnum \absseclevel > \unnlevel \def\headtype{U}% \else - \chardef\unmlevel = 3 + \chardef\unnlevel = 3 \fi \fi % Now print the heading: @@ -4137,7 +5384,9 @@ \gdef\chaplevelprefix{\the\chapno.}% \resetallfloatnos % - \message{\putwordChapter\space \the\chapno}% + % \putwordChapter can contain complex things in translations. + \toks0=\expandafter{\putwordChapter}% + \message{\the\toks0 \space \the\chapno}% % % Write the actual heading. \chapmacro{#1}{Ynumbered}{\the\chapno}% @@ -4148,15 +5397,17 @@ \global\let\subsubsection = \numberedsubsubsec } -\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz +\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz +% \def\appendixzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\appendixno by 1 \gdef\chaplevelprefix{\appendixletter.}% \resetallfloatnos % - \def\appendixnum{\putwordAppendix\space \appendixletter}% - \message{\appendixnum}% + % \putwordAppendix can contain complex things in translations. + \toks0=\expandafter{\putwordAppendix}% + \message{\the\toks0 \space \appendixletter}% % \chapmacro{#1}{Yappendix}{\appendixletter}% % @@ -4165,7 +5416,8 @@ \global\let\subsubsection = \appendixsubsubsec } -\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz +% normally unnmhead0 calls unnumberedzzz: +\outer\parseargdef\unnumbered{\unnmhead0{#1}} \def\unnumberedzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\unnumberedno by 1 @@ -4209,40 +5461,47 @@ \let\top\unnumbered % Sections. +% \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz \def\seczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% } -\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz +% normally calls appendixsectionzzz: +\outer\parseargdef\appendixsection{\apphead1{#1}} \def\appendixsectionzzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% } \let\appendixsec\appendixsection -\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz +% normally calls unnumberedseczzz: +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} \def\unnumberedseczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% } % Subsections. -\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz +% +% normally calls numberedsubseczzz: +\outer\parseargdef\numberedsubsec{\numhead2{#1}} \def\numberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% } -\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz +% normally calls appendixsubseczzz: +\outer\parseargdef\appendixsubsec{\apphead2{#1}} \def\appendixsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno}% } -\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz +% normally calls unnumberedsubseczzz: +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} \def\unnumberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynothing}% @@ -4250,21 +5509,25 @@ } % Subsubsections. -\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz +% +% normally numberedsubsubseczzz: +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} \def\numberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynumbered}% {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% } -\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz +% normally appendixsubsubseczzz: +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} \def\appendixsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% } -\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz +% normally unnumberedsubsubseczzz: +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} \def\unnumberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynothing}% @@ -4288,7 +5551,6 @@ % 3) Likewise, headings look best if no \parindent is used, and % if justification is not attempted. Hence \raggedright. - \def\majorheading{% {\advance\chapheadingskip by 10pt \chapbreak }% \parsearg\chapheadingzzz @@ -4297,8 +5559,8 @@ \def\chapheading{\chapbreak \parsearg\chapheadingzzz} \def\chapheadingzzz#1{% {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}% + \parindent=0pt\ptexraggedright + \rmisbold #1\hfill}}% \bigskip \par\penalty 200\relax \suppressfirstparagraphindent } @@ -4315,17 +5577,28 @@ % (including whitespace, linebreaking, etc. around it), % given all the information in convenient, parsed form. -%%% Args are the skip and penalty (usually negative) +% Args are the skip and penalty (usually negative) \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} -%%% Define plain chapter starts, and page on/off switching for it % Parameter controlling skip before chapter headings (if needed) - \newskip\chapheadingskip +% Define plain chapter starts, and page on/off switching for it. \def\chapbreak{\dobreak \chapheadingskip {-4000}} \def\chappager{\par\vfill\supereject} -\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} +% Because \domark is called before \chapoddpage, the filler page will +% get the headings for the next chapter, which is wrong. But we don't +% care -- we just disable all headings on the filler page. +\def\chapoddpage{% + \chappager + \ifodd\pageno \else + \begingroup + \headingsoff + \null + \chappager + \endgroup + \fi +} \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} @@ -4359,41 +5632,78 @@ \def\Yappendixkeyword{Yappendix} % \def\chapmacro#1#2#3{% + % Insert the first mark before the heading break (see notes for \domark). + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% + \gdef\thissection{}}% + % + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{\thischaptername}}% + \else\ifx\temptype\Yomitfromtockeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{}}% + \else\ifx\temptype\Yappendixkeyword + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\appendixletter}% + % \noexpand\putwordAppendix avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thischapter{\noexpand\putwordAppendix{} + \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \else + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\the\chapno}% + % \noexpand\putwordChapter avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thischapter{\noexpand\putwordChapter{} + \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \fi\fi\fi + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark + % + % Insert the chapter heading break. \pchapsepmacro + % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \domark + % {% - \chapfonts \rm + \chapfonts \rmisbold % - % Have to define \thissection before calling \donoderef, because the + % Have to define \lastsection before calling \donoderef, because the % xref code eventually uses it. On the other hand, it has to be called % after \pchapsepmacro, or the headline will change too soon. - \gdef\thissection{#1}% - \gdef\thischaptername{#1}% + \gdef\lastsection{#1}% % % Only insert the separating space if we have a chapter/appendix % number, and don't print the unnumbered ``number''. - \def\temptype{#2}% \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unnchap}% - \gdef\thischapter{#1}% \else\ifx\temptype\Yomitfromtockeyword \setbox0 = \hbox{}% contents like unnumbered, but no toc entry \def\toctype{omit}% - \gdef\thischapter{}% \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% \def\toctype{app}% - % We don't substitute the actual chapter name into \thischapter - % because we don't want its macros evaluated now. And we don't - % use \thissection because that changes with each section. - % - \xdef\thischapter{\putwordAppendix{} \appendixletter: - \noexpand\thischaptername}% \else \setbox0 = \hbox{#3\enspace}% \def\toctype{numchap}% - \xdef\thischapter{\putwordChapter{} \the\chapno: - \noexpand\thischaptername}% \fi\fi\fi % % Write the toc entry for this chapter. Must come before the @@ -4409,7 +5719,8 @@ \donoderef{#2}% % % Typeset the actual heading. - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \nobreak % Avoid page breaks at the interline glue. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright \hangindent=\wd0 \centerparametersmaybe \unhbox0 #1\par}% }% @@ -4433,8 +5744,8 @@ % \def\unnchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\nobreak + \parindent=0pt\ptexraggedright + \rmisbold #1\hfill}}\bigskip \par\nobreak } \def\chfopen #1#2{\chapoddpage {\chapfonts \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% @@ -4443,7 +5754,7 @@ \def\centerchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt - \hfill {\rm #1}\hfill}}\bigskip \par\nobreak + \hfill {\rmisbold #1}\hfill}}\bigskip \par\nobreak } \def\CHAPFopen{% \global\let\chapmacro=\chfopen @@ -4471,47 +5782,110 @@ % the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the % section number. % +\def\seckeyword{sec} +% \def\sectionheading#1#2#3#4{% {% + \checkenv{}% should not be in an environment. + % % Switch to the right set of fonts. - \csname #2fonts\endcsname \rm + \csname #2fonts\endcsname \rmisbold + % + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + % Insert first mark before the heading break (see notes for \domark). + \let\prevsectiondefs=\lastsectiondefs + \ifx\temptype\Ynothingkeyword + \ifx\sectionlevel\seckeyword + \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% + \gdef\thissection{\thissectionname}}% + \fi + \else\ifx\temptype\Yomitfromtockeyword + % Don't redefine \thissection. + \else\ifx\temptype\Yappendixkeyword + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + % \noexpand\putwordSection avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thissection{\noexpand\putwordSection{} + \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \else + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + % \noexpand\putwordSection avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thissection{\noexpand\putwordSection{} + \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \fi\fi\fi + % + % Go into vertical mode. Usually we'll already be there, but we + % don't want the following whatsit to end up in a preceding paragraph + % if the document didn't happen to have a blank line. + \par + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark % % Insert space above the heading. \csname #2headingbreak\endcsname % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevsectiondefs=\lastsectiondefs + \domark + % % Only insert the space after the number if we have a section number. - \def\sectionlevel{#2}% - \def\temptype{#3}% - % \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unn}% - \gdef\thissection{#1}% + \gdef\lastsection{#1}% \else\ifx\temptype\Yomitfromtockeyword % for @headings -- no section number, don't include in toc, - % and don't redefine \thissection. + % and don't redefine \lastsection. \setbox0 = \hbox{}% \def\toctype{omit}% \let\sectionlevel=\empty \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{#4\enspace}% \def\toctype{app}% - \gdef\thissection{#1}% + \gdef\lastsection{#1}% \else \setbox0 = \hbox{#4\enspace}% \def\toctype{num}% - \gdef\thissection{#1}% + \gdef\lastsection{#1}% \fi\fi\fi % - % Write the toc entry (before \donoderef). See comments in \chfplain. + % Write the toc entry (before \donoderef). See comments in \chapmacro. \writetocentry{\toctype\sectionlevel}{#1}{#4}% % % Write the node reference (= pdf destination for pdftex). - % Again, see comments in \chfplain. + % Again, see comments in \chapmacro. \donoderef{#3}% % + % Interline glue will be inserted when the vbox is completed. + % That glue will be a valid breakpoint for the page, since it'll be + % preceded by a whatsit (usually from the \donoderef, or from the + % \writetocentry if there was no node). We don't want to allow that + % break, since then the whatsits could end up on page n while the + % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. + \nobreak + % % Output the actual section heading. - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright \hangindent=\wd0 % zero if no section number \unhbox0 #1}% }% @@ -4525,15 +5899,15 @@ % % We'll almost certainly start a paragraph next, so don't let that % glue accumulate. (Not a breakpoint because it's preceded by a - % discardable item.) + % discardable item.) However, when a paragraph is not started next + % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out + % or the negative glue will cause weirdly wrong output, typically + % obscuring the section heading with something else. \vskip-\parskip - % - % This is purely so the last item on the list is a known \penalty > - % 10000. This is so \startdefun can avoid allowing breakpoints after - % section headings. Otherwise, it would insert a valid breakpoint between: - % - % @section sec-whatever - % @deffn def-whatever + % + % This is so the last item on the main vertical list is a known + % \penalty > 10000, so \startdefun, etc., can recognize the situation + % and do the needful. \penalty 10001 } @@ -4572,7 +5946,7 @@ \edef\temp{% \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% \temp - } + }% \fi \fi % @@ -4589,7 +5963,7 @@ % These characters do not print properly in the Computer Modern roman % fonts, so we must take special care. This is more or less redundant % with the Texinfo input format setup at the end of this file. -% +% \def\activecatcodes{% \catcode`\"=\active \catcode`\$=\active @@ -4607,7 +5981,7 @@ \def\readtocfile{% \setupdatafile \activecatcodes - \input \jobname.toc + \input \tocreadfilename } \newskip\contentsrightmargin \contentsrightmargin=1in @@ -4626,7 +6000,6 @@ % % Don't need to put `Contents' or `Short Contents' in the headline. % It is abundantly clear what they are. - \def\thischapter{}% \chapmacro{#1}{Yomitfromtoc}{}% % \savepageno = \pageno @@ -4638,11 +6011,16 @@ \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi } +% redefined for the two-volume lispref. We always output on +% \jobname.toc even if this is redefined. +% +\def\tocreadfilename{\jobname.toc} % Normal (long) toc. +% \def\contents{% \startcontents{\putwordTOC}% - \openin 1 \jobname.toc + \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi @@ -4661,6 +6039,7 @@ \def\summarycontents{% \startcontents{\putwordShortTOC}% % + \let\partentry = \shortpartentry \let\numchapentry = \shortchapentry \let\appentry = \shortchapentry \let\unnchapentry = \shortunnchapentry @@ -4680,7 +6059,7 @@ \let\numsubsubsecentry = \numsecentry \let\appsubsubsecentry = \numsecentry \let\unnsubsubsecentry = \numsecentry - \openin 1 \jobname.toc + \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi @@ -4716,6 +6095,19 @@ % The last argument is the page number. % The arguments in between are the chapter number, section number, ... +% Parts, in the main contents. Replace the part number, which doesn't +% exist, with an empty box. Let's hope all the numbers have the same width. +% Also ignore the page number, which is conventionally not printed. +\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} +\def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}} +% +% Parts, in the short toc. +\def\shortpartentry#1#2#3#4{% + \penalty-300 + \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip + \shortchapentry{{\bf #1}}{\numeralbox}{}{}% +} + % Chapters, in the main contents. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} % @@ -4805,45 +6197,12 @@ \message{environments,} % @foo ... @end foo. -% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. -% -% Since these characters are used in examples, it should be an even number of -% \tt widths. Each \tt character is 1en, so two makes it 1em. -% -\def\point{$\star$} -\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} -\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} -\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} -\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} - -% The @error{} command. -% Adapted from the TeXbook's \boxit. -% -\newbox\errorbox -% -{\tentt \global\dimen0 = 3em}% Width of the box. -\dimen2 = .55pt % Thickness of rules -% The text. (`r' is open on the right, `e' somewhat less so on the left.) -\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} -% -\setbox\errorbox=\hbox to \dimen0{\hfil - \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. - \advance\hsize by -2\dimen2 % Rules. - \vbox{% - \hrule height\dimen2 - \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. - \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. - \kern3pt\vrule width\dimen2}% Space to right. - \hrule height\dimen2} - \hfil} -% -\def\error{\leavevmode\lower.7ex\copy\errorbox} - -% @tex ... @end tex escapes into raw Tex temporarily. +% @tex ... @end tex escapes into raw TeX temporarily. % One exception: @ is still an escape character, so that @end tex works. -% But \@ or @@ will get a plain tex @ character. +% But \@ or @@ will get a plain @ character. \envdef\tex{% + \setupmarkupstyle{tex}% \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie @@ -4853,8 +6212,14 @@ \catcode `\|=\other \catcode `\<=\other \catcode `\>=\other + \catcode`\`=\other + \catcode`\'=\other \escapechar=`\\ % + % ' is active in math mode (mathcode"8000). So reset it, and all our + % other math active characters (just in case), to plain's definitions. + \mathactive + % \let\b=\ptexb \let\bullet=\ptexbullet \let\c=\ptexc @@ -4872,6 +6237,7 @@ \let\/=\ptexslash \let\*=\ptexstar \let\t=\ptext + \expandafter \let\csname top\endcsname=\ptextop % outer \let\frenchspacing=\plainfrenchspacing % \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% @@ -4957,6 +6323,12 @@ \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip % Flag to tell @lisp, etc., not to narrow margin. \let\nonarrowing = t% + % + % If this cartouche directly follows a sectioning command, we need the + % \parskip glue (backspaced over by default) or the cartouche can + % collide with the section heading. + \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi + % \vbox\bgroup \baselineskip=0pt\parskip=0pt\lineskip=0pt \carttop @@ -4970,7 +6342,7 @@ \lineskip=\normlskip \parskip=\normpskip \vskip -\parskip - \comment % For explanation, see the end of \def\group. + \comment % For explanation, see the end of def\group. } \def\Ecartouche{% \ifhmode\par\fi @@ -4987,6 +6359,7 @@ % This macro is called at the beginning of all the @example variants, % inside a group. +\newdimen\nonfillparindent \def\nonfillstart{% \aboveenvbreak \hfuzz = 12pt % Don't be fussy @@ -4994,7 +6367,12 @@ \let\par = \lisppar % don't ignore blank lines \obeylines % each line of input is a line of output \parskip = 0pt + % Turn off paragraph indentation but redefine \indent to emulate + % the normal \indent. + \nonfillparindent=\parindent \parindent = 0pt + \let\indent\nonfillindent + % \emergencystretch = 0pt % don't try to avoid overfull boxes \ifx\nonarrowing\relax \advance \leftskip by \lispnarrowing @@ -5005,6 +6383,24 @@ \let\exdent=\nofillexdent } +\begingroup +\obeyspaces +% We want to swallow spaces (but not other tokens) after the fake +% @indent in our nonfill-environments, where spaces are normally +% active and set to @tie, resulting in them not being ignored after +% @indent. +\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}% +\gdef\nonfillindentcheck{% +\ifx\temp % +\expandafter\nonfillindentgobble% +\else% +\leavevmode\nonfillindentbox% +\fi% +}% +\endgroup +\def\nonfillindentgobble#1{\nonfillindent} +\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}} + % If you want all examples etc. small: @set dispenvsize small. % If you want even small examples the full size: @set dispenvsize nosmall. % This affects the following displayed environments: @@ -5015,53 +6411,59 @@ \let\SETdispenvsize\relax \def\setnormaldispenv{% \ifx\SETdispenvsize\smallword + % end paragraph for sake of leading, in case document has no blank + % line. This is redundant with what happens in \aboveenvbreak, but + % we need to do it before changing the fonts, and it's inconvenient + % to change the fonts afterward. + \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } \def\setsmalldispenv{% \ifx\SETdispenvsize\nosmallword \else + \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } % We often define two environments, @foo and @smallfoo. -% Let's do it by one command: -\def\makedispenv #1#2{ - \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} - \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} +% Let's do it in one command. #1 is the env name, #2 the definition. +\def\makedispenvdef#1#2{% + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}% + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}% \expandafter\let\csname E#1\endcsname \afterenvbreak \expandafter\let\csname Esmall#1\endcsname \afterenvbreak } -% Define two synonyms: -\def\maketwodispenvs #1#2#3{ - \makedispenv{#1}{#3} - \makedispenv{#2}{#3} -} - -% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. +% Define two environment synonyms (#1 and #2) for an environment. +\def\maketwodispenvdef#1#2#3{% + \makedispenvdef{#1}{#3}% + \makedispenvdef{#2}{#3}% +} +% +% @lisp: indented, narrowed, typewriter font; +% @example: same as @lisp. % % @smallexample and @smalllisp: use smaller fonts. % Originally contributed by Pavel at xerox. % -\maketwodispenvs {lisp}{example}{% +\maketwodispenvdef{lisp}{example}{% \nonfillstart - \tt + \tt\setupmarkupstyle{example}% \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. - \gobble % eat return -} - + \gobble % eat return +} % @display/@smalldisplay: same as @lisp except keep current font. % -\makedispenv {display}{% +\makedispenvdef{display}{% \nonfillstart \gobble } % @format/@smallformat: same as @display except don't narrow margins. % -\makedispenv{format}{% +\makedispenvdef{format}{% \let\nonarrowing = t% \nonfillstart \gobble @@ -5080,18 +6482,44 @@ \envdef\flushright{% \let\nonarrowing = t% \nonfillstart - \advance\leftskip by 0pt plus 1fill + \advance\leftskip by 0pt plus 1fill\relax \gobble } \let\Eflushright = \afterenvbreak +% @raggedright does more-or-less normal line breaking but no right +% justification. From plain.tex. +\envdef\raggedright{% + \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax +} +\let\Eraggedright\par + +\envdef\raggedleft{% + \parindent=0pt \leftskip0pt plus2em + \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt + \hbadness=10000 % Last line will usually be underfull, so turn off + % badness reporting. +} +\let\Eraggedleft\par + +\envdef\raggedcenter{% + \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em + \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt + \hbadness=10000 % Last line will usually be underfull, so turn off + % badness reporting. +} +\let\Eraggedcenter\par + + % @quotation does normal linebreaking (hence we can't use \nonfillstart) % and narrows the margins. We keep \parskip nonzero in general, since % we're doing normal filling. So, when using \aboveenvbreak and % \afterenvbreak, temporarily make \parskip 0. % -\envdef\quotation{% +\makedispenvdef{quotation}{\quotationstart} +% +\def\quotationstart{% {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip \parindent=0pt % @@ -5111,12 +6539,13 @@ % \def\Equotation{% \par - \ifx\quotationauthor\undefined\else + \ifx\quotationauthor\thisisundefined\else % indent a bit. \leftline{\kern 2\leftskip \sl ---\quotationauthor}% \fi {\parskip=0pt \afterenvbreak}% } +\def\Esmallquotation{\Equotation} % If we're given an argument, typeset it in bold with a colon after. \def\quotationlabel#1{% @@ -5141,18 +6570,16 @@ \do\ \do\\\do\{\do\}\do\$\do\&% \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% \do\<\do\>\do\|\do\@\do+\do\"% + % Don't do the quotes -- if we do, @set txicodequoteundirected and + % @set txicodequotebacktick will not have effect on @verb and + % @verbatim, and ?` and !` ligatures won't get disabled. + %\do\`\do\'% } % % [Knuth] p. 380 \def\uncatcodespecials{% \def\do##1{\catcode`##1=\other}\dospecials} % -% [Knuth] pp. 380,381,391 -% Disable Spanish ligatures ?` and !` of \tt font -\begingroup - \catcode`\`=\active\gdef`{\relax\lq} -\endgroup -% % Setup for the @verb command. % % Eight spaces for a tab @@ -5164,7 +6591,7 @@ \def\setupverb{% \tt % easiest (and conventionally used) font for verbatim \def\par{\leavevmode\endgraf}% - \catcode`\`=\active + \setupmarkupstyle{verb}% \tabeightspaces % Respect line breaks, % print special symbols as themselves, and @@ -5175,35 +6602,46 @@ % Setup for the @verbatim environment % -% Real tab expansion +% Real tab expansion. \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount % -\def\starttabbox{\setbox0=\hbox\bgroup} +% We typeset each line of the verbatim in an \hbox, so we can handle +% tabs. The \global is in case the verbatim line starts with an accent, +% or some other command that starts with a begin-group. Otherwise, the +% entire \verbbox would disappear at the corresponding end-group, before +% it is typeset. Meanwhile, we can't have nested verbatim commands +% (can we?), so the \global won't be overwriting itself. +\newbox\verbbox +\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup} +% \begingroup \catcode`\^^I=\active \gdef\tabexpand{% \catcode`\^^I=\active \def^^I{\leavevmode\egroup - \dimen0=\wd0 % the width so far, or since the previous tab - \divide\dimen0 by\tabw - \multiply\dimen0 by\tabw % compute previous multiple of \tabw - \advance\dimen0 by\tabw % advance to next multiple of \tabw - \wd0=\dimen0 \box0 \starttabbox + \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab + \divide\dimen\verbbox by\tabw + \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw + \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw + \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox }% } \endgroup + +% start the verbatim environment. \def\setupverbatim{% \let\nonarrowing = t% \nonfillstart - % Easiest (and conventionally used) font for verbatim - \tt - \def\par{\leavevmode\egroup\box0\endgraf}% - \catcode`\`=\active + \tt % easiest (and conventionally used) font for verbatim + % The \leavevmode here is for blank lines. Otherwise, we would + % never \starttabox and the \egroup would end verbatim mode. + \def\par{\leavevmode\egroup\box\verbbox\endgraf}% \tabexpand + \setupmarkupstyle{verbatim}% % Respect line breaks, % print special symbols as themselves, and - % make each space count - % must do in this order: + % make each space count. + % Must do in this order: \obeylines \uncatcodespecials \sepspaces \everypar{\starttabbox}% } @@ -5259,6 +6697,8 @@ {% \makevalueexpandable \setupverbatim + \indexnofonts % Allow `@@' and other weird things in file names. + \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% \input #1 \afterenvbreak }% @@ -5284,27 +6724,35 @@ \endgroup } + \message{defuns,} % @defun etc. \newskip\defbodyindent \defbodyindent=.4in \newskip\defargsindent \defargsindent=50pt \newskip\deflastargmargin \deflastargmargin=18pt +\newcount\defunpenalty % Start the processing of @deffn: \def\startdefun{% \ifnum\lastpenalty<10000 \medbreak + \defunpenalty=10003 % Will keep this @deffn together with the + % following @def command, see below. \else % If there are two @def commands in a row, we'll have a \nobreak, % which is there to keep the function description together with its % header. But if there's nothing but headers, we need to allow a % break somewhere. Check specifically for penalty 10002, inserted - % by \defargscommonending, instead of 10000, since the sectioning + % by \printdefunline, instead of 10000, since the sectioning % commands also insert a nobreak penalty, and we don't want to allow % a break between a section heading and a defun. - % - \ifnum\lastpenalty=10002 \penalty2000 \fi + % + % As a further refinement, we avoid "club" headers by signalling + % with penalty of 10003 after the very first @deffn in the + % sequence (see above), and penalty of 10002 after any following + % @def command. + \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi % % Similarly, after a section heading, do not allow a break. % But do insert the glue. @@ -5322,7 +6770,7 @@ % % As above, allow line break if we have multiple x headers in a row. % It's not a great place, though. - \ifnum\lastpenalty=10002 \penalty3000 \fi + \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi % % And now, it's time to reuse the body of the original defun: \expandafter\gobbledefun#1% @@ -5337,10 +6785,10 @@ #1#2 \endheader % common ending: \interlinepenalty = 10000 - \advance\rightskip by 0pt plus 1fil + \advance\rightskip by 0pt plus 1fil\relax \endgraf \nobreak\vskip -\parskip - \penalty 10002 % signal to \startdefun and \dodefunx + \penalty\defunpenalty % signal to \startdefun and \dodefunx % Some of the @defun-type tags do not enable magic parentheses, % rendering the following check redundant. But we don't optimize. \checkparencounts @@ -5350,7 +6798,7 @@ \def\Edefun{\endgraf\medbreak} % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; -% the only thing remainnig is to define \deffnheader. +% the only thing remaining is to define \deffnheader. % \def\makedefun#1{% \expandafter\let\csname E#1\endcsname = \Edefun @@ -5367,13 +6815,36 @@ \def\domakedefun#1#2#3{% \envdef#1{% \startdefun + \doingtypefnfalse % distinguish typed functions from all else \parseargusing\activeparens{\printdefunline#3}% }% \def#2{\dodefunx#1}% \def#3% } -%%% Untyped functions: +\newif\ifdoingtypefn % doing typed function? +\newif\ifrettypeownline % typeset return type on its own line? + +% @deftypefnnewline on|off says whether the return type of typed functions +% are printed on their own line. This affects @deftypefn, @deftypefun, +% @deftypeop, and @deftypemethod. +% +\parseargdef\deftypefnnewline{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxideftypefnnl\endcsname + = \empty + \else\ifx\temp\offword + \expandafter\let\csname SETtxideftypefnnl\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @txideftypefnnl value `\temp', + must be on|off}% + \fi\fi +} + +% Untyped functions: % @deffn category name args \makedefun{deffn}{\deffngeneral{}} @@ -5392,7 +6863,7 @@ \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% } -%%% Typed functions: +% Typed functions: % @deftypefn category type name args \makedefun{deftypefn}{\deftypefngeneral{}} @@ -5407,10 +6878,11 @@ % \def\deftypefngeneral#1#2 #3 #4 #5\endheader{% \dosubind{fn}{\code{#4}}{#1}% + \doingtypefntrue \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } -%%% Typed variables: +% Typed variables: % @deftypevr category type var args \makedefun{deftypevr}{\deftypecvgeneral{}} @@ -5428,7 +6900,7 @@ \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } -%%% Untyped variables: +% Untyped variables: % @defvr category var args \makedefun{defvr}#1 {\deftypevrheader{#1} {} } @@ -5439,7 +6911,8 @@ % \defcvof {category of}class var args \def\defcvof#1#2 {\deftypecvof{#1}#2 {} } -%%% Type: +% Types: + % @deftp category name args \makedefun{deftp}#1 #2 #3\endheader{% \doind{tp}{\code{#2}}% @@ -5467,25 +6940,49 @@ % We are followed by (but not passed) the arguments, if any. % \def\defname#1#2#3{% + \par % Get the values of \leftskip and \rightskip as they were outside the @def... \advance\leftskip by -\defbodyindent % - % How we'll format the type name. Putting it in brackets helps + % Determine if we are typesetting the return type of a typed function + % on a line by itself. + \rettypeownlinefalse + \ifdoingtypefn % doing a typed function specifically? + % then check user option for putting return type on its own line: + \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else + \rettypeownlinetrue + \fi + \fi + % + % How we'll format the category name. Putting it in brackets helps % distinguish it from the body text that may end up on the next line % just below it. \def\temp{#1}% \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} % - % Figure out line sizes for the paragraph shape. + % Figure out line sizes for the paragraph shape. We'll always have at + % least two. + \tempnum = 2 + % % The first line needs space for \box0; but if \rightskip is nonzero, % we need only space for the part of \box0 which exceeds it: \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % + % If doing a return type on its own line, we'll have another line. + \ifrettypeownline + \advance\tempnum by 1 + \def\maybeshapeline{0in \hsize}% + \else + \def\maybeshapeline{}% + \fi + % % The continuations: \dimen2=\hsize \advance\dimen2 by -\defargsindent - % (plain.tex says that \dimen1 should be used only as global.) - \parshape 2 0in \dimen0 \defargsindent \dimen2 - % - % Put the type name to the right margin. + % + % The final paragraph shape: + \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 + % + % Put the category name at the right margin. \noindent \hbox to 0pt{% \hfil\box0 \kern-\hsize @@ -5507,8 +7004,16 @@ % . this still does not fix the ?` and !` ligatures, but so far no % one has made identifiers using them :). \df \tt - \def\temp{#2}% return value type - \ifx\temp\empty\else \tclose{\temp} \fi + \def\temp{#2}% text of the return type + \ifx\temp\empty\else + \tclose{\temp}% typeset the return type + \ifrettypeownline + % put return type on its own line; prohibit line break following: + \hfil\vadjust{\nobreak}\break + \else + \space % type on same line, so just followed by a space + \fi + \fi % no return type #3% output function name }% {\rm\enskip}% hskip 0.5 em of \tenrm @@ -5529,7 +7034,7 @@ % % On the other hand, if an argument has two dashes (for instance), we % want a way to get ttsl. Let's try @var for that. - \let\var=\ttslanted + \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}% #1% \sl\hyphenchar\font=45 } @@ -5609,12 +7114,14 @@ \ifnum\parencount=0 \else \badparencount \fi \ifnum\brackcount=0 \else \badbrackcount \fi } +% these should not use \errmessage; the glibc manual, at least, actually +% has such constructs (when documenting function pointers). \def\badparencount{% - \errmessage{Unbalanced parentheses in @def}% + \message{Warning: unbalanced parentheses in @def...}% \global\parencount=0 } \def\badbrackcount{% - \errmessage{Unbalanced square braces in @def}% + \message{Warning: unbalanced square brackets in @def...}% \global\brackcount=0 } @@ -5624,7 +7131,7 @@ % To do this right we need a feature of e-TeX, \scantokens, % which we arrange to emulate with a temporary file in ordinary TeX. -\ifx\eTeXversion\undefined +\ifx\eTeXversion\thisisundefined \newwrite\macscribble \def\scantokens#1{% \toks0={#1}% @@ -5635,26 +7142,30 @@ } \fi -\def\scanmacro#1{% - \begingroup - \newlinechar`\^^M - \let\xeatspaces\eatspaces - % Undo catcode changes of \startcontents and \doprintindex - % When called from @insertcopying or (short)caption, we need active - % backslash to get it printed correctly. Previously, we had - % \catcode`\\=\other instead. We'll see whether a problem appears - % with macro expansion. --kasal, 19aug04 - \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ - % ... and \example - \spaceisspace - % - % Append \endinput to make sure that TeX does not see the ending newline. - % - % I've verified that it is necessary both for e-TeX and for ordinary TeX - % --kasal, 29nov03 - \scantokens{#1\endinput}% - \endgroup -} +\def\scanmacro#1{\begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % + % ... and for \example: + \spaceisspace + % + % The \empty here causes a following catcode 5 newline to be eaten as + % part of reading whitespace after a control sequence. It does not + % eat a catcode 13 newline. There's no good way to handle the two + % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX + % would then have different behavior). See the Macro Details node in + % the manual for the workaround we recommend for macros and + % line-oriented commands. + % + \scantokens{#1\empty}% +\endgroup} \def\scanexp#1{% \edef\temp{\noexpand\scanmacro{#1}}% @@ -5682,7 +7193,7 @@ % This does \let #1 = #2, with \csnames; that is, % \let \csname#1\endcsname = \csname#2\endcsname % (except of course we have to play expansion games). -% +% \def\cslet#1#2{% \expandafter\let \csname#1\expandafter\endcsname @@ -5708,13 +7219,18 @@ % Macro bodies are absorbed as an argument in a context where % all characters are catcode 10, 11 or 12, except \ which is active -% (as in normal texinfo). It is necessary to change the definition of \. - +% (as in normal texinfo). It is necessary to change the definition of \ +% to recognize macro arguments; this is the job of \mbodybackslash. +% +% Non-ASCII encodings make 8-bit characters active, so un-activate +% them to avoid their expansion. Must do this non-globally, to +% confine the change to the current group. +% % It's necessary to have hard CRs when the macro is executed. This is -% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% done by making ^^M (\endlinechar) catcode 12 when reading the macro % body, and then making it the \newlinechar in \scanmacro. - -\def\scanctxt{% +% +\def\scanctxt{% used as subroutine \catcode`\"=\other \catcode`\+=\other \catcode`\<=\other @@ -5724,15 +7240,16 @@ \catcode`\_=\other \catcode`\|=\other \catcode`\~=\other -} - -\def\scanargctxt{% + \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi +} + +\def\scanargctxt{% used for copying and captions, not macros. \scanctxt \catcode`\\=\other \catcode`\^^M=\other } -\def\macrobodyctxt{% +\def\macrobodyctxt{% used for @macro definitions \scanctxt \catcode`\{=\other \catcode`\}=\other @@ -5740,32 +7257,56 @@ \usembodybackslash } -\def\macroargctxt{% +\def\macroargctxt{% used when scanning invocations \scanctxt - \catcode`\\=\other -} + \catcode`\\=0 +} +% why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes" +% for the single characters \ { }. Thus, we end up with the "commands" +% that would be written @\ @{ @} in a Texinfo document. +% +% We already have @{ and @}. For @\, we define it here, and only for +% this purpose, to produce a typewriter backslash (so, the @\ that we +% define for @math can't be used with @macro calls): +% +\def\\{\normalbackslash}% +% +% We would like to do this for \, too, since that is what makeinfo does. +% But it is not possible, because Texinfo already has a command @, for a +% cedilla accent. Documents must use @comma{} instead. +% +% \anythingelse will almost certainly be an error of some kind. + % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N % where N is the macro parameter number. % We define \csname macarg.\endcsname to be \realbackslash, so % \\ in macro replacement text gets you a backslash. - +% {\catcode`@=0 @catcode`@\=@active @gdef at usembodybackslash{@let\=@mbodybackslash} @gdef at mbodybackslash#1\{@csname macarg.#1 at endcsname} } \expandafter\def\csname macarg.\endcsname{\realbackslash} +\def\margbackslash#1{\char`\#1 } + \def\macro{\recursivefalse\parsearg\macroxxx} \def\rmacro{\recursivetrue\parsearg\macroxxx} \def\macroxxx#1{% - \getargs{#1}% now \macname is the macname and \argl the arglist + \getargs{#1}% now \macname is the macname and \argl the arglist \ifx\argl\empty % no arguments - \paramno=0% + \paramno=0\relax \else \expandafter\parsemargdef \argl;% + \if\paramno>256\relax + \ifx\eTeXversion\thisisundefined + \errhelp = \EMsimple + \errmessage{You need eTeX to compile a file with macros with more than 256 arguments} + \fi + \fi \fi \if1\csname ismacro.\the\macname\endcsname \message{Warning: redefining \the\macname}% @@ -5812,46 +7353,269 @@ % an opening brace, and that opening brace is not consumed. \def\getargs#1{\getargsxxx#1{}} \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} -\def\getmacname #1 #2\relax{\macname={#1}} +\def\getmacname#1 #2\relax{\macname={#1}} \def\getmacargs#1{\def\argl{#1}} +% For macro processing make @ a letter so that we can make Texinfo private macro names. +\edef\texiatcatcode{\the\catcode`\@} +\catcode `@=11\relax + % Parse the optional {params} list. Set up \paramno and \paramlist -% so \defmacro knows what to do. Define \macarg.blah for each blah -% in the params list, to be ##N where N is the position in that list. +% so \defmacro knows what to do. Define \macarg.BLAH for each BLAH +% in the params list to some hook where the argument si to be expanded. If +% there are less than 10 arguments that hook is to be replaced by ##N where N +% is the position in that list, that is to say the macro arguments are to be +% defined `a la TeX in the macro body. +% % That gets used by \mbodybackslash (above). - +% % We need to get `macro parameter char #' into several definitions. -% The technique used is stolen from LaTeX: let \hash be something +% The technique used is stolen from LaTeX: let \hash be something % unexpandable, insert that wherever you need a #, and then redefine % it to # just before using the token list produced. % % The same technique is used to protect \eatspaces till just before % the macro is used. - -\def\parsemargdef#1;{\paramno=0\def\paramlist{}% - \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} +% +% If there are 10 or more arguments, a different technique is used, where the +% hook remains in the body, and when macro is to be expanded the body is +% processed again to replace the arguments. +% +% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the +% argument N value and then \edef the body (nothing else will expand because of +% the catcode regime underwhich the body was input). +% +% If you compile with TeX (not eTeX), and you have macros with 10 or more +% arguments, you need that no macro has more than 256 arguments, otherwise an +% error is produced. +\def\parsemargdef#1;{% + \paramno=0\def\paramlist{}% + \let\hash\relax + \let\xeatspaces\relax + \parsemargdefxxx#1,;,% + % In case that there are 10 or more arguments we parse again the arguments + % list to set new definitions for the \macarg.BLAH macros corresponding to + % each BLAH argument. It was anyhow needed to parse already once this list + % in order to count the arguments, and as macros with at most 9 arguments + % are by far more frequent than macro with 10 or more arguments, defining + % twice the \macarg.BLAH macros does not cost too much processing power. + \ifnum\paramno<10\relax\else + \paramno0\relax + \parsemmanyargdef@@#1,;,% 10 or more arguments + \fi +} \def\parsemargdefxxx#1,{% \if#1;\let\next=\relax \else \let\next=\parsemargdefxxx - \advance\paramno by 1% + \advance\paramno by 1 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname {\xeatspaces{\hash\the\paramno}}% \edef\paramlist{\paramlist\hash\the\paramno,}% \fi\next} +\def\parsemmanyargdef@@#1,{% + \if#1;\let\next=\relax + \else + \let\next=\parsemmanyargdef@@ + \edef\tempb{\eatspaces{#1}}% + \expandafter\def\expandafter\tempa + \expandafter{\csname macarg.\tempb\endcsname}% + % Note that we need some extra \noexpand\noexpand, this is because we + % don't want \the to be expanded in the \parsermacbody as it uses an + % \xdef . + \expandafter\edef\tempa + {\noexpand\noexpand\noexpand\the\toks\the\paramno}% + \advance\paramno by 1\relax + \fi\next} + % These two commands read recursive and nonrecursive macro bodies. % (They're different since rec and nonrec macros end differently.) - +% + +\catcode `\@\texiatcatcode \long\def\parsemacbody#1 at end macro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% \long\def\parsermacbody#1 at end rmacro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% - -% This defines the macro itself. There are six cases: recursive and -% nonrecursive macros of zero, one, and many arguments. +\catcode `\@=11\relax + +\let\endargs@\relax +\let\nil@\relax +\def\nilm@{\nil@}% +\long\def\nillm@{\nil@}% + +% This macro is expanded during the Texinfo macro expansion, not during its +% definition. It gets all the arguments values and assigns them to macros +% macarg.ARGNAME +% +% #1 is the macro name +% #2 is the list of argument names +% #3 is the list of argument values +\def\getargvals@#1#2#3{% + \def\macargdeflist@{}% + \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion. + \def\paramlist{#2,\nil@}% + \def\macroname{#1}% + \begingroup + \macroargctxt + \def\argvaluelist{#3,\nil@}% + \def\@tempa{#3}% + \ifx\@tempa\empty + \setemptyargvalues@ + \else + \getargvals@@ + \fi +} + +% +\def\getargvals@@{% + \ifx\paramlist\nilm@ + % Some sanity check needed here that \argvaluelist is also empty. + \ifx\argvaluelist\nillm@ + \else + \errhelp = \EMsimple + \errmessage{Too many arguments in macro `\macroname'!}% + \fi + \let\next\macargexpandinbody@ + \else + \ifx\argvaluelist\nillm@ + % No more arguments values passed to macro. Set remaining named-arg + % macros to empty. + \let\next\setemptyargvalues@ + \else + % pop current arg name into \@tempb + \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}% + \expandafter\@tempa\expandafter{\paramlist}% + % pop current argument value into \@tempc + \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}% + \expandafter\@tempa\expandafter{\argvaluelist}% + % Here \@tempb is the current arg name and \@tempc is the current arg value. + % First place the new argument macro definition into \@tempd + \expandafter\macname\expandafter{\@tempc}% + \expandafter\let\csname macarg.\@tempb\endcsname\relax + \expandafter\def\expandafter\@tempe\expandafter{% + \csname macarg.\@tempb\endcsname}% + \edef\@tempd{\long\def\@tempe{\the\macname}}% + \push@\@tempd\macargdeflist@ + \let\next\getargvals@@ + \fi + \fi + \next +} + +\def\push@#1#2{% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter#2% + \expandafter\expandafter\expandafter{% + \expandafter#1#2}% +} + +% Replace arguments by their values in the macro body, and place the result +% in macro \@tempa +\def\macvalstoargs@{% + % To do this we use the property that token registers that are \the'ed + % within an \edef expand only once. So we are going to place all argument + % values into respective token registers. + % + % First we save the token context, and initialize argument numbering. + \begingroup + \paramno0\relax + % Then, for each argument number #N, we place the corresponding argument + % value into a new token list register \toks#N + \expandafter\putargsintokens@\saveparamlist@,;,% + % Then, we expand the body so that argument are replaced by their + % values. The trick for values not to be expanded themselves is that they + % are within tokens and that tokens expand only once in an \edef . + \edef\@tempc{\csname mac.\macroname .body\endcsname}% + % Now we restore the token stack pointer to free the token list registers + % which we have used, but we make sure that expanded body is saved after + % group. + \expandafter + \endgroup + \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% + } + +\def\macargexpandinbody@{% + %% Define the named-macro outside of this group and then close this group. + \expandafter + \endgroup + \macargdeflist@ + % First the replace in body the macro arguments by their values, the result + % is in \@tempa . + \macvalstoargs@ + % Then we point at the \norecurse or \gobble (for recursive) macro value + % with \@tempb . + \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname + % Depending on whether it is recursive or not, we need some tailing + % \egroup . + \ifx\@tempb\gobble + \let\@tempc\relax + \else + \let\@tempc\egroup + \fi + % And now we do the real job: + \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}% + \@tempd +} + +\def\putargsintokens@#1,{% + \if#1;\let\next\relax + \else + \let\next\putargsintokens@ + % First we allocate the new token list register, and give it a temporary + % alias \@tempb . + \toksdef\@tempb\the\paramno + % Then we place the argument value into that token list register. + \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname + \expandafter\@tempb\expandafter{\@tempa}% + \advance\paramno by 1\relax + \fi + \next +} + +% Save the token stack pointer into macro #1 +\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}} +% Restore the token stack pointer from number in macro #1 +\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax} +% newtoks that can be used non \outer . +\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi} + +% Tailing missing arguments are set to empty +\def\setemptyargvalues@{% + \ifx\paramlist\nilm@ + \let\next\macargexpandinbody@ + \else + \expandafter\setemptyargvaluesparser@\paramlist\endargs@ + \let\next\setemptyargvalues@ + \fi + \next +} + +\def\setemptyargvaluesparser@#1,#2\endargs@{% + \expandafter\def\expandafter\@tempa\expandafter{% + \expandafter\def\csname macarg.#1\endcsname{}}% + \push@\@tempa\macargdeflist@ + \def\paramlist{#2}% +} + +% #1 is the element target macro +% #2 is the list macro +% #3,#4\endargs@ is the list value +\def\pop@#1#2#3,#4\endargs@{% + \def#1{#3}% + \def#2{#4}% +} +\long\def\longpop@#1#2#3,#4\endargs@{% + \long\def#1{#3}% + \long\def#2{#4}% +} + +% This defines a Texinfo @macro. There are eight cases: recursive and +% nonrecursive macros of zero, one, up to nine, and many arguments. % Much magic with \expandafter here. % \xdef is used so that macro definitions will survive the file % they're defined in; @include reads the file inside a group. +% \def\defmacro{% \let\hash=##% convert placeholders to macro parameter chars \ifrecursive @@ -5866,17 +7630,25 @@ \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup\noexpand\scanmacro{\temp}}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \else + \ifnum\paramno<10\relax % at most 9 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \else % 10 or more + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\getargvals@{\the\macname}{\argl}% + }% + \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp + \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble + \fi \fi \else \ifcase\paramno @@ -5893,39 +7665,51 @@ \egroup \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \expandafter\noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% + \else % at most 9 + \ifnum\paramno<10\relax + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % 10 or more: + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\getargvals@{\the\macname}{\argl}% + }% + \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp + \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse + \fi \fi \fi} +\catcode `\@\texiatcatcode\relax + \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} % \braceorline decides whether the next nonwhitespace character is a % {. If so it reads up to the closing }, if not, it reads the whole % line. Whatever was read is then fed to the next control sequence -% as an argument (by \parsebrace or \parsearg) -\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} +% as an argument (by \parsebrace or \parsearg). +% +\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} \def\braceorlinexxx{% \ifx\nchar\bgroup\else \expandafter\parsearg - \fi \next} + \fi \macnamexxx} % @alias. % We need some trickery to remove the optional spaces around the equal -% sign. Just make them active and then expand them all to nothing. +% sign. Make them active and then expand them all to nothing. +% \def\alias{\parseargusing\obeyspaces\aliasxxx} \def\aliasxxx #1{\aliasyyy#1\relax} \def\aliasyyy #1=#2\relax{% @@ -5941,13 +7725,13 @@ \message{cross references,} \newwrite\auxfile - \newif\ifhavexrefs % True if xref values are known. \newif\ifwarnedxrefs % True if we warned once that they aren't known. % @inforef is relatively simple. \def\inforef #1{\inforefzzz #1,,,,**} -\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, +\def\inforefzzz #1,#2,#3,#4**{% + \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, node \samp{\ignorespaces#1{}}} % @node's only job in TeX is to define \lastnode, which is used in @@ -5986,7 +7770,7 @@ % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an % anchor), which consists of three parts: -% 1) NAME-title - the current sectioning name taken from \thissection, +% 1) NAME-title - the current sectioning name taken from \lastsection, % or the anchor name. % 2) NAME-snt - section number and type, passed as the SNT arg, or % empty for anchors. @@ -6005,14 +7789,35 @@ \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef ##1}{##2}}% these are parameters of \writexrdef }% - \toks0 = \expandafter{\thissection}% + \toks0 = \expandafter{\lastsection}% \immediate \writexrdef{title}{\the\toks0 }% \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. - \writexrdef{pg}{\folio}% will be written later, during \shipout + \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout }% \fi } +% @xrefautosectiontitle on|off says whether @section(ing) names are used +% automatically in xrefs, if the third arg is not explicitly specified. +% This was provided as a "secret" @set xref-automatic-section-title +% variable, now it's official. +% +\parseargdef\xrefautomaticsectiontitle{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETxref-automatic-section-title\endcsname + = \empty + \else\ifx\temp\offword + \expandafter\let\csname SETxref-automatic-section-title\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', + must be on|off}% + \fi\fi +} + +% % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is % the node name, #2 the name of the Info cross-reference, #3 the printed % node name, #4 the name of the Info file, #5 the name of the printed @@ -6021,26 +7826,41 @@ \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} \def\ref#1{\xrefX[#1,,,,,,,]} +% +\newbox\toprefbox +\newbox\printedrefnamebox +\newbox\infofilenamebox +\newbox\printedmanualbox +% \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup \unsepspaces + % + % Get args without leading/trailing spaces. + \def\printedrefname{\ignorespaces #3}% + \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}% + % + \def\infofilename{\ignorespaces #4}% + \setbox\infofilenamebox = \hbox{\infofilename\unskip}% + % \def\printedmanual{\ignorespaces #5}% - \def\printedrefname{\ignorespaces #3}% - \setbox1=\hbox{\printedmanual\unskip}% - \setbox0=\hbox{\printedrefname\unskip}% - \ifdim \wd0 = 0pt + \setbox\printedmanualbox = \hbox{\printedmanual\unskip}% + % + % If the printed reference name (arg #3) was not explicitly given in + % the @xref, figure out what we want to use. + \ifdim \wd\printedrefnamebox = 0pt % No printed node name was explicitly given. - \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax - % Use the node name inside the square brackets. + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax + % Not auto section-title: use node name inside the square brackets. \def\printedrefname{\ignorespaces #1}% \else - % Use the actual chapter/section title appear inside - % the square brackets. Use the real section title if we have it. - \ifdim \wd1 > 0pt - % It is in another manual, so we don't have it. + % Auto section-title: use chapter/section title inside + % the square brackets if we have it. + \ifdim \wd\printedmanualbox > 0pt + % It is in another manual, so we don't have it; use node name. \def\printedrefname{\ignorespaces #1}% \else \ifhavexrefs - % We know the real title if we have the xref values. + % We (should) know the real title if we have the xref values. \def\printedrefname{\refx{#1-title}{}}% \else % Otherwise just copy the Info node name. @@ -6052,22 +7872,32 @@ % % Make link in pdf output. \ifpdf - \leavevmode - \getfilename{#4}% - {\turnoffactive - % See comments at \activebackslashdouble. - {\activebackslashdouble \xdef\pdfxrefdest{#1}% - \backslashparens\pdfxrefdest}% + {\indexnofonts + \turnoffactive + \makevalueexpandable + % This expands tokens, so do it after making catcode changes, so _ + % etc. don't get their TeX definitions. This ignores all spaces in + % #4, including (wrongly) those in the middle of the filename. + \getfilename{#4}% % + % This (wrongly) does not take account of leading or trailing + % spaces in #1, which should be ignored. + \edef\pdfxrefdest{#1}% + \ifx\pdfxrefdest\empty + \def\pdfxrefdest{Top}% no empty targets + \else + \txiescapepdf\pdfxrefdest % escape PDF special chars + \fi + % + \leavevmode + \startlink attr{/Border [0 0 0]}% \ifnum\filenamelength>0 - \startlink attr{/Border [0 0 0]}% - goto file{\the\filename.pdf} name{\pdfxrefdest}% + goto file{\the\filename.pdf} name{\pdfxrefdest}% \else - \startlink attr{/Border [0 0 0]}% - goto name{\pdfmkpgn{\pdfxrefdest}}% + goto name{\pdfmkpgn{\pdfxrefdest}}% \fi }% - \linkcolor + \setcolor{\linkcolor}% \fi % % Float references are printed completely differently: "Figure 1.2" @@ -6084,29 +7914,42 @@ \iffloat\Xthisreftitle % If the user specified the print name (third arg) to the ref, % print it instead of our usual "Figure 1.2". - \ifdim\wd0 = 0pt - \refx{#1-snt}% + \ifdim\wd\printedrefnamebox = 0pt + \refx{#1-snt}{}% \else \printedrefname \fi % - % if the user also gave the printed manual name (fifth arg), append + % If the user also gave the printed manual name (fifth arg), append % "in MANUALNAME". - \ifdim \wd1 > 0pt + \ifdim \wd\printedmanualbox > 0pt \space \putwordin{} \cite{\printedmanual}% \fi \else % node/anchor (non-float) references. + % + % If we use \unhbox to print the node names, TeX does not insert + % empty discretionaries after hyphens, which means that it will not + % find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, + % this is a loss. Therefore, we give the text of the node name + % again, so it is as if TeX is seeing it for the first time. + % + \ifdim \wd\printedmanualbox > 0pt + % Cross-manual reference with a printed manual name. + % + \crossmanualxref{\cite{\printedmanual\unskip}}% % - % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not - % insert empty discretionaries after hyphens, which means that it will - % not find a line break at a hyphen in a node names. Since some manuals - % are best written with fairly long node names, containing hyphens, this - % is a loss. Therefore, we give the text of the node name again, so it - % is as if TeX is seeing it for the first time. - \ifdim \wd1 > 0pt - \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + \else\ifdim \wd\infofilenamebox > 0pt + % Cross-manual reference with only an info filename (arg 4), no + % printed manual name (arg 5). This is essentially the same as + % the case above; we output the filename, since we have nothing else. + % + \crossmanualxref{\code{\infofilename\unskip}}% + % \else + % Reference within this manual. + % % _ (for example) has to be the character _ for the purposes of the % control sequence corresponding to the node, but it has to expand % into the usual \leavevmode...\vrule stuff for purposes of @@ -6118,7 +7961,7 @@ \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi }% - % output the `[mynode]' via a macro so it can be overridden. + % output the `[mynode]' via the macro below so it can be overridden. \xrefprintnodename\printedrefname % % But we always want a comma and a space: @@ -6126,11 +7969,37 @@ % % output the `page 3'. \turnoffactive \putwordpage\tie\refx{#1-pg}{}% - \fi + \fi\fi \fi \endlink \endgroup} +% Output a cross-manual xref to #1. Used just above (twice). +% +% Only include the text "Section ``foo'' in" if the foo is neither +% missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply +% "see The Foo Manual", the idea being to refer to the whole manual. +% +% But, this being TeX, we can't easily compare our node name against the +% string "Top" while ignoring the possible spaces before and after in +% the input. By adding the arbitrary 7sp below, we make it much less +% likely that a real node name would have the same width as "Top" (e.g., +% in a monospaced font). Hopefully it will never happen in practice. +% +% For the same basic reason, we retypeset the "Top" at every +% reference, since the current font is indeterminate. +% +\def\crossmanualxref#1{% + \setbox\toprefbox = \hbox{Top\kern7sp}% + \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}% + \ifdim \wd2 > 7sp % nonempty? + \ifdim \wd2 = \wd\toprefbox \else % same as Top? + \putwordSection{} ``\printedrefname'' \putwordin{}\space + \fi + \fi + #1% +} + % This macro is called from \xrefX for the `[nodename]' part of xref % output. It's a separate macro only so it can be changed more easily, % since square brackets don't work well in some documents. Particularly @@ -6181,7 +8050,8 @@ \angleleft un\-de\-fined\angleright \iflinks \ifhavexrefs - \message{\linenumber Undefined cross reference `#1'.}% + {\toks0 = {#1}% avoid expansion of possibly-complex value + \message{\linenumber Undefined cross reference `\the\toks0'.}}% \else \ifwarnedxrefs\else \global\warnedxrefstrue @@ -6201,10 +8071,18 @@ % collisions). But if this is a float type, we have more work to do. % \def\xrdef#1#2{% - \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. + {% The node name might contain 8-bit characters, which in our current + % implementation are changed to commands like @'e. Don't let these + % mess up the control sequence name. + \indexnofonts + \turnoffactive + \xdef\safexrefname{#1}% + }% + % + \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref % % Was that xref control sequence that we just defined for a float? - \expandafter\iffloat\csname XR#1\endcsname + \expandafter\iffloat\csname XR\safexrefname\endcsname % it was a float, and we have the (safe) float type in \iffloattype. \expandafter\let\expandafter\floatlist \csname floatlist\iffloattype\endcsname @@ -6219,7 +8097,8 @@ % % Remember this xref in the control sequence \floatlistFLOATTYPE, % for later use in \listoffloats. - \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 + {\safexrefname}}% \fi } @@ -6323,6 +8202,7 @@ \input\jobname.#1 \endgroup} + \message{insertions,} % including footnotes. @@ -6335,7 +8215,7 @@ % space to prevent strange expansion errors.) \def\supereject{\par\penalty -20000\footnoteno =0 } -% @footnotestyle is meaningful for info output only. +% @footnotestyle is meaningful for Info output only. \let\footnotestyle=\comment {\catcode `\@=11 @@ -6398,6 +8278,8 @@ % expands into a box, it must come within the paragraph, lest it % provide a place where TeX can split the footnote. \footstrut + % + % Invoke rest of plain TeX footnote routine. \futurelet\next\fo at t } }%end \catcode `\@=11 @@ -6405,7 +8287,7 @@ % In case a @footnote appears in a vbox, save the footnote text and create % the real \insert just after the vbox finished. Otherwise, the insertion % would be lost. -% Similarily, if a @footnote appears inside an alignment, save the footnote +% Similarly, if a @footnote appears inside an alignment, save the footnote % text to a box and make the \insert when a row of the table is finished. % And the same can be done for other insert classes. --kasal, 16nov03. @@ -6485,7 +8367,7 @@ it from ftp://tug.org/tex/epsf.tex.} % \def\image#1{% - \ifx\epsfbox\undefined + \ifx\epsfbox\thisisundefined \ifwarnednoepsf \else \errhelp = \noepsfhelp \errmessage{epsf.tex not found, images will be ignored}% @@ -6501,7 +8383,7 @@ % #2 is (optional) width, #3 is (optional) height. % #4 is (ignored optional) html alt text. % #5 is (ignored optional) extension. -% #6 is just the usual extra ignored arg for parsing this stuff. +% #6 is just the usual extra ignored arg for parsing stuff. \newif\ifimagevmode \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup \catcode`\^^M = 5 % in case we're inside an example @@ -6509,15 +8391,30 @@ % If the image is by itself, center it. \ifvmode \imagevmodetrue - \nobreak\bigskip + \else \ifx\centersub\centerV + % for @center @image, we need a vbox so we can have our vertical space + \imagevmodetrue + \vbox\bgroup % vbox has better behavior than vtop herev + \fi\fi + % + \ifimagevmode + \nobreak\medskip % Usually we'll have text after the image which will insert % \parskip glue, so insert it here too to equalize the space % above and below. \nobreak\vskip\parskip \nobreak - \line\bgroup\hss \fi % + % Leave vertical mode so that indentation from an enclosing + % environment such as @quotation is respected. + % However, if we're at the top level, we don't want the + % normal paragraph indentation. + % On the other hand, if we are in the case of @center @image, we don't + % want to start a paragraph, which will create a hsize-width box and + % eradicate the centering. + \ifx\centersub\centerV\else \noindent \fi + % % Output the image. \ifpdf \dopdfimage{#1}{#2}{#3}% @@ -6528,7 +8425,10 @@ \epsfbox{#1.eps}% \fi % - \ifimagevmode \hss \egroup \bigbreak \fi % space after the image + \ifimagevmode + \medskip % space after a standalone image + \fi + \ifx\centersub\centerV \egroup \fi \endgroup} @@ -6595,13 +8495,13 @@ \global\advance\floatno by 1 % {% - % This magic value for \thissection is output by \setref as the + % This magic value for \lastsection is output by \setref as the % XREFLABEL-title value. \xrefX uses it to distinguish float % labels (which have a completely different output format) from % node and anchor labels. And \xrdef uses it to construct the % lists of floats. % - \edef\thissection{\floatmagic=\safefloattype}% + \edef\lastsection{\floatmagic=\safefloattype}% \setref{\floatlabel}{Yfloat}% }% \fi @@ -6669,6 +8569,7 @@ % caption if specified, else the full caption if specified, else nothing. {% \atdummies + % % since we read the caption text in the macro world, where ^^M % is turned into a normal character, we have to scan it back, so % we don't write the literal three characters "^^M" into the aux file. @@ -6689,8 +8590,9 @@ % % place the captured inserts % - % BEWARE: when the floats start float, we have to issue warning whenever an - % insert appears inside a float which could possibly float. --kasal, 26may04 + % BEWARE: when the floats start floating, we have to issue warning + % whenever an insert appears inside a float which could possibly + % float. --kasal, 26may04 % \checkinserts } @@ -6734,7 +8636,7 @@ % #1 is the control sequence we are passed; we expand into a conditional % which is true if #1 represents a float ref. That is, the magic -% \thissection value which we \setref above. +% \lastsection value which we \setref above. % \def\iffloat#1{\expandafter\doiffloat#1==\finish} % @@ -6795,39 +8697,909 @@ \writeentry }} + \message{localization,} -% and i18n. - -% @documentlanguage is usually given very early, just after -% @setfilename. If done too late, it may not override everything -% properly. Single argument is the language abbreviation. -% It would be nice if we could set up a hyphenation file here. -% -\parseargdef\documentlanguage{% + +% For single-language documents, @documentlanguage is usually given very +% early, just after @documentencoding. Single argument is the language +% (de) or locale (de_DE) abbreviation. +% +{ + \catcode`\_ = \active + \globaldefs=1 +\parseargdef\documentlanguage{\begingroup + \let_=\normalunderscore % normal _ character for filenames \tex % read txi-??.tex file in plain TeX. - % Read the file if it exists. + % Read the file by the name they passed if it exists. \openin 1 txi-#1.tex \ifeof 1 - \errhelp = \nolanghelp - \errmessage{Cannot read language file txi-#1.tex}% + \documentlanguagetrywithoutunderscore{#1_\finish}% \else + \globaldefs = 1 % everything in the txi-LL files needs to persist \input txi-#1.tex \fi \closein 1 - \endgroup -} + \endgroup % end raw TeX +\endgroup} +% +% If they passed de_DE, and txi-de_DE.tex doesn't exist, +% try txi-de.tex. +% +\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{% + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \globaldefs = 1 % everything in the txi-LL files needs to persist + \input txi-#1.tex + \fi + \closein 1 +} +}% end of special _ catcode +% \newhelp\nolanghelp{The given language definition file cannot be found or -is empty. Maybe you need to install it? In the current directory -should work if nowhere else does.} - - -% @documentencoding should change something in TeX eventually, most -% likely, but for now just recognize it. -\let\documentencoding = \comment - - -% Page size parameters. -% +is empty. Maybe you need to install it? Putting it in the current +directory should work if nowhere else does.} + +% This macro is called from txi-??.tex files; the first argument is the +% \language name to set (without the "\lang@" prefix), the second and +% third args are \{left,right}hyphenmin. +% +% The language names to pass are determined when the format is built. +% See the etex.log file created at that time, e.g., +% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. +% +% With TeX Live 2008, etex now includes hyphenation patterns for all +% available languages. This means we can support hyphenation in +% Texinfo, at least to some extent. (This still doesn't solve the +% accented characters problem.) +% +\catcode`@=11 +\def\txisetlanguage#1#2#3{% + % do not set the language if the name is undefined in the current TeX. + \expandafter\ifx\csname lang@#1\endcsname \relax + \message{no patterns for #1}% + \else + \global\language = \csname lang@#1\endcsname + \fi + % but there is no harm in adjusting the hyphenmin values regardless. + \global\lefthyphenmin = #2\relax + \global\righthyphenmin = #3\relax +} + +% Helpers for encodings. +% Set the catcode of characters 128 through 255 to the specified number. +% +\def\setnonasciicharscatcode#1{% + \count255=128 + \loop\ifnum\count255<256 + \global\catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} + +\def\setnonasciicharscatcodenonglobal#1{% + \count255=128 + \loop\ifnum\count255<256 + \catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} + +% @documentencoding sets the definition of non-ASCII characters +% according to the specified encoding. +% +\parseargdef\documentencoding{% + % Encoding being declared for the document. + \def\declaredencoding{\csname #1.enc\endcsname}% + % + % Supported encodings: names converted to tokens in order to be able + % to compare them with \ifx. + \def\ascii{\csname US-ASCII.enc\endcsname}% + \def\latnine{\csname ISO-8859-15.enc\endcsname}% + \def\latone{\csname ISO-8859-1.enc\endcsname}% + \def\lattwo{\csname ISO-8859-2.enc\endcsname}% + \def\utfeight{\csname UTF-8.enc\endcsname}% + % + \ifx \declaredencoding \ascii + \asciichardefs + % + \else \ifx \declaredencoding \lattwo + \setnonasciicharscatcode\active + \lattwochardefs + % + \else \ifx \declaredencoding \latone + \setnonasciicharscatcode\active + \latonechardefs + % + \else \ifx \declaredencoding \latnine + \setnonasciicharscatcode\active + \latninechardefs + % + \else \ifx \declaredencoding \utfeight + \setnonasciicharscatcode\active + \utfeightchardefs + % + \else + \message{Unknown document encoding #1, ignoring.}% + % + \fi % utfeight + \fi % latnine + \fi % latone + \fi % lattwo + \fi % ascii +} + +% A message to be logged when using a character that isn't available +% the default font encoding (OT1). +% +\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} + +% Take account of \c (plain) vs. \, (Texinfo) difference. +\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} + +% First, make active non-ASCII characters in order for them to be +% correctly categorized when TeX reads the replacement text of +% macros containing the character definitions. +\setnonasciicharscatcode\active +% +% Latin1 (ISO-8859-1) character definitions. +\def\latonechardefs{% + \gdef^^a0{\tie} + \gdef^^a1{\exclamdown} + \gdef^^a2{\missingcharmsg{CENT SIGN}} + \gdef^^a3{{\pounds}} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\missingcharmsg{YEN SIGN}} + \gdef^^a6{\missingcharmsg{BROKEN BAR}} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\copyright} + \gdef^^aa{\ordf} + \gdef^^ab{\guillemetleft} + \gdef^^ac{$\lnot$} + \gdef^^ad{\-} + \gdef^^ae{\registeredsymbol} + \gdef^^af{\={}} + % + \gdef^^b0{\textdegree} + \gdef^^b1{$\pm$} + \gdef^^b2{$^2$} + \gdef^^b3{$^3$} + \gdef^^b4{\'{}} + \gdef^^b5{$\mu$} + \gdef^^b6{\P} + % + \gdef^^b7{$^.$} + \gdef^^b8{\cedilla\ } + \gdef^^b9{$^1$} + \gdef^^ba{\ordm} + % + \gdef^^bb{\guillemetright} + \gdef^^bc{$1\over4$} + \gdef^^bd{$1\over2$} + \gdef^^be{$3\over4$} + \gdef^^bf{\questiondown} + % + \gdef^^c0{\`A} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\~A} + \gdef^^c4{\"A} + \gdef^^c5{\ringaccent A} + \gdef^^c6{\AE} + \gdef^^c7{\cedilla C} + \gdef^^c8{\`E} + \gdef^^c9{\'E} + \gdef^^ca{\^E} + \gdef^^cb{\"E} + \gdef^^cc{\`I} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\"I} + % + \gdef^^d0{\DH} + \gdef^^d1{\~N} + \gdef^^d2{\`O} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\~O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\O} + \gdef^^d9{\`U} + \gdef^^da{\'U} + \gdef^^db{\^U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\TH} + \gdef^^df{\ss} + % + \gdef^^e0{\`a} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\~a} + \gdef^^e4{\"a} + \gdef^^e5{\ringaccent a} + \gdef^^e6{\ae} + \gdef^^e7{\cedilla c} + \gdef^^e8{\`e} + \gdef^^e9{\'e} + \gdef^^ea{\^e} + \gdef^^eb{\"e} + \gdef^^ec{\`{\dotless i}} + \gdef^^ed{\'{\dotless i}} + \gdef^^ee{\^{\dotless i}} + \gdef^^ef{\"{\dotless i}} + % + \gdef^^f0{\dh} + \gdef^^f1{\~n} + \gdef^^f2{\`o} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\~o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\o} + \gdef^^f9{\`u} + \gdef^^fa{\'u} + \gdef^^fb{\^u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\th} + \gdef^^ff{\"y} +} + +% Latin9 (ISO-8859-15) encoding character definitions. +\def\latninechardefs{% + % Encoding is almost identical to Latin1. + \latonechardefs + % + \gdef^^a4{\euro} + \gdef^^a6{\v S} + \gdef^^a8{\v s} + \gdef^^b4{\v Z} + \gdef^^b8{\v z} + \gdef^^bc{\OE} + \gdef^^bd{\oe} + \gdef^^be{\"Y} +} + +% Latin2 (ISO-8859-2) character definitions. +\def\lattwochardefs{% + \gdef^^a0{\tie} + \gdef^^a1{\ogonek{A}} + \gdef^^a2{\u{}} + \gdef^^a3{\L} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\v L} + \gdef^^a6{\'S} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\v S} + \gdef^^aa{\cedilla S} + \gdef^^ab{\v T} + \gdef^^ac{\'Z} + \gdef^^ad{\-} + \gdef^^ae{\v Z} + \gdef^^af{\dotaccent Z} + % + \gdef^^b0{\textdegree} + \gdef^^b1{\ogonek{a}} + \gdef^^b2{\ogonek{ }} + \gdef^^b3{\l} + \gdef^^b4{\'{}} + \gdef^^b5{\v l} + \gdef^^b6{\'s} + \gdef^^b7{\v{}} + \gdef^^b8{\cedilla\ } + \gdef^^b9{\v s} + \gdef^^ba{\cedilla s} + \gdef^^bb{\v t} + \gdef^^bc{\'z} + \gdef^^bd{\H{}} + \gdef^^be{\v z} + \gdef^^bf{\dotaccent z} + % + \gdef^^c0{\'R} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\u A} + \gdef^^c4{\"A} + \gdef^^c5{\'L} + \gdef^^c6{\'C} + \gdef^^c7{\cedilla C} + \gdef^^c8{\v C} + \gdef^^c9{\'E} + \gdef^^ca{\ogonek{E}} + \gdef^^cb{\"E} + \gdef^^cc{\v E} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\v D} + % + \gdef^^d0{\DH} + \gdef^^d1{\'N} + \gdef^^d2{\v N} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\H O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\v R} + \gdef^^d9{\ringaccent U} + \gdef^^da{\'U} + \gdef^^db{\H U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\cedilla T} + \gdef^^df{\ss} + % + \gdef^^e0{\'r} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\u a} + \gdef^^e4{\"a} + \gdef^^e5{\'l} + \gdef^^e6{\'c} + \gdef^^e7{\cedilla c} + \gdef^^e8{\v c} + \gdef^^e9{\'e} + \gdef^^ea{\ogonek{e}} + \gdef^^eb{\"e} + \gdef^^ec{\v e} + \gdef^^ed{\'{\dotless{i}}} + \gdef^^ee{\^{\dotless{i}}} + \gdef^^ef{\v d} + % + \gdef^^f0{\dh} + \gdef^^f1{\'n} + \gdef^^f2{\v n} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\H o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\v r} + \gdef^^f9{\ringaccent u} + \gdef^^fa{\'u} + \gdef^^fb{\H u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\cedilla t} + \gdef^^ff{\dotaccent{}} +} + +% UTF-8 character definitions. +% +% This code to support UTF-8 is based on LaTeX's utf8.def, with some +% changes for Texinfo conventions. It is included here under the GPL by +% permission from Frank Mittelbach and the LaTeX team. +% +\newcount\countUTFx +\newcount\countUTFy +\newcount\countUTFz + +\gdef\UTFviiiTwoOctets#1#2{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\endcsname} +% +\gdef\UTFviiiThreeOctets#1#2#3{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} +% +\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} + +\gdef\UTFviiiDefined#1{% + \ifx #1\relax + \message{\linenumber Unicode char \string #1 not defined for Texinfo}% + \else + \expandafter #1% + \fi +} + +\begingroup + \catcode`\~13 + \catcode`\"12 + + \def\UTFviiiLoop{% + \global\catcode\countUTFx\active + \uccode`\~\countUTFx + \uppercase\expandafter{\UTFviiiTmp}% + \advance\countUTFx by 1 + \ifnum\countUTFx < \countUTFy + \expandafter\UTFviiiLoop + \fi} + + \countUTFx = "C2 + \countUTFy = "E0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiTwoOctets\string~}} + \UTFviiiLoop + + \countUTFx = "E0 + \countUTFy = "F0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiThreeOctets\string~}} + \UTFviiiLoop + + \countUTFx = "F0 + \countUTFy = "F4 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiFourOctets\string~}} + \UTFviiiLoop +\endgroup + +\begingroup + \catcode`\"=12 + \catcode`\<=12 + \catcode`\.=12 + \catcode`\,=12 + \catcode`\;=12 + \catcode`\!=12 + \catcode`\~=13 + + \gdef\DeclareUnicodeCharacter#1#2{% + \countUTFz = "#1\relax + %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% + \begingroup + \parseXMLCharref + \def\UTFviiiTwoOctets##1##2{% + \csname u8:##1\string ##2\endcsname}% + \def\UTFviiiThreeOctets##1##2##3{% + \csname u8:##1\string ##2\string ##3\endcsname}% + \def\UTFviiiFourOctets##1##2##3##4{% + \csname u8:##1\string ##2\string ##3\string ##4\endcsname}% + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter + \gdef\UTFviiiTmp{#2}% + \endgroup} + + \gdef\parseXMLCharref{% + \ifnum\countUTFz < "A0\relax + \errhelp = \EMsimple + \errmessage{Cannot define Unicode char value < 00A0}% + \else\ifnum\countUTFz < "800\relax + \parseUTFviiiA,% + \parseUTFviiiB C\UTFviiiTwoOctets.,% + \else\ifnum\countUTFz < "10000\relax + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiB E\UTFviiiThreeOctets.{,;}% + \else + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiA!% + \parseUTFviiiB F\UTFviiiFourOctets.{!,;}% + \fi\fi\fi + } + + \gdef\parseUTFviiiA#1{% + \countUTFx = \countUTFz + \divide\countUTFz by 64 + \countUTFy = \countUTFz + \multiply\countUTFz by 64 + \advance\countUTFx by -\countUTFz + \advance\countUTFx by 128 + \uccode `#1\countUTFx + \countUTFz = \countUTFy} + + \gdef\parseUTFviiiB#1#2#3#4{% + \advance\countUTFz by "#10\relax + \uccode `#3\countUTFz + \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} +\endgroup + +\def\utfeightchardefs{% + \DeclareUnicodeCharacter{00A0}{\tie} + \DeclareUnicodeCharacter{00A1}{\exclamdown} + \DeclareUnicodeCharacter{00A3}{\pounds} + \DeclareUnicodeCharacter{00A8}{\"{ }} + \DeclareUnicodeCharacter{00A9}{\copyright} + \DeclareUnicodeCharacter{00AA}{\ordf} + \DeclareUnicodeCharacter{00AB}{\guillemetleft} + \DeclareUnicodeCharacter{00AD}{\-} + \DeclareUnicodeCharacter{00AE}{\registeredsymbol} + \DeclareUnicodeCharacter{00AF}{\={ }} + + \DeclareUnicodeCharacter{00B0}{\ringaccent{ }} + \DeclareUnicodeCharacter{00B4}{\'{ }} + \DeclareUnicodeCharacter{00B8}{\cedilla{ }} + \DeclareUnicodeCharacter{00BA}{\ordm} + \DeclareUnicodeCharacter{00BB}{\guillemetright} + \DeclareUnicodeCharacter{00BF}{\questiondown} + + \DeclareUnicodeCharacter{00C0}{\`A} + \DeclareUnicodeCharacter{00C1}{\'A} + \DeclareUnicodeCharacter{00C2}{\^A} + \DeclareUnicodeCharacter{00C3}{\~A} + \DeclareUnicodeCharacter{00C4}{\"A} + \DeclareUnicodeCharacter{00C5}{\AA} + \DeclareUnicodeCharacter{00C6}{\AE} + \DeclareUnicodeCharacter{00C7}{\cedilla{C}} + \DeclareUnicodeCharacter{00C8}{\`E} + \DeclareUnicodeCharacter{00C9}{\'E} + \DeclareUnicodeCharacter{00CA}{\^E} + \DeclareUnicodeCharacter{00CB}{\"E} + \DeclareUnicodeCharacter{00CC}{\`I} + \DeclareUnicodeCharacter{00CD}{\'I} + \DeclareUnicodeCharacter{00CE}{\^I} + \DeclareUnicodeCharacter{00CF}{\"I} + + \DeclareUnicodeCharacter{00D0}{\DH} + \DeclareUnicodeCharacter{00D1}{\~N} + \DeclareUnicodeCharacter{00D2}{\`O} + \DeclareUnicodeCharacter{00D3}{\'O} + \DeclareUnicodeCharacter{00D4}{\^O} + \DeclareUnicodeCharacter{00D5}{\~O} + \DeclareUnicodeCharacter{00D6}{\"O} + \DeclareUnicodeCharacter{00D8}{\O} + \DeclareUnicodeCharacter{00D9}{\`U} + \DeclareUnicodeCharacter{00DA}{\'U} + \DeclareUnicodeCharacter{00DB}{\^U} + \DeclareUnicodeCharacter{00DC}{\"U} + \DeclareUnicodeCharacter{00DD}{\'Y} + \DeclareUnicodeCharacter{00DE}{\TH} + \DeclareUnicodeCharacter{00DF}{\ss} + + \DeclareUnicodeCharacter{00E0}{\`a} + \DeclareUnicodeCharacter{00E1}{\'a} + \DeclareUnicodeCharacter{00E2}{\^a} + \DeclareUnicodeCharacter{00E3}{\~a} + \DeclareUnicodeCharacter{00E4}{\"a} + \DeclareUnicodeCharacter{00E5}{\aa} + \DeclareUnicodeCharacter{00E6}{\ae} + \DeclareUnicodeCharacter{00E7}{\cedilla{c}} + \DeclareUnicodeCharacter{00E8}{\`e} + \DeclareUnicodeCharacter{00E9}{\'e} + \DeclareUnicodeCharacter{00EA}{\^e} + \DeclareUnicodeCharacter{00EB}{\"e} + \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}} + \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}} + \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}} + \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}} + + \DeclareUnicodeCharacter{00F0}{\dh} + \DeclareUnicodeCharacter{00F1}{\~n} + \DeclareUnicodeCharacter{00F2}{\`o} + \DeclareUnicodeCharacter{00F3}{\'o} + \DeclareUnicodeCharacter{00F4}{\^o} + \DeclareUnicodeCharacter{00F5}{\~o} + \DeclareUnicodeCharacter{00F6}{\"o} + \DeclareUnicodeCharacter{00F8}{\o} + \DeclareUnicodeCharacter{00F9}{\`u} + \DeclareUnicodeCharacter{00FA}{\'u} + \DeclareUnicodeCharacter{00FB}{\^u} + \DeclareUnicodeCharacter{00FC}{\"u} + \DeclareUnicodeCharacter{00FD}{\'y} + \DeclareUnicodeCharacter{00FE}{\th} + \DeclareUnicodeCharacter{00FF}{\"y} + + \DeclareUnicodeCharacter{0100}{\=A} + \DeclareUnicodeCharacter{0101}{\=a} + \DeclareUnicodeCharacter{0102}{\u{A}} + \DeclareUnicodeCharacter{0103}{\u{a}} + \DeclareUnicodeCharacter{0104}{\ogonek{A}} + \DeclareUnicodeCharacter{0105}{\ogonek{a}} + \DeclareUnicodeCharacter{0106}{\'C} + \DeclareUnicodeCharacter{0107}{\'c} + \DeclareUnicodeCharacter{0108}{\^C} + \DeclareUnicodeCharacter{0109}{\^c} + \DeclareUnicodeCharacter{0118}{\ogonek{E}} + \DeclareUnicodeCharacter{0119}{\ogonek{e}} + \DeclareUnicodeCharacter{010A}{\dotaccent{C}} + \DeclareUnicodeCharacter{010B}{\dotaccent{c}} + \DeclareUnicodeCharacter{010C}{\v{C}} + \DeclareUnicodeCharacter{010D}{\v{c}} + \DeclareUnicodeCharacter{010E}{\v{D}} + + \DeclareUnicodeCharacter{0112}{\=E} + \DeclareUnicodeCharacter{0113}{\=e} + \DeclareUnicodeCharacter{0114}{\u{E}} + \DeclareUnicodeCharacter{0115}{\u{e}} + \DeclareUnicodeCharacter{0116}{\dotaccent{E}} + \DeclareUnicodeCharacter{0117}{\dotaccent{e}} + \DeclareUnicodeCharacter{011A}{\v{E}} + \DeclareUnicodeCharacter{011B}{\v{e}} + \DeclareUnicodeCharacter{011C}{\^G} + \DeclareUnicodeCharacter{011D}{\^g} + \DeclareUnicodeCharacter{011E}{\u{G}} + \DeclareUnicodeCharacter{011F}{\u{g}} + + \DeclareUnicodeCharacter{0120}{\dotaccent{G}} + \DeclareUnicodeCharacter{0121}{\dotaccent{g}} + \DeclareUnicodeCharacter{0124}{\^H} + \DeclareUnicodeCharacter{0125}{\^h} + \DeclareUnicodeCharacter{0128}{\~I} + \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}} + \DeclareUnicodeCharacter{012A}{\=I} + \DeclareUnicodeCharacter{012B}{\={\dotless{i}}} + \DeclareUnicodeCharacter{012C}{\u{I}} + \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}} + + \DeclareUnicodeCharacter{0130}{\dotaccent{I}} + \DeclareUnicodeCharacter{0131}{\dotless{i}} + \DeclareUnicodeCharacter{0132}{IJ} + \DeclareUnicodeCharacter{0133}{ij} + \DeclareUnicodeCharacter{0134}{\^J} + \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}} + \DeclareUnicodeCharacter{0139}{\'L} + \DeclareUnicodeCharacter{013A}{\'l} + + \DeclareUnicodeCharacter{0141}{\L} + \DeclareUnicodeCharacter{0142}{\l} + \DeclareUnicodeCharacter{0143}{\'N} + \DeclareUnicodeCharacter{0144}{\'n} + \DeclareUnicodeCharacter{0147}{\v{N}} + \DeclareUnicodeCharacter{0148}{\v{n}} + \DeclareUnicodeCharacter{014C}{\=O} + \DeclareUnicodeCharacter{014D}{\=o} + \DeclareUnicodeCharacter{014E}{\u{O}} + \DeclareUnicodeCharacter{014F}{\u{o}} + + \DeclareUnicodeCharacter{0150}{\H{O}} + \DeclareUnicodeCharacter{0151}{\H{o}} + \DeclareUnicodeCharacter{0152}{\OE} + \DeclareUnicodeCharacter{0153}{\oe} + \DeclareUnicodeCharacter{0154}{\'R} + \DeclareUnicodeCharacter{0155}{\'r} + \DeclareUnicodeCharacter{0158}{\v{R}} + \DeclareUnicodeCharacter{0159}{\v{r}} + \DeclareUnicodeCharacter{015A}{\'S} + \DeclareUnicodeCharacter{015B}{\'s} + \DeclareUnicodeCharacter{015C}{\^S} + \DeclareUnicodeCharacter{015D}{\^s} + \DeclareUnicodeCharacter{015E}{\cedilla{S}} + \DeclareUnicodeCharacter{015F}{\cedilla{s}} + + \DeclareUnicodeCharacter{0160}{\v{S}} + \DeclareUnicodeCharacter{0161}{\v{s}} + \DeclareUnicodeCharacter{0162}{\cedilla{t}} + \DeclareUnicodeCharacter{0163}{\cedilla{T}} + \DeclareUnicodeCharacter{0164}{\v{T}} + + \DeclareUnicodeCharacter{0168}{\~U} + \DeclareUnicodeCharacter{0169}{\~u} + \DeclareUnicodeCharacter{016A}{\=U} + \DeclareUnicodeCharacter{016B}{\=u} + \DeclareUnicodeCharacter{016C}{\u{U}} + \DeclareUnicodeCharacter{016D}{\u{u}} + \DeclareUnicodeCharacter{016E}{\ringaccent{U}} + \DeclareUnicodeCharacter{016F}{\ringaccent{u}} + + \DeclareUnicodeCharacter{0170}{\H{U}} + \DeclareUnicodeCharacter{0171}{\H{u}} + \DeclareUnicodeCharacter{0174}{\^W} + \DeclareUnicodeCharacter{0175}{\^w} + \DeclareUnicodeCharacter{0176}{\^Y} + \DeclareUnicodeCharacter{0177}{\^y} + \DeclareUnicodeCharacter{0178}{\"Y} + \DeclareUnicodeCharacter{0179}{\'Z} + \DeclareUnicodeCharacter{017A}{\'z} + \DeclareUnicodeCharacter{017B}{\dotaccent{Z}} + \DeclareUnicodeCharacter{017C}{\dotaccent{z}} + \DeclareUnicodeCharacter{017D}{\v{Z}} + \DeclareUnicodeCharacter{017E}{\v{z}} + + \DeclareUnicodeCharacter{01C4}{D\v{Z}} + \DeclareUnicodeCharacter{01C5}{D\v{z}} + \DeclareUnicodeCharacter{01C6}{d\v{z}} + \DeclareUnicodeCharacter{01C7}{LJ} + \DeclareUnicodeCharacter{01C8}{Lj} + \DeclareUnicodeCharacter{01C9}{lj} + \DeclareUnicodeCharacter{01CA}{NJ} + \DeclareUnicodeCharacter{01CB}{Nj} + \DeclareUnicodeCharacter{01CC}{nj} + \DeclareUnicodeCharacter{01CD}{\v{A}} + \DeclareUnicodeCharacter{01CE}{\v{a}} + \DeclareUnicodeCharacter{01CF}{\v{I}} + + \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}} + \DeclareUnicodeCharacter{01D1}{\v{O}} + \DeclareUnicodeCharacter{01D2}{\v{o}} + \DeclareUnicodeCharacter{01D3}{\v{U}} + \DeclareUnicodeCharacter{01D4}{\v{u}} + + \DeclareUnicodeCharacter{01E2}{\={\AE}} + \DeclareUnicodeCharacter{01E3}{\={\ae}} + \DeclareUnicodeCharacter{01E6}{\v{G}} + \DeclareUnicodeCharacter{01E7}{\v{g}} + \DeclareUnicodeCharacter{01E8}{\v{K}} + \DeclareUnicodeCharacter{01E9}{\v{k}} + + \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}} + \DeclareUnicodeCharacter{01F1}{DZ} + \DeclareUnicodeCharacter{01F2}{Dz} + \DeclareUnicodeCharacter{01F3}{dz} + \DeclareUnicodeCharacter{01F4}{\'G} + \DeclareUnicodeCharacter{01F5}{\'g} + \DeclareUnicodeCharacter{01F8}{\`N} + \DeclareUnicodeCharacter{01F9}{\`n} + \DeclareUnicodeCharacter{01FC}{\'{\AE}} + \DeclareUnicodeCharacter{01FD}{\'{\ae}} + \DeclareUnicodeCharacter{01FE}{\'{\O}} + \DeclareUnicodeCharacter{01FF}{\'{\o}} + + \DeclareUnicodeCharacter{021E}{\v{H}} + \DeclareUnicodeCharacter{021F}{\v{h}} + + \DeclareUnicodeCharacter{0226}{\dotaccent{A}} + \DeclareUnicodeCharacter{0227}{\dotaccent{a}} + \DeclareUnicodeCharacter{0228}{\cedilla{E}} + \DeclareUnicodeCharacter{0229}{\cedilla{e}} + \DeclareUnicodeCharacter{022E}{\dotaccent{O}} + \DeclareUnicodeCharacter{022F}{\dotaccent{o}} + + \DeclareUnicodeCharacter{0232}{\=Y} + \DeclareUnicodeCharacter{0233}{\=y} + \DeclareUnicodeCharacter{0237}{\dotless{j}} + + \DeclareUnicodeCharacter{02DB}{\ogonek{ }} + + \DeclareUnicodeCharacter{1E02}{\dotaccent{B}} + \DeclareUnicodeCharacter{1E03}{\dotaccent{b}} + \DeclareUnicodeCharacter{1E04}{\udotaccent{B}} + \DeclareUnicodeCharacter{1E05}{\udotaccent{b}} + \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}} + \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}} + \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}} + \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}} + \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}} + \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}} + \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}} + \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}} + + \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}} + \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}} + + \DeclareUnicodeCharacter{1E20}{\=G} + \DeclareUnicodeCharacter{1E21}{\=g} + \DeclareUnicodeCharacter{1E22}{\dotaccent{H}} + \DeclareUnicodeCharacter{1E23}{\dotaccent{h}} + \DeclareUnicodeCharacter{1E24}{\udotaccent{H}} + \DeclareUnicodeCharacter{1E25}{\udotaccent{h}} + \DeclareUnicodeCharacter{1E26}{\"H} + \DeclareUnicodeCharacter{1E27}{\"h} + + \DeclareUnicodeCharacter{1E30}{\'K} + \DeclareUnicodeCharacter{1E31}{\'k} + \DeclareUnicodeCharacter{1E32}{\udotaccent{K}} + \DeclareUnicodeCharacter{1E33}{\udotaccent{k}} + \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}} + \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}} + \DeclareUnicodeCharacter{1E36}{\udotaccent{L}} + \DeclareUnicodeCharacter{1E37}{\udotaccent{l}} + \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}} + \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}} + \DeclareUnicodeCharacter{1E3E}{\'M} + \DeclareUnicodeCharacter{1E3F}{\'m} + + \DeclareUnicodeCharacter{1E40}{\dotaccent{M}} + \DeclareUnicodeCharacter{1E41}{\dotaccent{m}} + \DeclareUnicodeCharacter{1E42}{\udotaccent{M}} + \DeclareUnicodeCharacter{1E43}{\udotaccent{m}} + \DeclareUnicodeCharacter{1E44}{\dotaccent{N}} + \DeclareUnicodeCharacter{1E45}{\dotaccent{n}} + \DeclareUnicodeCharacter{1E46}{\udotaccent{N}} + \DeclareUnicodeCharacter{1E47}{\udotaccent{n}} + \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}} + \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}} + + \DeclareUnicodeCharacter{1E54}{\'P} + \DeclareUnicodeCharacter{1E55}{\'p} + \DeclareUnicodeCharacter{1E56}{\dotaccent{P}} + \DeclareUnicodeCharacter{1E57}{\dotaccent{p}} + \DeclareUnicodeCharacter{1E58}{\dotaccent{R}} + \DeclareUnicodeCharacter{1E59}{\dotaccent{r}} + \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}} + \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}} + \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}} + \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}} + + \DeclareUnicodeCharacter{1E60}{\dotaccent{S}} + \DeclareUnicodeCharacter{1E61}{\dotaccent{s}} + \DeclareUnicodeCharacter{1E62}{\udotaccent{S}} + \DeclareUnicodeCharacter{1E63}{\udotaccent{s}} + \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}} + \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}} + \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}} + \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}} + \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}} + \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}} + + \DeclareUnicodeCharacter{1E7C}{\~V} + \DeclareUnicodeCharacter{1E7D}{\~v} + \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}} + \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}} + + \DeclareUnicodeCharacter{1E80}{\`W} + \DeclareUnicodeCharacter{1E81}{\`w} + \DeclareUnicodeCharacter{1E82}{\'W} + \DeclareUnicodeCharacter{1E83}{\'w} + \DeclareUnicodeCharacter{1E84}{\"W} + \DeclareUnicodeCharacter{1E85}{\"w} + \DeclareUnicodeCharacter{1E86}{\dotaccent{W}} + \DeclareUnicodeCharacter{1E87}{\dotaccent{w}} + \DeclareUnicodeCharacter{1E88}{\udotaccent{W}} + \DeclareUnicodeCharacter{1E89}{\udotaccent{w}} + \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}} + \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}} + \DeclareUnicodeCharacter{1E8C}{\"X} + \DeclareUnicodeCharacter{1E8D}{\"x} + \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}} + \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}} + + \DeclareUnicodeCharacter{1E90}{\^Z} + \DeclareUnicodeCharacter{1E91}{\^z} + \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}} + \DeclareUnicodeCharacter{1E93}{\udotaccent{z}} + \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}} + \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}} + \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}} + \DeclareUnicodeCharacter{1E97}{\"t} + \DeclareUnicodeCharacter{1E98}{\ringaccent{w}} + \DeclareUnicodeCharacter{1E99}{\ringaccent{y}} + + \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}} + \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}} + + \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}} + \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}} + \DeclareUnicodeCharacter{1EBC}{\~E} + \DeclareUnicodeCharacter{1EBD}{\~e} + + \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}} + \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}} + \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}} + \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}} + + \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}} + \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}} + + \DeclareUnicodeCharacter{1EF2}{\`Y} + \DeclareUnicodeCharacter{1EF3}{\`y} + \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}} + + \DeclareUnicodeCharacter{1EF8}{\~Y} + \DeclareUnicodeCharacter{1EF9}{\~y} + + \DeclareUnicodeCharacter{2013}{--} + \DeclareUnicodeCharacter{2014}{---} + \DeclareUnicodeCharacter{2018}{\quoteleft} + \DeclareUnicodeCharacter{2019}{\quoteright} + \DeclareUnicodeCharacter{201A}{\quotesinglbase} + \DeclareUnicodeCharacter{201C}{\quotedblleft} + \DeclareUnicodeCharacter{201D}{\quotedblright} + \DeclareUnicodeCharacter{201E}{\quotedblbase} + \DeclareUnicodeCharacter{2022}{\bullet} + \DeclareUnicodeCharacter{2026}{\dots} + \DeclareUnicodeCharacter{2039}{\guilsinglleft} + \DeclareUnicodeCharacter{203A}{\guilsinglright} + \DeclareUnicodeCharacter{20AC}{\euro} + + \DeclareUnicodeCharacter{2192}{\expansion} + \DeclareUnicodeCharacter{21D2}{\result} + + \DeclareUnicodeCharacter{2212}{\minus} + \DeclareUnicodeCharacter{2217}{\point} + \DeclareUnicodeCharacter{2261}{\equiv} +}% end of \utfeightchardefs + + +% US-ASCII character definitions. +\def\asciichardefs{% nothing need be done + \relax +} + +% Make non-ASCII characters printable again for compatibility with +% existing Texinfo documents that may use them, even without declaring a +% document encoding. +% +\setnonasciicharscatcode \other + + +\message{formatting,} + \newdimen\defaultparindent \defaultparindent = 15pt \chapheadingskip = 15pt plus 4pt minus 2pt @@ -6837,10 +9609,10 @@ % Prevent underfull vbox error messages. \vbadness = 10000 -% Don't be so finicky about underfull hboxes, either. -\hbadness = 2000 - -% Following George Bush, just get rid of widows and orphans. +% Don't be very finicky about underfull hboxes, either. +\hbadness = 6666 + +% Following George Bush, get rid of widows and orphans. \widowpenalty=10000 \clubpenalty=10000 @@ -6887,6 +9659,10 @@ \ifpdf \pdfpageheight #7\relax \pdfpagewidth #8\relax + % if we don't reset these, they will remain at "1 true in" of + % whatever layout pdftex was dumped with. + \pdfhorigin = 1 true in + \pdfvorigin = 1 true in \fi % \setleading{\textleading} @@ -6901,7 +9677,7 @@ \textleading = 13.2pt % % If page is nothing but text, make it come out even. - \internalpagesizes{46\baselineskip}{6in}% + \internalpagesizes{607.2pt}{6in}% that's 46 lines {\voffset}{.25in}% {\bindingoffset}{36pt}% {11in}{8.5in}% @@ -6913,7 +9689,7 @@ \textleading = 12pt % \internalpagesizes{7.5in}{5in}% - {\voffset}{.25in}% + {-.2in}{0in}% {\bindingoffset}{16pt}% {9.25in}{7in}% % @@ -6957,7 +9733,7 @@ % \global\normaloffset = -6mm % \global\bindingoffset = 10mm % @end tex - \internalpagesizes{51\baselineskip}{160mm} + \internalpagesizes{673.2pt}{160mm}% that's 51 lines {\voffset}{\hoffset}% {\bindingoffset}{44pt}% {297mm}{210mm}% @@ -7022,7 +9798,7 @@ \parskip = 3pt plus 2pt minus 1pt \setleading{\textleading}% % - \dimen0 = #1 + \dimen0 = #1\relax \advance\dimen0 by \voffset % \dimen2 = \hsize @@ -7041,25 +9817,21 @@ \message{and turning on texinfo input format.} +\def^^L{\par} % remove \outer, so ^L can appear in an @comment + +% DEL is a comment character, in case @c does not suffice. +\catcode`\^^? = 14 + % Define macros to output various characters with catcode for normal text. -\catcode`\"=\other -\catcode`\~=\other -\catcode`\^=\other -\catcode`\_=\other -\catcode`\|=\other -\catcode`\<=\other -\catcode`\>=\other -\catcode`\+=\other -\catcode`\$=\other -\def\normaldoublequote{"} -\def\normaltilde{~} -\def\normalcaret{^} -\def\normalunderscore{_} -\def\normalverticalbar{|} -\def\normalless{<} -\def\normalgreater{>} -\def\normalplus{+} -\def\normaldollar{$}%$ font-lock fix +\catcode`\"=\other \def\normaldoublequote{"} +\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix +\catcode`\+=\other \def\normalplus{+} +\catcode`\<=\other \def\normalless{<} +\catcode`\>=\other \def\normalgreater{>} +\catcode`\^=\other \def\normalcaret{^} +\catcode`\_=\other \def\normalunderscore{_} +\catcode`\|=\other \def\normalverticalbar{|} +\catcode`\~=\other \def\normaltilde{~} % This macro is used to make a character print one way in \tt % (where it can probably be output as-is), and another way in other fonts, @@ -7117,6 +9889,13 @@ % \otherifyactive is called near the end of this file. \def\otherifyactive{\catcode`+=\other \catcode`\_=\other} +% Used sometimes to turn off (effectively) the active characters even after +% parsing them. +\def\turnoffactive{% + \normalturnoffactive + \otherbackslash +} + \catcode`\@=0 % \backslashcurfont outputs one backslash character in current font, @@ -7124,45 +9903,52 @@ \global\chardef\backslashcurfont=`\\ \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work -% \rawbackslash defines an active \ to do \backslashcurfont. -% \otherbackslash defines an active \ to be a literal `\' character with -% catcode other. -{\catcode`\\=\active - @gdef at rawbackslash{@let\=@backslashcurfont} - @gdef at otherbackslash{@let\=@realbackslash} -} - % \realbackslash is an actual character `\' with catcode other, and % \doublebackslash is two of them (for the pdf outlines). {\catcode`\\=\other @gdef at realbackslash{\} @gdef at doublebackslash{\\}} -% \normalbackslash outputs one backslash in fixed width font. -\def\normalbackslash{{\tt\backslashcurfont}} - -\catcode`\\=\active - -% Used sometimes to turn off (effectively) the active characters -% even after parsing them. - at def@turnoffactive{% +% In texinfo, backslash is an active character; it prints the backslash +% in fixed width font. +\catcode`\\=\active % @ for escape char from now on. + +% The story here is that in math mode, the \char of \backslashcurfont +% ends up printing the roman \ from the math symbol font (because \char +% in math mode uses the \mathcode, and plain.tex sets +% \mathcode`\\="026E). It seems better for @backslashchar{} to always +% print a typewriter backslash, hence we use an explicit \mathchar, +% which is the decimal equivalent of "715c (class 7, e.g., use \fam; +% ignored family value; char position "5C). We can't use " for the +% usual hex value because it has already been made active. + at def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} + at let@backslashchar = @normalbackslash % @backslashchar{} is for user documents. + +% On startup, @fixbackslash assigns: +% @let \ = @normalbackslash +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. We switch back and forth between these. + at gdef@rawbackslash{@let\=@backslashcurfont} + at gdef@otherbackslash{@let\=@realbackslash} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. +% + at def@normalturnoffactive{% @let"=@normaldoublequote - @let\=@realbackslash - @let~=@normaltilde + @let$=@normaldollar %$ font-lock fix + @let+=@normalplus + @let<=@normalless + @let>=@normalgreater + @let\=@normalbackslash @let^=@normalcaret @let_=@normalunderscore @let|=@normalverticalbar - @let<=@normalless - @let>=@normalgreater - @let+=@normalplus - @let$=@normaldollar %$ font-lock fix + @let~=@normaltilde + @markupsetuplqdefault + @markupsetuprqdefault @unsepspaces } -% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of -% the literal character `\'. (Thus, \ is not expandable when this is in -% effect.) -% - at def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} - % Make _ and + \other characters, temporarily. % This is canceled by @fixbackslash. @otherifyactive @@ -7175,7 +9961,7 @@ @global at let\ = @eatinput % On the other hand, perhaps the file did not have a `\input texinfo'. Then -% the first `\{ in the file would cause an error. This macro tries to fix +% the first `\' in the file would cause an error. This macro tries to fix % that, assuming it is called before the first `\' could plausibly occur. % Also turn back on active characters that might appear in the input % file name, in case not using a pre-dumped format. @@ -7189,11 +9975,28 @@ % Say @foo, not \foo, in error messages. @escapechar = `@@ +% These (along with & and #) are made active for url-breaking, so need +% active definitions as the normal characters. + at def@normaldot{.} + at def@normalquest{?} + at def@normalslash{/} + % These look ok in all fonts, so just make them not special. - at catcode`@& = @other - at catcode`@# = @other - at catcode`@% = @other - +% @hashchar{} gets its own user-level command, because of #line. + at catcode`@& = @other @def at normalamp{&} + at catcode`@# = @other @def at normalhash{#} + at catcode`@% = @other @def at normalpercent{%} + + at let @hashchar = @normalhash + + at c Finally, make ` and ' active, so that txicodequoteundirected and + at c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we + at c don't make ` and ' active, @code will not get them as active chars. + at c Do this last of all since we use ` in the previous @catcode assignments. + at catcode`@'=@active + at catcode`@`=@active + at markupsetuplqdefault + at markupsetuprqdefault @c Local variables: @c eval: (add-hook 'write-file-hooks 'time-stamp) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 01:07:39 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 19 Mar 2013 01:07:39 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzEwMDUwIC0gRG9j?= =?utf-8?q?ument_DeprecationWarnings_for_URLopener_and_FancyURLopener?= Message-ID: <3ZVF2M5DghzNBV@mail.python.org> http://hg.python.org/cpython/rev/ea76cfff5851 changeset: 82741:ea76cfff5851 branch: 3.3 parent: 82737:9ac6a3871d76 user: Senthil Kumaran date: Mon Mar 18 17:09:50 2013 -0700 summary: #10050 - Document DeprecationWarnings for URLopener and FancyURLopener (msg172874 ) files: Doc/library/urllib.request.rst | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1274,6 +1274,8 @@ .. class:: URLopener(proxies=None, **x509) + .. deprecated:: 3.3 + Base class for opening and reading URLs. Unless you need to support opening objects using schemes other than :file:`http:`, :file:`ftp:`, or :file:`file:`, you probably want to use :class:`FancyURLopener`. @@ -1343,6 +1345,8 @@ .. class:: FancyURLopener(...) + .. deprecated:: 3.3 + :class:`FancyURLopener` subclasses :class:`URLopener` providing default handling for the following HTTP response codes: 301, 302, 303, 307 and 401. For the 30x response codes listed above, the :mailheader:`Location` header is used to fetch -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 01:07:41 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 19 Mar 2013 01:07:41 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_=2310050_=3A_merge_to_default?= Message-ID: <3ZVF2P0v4yzS8n@mail.python.org> http://hg.python.org/cpython/rev/d4cbd9e2e1cb changeset: 82742:d4cbd9e2e1cb parent: 82739:f86d46a580d8 parent: 82741:ea76cfff5851 user: Senthil Kumaran date: Mon Mar 18 17:10:45 2013 -0700 summary: #10050 : merge to default files: Doc/library/urllib.request.rst | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1306,6 +1306,8 @@ .. class:: URLopener(proxies=None, **x509) + .. deprecated:: 3.3 + Base class for opening and reading URLs. Unless you need to support opening objects using schemes other than :file:`http:`, :file:`ftp:`, or :file:`file:`, you probably want to use :class:`FancyURLopener`. @@ -1375,6 +1377,8 @@ .. class:: FancyURLopener(...) + .. deprecated:: 3.3 + :class:`FancyURLopener` subclasses :class:`URLopener` providing default handling for the following HTTP response codes: 301, 302, 303, 307 and 401. For the 30x response codes listed above, the :mailheader:`Location` header is used to fetch -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 01:50:27 2013 From: python-checkins at python.org (michael.foord) Date: Tue, 19 Mar 2013 01:50:27 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Closes_issue_16709=2E_unit?= =?utf-8?q?test_test_discovery_sorts_test_files_for_consistent?= Message-ID: <3ZVFzl01yrzPY3@mail.python.org> http://hg.python.org/cpython/rev/fe18f16dc2a6 changeset: 82743:fe18f16dc2a6 user: Michael Foord date: Mon Mar 18 17:50:12 2013 -0700 summary: Closes issue 16709. unittest test discovery sorts test files for consistent test ordering files: Doc/library/unittest.rst | 5 +++++ Lib/unittest/loader.py | 5 ++++- Lib/unittest/test/test_discovery.py | 7 +++++-- Misc/NEWS | 3 +++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -1518,6 +1518,11 @@ Modules that raise ``SkipTest`` on import are recorded as skips, not errors. + .. versionchanged:: 3.4 + Paths are sorted before being imported to ensure execution order for a + given test suite is the same even if the underlying file system's ordering + is not dependent on file name like in ext3/4. + The following attributes of a :class:`TestLoader` can be configured either by subclassing or assignment on an instance: diff --git a/Lib/unittest/loader.py b/Lib/unittest/loader.py --- a/Lib/unittest/loader.py +++ b/Lib/unittest/loader.py @@ -177,6 +177,9 @@ The pattern is deliberately not stored as a loader attribute so that packages can continue discovery themselves. top_level_dir is stored so load_tests does not need to pass this argument in to loader.discover(). + + Paths are sorted before being imported to ensure reproducible execution + order even on filesystems with non-alphabetical ordering like ext3/4. """ set_implicit_top = False if top_level_dir is None and self._top_level_dir is not None: @@ -253,7 +256,7 @@ def _find_tests(self, start_dir, pattern): """Used by discovery. Yields test suites it loads.""" - paths = os.listdir(start_dir) + paths = sorted(os.listdir(start_dir)) for path in paths: full_path = os.path.join(start_dir, path) diff --git a/Lib/unittest/test/test_discovery.py b/Lib/unittest/test/test_discovery.py --- a/Lib/unittest/test/test_discovery.py +++ b/Lib/unittest/test/test_discovery.py @@ -46,9 +46,9 @@ def restore_isdir(): os.path.isdir = original_isdir - path_lists = [['test1.py', 'test2.py', 'not_a_test.py', 'test_dir', + path_lists = [['test2.py', 'test1.py', 'not_a_test.py', 'test_dir', 'test.foo', 'test-not-a-module.py', 'another_dir'], - ['test3.py', 'test4.py', ]] + ['test4.py', 'test3.py', ]] os.listdir = lambda path: path_lists.pop(0) self.addCleanup(restore_listdir) @@ -70,6 +70,8 @@ loader._top_level_dir = top_level suite = list(loader._find_tests(top_level, 'test*.py')) + # The test suites found should be sorted alphabetically for reliable + # execution order. expected = [name + ' module tests' for name in ('test1', 'test2')] expected.extend([('test_dir.%s' % name) + ' module tests' for name in @@ -132,6 +134,7 @@ # and directly from the test_directory2 package self.assertEqual(suite, ['load_tests', 'test_directory2' + ' module tests']) + # The test module paths should be sorted for reliable execution order self.assertEqual(Module.paths, ['test_directory', 'test_directory2']) # load_tests should have been called once with loader, tests and pattern diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -289,6 +289,9 @@ Library ------- +- Issue #16709: unittest discover order is no-longer filesystem specific. Patch + by Jeff Ramnani. + - Issue #5024: sndhdr.whichhdr now returns the frame count for WAV files rather than -1. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 02:02:54 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 19 Mar 2013 02:02:54 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=2317474_-_Remove_the_vari?= =?utf-8?q?ous_deprecated_methods_of_Request_class=2E?= Message-ID: <3ZVGG623ggzSBY@mail.python.org> http://hg.python.org/cpython/rev/b5980b1171d0 changeset: 82744:b5980b1171d0 user: Senthil Kumaran date: Mon Mar 18 18:06:00 2013 -0700 summary: #17474 - Remove the various deprecated methods of Request class. files: Doc/library/urllib.request.rst | 69 ---------------------- Lib/test/test_urllib2.py | 21 ------ Lib/urllib/request.py | 44 -------------- Misc/NEWS | 2 + 4 files changed, 2 insertions(+), 134 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -488,54 +488,6 @@ URL given in the constructor. -.. method:: Request.add_data(data) - - Set the :class:`Request` data to *data*. This is ignored by all handlers except - HTTP handlers --- and there it should be a byte string, and will change the - request to be ``POST`` rather than ``GET``. Deprecated in 3.3, use - :attr:`Request.data`. - - .. deprecated:: 3.3 - - -.. method:: Request.has_data() - - Return whether the instance has a non-\ ``None`` data. Deprecated in 3.3, - use :attr:`Request.data`. - - .. deprecated:: 3.3 - - -.. method:: Request.get_data() - - Return the instance's data. Deprecated in 3.3, use :attr:`Request.data`. - - .. deprecated:: 3.3 - - -.. method:: Request.get_type() - - Return the type of the URL --- also known as the scheme. Deprecated in 3.3, - use :attr:`Request.type`. - - .. deprecated:: 3.3 - - -.. method:: Request.get_host() - - Return the host to which a connection will be made. Deprecated in 3.3, use - :attr:`Request.host`. - - .. deprecated:: 3.3 - - -.. method:: Request.get_selector() - - Return the selector --- the part of the URL that is sent to the server. - Deprecated in 3.3, use :attr:`Request.selector`. - - .. deprecated:: 3.3 - .. method:: Request.get_header(header_name, default=None) Return the value of the given header. If the header is not present, return @@ -546,27 +498,6 @@ Return a list of tuples (header_name, header_value) of the Request headers. - -.. method:: Request.set_proxy(host, type) - -.. method:: Request.get_origin_req_host() - - Return the request-host of the origin transaction, as defined by - :rfc:`2965`. See the documentation for the :class:`Request` constructor. - Deprecated in 3.3, use :attr:`Request.origin_req_host`. - - .. deprecated:: 3.3 - - -.. method:: Request.is_unverifiable() - - Return whether the request is unverifiable, as defined by RFC 2965. See the - documentation for the :class:`Request` constructor. Deprecated in 3.3, use - :attr:`Request.unverifiable`. - - .. deprecated:: 3.3 - - .. _opener-director-objects: OpenerDirector Objects diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -630,27 +630,6 @@ self.assertTrue(args[1] is None or isinstance(args[1], MockResponse)) - def test_method_deprecations(self): - req = Request("http://www.example.com") - - with self.assertWarns(DeprecationWarning): - req.add_data("data") - with self.assertWarns(DeprecationWarning): - req.get_data() - with self.assertWarns(DeprecationWarning): - req.has_data() - with self.assertWarns(DeprecationWarning): - req.get_host() - with self.assertWarns(DeprecationWarning): - req.get_selector() - with self.assertWarns(DeprecationWarning): - req.is_unverifiable() - with self.assertWarns(DeprecationWarning): - req.get_origin_req_host() - with self.assertWarns(DeprecationWarning): - req.get_type() - - def sanepathname2url(path): try: path.encode("utf-8") diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -321,50 +321,6 @@ else: return self.full_url - # Begin deprecated methods - - def add_data(self, data): - msg = "Request.add_data method is deprecated." - warnings.warn(msg, DeprecationWarning, stacklevel=1) - self.data = data - - def has_data(self): - msg = "Request.has_data method is deprecated." - warnings.warn(msg, DeprecationWarning, stacklevel=1) - return self.data is not None - - def get_data(self): - msg = "Request.get_data method is deprecated." - warnings.warn(msg, DeprecationWarning, stacklevel=1) - return self.data - - def get_type(self): - msg = "Request.get_type method is deprecated." - warnings.warn(msg, DeprecationWarning, stacklevel=1) - return self.type - - def get_host(self): - msg = "Request.get_host method is deprecated." - warnings.warn(msg, DeprecationWarning, stacklevel=1) - return self.host - - def get_selector(self): - msg = "Request.get_selector method is deprecated." - warnings.warn(msg, DeprecationWarning, stacklevel=1) - return self.selector - - def is_unverifiable(self): - msg = "Request.is_unverifiable method is deprecated." - warnings.warn(msg, DeprecationWarning, stacklevel=1) - return self.unverifiable - - def get_origin_req_host(self): - msg = "Request.get_origin_req_host method is deprecated." - warnings.warn(msg, DeprecationWarning, stacklevel=1) - return self.origin_req_host - - # End deprecated methods - def set_proxy(self, host, type): if self.type == 'https' and not self._tunnel_host: self._tunnel_host = self.host diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -289,6 +289,8 @@ Library ------- +- Issue #17474: Remove the deprecated methods of Request class. + - Issue #16709: unittest discover order is no-longer filesystem specific. Patch by Jeff Ramnani. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 05:04:07 2013 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Mar 2013 05:04:07 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=2317464=3A_improve_pydoc_?= =?utf-8?q?test_coverage=2E?= Message-ID: <3ZVLHC03GXzQn6@mail.python.org> http://hg.python.org/cpython/rev/474f078ec958 changeset: 82745:474f078ec958 user: R David Murray date: Tue Mar 19 00:00:33 2013 -0400 summary: #17464: improve pydoc test coverage. Patch by Matt Bachmann. files: Lib/test/test_pydoc.py | 25 +++++++++++++++++++++++++ Misc/ACKS | 2 +- 2 files changed, 26 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -395,6 +395,31 @@ synopsis = pydoc.synopsis(TESTFN, {}) self.assertEqual(synopsis, 'line 1: h\xe9') + def test_splitdoc_with_description(self): + example_string = "I Am A Doc\n\n\nHere is my description" + self.assertEqual(pydoc.splitdoc(example_string), + ('I Am A Doc', '\nHere is my description')) + + def test_is_object_or_method(self): + doc = pydoc.Doc() + # Bound Method + self.assertTrue(pydoc._is_some_method(doc.fail)) + # Method Descriptor + self.assertTrue(pydoc._is_some_method(int.__add__)) + # String + self.assertFalse(pydoc._is_some_method("I am not a method")) + + def test_is_package_when_not_package(self): + with test.support.temp_cwd() as test_dir: + self.assertFalse(pydoc.ispackage(test_dir)) + + def test_is_package_when_is_package(self): + with test.support.temp_cwd() as test_dir: + init_path = os.path.join(test_dir, '__init__.py') + open(init_path, 'w').close() + self.assertTrue(pydoc.ispackage(test_dir)) + os.remove(init_path) + class PydocImportTest(unittest.TestCase): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -56,6 +56,7 @@ Donovan Baarda Arne Babenhauserheide Attila Babo +Matt Bachmann Marcin Bachry Alfonso Baciero Dwayne Bailey @@ -1364,4 +1365,3 @@ Kai Zhu Tarek Ziad? Peter ?strand - -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Tue Mar 19 06:40:30 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 19 Mar 2013 06:40:30 +0100 Subject: [Python-checkins] Daily reference leaks (b5980b1171d0): sum=1824552 Message-ID: results for b5980b1171d0 on branch "default" -------------------------------------------- test_builtin leaked [444, 444, 444] references, sum=1332 test_builtin leaked [124, 126, 126] memory blocks, sum=376 test_unittest leaked [-1, 1, 2] memory blocks, sum=2 test_ast leaked [471148, 471148, 471148] references, sum=1413444 test_ast leaked [134195, 134197, 134197] memory blocks, sum=402589 test_compile leaked [1837, 1837, 1837] references, sum=5511 test_compile leaked [430, 432, 432] memory blocks, sum=1294 test_httplib leaked [-1, 1, 0] references, sum=0 test_httplib leaked [-1, 3, 2] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogTqw5h6', '-x'] From python-checkins at python.org Tue Mar 19 07:28:14 2013 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 19 Mar 2013 07:28:14 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_sprinkle_const?= Message-ID: <3ZVPTV1p5zzRDf@mail.python.org> http://hg.python.org/cpython/rev/6c0fca49b0fd changeset: 82746:6c0fca49b0fd parent: 82744:b5980b1171d0 user: Benjamin Peterson date: Mon Mar 18 23:13:31 2013 -0700 summary: sprinkle const files: Python/import.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -846,7 +846,7 @@ /* Forward */ -static struct _frozen * find_frozen(PyObject *); +static const struct _frozen * find_frozen(PyObject *); /* Helper to test for built-in module */ @@ -983,10 +983,10 @@ /* Frozen modules */ -static struct _frozen * +static const struct _frozen * find_frozen(PyObject *name) { - struct _frozen *p; + const struct _frozen *p; if (name == NULL) return NULL; @@ -1003,7 +1003,7 @@ static PyObject * get_frozen_object(PyObject *name) { - struct _frozen *p = find_frozen(name); + const struct _frozen *p = find_frozen(name); int size; if (p == NULL) { @@ -1027,7 +1027,7 @@ static PyObject * is_frozen_package(PyObject *name) { - struct _frozen *p = find_frozen(name); + const struct _frozen *p = find_frozen(name); int size; if (p == NULL) { @@ -1054,7 +1054,7 @@ int PyImport_ImportFrozenModuleObject(PyObject *name) { - struct _frozen *p; + const struct _frozen *p; PyObject *co, *m, *path; int ispackage; int size; @@ -1781,7 +1781,7 @@ imp_is_frozen(PyObject *self, PyObject *args) { PyObject *name; - struct _frozen *p; + const struct _frozen *p; if (!PyArg_ParseTuple(args, "U:is_frozen", &name)) return NULL; p = find_frozen(name); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 07:28:15 2013 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 19 Mar 2013 07:28:15 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_refactor_to_fix_refleaks?= Message-ID: <3ZVPTW67FGzRH5@mail.python.org> http://hg.python.org/cpython/rev/c8ccc0519247 changeset: 82747:c8ccc0519247 user: Benjamin Peterson date: Mon Mar 18 23:24:41 2013 -0700 summary: refactor to fix refleaks files: Parser/asdl_c.py | 20 ++++++++-- Python/Python-ast.c | 56 ++++++++++++++++++++------------ 2 files changed, 49 insertions(+), 27 deletions(-) diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -499,12 +499,10 @@ def visitField(self, field, name, sum=None, prod=None, depth=0): ctype = get_c_type(field.type) if field.opt: - add_check = " && _PyObject_GetAttrId(obj, &PyId_%s) != Py_None" \ - % (field.name) + check = "exists_not_none(obj, &PyId_%s)" % (field.name,) else: - add_check = str() - self.emit("if (_PyObject_HasAttrId(obj, &PyId_%s)%s) {" - % (field.name, add_check), depth, reflow=False) + check = "_PyObject_HasAttrId(obj, &PyId_%s)" % (field.name,) + self.emit("if (%s) {" % (check,), depth, reflow=False) self.emit("int res;", depth+1) if field.seq: self.emit("Py_ssize_t len;", depth+1) @@ -931,6 +929,18 @@ return 0; } +static int exists_not_none(PyObject *obj, _Py_Identifier *id) +{ + PyObject *attr = _PyObject_GetAttrId(obj, id); + if (!attr) { + PyErr_Clear(); + return 0; + } + int isnone = attr == Py_None; + Py_DECREF(attr); + return !isnone; +} + """, 0, reflow=False) self.emit("static int init_types(void)",0) diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -770,6 +770,18 @@ return 0; } +static int exists_not_none(PyObject *obj, _Py_Identifier *id) +{ + PyObject *attr = _PyObject_GetAttrId(obj, id); + if (!attr) { + PyErr_Clear(); + return 0; + } + int isnone = attr == Py_None; + Py_DECREF(attr); + return !isnone; +} + static int init_types(void) { @@ -3846,7 +3858,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"decorator_list\" missing from FunctionDef"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_returns) && _PyObject_GetAttrId(obj, &PyId_returns) != Py_None) { + if (exists_not_none(obj, &PyId_returns)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_returns); if (tmp == NULL) goto failed; @@ -3937,7 +3949,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"keywords\" missing from ClassDef"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_starargs) && _PyObject_GetAttrId(obj, &PyId_starargs) != Py_None) { + if (exists_not_none(obj, &PyId_starargs)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_starargs); if (tmp == NULL) goto failed; @@ -3948,7 +3960,7 @@ } else { starargs = NULL; } - if (_PyObject_HasAttrId(obj, &PyId_kwargs) && _PyObject_GetAttrId(obj, &PyId_kwargs) != Py_None) { + if (exists_not_none(obj, &PyId_kwargs)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_kwargs); if (tmp == NULL) goto failed; @@ -4021,7 +4033,7 @@ if (isinstance) { expr_ty value; - if (_PyObject_HasAttrId(obj, &PyId_value) && _PyObject_GetAttrId(obj, &PyId_value) != Py_None) { + if (exists_not_none(obj, &PyId_value)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_value); if (tmp == NULL) goto failed; @@ -4479,7 +4491,7 @@ expr_ty exc; expr_ty cause; - if (_PyObject_HasAttrId(obj, &PyId_exc) && _PyObject_GetAttrId(obj, &PyId_exc) != Py_None) { + if (exists_not_none(obj, &PyId_exc)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_exc); if (tmp == NULL) goto failed; @@ -4490,7 +4502,7 @@ } else { exc = NULL; } - if (_PyObject_HasAttrId(obj, &PyId_cause) && _PyObject_GetAttrId(obj, &PyId_cause) != Py_None) { + if (exists_not_none(obj, &PyId_cause)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_cause); if (tmp == NULL) goto failed; @@ -4640,7 +4652,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from Assert"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_msg) && _PyObject_GetAttrId(obj, &PyId_msg) != Py_None) { + if (exists_not_none(obj, &PyId_msg)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_msg); if (tmp == NULL) goto failed; @@ -4700,7 +4712,7 @@ asdl_seq* names; int level; - if (_PyObject_HasAttrId(obj, &PyId_module) && _PyObject_GetAttrId(obj, &PyId_module) != Py_None) { + if (exists_not_none(obj, &PyId_module)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_module); if (tmp == NULL) goto failed; @@ -4736,7 +4748,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from ImportFrom"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_level) && _PyObject_GetAttrId(obj, &PyId_level) != Py_None) { + if (exists_not_none(obj, &PyId_level)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_level); if (tmp == NULL) goto failed; @@ -5455,7 +5467,7 @@ if (isinstance) { expr_ty value; - if (_PyObject_HasAttrId(obj, &PyId_value) && _PyObject_GetAttrId(obj, &PyId_value) != Py_None) { + if (exists_not_none(obj, &PyId_value)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_value); if (tmp == NULL) goto failed; @@ -5642,7 +5654,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"keywords\" missing from Call"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_starargs) && _PyObject_GetAttrId(obj, &PyId_starargs) != Py_None) { + if (exists_not_none(obj, &PyId_starargs)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_starargs); if (tmp == NULL) goto failed; @@ -5653,7 +5665,7 @@ } else { starargs = NULL; } - if (_PyObject_HasAttrId(obj, &PyId_kwargs) && _PyObject_GetAttrId(obj, &PyId_kwargs) != Py_None) { + if (exists_not_none(obj, &PyId_kwargs)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_kwargs); if (tmp == NULL) goto failed; @@ -6124,7 +6136,7 @@ expr_ty upper; expr_ty step; - if (_PyObject_HasAttrId(obj, &PyId_lower) && _PyObject_GetAttrId(obj, &PyId_lower) != Py_None) { + if (exists_not_none(obj, &PyId_lower)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_lower); if (tmp == NULL) goto failed; @@ -6135,7 +6147,7 @@ } else { lower = NULL; } - if (_PyObject_HasAttrId(obj, &PyId_upper) && _PyObject_GetAttrId(obj, &PyId_upper) != Py_None) { + if (exists_not_none(obj, &PyId_upper)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_upper); if (tmp == NULL) goto failed; @@ -6146,7 +6158,7 @@ } else { upper = NULL; } - if (_PyObject_HasAttrId(obj, &PyId_step) && _PyObject_GetAttrId(obj, &PyId_step) != Py_None) { + if (exists_not_none(obj, &PyId_step)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_step); if (tmp == NULL) goto failed; @@ -6601,7 +6613,7 @@ identifier name; asdl_seq* body; - if (_PyObject_HasAttrId(obj, &PyId_type) && _PyObject_GetAttrId(obj, &PyId_type) != Py_None) { + if (exists_not_none(obj, &PyId_type)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_type); if (tmp == NULL) goto failed; @@ -6612,7 +6624,7 @@ } else { type = NULL; } - if (_PyObject_HasAttrId(obj, &PyId_name) && _PyObject_GetAttrId(obj, &PyId_name) != Py_None) { + if (exists_not_none(obj, &PyId_name)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_name); if (tmp == NULL) goto failed; @@ -6696,7 +6708,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from arguments"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_vararg) && _PyObject_GetAttrId(obj, &PyId_vararg) != Py_None) { + if (exists_not_none(obj, &PyId_vararg)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_vararg); if (tmp == NULL) goto failed; @@ -6757,7 +6769,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"kw_defaults\" missing from arguments"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_kwarg) && _PyObject_GetAttrId(obj, &PyId_kwarg) != Py_None) { + if (exists_not_none(obj, &PyId_kwarg)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_kwarg); if (tmp == NULL) goto failed; @@ -6820,7 +6832,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"arg\" missing from arg"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_annotation) && _PyObject_GetAttrId(obj, &PyId_annotation) != Py_None) { + if (exists_not_none(obj, &PyId_annotation)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_annotation); if (tmp == NULL) goto failed; @@ -6895,7 +6907,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from alias"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_asname) && _PyObject_GetAttrId(obj, &PyId_asname) != Py_None) { + if (exists_not_none(obj, &PyId_asname)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_asname); if (tmp == NULL) goto failed; @@ -6932,7 +6944,7 @@ PyErr_SetString(PyExc_TypeError, "required field \"context_expr\" missing from withitem"); return 1; } - if (_PyObject_HasAttrId(obj, &PyId_optional_vars) && _PyObject_GetAttrId(obj, &PyId_optional_vars) != Py_None) { + if (exists_not_none(obj, &PyId_optional_vars)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_optional_vars); if (tmp == NULL) goto failed; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 07:28:17 2013 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 19 Mar 2013 07:28:17 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_merge_heads?= Message-ID: <3ZVPTY1qlkzS7x@mail.python.org> http://hg.python.org/cpython/rev/dec387dcdda3 changeset: 82748:dec387dcdda3 parent: 82747:c8ccc0519247 parent: 82745:474f078ec958 user: Benjamin Peterson date: Mon Mar 18 23:28:07 2013 -0700 summary: merge heads files: Lib/test/test_pydoc.py | 25 +++++++++++++++++++++++++ Misc/ACKS | 2 +- 2 files changed, 26 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -395,6 +395,31 @@ synopsis = pydoc.synopsis(TESTFN, {}) self.assertEqual(synopsis, 'line 1: h\xe9') + def test_splitdoc_with_description(self): + example_string = "I Am A Doc\n\n\nHere is my description" + self.assertEqual(pydoc.splitdoc(example_string), + ('I Am A Doc', '\nHere is my description')) + + def test_is_object_or_method(self): + doc = pydoc.Doc() + # Bound Method + self.assertTrue(pydoc._is_some_method(doc.fail)) + # Method Descriptor + self.assertTrue(pydoc._is_some_method(int.__add__)) + # String + self.assertFalse(pydoc._is_some_method("I am not a method")) + + def test_is_package_when_not_package(self): + with test.support.temp_cwd() as test_dir: + self.assertFalse(pydoc.ispackage(test_dir)) + + def test_is_package_when_is_package(self): + with test.support.temp_cwd() as test_dir: + init_path = os.path.join(test_dir, '__init__.py') + open(init_path, 'w').close() + self.assertTrue(pydoc.ispackage(test_dir)) + os.remove(init_path) + class PydocImportTest(unittest.TestCase): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -56,6 +56,7 @@ Donovan Baarda Arne Babenhauserheide Attila Babo +Matt Bachmann Marcin Bachry Alfonso Baciero Dwayne Bailey @@ -1364,4 +1365,3 @@ Kai Zhu Tarek Ziad? Peter ?strand - -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 07:40:01 2013 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 19 Mar 2013 07:40:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_placate_msvc?= Message-ID: <3ZVPl51jB8zRFQ@mail.python.org> http://hg.python.org/cpython/rev/8e44c9a254ce changeset: 82749:8e44c9a254ce user: Benjamin Peterson date: Mon Mar 18 23:39:53 2013 -0700 summary: placate msvc files: Parser/asdl_c.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -931,12 +931,13 @@ static int exists_not_none(PyObject *obj, _Py_Identifier *id) { + int isnone; PyObject *attr = _PyObject_GetAttrId(obj, id); if (!attr) { PyErr_Clear(); return 0; } - int isnone = attr == Py_None; + isnone = attr == Py_None; Py_DECREF(attr); return !isnone; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 07:41:02 2013 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 19 Mar 2013 07:41:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_bump_Python-ast=2Ec?= Message-ID: <3ZVPmG4LrmzRH5@mail.python.org> http://hg.python.org/cpython/rev/cc7a94efb1b7 changeset: 82750:cc7a94efb1b7 user: Benjamin Peterson date: Mon Mar 18 23:40:53 2013 -0700 summary: bump Python-ast.c files: Python/Python-ast.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -772,12 +772,13 @@ static int exists_not_none(PyObject *obj, _Py_Identifier *id) { + int isnone; PyObject *attr = _PyObject_GetAttrId(obj, id); if (!attr) { PyErr_Clear(); return 0; } - int isnone = attr == Py_None; + isnone = attr == Py_None; Py_DECREF(attr); return !isnone; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 07:48:01 2013 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Mar 2013 07:48:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3NDc2OiBtYWtl?= =?utf-8?q?_allmethods_actually_return_all_methods=2E?= Message-ID: <3ZVPwK6H9PzP8p@mail.python.org> http://hg.python.org/cpython/rev/0a9b42de49d5 changeset: 82751:0a9b42de49d5 branch: 3.2 parent: 82725:114e363ebf83 user: R David Murray date: Tue Mar 19 02:31:06 2013 -0400 summary: #17476: make allmethods actually return all methods. This fixes a regression relative to Python2. (In 2, methods on a class were unbound methods and matched the inspect queries being done, in 3 they are just functions and so were missed). This is an undocumented function that pydoc itself does not use, but I found that numpy at least uses it in its documentation generator. Original patch by Matt Bachmann. files: Lib/pydoc.py | 5 ++++- Lib/test/test_pydoc.py | 24 ++++++++++++++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 31 insertions(+), 1 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -137,7 +137,10 @@ return _re_stripid.sub(r'\1', text) def _is_some_method(obj): - return inspect.ismethod(obj) or inspect.ismethoddescriptor(obj) + return (inspect.isfunction(obj) or + inspect.ismethod(obj) or + inspect.isbuiltin(obj) or + inspect.ismethoddescriptor(obj)) def allmethods(cl): methods = {} diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -389,6 +389,30 @@ synopsis = pydoc.synopsis(TESTFN, {}) self.assertEqual(synopsis, 'line 1: h\xe9') + def test_allmethods(self): + # issue 17476: allmethods was no longer returning unbound methods. + # This test is a bit fragile in the face of changes to object and type, + # but I can't think of a better way to do it without duplicating the + # logic of the function under test. + + class TestClass(object): + def method_returning_true(self): + return True + + # What we expect to get back: everything on object... + expected = dict(vars(object)) + # ...plus our unbound method... + expected['method_returning_true'] = TestClass.method_returning_true + # ...but not the non-methods on object. + del expected['__doc__'] + del expected['__class__'] + # inspect resolves descriptors on type into methods, but vars doesn't, + # so we need to update __subclasshook__. + expected['__subclasshook__'] = TestClass.__subclasshook__ + + methods = pydoc.allmethods(TestClass) + self.assertDictEqual(methods, expected) + class PydocImportTest(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,6 +233,9 @@ Library ------- +- Issue #17476: Fixed regression relative to Python2 in undocumented pydoc + 'allmethods'; it was missing unbound methods on the class. + - Issue #16389: Fixed a performance regression relative to Python 3.1 in the caching of compiled regular expressions. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 07:48:03 2013 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Mar 2013 07:48:03 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2317476=3A_make_allmethods_actually_return_all_methods=2E?= Message-ID: <3ZVPwM2RqBzS7x@mail.python.org> http://hg.python.org/cpython/rev/7127fbc363bb changeset: 82752:7127fbc363bb branch: 3.3 parent: 82741:ea76cfff5851 parent: 82751:0a9b42de49d5 user: R David Murray date: Tue Mar 19 02:32:35 2013 -0400 summary: #17476: make allmethods actually return all methods. This fixes a regression relative to Python2. (In 2, methods on a class were unbound methods and matched the inspect queries being done, in 3 they are just functions and so were missed). This is an undocumented function that pydoc itself does not use, but I found that numpy at least uses it in its documentation generator. Original patch by Matt Bachmann. files: Lib/pydoc.py | 5 ++++- Lib/test/test_pydoc.py | 24 ++++++++++++++++++++++++ Misc/NEWS | 5 ++++- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -132,7 +132,10 @@ return _re_stripid.sub(r'\1', text) def _is_some_method(obj): - return inspect.ismethod(obj) or inspect.ismethoddescriptor(obj) + return (inspect.isfunction(obj) or + inspect.ismethod(obj) or + inspect.isbuiltin(obj) or + inspect.ismethoddescriptor(obj)) def allmethods(cl): methods = {} diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -395,6 +395,30 @@ synopsis = pydoc.synopsis(TESTFN, {}) self.assertEqual(synopsis, 'line 1: h\xe9') + def test_allmethods(self): + # issue 17476: allmethods was no longer returning unbound methods. + # This test is a bit fragile in the face of changes to object and type, + # but I can't think of a better way to do it without duplicating the + # logic of the function under test. + + class TestClass(object): + def method_returning_true(self): + return True + + # What we expect to get back: everything on object... + expected = dict(vars(object)) + # ...plus our unbound method... + expected['method_returning_true'] = TestClass.method_returning_true + # ...but not the non-methods on object. + del expected['__doc__'] + del expected['__class__'] + # inspect resolves descriptors on type into methods, but vars doesn't, + # so we need to update __subclasshook__. + expected['__subclasshook__'] = TestClass.__subclasshook__ + + methods = pydoc.allmethods(TestClass) + self.assertDictEqual(methods, expected) + class PydocImportTest(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -193,7 +193,10 @@ Library ------- -Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. +- Issue #17476: Fixed regression relative to Python2 in undocumented pydoc + 'allmethods'; it was missing unbound methods on the class. + +- Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. - Issue #16389: Fixed a performance regression relative to Python 3.1 in the caching of compiled regular expressions. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 07:48:04 2013 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Mar 2013 07:48:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Merge=3A_=2317476=3A_make_?= =?utf-8?q?allmethods_actually_return_all_methods=2E?= Message-ID: <3ZVPwN5GC0zS9X@mail.python.org> http://hg.python.org/cpython/rev/ee1376c15e2e changeset: 82753:ee1376c15e2e parent: 82750:cc7a94efb1b7 user: R David Murray date: Tue Mar 19 02:47:44 2013 -0400 summary: Merge: #17476: make allmethods actually return all methods. This fixes a regression relative to Python2. (In 2, methods on a class were unbound methods and matched the inspect queries being done, in 3 they are just functions and so were missed). This is an undocumented function that pydoc itself does not use, but I found that numpy at least uses it in its documentation generator. Original patch by Matt Bachmann. files: Lib/pydoc.py | 5 ++++- Lib/test/test_pydoc.py | 24 ++++++++++++++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 31 insertions(+), 1 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -132,7 +132,10 @@ return _re_stripid.sub(r'\1', text) def _is_some_method(obj): - return inspect.ismethod(obj) or inspect.ismethoddescriptor(obj) + return (inspect.isfunction(obj) or + inspect.ismethod(obj) or + inspect.isbuiltin(obj) or + inspect.ismethoddescriptor(obj)) def allmethods(cl): methods = {} diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -420,6 +420,30 @@ self.assertTrue(pydoc.ispackage(test_dir)) os.remove(init_path) + def test_allmethods(self): + # issue 17476: allmethods was no longer returning unbound methods. + # This test is a bit fragile in the face of changes to object and type, + # but I can't think of a better way to do it without duplicating the + # logic of the function under test. + + class TestClass(object): + def method_returning_true(self): + return True + + # What we expect to get back: everything on object... + expected = dict(vars(object)) + # ...plus our unbound method... + expected['method_returning_true'] = TestClass.method_returning_true + # ...but not the non-methods on object. + del expected['__doc__'] + del expected['__class__'] + # inspect resolves descriptors on type into methods, but vars doesn't, + # so we need to update __subclasshook__. + expected['__subclasshook__'] = TestClass.__subclasshook__ + + methods = pydoc.allmethods(TestClass) + self.assertDictEqual(methods, expected) + class PydocImportTest(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -289,6 +289,9 @@ Library ------- +- Issue #17476: Fixed regression relative to Python2 in undocumented pydoc + 'allmethods'; it was missing unbound methods on the class. + - Issue #17474: Remove the deprecated methods of Request class. - Issue #16709: unittest discover order is no-longer filesystem specific. Patch -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 09:13:41 2013 From: python-checkins at python.org (ezio.melotti) Date: Tue, 19 Mar 2013 09:13:41 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Null_merge_7127fbc363bb=2E?= Message-ID: <3ZVRq96ZzqzR65@mail.python.org> http://hg.python.org/cpython/rev/145d78bc00f8 changeset: 82754:145d78bc00f8 parent: 82753:ee1376c15e2e parent: 82752:7127fbc363bb user: Ezio Melotti date: Tue Mar 19 10:13:28 2013 +0200 summary: Null merge 7127fbc363bb. files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 09:20:03 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 19 Mar 2013 09:20:03 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3NDYwIC0gQWRk?= =?utf-8?q?ing_relevant_warning_messages_regarding_strict_removal_in_docs?= Message-ID: <3ZVRyW2QXCzR65@mail.python.org> http://hg.python.org/cpython/rev/ac023b1a23ea changeset: 82755:ac023b1a23ea branch: 3.2 parent: 82751:0a9b42de49d5 user: Senthil Kumaran date: Tue Mar 19 00:51:08 2013 -0700 summary: #17460 - Adding relevant warning messages regarding strict removal in docs files: Doc/library/http.client.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -51,7 +51,7 @@ .. versionchanged:: 3.2 *source_address* was added. - .. versionchanged:: 3.2 + .. deprecated:: 3.2 The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" are not supported anymore. @@ -89,7 +89,7 @@ This class now supports HTTPS virtual hosts if possible (that is, if :data:`ssl.HAS_SNI` is true). - .. versionchanged:: 3.2 + .. deprecated:: 3.2 The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" are not supported anymore. @@ -99,7 +99,7 @@ Class whose instances are returned upon successful connection. Not instantiated directly by user. - .. versionchanged:: 3.2 + .. deprecated:: 3.2 The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" are not supported anymore. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 09:20:04 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 19 Mar 2013 09:20:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2317460_-_merge_from_3=2E2?= Message-ID: <3ZVRyX5XYXzS4j@mail.python.org> http://hg.python.org/cpython/rev/f4e966570416 changeset: 82756:f4e966570416 branch: 3.3 parent: 82752:7127fbc363bb parent: 82755:ac023b1a23ea user: Senthil Kumaran date: Tue Mar 19 00:58:46 2013 -0700 summary: #17460 - merge from 3.2 files: Doc/library/http.client.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -51,7 +51,7 @@ .. versionchanged:: 3.2 *source_address* was added. - .. versionchanged:: 3.2 + .. deprecated-removed:: 3.2 3.4 The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" are not supported anymore. @@ -89,7 +89,7 @@ This class now supports HTTPS virtual hosts if possible (that is, if :data:`ssl.HAS_SNI` is true). - .. versionchanged:: 3.2 + .. deprecated-removed:: 3.2 3.4 The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" are not supported anymore. @@ -99,7 +99,7 @@ Class whose instances are returned upon successful connection. Not instantiated directly by user. - .. versionchanged:: 3.2 + .. deprecated-removed:: 3.2 3.4 The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" are not supported anymore. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 09:20:06 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 19 Mar 2013 09:20:06 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_=2317460_-_merge_from_3=2E3?= Message-ID: <3ZVRyZ1RhJzSHW@mail.python.org> http://hg.python.org/cpython/rev/2a1b4ac63f3a changeset: 82757:2a1b4ac63f3a parent: 82754:145d78bc00f8 parent: 82756:f4e966570416 user: Senthil Kumaran date: Tue Mar 19 01:22:56 2013 -0700 summary: #17460 - merge from 3.3 files: Doc/library/http.client.rst | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -51,6 +51,10 @@ .. versionchanged:: 3.2 *source_address* was added. + .. versionchanged:: 3.4 + The *strict* parameter is removed. HTTP 0.9-style "Simple Responses" are + not supported. + .. class:: HTTPSConnection(host, port=None, key_file=None, \ cert_file=None[, timeout], \ @@ -85,12 +89,20 @@ This class now supports HTTPS virtual hosts if possible (that is, if :data:`ssl.HAS_SNI` is true). + .. versionchanged:: 3.4 + The *strict* parameter is removed. HTTP 0.9-style "Simple Responses" are + not supported anymore. + .. class:: HTTPResponse(sock, debuglevel=0, method=None, url=None) Class whose instances are returned upon successful connection. Not instantiated directly by user. + .. versionchanged:: 3.4 + The *strict* parameter is removed. HTTP 0.9 style "Simple Responses" are + not supported anymore. + The following exceptions are raised as appropriate: -- Repository URL: http://hg.python.org/cpython From root at python.org Tue Mar 19 11:15:22 2013 From: root at python.org (Cron Daemon) Date: Tue, 19 Mar 2013 11:15:22 +0100 Subject: [Python-checkins] Cron /home/docs/build-devguide Message-ID: abort: error: Connection timed out From python-checkins at python.org Tue Mar 19 12:31:02 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 19 Mar 2013 12:31:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_Fix_usage_of_t?= =?utf-8?q?he_unittest=2Eskip_decorator=2E?= Message-ID: <3ZVXBt6y7jzRCx@mail.python.org> http://hg.python.org/cpython/rev/02e028b104d3 changeset: 82758:02e028b104d3 branch: 3.2 parent: 82755:ac023b1a23ea user: Serhiy Storchaka date: Tue Mar 19 13:25:20 2013 +0200 summary: Fix usage of the unittest.skip decorator. files: Lib/tkinter/test/test_ttk/test_widgets.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py --- a/Lib/tkinter/test/test_ttk/test_widgets.py +++ b/Lib/tkinter/test/test_ttk/test_widgets.py @@ -947,7 +947,7 @@ anchor=1) # XXX skipping for now; should be fixed to work with newer ttk - @unittest.skip + @unittest.skip("skipping pending resolution of Issue #10734") def test_heading_callback(self): def simulate_heading_click(x, y): support.simulate_mouse_click(self.tv, x, y) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 12:31:04 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 19 Mar 2013 12:31:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Fix_usage_of_the_unittest=2Eskip_decorator=2E?= Message-ID: <3ZVXBw2V0YzRCx@mail.python.org> http://hg.python.org/cpython/rev/eff77a3ee938 changeset: 82759:eff77a3ee938 branch: 3.3 parent: 82756:f4e966570416 parent: 82758:02e028b104d3 user: Serhiy Storchaka date: Tue Mar 19 13:27:05 2013 +0200 summary: Fix usage of the unittest.skip decorator. files: Lib/tkinter/test/test_ttk/test_widgets.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py --- a/Lib/tkinter/test/test_ttk/test_widgets.py +++ b/Lib/tkinter/test/test_ttk/test_widgets.py @@ -947,7 +947,7 @@ anchor=1) # XXX skipping for now; should be fixed to work with newer ttk - @unittest.skip + @unittest.skip("skipping pending resolution of Issue #10734") def test_heading_callback(self): def simulate_heading_click(x, y): support.simulate_mouse_click(self.tv, x, y) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 12:31:05 2013 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 19 Mar 2013 12:31:05 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Fix_usage_of_the_unittest=2Eskip_decorator=2E?= Message-ID: <3ZVXBx5LphzRhf@mail.python.org> http://hg.python.org/cpython/rev/57c6435ca03b changeset: 82760:57c6435ca03b parent: 82757:2a1b4ac63f3a parent: 82759:eff77a3ee938 user: Serhiy Storchaka date: Tue Mar 19 13:27:24 2013 +0200 summary: Fix usage of the unittest.skip decorator. files: Lib/tkinter/test/test_ttk/test_widgets.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py --- a/Lib/tkinter/test/test_ttk/test_widgets.py +++ b/Lib/tkinter/test/test_ttk/test_widgets.py @@ -947,7 +947,7 @@ anchor=1) # XXX skipping for now; should be fixed to work with newer ttk - @unittest.skip + @unittest.skip("skipping pending resolution of Issue #10734") def test_heading_callback(self): def simulate_heading_click(x, y): support.simulate_mouse_click(self.tv, x, y) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 18:57:52 2013 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Mar 2013 18:57:52 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3NDQzOiBGaXgg?= =?utf-8?q?buffering_in_IMAP4=5Fstream=2E?= Message-ID: <3ZVhnD31bzzSQt@mail.python.org> http://hg.python.org/cpython/rev/c5aacf9d1cdc changeset: 82761:c5aacf9d1cdc branch: 3.2 parent: 82758:02e028b104d3 user: R David Murray date: Tue Mar 19 13:52:33 2013 -0400 summary: #17443: Fix buffering in IMAP4_stream. In Python2 Popen uses *FILE objects, which wind up buffering even though subprocess defaults to no buffering. In Python3, subprocess streams really are unbuffered by default, but the imaplib code assumes read is buffered. This patch uses the default buffer size from the io module to get buffered streams from Popen. Much debugging work and patch by Diane Trout. The imap protocol is too complicated to write a test for this simple change with our current level of test infrastructure. files: Lib/imaplib.py | 2 ++ Misc/ACKS | 1 + Misc/NEWS | 4 ++++ 3 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Lib/imaplib.py b/Lib/imaplib.py --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -23,6 +23,7 @@ __version__ = "2.58" import binascii, errno, random, re, socket, subprocess, sys, time, calendar +from io import DEFAULT_BUFFER_SIZE try: import ssl @@ -1237,6 +1238,7 @@ self.sock = None self.file = None self.process = subprocess.Popen(self.command, + bufsize=DEFAULT_BUFFER_SIZE, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True, close_fds=True) self.writefile = self.process.stdin diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1098,6 +1098,7 @@ Nathan Trapuzzano Laurence Tratt John Tromp +Diane Trout Jason Trowbridge Brent Tubbs Anthony Tuininga diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,6 +233,10 @@ Library ------- +- Issue #17443: impalib.IMAP4_stream was using the default unbuffered IO + in subprocess, but the imap code assumes buffered IO. In Python2 this + worked by accident. IMAP4_stream now explicitly uses buffered IO. + - Issue #17476: Fixed regression relative to Python2 in undocumented pydoc 'allmethods'; it was missing unbound methods on the class. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 18:57:53 2013 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Mar 2013 18:57:53 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge=3A_=2317443=3A_Fix_buffering_in_IMAP4=5Fstream=2E?= Message-ID: <3ZVhnF6Lc8zSVf@mail.python.org> http://hg.python.org/cpython/rev/0baa65b3ef76 changeset: 82762:0baa65b3ef76 branch: 3.3 parent: 82759:eff77a3ee938 parent: 82761:c5aacf9d1cdc user: R David Murray date: Tue Mar 19 13:56:01 2013 -0400 summary: Merge: #17443: Fix buffering in IMAP4_stream. In Python2 Popen uses *FILE objects, which wind up buffering even though subprocess defaults to no buffering. In Python3, subprocess streams really are unbuffered by default, but the imaplib code assumes read is buffered. This patch uses the default buffer size from the io module to get buffered streams from Popen. Much debugging work and patch by Diane Trout. The imap protocol is too complicated to write a test for this simple change with our current level of test infrastructure. files: Lib/imaplib.py | 3 +++ Misc/ACKS | 1 + Misc/NEWS | 4 ++++ 3 files changed, 8 insertions(+), 0 deletions(-) diff --git a/Lib/imaplib.py b/Lib/imaplib.py --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -24,6 +24,8 @@ import binascii, errno, random, re, socket, subprocess, sys, time, calendar from datetime import datetime, timezone, timedelta +from io import DEFAULT_BUFFER_SIZE + try: import ssl HAVE_SSL = True @@ -1244,6 +1246,7 @@ self.sock = None self.file = None self.process = subprocess.Popen(self.command, + bufsize=DEFAULT_BUFFER_SIZE, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True, close_fds=True) self.writefile = self.process.stdin diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1216,6 +1216,7 @@ Matthias Troffaes Tom Tromey John Tromp +Diane Trout Jason Trowbridge Brent Tubbs Anthony Tuininga diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -193,6 +193,10 @@ Library ------- +- Issue #17443: impalib.IMAP4_stream was using the default unbuffered IO + in subprocess, but the imap code assumes buffered IO. In Python2 this + worked by accident. IMAP4_stream now explicitly uses buffered IO. + - Issue #17476: Fixed regression relative to Python2 in undocumented pydoc 'allmethods'; it was missing unbound methods on the class. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 18:57:55 2013 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Mar 2013 18:57:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=2317443=3A_Fix_buffering_in_IMAP4=5Fstream=2E?= Message-ID: <3ZVhnH29kGzSQx@mail.python.org> http://hg.python.org/cpython/rev/4c6463b96a2c changeset: 82763:4c6463b96a2c parent: 82760:57c6435ca03b parent: 82762:0baa65b3ef76 user: R David Murray date: Tue Mar 19 13:56:54 2013 -0400 summary: Merge: #17443: Fix buffering in IMAP4_stream. In Python2 Popen uses *FILE objects, which wind up buffering even though subprocess defaults to no buffering. In Python3, subprocess streams really are unbuffered by default, but the imaplib code assumes read is buffered. This patch uses the default buffer size from the io module to get buffered streams from Popen. Much debugging work and patch by Diane Trout. The imap protocol is too complicated to write a test for this simple change with our current level of test infrastructure. files: Lib/imaplib.py | 3 +++ Misc/ACKS | 1 + Misc/NEWS | 4 ++++ 3 files changed, 8 insertions(+), 0 deletions(-) diff --git a/Lib/imaplib.py b/Lib/imaplib.py --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -24,6 +24,8 @@ import binascii, errno, random, re, socket, subprocess, sys, time, calendar from datetime import datetime, timezone, timedelta +from io import DEFAULT_BUFFER_SIZE + try: import ssl HAVE_SSL = True @@ -1244,6 +1246,7 @@ self.sock = None self.file = None self.process = subprocess.Popen(self.command, + bufsize=DEFAULT_BUFFER_SIZE, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True, close_fds=True) self.writefile = self.process.stdin diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1236,6 +1236,7 @@ Matthias Troffaes Tom Tromey John Tromp +Diane Trout Jason Trowbridge Brent Tubbs Anthony Tuininga diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -289,6 +289,10 @@ Library ------- +- Issue #17443: impalib.IMAP4_stream was using the default unbuffered IO + in subprocess, but the imap code assumes buffered IO. In Python2 this + worked by accident. IMAP4_stream now explicitly uses buffered IO. + - Issue #17476: Fixed regression relative to Python2 in undocumented pydoc 'allmethods'; it was missing unbound methods on the class. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 19:08:13 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Tue, 19 Mar 2013 19:08:13 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzkwOTAg?= =?utf-8?q?=3A_Error_code_10035_calling_socket=2Erecv=28=29_on_a_socket_wi?= =?utf-8?q?th_a_timeout?= Message-ID: <3ZVj1911wHzSrl@mail.python.org> http://hg.python.org/cpython/rev/8ec39bfd1f01 changeset: 82764:8ec39bfd1f01 branch: 2.7 parent: 82740:b10ec5083a53 user: Kristj?n Valur J?nsson date: Tue Mar 19 10:58:59 2013 -0700 summary: Issue #9090 : Error code 10035 calling socket.recv() on a socket with a timeout (WSAEWOULDBLOCK - A non-blocking socket operation could not be completed immediately) files: Misc/NEWS | 5 + Modules/socketmodule.c | 104 ++++++++++++++++++++++++---- Modules/timemodule.c | 7 + 3 files changed, 101 insertions(+), 15 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -214,6 +214,11 @@ Library ------- +- Issue #9090: When a socket with a timeout fails with EWOULDBLOCK or EAGAIN, + retry the select() loop instead of bailing out. This is because select() + can incorrectly report a socket as ready for reading (for example, if it + received some data with an invalid checksum). + - Issue #1285086: Get rid of the refcounting hack and speed up urllib.unquote(). - Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -473,6 +473,17 @@ return NULL; } +#ifdef MS_WINDOWS +#ifndef WSAEAGAIN +#define WSAEAGAIN WSAEWOULDBLOCK +#endif +#define CHECK_ERRNO(expected) \ + (WSAGetLastError() == WSA ## expected) +#else +#define CHECK_ERRNO(expected) \ + (errno == expected) +#endif + /* Convenience function to raise an error according to errno and return a NULL pointer from a function. */ @@ -661,7 +672,7 @@ after they've reacquired the interpreter lock. Returns 1 on timeout, -1 on error, 0 otherwise. */ static int -internal_select(PySocketSockObject *s, int writing) +internal_select_ex(PySocketSockObject *s, int writing, double interval) { int n; @@ -673,6 +684,10 @@ if (s->sock_fd < 0) return 0; + /* Handling this condition here simplifies the select loops */ + if (interval < 0.0) + return 1; + /* Prefer poll, if available, since you can poll() any fd * which can't be done with select(). */ #ifdef HAVE_POLL @@ -684,7 +699,7 @@ pollfd.events = writing ? POLLOUT : POLLIN; /* s->sock_timeout is in seconds, timeout in ms */ - timeout = (int)(s->sock_timeout * 1000 + 0.5); + timeout = (int)(interval * 1000 + 0.5); n = poll(&pollfd, 1, timeout); } #else @@ -692,8 +707,8 @@ /* Construct the arguments to select */ fd_set fds; struct timeval tv; - tv.tv_sec = (int)s->sock_timeout; - tv.tv_usec = (int)((s->sock_timeout - tv.tv_sec) * 1e6); + tv.tv_sec = (int)interval; + tv.tv_usec = (int)((interval - tv.tv_sec) * 1e6); FD_ZERO(&fds); FD_SET(s->sock_fd, &fds); @@ -712,6 +727,49 @@ return 0; } +static int +internal_select(PySocketSockObject *s, int writing) +{ + return internal_select_ex(s, writing, s->sock_timeout); +} + +/* + Two macros for automatic retry of select() in case of false positives + (for example, select() could indicate a socket is ready for reading + but the data then discarded by the OS because of a wrong checksum). + Here is an example of use: + + BEGIN_SELECT_LOOP(s) + Py_BEGIN_ALLOW_THREADS + timeout = internal_select_ex(s, 0, interval); + if (!timeout) + outlen = recv(s->sock_fd, cbuf, len, flags); + Py_END_ALLOW_THREADS + if (timeout == 1) { + PyErr_SetString(socket_timeout, "timed out"); + return -1; + } + END_SELECT_LOOP(s) +*/ +PyAPI_FUNC(double) _PyTime_floattime(void); /* defined in timemodule.c */ +#define BEGIN_SELECT_LOOP(s) \ + { \ + double deadline, interval = s->sock_timeout; \ + int has_timeout = s->sock_timeout > 0.0; \ + if (has_timeout) { \ + deadline = _PyTime_floattime() + s->sock_timeout; \ + } \ + while (1) { \ + errno = 0; \ + +#define END_SELECT_LOOP(s) \ + if (!has_timeout || \ + (!CHECK_ERRNO(EWOULDBLOCK) && !CHECK_ERRNO(EAGAIN))) \ + break; \ + interval = deadline - _PyTime_floattime(); \ + } \ + } \ + /* Initialize a new socket object. */ static double defaulttimeout = -1.0; /* Default timeout for new sockets */ @@ -1656,8 +1714,9 @@ if (!IS_SELECTABLE(s)) return select_error(); + BEGIN_SELECT_LOOP(s) Py_BEGIN_ALLOW_THREADS - timeout = internal_select(s, 0); + timeout = internal_select_ex(s, 0, interval); if (!timeout) newfd = accept(s->sock_fd, SAS2SA(&addrbuf), &addrlen); Py_END_ALLOW_THREADS @@ -1666,6 +1725,7 @@ PyErr_SetString(socket_timeout, "timed out"); return NULL; } + END_SELECT_LOOP(s) #ifdef MS_WINDOWS if (newfd == INVALID_SOCKET) @@ -2355,8 +2415,9 @@ } #ifndef __VMS + BEGIN_SELECT_LOOP(s) Py_BEGIN_ALLOW_THREADS - timeout = internal_select(s, 0); + timeout = internal_select_ex(s, 0, interval); if (!timeout) outlen = recv(s->sock_fd, cbuf, len, flags); Py_END_ALLOW_THREADS @@ -2365,6 +2426,7 @@ PyErr_SetString(socket_timeout, "timed out"); return -1; } + END_SELECT_LOOP(s) if (outlen < 0) { /* Note: the call to errorhandler() ALWAYS indirectly returned NULL, so ignore its return value */ @@ -2386,8 +2448,9 @@ segment = remaining; } + BEGIN_SELECT_LOOP(s) Py_BEGIN_ALLOW_THREADS - timeout = internal_select(s, 0); + timeout = internal_select_ex(s, 0, interval); if (!timeout) nread = recv(s->sock_fd, read_buf, segment, flags); Py_END_ALLOW_THREADS @@ -2396,6 +2459,8 @@ PyErr_SetString(socket_timeout, "timed out"); return -1; } + END_SELECT_LOOP(s) + if (nread < 0) { s->errorhandler(); return -1; @@ -2559,9 +2624,10 @@ return -1; } + BEGIN_SELECT_LOOP(s) Py_BEGIN_ALLOW_THREADS memset(&addrbuf, 0, addrlen); - timeout = internal_select(s, 0); + timeout = internal_select_ex(s, 0, interval); if (!timeout) { #ifndef MS_WINDOWS #if defined(PYOS_OS2) && !defined(PYCC_GCC) @@ -2582,6 +2648,7 @@ PyErr_SetString(socket_timeout, "timed out"); return -1; } + END_SELECT_LOOP(s) if (n < 0) { s->errorhandler(); return -1; @@ -2719,8 +2786,9 @@ buf = pbuf.buf; len = pbuf.len; + BEGIN_SELECT_LOOP(s) Py_BEGIN_ALLOW_THREADS - timeout = internal_select(s, 1); + timeout = internal_select_ex(s, 1, interval); if (!timeout) #ifdef __VMS n = sendsegmented(s->sock_fd, buf, len, flags); @@ -2728,13 +2796,14 @@ n = send(s->sock_fd, buf, len, flags); #endif Py_END_ALLOW_THREADS - - PyBuffer_Release(&pbuf); - if (timeout == 1) { + PyBuffer_Release(&pbuf); PyErr_SetString(socket_timeout, "timed out"); return NULL; } + END_SELECT_LOOP(s) + + PyBuffer_Release(&pbuf); if (n < 0) return s->errorhandler(); return PyInt_FromLong((long)n); @@ -2768,8 +2837,9 @@ } do { + BEGIN_SELECT_LOOP(s) Py_BEGIN_ALLOW_THREADS - timeout = internal_select(s, 1); + timeout = internal_select_ex(s, 1, interval); n = -1; if (!timeout) { #ifdef __VMS @@ -2784,6 +2854,7 @@ PyErr_SetString(socket_timeout, "timed out"); return NULL; } + END_SELECT_LOOP(s) /* PyErr_CheckSignals() might change errno */ saved_errno = errno; /* We must run our signal handlers before looping again. @@ -2863,17 +2934,20 @@ return NULL; } + BEGIN_SELECT_LOOP(s) Py_BEGIN_ALLOW_THREADS - timeout = internal_select(s, 1); + timeout = internal_select_ex(s, 1, interval); if (!timeout) n = sendto(s->sock_fd, buf, len, flags, SAS2SA(&addrbuf), addrlen); Py_END_ALLOW_THREADS - PyBuffer_Release(&pbuf); if (timeout == 1) { + PyBuffer_Release(&pbuf); PyErr_SetString(socket_timeout, "timed out"); return NULL; } + END_SELECT_LOOP(s) + PyBuffer_Release(&pbuf); if (n < 0) return s->errorhandler(); return PyInt_FromLong((long)n); diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -1055,3 +1055,10 @@ return 0; } + +/* export floattime to socketmodule.c */ +PyAPI_FUNC(double) +_PyTime_floattime(void) +{ + return floattime(); +} -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 20:04:33 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 19 Mar 2013 20:04:33 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=2E=2E/bug-fixes/http=5Fer?= =?utf-8?q?ror=5Finterface/=2Ehg/last-message=2Etxt?= Message-ID: <3ZVkG913khzS5n@mail.python.org> http://hg.python.org/cpython/rev/4f2080e9eee2 changeset: 82765:4f2080e9eee2 parent: 82763:4c6463b96a2c user: Senthil Kumaran date: Tue Mar 19 12:07:43 2013 -0700 summary: ../bug-fixes/http_error_interface/.hg/last-message.txt files: Lib/test/test_urllib2.py | 39 +++++++++++++-------------- 1 files changed, 19 insertions(+), 20 deletions(-) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -1387,6 +1387,10 @@ class MiscTests(unittest.TestCase): + def opener_has_handler(self, opener, handler_class): + self.assertTrue(any(h.__class__ == handler_class + for h in opener.handlers)) + def test_build_opener(self): class MyHTTPHandler(urllib.request.HTTPHandler): pass class FooHandler(urllib.request.BaseHandler): @@ -1439,10 +1443,22 @@ self.assertEqual(b"1234567890", request.data) self.assertEqual("10", request.get_header("Content-length")) + def test_HTTPError_interface(self): + """ + Issue 13211 reveals that HTTPError didn't implement the URLError + interface even though HTTPError is a subclass of URLError. - def opener_has_handler(self, opener, handler_class): - self.assertTrue(any(h.__class__ == handler_class - for h in opener.handlers)) + >>> msg = 'something bad happened' + >>> url = code = fp = None + >>> hdrs = 'Content-Length: 42' + >>> err = urllib.error.HTTPError(url, code, msg, hdrs, fp) + >>> assert hasattr(err, 'reason') + >>> err.reason + 'something bad happened' + >>> assert hasattr(err, 'headers') + >>> err.headers + 'Content-Length: 42' + """ class RequestTests(unittest.TestCase): @@ -1514,23 +1530,6 @@ req = Request(url) self.assertEqual(req.get_full_url(), url) -def test_HTTPError_interface(): - """ - Issue 13211 reveals that HTTPError didn't implement the URLError - interface even though HTTPError is a subclass of URLError. - - >>> msg = 'something bad happened' - >>> url = code = fp = None - >>> hdrs = 'Content-Length: 42' - >>> err = urllib.error.HTTPError(url, code, msg, hdrs, fp) - >>> assert hasattr(err, 'reason') - >>> err.reason - 'something bad happened' - >>> assert hasattr(err, 'headers') - >>> err.headers - 'Content-Length: 42' - """ - def test_main(verbose=None): from test import test_urllib2 support.run_doctest(test_urllib2, verbose) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 20:15:53 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 19 Mar 2013 20:15:53 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Refactor_test=5Furllib2=2E?= =?utf-8?q?_Include_test=5FHTTPError=5Finterface_under_MiscTests?= Message-ID: <3ZVkWF5V2ZzSD2@mail.python.org> http://hg.python.org/cpython/rev/cafa7b27f0ff changeset: 82766:cafa7b27f0ff parent: 82763:4c6463b96a2c user: Senthil Kumaran date: Tue Mar 19 12:07:43 2013 -0700 summary: Refactor test_urllib2. Include test_HTTPError_interface under MiscTests files: Lib/test/test_urllib2.py | 39 +++++++++++++-------------- 1 files changed, 19 insertions(+), 20 deletions(-) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -1387,6 +1387,10 @@ class MiscTests(unittest.TestCase): + def opener_has_handler(self, opener, handler_class): + self.assertTrue(any(h.__class__ == handler_class + for h in opener.handlers)) + def test_build_opener(self): class MyHTTPHandler(urllib.request.HTTPHandler): pass class FooHandler(urllib.request.BaseHandler): @@ -1439,10 +1443,22 @@ self.assertEqual(b"1234567890", request.data) self.assertEqual("10", request.get_header("Content-length")) + def test_HTTPError_interface(self): + """ + Issue 13211 reveals that HTTPError didn't implement the URLError + interface even though HTTPError is a subclass of URLError. - def opener_has_handler(self, opener, handler_class): - self.assertTrue(any(h.__class__ == handler_class - for h in opener.handlers)) + >>> msg = 'something bad happened' + >>> url = code = fp = None + >>> hdrs = 'Content-Length: 42' + >>> err = urllib.error.HTTPError(url, code, msg, hdrs, fp) + >>> assert hasattr(err, 'reason') + >>> err.reason + 'something bad happened' + >>> assert hasattr(err, 'headers') + >>> err.headers + 'Content-Length: 42' + """ class RequestTests(unittest.TestCase): @@ -1514,23 +1530,6 @@ req = Request(url) self.assertEqual(req.get_full_url(), url) -def test_HTTPError_interface(): - """ - Issue 13211 reveals that HTTPError didn't implement the URLError - interface even though HTTPError is a subclass of URLError. - - >>> msg = 'something bad happened' - >>> url = code = fp = None - >>> hdrs = 'Content-Length: 42' - >>> err = urllib.error.HTTPError(url, code, msg, hdrs, fp) - >>> assert hasattr(err, 'reason') - >>> err.reason - 'something bad happened' - >>> assert hasattr(err, 'headers') - >>> err.headers - 'Content-Length: 42' - """ - def test_main(verbose=None): from test import test_urllib2 support.run_doctest(test_urllib2, verbose) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 20:15:55 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 19 Mar 2013 20:15:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_merge_branch?= Message-ID: <3ZVkWH0xDfzSqP@mail.python.org> http://hg.python.org/cpython/rev/d7dede0eabd8 changeset: 82767:d7dede0eabd8 parent: 82766:cafa7b27f0ff parent: 82765:4f2080e9eee2 user: Senthil Kumaran date: Tue Mar 19 12:18:50 2013 -0700 summary: merge branch files: -- Repository URL: http://hg.python.org/cpython From senthil at uthcode.com Tue Mar 19 20:17:20 2013 From: senthil at uthcode.com (Senthil Kumaran) Date: Tue, 19 Mar 2013 12:17:20 -0700 Subject: [Python-checkins] cpython: ../bug-fixes/http_error_interface/.hg/last-message.txt In-Reply-To: <3ZVkG913khzS5n@mail.python.org> References: <3ZVkG913khzS5n@mail.python.org> Message-ID: Looks like I used hg commit -m /path/to/.hg/last-message.txt instead of hg commit -l /path/to/.hg/last-message.txt I have amended it, merged it and pushed it again. On Tue, Mar 19, 2013 at 12:04 PM, senthil.kumaran wrote: > http://hg.python.org/cpython/rev/4f2080e9eee2 > changeset: 82765:4f2080e9eee2 > parent: 82763:4c6463b96a2c > user: Senthil Kumaran > date: Tue Mar 19 12:07:43 2013 -0700 > summary: > ../bug-fixes/http_error_interface/.hg/last-message.txt > > files: > Lib/test/test_urllib2.py | 39 +++++++++++++-------------- > 1 files changed, 19 insertions(+), 20 deletions(-) > > > diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py > --- a/Lib/test/test_urllib2.py > +++ b/Lib/test/test_urllib2.py > @@ -1387,6 +1387,10 @@ > > class MiscTests(unittest.TestCase): > > + def opener_has_handler(self, opener, handler_class): > + self.assertTrue(any(h.__class__ == handler_class > + for h in opener.handlers)) > + > def test_build_opener(self): > class MyHTTPHandler(urllib.request.HTTPHandler): pass > class FooHandler(urllib.request.BaseHandler): > @@ -1439,10 +1443,22 @@ > self.assertEqual(b"1234567890", request.data) > self.assertEqual("10", request.get_header("Content-length")) > > + def test_HTTPError_interface(self): > + """ > + Issue 13211 reveals that HTTPError didn't implement the URLError > + interface even though HTTPError is a subclass of URLError. > > - def opener_has_handler(self, opener, handler_class): > - self.assertTrue(any(h.__class__ == handler_class > - for h in opener.handlers)) > + >>> msg = 'something bad happened' > + >>> url = code = fp = None > + >>> hdrs = 'Content-Length: 42' > + >>> err = urllib.error.HTTPError(url, code, msg, hdrs, fp) > + >>> assert hasattr(err, 'reason') > + >>> err.reason > + 'something bad happened' > + >>> assert hasattr(err, 'headers') > + >>> err.headers > + 'Content-Length: 42' > + """ > > class RequestTests(unittest.TestCase): > > @@ -1514,23 +1530,6 @@ > req = Request(url) > self.assertEqual(req.get_full_url(), url) > > -def test_HTTPError_interface(): > - """ > - Issue 13211 reveals that HTTPError didn't implement the URLError > - interface even though HTTPError is a subclass of URLError. > - > - >>> msg = 'something bad happened' > - >>> url = code = fp = None > - >>> hdrs = 'Content-Length: 42' > - >>> err = urllib.error.HTTPError(url, code, msg, hdrs, fp) > - >>> assert hasattr(err, 'reason') > - >>> err.reason > - 'something bad happened' > - >>> assert hasattr(err, 'headers') > - >>> err.headers > - 'Content-Length: 42' > - """ > - > def test_main(verbose=None): > from test import test_urllib2 > support.run_doctest(test_urllib2, verbose) > > -- > Repository URL: http://hg.python.org/cpython > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > From senthil at uthcode.com Tue Mar 19 20:28:20 2013 From: senthil at uthcode.com (Senthil Kumaran) Date: Tue, 19 Mar 2013 12:28:20 -0700 Subject: [Python-checkins] cpython (2.7): Issue #9090 : Error code 10035 calling socket.recv() on a socket with a timeout In-Reply-To: <3ZVj1911wHzSrl@mail.python.org> References: <3ZVj1911wHzSrl@mail.python.org> Message-ID: Looks like RHEL 2.7 buildbots are unhappy with this change. -- Senthil On Tue, Mar 19, 2013 at 11:08 AM, kristjan.jonsson wrote: > http://hg.python.org/cpython/rev/8ec39bfd1f01 > changeset: 82764:8ec39bfd1f01 > branch: 2.7 > parent: 82740:b10ec5083a53 > user: Kristj?n Valur J?nsson > date: Tue Mar 19 10:58:59 2013 -0700 > summary: > Issue #9090 : Error code 10035 calling socket.recv() on a socket with a timeout > (WSAEWOULDBLOCK - A non-blocking socket operation could not be completed > immediately) > > files: > Misc/NEWS | 5 + > Modules/socketmodule.c | 104 ++++++++++++++++++++++++---- > Modules/timemodule.c | 7 + > 3 files changed, 101 insertions(+), 15 deletions(-) > > > diff --git a/Misc/NEWS b/Misc/NEWS > --- a/Misc/NEWS > +++ b/Misc/NEWS > @@ -214,6 +214,11 @@ > Library > ------- > > +- Issue #9090: When a socket with a timeout fails with EWOULDBLOCK or EAGAIN, > + retry the select() loop instead of bailing out. This is because select() > + can incorrectly report a socket as ready for reading (for example, if it > + received some data with an invalid checksum). > + > - Issue #1285086: Get rid of the refcounting hack and speed up urllib.unquote(). > > - Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused > diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c > --- a/Modules/socketmodule.c > +++ b/Modules/socketmodule.c > @@ -473,6 +473,17 @@ > return NULL; > } > > +#ifdef MS_WINDOWS > +#ifndef WSAEAGAIN > +#define WSAEAGAIN WSAEWOULDBLOCK > +#endif > +#define CHECK_ERRNO(expected) \ > + (WSAGetLastError() == WSA ## expected) > +#else > +#define CHECK_ERRNO(expected) \ > + (errno == expected) > +#endif > + > /* Convenience function to raise an error according to errno > and return a NULL pointer from a function. */ > > @@ -661,7 +672,7 @@ > after they've reacquired the interpreter lock. > Returns 1 on timeout, -1 on error, 0 otherwise. */ > static int > -internal_select(PySocketSockObject *s, int writing) > +internal_select_ex(PySocketSockObject *s, int writing, double interval) > { > int n; > > @@ -673,6 +684,10 @@ > if (s->sock_fd < 0) > return 0; > > + /* Handling this condition here simplifies the select loops */ > + if (interval < 0.0) > + return 1; > + > /* Prefer poll, if available, since you can poll() any fd > * which can't be done with select(). */ > #ifdef HAVE_POLL > @@ -684,7 +699,7 @@ > pollfd.events = writing ? POLLOUT : POLLIN; > > /* s->sock_timeout is in seconds, timeout in ms */ > - timeout = (int)(s->sock_timeout * 1000 + 0.5); > + timeout = (int)(interval * 1000 + 0.5); > n = poll(&pollfd, 1, timeout); > } > #else > @@ -692,8 +707,8 @@ > /* Construct the arguments to select */ > fd_set fds; > struct timeval tv; > - tv.tv_sec = (int)s->sock_timeout; > - tv.tv_usec = (int)((s->sock_timeout - tv.tv_sec) * 1e6); > + tv.tv_sec = (int)interval; > + tv.tv_usec = (int)((interval - tv.tv_sec) * 1e6); > FD_ZERO(&fds); > FD_SET(s->sock_fd, &fds); > > @@ -712,6 +727,49 @@ > return 0; > } > > +static int > +internal_select(PySocketSockObject *s, int writing) > +{ > + return internal_select_ex(s, writing, s->sock_timeout); > +} > + > +/* > + Two macros for automatic retry of select() in case of false positives > + (for example, select() could indicate a socket is ready for reading > + but the data then discarded by the OS because of a wrong checksum). > + Here is an example of use: > + > + BEGIN_SELECT_LOOP(s) > + Py_BEGIN_ALLOW_THREADS > + timeout = internal_select_ex(s, 0, interval); > + if (!timeout) > + outlen = recv(s->sock_fd, cbuf, len, flags); > + Py_END_ALLOW_THREADS > + if (timeout == 1) { > + PyErr_SetString(socket_timeout, "timed out"); > + return -1; > + } > + END_SELECT_LOOP(s) > +*/ > +PyAPI_FUNC(double) _PyTime_floattime(void); /* defined in timemodule.c */ > +#define BEGIN_SELECT_LOOP(s) \ > + { \ > + double deadline, interval = s->sock_timeout; \ > + int has_timeout = s->sock_timeout > 0.0; \ > + if (has_timeout) { \ > + deadline = _PyTime_floattime() + s->sock_timeout; \ > + } \ > + while (1) { \ > + errno = 0; \ > + > +#define END_SELECT_LOOP(s) \ > + if (!has_timeout || \ > + (!CHECK_ERRNO(EWOULDBLOCK) && !CHECK_ERRNO(EAGAIN))) \ > + break; \ > + interval = deadline - _PyTime_floattime(); \ > + } \ > + } \ > + > /* Initialize a new socket object. */ > > static double defaulttimeout = -1.0; /* Default timeout for new sockets */ > @@ -1656,8 +1714,9 @@ > if (!IS_SELECTABLE(s)) > return select_error(); > > + BEGIN_SELECT_LOOP(s) > Py_BEGIN_ALLOW_THREADS > - timeout = internal_select(s, 0); > + timeout = internal_select_ex(s, 0, interval); > if (!timeout) > newfd = accept(s->sock_fd, SAS2SA(&addrbuf), &addrlen); > Py_END_ALLOW_THREADS > @@ -1666,6 +1725,7 @@ > PyErr_SetString(socket_timeout, "timed out"); > return NULL; > } > + END_SELECT_LOOP(s) > > #ifdef MS_WINDOWS > if (newfd == INVALID_SOCKET) > @@ -2355,8 +2415,9 @@ > } > > #ifndef __VMS > + BEGIN_SELECT_LOOP(s) > Py_BEGIN_ALLOW_THREADS > - timeout = internal_select(s, 0); > + timeout = internal_select_ex(s, 0, interval); > if (!timeout) > outlen = recv(s->sock_fd, cbuf, len, flags); > Py_END_ALLOW_THREADS > @@ -2365,6 +2426,7 @@ > PyErr_SetString(socket_timeout, "timed out"); > return -1; > } > + END_SELECT_LOOP(s) > if (outlen < 0) { > /* Note: the call to errorhandler() ALWAYS indirectly returned > NULL, so ignore its return value */ > @@ -2386,8 +2448,9 @@ > segment = remaining; > } > > + BEGIN_SELECT_LOOP(s) > Py_BEGIN_ALLOW_THREADS > - timeout = internal_select(s, 0); > + timeout = internal_select_ex(s, 0, interval); > if (!timeout) > nread = recv(s->sock_fd, read_buf, segment, flags); > Py_END_ALLOW_THREADS > @@ -2396,6 +2459,8 @@ > PyErr_SetString(socket_timeout, "timed out"); > return -1; > } > + END_SELECT_LOOP(s) > + > if (nread < 0) { > s->errorhandler(); > return -1; > @@ -2559,9 +2624,10 @@ > return -1; > } > > + BEGIN_SELECT_LOOP(s) > Py_BEGIN_ALLOW_THREADS > memset(&addrbuf, 0, addrlen); > - timeout = internal_select(s, 0); > + timeout = internal_select_ex(s, 0, interval); > if (!timeout) { > #ifndef MS_WINDOWS > #if defined(PYOS_OS2) && !defined(PYCC_GCC) > @@ -2582,6 +2648,7 @@ > PyErr_SetString(socket_timeout, "timed out"); > return -1; > } > + END_SELECT_LOOP(s) > if (n < 0) { > s->errorhandler(); > return -1; > @@ -2719,8 +2786,9 @@ > buf = pbuf.buf; > len = pbuf.len; > > + BEGIN_SELECT_LOOP(s) > Py_BEGIN_ALLOW_THREADS > - timeout = internal_select(s, 1); > + timeout = internal_select_ex(s, 1, interval); > if (!timeout) > #ifdef __VMS > n = sendsegmented(s->sock_fd, buf, len, flags); > @@ -2728,13 +2796,14 @@ > n = send(s->sock_fd, buf, len, flags); > #endif > Py_END_ALLOW_THREADS > - > - PyBuffer_Release(&pbuf); > - > if (timeout == 1) { > + PyBuffer_Release(&pbuf); > PyErr_SetString(socket_timeout, "timed out"); > return NULL; > } > + END_SELECT_LOOP(s) > + > + PyBuffer_Release(&pbuf); > if (n < 0) > return s->errorhandler(); > return PyInt_FromLong((long)n); > @@ -2768,8 +2837,9 @@ > } > > do { > + BEGIN_SELECT_LOOP(s) > Py_BEGIN_ALLOW_THREADS > - timeout = internal_select(s, 1); > + timeout = internal_select_ex(s, 1, interval); > n = -1; > if (!timeout) { > #ifdef __VMS > @@ -2784,6 +2854,7 @@ > PyErr_SetString(socket_timeout, "timed out"); > return NULL; > } > + END_SELECT_LOOP(s) > /* PyErr_CheckSignals() might change errno */ > saved_errno = errno; > /* We must run our signal handlers before looping again. > @@ -2863,17 +2934,20 @@ > return NULL; > } > > + BEGIN_SELECT_LOOP(s) > Py_BEGIN_ALLOW_THREADS > - timeout = internal_select(s, 1); > + timeout = internal_select_ex(s, 1, interval); > if (!timeout) > n = sendto(s->sock_fd, buf, len, flags, SAS2SA(&addrbuf), addrlen); > Py_END_ALLOW_THREADS > > - PyBuffer_Release(&pbuf); > if (timeout == 1) { > + PyBuffer_Release(&pbuf); > PyErr_SetString(socket_timeout, "timed out"); > return NULL; > } > + END_SELECT_LOOP(s) > + PyBuffer_Release(&pbuf); > if (n < 0) > return s->errorhandler(); > return PyInt_FromLong((long)n); > diff --git a/Modules/timemodule.c b/Modules/timemodule.c > --- a/Modules/timemodule.c > +++ b/Modules/timemodule.c > @@ -1055,3 +1055,10 @@ > > return 0; > } > + > +/* export floattime to socketmodule.c */ > +PyAPI_FUNC(double) > +_PyTime_floattime(void) > +{ > + return floattime(); > +} > > -- > Repository URL: http://hg.python.org/cpython > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > From guido at python.org Tue Mar 19 20:55:53 2013 From: guido at python.org (Guido van Rossum) Date: Tue, 19 Mar 2013 12:55:53 -0700 Subject: [Python-checkins] cpython (2.7): Issue #9090 : Error code 10035 calling socket.recv() on a socket with a timeout In-Reply-To: <3ZVj1911wHzSrl@mail.python.org> References: <3ZVj1911wHzSrl@mail.python.org> Message-ID: On Tue, Mar 19, 2013 at 11:08 AM, kristjan.jonsson < python-checkins at python.org> wrote: > http://hg.python.org/cpython/rev/8ec39bfd1f01 > changeset: 82764:8ec39bfd1f01 > branch: 2.7 > parent: 82740:b10ec5083a53 > user: Kristj?n Valur J?nsson > date: Tue Mar 19 10:58:59 2013 -0700 > summary: > Issue #9090 : Error code 10035 calling socket.recv() on a socket with a > timeout > (WSAEWOULDBLOCK - A non-blocking socket operation could not be completed > immediately) > [...] > +- Issue #9090: When a socket with a timeout fails with EWOULDBLOCK or > EAGAIN, > + retry the select() loop instead of bailing out. This is because > select() > + can incorrectly report a socket as ready for reading (for example, if it > + received some data with an invalid checksum). > Might I recommend treating EINTR the same way? It has the same issue of popping up, rarely, when you least expect it, and messing with your code. -- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: From python-checkins at python.org Tue Mar 19 21:02:01 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Tue, 19 Mar 2013 21:02:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogaXNzdWUgIzkwOTAg?= =?utf-8?q?=3A_Limit_the_fix_to_windows_since_getting_a_portable_simple?= Message-ID: <3ZVlXT0D2VzSVf@mail.python.org> http://hg.python.org/cpython/rev/f22b93b318a5 changeset: 82768:f22b93b318a5 branch: 2.7 parent: 82764:8ec39bfd1f01 user: Kristj?n Valur J?nsson date: Tue Mar 19 13:01:05 2013 -0700 summary: issue #9090 : Limit the fix to windows since getting a portable simple time function on non-windows isn't quite simple. files: Modules/socketmodule.c | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-) diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -751,6 +751,14 @@ } END_SELECT_LOOP(s) */ +#ifdef _WIN32 +/* _PyTime_floattime is exported from timemodule.c which is a builtin on windows + * but not on linux. The problem we are fixing is mostly a windows problem so + * we leave it at that. + */ +#define HAVE_PYTIME_FLOATTIME +#endif +#ifdef HAVE_PYTIME_FLOATTIME PyAPI_FUNC(double) _PyTime_floattime(void); /* defined in timemodule.c */ #define BEGIN_SELECT_LOOP(s) \ { \ @@ -768,7 +776,18 @@ break; \ interval = deadline - _PyTime_floattime(); \ } \ - } \ + } +#else +#define BEGIN_SELECT_LOOP(s) \ + { \ + double interval = s->sock_timeout; \ + do { \ + errno = 0; \ + +#define END_SELECT_LOOP(s) \ + } while(0); \ + } +#endif /* Initialize a new socket object. */ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 21:28:00 2013 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Mar 2013 21:28:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzg4NjI6IEZpeCBj?= =?utf-8?q?urses_cleanup_with_getchar_is_interrupted_by_a_signal=2E?= Message-ID: <3ZVm6S5tPyzQy3@mail.python.org> http://hg.python.org/cpython/rev/8a08607abf32 changeset: 82769:8a08607abf32 branch: 3.2 parent: 82761:c5aacf9d1cdc user: R David Murray date: Tue Mar 19 16:23:09 2013 -0400 summary: #8862: Fix curses cleanup with getchar is interrupted by a signal. I have no idea how one would write a test for this. Patch by July Tikhonov. files: Misc/NEWS | 2 ++ Modules/_cursesmodule.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,6 +233,8 @@ Library ------- +- Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal. + - Issue #17443: impalib.IMAP4_stream was using the default unbuffered IO in subprocess, but the imap code assumes buffered IO. In Python2 this worked by accident. IMAP4_stream now explicitly uses buffered IO. diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -895,7 +895,9 @@ } if (rtn == ERR) { /* getch() returns ERR in nodelay mode */ - PyErr_SetString(PyCursesError, "no input"); + PyErr_CheckSignals(); + if (!PyErr_Occurred()) + PyErr_SetString(PyCursesError, "no input"); return NULL; } else if (rtn<=255) { return Py_BuildValue("C", rtn); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 21:28:02 2013 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Mar 2013 21:28:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge=3A_=238862=3A_Fix_curses_cleanup_with_getchar_is_interru?= =?utf-8?q?pted_by_a_signal=2E?= Message-ID: <3ZVm6V1hTzzS6b@mail.python.org> http://hg.python.org/cpython/rev/342ef2ed8d05 changeset: 82770:342ef2ed8d05 branch: 3.3 parent: 82762:0baa65b3ef76 parent: 82769:8a08607abf32 user: R David Murray date: Tue Mar 19 16:24:35 2013 -0400 summary: Merge: #8862: Fix curses cleanup with getchar is interrupted by a signal. I have no idea how one would write a test for this. Patch by July Tikhonov. files: Misc/NEWS | 2 ++ Modules/_cursesmodule.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -193,6 +193,8 @@ Library ------- +- Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal. + - Issue #17443: impalib.IMAP4_stream was using the default unbuffered IO in subprocess, but the imap code assumes buffered IO. In Python2 this worked by accident. IMAP4_stream now explicitly uses buffered IO. diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -1138,7 +1138,9 @@ } if (rtn == ERR) { /* getch() returns ERR in nodelay mode */ - PyErr_SetString(PyCursesError, "no input"); + PyErr_CheckSignals(); + if (!PyErr_Occurred()) + PyErr_SetString(PyCursesError, "no input"); return NULL; } else if (rtn<=255) { return Py_BuildValue("C", rtn); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 21:28:03 2013 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Mar 2013 21:28:03 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=238862=3A_Fix_curses_cleanup_with_getchar_is_i?= =?utf-8?q?nterrupted_by_a_signal=2E?= Message-ID: <3ZVm6W4qlszS4j@mail.python.org> http://hg.python.org/cpython/rev/4b9705fe3b2a changeset: 82771:4b9705fe3b2a parent: 82767:d7dede0eabd8 parent: 82770:342ef2ed8d05 user: R David Murray date: Tue Mar 19 16:26:19 2013 -0400 summary: Merge: #8862: Fix curses cleanup with getchar is interrupted by a signal. I have no idea how one would write a test for this. Patch by July Tikhonov. files: Misc/NEWS | 2 ++ Modules/_cursesmodule.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -289,6 +289,8 @@ Library ------- +- Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal. + - Issue #17443: impalib.IMAP4_stream was using the default unbuffered IO in subprocess, but the imap code assumes buffered IO. In Python2 this worked by accident. IMAP4_stream now explicitly uses buffered IO. diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -1138,7 +1138,9 @@ } if (rtn == ERR) { /* getch() returns ERR in nodelay mode */ - PyErr_SetString(PyCursesError, "no input"); + PyErr_CheckSignals(); + if (!PyErr_Occurred()) + PyErr_SetString(PyCursesError, "no input"); return NULL; } else if (rtn<=255) { return Py_BuildValue("C", rtn); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 21:28:05 2013 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Mar 2013 21:28:05 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzg4NjI6IEZpeCBj?= =?utf-8?q?urses_cleanup_with_getchar_is_interrupted_by_a_signal=2E?= Message-ID: <3ZVm6Y0qwlzSZB@mail.python.org> http://hg.python.org/cpython/rev/58980d0084cc changeset: 82772:58980d0084cc branch: 2.7 parent: 82768:f22b93b318a5 user: R David Murray date: Tue Mar 19 16:26:53 2013 -0400 summary: #8862: Fix curses cleanup with getchar is interrupted by a signal. I have no idea how one would write a test for this. Patch by July Tikhonov. files: Misc/NEWS | 2 ++ Modules/_cursesmodule.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -214,6 +214,8 @@ Library ------- +- Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal. + - Issue #9090: When a socket with a timeout fails with EWOULDBLOCK or EAGAIN, retry the select() loop instead of bailing out. This is because select() can incorrectly report a socket as ready for reading (for example, if it diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -885,7 +885,9 @@ } if (rtn == ERR) { /* getch() returns ERR in nodelay mode */ - PyErr_SetString(PyCursesError, "no input"); + PyErr_CheckSignals(); + if (!PyErr_Occurred()) + PyErr_SetString(PyCursesError, "no input"); return NULL; } else if (rtn<=255) { return Py_BuildValue("c", rtn); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 21:41:34 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 19 Mar 2013 21:41:34 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3NDcxIC0gSW1w?= =?utf-8?q?rove_urllib2_test_coverage=2E_Patch_contributed_by_Daniel_Wozni?= =?utf-8?q?ak?= Message-ID: <3ZVmQ60MkGzSCd@mail.python.org> http://hg.python.org/cpython/rev/33f02ccb5301 changeset: 82773:33f02ccb5301 branch: 3.2 parent: 82769:8a08607abf32 user: Senthil Kumaran date: Tue Mar 19 13:43:42 2013 -0700 summary: #17471 - Improve urllib2 test coverage. Patch contributed by Daniel Wozniak files: Lib/test/test_urllib2.py | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -47,6 +47,9 @@ for string, list in tests: self.assertEqual(urllib.request.parse_http_list(string), list) + def test_URLError_reasonstr(self): + err = urllib.error.URLError('reason') + self.assertIn(err.reason, str(err)) def test_request_headers_dict(): """ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 21:41:35 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 19 Mar 2013 21:41:35 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2317471_-_merge_from_3=2E2?= Message-ID: <3ZVmQ72zdmzSnS@mail.python.org> http://hg.python.org/cpython/rev/4e59a7fc69c6 changeset: 82774:4e59a7fc69c6 branch: 3.3 parent: 82770:342ef2ed8d05 parent: 82773:33f02ccb5301 user: Senthil Kumaran date: Tue Mar 19 13:44:17 2013 -0700 summary: #17471 - merge from 3.2 files: Lib/test/test_urllib2.py | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -64,6 +64,9 @@ for string, list in tests: self.assertEqual(urllib.request.parse_http_list(string), list) + def test_URLError_reasonstr(self): + err = urllib.error.URLError('reason') + self.assertIn(err.reason, str(err)) def test_request_headers_dict(): """ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 21:41:36 2013 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 19 Mar 2013 21:41:36 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_=2317471_-_merge_from_3=2E3?= Message-ID: <3ZVmQ85W89zSvV@mail.python.org> http://hg.python.org/cpython/rev/21d23fda469f changeset: 82775:21d23fda469f parent: 82771:4b9705fe3b2a parent: 82774:4e59a7fc69c6 user: Senthil Kumaran date: Tue Mar 19 13:44:42 2013 -0700 summary: #17471 - merge from 3.3 files: Lib/test/test_urllib2.py | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -64,6 +64,9 @@ for string, list in tests: self.assertEqual(urllib.request.parse_http_list(string), list) + def test_URLError_reasonstr(self): + err = urllib.error.URLError('reason') + self.assertIn(err.reason, str(err)) def test_request_headers_dict(): """ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 21:57:21 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Tue, 19 Mar 2013 21:57:21 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogaXNzdWUgIzkwOTAg?= =?utf-8?q?=3A_Take_the_same_approach_for_socketmodule_as_daytimemodule?= Message-ID: <3ZVmmK5XN9zS8V@mail.python.org> http://hg.python.org/cpython/rev/0f5e1e642dc3 changeset: 82776:0f5e1e642dc3 branch: 2.7 parent: 82772:58980d0084cc user: Kristj?n Valur J?nsson date: Tue Mar 19 13:53:56 2013 -0700 summary: issue #9090 : Take the same approach for socketmodule as daytimemodule when it needs support from timemodule (which is a .so on linux): link in timemodule.c for the required functions. files: Include/timefuncs.h | 3 +++ Modules/socketmodule.c | 27 ++++----------------------- Modules/timemodule.c | 2 +- setup.py | 5 +++-- 4 files changed, 11 insertions(+), 26 deletions(-) diff --git a/Include/timefuncs.h b/Include/timefuncs.h --- a/Include/timefuncs.h +++ b/Include/timefuncs.h @@ -16,6 +16,9 @@ */ PyAPI_FUNC(time_t) _PyTime_DoubleToTimet(double x); +/* Get the current time since the epoch in seconds */ +PyAPI_FUNC(double) _PyTime_FloatTime(void); + #ifdef __cplusplus } diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -92,6 +92,7 @@ #include "Python.h" #include "structmember.h" +#include "timefuncs.h" #undef MAX #define MAX(x, y) ((x) < (y) ? (y) : (x)) @@ -751,43 +752,23 @@ } END_SELECT_LOOP(s) */ -#ifdef _WIN32 -/* _PyTime_floattime is exported from timemodule.c which is a builtin on windows - * but not on linux. The problem we are fixing is mostly a windows problem so - * we leave it at that. - */ -#define HAVE_PYTIME_FLOATTIME -#endif -#ifdef HAVE_PYTIME_FLOATTIME -PyAPI_FUNC(double) _PyTime_floattime(void); /* defined in timemodule.c */ #define BEGIN_SELECT_LOOP(s) \ { \ double deadline, interval = s->sock_timeout; \ int has_timeout = s->sock_timeout > 0.0; \ if (has_timeout) { \ - deadline = _PyTime_floattime() + s->sock_timeout; \ + deadline = _PyTime_FloatTime() + s->sock_timeout; \ } \ while (1) { \ - errno = 0; \ + errno = 0; #define END_SELECT_LOOP(s) \ if (!has_timeout || \ (!CHECK_ERRNO(EWOULDBLOCK) && !CHECK_ERRNO(EAGAIN))) \ break; \ - interval = deadline - _PyTime_floattime(); \ + interval = deadline - _PyTime_FloatTime(); \ } \ } -#else -#define BEGIN_SELECT_LOOP(s) \ - { \ - double interval = s->sock_timeout; \ - do { \ - errno = 0; \ - -#define END_SELECT_LOOP(s) \ - } while(0); \ - } -#endif /* Initialize a new socket object. */ diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -1058,7 +1058,7 @@ /* export floattime to socketmodule.c */ PyAPI_FUNC(double) -_PyTime_floattime(void) +_PyTime_FloatTime(void) { return floattime(); } diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -777,8 +777,9 @@ exts.append( Extension('_csv', ['_csv.c']) ) # socket(2) - exts.append( Extension('_socket', ['socketmodule.c'], - depends = ['socketmodule.h']) ) + exts.append( Extension('_socket', ['socketmodule.c', 'timemodule.c'], + depends=['socketmodule.h'], + libraries=math_libs) ) # Detect SSL support for the socket module (via _ssl) search_for_ssl_incs_in = [ '/usr/local/ssl/include', -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 22:28:43 2013 From: python-checkins at python.org (terry.reedy) Date: Tue, 19 Mar 2013 22:28:43 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_second_pydev_post_date?= Message-ID: <3ZVnSW6bZvzPKQ@mail.python.org> http://hg.python.org/peps/rev/94cf0ce7bc9e changeset: 4808:94cf0ce7bc9e parent: 4787:feacb6c0633d user: Terry Jan Reedy date: Tue Mar 19 17:25:59 2013 -0400 summary: Add second pydev post date files: pep-0434.txt | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/pep-0434.txt b/pep-0434.txt --- a/pep-0434.txt +++ b/pep-0434.txt @@ -10,6 +10,7 @@ Content-Type: text/x-rst Created: 16-Feb-2013 Post-History: 16-Feb-2013 + 03-Mar-2013 Abstract -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Tue Mar 19 22:28:45 2013 From: python-checkins at python.org (terry.reedy) Date: Tue, 19 Mar 2013 22:28:45 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps_=28merge_default_-=3E_default=29?= =?utf-8?q?=3A_Merge?= Message-ID: <3ZVnSY1vbczPKQ@mail.python.org> http://hg.python.org/peps/rev/3a65788bdd17 changeset: 4809:3a65788bdd17 parent: 4807:3d706be6e879 parent: 4808:94cf0ce7bc9e user: Terry Jan Reedy date: Tue Mar 19 17:28:18 2013 -0400 summary: Merge files: pep-0434.txt | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/pep-0434.txt b/pep-0434.txt --- a/pep-0434.txt +++ b/pep-0434.txt @@ -10,6 +10,7 @@ Content-Type: text/x-rst Created: 16-Feb-2013 Post-History: 16-Feb-2013 + 03-Mar-2013 Abstract -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Tue Mar 19 22:51:06 2013 From: python-checkins at python.org (matthias.klose) Date: Tue, 19 Mar 2013 22:51:06 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogLSBJc3N1ZSAjMTc0?= =?utf-8?q?77=3A_Update_the_bsddb_module_to_pybsddb_5=2E3=2E0=2C_supportin?= =?utf-8?q?g?= Message-ID: <3ZVnyL63N8zSSx@mail.python.org> http://hg.python.org/cpython/rev/83fd64c97296 changeset: 82777:83fd64c97296 branch: 2.7 user: doko at ubuntu.com date: Tue Mar 19 14:46:29 2013 -0700 summary: - Issue #17477: Update the bsddb module to pybsddb 5.3.0, supporting db-5.x, and dropping support for db-4.1 and db-4.2. files: Lib/bsddb/__init__.py | 6 +- Lib/bsddb/dbobj.py | 9 +- Lib/bsddb/dbshelve.py | 32 +- Lib/bsddb/dbtables.py | 4 +- Lib/bsddb/test/test_all.py | 9 +- Lib/bsddb/test/test_basics.py | 36 +- Lib/bsddb/test/test_compare.py | 394 ++- Lib/bsddb/test/test_db.py | 43 +- Lib/bsddb/test/test_dbenv.py | 66 +- Lib/bsddb/test/test_dbshelve.py | 7 - Lib/bsddb/test/test_distributed_transactions.py | 11 - Lib/bsddb/test/test_early_close.py | 21 +- Lib/bsddb/test/test_lock.py | 7 - Lib/bsddb/test/test_misc.py | 11 - Lib/bsddb/test/test_queue.py | 5 - Lib/bsddb/test/test_recno.py | 26 +- Lib/bsddb/test/test_replication.py | 86 +- Lib/bsddb/test/test_sequence.py | 8 +- Lib/bsddb/test/test_thread.py | 4 - Misc/NEWS | 3 + Modules/_bsddb.c | 1116 ++++++--- Modules/bsddb.h | 42 +- setup.py | 10 +- 23 files changed, 1236 insertions(+), 720 deletions(-) diff --git a/Lib/bsddb/__init__.py b/Lib/bsddb/__init__.py --- a/Lib/bsddb/__init__.py +++ b/Lib/bsddb/__init__.py @@ -33,7 +33,7 @@ #---------------------------------------------------------------------- -"""Support for Berkeley DB 4.1 through 4.8 with a simple interface. +"""Support for Berkeley DB 4.3 through 5.3 with a simple interface. For the full featured object oriented interface use the bsddb.db module instead. It mirrors the Oracle Berkeley DB C API. @@ -138,7 +138,7 @@ except _bsddb.DBCursorClosedError: # the database was modified during iteration. abort. pass -# When Python 2.3 not supported in bsddb3, we can change this to "finally" +# When Python 2.4 not supported in bsddb3, we can change this to "finally" except : self._in_iter -= 1 raise @@ -181,7 +181,7 @@ except _bsddb.DBCursorClosedError: # the database was modified during iteration. abort. pass -# When Python 2.3 not supported in bsddb3, we can change this to "finally" +# When Python 2.4 not supported in bsddb3, we can change this to "finally" except : self._in_iter -= 1 raise diff --git a/Lib/bsddb/dbobj.py b/Lib/bsddb/dbobj.py --- a/Lib/bsddb/dbobj.py +++ b/Lib/bsddb/dbobj.py @@ -30,12 +30,7 @@ import db if sys.version_info < (2, 6) : - try: - from UserDict import DictMixin - except ImportError: - # DictMixin is new in Python 2.3 - class DictMixin: pass - MutableMapping = DictMixin + from UserDict import DictMixin as MutableMapping else : import collections MutableMapping = collections.MutableMapping @@ -196,6 +191,8 @@ return self._cobj.set_bt_compare(*args, **kwargs) def set_cachesize(self, *args, **kwargs): return self._cobj.set_cachesize(*args, **kwargs) + def set_dup_compare(self, *args, **kwargs) : + return self._cobj.set_dup_compare(*args, **kwargs) def set_flags(self, *args, **kwargs): return self._cobj.set_flags(*args, **kwargs) def set_h_ffactor(self, *args, **kwargs): diff --git a/Lib/bsddb/dbshelve.py b/Lib/bsddb/dbshelve.py --- a/Lib/bsddb/dbshelve.py +++ b/Lib/bsddb/dbshelve.py @@ -43,7 +43,7 @@ if sys.version_info < (2, 6) : import cPickle else : - # When we drop support for python 2.3 and 2.4 + # When we drop support for python 2.4 # we could use: (in 2.5 we need a __future__ statement) # # with warnings.catch_warnings(): @@ -51,7 +51,7 @@ # ... # # We can not use "with" as is, because it would be invalid syntax - # in python 2.3, 2.4 and (with no __future__) 2.5. + # in python 2.4 and (with no __future__) 2.5. # Here we simulate "with" following PEP 343 : import warnings w = warnings.catch_warnings() @@ -65,32 +65,12 @@ w.__exit__() del w -#At version 2.3 cPickle switched to using protocol instead of bin -if sys.version_info >= (2, 3): - HIGHEST_PROTOCOL = cPickle.HIGHEST_PROTOCOL -# In python 2.3.*, "cPickle.dumps" accepts no -# named parameters. "pickle.dumps" accepts them, -# so this seems a bug. - if sys.version_info < (2, 4): - def _dumps(object, protocol): - return cPickle.dumps(object, protocol) - else : - def _dumps(object, protocol): - return cPickle.dumps(object, protocol=protocol) - -else: - HIGHEST_PROTOCOL = None - def _dumps(object, protocol): - return cPickle.dumps(object, bin=protocol) - +HIGHEST_PROTOCOL = cPickle.HIGHEST_PROTOCOL +def _dumps(object, protocol): + return cPickle.dumps(object, protocol=protocol) if sys.version_info < (2, 6) : - try: - from UserDict import DictMixin - except ImportError: - # DictMixin is new in Python 2.3 - class DictMixin: pass - MutableMapping = DictMixin + from UserDict import DictMixin as MutableMapping else : import collections MutableMapping = collections.MutableMapping diff --git a/Lib/bsddb/dbtables.py b/Lib/bsddb/dbtables.py --- a/Lib/bsddb/dbtables.py +++ b/Lib/bsddb/dbtables.py @@ -30,7 +30,7 @@ if sys.version_info < (2, 6) : import cPickle as pickle else : - # When we drop support for python 2.3 and 2.4 + # When we drop support for python 2.4 # we could use: (in 2.5 we need a __future__ statement) # # with warnings.catch_warnings(): @@ -38,7 +38,7 @@ # ... # # We can not use "with" as is, because it would be invalid syntax - # in python 2.3, 2.4 and (with no __future__) 2.5. + # in python 2.4 and (with no __future__) 2.5. # Here we simulate "with" following PEP 343 : import warnings w = warnings.catch_warnings() diff --git a/Lib/bsddb/test/test_all.py b/Lib/bsddb/test/test_all.py --- a/Lib/bsddb/test/test_all.py +++ b/Lib/bsddb/test/test_all.py @@ -392,10 +392,8 @@ return self._dbenv.get_tmp_dir().decode(charset) def get_data_dirs(self) : - # Have to use a list comprehension and not - # generators, because we are supporting Python 2.3. return tuple( - [i.decode(charset) for i in self._dbenv.get_data_dirs()]) + (i.decode(charset) for i in self._dbenv.get_data_dirs())) class DBSequence_py3k(object) : def __init__(self, db, *args, **kwargs) : @@ -484,6 +482,8 @@ print '-=' * 38 print db.DB_VERSION_STRING print 'bsddb.db.version(): %s' % (db.version(), ) + if db.version() >= (5, 0) : + print 'bsddb.db.full_version(): %s' %repr(db.full_version()) print 'bsddb.db.__version__: %s' % db.__version__ print 'bsddb.db.cvsid: %s' % db.cvsid @@ -528,7 +528,8 @@ # This path can be overriden via "set_test_path_prefix()". import os, os.path -get_new_path.prefix=os.path.join(os.sep,"tmp","z-Berkeley_DB") +get_new_path.prefix=os.path.join(os.environ.get("TMPDIR", + os.path.join(os.sep,"tmp")), "z-Berkeley_DB") get_new_path.num=0 def get_test_path_prefix() : diff --git a/Lib/bsddb/test/test_basics.py b/Lib/bsddb/test/test_basics.py --- a/Lib/bsddb/test/test_basics.py +++ b/Lib/bsddb/test/test_basics.py @@ -9,6 +9,7 @@ from pprint import pprint import unittest import time +import sys from test_all import db, test_support, verbose, get_new_environment_path, \ get_new_database_path @@ -44,13 +45,6 @@ _numKeys = 1002 # PRIVATE. NOTE: must be an even value - import sys - if sys.version_info < (2, 4): - def assertTrue(self, expr, msg=None): - self.failUnless(expr,msg=msg) - def assertFalse(self, expr, msg=None): - self.failIf(expr,msg=msg) - def setUp(self): if self.useEnv: self.homeDir=get_new_environment_path() @@ -74,7 +68,6 @@ # create and open the DB self.d = db.DB(self.env) if not self.useEnv : - if db.version() >= (4, 2) : self.d.set_cachesize(*self.cachesize) cachesize = self.d.get_cachesize() self.assertEqual(cachesize[0], self.cachesize[0]) @@ -161,7 +154,6 @@ try: d.delete('abcd') except db.DBNotFoundError, val: - import sys if sys.version_info < (2, 6) : self.assertEqual(val[0], db.DB_NOTFOUND) else : @@ -184,7 +176,6 @@ try: d.put('abcd', 'this should fail', flags=db.DB_NOOVERWRITE) except db.DBKeyExistError, val: - import sys if sys.version_info < (2, 6) : self.assertEqual(val[0], db.DB_KEYEXIST) else : @@ -338,7 +329,6 @@ rec = c.next() except db.DBNotFoundError, val: if get_raises_error: - import sys if sys.version_info < (2, 6) : self.assertEqual(val[0], db.DB_NOTFOUND) else : @@ -363,7 +353,6 @@ rec = c.prev() except db.DBNotFoundError, val: if get_raises_error: - import sys if sys.version_info < (2, 6) : self.assertEqual(val[0], db.DB_NOTFOUND) else : @@ -390,7 +379,6 @@ try: n = c.set('bad key') except db.DBNotFoundError, val: - import sys if sys.version_info < (2, 6) : self.assertEqual(val[0], db.DB_NOTFOUND) else : @@ -408,7 +396,6 @@ try: n = c.get_both('0404', 'bad data') except db.DBNotFoundError, val: - import sys if sys.version_info < (2, 6) : self.assertEqual(val[0], db.DB_NOTFOUND) else : @@ -441,7 +428,6 @@ rec = c.current() except db.DBKeyEmptyError, val: if get_raises_error: - import sys if sys.version_info < (2, 6) : self.assertEqual(val[0], db.DB_KEYEMPTY) else : @@ -490,7 +476,6 @@ # a bug may cause a NULL pointer dereference... getattr(c, method)(*args) except db.DBError, val: - import sys if sys.version_info < (2, 6) : self.assertEqual(val[0], 0) else : @@ -712,11 +697,6 @@ #---------------------------------------------------------------------- class BasicTransactionTestCase(BasicTestCase): - import sys - if sys.version_info < (2, 4): - def assertTrue(self, expr, msg=None): - return self.failUnless(expr,msg=msg) - if (sys.version_info < (2, 7)) or ((sys.version_info >= (3, 0)) and (sys.version_info < (3, 2))) : def assertIn(self, a, b, msg=None) : @@ -792,7 +772,6 @@ for log in logs: if verbose: print 'log file: ' + log - if db.version() >= (4,2): logs = self.env.log_archive(db.DB_ARCH_REMOVE) self.assertTrue(not logs) @@ -875,7 +854,6 @@ #---------------------------------------- - if db.version() >= (4, 2) : def test_get_tx_max(self) : self.assertEqual(self.env.get_tx_max(), 30) @@ -1098,11 +1076,6 @@ class PrivateObject(unittest.TestCase) : - import sys - if sys.version_info < (2, 4): - def assertTrue(self, expr, msg=None): - self.failUnless(expr,msg=msg) - def tearDown(self) : del self.obj @@ -1116,7 +1089,6 @@ self.assertTrue(a is b) # Object identity def test03_leak_assignment(self) : - import sys a = "example of private object" refcount = sys.getrefcount(a) self.obj.set_private(a) @@ -1125,7 +1097,6 @@ self.assertEqual(refcount, sys.getrefcount(a)) def test04_leak_GC(self) : - import sys a = "example of private object" refcount = sys.getrefcount(a) self.obj.set_private(a) @@ -1141,11 +1112,6 @@ self.obj = db.DB() class CrashAndBurn(unittest.TestCase) : - import sys - if sys.version_info < (2, 4): - def assertTrue(self, expr, msg=None): - self.failUnless(expr,msg=msg) - #def test01_OpenCrash(self) : # # See http://bugs.python.org/issue3307 # self.assertRaises(db.DBInvalidArgError, db.DB, None, 65535) diff --git a/Lib/bsddb/test/test_compare.py b/Lib/bsddb/test/test_compare.py --- a/Lib/bsddb/test/test_compare.py +++ b/Lib/bsddb/test/test_compare.py @@ -1,5 +1,5 @@ """ -TestCases for python DB Btree key comparison function. +TestCases for python DB duplicate and Btree key comparison function. """ import sys, os, re @@ -20,31 +20,24 @@ lexical_cmp = cmp -def lowercase_cmp(left, right): - return cmp (left.lower(), right.lower()) +def lowercase_cmp(left, right) : + return cmp(left.lower(), right.lower()) -def make_reverse_comparator (cmp): - def reverse (left, right, delegate=cmp): - return - delegate (left, right) +def make_reverse_comparator(cmp) : + def reverse(left, right, delegate=cmp) : + return - delegate(left, right) return reverse _expected_lexical_test_data = ['', 'CCCP', 'a', 'aaa', 'b', 'c', 'cccce', 'ccccf'] _expected_lowercase_test_data = ['', 'a', 'aaa', 'b', 'c', 'CC', 'cccce', 'ccccf', 'CCCP'] -class ComparatorTests (unittest.TestCase): - if sys.version_info < (2, 4) : - def assertTrue(self, expr, msg=None) : - return self.failUnless(expr,msg=msg) - - def comparator_test_helper (self, comparator, expected_data): +class ComparatorTests(unittest.TestCase) : + def comparator_test_helper(self, comparator, expected_data) : data = expected_data[:] import sys if sys.version_info < (2, 6) : - if sys.version_info < (2, 4) : - data.sort(comparator) - else : - data.sort(cmp=comparator) + data.sort(cmp=comparator) else : # Insertion Sort. Please, improve data2 = [] for i in data : @@ -60,143 +53,139 @@ self.assertEqual(data, expected_data, "comparator `%s' is not right: %s vs. %s" % (comparator, expected_data, data)) - def test_lexical_comparator (self): - self.comparator_test_helper (lexical_cmp, _expected_lexical_test_data) - def test_reverse_lexical_comparator (self): + def test_lexical_comparator(self) : + self.comparator_test_helper(lexical_cmp, _expected_lexical_test_data) + def test_reverse_lexical_comparator(self) : rev = _expected_lexical_test_data[:] - rev.reverse () - self.comparator_test_helper (make_reverse_comparator (lexical_cmp), + rev.reverse() + self.comparator_test_helper(make_reverse_comparator(lexical_cmp), rev) - def test_lowercase_comparator (self): - self.comparator_test_helper (lowercase_cmp, + def test_lowercase_comparator(self) : + self.comparator_test_helper(lowercase_cmp, _expected_lowercase_test_data) -class AbstractBtreeKeyCompareTestCase (unittest.TestCase): +class AbstractBtreeKeyCompareTestCase(unittest.TestCase) : env = None db = None - if sys.version_info < (2, 4) : - def assertTrue(self, expr, msg=None): - self.failUnless(expr,msg=msg) - if (sys.version_info < (2, 7)) or ((sys.version_info >= (3,0)) and (sys.version_info < (3, 2))) : def assertLess(self, a, b, msg=None) : return self.assertTrue(a= (3,0)) and + (sys.version_info < (3, 2))) : + def assertLess(self, a, b, msg=None) : + return self.assertTrue(a= (4, 2) : + def test_get_open_flags(self) : + self.db.open(self.path, dbtype=db.DB_HASH, flags = db.DB_CREATE) + self.assertEqual(db.DB_CREATE, self.db.get_open_flags()) + + def test_get_open_flags2(self) : + self.db.open(self.path, dbtype=db.DB_HASH, flags = db.DB_CREATE | + db.DB_THREAD) + self.assertEqual(db.DB_CREATE | db.DB_THREAD, self.db.get_open_flags()) + + def test_get_dbname_filename(self) : + self.db.open(self.path, dbtype=db.DB_HASH, flags = db.DB_CREATE) + self.assertEqual((self.path, None), self.db.get_dbname()) + + def test_get_dbname_filename_database(self) : + name = "jcea-random-name" + self.db.open(self.path, dbname=name, dbtype=db.DB_HASH, + flags = db.DB_CREATE) + self.assertEqual((self.path, name), self.db.get_dbname()) + def test_bt_minkey(self) : for i in [17, 108, 1030] : self.db.set_bt_minkey(i) @@ -44,8 +57,12 @@ self.db.set_priority(flag) self.assertEqual(flag, self.db.get_priority()) + def test_get_transactional(self) : + self.assertFalse(self.db.get_transactional()) + self.db.open(self.path, dbtype=db.DB_HASH, flags = db.DB_CREATE) + self.assertFalse(self.db.get_transactional()) + class DB_hash(DB) : - if db.version() >= (4, 2) : def test_h_ffactor(self) : for ffactor in [4, 16, 256] : self.db.set_h_ffactor(ffactor) @@ -84,7 +101,6 @@ del self.env test_support.rmtree(self.homeDir) - if db.version() >= (4, 2) : def test_flags(self) : self.db.set_flags(db.DB_CHKSUM) self.assertEqual(db.DB_CHKSUM, self.db.get_flags()) @@ -92,8 +108,14 @@ self.assertEqual(db.DB_TXN_NOT_DURABLE | db.DB_CHKSUM, self.db.get_flags()) + def test_get_transactional(self) : + self.assertFalse(self.db.get_transactional()) + # DB_AUTO_COMMIT = Implicit transaction + self.db.open("XXX", dbtype=db.DB_HASH, + flags = db.DB_CREATE | db.DB_AUTO_COMMIT) + self.assertTrue(self.db.get_transactional()) + class DB_recno(DB) : - if db.version() >= (4, 2) : def test_re_pad(self) : for i in [' ', '*'] : # Check chars self.db.set_re_pad(i) @@ -116,7 +138,6 @@ self.assertEqual(i, self.db.get_re_source()) class DB_queue(DB) : - if db.version() >= (4, 2) : def test_re_len(self) : for i in [33, 65, 300, 2000] : self.db.set_re_len(i) diff --git a/Lib/bsddb/test/test_dbenv.py b/Lib/bsddb/test/test_dbenv.py --- a/Lib/bsddb/test/test_dbenv.py +++ b/Lib/bsddb/test/test_dbenv.py @@ -7,14 +7,6 @@ #---------------------------------------------------------------------- class DBEnv(unittest.TestCase): - import sys - if sys.version_info < (2, 4) : - def assertTrue(self, expr, msg=None): - self.failUnless(expr,msg=msg) - - def assertFalse(self, expr, msg=None): - self.failIf(expr,msg=msg) - def setUp(self): self.homeDir = get_new_environment_path() self.env = db.DBEnv() @@ -25,12 +17,31 @@ test_support.rmtree(self.homeDir) class DBEnv_general(DBEnv) : + def test_get_open_flags(self) : + flags = db.DB_CREATE | db.DB_INIT_MPOOL + self.env.open(self.homeDir, flags) + self.assertEqual(flags, self.env.get_open_flags()) + + def test_get_open_flags2(self) : + flags = db.DB_CREATE | db.DB_INIT_MPOOL | \ + db.DB_INIT_LOCK | db.DB_THREAD + self.env.open(self.homeDir, flags) + self.assertEqual(flags, self.env.get_open_flags()) + if db.version() >= (4, 7) : def test_lk_partitions(self) : for i in [10, 20, 40] : self.env.set_lk_partitions(i) self.assertEqual(i, self.env.get_lk_partitions()) + def test_getset_intermediate_dir_mode(self) : + self.assertEqual(None, self.env.get_intermediate_dir_mode()) + for mode in ["rwx------", "rw-rw-rw-", "rw-r--r--"] : + self.env.set_intermediate_dir_mode(mode) + self.assertEqual(mode, self.env.get_intermediate_dir_mode()) + self.assertRaises(db.DBInvalidArgError, + self.env.set_intermediate_dir_mode, "abcde") + if db.version() >= (4, 6) : def test_thread(self) : for i in [16, 100, 1000] : @@ -58,21 +69,19 @@ self.env.set_lg_filemode(i) self.assertEqual(i, self.env.get_lg_filemode()) - if db.version() >= (4, 3) : - def test_mp_max_openfd(self) : - for i in [17, 31, 42] : - self.env.set_mp_max_openfd(i) - self.assertEqual(i, self.env.get_mp_max_openfd()) + def test_mp_max_openfd(self) : + for i in [17, 31, 42] : + self.env.set_mp_max_openfd(i) + self.assertEqual(i, self.env.get_mp_max_openfd()) - def test_mp_max_write(self) : - for i in [100, 200, 300] : - for j in [1, 2, 3] : - j *= 1000000 - self.env.set_mp_max_write(i, j) - v=self.env.get_mp_max_write() - self.assertEqual((i, j), v) + def test_mp_max_write(self) : + for i in [100, 200, 300] : + for j in [1, 2, 3] : + j *= 1000000 + self.env.set_mp_max_write(i, j) + v=self.env.get_mp_max_write() + self.assertEqual((i, j), v) - if db.version() >= (4, 2) : def test_invalid_txn(self) : # This environment doesn't support transactions self.assertRaises(db.DBInvalidArgError, self.env.txn_begin) @@ -115,7 +124,7 @@ self.assertEqual(i, self.env.get_lk_max_lockers()) def test_lg_regionmax(self) : - for i in [128, 256, 1024] : + for i in [128, 256, 1000] : i = i*1024*1024 self.env.set_lg_regionmax(i) j = self.env.get_lg_regionmax() @@ -127,8 +136,7 @@ db.DB_LOCK_MINLOCKS, db.DB_LOCK_MINWRITE, db.DB_LOCK_OLDEST, db.DB_LOCK_RANDOM, db.DB_LOCK_YOUNGEST] - if db.version() >= (4, 3) : - flags.append(db.DB_LOCK_MAXWRITE) + flags.append(db.DB_LOCK_MAXWRITE) for i in flags : self.env.set_lk_detect(i) @@ -172,8 +180,12 @@ self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL) cachesize = (0, 2*1024*1024, 1) self.assertRaises(db.DBInvalidArgError, - self.env.set_cachesize, *cachesize) - self.assertEqual(cachesize2, self.env.get_cachesize()) + self.env.set_cachesize, *cachesize) + cachesize3 = self.env.get_cachesize() + self.assertEqual(cachesize2[0], cachesize3[0]) + self.assertEqual(cachesize2[2], cachesize3[2]) + # In Berkeley DB 5.1, the cachesize can change when opening the Env + self.assertTrue(cachesize2[1] <= cachesize3[1]) def test_set_cachesize_dbenv_db(self) : # You can not configure the cachesize using @@ -305,7 +317,7 @@ self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL | db.DB_INIT_LOG | db.DB_INIT_TXN) - if db.version() >= (4, 5) : + if (db.version() >= (4, 5)) and (db.version() < (5, 2)) : def test_tx_max(self) : txns=[] def tx() : diff --git a/Lib/bsddb/test/test_dbshelve.py b/Lib/bsddb/test/test_dbshelve.py --- a/Lib/bsddb/test/test_dbshelve.py +++ b/Lib/bsddb/test/test_dbshelve.py @@ -12,9 +12,6 @@ -if sys.version_info < (2, 4) : - from sets import Set as set - #---------------------------------------------------------------------- @@ -33,10 +30,6 @@ class DBShelveTestCase(unittest.TestCase): - if sys.version_info < (2, 4): - def assertTrue(self, expr, msg=None): - return self.failUnless(expr,msg=msg) - if (sys.version_info < (2, 7)) or ((sys.version_info >= (3, 0)) and (sys.version_info < (3, 2))) : def assertIn(self, a, b, msg=None) : diff --git a/Lib/bsddb/test/test_distributed_transactions.py b/Lib/bsddb/test/test_distributed_transactions.py --- a/Lib/bsddb/test/test_distributed_transactions.py +++ b/Lib/bsddb/test/test_distributed_transactions.py @@ -7,13 +7,6 @@ from test_all import db, test_support, get_new_environment_path, \ get_new_database_path -try : - a=set() -except : # Python 2.3 - from sets import Set as set -else : - del a - from test_all import verbose #---------------------------------------------------------------------- @@ -37,15 +30,11 @@ self.db = db.DB(self.dbenv) self.db.set_re_len(db.DB_GID_SIZE) if must_open_db : - if db.version() >= (4,2) : txn=self.dbenv.txn_begin() self.db.open(self.filename, db.DB_QUEUE, db.DB_CREATE | db.DB_THREAD, 0666, txn=txn) txn.commit() - else : - self.db.open(self.filename, - db.DB_QUEUE, db.DB_CREATE | db.DB_THREAD, 0666) def setUp(self) : self.homeDir = get_new_environment_path() diff --git a/Lib/bsddb/test/test_early_close.py b/Lib/bsddb/test/test_early_close.py --- a/Lib/bsddb/test/test_early_close.py +++ b/Lib/bsddb/test/test_early_close.py @@ -174,7 +174,7 @@ txn.commit() warnings.resetwarnings() else : - # When we drop support for python 2.3 and 2.4 + # When we drop support for python 2.4 # we could use: (in 2.5 we need a __future__ statement) # # with warnings.catch_warnings(): @@ -182,7 +182,7 @@ # txn.commit() # # We can not use "with" as is, because it would be invalid syntax - # in python 2.3, 2.4 and (with no __future__) 2.5. + # in python 2.4 and (with no __future__) 2.5. # Here we simulate "with" following PEP 343 : w = warnings.catch_warnings() w.__enter__() @@ -194,15 +194,14 @@ self.assertRaises(db.DBCursorClosedError, c2.first) - if db.version() > (4,3,0) : - def test07_close_db_before_sequence(self): - import os.path - path=os.path.join(self.homeDir,self.filename) - d = db.DB() - d.open(path, db.DB_BTREE, db.DB_CREATE | db.DB_THREAD, 0666) - dbs=db.DBSequence(d) - d.close() # This "close" should close the child DBSequence also - dbs.close() # If not closed, core dump (in Berkeley DB 4.6.*) + def test07_close_db_before_sequence(self): + import os.path + path=os.path.join(self.homeDir,self.filename) + d = db.DB() + d.open(path, db.DB_BTREE, db.DB_CREATE | db.DB_THREAD, 0666) + dbs=db.DBSequence(d) + d.close() # This "close" should close the child DBSequence also + dbs.close() # If not closed, core dump (in Berkeley DB 4.6.*) #---------------------------------------------------------------------- diff --git a/Lib/bsddb/test/test_lock.py b/Lib/bsddb/test/test_lock.py --- a/Lib/bsddb/test/test_lock.py +++ b/Lib/bsddb/test/test_lock.py @@ -19,12 +19,6 @@ #---------------------------------------------------------------------- class LockingTestCase(unittest.TestCase): - import sys - if sys.version_info < (2, 4) : - def assertTrue(self, expr, msg=None): - self.failUnless(expr,msg=msg) - - def setUp(self): self.homeDir = get_new_environment_path() self.env = db.DBEnv() @@ -89,7 +83,6 @@ for t in threads: t.join() - if db.version() >= (4, 2) : def test03_lock_timeout(self): self.env.set_timeout(0, db.DB_SET_LOCK_TIMEOUT) self.assertEqual(self.env.get_timeout(db.DB_SET_LOCK_TIMEOUT), 0) diff --git a/Lib/bsddb/test/test_misc.py b/Lib/bsddb/test/test_misc.py --- a/Lib/bsddb/test/test_misc.py +++ b/Lib/bsddb/test/test_misc.py @@ -9,13 +9,6 @@ #---------------------------------------------------------------------- class MiscTestCase(unittest.TestCase): - if sys.version_info < (2, 4) : - def assertTrue(self, expr, msg=None): - self.failUnless(expr, msg=msg) - - def assertFalse(self, expr, msg=None): - self.failIf(expr, msg=msg) - def setUp(self): self.filename = get_new_database_path() self.homeDir = get_new_environment_path() @@ -97,10 +90,6 @@ test_support.unlink(self.filename) def test07_DB_set_flags_persists(self): - if db.version() < (4,2): - # The get_flags API required for this to work is only available - # in Berkeley DB >= 4.2 - return try: db1 = db.DB() db1.set_flags(db.DB_DUPSORT) diff --git a/Lib/bsddb/test/test_queue.py b/Lib/bsddb/test/test_queue.py --- a/Lib/bsddb/test/test_queue.py +++ b/Lib/bsddb/test/test_queue.py @@ -99,11 +99,6 @@ print '\n', '-=' * 30 print "Running %s.test02_basicPost32..." % self.__class__.__name__ - if db.version() < (3, 2, 0): - if verbose: - print "Test not run, DB not new enough..." - return - d = db.DB() d.set_re_len(40) # Queues must be fixed length d.open(self.filename, db.DB_QUEUE, db.DB_CREATE) diff --git a/Lib/bsddb/test/test_recno.py b/Lib/bsddb/test/test_recno.py --- a/Lib/bsddb/test/test_recno.py +++ b/Lib/bsddb/test/test_recno.py @@ -14,12 +14,6 @@ #---------------------------------------------------------------------- class SimpleRecnoTestCase(unittest.TestCase): - if sys.version_info < (2, 4) : - def assertFalse(self, expr, msg=None) : - return self.failIf(expr,msg=msg) - def assertTrue(self, expr, msg=None) : - return self.assertTrue(expr, msg=msg) - if (sys.version_info < (2, 7)) or ((sys.version_info >= (3, 0)) and (sys.version_info < (3, 2))) : def assertIsInstance(self, obj, datatype, msg=None) : @@ -236,7 +230,9 @@ d.close() # get the text from the backing source - text = open(source, 'r').read() + f = open(source, 'r') + text = f.read() + f.close() text = text.strip() if verbose: print text @@ -256,7 +252,9 @@ d.sync() d.close() - text = open(source, 'r').read() + f = open(source, 'r') + text = f.read() + f.close() text = text.strip() if verbose: print text @@ -298,6 +296,18 @@ c.close() d.close() + def test04_get_size_empty(self) : + d = db.DB() + d.open(self.filename, dbtype=db.DB_RECNO, flags=db.DB_CREATE) + + row_id = d.append(' ') + self.assertEqual(1, d.get_size(key=row_id)) + row_id = d.append('') + self.assertEqual(0, d.get_size(key=row_id)) + + + + #---------------------------------------------------------------------- diff --git a/Lib/bsddb/test/test_replication.py b/Lib/bsddb/test/test_replication.py --- a/Lib/bsddb/test/test_replication.py +++ b/Lib/bsddb/test/test_replication.py @@ -12,11 +12,6 @@ #---------------------------------------------------------------------- class DBReplication(unittest.TestCase) : - import sys - if sys.version_info < (2, 4) : - def assertTrue(self, expr, msg=None): - self.failUnless(expr,msg=msg) - def setUp(self) : self.homeDirMaster = get_new_environment_path() self.homeDirClient = get_new_environment_path() @@ -76,13 +71,57 @@ class DBReplicationManager(DBReplication) : def test01_basic_replication(self) : master_port = test_support.find_unused_port() - self.dbenvMaster.repmgr_set_local_site("127.0.0.1", master_port) client_port = test_support.find_unused_port() - self.dbenvClient.repmgr_set_local_site("127.0.0.1", client_port) - self.dbenvMaster.repmgr_add_remote_site("127.0.0.1", client_port) - self.dbenvClient.repmgr_add_remote_site("127.0.0.1", master_port) - self.dbenvMaster.rep_set_nsites(2) - self.dbenvClient.rep_set_nsites(2) + if db.version() >= (5, 2) : + self.site = self.dbenvMaster.repmgr_site("127.0.0.1", master_port) + self.site.set_config(db.DB_GROUP_CREATOR, True) + self.site.set_config(db.DB_LOCAL_SITE, True) + self.site2 = self.dbenvMaster.repmgr_site("127.0.0.1", client_port) + + self.site3 = self.dbenvClient.repmgr_site("127.0.0.1", master_port) + self.site3.set_config(db.DB_BOOTSTRAP_HELPER, True) + self.site4 = self.dbenvClient.repmgr_site("127.0.0.1", client_port) + self.site4.set_config(db.DB_LOCAL_SITE, True) + + d = { + db.DB_BOOTSTRAP_HELPER: [False, False, True, False], + db.DB_GROUP_CREATOR: [True, False, False, False], + db.DB_LEGACY: [False, False, False, False], + db.DB_LOCAL_SITE: [True, False, False, True], + db.DB_REPMGR_PEER: [False, False, False, False ], + } + + for i, j in d.items() : + for k, v in \ + zip([self.site, self.site2, self.site3, self.site4], j) : + if v : + self.assertTrue(k.get_config(i)) + else : + self.assertFalse(k.get_config(i)) + + self.assertNotEqual(self.site.get_eid(), self.site2.get_eid()) + self.assertNotEqual(self.site3.get_eid(), self.site4.get_eid()) + + for i, j in zip([self.site, self.site2, self.site3, self.site4], \ + [master_port, client_port, master_port, client_port]) : + addr = i.get_address() + self.assertEqual(addr, ("127.0.0.1", j)) + + for i in [self.site, self.site2] : + self.assertEqual(i.get_address(), + self.dbenvMaster.repmgr_site_by_eid(i.get_eid()).get_address()) + for i in [self.site3, self.site4] : + self.assertEqual(i.get_address(), + self.dbenvClient.repmgr_site_by_eid(i.get_eid()).get_address()) + else : + self.dbenvMaster.repmgr_set_local_site("127.0.0.1", master_port) + self.dbenvClient.repmgr_set_local_site("127.0.0.1", client_port) + self.dbenvMaster.repmgr_add_remote_site("127.0.0.1", client_port) + self.dbenvClient.repmgr_add_remote_site("127.0.0.1", master_port) + + self.dbenvMaster.rep_set_nsites(2) + self.dbenvClient.rep_set_nsites(2) + self.dbenvMaster.rep_set_priority(10) self.dbenvClient.rep_set_priority(0) @@ -144,17 +183,19 @@ d = self.dbenvMaster.repmgr_site_list() self.assertEqual(len(d), 1) - self.assertEqual(d[0][0], "127.0.0.1") - self.assertEqual(d[0][1], client_port) - self.assertTrue((d[0][2]==db.DB_REPMGR_CONNECTED) or \ - (d[0][2]==db.DB_REPMGR_DISCONNECTED)) + d = d.values()[0] # There is only one + self.assertEqual(d[0], "127.0.0.1") + self.assertEqual(d[1], client_port) + self.assertTrue((d[2]==db.DB_REPMGR_CONNECTED) or \ + (d[2]==db.DB_REPMGR_DISCONNECTED)) d = self.dbenvClient.repmgr_site_list() self.assertEqual(len(d), 1) - self.assertEqual(d[0][0], "127.0.0.1") - self.assertEqual(d[0][1], master_port) - self.assertTrue((d[0][2]==db.DB_REPMGR_CONNECTED) or \ - (d[0][2]==db.DB_REPMGR_DISCONNECTED)) + d = d.values()[0] # There is only one + self.assertEqual(d[0], "127.0.0.1") + self.assertEqual(d[1], master_port) + self.assertTrue((d[2]==db.DB_REPMGR_CONNECTED) or \ + (d[2]==db.DB_REPMGR_DISCONNECTED)) if db.version() >= (4,6) : d = self.dbenvMaster.repmgr_stat(flags=db.DB_STAT_CLEAR); @@ -461,6 +502,13 @@ self.assertTrue(self.confirmed_master) + # Race condition showed up after upgrading to Solaris 10 Update 10 + # https://forums.oracle.com/forums/thread.jspa?messageID=9902860 + # jcea at jcea.es: See private email from Paula Bingham (Oracle), + # in 20110929. + while not (self.dbenvClient.rep_stat()["startup_complete"]) : + pass + if db.version() >= (4,7) : def test04_test_clockskew(self) : fast, slow = 1234, 1230 diff --git a/Lib/bsddb/test/test_sequence.py b/Lib/bsddb/test/test_sequence.py --- a/Lib/bsddb/test/test_sequence.py +++ b/Lib/bsddb/test/test_sequence.py @@ -5,11 +5,6 @@ class DBSequenceTest(unittest.TestCase): - import sys - if sys.version_info < (2, 4) : - def assertTrue(self, expr, msg=None): - self.failUnless(expr,msg=msg) - def setUp(self): self.int_32_max = 0x100000000 self.homeDir = get_new_environment_path() @@ -133,8 +128,7 @@ def test_suite(): suite = unittest.TestSuite() - if db.version() >= (4,3): - suite.addTest(unittest.makeSuite(DBSequenceTest)) + suite.addTest(unittest.makeSuite(DBSequenceTest)) return suite diff --git a/Lib/bsddb/test/test_thread.py b/Lib/bsddb/test/test_thread.py --- a/Lib/bsddb/test/test_thread.py +++ b/Lib/bsddb/test/test_thread.py @@ -35,10 +35,6 @@ dbsetflags = 0 envflags = 0 - if sys.version_info < (2, 4) : - def assertTrue(self, expr, msg=None): - self.failUnless(expr,msg=msg) - def setUp(self): if verbose: dbutils._deadlock_VerboseFile = sys.stdout diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -793,6 +793,9 @@ Extension Modules ----------------- +- Issue #17477: Update the bsddb module to pybsddb 5.3.0, supporting + db-5.x, and dropping support for db-4.1 and db-4.2. + - Issue #17192: Update the ctypes module's libffi to v3.0.13. This specifically addresses a stack misalignment issue on x86 and issues on some more recent platforms. diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -64,7 +64,7 @@ * * http://www.python.org/peps/pep-0291.html * - * This module contains 6 types: + * This module contains 7 types: * * DB (Database) * DBCursor (Database Cursor) @@ -72,6 +72,7 @@ * DBTxn (An explicit database transaction) * DBLock (A lock handle) * DBSequence (Sequence) + * DBSite (Site) * * More datatypes added: * @@ -135,34 +136,11 @@ #define MYDB_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS; #define MYDB_END_ALLOW_THREADS Py_END_ALLOW_THREADS; -/* For 2.3, use the PyGILState_ calls */ -#if (PY_VERSION_HEX >= 0x02030000) -#define MYDB_USE_GILSTATE -#endif - /* and these are for calling C --> Python */ -#if defined(MYDB_USE_GILSTATE) #define MYDB_BEGIN_BLOCK_THREADS \ PyGILState_STATE __savestate = PyGILState_Ensure(); #define MYDB_END_BLOCK_THREADS \ PyGILState_Release(__savestate); -#else /* MYDB_USE_GILSTATE */ -/* Pre GILState API - do it the long old way */ -static PyInterpreterState* _db_interpreterState = NULL; -#define MYDB_BEGIN_BLOCK_THREADS { \ - PyThreadState* prevState; \ - PyThreadState* newState; \ - PyEval_AcquireLock(); \ - newState = PyThreadState_New(_db_interpreterState); \ - prevState = PyThreadState_Swap(newState); - -#define MYDB_END_BLOCK_THREADS \ - newState = PyThreadState_Swap(prevState); \ - PyThreadState_Clear(newState); \ - PyEval_ReleaseLock(); \ - PyThreadState_Delete(newState); \ - } -#endif /* MYDB_USE_GILSTATE */ #else /* Compiled without threads - avoid all this cruft */ @@ -187,24 +165,24 @@ static PyObject* DBRunRecoveryError; /* DB_RUNRECOVERY */ static PyObject* DBVerifyBadError; /* DB_VERIFY_BAD */ static PyObject* DBNoServerError; /* DB_NOSERVER */ +#if (DBVER < 52) static PyObject* DBNoServerHomeError; /* DB_NOSERVER_HOME */ static PyObject* DBNoServerIDError; /* DB_NOSERVER_ID */ +#endif static PyObject* DBPageNotFoundError; /* DB_PAGE_NOTFOUND */ static PyObject* DBSecondaryBadError; /* DB_SECONDARY_BAD */ static PyObject* DBInvalidArgError; /* EINVAL */ static PyObject* DBAccessError; /* EACCES */ static PyObject* DBNoSpaceError; /* ENOSPC */ -static PyObject* DBNoMemoryError; /* DB_BUFFER_SMALL (ENOMEM when < 4.3) */ +static PyObject* DBNoMemoryError; /* DB_BUFFER_SMALL */ static PyObject* DBAgainError; /* EAGAIN */ static PyObject* DBBusyError; /* EBUSY */ static PyObject* DBFileExistsError; /* EEXIST */ static PyObject* DBNoSuchFileError; /* ENOENT */ static PyObject* DBPermissionsError; /* EPERM */ -#if (DBVER >= 42) static PyObject* DBRepHandleDeadError; /* DB_REP_HANDLE_DEAD */ -#endif #if (DBVER >= 44) static PyObject* DBRepLockoutError; /* DB_REP_LOCKOUT */ #endif @@ -220,10 +198,6 @@ static PyObject* DBRepUnavailError; /* DB_REP_UNAVAIL */ -#if (DBVER < 43) -#define DB_BUFFER_SMALL ENOMEM -#endif - #if (DBVER < 48) #define DB_GID_SIZE DB_XIDDATASIZE #endif @@ -252,8 +226,9 @@ staticforward PyTypeObject DB_Type, DBCursor_Type, DBEnv_Type, DBTxn_Type, DBLock_Type, DBLogCursor_Type; -#if (DBVER >= 43) staticforward PyTypeObject DBSequence_Type; +#if (DBVER >= 52) +staticforward PyTypeObject DBSite_Type; #endif #ifndef Py_TYPE @@ -267,8 +242,9 @@ #define DBEnvObject_Check(v) (Py_TYPE(v) == &DBEnv_Type) #define DBTxnObject_Check(v) (Py_TYPE(v) == &DBTxn_Type) #define DBLockObject_Check(v) (Py_TYPE(v) == &DBLock_Type) -#if (DBVER >= 43) #define DBSequenceObject_Check(v) (Py_TYPE(v) == &DBSequence_Type) +#if (DBVER >= 52) +#define DBSiteObject_Check(v) (Py_TYPE(v) == &DBSite_Type) #endif #if (DBVER < 46) @@ -372,9 +348,12 @@ #define CHECK_LOGCURSOR_NOT_CLOSED(logcurs) \ _CHECK_OBJECT_NOT_CLOSED(logcurs->logc, DBCursorClosedError, DBLogCursor) -#if (DBVER >= 43) #define CHECK_SEQUENCE_NOT_CLOSED(curs) \ _CHECK_OBJECT_NOT_CLOSED(curs->sequence, DBError, DBSequence) + +#if (DBVER >= 52) +#define CHECK_SITE_NOT_CLOSED(db_site) \ + _CHECK_OBJECT_NOT_CLOSED(db_site->site, DBError, DBSite) #endif #define CHECK_DBFLAG(mydb, flag) (((mydb)->flags & (flag)) || \ @@ -567,12 +546,8 @@ /* Callback used to save away more information about errors from the DB * library. */ static char _db_errmsg[1024]; -#if (DBVER <= 42) -static void _db_errorCallback(const char* prefix, char* msg) -#else static void _db_errorCallback(const DB_ENV *db_env, const char* prefix, const char* msg) -#endif { our_strlcpy(_db_errmsg, msg, sizeof(_db_errmsg)); } @@ -626,11 +601,7 @@ return NULL; } -#if (PY_VERSION_HEX >= 0x02040000) r = PyTuple_Pack(2, a, b) ; -#else - r = Py_BuildValue("OO", a, b); -#endif Py_DECREF(a); Py_DECREF(b); return r; @@ -696,16 +667,15 @@ case DB_RUNRECOVERY: errObj = DBRunRecoveryError; break; case DB_VERIFY_BAD: errObj = DBVerifyBadError; break; case DB_NOSERVER: errObj = DBNoServerError; break; +#if (DBVER < 52) case DB_NOSERVER_HOME: errObj = DBNoServerHomeError; break; case DB_NOSERVER_ID: errObj = DBNoServerIDError; break; +#endif case DB_PAGE_NOTFOUND: errObj = DBPageNotFoundError; break; case DB_SECONDARY_BAD: errObj = DBSecondaryBadError; break; case DB_BUFFER_SMALL: errObj = DBNoMemoryError; break; -#if (DBVER >= 43) - /* ENOMEM and DB_BUFFER_SMALL were one and the same until 4.3 */ case ENOMEM: errObj = PyExc_MemoryError; break; -#endif case EINVAL: errObj = DBInvalidArgError; break; case EACCES: errObj = DBAccessError; break; case ENOSPC: errObj = DBNoSpaceError; break; @@ -715,9 +685,7 @@ case ENOENT: errObj = DBNoSuchFileError; break; case EPERM : errObj = DBPermissionsError; break; -#if (DBVER >= 42) case DB_REP_HANDLE_DEAD : errObj = DBRepHandleDeadError; break; -#endif #if (DBVER >= 44) case DB_REP_LOCKOUT : errObj = DBRepLockoutError; break; #endif @@ -902,7 +870,6 @@ Py_XDECREF(v); } -#if (DBVER >= 43) /* add an db_seq_t to a dictionary using the given name as a key */ static void _addDb_seq_tToDict(PyObject* dict, char *name, db_seq_t value) { @@ -912,7 +879,6 @@ Py_XDECREF(v); } -#endif static void _addDB_lsnToDict(PyObject* dict, char *name, DB_LSN value) { @@ -942,11 +908,10 @@ self->myenvobj = NULL; self->db = NULL; self->children_cursors = NULL; -#if (DBVER >=43) self->children_sequences = NULL; -#endif self->associateCallback = NULL; self->btCompareCallback = NULL; + self->dupCompareCallback = NULL; self->primaryDBType = 0; Py_INCREF(Py_None); self->private_obj = Py_None; @@ -1028,6 +993,10 @@ Py_DECREF(self->btCompareCallback); self->btCompareCallback = NULL; } + if (self->dupCompareCallback != NULL) { + Py_DECREF(self->dupCompareCallback); + self->dupCompareCallback = NULL; + } Py_DECREF(self->private_obj); PyObject_Del(self); } @@ -1147,6 +1116,9 @@ self->children_dbs = NULL; self->children_txns = NULL; self->children_logcursors = NULL ; +#if (DBVER >= 52) + self->children_sites = NULL; +#endif Py_INCREF(Py_None); self->private_obj = Py_None; Py_INCREF(Py_None); @@ -1340,7 +1312,6 @@ } -#if (DBVER >= 43) static DBSequenceObject* newDBSequenceObject(DBObject* mydb, int flags) { @@ -1396,6 +1367,53 @@ Py_DECREF(self->mydb); PyObject_Del(self); } + +#if (DBVER >= 52) +static DBSiteObject* +newDBSiteObject(DB_SITE* sitep, DBEnvObject* env) +{ + DBSiteObject* self; + + self = PyObject_New(DBSiteObject, &DBSite_Type); + + if (self == NULL) + return NULL; + + self->site = sitep; + self->env = env; + + INSERT_IN_DOUBLE_LINKED_LIST(self->env->children_sites, self); + + self->in_weakreflist = NULL; + Py_INCREF(self->env); + return self; +} + +/* Forward declaration */ +static PyObject *DBSite_close_internal(DBSiteObject* self); + +static void +DBSite_dealloc(DBSiteObject* self) +{ + PyObject *dummy; + + if (self->site != NULL) { + dummy = DBSite_close_internal(self); + /* + ** Raising exceptions while doing + ** garbage collection is a fatal error. + */ + if (dummy) + Py_DECREF(dummy); + else + PyErr_Clear(); + } + if (self->in_weakreflist != NULL) { + PyObject_ClearWeakRefs((PyObject *) self); + } + Py_DECREF(self->env); + PyObject_Del(self); +} #endif /* --------------------------------------------------------------------- */ @@ -1652,12 +1670,10 @@ Py_XDECREF(dummy); } -#if (DBVER >= 43) while(self->children_sequences) { dummy=DBSequence_close_internal(self->children_sequences,0,0); Py_XDECREF(dummy); } -#endif /* ** "do_not_close" is used to dispose all related objects in the @@ -2074,20 +2090,12 @@ keyObj = NUMBER_FromLong(*(int *)key.data); else keyObj = Build_PyString(key.data, key.size); -#if (PY_VERSION_HEX >= 0x02040000) retval = PyTuple_Pack(3, keyObj, pkeyObj, dataObj); -#else - retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj); -#endif Py_DECREF(keyObj); } else /* return just the pkey and data */ { -#if (PY_VERSION_HEX >= 0x02040000) retval = PyTuple_Pack(2, pkeyObj, dataObj); -#else - retval = Py_BuildValue("OO", pkeyObj, dataObj); -#endif } Py_DECREF(dataObj); Py_DECREF(pkeyObj); @@ -2132,7 +2140,7 @@ MYDB_BEGIN_ALLOW_THREADS; err = self->db->get(self->db, txn, &key, &data, flags); MYDB_END_ALLOW_THREADS; - if (err == DB_BUFFER_SMALL) { + if ((err == DB_BUFFER_SMALL) || (err == 0)) { retval = NUMBER_FromLong((long)data.size); err = 0; } @@ -2385,9 +2393,7 @@ return NULL; } -#if (DBVER >= 42) self->db->get_flags(self->db, &self->setflags); -#endif self->flags = flags; @@ -2539,6 +2545,37 @@ #endif static PyObject* +DB_get_dbname(DBObject* self) +{ + int err; + const char *filename, *dbname; + + CHECK_DB_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db->get_dbname(self->db, &filename, &dbname); + MYDB_END_ALLOW_THREADS; + RETURN_IF_ERR(); + /* If "dbname==NULL", it is correctly converted to "None" */ + return Py_BuildValue("(ss)", filename, dbname); +} + +static PyObject* +DB_get_open_flags(DBObject* self) +{ + int err; + unsigned int flags; + + CHECK_DB_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db->get_open_flags(self->db, &flags); + MYDB_END_ALLOW_THREADS; + RETURN_IF_ERR(); + return NUMBER_FromLong(flags); +} + +static PyObject* DB_set_q_extentsize(DBObject* self, PyObject* args) { int err; @@ -2555,7 +2592,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DB_get_q_extentsize(DBObject* self) { @@ -2570,7 +2606,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(extentsize); } -#endif static PyObject* DB_set_bt_minkey(DBObject* self, PyObject* args) @@ -2588,7 +2623,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DB_get_bt_minkey(DBObject* self) { @@ -2603,7 +2637,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(bt_minkey); } -#endif static int _default_cmp(const DBT *leftKey, @@ -2740,6 +2773,120 @@ RETURN_NONE(); } +static int +_db_dupCompareCallback(DB* db, + const DBT *leftKey, + const DBT *rightKey) +{ + int res = 0; + PyObject *args; + PyObject *result = NULL; + DBObject *self = (DBObject *)db->app_private; + + if (self == NULL || self->dupCompareCallback == NULL) { + MYDB_BEGIN_BLOCK_THREADS; + PyErr_SetString(PyExc_TypeError, + (self == 0 + ? "DB_dup_compare db is NULL." + : "DB_dup_compare callback is NULL.")); + /* we're in a callback within the DB code, we can't raise */ + PyErr_Print(); + res = _default_cmp(leftKey, rightKey); + MYDB_END_BLOCK_THREADS; + } else { + MYDB_BEGIN_BLOCK_THREADS; + + args = BuildValue_SS(leftKey->data, leftKey->size, rightKey->data, rightKey->size); + if (args != NULL) { + result = PyEval_CallObject(self->dupCompareCallback, args); + } + if (args == NULL || result == NULL) { + /* we're in a callback within the DB code, we can't raise */ + PyErr_Print(); + res = _default_cmp(leftKey, rightKey); + } else if (NUMBER_Check(result)) { + res = NUMBER_AsLong(result); + } else { + PyErr_SetString(PyExc_TypeError, + "DB_dup_compare callback MUST return an int."); + /* we're in a callback within the DB code, we can't raise */ + PyErr_Print(); + res = _default_cmp(leftKey, rightKey); + } + + Py_XDECREF(args); + Py_XDECREF(result); + + MYDB_END_BLOCK_THREADS; + } + return res; +} + +static PyObject* +DB_set_dup_compare(DBObject* self, PyObject* comparator) +{ + int err; + PyObject *tuple, *result; + + CHECK_DB_NOT_CLOSED(self); + + if (!PyCallable_Check(comparator)) { + makeTypeError("Callable", comparator); + return NULL; + } + + /* + * Perform a test call of the comparator function with two empty + * string objects here. verify that it returns an int (0). + * err if not. + */ + tuple = Py_BuildValue("(ss)", "", ""); + result = PyEval_CallObject(comparator, tuple); + Py_DECREF(tuple); + if (result == NULL) + return NULL; + if (!NUMBER_Check(result)) { + Py_DECREF(result); + PyErr_SetString(PyExc_TypeError, + "callback MUST return an int"); + return NULL; + } else if (NUMBER_AsLong(result) != 0) { + Py_DECREF(result); + PyErr_SetString(PyExc_TypeError, + "callback failed to return 0 on two empty strings"); + return NULL; + } + Py_DECREF(result); + + /* We don't accept multiple set_dup_compare operations, in order to + * simplify the code. This would have no real use, as one cannot + * change the function once the db is opened anyway */ + if (self->dupCompareCallback != NULL) { + PyErr_SetString(PyExc_RuntimeError, "set_dup_compare() cannot be called more than once"); + return NULL; + } + + Py_INCREF(comparator); + self->dupCompareCallback = comparator; + + /* This is to workaround a problem with un-initialized threads (see + comment in DB_associate) */ +#ifdef WITH_THREAD + PyEval_InitThreads(); +#endif + + err = self->db->set_dup_compare(self->db, _db_dupCompareCallback); + + if (err) { + /* restore the old state in case of error */ + Py_DECREF(comparator); + self->dupCompareCallback = NULL; + } + + RETURN_IF_ERR(); + RETURN_NONE(); +} + static PyObject* DB_set_cachesize(DBObject* self, PyObject* args) @@ -2759,7 +2906,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DB_get_cachesize(DBObject* self) { @@ -2777,7 +2923,6 @@ return Py_BuildValue("(iii)", gbytes, bytes, ncache); } -#endif static PyObject* DB_set_flags(DBObject* self, PyObject* args) @@ -2797,7 +2942,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DB_get_flags(DBObject* self) { @@ -2812,7 +2956,34 @@ RETURN_IF_ERR(); return NUMBER_FromLong(flags); } -#endif + +static PyObject* +DB_get_transactional(DBObject* self) +{ + int err; + + CHECK_DB_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db->get_transactional(self->db); + MYDB_END_ALLOW_THREADS; + + if(err == 0) { + Py_INCREF(Py_False); + return Py_False; + } else if(err == 1) { + Py_INCREF(Py_True); + return Py_True; + } + + /* + ** If we reach there, there was an error. The + ** "return" should be unreachable. + */ + RETURN_IF_ERR(); + assert(0); /* This code SHOULD be unreachable */ + return NULL; +} static PyObject* DB_set_h_ffactor(DBObject* self, PyObject* args) @@ -2830,7 +3001,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DB_get_h_ffactor(DBObject* self) { @@ -2845,7 +3015,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(ffactor); } -#endif static PyObject* DB_set_h_nelem(DBObject* self, PyObject* args) @@ -2863,7 +3032,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DB_get_h_nelem(DBObject* self) { @@ -2878,7 +3046,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(nelem); } -#endif static PyObject* DB_set_lorder(DBObject* self, PyObject* args) @@ -2896,7 +3063,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DB_get_lorder(DBObject* self) { @@ -2911,7 +3077,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(lorder); } -#endif static PyObject* DB_set_pagesize(DBObject* self, PyObject* args) @@ -2929,7 +3094,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DB_get_pagesize(DBObject* self) { @@ -2944,7 +3108,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(pagesize); } -#endif static PyObject* DB_set_re_delim(DBObject* self, PyObject* args) @@ -2967,7 +3130,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DB_get_re_delim(DBObject* self) { @@ -2981,7 +3143,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(re_delim); } -#endif static PyObject* DB_set_re_len(DBObject* self, PyObject* args) @@ -2999,7 +3160,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DB_get_re_len(DBObject* self) { @@ -3014,7 +3174,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(re_len); } -#endif static PyObject* DB_set_re_pad(DBObject* self, PyObject* args) @@ -3036,7 +3195,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DB_get_re_pad(DBObject* self) { @@ -3050,7 +3208,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(re_pad); } -#endif static PyObject* DB_set_re_source(DBObject* self, PyObject* args) @@ -3069,7 +3226,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DB_get_re_source(DBObject* self) { @@ -3084,7 +3240,6 @@ RETURN_IF_ERR(); return PyBytes_FromString(source); } -#endif static PyObject* DB_stat(DBObject* self, PyObject* args, PyObject* kwargs) @@ -3092,32 +3247,19 @@ int err, flags = 0, type; void* sp; PyObject* d; -#if (DBVER >= 43) PyObject* txnobj = NULL; DB_TXN *txn = NULL; static char* kwnames[] = { "flags", "txn", NULL }; -#else - static char* kwnames[] = { "flags", NULL }; -#endif - -#if (DBVER >= 43) + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iO:stat", kwnames, &flags, &txnobj)) return NULL; if (!checkTxnObj(txnobj, &txn)) return NULL; -#else - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i:stat", kwnames, &flags)) - return NULL; -#endif CHECK_DB_NOT_CLOSED(self); MYDB_BEGIN_ALLOW_THREADS; -#if (DBVER >= 43) err = self->db->stat(self->db, txn, &sp, flags); -#else - err = self->db->stat(self->db, &sp, flags); -#endif MYDB_END_ALLOW_THREADS; RETURN_IF_ERR(); @@ -3172,9 +3314,7 @@ MAKE_BT_ENTRY(leaf_pg); MAKE_BT_ENTRY(dup_pg); MAKE_BT_ENTRY(over_pg); -#if (DBVER >= 43) MAKE_BT_ENTRY(empty_pg); -#endif MAKE_BT_ENTRY(free); MAKE_BT_ENTRY(int_pgfree); MAKE_BT_ENTRY(leaf_pgfree); @@ -3214,7 +3354,6 @@ return d; } -#if (DBVER >= 43) static PyObject* DB_stat_print(DBObject* self, PyObject* args, PyObject *kwargs) { @@ -3234,7 +3373,6 @@ RETURN_IF_ERR(); RETURN_NONE(); } -#endif static PyObject* @@ -3381,7 +3519,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DB_get_encrypt_flags(DBObject* self) { @@ -3396,7 +3533,6 @@ return NUMBER_FromLong(flags); } -#endif @@ -3420,11 +3556,7 @@ } MYDB_BEGIN_ALLOW_THREADS; -#if (DBVER >= 43) err = self->db->stat(self->db, /*txnid*/ NULL, &sp, 0); -#else - err = self->db->stat(self->db, &sp, 0); -#endif MYDB_END_ALLOW_THREADS; /* All the stat structures have matching fields upto the ndata field, @@ -3868,6 +4000,136 @@ } +/* --------------------------------------------------------------------- */ +/* DBSite methods */ + + +#if (DBVER >= 52) +static PyObject* +DBSite_close_internal(DBSiteObject* self) +{ + int err = 0; + + if (self->site != NULL) { + EXTRACT_FROM_DOUBLE_LINKED_LIST(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->site->close(self->site); + MYDB_END_ALLOW_THREADS; + self->site = NULL; + } + RETURN_IF_ERR(); + RETURN_NONE(); +} + +static PyObject* +DBSite_close(DBSiteObject* self) +{ + return DBSite_close_internal(self); +} + +static PyObject* +DBSite_remove(DBSiteObject* self) +{ + int err = 0; + + CHECK_SITE_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->site->remove(self->site); + MYDB_END_ALLOW_THREADS; + + RETURN_IF_ERR(); + RETURN_NONE(); +} + +static PyObject* +DBSite_get_eid(DBSiteObject* self) +{ + int err = 0; + int eid; + + CHECK_SITE_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->site->get_eid(self->site, &eid); + MYDB_END_ALLOW_THREADS; + + RETURN_IF_ERR(); + return NUMBER_FromLong(eid); +} + +static PyObject* +DBSite_get_address(DBSiteObject* self) +{ + int err = 0; + const char *host; + u_int port; + + CHECK_SITE_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->site->get_address(self->site, &host, &port); + MYDB_END_ALLOW_THREADS; + + RETURN_IF_ERR(); + + return Py_BuildValue("(sI)", host, port); +} + +static PyObject* +DBSite_get_config(DBSiteObject* self, PyObject* args, PyObject* kwargs) +{ + int err = 0; + u_int32_t which, value; + static char* kwnames[] = { "which", NULL }; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:get_config", kwnames, + &which)) + return NULL; + + CHECK_SITE_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->site->get_config(self->site, which, &value); + MYDB_END_ALLOW_THREADS; + + RETURN_IF_ERR(); + + if (value) { + Py_INCREF(Py_True); + return Py_True; + } else { + Py_INCREF(Py_False); + return Py_False; + } +} + +static PyObject* +DBSite_set_config(DBSiteObject* self, PyObject* args, PyObject* kwargs) +{ + int err = 0; + u_int32_t which, value; + PyObject *valueO; + static char* kwnames[] = { "which", "value", NULL }; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iO:set_config", kwnames, + &which, &valueO)) + return NULL; + + CHECK_SITE_NOT_CLOSED(self); + + value = PyObject_IsTrue(valueO); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->site->set_config(self->site, which, value); + MYDB_END_ALLOW_THREADS; + + RETURN_IF_ERR(); + RETURN_NONE(); +} +#endif + /* --------------------------------------------------------------------- */ /* DBCursor methods */ @@ -4127,21 +4389,13 @@ keyObj = NUMBER_FromLong(*(int *)key.data); else keyObj = Build_PyString(key.data, key.size); -#if (PY_VERSION_HEX >= 0x02040000) retval = PyTuple_Pack(3, keyObj, pkeyObj, dataObj); -#else - retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj); -#endif Py_DECREF(keyObj); FREE_DBT(key); /* 'make_key_dbt' could do a 'malloc' */ } else /* return just the pkey and data */ { -#if (PY_VERSION_HEX >= 0x02040000) retval = PyTuple_Pack(2, pkeyObj, dataObj); -#else - retval = Py_BuildValue("OO", pkeyObj, dataObj); -#endif } Py_DECREF(dataObj); Py_DECREF(pkeyObj); @@ -4656,6 +4910,12 @@ dummy = DBLogCursor_close_internal(self->children_logcursors); Py_XDECREF(dummy); } +#if (DBVER >= 52) + while(self->children_sites) { + dummy = DBSite_close_internal(self->children_sites); + Py_XDECREF(dummy); + } +#endif } self->closed = 1; @@ -4735,17 +4995,16 @@ #define MAKE_ENTRY(name) _addIntToDict(d, #name, gsp->st_##name) MAKE_ENTRY(gbytes); + MAKE_ENTRY(bytes); MAKE_ENTRY(ncache); #if (DBVER >= 46) MAKE_ENTRY(max_ncache); #endif MAKE_ENTRY(regsize); -#if (DBVER >= 43) MAKE_ENTRY(mmapsize); MAKE_ENTRY(maxopenfd); MAKE_ENTRY(maxwrite); MAKE_ENTRY(maxwrite_sleep); -#endif MAKE_ENTRY(map); MAKE_ENTRY(cache_hit); MAKE_ENTRY(cache_miss); @@ -4828,13 +5087,12 @@ #undef MAKE_ENTRY free(fsp); - r = Py_BuildValue("(OO)", d, d2); + r = PyTuple_Pack(2, d, d2); Py_DECREF(d); Py_DECREF(d2); return r; } -#if (DBVER >= 43) static PyObject* DBEnv_memp_stat_print(DBEnvObject* self, PyObject* args, PyObject *kwargs) { @@ -4854,7 +5112,6 @@ RETURN_IF_ERR(); RETURN_NONE(); } -#endif static PyObject* @@ -4987,7 +5244,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DBEnv_get_encrypt_flags(DBEnvObject* self) { @@ -5025,7 +5281,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(timeout); } -#endif static PyObject* @@ -5064,7 +5319,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DBEnv_get_shm_key(DBEnvObject* self) { @@ -5081,7 +5335,6 @@ return NUMBER_FromLong(shm_key); } -#endif #if (DBVER >= 46) static PyObject* @@ -5170,7 +5423,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DBEnv_get_cachesize(DBEnvObject* self) { @@ -5188,7 +5440,6 @@ return Py_BuildValue("(iii)", gbytes, bytes, ncache); } -#endif static PyObject* @@ -5208,7 +5459,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DBEnv_get_flags(DBEnvObject* self) { @@ -5223,7 +5473,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(flags); } -#endif #if (DBVER >= 47) static PyObject* @@ -5423,7 +5672,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DBEnv_get_data_dirs(DBEnvObject* self) { @@ -5463,7 +5711,6 @@ } return tuple; } -#endif #if (DBVER >= 44) static PyObject* @@ -5513,7 +5760,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DBEnv_get_lg_bsize(DBEnvObject* self) { @@ -5528,7 +5774,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(lg_bsize); } -#endif static PyObject* DBEnv_set_lg_dir(DBEnvObject* self, PyObject* args) @@ -5547,7 +5792,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DBEnv_get_lg_dir(DBEnvObject* self) { @@ -5562,7 +5806,6 @@ RETURN_IF_ERR(); return PyBytes_FromString(dirp); } -#endif static PyObject* DBEnv_set_lg_max(DBEnvObject* self, PyObject* args) @@ -5580,7 +5823,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DBEnv_get_lg_max(DBEnvObject* self) { @@ -5595,8 +5837,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(lg_max); } -#endif - static PyObject* DBEnv_set_lg_regionmax(DBEnvObject* self, PyObject* args) @@ -5614,7 +5854,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DBEnv_get_lg_regionmax(DBEnvObject* self) { @@ -5629,7 +5868,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(lg_regionmax); } -#endif #if (DBVER >= 47) static PyObject* @@ -5680,7 +5918,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DBEnv_get_lk_detect(DBEnvObject* self) { @@ -5695,8 +5932,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(lk_detect); } -#endif - #if (DBVER < 45) static PyObject* @@ -5734,7 +5969,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DBEnv_get_lk_max_locks(DBEnvObject* self) { @@ -5749,7 +5983,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(lk_max); } -#endif static PyObject* DBEnv_set_lk_max_lockers(DBEnvObject* self, PyObject* args) @@ -5767,7 +6000,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DBEnv_get_lk_max_lockers(DBEnvObject* self) { @@ -5782,7 +6014,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(lk_max); } -#endif static PyObject* DBEnv_set_lk_max_objects(DBEnvObject* self, PyObject* args) @@ -5800,7 +6031,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DBEnv_get_lk_max_objects(DBEnvObject* self) { @@ -5815,9 +6045,7 @@ RETURN_IF_ERR(); return NUMBER_FromLong(lk_max); } -#endif - -#if (DBVER >= 42) + static PyObject* DBEnv_get_mp_mmapsize(DBEnvObject* self) { @@ -5832,8 +6060,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(mmapsize); } -#endif - static PyObject* DBEnv_set_mp_mmapsize(DBEnvObject* self, PyObject* args) @@ -5869,8 +6095,6 @@ RETURN_NONE(); } - -#if (DBVER >= 42) static PyObject* DBEnv_get_tmp_dir(DBEnvObject* self) { @@ -5887,8 +6111,6 @@ return PyBytes_FromString(dirpp); } -#endif - static PyObject* DBEnv_txn_recover(DBEnvObject* self) @@ -5899,7 +6121,7 @@ DBTxnObject *txn; #define PREPLIST_LEN 16 DB_PREPLIST preplist[PREPLIST_LEN]; -#if (DBVER < 48) +#if (DBVER < 48) || (DBVER >= 52) long retp; #else u_int32_t retp; @@ -6003,8 +6225,6 @@ RETURN_NONE(); } - -#if (DBVER >= 42) static PyObject* DBEnv_get_tx_max(DBEnvObject* self) { @@ -6019,8 +6239,6 @@ RETURN_IF_ERR(); return PyLong_FromUnsignedLong(max); } -#endif - static PyObject* DBEnv_set_tx_max(DBEnvObject* self, PyObject* args) @@ -6038,8 +6256,6 @@ RETURN_NONE(); } - -#if (DBVER >= 42) static PyObject* DBEnv_get_tx_timestamp(DBEnvObject* self) { @@ -6054,7 +6270,6 @@ RETURN_IF_ERR(); return NUMBER_FromLong(timestamp); } -#endif static PyObject* DBEnv_set_tx_timestamp(DBEnvObject* self, PyObject* args) @@ -6204,7 +6419,6 @@ #endif /* DBVER >= 4.4 */ -#if (DBVER >= 43) static PyObject* DBEnv_stat_print(DBEnvObject* self, PyObject* args, PyObject *kwargs) { @@ -6224,7 +6438,6 @@ RETURN_IF_ERR(); RETURN_NONE(); } -#endif static PyObject* @@ -6288,7 +6501,6 @@ } /* DBEnv_log_stat */ -#if (DBVER >= 43) static PyObject* DBEnv_log_stat_print(DBEnvObject* self, PyObject* args, PyObject *kwargs) { @@ -6308,7 +6520,6 @@ RETURN_IF_ERR(); RETURN_NONE(); } -#endif static PyObject* @@ -6390,7 +6601,6 @@ return d; } -#if (DBVER >= 43) static PyObject* DBEnv_lock_stat_print(DBEnvObject* self, PyObject* args, PyObject *kwargs) { @@ -6410,7 +6620,6 @@ RETURN_IF_ERR(); RETURN_NONE(); } -#endif static PyObject* @@ -6572,6 +6781,52 @@ } +#if (DBVER >= 52) +static PyObject* +DBEnv_repmgr_site(DBEnvObject* self, PyObject* args, PyObject *kwargs) +{ + int err; + DB_SITE* site; + char *host; + u_int port; + static char* kwnames[] = {"host", "port", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "si:repmgr_site", kwnames, + &host, &port)) + return NULL; + + CHECK_ENV_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db_env->repmgr_site(self->db_env, host, port, &site, 0); + MYDB_END_ALLOW_THREADS; + RETURN_IF_ERR(); + return (PyObject*) newDBSiteObject(site, self); +} + +static PyObject* +DBEnv_repmgr_site_by_eid(DBEnvObject* self, PyObject* args, PyObject *kwargs) +{ + int err; + DB_SITE* site; + int eid; + static char* kwnames[] = {"eid", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:repmgr_site_by_eid", + kwnames, &eid)) + return NULL; + + CHECK_ENV_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db_env->repmgr_site_by_eid(self->db_env, eid, &site); + MYDB_END_ALLOW_THREADS; + RETURN_IF_ERR(); + return (PyObject*) newDBSiteObject(site, self); +} +#endif + + #if (DBVER >= 44) static PyObject* DBEnv_mutex_stat(DBEnvObject* self, PyObject* args) @@ -6640,7 +6895,6 @@ #endif -#if (DBVER >= 43) static PyObject* DBEnv_txn_stat_print(DBEnvObject* self, PyObject* args, PyObject *kwargs) { @@ -6662,7 +6916,6 @@ RETURN_IF_ERR(); RETURN_NONE(); } -#endif static PyObject* @@ -6756,6 +7009,76 @@ RETURN_NONE(); } +#if (DBVER >= 47) +static PyObject* +DBEnv_set_intermediate_dir_mode(DBEnvObject* self, PyObject* args) +{ + int err; + const char *mode; + + if (!PyArg_ParseTuple(args,"s:set_intermediate_dir_mode", &mode)) + return NULL; + + CHECK_ENV_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db_env->set_intermediate_dir_mode(self->db_env, mode); + MYDB_END_ALLOW_THREADS; + RETURN_IF_ERR(); + RETURN_NONE(); +} + +static PyObject* +DBEnv_get_intermediate_dir_mode(DBEnvObject* self) +{ + int err; + const char *mode; + + CHECK_ENV_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db_env->get_intermediate_dir_mode(self->db_env, &mode); + MYDB_END_ALLOW_THREADS; + RETURN_IF_ERR(); + return Py_BuildValue("s", mode); +} +#endif + +#if (DBVER < 47) +static PyObject* +DBEnv_set_intermediate_dir(DBEnvObject* self, PyObject* args) +{ + int err; + int mode; + u_int32_t flags; + + if (!PyArg_ParseTuple(args, "iI:set_intermediate_dir", &mode, &flags)) + return NULL; + + CHECK_ENV_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db_env->set_intermediate_dir(self->db_env, mode, flags); + MYDB_END_ALLOW_THREADS; + RETURN_IF_ERR(); + RETURN_NONE(); +} +#endif + +static PyObject* +DBEnv_get_open_flags(DBEnvObject* self) +{ + int err; + unsigned int flags; + + CHECK_ENV_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db_env->get_open_flags(self->db_env, &flags); + MYDB_END_ALLOW_THREADS; + RETURN_IF_ERR(); + return NUMBER_FromLong(flags); +} #if (DBVER < 48) static PyObject* @@ -6781,7 +7104,6 @@ } #endif -#if (DBVER >= 43) static PyObject* DBEnv_set_mp_max_openfd(DBEnvObject* self, PyObject* args) { @@ -6855,7 +7177,6 @@ return Py_BuildValue("(ii)", maxwrite, (int)maxwrite_sleep); } -#endif static PyObject* @@ -6875,7 +7196,6 @@ RETURN_NONE(); } -#if (DBVER >= 42) static PyObject* DBEnv_get_verbose(DBEnvObject* self, PyObject* args) { @@ -6893,7 +7213,6 @@ RETURN_IF_ERR(); return PyBool_FromLong(verbose); } -#endif #if (DBVER >= 45) static void @@ -6975,9 +7294,7 @@ PyObject *control_py, *rec_py; DBT control, rec; int envid; -#if (DBVER >= 42) DB_LSN lsn; -#endif if (!PyArg_ParseTuple(args, "OOi:rep_process_message", &control_py, &rec_py, &envid)) @@ -6994,13 +7311,8 @@ err = self->db_env->rep_process_message(self->db_env, &control, &rec, envid, &lsn); #else -#if (DBVER >= 42) err = self->db_env->rep_process_message(self->db_env, &control, &rec, &envid, &lsn); -#else - err = self->db_env->rep_process_message(self->db_env, &control, &rec, - &envid); -#endif #endif MYDB_END_ALLOW_THREADS; switch (err) { @@ -7029,15 +7341,13 @@ return r; break; } -#if (DBVER >= 42) case DB_REP_NOTPERM : case DB_REP_ISPERM : return Py_BuildValue("(i(ll))", err, lsn.file, lsn.offset); break; -#endif - } - RETURN_IF_ERR(); - return Py_BuildValue("(OO)", Py_None, Py_None); + } + RETURN_IF_ERR(); + return PyTuple_Pack(2, Py_None, Py_None); } static int @@ -7062,11 +7372,7 @@ b = PyBytes_FromStringAndSize(rec->data, rec->size); args = Py_BuildValue( -#if (PY_VERSION_HEX >= 0x02040000) "(OOO(ll)iI)", -#else - "(OOO(ll)ii)", -#endif dbenv, a, b, lsn->file, lsn->offset, envid, flags); @@ -7086,20 +7392,6 @@ return ret; } -#if (DBVER <= 41) -static int -_DBEnv_rep_transportCallbackOLD(DB_ENV* db_env, const DBT* control, const DBT* rec, - int envid, u_int32_t flags) -{ - DB_LSN lsn; - - lsn.file = -1; /* Dummy values */ - lsn.offset = -1; - return _DBEnv_rep_transportCallback(db_env, control, rec, &lsn, envid, - flags); -} -#endif - static PyObject* DBEnv_rep_set_transport(DBEnvObject* self, PyObject* args) { @@ -7120,13 +7412,8 @@ err = self->db_env->rep_set_transport(self->db_env, envid, &_DBEnv_rep_transportCallback); #else -#if (DBVER >= 42) err = self->db_env->set_rep_transport(self->db_env, envid, &_DBEnv_rep_transportCallback); -#else - err = self->db_env->set_rep_transport(self->db_env, envid, - &_DBEnv_rep_transportCallbackOLD); -#endif #endif MYDB_END_ALLOW_THREADS; RETURN_IF_ERR(); @@ -7166,11 +7453,7 @@ err = self->db_env->rep_get_request(self->db_env, &minimum, &maximum); MYDB_END_ALLOW_THREADS; RETURN_IF_ERR(); -#if (PY_VERSION_HEX >= 0x02040000) return Py_BuildValue("II", minimum, maximum); -#else - return Py_BuildValue("ii", minimum, maximum); -#endif } #endif @@ -7422,13 +7705,8 @@ int err; unsigned int fast, slow; -#if (PY_VERSION_HEX >= 0x02040000) if (!PyArg_ParseTuple(args,"II:rep_set_clockskew", &fast, &slow)) return NULL; -#else - if (!PyArg_ParseTuple(args,"ii:rep_set_clockskew", &fast, &slow)) - return NULL; -#endif CHECK_ENV_NOT_CLOSED(self); @@ -7450,15 +7728,10 @@ err = self->db_env->rep_get_clockskew(self->db_env, &fast, &slow); MYDB_END_ALLOW_THREADS; RETURN_IF_ERR(); -#if (PY_VERSION_HEX >= 0x02040000) return Py_BuildValue("(II)", fast, slow); -#else - return Py_BuildValue("(ii)", fast, slow); -#endif -} -#endif - -#if (DBVER >= 43) +} +#endif + static PyObject* DBEnv_rep_stat_print(DBEnvObject* self, PyObject* args, PyObject *kwargs) { @@ -7478,7 +7751,6 @@ RETURN_IF_ERR(); RETURN_NONE(); } -#endif static PyObject* DBEnv_rep_stat(DBEnvObject* self, PyObject* args, PyObject *kwargs) @@ -7519,7 +7791,6 @@ MAKE_ENTRY(client_svc_req); #endif MAKE_ENTRY(dupmasters); -#if (DBVER >= 43) MAKE_ENTRY(egen); MAKE_ENTRY(election_nvotes); MAKE_ENTRY(startup_complete); @@ -7528,7 +7799,6 @@ MAKE_ENTRY(pg_requested); MAKE_ENTRY(next_pg); MAKE_ENTRY(waiting_pg); -#endif MAKE_ENTRY(election_cur_winner); MAKE_ENTRY(election_gen); MAKE_DB_LSN_ENTRY(election_lsn); @@ -7608,6 +7878,7 @@ RETURN_NONE(); } +#if (DBVER < 52) static PyObject* DBEnv_repmgr_set_local_site(DBEnvObject* self, PyObject* args, PyObject* kwargs) @@ -7654,6 +7925,7 @@ RETURN_IF_ERR(); return NUMBER_FromLong(eidp); } +#endif static PyObject* DBEnv_repmgr_set_ack_policy(DBEnvObject* self, PyObject* args) @@ -7714,13 +7986,8 @@ free(listp); return NULL; } -#if (PY_VERSION_HEX >= 0x02040000) tuple=Py_BuildValue("(sII)", listp[countp].host, listp[countp].port, listp[countp].status); -#else - tuple=Py_BuildValue("(sii)", listp[countp].host, - listp[countp].port, listp[countp].status); -#endif if(!tuple) { Py_DECREF(key); Py_DECREF(stats); @@ -7824,9 +8091,7 @@ static void _promote_transaction_dbs_and_sequences(DBTxnObject *txn) { DBObject *db; -#if (DBVER >= 43) DBSequenceObject *dbs; -#endif while (txn->children_dbs) { db=txn->children_dbs; @@ -7842,7 +8107,6 @@ } } -#if (DBVER >= 43) while (txn->children_sequences) { dbs=txn->children_sequences; EXTRACT_FROM_DOUBLE_LINKED_LIST_TXN(dbs); @@ -7856,7 +8120,6 @@ dbs->txn=NULL; } } -#endif } @@ -7953,12 +8216,10 @@ self->txn = NULL; /* this DB_TXN is no longer valid after this call */ _close_transaction_cursors(self); -#if (DBVER >= 43) while (self->children_sequences) { dummy=DBSequence_close_internal(self->children_sequences,0,0); Py_XDECREF(dummy); } -#endif while (self->children_dbs) { dummy=DB_close_internal(self->children_dbs, 0, 0); Py_XDECREF(dummy); @@ -8094,7 +8355,6 @@ #endif -#if (DBVER >= 43) /* --------------------------------------------------------------------- */ /* DBSequence methods */ @@ -8444,7 +8704,6 @@ free(sp); return dict_stat; } -#endif /* --------------------------------------------------------------------- */ @@ -8482,70 +8741,45 @@ {"remove", (PyCFunction)DB_remove, METH_VARARGS|METH_KEYWORDS}, {"rename", (PyCFunction)DB_rename, METH_VARARGS}, {"set_bt_minkey", (PyCFunction)DB_set_bt_minkey, METH_VARARGS}, -#if (DBVER >= 42) {"get_bt_minkey", (PyCFunction)DB_get_bt_minkey, METH_NOARGS}, -#endif {"set_bt_compare", (PyCFunction)DB_set_bt_compare, METH_O}, {"set_cachesize", (PyCFunction)DB_set_cachesize, METH_VARARGS}, -#if (DBVER >= 42) {"get_cachesize", (PyCFunction)DB_get_cachesize, METH_NOARGS}, -#endif + {"set_dup_compare", (PyCFunction)DB_set_dup_compare, METH_O}, {"set_encrypt", (PyCFunction)DB_set_encrypt, METH_VARARGS|METH_KEYWORDS}, -#if (DBVER >= 42) {"get_encrypt_flags", (PyCFunction)DB_get_encrypt_flags, METH_NOARGS}, -#endif - {"set_flags", (PyCFunction)DB_set_flags, METH_VARARGS}, -#if (DBVER >= 42) {"get_flags", (PyCFunction)DB_get_flags, METH_NOARGS}, -#endif + {"get_transactional", (PyCFunction)DB_get_transactional, METH_NOARGS}, {"set_h_ffactor", (PyCFunction)DB_set_h_ffactor, METH_VARARGS}, -#if (DBVER >= 42) {"get_h_ffactor", (PyCFunction)DB_get_h_ffactor, METH_NOARGS}, -#endif {"set_h_nelem", (PyCFunction)DB_set_h_nelem, METH_VARARGS}, -#if (DBVER >= 42) {"get_h_nelem", (PyCFunction)DB_get_h_nelem, METH_NOARGS}, -#endif {"set_lorder", (PyCFunction)DB_set_lorder, METH_VARARGS}, -#if (DBVER >= 42) {"get_lorder", (PyCFunction)DB_get_lorder, METH_NOARGS}, -#endif {"set_pagesize", (PyCFunction)DB_set_pagesize, METH_VARARGS}, -#if (DBVER >= 42) {"get_pagesize", (PyCFunction)DB_get_pagesize, METH_NOARGS}, -#endif {"set_re_delim", (PyCFunction)DB_set_re_delim, METH_VARARGS}, -#if (DBVER >= 42) {"get_re_delim", (PyCFunction)DB_get_re_delim, METH_NOARGS}, -#endif {"set_re_len", (PyCFunction)DB_set_re_len, METH_VARARGS}, -#if (DBVER >= 42) {"get_re_len", (PyCFunction)DB_get_re_len, METH_NOARGS}, -#endif {"set_re_pad", (PyCFunction)DB_set_re_pad, METH_VARARGS}, -#if (DBVER >= 42) {"get_re_pad", (PyCFunction)DB_get_re_pad, METH_NOARGS}, -#endif {"set_re_source", (PyCFunction)DB_set_re_source, METH_VARARGS}, -#if (DBVER >= 42) {"get_re_source", (PyCFunction)DB_get_re_source, METH_NOARGS}, -#endif {"set_q_extentsize",(PyCFunction)DB_set_q_extentsize, METH_VARARGS}, -#if (DBVER >= 42) {"get_q_extentsize",(PyCFunction)DB_get_q_extentsize, METH_NOARGS}, -#endif {"set_private", (PyCFunction)DB_set_private, METH_O}, {"get_private", (PyCFunction)DB_get_private, METH_NOARGS}, #if (DBVER >= 46) {"set_priority", (PyCFunction)DB_set_priority, METH_VARARGS}, {"get_priority", (PyCFunction)DB_get_priority, METH_NOARGS}, #endif + {"get_dbname", (PyCFunction)DB_get_dbname, METH_NOARGS}, + {"get_open_flags", (PyCFunction)DB_get_open_flags, METH_NOARGS}, {"stat", (PyCFunction)DB_stat, METH_VARARGS|METH_KEYWORDS}, -#if (DBVER >= 43) {"stat_print", (PyCFunction)DB_stat_print, METH_VARARGS|METH_KEYWORDS}, -#endif {"sync", (PyCFunction)DB_sync, METH_VARARGS}, {"truncate", (PyCFunction)DB_truncate, METH_VARARGS|METH_KEYWORDS}, {"type", (PyCFunction)DB_get_type, METH_NOARGS}, @@ -8627,6 +8861,19 @@ {NULL, NULL} /* sentinel */ }; +#if (DBVER >= 52) +static PyMethodDef DBSite_methods[] = { + {"get_config", (PyCFunction)DBSite_get_config, + METH_VARARGS | METH_KEYWORDS}, + {"set_config", (PyCFunction)DBSite_set_config, + METH_VARARGS | METH_KEYWORDS}, + {"remove", (PyCFunction)DBSite_remove, METH_NOARGS}, + {"get_eid", (PyCFunction)DBSite_get_eid, METH_NOARGS}, + {"get_address", (PyCFunction)DBSite_get_address, METH_NOARGS}, + {"close", (PyCFunction)DBSite_close, METH_NOARGS}, + {NULL, NULL} /* sentinel */ +}; +#endif static PyMethodDef DBEnv_methods[] = { {"close", (PyCFunction)DBEnv_close, METH_VARARGS}, @@ -8639,32 +8886,24 @@ {"get_thread_count", (PyCFunction)DBEnv_get_thread_count, METH_NOARGS}, #endif {"set_encrypt", (PyCFunction)DBEnv_set_encrypt, METH_VARARGS|METH_KEYWORDS}, -#if (DBVER >= 42) {"get_encrypt_flags", (PyCFunction)DBEnv_get_encrypt_flags, METH_NOARGS}, {"get_timeout", (PyCFunction)DBEnv_get_timeout, METH_VARARGS|METH_KEYWORDS}, -#endif {"set_timeout", (PyCFunction)DBEnv_set_timeout, METH_VARARGS|METH_KEYWORDS}, {"set_shm_key", (PyCFunction)DBEnv_set_shm_key, METH_VARARGS}, -#if (DBVER >= 42) {"get_shm_key", (PyCFunction)DBEnv_get_shm_key, METH_NOARGS}, -#endif #if (DBVER >= 46) {"set_cache_max", (PyCFunction)DBEnv_set_cache_max, METH_VARARGS}, {"get_cache_max", (PyCFunction)DBEnv_get_cache_max, METH_NOARGS}, #endif {"set_cachesize", (PyCFunction)DBEnv_set_cachesize, METH_VARARGS}, -#if (DBVER >= 42) {"get_cachesize", (PyCFunction)DBEnv_get_cachesize, METH_NOARGS}, -#endif {"memp_trickle", (PyCFunction)DBEnv_memp_trickle, METH_VARARGS}, {"memp_sync", (PyCFunction)DBEnv_memp_sync, METH_VARARGS}, {"memp_stat", (PyCFunction)DBEnv_memp_stat, METH_VARARGS|METH_KEYWORDS}, -#if (DBVER >= 43) {"memp_stat_print", (PyCFunction)DBEnv_memp_stat_print, METH_VARARGS|METH_KEYWORDS}, -#endif #if (DBVER >= 44) {"mutex_set_max", (PyCFunction)DBEnv_mutex_set_max, METH_VARARGS}, {"mutex_get_max", (PyCFunction)DBEnv_mutex_get_max, METH_NOARGS}, @@ -8685,33 +8924,21 @@ #endif #endif {"set_data_dir", (PyCFunction)DBEnv_set_data_dir, METH_VARARGS}, -#if (DBVER >= 42) {"get_data_dirs", (PyCFunction)DBEnv_get_data_dirs, METH_NOARGS}, -#endif -#if (DBVER >= 42) {"get_flags", (PyCFunction)DBEnv_get_flags, METH_NOARGS}, -#endif {"set_flags", (PyCFunction)DBEnv_set_flags, METH_VARARGS}, #if (DBVER >= 47) {"log_set_config", (PyCFunction)DBEnv_log_set_config, METH_VARARGS}, {"log_get_config", (PyCFunction)DBEnv_log_get_config, METH_VARARGS}, #endif {"set_lg_bsize", (PyCFunction)DBEnv_set_lg_bsize, METH_VARARGS}, -#if (DBVER >= 42) {"get_lg_bsize", (PyCFunction)DBEnv_get_lg_bsize, METH_NOARGS}, -#endif {"set_lg_dir", (PyCFunction)DBEnv_set_lg_dir, METH_VARARGS}, -#if (DBVER >= 42) {"get_lg_dir", (PyCFunction)DBEnv_get_lg_dir, METH_NOARGS}, -#endif {"set_lg_max", (PyCFunction)DBEnv_set_lg_max, METH_VARARGS}, -#if (DBVER >= 42) {"get_lg_max", (PyCFunction)DBEnv_get_lg_max, METH_NOARGS}, -#endif {"set_lg_regionmax",(PyCFunction)DBEnv_set_lg_regionmax, METH_VARARGS}, -#if (DBVER >= 42) {"get_lg_regionmax",(PyCFunction)DBEnv_get_lg_regionmax, METH_NOARGS}, -#endif #if (DBVER >= 44) {"set_lg_filemode", (PyCFunction)DBEnv_set_lg_filemode, METH_VARARGS}, {"get_lg_filemode", (PyCFunction)DBEnv_get_lg_filemode, METH_NOARGS}, @@ -8721,47 +8948,29 @@ {"get_lk_partitions", (PyCFunction)DBEnv_get_lk_partitions, METH_NOARGS}, #endif {"set_lk_detect", (PyCFunction)DBEnv_set_lk_detect, METH_VARARGS}, -#if (DBVER >= 42) {"get_lk_detect", (PyCFunction)DBEnv_get_lk_detect, METH_NOARGS}, -#endif #if (DBVER < 45) {"set_lk_max", (PyCFunction)DBEnv_set_lk_max, METH_VARARGS}, #endif {"set_lk_max_locks", (PyCFunction)DBEnv_set_lk_max_locks, METH_VARARGS}, -#if (DBVER >= 42) {"get_lk_max_locks", (PyCFunction)DBEnv_get_lk_max_locks, METH_NOARGS}, -#endif {"set_lk_max_lockers", (PyCFunction)DBEnv_set_lk_max_lockers, METH_VARARGS}, -#if (DBVER >= 42) {"get_lk_max_lockers", (PyCFunction)DBEnv_get_lk_max_lockers, METH_NOARGS}, -#endif {"set_lk_max_objects", (PyCFunction)DBEnv_set_lk_max_objects, METH_VARARGS}, -#if (DBVER >= 42) {"get_lk_max_objects", (PyCFunction)DBEnv_get_lk_max_objects, METH_NOARGS}, -#endif -#if (DBVER >= 43) {"stat_print", (PyCFunction)DBEnv_stat_print, METH_VARARGS|METH_KEYWORDS}, -#endif {"set_mp_mmapsize", (PyCFunction)DBEnv_set_mp_mmapsize, METH_VARARGS}, -#if (DBVER >= 42) {"get_mp_mmapsize", (PyCFunction)DBEnv_get_mp_mmapsize, METH_NOARGS}, -#endif {"set_tmp_dir", (PyCFunction)DBEnv_set_tmp_dir, METH_VARARGS}, -#if (DBVER >= 42) {"get_tmp_dir", (PyCFunction)DBEnv_get_tmp_dir, METH_NOARGS}, -#endif {"txn_begin", (PyCFunction)DBEnv_txn_begin, METH_VARARGS|METH_KEYWORDS}, {"txn_checkpoint", (PyCFunction)DBEnv_txn_checkpoint, METH_VARARGS}, {"txn_stat", (PyCFunction)DBEnv_txn_stat, METH_VARARGS}, -#if (DBVER >= 43) {"txn_stat_print", (PyCFunction)DBEnv_txn_stat_print, METH_VARARGS|METH_KEYWORDS}, -#endif -#if (DBVER >= 42) {"get_tx_max", (PyCFunction)DBEnv_get_tx_max, METH_NOARGS}, {"get_tx_timestamp", (PyCFunction)DBEnv_get_tx_timestamp, METH_NOARGS}, -#endif {"set_tx_max", (PyCFunction)DBEnv_set_tx_max, METH_VARARGS}, {"set_tx_timestamp", (PyCFunction)DBEnv_set_tx_timestamp, METH_VARARGS}, {"lock_detect", (PyCFunction)DBEnv_lock_detect, METH_VARARGS}, @@ -8770,10 +8979,8 @@ {"lock_id_free", (PyCFunction)DBEnv_lock_id_free, METH_VARARGS}, {"lock_put", (PyCFunction)DBEnv_lock_put, METH_VARARGS}, {"lock_stat", (PyCFunction)DBEnv_lock_stat, METH_VARARGS}, -#if (DBVER >= 43) {"lock_stat_print", (PyCFunction)DBEnv_lock_stat_print, METH_VARARGS|METH_KEYWORDS}, -#endif {"log_cursor", (PyCFunction)DBEnv_log_cursor, METH_NOARGS}, {"log_file", (PyCFunction)DBEnv_log_file, METH_VARARGS}, #if (DBVER >= 44) @@ -8783,10 +8990,8 @@ {"log_archive", (PyCFunction)DBEnv_log_archive, METH_VARARGS}, {"log_flush", (PyCFunction)DBEnv_log_flush, METH_NOARGS}, {"log_stat", (PyCFunction)DBEnv_log_stat, METH_VARARGS}, -#if (DBVER >= 43) {"log_stat_print", (PyCFunction)DBEnv_log_stat_print, METH_VARARGS|METH_KEYWORDS}, -#endif #if (DBVER >= 44) {"fileid_reset", (PyCFunction)DBEnv_fileid_reset, METH_VARARGS|METH_KEYWORDS}, {"lsn_reset", (PyCFunction)DBEnv_lsn_reset, METH_VARARGS|METH_KEYWORDS}, @@ -8797,18 +9002,25 @@ {"set_rpc_server", (PyCFunction)DBEnv_set_rpc_server, METH_VARARGS|METH_KEYWORDS}, #endif -#if (DBVER >= 43) {"set_mp_max_openfd", (PyCFunction)DBEnv_set_mp_max_openfd, METH_VARARGS}, {"get_mp_max_openfd", (PyCFunction)DBEnv_get_mp_max_openfd, METH_NOARGS}, {"set_mp_max_write", (PyCFunction)DBEnv_set_mp_max_write, METH_VARARGS}, {"get_mp_max_write", (PyCFunction)DBEnv_get_mp_max_write, METH_NOARGS}, -#endif {"set_verbose", (PyCFunction)DBEnv_set_verbose, METH_VARARGS}, -#if (DBVER >= 42) - {"get_verbose", (PyCFunction)DBEnv_get_verbose, METH_VARARGS}, -#endif - {"set_private", (PyCFunction)DBEnv_set_private, METH_O}, - {"get_private", (PyCFunction)DBEnv_get_private, METH_NOARGS}, + {"get_verbose", (PyCFunction)DBEnv_get_verbose, METH_VARARGS}, + {"set_private", (PyCFunction)DBEnv_set_private, METH_O}, + {"get_private", (PyCFunction)DBEnv_get_private, METH_NOARGS}, + {"get_open_flags", (PyCFunction)DBEnv_get_open_flags, METH_NOARGS}, +#if (DBVER >= 47) + {"set_intermediate_dir_mode", (PyCFunction)DBEnv_set_intermediate_dir_mode, + METH_VARARGS}, + {"get_intermediate_dir_mode", (PyCFunction)DBEnv_get_intermediate_dir_mode, + METH_NOARGS}, +#endif +#if (DBVER < 47) + {"set_intermediate_dir", (PyCFunction)DBEnv_set_intermediate_dir, + METH_VARARGS}, +#endif {"rep_start", (PyCFunction)DBEnv_rep_start, METH_VARARGS|METH_KEYWORDS}, {"rep_set_transport", (PyCFunction)DBEnv_rep_set_transport, METH_VARARGS}, @@ -8847,18 +9059,18 @@ #endif {"rep_stat", (PyCFunction)DBEnv_rep_stat, METH_VARARGS|METH_KEYWORDS}, -#if (DBVER >= 43) {"rep_stat_print", (PyCFunction)DBEnv_rep_stat_print, METH_VARARGS|METH_KEYWORDS}, -#endif #if (DBVER >= 45) {"repmgr_start", (PyCFunction)DBEnv_repmgr_start, METH_VARARGS|METH_KEYWORDS}, +#if (DBVER < 52) {"repmgr_set_local_site", (PyCFunction)DBEnv_repmgr_set_local_site, METH_VARARGS|METH_KEYWORDS}, {"repmgr_add_remote_site", (PyCFunction)DBEnv_repmgr_add_remote_site, METH_VARARGS|METH_KEYWORDS}, +#endif {"repmgr_set_ack_policy", (PyCFunction)DBEnv_repmgr_set_ack_policy, METH_VARARGS}, {"repmgr_get_ack_policy", (PyCFunction)DBEnv_repmgr_get_ack_policy, @@ -8872,6 +9084,12 @@ {"repmgr_stat_print", (PyCFunction)DBEnv_repmgr_stat_print, METH_VARARGS|METH_KEYWORDS}, #endif +#if (DBVER >= 52) + {"repmgr_site", (PyCFunction)DBEnv_repmgr_site, + METH_VARARGS | METH_KEYWORDS}, + {"repmgr_site_by_eid", (PyCFunction)DBEnv_repmgr_site_by_eid, + METH_VARARGS | METH_KEYWORDS}, +#endif {NULL, NULL} /* sentinel */ }; @@ -8892,7 +9110,6 @@ }; -#if (DBVER >= 43) static PyMethodDef DBSequence_methods[] = { {"close", (PyCFunction)DBSequence_close, METH_VARARGS}, {"get", (PyCFunction)DBSequence_get, METH_VARARGS|METH_KEYWORDS}, @@ -8912,7 +9129,6 @@ METH_VARARGS|METH_KEYWORDS}, {NULL, NULL} /* sentinel */ }; -#endif static PyObject* @@ -8922,13 +9138,9 @@ CHECK_ENV_NOT_CLOSED(self); -#if (DBVER >= 42) MYDB_BEGIN_ALLOW_THREADS; self->db_env->get_home(self->db_env, &home); MYDB_END_ALLOW_THREADS; -#else - home=self->db_env->db_home; -#endif if (home == NULL) { RETURN_NONE(); @@ -9070,6 +9282,49 @@ 0, /*tp_members*/ }; +#if (DBVER >= 52) +statichere PyTypeObject DBSite_Type = { +#if (PY_VERSION_HEX < 0x03000000) + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ +#else + PyVarObject_HEAD_INIT(NULL, 0) +#endif + "DBSite", /*tp_name*/ + sizeof(DBSiteObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor)DBSite_dealloc,/*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ +#if (PY_VERSION_HEX < 0x03000000) + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ +#else + Py_TPFLAGS_DEFAULT, /* tp_flags */ +#endif + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(DBSiteObject, in_weakreflist), /* tp_weaklistoffset */ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + DBSite_methods, /*tp_methods*/ + 0, /*tp_members*/ +}; +#endif statichere PyTypeObject DBEnv_Type = { #if (PY_VERSION_HEX < 0x03000000) @@ -9195,7 +9450,6 @@ offsetof(DBLockObject, in_weakreflist), /* tp_weaklistoffset */ }; -#if (DBVER >= 43) statichere PyTypeObject DBSequence_Type = { #if (PY_VERSION_HEX < 0x03000000) PyObject_HEAD_INIT(NULL) @@ -9237,7 +9491,6 @@ DBSequence_methods, /*tp_methods*/ 0, /*tp_members*/ }; -#endif /* --------------------------------------------------------------------- */ /* Module-level functions */ @@ -9271,7 +9524,6 @@ return (PyObject* )newDBEnvObject(flags); } -#if (DBVER >= 43) static PyObject* DBSequence_construct(PyObject* self, PyObject* args, PyObject* kwargs) { @@ -9287,7 +9539,6 @@ } return (PyObject* )newDBSequenceObject((DBObject*)dbobj, flags); } -#endif static char bsddb_version_doc[] = "Returns a tuple of major, minor, and patch release numbers of the\n\ @@ -9298,19 +9549,35 @@ { int major, minor, patch; + /* This should be instantaneous, no need to release the GIL */ db_version(&major, &minor, &patch); return Py_BuildValue("(iii)", major, minor, patch); } +#if (DBVER >= 50) +static PyObject* +bsddb_version_full(PyObject* self) +{ + char *version_string; + int family, release, major, minor, patch; + + /* This should be instantaneous, no need to release the GIL */ + version_string = db_full_version(&family, &release, &major, &minor, &patch); + return Py_BuildValue("(siiiii)", + version_string, family, release, major, minor, patch); +} +#endif + /* List of functions defined in the module */ static PyMethodDef bsddb_methods[] = { {"DB", (PyCFunction)DB_construct, METH_VARARGS | METH_KEYWORDS }, {"DBEnv", (PyCFunction)DBEnv_construct, METH_VARARGS}, -#if (DBVER >= 43) {"DBSequence", (PyCFunction)DBSequence_construct, METH_VARARGS | METH_KEYWORDS }, -#endif {"version", (PyCFunction)bsddb_version, METH_NOARGS, bsddb_version_doc}, +#if (DBVER >= 50) + {"full_version", (PyCFunction)bsddb_version_full, METH_NOARGS}, +#endif {NULL, NULL} /* sentinel */ }; @@ -9328,6 +9595,11 @@ */ #define ADD_INT(dict, NAME) _addIntToDict(dict, #NAME, NAME) +/* +** We can rename the module at import time, so the string allocated +** must be big enough, and any use of the name must use this particular +** string. +*/ #define MODULE_NAME_MAX_LEN 11 static char _bsddbModuleName[MODULE_NAME_MAX_LEN+1] = "_bsddb"; @@ -9378,8 +9650,9 @@ || (PyType_Ready(&DBEnv_Type) < 0) || (PyType_Ready(&DBTxn_Type) < 0) || (PyType_Ready(&DBLock_Type) < 0) -#if (DBVER >= 43) || (PyType_Ready(&DBSequence_Type) < 0) +#if (DBVER >= 52) + || (PyType_Ready(&DBSite_Type) < 0) #endif ) { #if (PY_VERSION_HEX < 0x03000000) @@ -9389,11 +9662,6 @@ #endif } -#if defined(WITH_THREAD) && !defined(MYDB_USE_GILSTATE) - /* Save the current interpreter, so callbacks can do the right thing. */ - _db_interpreterState = PyThreadState_GET()->interp; -#endif - /* Create the module and add the functions */ #if (PY_VERSION_HEX < 0x03000000) m = Py_InitModule(_bsddbModuleName, bsddb_methods); @@ -9428,13 +9696,7 @@ ADD_INT(d, DB_MAX_RECORDS); #if (DBVER < 48) -#if (DBVER >= 42) ADD_INT(d, DB_RPCCLIENT); -#else - ADD_INT(d, DB_CLIENT); - /* allow apps to be written using DB_RPCCLIENT on older Berkeley DB */ - _addIntToDict(d, "DB_RPCCLIENT", DB_CLIENT); -#endif #endif #if (DBVER < 48) @@ -9477,6 +9739,14 @@ ADD_INT(d, DB_TXN_SYNC); ADD_INT(d, DB_TXN_NOWAIT); +#if (DBVER >= 51) + ADD_INT(d, DB_TXN_BULK); +#endif + +#if (DBVER >= 48) + ADD_INT(d, DB_CURSOR_BULK); +#endif + #if (DBVER >= 46) ADD_INT(d, DB_TXN_WAIT); #endif @@ -9511,9 +9781,7 @@ ADD_INT(d, DB_LOCK_MINWRITE); ADD_INT(d, DB_LOCK_EXPIRE); -#if (DBVER >= 43) ADD_INT(d, DB_LOCK_MAXWRITE); -#endif _addIntToDict(d, "DB_LOCK_CONFLICT", 0); @@ -9549,9 +9817,6 @@ ADD_INT(d, DB_LOCK_UPGRADE); ADD_INT(d, DB_LSTAT_ABORTED); -#if (DBVER < 43) - ADD_INT(d, DB_LSTAT_ERR); -#endif ADD_INT(d, DB_LSTAT_FREE); ADD_INT(d, DB_LSTAT_HELD); @@ -9561,9 +9826,7 @@ ADD_INT(d, DB_ARCH_ABS); ADD_INT(d, DB_ARCH_DATA); ADD_INT(d, DB_ARCH_LOG); -#if (DBVER >= 42) ADD_INT(d, DB_ARCH_REMOVE); -#endif ADD_INT(d, DB_BTREE); ADD_INT(d, DB_HASH); @@ -9578,9 +9841,7 @@ ADD_INT(d, DB_REVSPLITOFF); ADD_INT(d, DB_SNAPSHOT); -#if (DBVER >= 43) ADD_INT(d, DB_INORDER); -#endif ADD_INT(d, DB_JOIN_NOSORT); @@ -9591,9 +9852,6 @@ ADD_INT(d, DB_CACHED_COUNTS); #endif -#if (DBVER <= 41) - ADD_INT(d, DB_COMMIT); -#endif ADD_INT(d, DB_CONSUME); ADD_INT(d, DB_CONSUME_WAIT); ADD_INT(d, DB_CURRENT); @@ -9651,8 +9909,10 @@ ADD_INT(d, DB_LOCK_DEADLOCK); ADD_INT(d, DB_LOCK_NOTGRANTED); ADD_INT(d, DB_NOSERVER); +#if (DBVER < 52) ADD_INT(d, DB_NOSERVER_HOME); ADD_INT(d, DB_NOSERVER_ID); +#endif ADD_INT(d, DB_NOTFOUND); ADD_INT(d, DB_OLD_VERSION); ADD_INT(d, DB_RUNRECOVERY); @@ -9665,13 +9925,14 @@ ADD_INT(d, DB_YIELDCPU); ADD_INT(d, DB_PANIC_ENVIRONMENT); ADD_INT(d, DB_NOPANIC); - ADD_INT(d, DB_OVERWRITE); -#if (DBVER >= 43) ADD_INT(d, DB_STAT_SUBSYSTEM); ADD_INT(d, DB_STAT_MEMP_HASH); -#endif + ADD_INT(d, DB_STAT_LOCK_CONF); + ADD_INT(d, DB_STAT_LOCK_LOCKERS); + ADD_INT(d, DB_STAT_LOCK_OBJECTS); + ADD_INT(d, DB_STAT_LOCK_PARAMS); #if (DBVER >= 48) ADD_INT(d, DB_OVERWRITE_DUP); @@ -9690,7 +9951,6 @@ ADD_INT(d, DB_EID_INVALID); ADD_INT(d, DB_EID_BROADCAST); -#if (DBVER >= 42) ADD_INT(d, DB_TIME_NOTGRANTED); ADD_INT(d, DB_TXN_NOT_DURABLE); ADD_INT(d, DB_TXN_WRITE_NOSYNC); @@ -9698,9 +9958,8 @@ ADD_INT(d, DB_INIT_REP); ADD_INT(d, DB_ENCRYPT); ADD_INT(d, DB_CHKSUM); -#endif - -#if (DBVER >= 42) && (DBVER < 47) + +#if (DBVER < 47) ADD_INT(d, DB_LOG_AUTOREMOVE); ADD_INT(d, DB_DIRECT_LOG); #endif @@ -9733,6 +9992,20 @@ ADD_INT(d, DB_VERB_REPLICATION); ADD_INT(d, DB_VERB_WAITSFOR); +#if (DBVER >= 50) + ADD_INT(d, DB_VERB_REP_SYSTEM); +#endif + +#if (DBVER >= 47) + ADD_INT(d, DB_VERB_REP_ELECT); + ADD_INT(d, DB_VERB_REP_LEASE); + ADD_INT(d, DB_VERB_REP_MISC); + ADD_INT(d, DB_VERB_REP_MSGS); + ADD_INT(d, DB_VERB_REP_SYNC); + ADD_INT(d, DB_VERB_REPMGR_CONNFAIL); + ADD_INT(d, DB_VERB_REPMGR_MISC); +#endif + #if (DBVER >= 45) ADD_INT(d, DB_EVENT_PANIC); ADD_INT(d, DB_EVENT_REP_CLIENT); @@ -9748,16 +10021,48 @@ ADD_INT(d, DB_EVENT_WRITE_FAILED); #endif +#if (DBVER >= 50) + ADD_INT(d, DB_REPMGR_CONF_ELECTIONS); + ADD_INT(d, DB_EVENT_REP_MASTER_FAILURE); + ADD_INT(d, DB_EVENT_REP_DUPMASTER); + ADD_INT(d, DB_EVENT_REP_ELECTION_FAILED); +#endif +#if (DBVER >= 48) + ADD_INT(d, DB_EVENT_REG_ALIVE); + ADD_INT(d, DB_EVENT_REG_PANIC); +#endif + +#if (DBVER >=52) + ADD_INT(d, DB_EVENT_REP_SITE_ADDED); + ADD_INT(d, DB_EVENT_REP_SITE_REMOVED); + ADD_INT(d, DB_EVENT_REP_LOCAL_SITE_REMOVED); + ADD_INT(d, DB_EVENT_REP_CONNECT_BROKEN); + ADD_INT(d, DB_EVENT_REP_CONNECT_ESTD); + ADD_INT(d, DB_EVENT_REP_CONNECT_TRY_FAILED); + ADD_INT(d, DB_EVENT_REP_INIT_DONE); + + ADD_INT(d, DB_MEM_LOCK); + ADD_INT(d, DB_MEM_LOCKOBJECT); + ADD_INT(d, DB_MEM_LOCKER); + ADD_INT(d, DB_MEM_LOGID); + ADD_INT(d, DB_MEM_TRANSACTION); + ADD_INT(d, DB_MEM_THREAD); + + ADD_INT(d, DB_BOOTSTRAP_HELPER); + ADD_INT(d, DB_GROUP_CREATOR); + ADD_INT(d, DB_LEGACY); + ADD_INT(d, DB_LOCAL_SITE); + ADD_INT(d, DB_REPMGR_PEER); +#endif + ADD_INT(d, DB_REP_DUPMASTER); ADD_INT(d, DB_REP_HOLDELECTION); #if (DBVER >= 44) ADD_INT(d, DB_REP_IGNORE); ADD_INT(d, DB_REP_JOIN_FAILURE); #endif -#if (DBVER >= 42) ADD_INT(d, DB_REP_ISPERM); ADD_INT(d, DB_REP_NOTPERM); -#endif ADD_INT(d, DB_REP_NEWSITE); ADD_INT(d, DB_REP_MASTER); @@ -9766,7 +10071,13 @@ ADD_INT(d, DB_REP_PERMANENT); #if (DBVER >= 44) +#if (DBVER >= 50) + ADD_INT(d, DB_REP_CONF_AUTOINIT); +#else ADD_INT(d, DB_REP_CONF_NOAUTOINIT); +#endif /* 5.0 */ +#endif /* 4.4 */ +#if (DBVER >= 44) ADD_INT(d, DB_REP_CONF_DELAYCLIENT); ADD_INT(d, DB_REP_CONF_BULK); ADD_INT(d, DB_REP_CONF_NOWAIT); @@ -9774,9 +10085,7 @@ ADD_INT(d, DB_REP_REREQUEST); #endif -#if (DBVER >= 42) ADD_INT(d, DB_REP_NOBUFFER); -#endif #if (DBVER >= 46) ADD_INT(d, DB_REP_LEASE_EXPIRED); @@ -9819,14 +10128,34 @@ ADD_INT(d, DB_STAT_ALL); #endif -#if (DBVER >= 43) +#if (DBVER >= 51) + ADD_INT(d, DB_REPMGR_ACKS_ALL_AVAILABLE); +#endif + +#if (DBVER >= 48) + ADD_INT(d, DB_REP_CONF_INMEM); +#endif + + ADD_INT(d, DB_TIMEOUT); + +#if (DBVER >= 50) + ADD_INT(d, DB_FORCESYNC); +#endif + +#if (DBVER >= 48) + ADD_INT(d, DB_FAILCHK); +#endif + +#if (DBVER >= 51) + ADD_INT(d, DB_HOTBACKUP_IN_PROGRESS); +#endif + ADD_INT(d, DB_BUFFER_SMALL); ADD_INT(d, DB_SEQ_DEC); ADD_INT(d, DB_SEQ_INC); ADD_INT(d, DB_SEQ_WRAP); -#endif - -#if (DBVER >= 43) && (DBVER < 47) + +#if (DBVER < 47) ADD_INT(d, DB_LOG_INMEMORY); ADD_INT(d, DB_DSYNC_LOG); #endif @@ -9856,6 +10185,10 @@ ADD_INT(d, DB_SET_LOCK_TIMEOUT); ADD_INT(d, DB_SET_TXN_TIMEOUT); +#if (DBVER >= 48) + ADD_INT(d, DB_SET_REG_TIMEOUT); +#endif + /* The exception name must be correct for pickled exception * * objects to unpickle properly. */ #ifdef PYBSDDB_STANDALONE /* different value needed for standalone pybsddb */ @@ -9912,8 +10245,10 @@ MAKE_EX(DBRunRecoveryError); MAKE_EX(DBVerifyBadError); MAKE_EX(DBNoServerError); +#if (DBVER < 52) MAKE_EX(DBNoServerHomeError); MAKE_EX(DBNoServerIDError); +#endif MAKE_EX(DBPageNotFoundError); MAKE_EX(DBSecondaryBadError); @@ -9927,9 +10262,7 @@ MAKE_EX(DBNoSuchFileError); MAKE_EX(DBPermissionsError); -#if (DBVER >= 42) MAKE_EX(DBRepHandleDeadError); -#endif #if (DBVER >= 44) MAKE_EX(DBRepLockoutError); #endif @@ -9947,27 +10280,30 @@ #undef MAKE_EX /* Initialise the C API structure and add it to the module */ + bsddb_api.api_version = PYBSDDB_API_VERSION; bsddb_api.db_type = &DB_Type; bsddb_api.dbcursor_type = &DBCursor_Type; bsddb_api.dblogcursor_type = &DBLogCursor_Type; bsddb_api.dbenv_type = &DBEnv_Type; bsddb_api.dbtxn_type = &DBTxn_Type; bsddb_api.dblock_type = &DBLock_Type; -#if (DBVER >= 43) bsddb_api.dbsequence_type = &DBSequence_Type; -#endif bsddb_api.makeDBError = makeDBError; /* - ** Capsules exist from Python 3.1, but I - ** don't want to break the API compatibility - ** for already published Python versions. + ** Capsules exist from Python 2.7 and 3.1. + ** We don't support Python 3.0 anymore, so... + ** #if (PY_VERSION_HEX < ((PY_MAJOR_VERSION < 3) ? 0x02070000 : 0x03020000)) */ -#if (PY_VERSION_HEX < 0x03020000) +#if (PY_VERSION_HEX < 0x02070000) py_api = PyCObject_FromVoidPtr((void*)&bsddb_api, NULL); #else { - char py_api_name[250]; + /* + ** The data must outlive the call!!. So, the static definition. + ** The buffer must be big enough... + */ + static char py_api_name[MODULE_NAME_MAX_LEN+10]; strcpy(py_api_name, _bsddbModuleName); strcat(py_api_name, ".api"); diff --git a/Modules/bsddb.h b/Modules/bsddb.h --- a/Modules/bsddb.h +++ b/Modules/bsddb.h @@ -61,7 +61,7 @@ * * http://www.python.org/peps/pep-0291.html * - * This module contains 6 types: + * This module contains 7 types: * * DB (Database) * DBCursor (Database Cursor) @@ -69,6 +69,7 @@ * DBTxn (An explicit database transaction) * DBLock (A lock handle) * DBSequence (Sequence) + * DBSite (Site) * * New datatypes: * @@ -109,7 +110,7 @@ #error "eek! DBVER can't handle minor versions > 9" #endif -#define PY_BSDDB_VERSION "4.8.4.2" +#define PY_BSDDB_VERSION "5.3.0" /* Python object definitions */ @@ -129,6 +130,9 @@ struct DBLogCursorObject; /* Forward declaration */ struct DBTxnObject; /* Forward declaration */ struct DBSequenceObject; /* Forward declaration */ +#if (DBVER >= 52) +struct DBSiteObject; /* Forward declaration */ +#endif typedef struct { PyObject_HEAD @@ -140,6 +144,9 @@ struct DBObject *children_dbs; struct DBTxnObject *children_txns; struct DBLogCursorObject *children_logcursors; +#if (DBVER >= 52) + struct DBSiteObject *children_sites; +#endif PyObject *private_obj; PyObject *rep_transport; PyObject *in_weakreflist; /* List of weak references */ @@ -154,15 +161,14 @@ struct behaviourFlags moduleFlags; struct DBTxnObject *txn; struct DBCursorObject *children_cursors; -#if (DBVER >=43) struct DBSequenceObject *children_sequences; -#endif struct DBObject **sibling_prev_p; struct DBObject *sibling_next; struct DBObject **sibling_prev_p_txn; struct DBObject *sibling_next_txn; PyObject* associateCallback; PyObject* btCompareCallback; + PyObject* dupCompareCallback; int primaryDBType; PyObject *private_obj; PyObject *in_weakreflist; /* List of weak references */ @@ -207,6 +213,16 @@ PyObject *in_weakreflist; /* List of weak references */ } DBLogCursorObject; +#if (DBVER >= 52) +typedef struct DBSiteObject { + PyObject_HEAD + DB_SITE *site; + DBEnvObject *env; + struct DBSiteObject **sibling_prev_p; + struct DBSiteObject *sibling_next; + PyObject *in_weakreflist; /* List of weak references */ +} DBSiteObject; +#endif typedef struct { PyObject_HEAD @@ -216,7 +232,6 @@ } DBLockObject; -#if (DBVER >= 43) typedef struct DBSequenceObject { PyObject_HEAD DB_SEQUENCE* sequence; @@ -228,7 +243,6 @@ struct DBSequenceObject *sibling_next_txn; PyObject *in_weakreflist; /* List of weak references */ } DBSequenceObject; -#endif /* API structure for use by C code */ @@ -236,7 +250,7 @@ /* To access the structure from an external module, use code like the following (error checking missed out for clarity): - // If you are using Python before 3.2: + // If you are using Python before 2.7: BSDDB_api* bsddb_api; PyObject* mod; PyObject* cobj; @@ -249,7 +263,7 @@ Py_DECREF(mod); - // If you are using Python 3.2 or up: + // If you are using Python 2.7 or up: (except Python 3.0, unsupported) BSDDB_api* bsddb_api; // Use "bsddb3._pybsddb.api" if you're using @@ -257,10 +271,14 @@ bsddb_api = (void **)PyCapsule_Import("bsddb._bsddb.api", 1); + Check "api_version" number before trying to use the API. + The structure's members must not be changed. */ +#define PYBSDDB_API_VERSION 1 typedef struct { + unsigned int api_version; /* Type objects */ PyTypeObject* db_type; PyTypeObject* dbcursor_type; @@ -268,9 +286,7 @@ PyTypeObject* dbenv_type; PyTypeObject* dbtxn_type; PyTypeObject* dblock_type; -#if (DBVER >= 43) PyTypeObject* dbsequence_type; -#endif /* Functions */ int (*makeDBError)(int err); @@ -289,9 +305,9 @@ #define DBEnvObject_Check(v) ((v)->ob_type == bsddb_api->dbenv_type) #define DBTxnObject_Check(v) ((v)->ob_type == bsddb_api->dbtxn_type) #define DBLockObject_Check(v) ((v)->ob_type == bsddb_api->dblock_type) -#if (DBVER >= 43) -#define DBSequenceObject_Check(v) ((v)->ob_type == bsddb_api->dbsequence_type) -#endif +#define DBSequenceObject_Check(v) \ + ((bsddb_api->dbsequence_type) && \ + ((v)->ob_type == bsddb_api->dbsequence_type)) #endif /* COMPILING_BSDDB_C */ diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -878,8 +878,8 @@ # a release. Most open source OSes come with one or more # versions of BerkeleyDB already installed. - max_db_ver = (4, 8) - min_db_ver = (4, 1) + max_db_ver = (5, 3) + min_db_ver = (4, 3) db_setup_debug = False # verbose debug prints from this script? def allow_db_ver(db_ver): @@ -900,7 +900,11 @@ return True def gen_db_minor_ver_nums(major): - if major == 4: + if major == 5: + for x in range(max_db_ver[1]+1): + if allow_db_ver((5, x)): + yield x + elif major == 4: for x in range(max_db_ver[1]+1): if allow_db_ver((4, x)): yield x -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 22:51:08 2013 From: python-checkins at python.org (matthias.klose) Date: Tue, 19 Mar 2013 22:51:08 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Reindent_files?= =?utf-8?q?_for=3A?= Message-ID: <3ZVnyN36L5zSbh@mail.python.org> http://hg.python.org/cpython/rev/df9d2adafc2c changeset: 82778:df9d2adafc2c branch: 2.7 user: doko at ubuntu.com date: Tue Mar 19 14:50:38 2013 -0700 summary: Reindent files for: - Issue #17477: Update the bsddb module to pybsddb 5.3.0, supporting db-5.x, and dropping support for db-4.1 and db-4.2. files: Lib/bsddb/test/test_basics.py | 14 +- Lib/bsddb/test/test_db.py | 90 +++++----- Lib/bsddb/test/test_distributed_transactions.py | 10 +- 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/Lib/bsddb/test/test_basics.py b/Lib/bsddb/test/test_basics.py --- a/Lib/bsddb/test/test_basics.py +++ b/Lib/bsddb/test/test_basics.py @@ -68,13 +68,13 @@ # create and open the DB self.d = db.DB(self.env) if not self.useEnv : - self.d.set_cachesize(*self.cachesize) - cachesize = self.d.get_cachesize() - self.assertEqual(cachesize[0], self.cachesize[0]) - self.assertEqual(cachesize[2], self.cachesize[2]) - # Berkeley DB expands the cache 25% accounting overhead, - # if the cache is small. - self.assertEqual(125, int(100.0*cachesize[1]/self.cachesize[1])) + self.d.set_cachesize(*self.cachesize) + cachesize = self.d.get_cachesize() + self.assertEqual(cachesize[0], self.cachesize[0]) + self.assertEqual(cachesize[2], self.cachesize[2]) + # Berkeley DB expands the cache 25% accounting overhead, + # if the cache is small. + self.assertEqual(125, int(100.0*cachesize[1]/self.cachesize[1])) self.d.set_flags(self.dbsetflags) if self.dbname: self.d.open(self.filename, self.dbname, self.dbtype, diff --git a/Lib/bsddb/test/test_db.py b/Lib/bsddb/test/test_db.py --- a/Lib/bsddb/test/test_db.py +++ b/Lib/bsddb/test/test_db.py @@ -63,28 +63,28 @@ self.assertFalse(self.db.get_transactional()) class DB_hash(DB) : - def test_h_ffactor(self) : - for ffactor in [4, 16, 256] : - self.db.set_h_ffactor(ffactor) - self.assertEqual(ffactor, self.db.get_h_ffactor()) + def test_h_ffactor(self) : + for ffactor in [4, 16, 256] : + self.db.set_h_ffactor(ffactor) + self.assertEqual(ffactor, self.db.get_h_ffactor()) - def test_h_nelem(self) : - for nelem in [1, 2, 4] : - nelem = nelem*1024*1024 # Millions - self.db.set_h_nelem(nelem) - self.assertEqual(nelem, self.db.get_h_nelem()) + def test_h_nelem(self) : + for nelem in [1, 2, 4] : + nelem = nelem*1024*1024 # Millions + self.db.set_h_nelem(nelem) + self.assertEqual(nelem, self.db.get_h_nelem()) - def test_pagesize(self) : - for i in xrange(9, 17) : # From 512 to 65536 - i = 1< http://hg.python.org/cpython/rev/1f2b5848f151 changeset: 82779:1f2b5848f151 branch: 2.7 user: doko at ubuntu.com date: Tue Mar 19 15:00:46 2013 -0700 summary: - update config.guess and config.sub files: config.guess | 43 ++++++++++++++----------- config.sub | 66 ++++++++++++++++++++++----------------- 2 files changed, 61 insertions(+), 48 deletions(-) diff --git a/config.guess b/config.guess old mode 100644 new mode 100755 --- a/config.guess +++ b/config.guess @@ -2,13 +2,13 @@ # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# 2011, 2012, 2013 Free Software Foundation, Inc. -timestamp='2012-02-10' +timestamp='2012-12-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -22,19 +22,17 @@ # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches at gnu.org. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -55,8 +53,8 @@ Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -200,6 +198,10 @@ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} @@ -302,7 +304,7 @@ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -801,6 +803,9 @@ i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; @@ -1201,6 +1206,9 @@ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1256,7 +1264,7 @@ NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1330,9 +1338,6 @@ exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - eval $set_cc_for_build cat >$dummy.c <. @@ -26,11 +22,12 @@ # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches with a ChangeLog entry to config-patches at gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -74,8 +71,8 @@ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -123,7 +120,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) @@ -156,7 +153,7 @@ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; @@ -259,8 +256,10 @@ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | be32 | be64 \ + | arc \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ @@ -273,7 +272,7 @@ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -389,7 +388,8 @@ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -788,9 +788,13 @@ basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze*) basic_machine=microblaze-xilinx ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) basic_machine=i386-pc os=-mingw32 @@ -1019,7 +1023,11 @@ basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1352,15 +1360,15 @@ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:04:14 2013 From: python-checkins at python.org (matthias.klose) Date: Tue, 19 Mar 2013 23:04:14 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_-_update_confi?= =?utf-8?q?g=2Eguess_and_config=2Esub?= Message-ID: <3ZVpFV5sCNzRkL@mail.python.org> http://hg.python.org/cpython/rev/6dcc9628065c changeset: 82780:6dcc9628065c branch: 3.3 parent: 82774:4e59a7fc69c6 user: doko at ubuntu.com date: Tue Mar 19 15:03:26 2013 -0700 summary: - update config.guess and config.sub files: config.guess | 43 ++++++++++++---------- config.sub | 75 ++++++++++++++++++++++++--------------- 2 files changed, 70 insertions(+), 48 deletions(-) diff --git a/config.guess b/config.guess --- a/config.guess +++ b/config.guess @@ -2,13 +2,13 @@ # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# 2011, 2012, 2013 Free Software Foundation, Inc. -timestamp='2012-02-10' +timestamp='2012-12-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -22,19 +22,17 @@ # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches at gnu.org. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -55,8 +53,8 @@ Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -200,6 +198,10 @@ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} @@ -302,7 +304,7 @@ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -801,6 +803,9 @@ i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; @@ -1201,6 +1206,9 @@ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1256,7 +1264,7 @@ NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1330,9 +1338,6 @@ exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - eval $set_cc_for_build cat >$dummy.c <. @@ -26,11 +22,12 @@ # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches with a ChangeLog entry to config-patches at gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -74,8 +71,8 @@ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -123,7 +120,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) @@ -156,7 +153,7 @@ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; @@ -225,6 +222,12 @@ -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -253,8 +256,10 @@ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | be32 | be64 \ + | arc \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ @@ -267,7 +272,7 @@ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -383,7 +388,8 @@ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -782,9 +788,13 @@ basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze*) basic_machine=microblaze-xilinx ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) basic_machine=i386-pc os=-mingw32 @@ -1013,7 +1023,11 @@ basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1346,15 +1360,15 @@ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ @@ -1537,6 +1551,9 @@ c4x-* | tic4x-*) os=-coff ;; + hexagon-*) + os=-elf + ;; tic54x-*) os=-coff ;; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:04:16 2013 From: python-checkins at python.org (matthias.klose) Date: Tue, 19 Mar 2013 23:04:16 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_-_update_config=2Eguess_an?= =?utf-8?q?d_config=2Esub?= Message-ID: <3ZVpFX34DszSMj@mail.python.org> http://hg.python.org/cpython/rev/7779dbc20536 changeset: 82781:7779dbc20536 parent: 82775:21d23fda469f user: doko at ubuntu.com date: Tue Mar 19 15:03:57 2013 -0700 summary: - update config.guess and config.sub files: config.guess | 43 ++++++++++++---------- config.sub | 75 ++++++++++++++++++++++++--------------- 2 files changed, 70 insertions(+), 48 deletions(-) diff --git a/config.guess b/config.guess --- a/config.guess +++ b/config.guess @@ -2,13 +2,13 @@ # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# 2011, 2012, 2013 Free Software Foundation, Inc. -timestamp='2012-02-10' +timestamp='2012-12-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -22,19 +22,17 @@ # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches at gnu.org. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -55,8 +53,8 @@ Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -200,6 +198,10 @@ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} @@ -302,7 +304,7 @@ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -801,6 +803,9 @@ i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; @@ -1201,6 +1206,9 @@ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1256,7 +1264,7 @@ NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1330,9 +1338,6 @@ exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - eval $set_cc_for_build cat >$dummy.c <. @@ -26,11 +22,12 @@ # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches with a ChangeLog entry to config-patches at gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -74,8 +71,8 @@ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -123,7 +120,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) @@ -156,7 +153,7 @@ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; @@ -225,6 +222,12 @@ -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -253,8 +256,10 @@ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | be32 | be64 \ + | arc \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ @@ -267,7 +272,7 @@ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -383,7 +388,8 @@ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -782,9 +788,13 @@ basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze*) basic_machine=microblaze-xilinx ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) basic_machine=i386-pc os=-mingw32 @@ -1013,7 +1023,11 @@ basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1346,15 +1360,15 @@ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ @@ -1537,6 +1551,9 @@ c4x-* | tic4x-*) os=-coff ;; + hexagon-*) + os=-elf + ;; tic54x-*) os=-coff ;; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:19:43 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Tue, 19 Mar 2013 23:19:43 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyMDk4?= =?utf-8?q?=3A_multiprocessing_on_Windows_now_starts_child_processes?= Message-ID: <3ZVpbM00ttzPPY@mail.python.org> http://hg.python.org/cpython/rev/37f52e71f4cd changeset: 82782:37f52e71f4cd branch: 2.7 parent: 82779:1f2b5848f151 user: Kristj?n Valur J?nsson date: Tue Mar 19 15:07:35 2013 -0700 summary: Issue #12098: multiprocessing on Windows now starts child processes using the same sys.flags as the current process. Backport from default branch. files: Lib/multiprocessing/forking.py | 3 +- Lib/multiprocessing/util.py | 1 + Lib/subprocess.py | 31 ++++++++++++++++++ Lib/test/test_multiprocessing.py | 34 +++++++++++++++++++- Lib/test/test_support.py | 17 +--------- Misc/NEWS | 4 ++ 6 files changed, 72 insertions(+), 18 deletions(-) diff --git a/Lib/multiprocessing/forking.py b/Lib/multiprocessing/forking.py --- a/Lib/multiprocessing/forking.py +++ b/Lib/multiprocessing/forking.py @@ -361,7 +361,8 @@ return [sys.executable, '--multiprocessing-fork'] else: prog = 'from multiprocessing.forking import main; main()' - return [_python_exe, '-c', prog, '--multiprocessing-fork'] + opts = util._args_from_interpreter_flags() + return [_python_exe] + opts + ['-c', prog, '--multiprocessing-fork'] def main(): diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py --- a/Lib/multiprocessing/util.py +++ b/Lib/multiprocessing/util.py @@ -37,6 +37,7 @@ import atexit import threading # we want threading to install it's # cleanup function before multiprocessing does +from subprocess import _args_from_interpreter_flags from multiprocessing.process import current_process, active_children diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -482,6 +482,37 @@ raise +# XXX This function is only used by multiprocessing and the test suite, +# but it's here so that it can be imported when Python is compiled without +# threads. + +def _args_from_interpreter_flags(): + """Return a list of command-line arguments reproducing the current + settings in sys.flags and sys.warnoptions.""" + flag_opt_map = { + 'debug': 'd', + # 'inspect': 'i', + # 'interactive': 'i', + 'optimize': 'O', + 'dont_write_bytecode': 'B', + 'no_user_site': 's', + 'no_site': 'S', + 'ignore_environment': 'E', + 'verbose': 'v', + 'bytes_warning': 'b', + 'hash_randomization': 'R', + 'py3k_warning': '3', + } + args = [] + for flag, opt in flag_opt_map.items(): + v = getattr(sys.flags, flag) + if v > 0: + args.append('-' + opt * v) + for opt in sys.warnoptions: + args.append('-W' + opt) + return args + + def call(*popenargs, **kwargs): """Run command with arguments. Wait for command to complete, then return the returncode attribute. diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -2400,11 +2400,43 @@ self.assertEqual('', err.decode('ascii')) # +# Issue 12098: check sys.flags of child matches that for parent # + +class TestFlags(unittest.TestCase): + @classmethod + def run_in_grandchild(cls, conn): + conn.send(tuple(sys.flags)) + + @classmethod + def run_in_child(cls): + import json + r, w = multiprocessing.Pipe(duplex=False) + p = multiprocessing.Process(target=cls.run_in_grandchild, args=(w,)) + p.start() + grandchild_flags = r.recv() + p.join() + r.close() + w.close() + flags = (tuple(sys.flags), grandchild_flags) + print(json.dumps(flags)) + + def test_flags(self): + import json, subprocess + # start child process using unusual flags + prog = ('from test.test_multiprocessing import TestFlags; ' + + 'TestFlags.run_in_child()') + data = subprocess.check_output( + [sys.executable, '-E', '-S', '-O', '-c', prog]) + child_flags, grandchild_flags = json.loads(data.decode('ascii')) + self.assertEqual(child_flags, grandchild_flags) # +# +# testcases_other = [OtherTest, TestInvalidHandle, TestInitializers, - TestStdinBadfiledescriptor, TestTimeouts, TestNoForkBomb] + TestStdinBadfiledescriptor, TestTimeouts, TestNoForkBomb, + TestFlags] # # diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -1344,22 +1344,7 @@ def args_from_interpreter_flags(): """Return a list of command-line arguments reproducing the current settings in sys.flags.""" - flag_opt_map = { - 'bytes_warning': 'b', - 'dont_write_bytecode': 'B', - 'ignore_environment': 'E', - 'no_user_site': 's', - 'no_site': 'S', - 'optimize': 'O', - 'py3k_warning': '3', - 'verbose': 'v', - } - args = [] - for flag, opt in flag_opt_map.items(): - v = getattr(sys.flags, flag) - if v > 0: - args.append('-' + opt * v) - return args + return subprocess._args_from_interpreter_flags() def strip_python_stderr(stderr): """Strip the stderr of a Python process from potential debug output diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -214,6 +214,10 @@ Library ------- +- Issue #12098: multiprocessing on Windows now starts child processes + using the same sys.flags as the current process. Initial patch by + Sergey Mezentsev. + - Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal. - Issue #9090: When a socket with a timeout fails with EWOULDBLOCK or EAGAIN, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:22:03 2013 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Mar 2013 23:22:03 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE1MjU5MTk6IERv?= =?utf-8?q?cument_MIMEText+set=5Fpayload_encoding_behavior=2E?= Message-ID: <3ZVpf35hDtzR52@mail.python.org> http://hg.python.org/cpython/rev/ba500b179c3a changeset: 82783:ba500b179c3a branch: 3.2 parent: 82773:33f02ccb5301 user: R David Murray date: Tue Mar 19 18:18:55 2013 -0400 summary: #1525919: Document MIMEText+set_payload encoding behavior. files: Doc/library/email.mime.rst | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/Doc/library/email.mime.rst b/Doc/library/email.mime.rst --- a/Doc/library/email.mime.rst +++ b/Doc/library/email.mime.rst @@ -185,5 +185,15 @@ minor type and defaults to :mimetype:`plain`. *_charset* is the character set of the text and is passed as a parameter to the :class:`~email.mime.nonmultipart.MIMENonMultipart` constructor; it defaults - to ``us-ascii``. No guessing or encoding is performed on the text data. + to ``us-ascii``. + Unless the ``_charset`` parameter is explicitly set to ``None``, the + MIMEText object created will have both a :mailheader:`Content-Type` header + with a ``charset`` parameter, and a :mailheader:`Content-Transfer-Endcoding` + header. This means that a subsequent ``set_payload`` call will not result + in an encoded payload, even if a charset is passed in the ``set_payload`` + command. You can "reset" this behavior by deleting the + ``Content-Transfer-Encoding`` header, after which a ``set_payload`` call + will automatically encode the new payload (and add a new + :mailheader:`Content-Transfer-Encoding` header). + -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:22:05 2013 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Mar 2013 23:22:05 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge=3A_=231525919=3A_Document_MIMEText+set=5Fpayload_encodin?= =?utf-8?q?g_behavior=2E?= Message-ID: <3ZVpf51MMczS8W@mail.python.org> http://hg.python.org/cpython/rev/fcbc28ef96a3 changeset: 82784:fcbc28ef96a3 branch: 3.3 parent: 82780:6dcc9628065c parent: 82783:ba500b179c3a user: R David Murray date: Tue Mar 19 18:21:22 2013 -0400 summary: Merge: #1525919: Document MIMEText+set_payload encoding behavior. files: Doc/library/email.mime.rst | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/Doc/library/email.mime.rst b/Doc/library/email.mime.rst --- a/Doc/library/email.mime.rst +++ b/Doc/library/email.mime.rst @@ -187,3 +187,13 @@ :class:`~email.mime.nonmultipart.MIMENonMultipart` constructor; it defaults to ``us-ascii`` if the string contains only ``ascii`` codepoints, and ``utf-8`` otherwise. + + Unless the ``_charset`` parameter is explicitly set to ``None``, the + MIMEText object created will have both a :mailheader:`Content-Type` header + with a ``charset`` parameter, and a :mailheader:`Content-Transfer-Endcoding` + header. This means that a subsequent ``set_payload`` call will not result + in an encoded payload, even if a charset is passed in the ``set_payload`` + command. You can "reset" this behavior by deleting the + ``Content-Transfer-Encoding`` header, after which a ``set_payload`` call + will automatically encode the new payload (and add a new + :mailheader:`Content-Transfer-Encoding` header). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:22:06 2013 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Mar 2013 23:22:06 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=231525919=3A_Document_MIMEText+set=5Fpayload_e?= =?utf-8?q?ncoding_behavior=2E?= Message-ID: <3ZVpf64ggNzSR9@mail.python.org> http://hg.python.org/cpython/rev/b9e07f20832e changeset: 82785:b9e07f20832e parent: 82781:7779dbc20536 parent: 82784:fcbc28ef96a3 user: R David Murray date: Tue Mar 19 18:21:50 2013 -0400 summary: Merge: #1525919: Document MIMEText+set_payload encoding behavior. files: Doc/library/email.mime.rst | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/Doc/library/email.mime.rst b/Doc/library/email.mime.rst --- a/Doc/library/email.mime.rst +++ b/Doc/library/email.mime.rst @@ -187,3 +187,13 @@ :class:`~email.mime.nonmultipart.MIMENonMultipart` constructor; it defaults to ``us-ascii`` if the string contains only ``ascii`` codepoints, and ``utf-8`` otherwise. + + Unless the ``_charset`` parameter is explicitly set to ``None``, the + MIMEText object created will have both a :mailheader:`Content-Type` header + with a ``charset`` parameter, and a :mailheader:`Content-Transfer-Endcoding` + header. This means that a subsequent ``set_payload`` call will not result + in an encoded payload, even if a charset is passed in the ``set_payload`` + command. You can "reset" this behavior by deleting the + ``Content-Transfer-Encoding`` header, after which a ``set_payload`` call + will automatically encode the new payload (and add a new + :mailheader:`Content-Transfer-Encoding` header). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:33:57 2013 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 19 Mar 2013 23:33:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_Fixes_issue_?= =?utf-8?q?=2317192=3A_Update_the_ctypes_module=27s_libffi_to_v3=2E0=2E13?= =?utf-8?q?=2E__This?= Message-ID: <3ZVpvn1Gz3zS6b@mail.python.org> http://hg.python.org/cpython/rev/43e8da639462 changeset: 82786:43e8da639462 branch: 3.2 parent: 82725:114e363ebf83 user: Gregory P. Smith date: Mon Mar 18 17:11:20 2013 -0700 summary: Fixes issue #17192: Update the ctypes module's libffi to v3.0.13. This specifically addresses a stack misalignment issue on x86 and issues on some more recent platforms. files: Misc/NEWS | 4 + Modules/_ctypes/libffi.diff | 67 +- Modules/_ctypes/libffi/.gitignore | 21 + Modules/_ctypes/libffi/.travis.yml | 8 + Modules/_ctypes/libffi/ChangeLog | 1364 ++ Modules/_ctypes/libffi/ChangeLog.libffi | 37 +- Modules/_ctypes/libffi/LICENSE | 6 +- Modules/_ctypes/libffi/Makefile.am | 117 +- Modules/_ctypes/libffi/Makefile.in | 937 +- Modules/_ctypes/libffi/README | 173 +- Modules/_ctypes/libffi/aclocal.m4 | 1207 +- Modules/_ctypes/libffi/build-ios.sh | 67 + Modules/_ctypes/libffi/compile | 21 +- Modules/_ctypes/libffi/config.guess | 297 +- Modules/_ctypes/libffi/config.sub | 264 +- Modules/_ctypes/libffi/configure | 6037 +++++++-- Modules/_ctypes/libffi/configure.ac | 343 +- Modules/_ctypes/libffi/depcomp | 116 +- Modules/_ctypes/libffi/doc/libffi.texi | 42 +- Modules/_ctypes/libffi/doc/stamp-vti | 8 +- Modules/_ctypes/libffi/doc/version.texi | 8 +- Modules/_ctypes/libffi/fficonfig.h.in | 21 + Modules/_ctypes/libffi/generate-ios-source-and-headers.py | 160 + Modules/_ctypes/libffi/generate-osx-source-and-headers.py | 153 + Modules/_ctypes/libffi/include/Makefile.in | 97 +- Modules/_ctypes/libffi/include/ffi.h.in | 125 +- Modules/_ctypes/libffi/include/ffi_common.h | 18 +- Modules/_ctypes/libffi/install-sh | 515 +- Modules/_ctypes/libffi/libffi.xcodeproj/project.pbxproj | 579 + Modules/_ctypes/libffi/libtool-ldflags | 106 + Modules/_ctypes/libffi/libtool-version | 2 +- Modules/_ctypes/libffi/ltmain.sh | 4333 ++++-- Modules/_ctypes/libffi/m4/asmcfi.m4 | 13 + Modules/_ctypes/libffi/m4/ax_append_flag.m4 | 69 + Modules/_ctypes/libffi/m4/ax_cc_maxopt.m4 | 181 + Modules/_ctypes/libffi/m4/ax_cflags_warn_all.m4 | 122 + Modules/_ctypes/libffi/m4/ax_check_compile_flag.m4 | 72 + Modules/_ctypes/libffi/m4/ax_compiler_vendor.m4 | 84 + Modules/_ctypes/libffi/m4/ax_configure_args.m4 | 70 + Modules/_ctypes/libffi/m4/ax_enable_builddir.m4 | 300 + Modules/_ctypes/libffi/m4/ax_gcc_archflag.m4 | 225 + Modules/_ctypes/libffi/m4/ax_gcc_x86_cpuid.m4 | 79 + Modules/_ctypes/libffi/m4/libtool.m4 | 2294 ++- Modules/_ctypes/libffi/m4/ltoptions.m4 | 32 +- Modules/_ctypes/libffi/m4/ltversion.m4 | 12 +- Modules/_ctypes/libffi/m4/lt~obsolete.m4 | 12 +- Modules/_ctypes/libffi/man/Makefile.am | 4 +- Modules/_ctypes/libffi/man/Makefile.in | 103 +- Modules/_ctypes/libffi/man/ffi.3 | 10 + Modules/_ctypes/libffi/man/ffi_prep_cif.3 | 10 +- Modules/_ctypes/libffi/man/ffi_prep_cif_var.3 | 73 + Modules/_ctypes/libffi/missing | 104 +- Modules/_ctypes/libffi/msvcc.sh | 30 +- Modules/_ctypes/libffi/src/aarch64/ffi.c | 1076 + Modules/_ctypes/libffi/src/aarch64/ffitarget.h | 59 + Modules/_ctypes/libffi/src/aarch64/sysv.S | 307 + Modules/_ctypes/libffi/src/alpha/ffi.c | 6 +- Modules/_ctypes/libffi/src/alpha/ffitarget.h | 7 +- Modules/_ctypes/libffi/src/alpha/osf.S | 57 +- Modules/_ctypes/libffi/src/arm/ffi.c | 503 +- Modules/_ctypes/libffi/src/arm/ffitarget.h | 28 +- Modules/_ctypes/libffi/src/arm/gentramp.sh | 118 + Modules/_ctypes/libffi/src/arm/sysv.S | 226 +- Modules/_ctypes/libffi/src/arm/trampoline.S | 4450 +++++++ Modules/_ctypes/libffi/src/avr32/ffi.c | 6 +- Modules/_ctypes/libffi/src/avr32/ffitarget.h | 11 +- Modules/_ctypes/libffi/src/bfin/ffi.c | 195 + Modules/_ctypes/libffi/src/bfin/ffitarget.h | 43 + Modules/_ctypes/libffi/src/bfin/sysv.S | 177 + Modules/_ctypes/libffi/src/closures.c | 58 +- Modules/_ctypes/libffi/src/cris/ffi.c | 15 +- Modules/_ctypes/libffi/src/cris/ffitarget.h | 11 +- Modules/_ctypes/libffi/src/dlmalloc.c | 87 +- Modules/_ctypes/libffi/src/frv/ffitarget.h | 15 +- Modules/_ctypes/libffi/src/ia64/ffi.c | 20 +- Modules/_ctypes/libffi/src/ia64/ffitarget.h | 11 +- Modules/_ctypes/libffi/src/java_raw_api.c | 2 +- Modules/_ctypes/libffi/src/m32r/ffitarget.h | 11 +- Modules/_ctypes/libffi/src/m68k/ffi.c | 106 +- Modules/_ctypes/libffi/src/m68k/ffitarget.h | 11 +- Modules/_ctypes/libffi/src/m68k/sysv.S | 146 +- Modules/_ctypes/libffi/src/metag/ffi.c | 330 + Modules/_ctypes/libffi/src/metag/ffitarget.h | 53 + Modules/_ctypes/libffi/src/metag/sysv.S | 311 + Modules/_ctypes/libffi/src/microblaze/ffi.c | 321 + Modules/_ctypes/libffi/src/microblaze/ffitarget.h | 53 + Modules/_ctypes/libffi/src/microblaze/sysv.S | 302 + Modules/_ctypes/libffi/src/mips/ffi.c | 26 +- Modules/_ctypes/libffi/src/mips/ffitarget.h | 34 +- Modules/_ctypes/libffi/src/mips/n32.S | 1 + Modules/_ctypes/libffi/src/moxie/eabi.S | 137 +- Modules/_ctypes/libffi/src/moxie/ffi.c | 82 +- Modules/_ctypes/libffi/src/moxie/ffitarget.h | 12 +- Modules/_ctypes/libffi/src/pa/ffi.c | 11 +- Modules/_ctypes/libffi/src/pa/ffitarget.h | 18 +- Modules/_ctypes/libffi/src/powerpc/aix.S | 18 +- Modules/_ctypes/libffi/src/powerpc/aix_closure.S | 6 +- Modules/_ctypes/libffi/src/powerpc/asm.h | 2 +- Modules/_ctypes/libffi/src/powerpc/darwin.S | 292 +- Modules/_ctypes/libffi/src/powerpc/darwin_closure.S | 459 +- Modules/_ctypes/libffi/src/powerpc/ffi.c | 601 +- Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c | 781 +- Modules/_ctypes/libffi/src/powerpc/ffitarget.h | 43 +- Modules/_ctypes/libffi/src/powerpc/linux64.S | 21 +- Modules/_ctypes/libffi/src/powerpc/linux64_closure.S | 20 +- Modules/_ctypes/libffi/src/powerpc/ppc_closure.S | 19 + Modules/_ctypes/libffi/src/powerpc/sysv.S | 6 + Modules/_ctypes/libffi/src/prep_cif.c | 90 +- Modules/_ctypes/libffi/src/s390/ffi.c | 3 +- Modules/_ctypes/libffi/src/s390/ffitarget.h | 13 +- Modules/_ctypes/libffi/src/sh/ffi.c | 5 +- Modules/_ctypes/libffi/src/sh/ffitarget.h | 11 +- Modules/_ctypes/libffi/src/sh64/ffi.c | 5 +- Modules/_ctypes/libffi/src/sh64/ffitarget.h | 11 +- Modules/_ctypes/libffi/src/sparc/ffi.c | 78 +- Modules/_ctypes/libffi/src/sparc/ffitarget.h | 15 +- Modules/_ctypes/libffi/src/sparc/v8.S | 35 +- Modules/_ctypes/libffi/src/sparc/v9.S | 2 +- Modules/_ctypes/libffi/src/tile/ffi.c | 355 + Modules/_ctypes/libffi/src/tile/ffitarget.h | 65 + Modules/_ctypes/libffi/src/tile/tile.S | 360 + Modules/_ctypes/libffi/src/x86/ffi.c | 262 +- Modules/_ctypes/libffi/src/x86/ffi64.c | 74 +- Modules/_ctypes/libffi/src/x86/ffitarget.h | 50 +- Modules/_ctypes/libffi/src/x86/sysv.S | 81 +- Modules/_ctypes/libffi/src/x86/unix64.S | 14 +- Modules/_ctypes/libffi/src/x86/win32.S | 268 +- Modules/_ctypes/libffi/src/x86/win64.S | 22 +- Modules/_ctypes/libffi/src/xtensa/ffi.c | 298 + Modules/_ctypes/libffi/src/xtensa/ffitarget.h | 53 + Modules/_ctypes/libffi/src/xtensa/sysv.S | 253 + Modules/_ctypes/libffi/stamp-h.in | 1 + Modules/_ctypes/libffi/testsuite/Makefile.am | 140 +- Modules/_ctypes/libffi/testsuite/Makefile.in | 229 +- Modules/_ctypes/libffi/testsuite/lib/libffi.exp | 369 + Modules/_ctypes/libffi/testsuite/lib/target-libpath.exp | 22 +- Modules/_ctypes/libffi/testsuite/libffi.call/call.exp | 25 +- Modules/_ctypes/libffi/testsuite/libffi.call/closure_stdcall.c | 8 + Modules/_ctypes/libffi/testsuite/libffi.call/closure_thiscall.c | 72 + Modules/_ctypes/libffi/testsuite/libffi.call/cls_12byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_16byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_18byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_19byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_1_1byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte1.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_24byte.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_2byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_3_1byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte1.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte2.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_4_1byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_4byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_5_1_byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_5byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_64byte.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_6_1_byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_6byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_7_1_byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_7byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_8byte.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte1.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte2.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_double.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_float.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_pointer.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint16.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint32.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint64.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint16.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint32.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint64.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_dbls_struct.c | 4 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c | 16 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c | 6 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c | 17 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c | 4 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c | 22 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_struct_va1.c | 114 + Modules/_ctypes/libffi/testsuite/libffi.call/cls_uchar_va.c | 44 + Modules/_ctypes/libffi/testsuite/libffi.call/cls_uint_va.c | 45 + Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulong_va.c | 45 + Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_ushort_va.c | 44 + Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_abi.c | 5 +- Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_typedef.c | 7 +- Modules/_ctypes/libffi/testsuite/libffi.call/fastthis1_win32.c | 50 + Modules/_ctypes/libffi/testsuite/libffi.call/fastthis2_win32.c | 50 + Modules/_ctypes/libffi/testsuite/libffi.call/fastthis3_win32.c | 56 + Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h | 81 +- Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c | 107 + Modules/_ctypes/libffi/testsuite/libffi.call/huge_struct.c | 69 +- Modules/_ctypes/libffi/testsuite/libffi.call/many2.c | 57 + Modules/_ctypes/libffi/testsuite/libffi.call/many2_win32.c | 63 + Modules/_ctypes/libffi/testsuite/libffi.call/negint.c | 1 - Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct.c | 12 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct1.c | 16 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct10.c | 12 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct11.c | 121 + Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct2.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct3.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct4.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct5.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct6.c | 12 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct7.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct8.c | 12 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct9.c | 12 +- Modules/_ctypes/libffi/testsuite/libffi.call/return_dbl.c | 1 + Modules/_ctypes/libffi/testsuite/libffi.call/return_sc.c | 2 +- Modules/_ctypes/libffi/testsuite/libffi.call/return_uc.c | 2 +- Modules/_ctypes/libffi/testsuite/libffi.call/stret_large.c | 14 +- Modules/_ctypes/libffi/testsuite/libffi.call/stret_large2.c | 14 +- Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium2.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/strlen2_win32.c | 44 + Modules/_ctypes/libffi/testsuite/libffi.call/struct1.c | 12 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct1_win32.c | 67 + Modules/_ctypes/libffi/testsuite/libffi.call/struct2.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct2_win32.c | 67 + Modules/_ctypes/libffi/testsuite/libffi.call/struct3.c | 9 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct4.c | 13 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct5.c | 13 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct6.c | 14 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct7.c | 14 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct8.c | 13 +- Modules/_ctypes/libffi/testsuite/libffi.call/struct9.c | 13 +- Modules/_ctypes/libffi/testsuite/libffi.call/testclosure.c | 4 +- Modules/_ctypes/libffi/testsuite/libffi.call/uninitialized.c | 61 + Modules/_ctypes/libffi/testsuite/libffi.call/va_1.c | 196 + Modules/_ctypes/libffi/testsuite/libffi.call/va_struct1.c | 121 + Modules/_ctypes/libffi/testsuite/libffi.call/va_struct2.c | 123 + Modules/_ctypes/libffi/testsuite/libffi.call/va_struct3.c | 125 + Modules/_ctypes/libffi/testsuite/libffi.special/ffitestcxx.h | 41 - Modules/_ctypes/libffi/testsuite/libffi.special/special.exp | 16 +- Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc | 1 + Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc | 1 + Modules/_ctypes/libffi/texinfo.tex | 4999 ++++++- 240 files changed, 35313 insertions(+), 8339 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -940,6 +940,10 @@ Extension Modules ----------------- +- Issue #17192: Update the ctypes module's libffi to v3.0.13. This + specifically addresses a stack misalignment issue on x86 and issues on + some more recent platforms. + - Issue #12268: The io module file object write methods no longer abort early when one of its write system calls is interrupted (EINTR). diff --git a/Modules/_ctypes/libffi.diff b/Modules/_ctypes/libffi.diff --- a/Modules/_ctypes/libffi.diff +++ b/Modules/_ctypes/libffi.diff @@ -1,24 +1,26 @@ -diff -urN libffi.orig/configure libffi/configure ---- libffi.orig/configure 2010-03-19 18:29:54.588499862 +0100 -+++ libffi/configure 2010-03-19 18:32:09.113499479 +0100 -@@ -11228,6 +11228,9 @@ - i?86-*-solaris2.1[0-9]*) - TARGET=X86_64; TARGETDIR=x86 +diff -r -N -u libffi.orig/autom4te.cache/output.0 libffi/autom4te.cache/output.0 +diff -r -N -u libffi.orig/configure libffi/configure +--- libffi.orig/configure 2013-03-17 15:37:50.000000000 -0700 ++++ libffi/configure 2013-03-18 15:11:39.611575163 -0700 +@@ -13368,6 +13368,10 @@ + fi ;; + + i*86-*-nto-qnx*) + TARGET=X86; TARGETDIR=x86 + ;; - i?86-*-*) - TARGET=X86; TARGETDIR=x86 ++ + x86_64-*-darwin*) + TARGET=X86_DARWIN; TARGETDIR=x86 ;; -@@ -11245,12 +11248,12 @@ +@@ -13426,12 +13430,12 @@ ;; - mips-sgi-irix5.* | mips-sgi-irix6.*) + mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) - TARGET=MIPS; TARGETDIR=mips + TARGET=MIPS_IRIX; TARGETDIR=mips ;; - mips*-*-linux*) + mips*-*-linux* | mips*-*-openbsd*) # Support 128-bit long double for NewABI. HAVE_LONG_DOUBLE='defined(__mips64)' - TARGET=MIPS; TARGETDIR=mips @@ -26,8 +28,8 @@ ;; powerpc*-*-linux* | powerpc-*-sysv*) -@@ -11307,7 +11310,7 @@ - as_fn_error "\"libffi has not been ported to $host.\"" "$LINENO" 5 +@@ -13491,7 +13495,7 @@ + as_fn_error $? "\"libffi has not been ported to $host.\"" "$LINENO" 5 fi - if test x$TARGET = xMIPS; then @@ -35,7 +37,7 @@ MIPS_TRUE= MIPS_FALSE='#' else -@@ -12422,6 +12425,12 @@ +@@ -14862,6 +14866,12 @@ ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc" @@ -48,44 +50,45 @@ cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure -@@ -13521,6 +13530,8 @@ +@@ -16047,6 +16057,8 @@ "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "libffi.pc") CONFIG_FILES="$CONFIG_FILES libffi.pc" ;; + "include/ffi_common.h") CONFIG_LINKS="$CONFIG_LINKS include/ffi_common.h:include/ffi_common.h" ;; + "fficonfig.py") CONFIG_FILES="$CONFIG_FILES fficonfig.py" ;; - *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac -diff -urN libffi.orig/configure.ac libffi/configure.ac ---- libffi.orig/configure.ac 2010-03-19 18:27:44.988498585 +0100 -+++ libffi/configure.ac 2010-03-19 18:31:29.252505178 +0100 +diff -r -N -u libffi.orig/configure.ac libffi/configure.ac +--- libffi.orig/configure.ac 2013-03-17 15:37:50.000000000 -0700 ++++ libffi/configure.ac 2013-03-18 15:11:11.392989136 -0700 @@ -1,4 +1,7 @@ dnl Process this with autoconf to create configure +# -+# file from libffi - slightly patched for ctypes ++# file from libffi - slightly patched for Python's ctypes +# - AC_PREREQ(2.63) + AC_PREREQ(2.68) -@@ -91,6 +94,9 @@ - i?86-*-solaris2.1[[0-9]]*) - TARGET=X86_64; TARGETDIR=x86 +@@ -146,6 +149,10 @@ + fi ;; + + i*86-*-nto-qnx*) + TARGET=X86; TARGETDIR=x86 + ;; - i?86-*-*) - TARGET=X86; TARGETDIR=x86 ++ + x86_64-*-darwin*) + TARGET=X86_DARWIN; TARGETDIR=x86 ;; -@@ -108,12 +114,12 @@ +@@ -204,12 +211,12 @@ ;; - mips-sgi-irix5.* | mips-sgi-irix6.*) + mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) - TARGET=MIPS; TARGETDIR=mips + TARGET=MIPS_IRIX; TARGETDIR=mips ;; - mips*-*-linux*) + mips*-*-linux* | mips*-*-openbsd*) # Support 128-bit long double for NewABI. HAVE_LONG_DOUBLE='defined(__mips64)' - TARGET=MIPS; TARGETDIR=mips @@ -93,16 +96,16 @@ ;; powerpc*-*-linux* | powerpc-*-sysv*) -@@ -170,7 +176,7 @@ +@@ -269,7 +276,7 @@ AC_MSG_ERROR(["libffi has not been ported to $host."]) fi -AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS) +AM_CONDITIONAL(MIPS,[expr x$TARGET : 'xMIPS' > /dev/null]) + AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN) AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) AM_CONDITIONAL(X86, test x$TARGET = xX86) - AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD) -@@ -401,4 +407,8 @@ +@@ -567,4 +574,8 @@ AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc) diff --git a/Modules/_ctypes/libffi/.gitignore b/Modules/_ctypes/libffi/.gitignore new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/.gitignore @@ -0,0 +1,21 @@ +.libs +.deps +*.o +*.lo +.dirstamp +*.la +Makefile +config.log +config.status +*~ +fficonfig.h +include/ffi.h +include/ffitarget.h +libffi.pc +libtool +stamp-h1 +libffi*gz +autom4te.cache +libffi.xcodeproj/xcuserdata +libffi.xcodeproj/project.xcworkspace +ios/ diff --git a/Modules/_ctypes/libffi/.travis.yml b/Modules/_ctypes/libffi/.travis.yml new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/.travis.yml @@ -0,0 +1,8 @@ +language: c +compiler: + - gcc + - clang + +before_script: sudo apt-get install dejagnu + +script: ./configure && make && make check diff --git a/Modules/_ctypes/libffi/ChangeLog b/Modules/_ctypes/libffi/ChangeLog --- a/Modules/_ctypes/libffi/ChangeLog +++ b/Modules/_ctypes/libffi/ChangeLog @@ -1,8 +1,1360 @@ +2013-03-17 Anthony Green + + * README: Update for 3.0.13. + * configure.ac: Ditto. + * configure: Rebuilt. + * doc/*: Update version. + +2013-03-17 Dave Korn + + * src/closures.c (is_emutramp_enabled + [!FFI_MMAP_EXEC_EMUTRAMP_PAX]): Move default definition outside + enclosing #if scope. + +2013-03-17 Anthony Green + + * configure.ac: Only modify toolexecdir in certain cases. + * configure: Rebuilt. + +2013-03-16 Gilles Talis + + * src/powerpc/ffi.c (ffi_prep_args_SYSV): Don't use + fparg_count,etc on __NO_FPRS__ targets. + +2013-03-16 Alan Hourihane + + * src/m68k/sysv.S (epilogue): Don't use extb instruction on + m680000 machines. + +2013-03-16 Alex Gaynor + + * src/x86/ffi.c (ffi_prep_cif_machdep): Always align stack. + +2013-03-13 Markos Chandras + + * configure.ac: Add support for Imagination Technologies Meta. + * Makefile.am: Likewise. + * README: Add Imagination Technologies Meta details. + * src/metag/ffi.c: New. + * src/metag/ffitarget.h: Likewise. + * src/metag/sysv.S: Likewise. + +2013-02-24 Andreas Schwab + + * doc/libffi.texi (Structures): Fix missing category argument of + @deftp. + +2013-02-11 Anthony Green + + * configure.ac: Update release number to 3.0.12. + * configure: Rebuilt. + * README: Update release info. + +2013-02-10 Anthony Green + + * README: Add Moxie. + * src/moxie/ffi.c: Created. + * src/moxie/eabi.S: Created. + * src/moxie/ffitarget.h: Created. + * Makefile.am (nodist_libffi_la_SOURCES): Add Moxie. + * Makefile.in: Rebuilt. + * configure.ac: Add Moxie. + * configure: Rebuilt. + * testsuite/libffi.call/huge_struct.c: Disable format string + warnings for moxie*-*-elf tests. + +2013-02-10 Anthony Green + + * Makefile.am (LTLDFLAGS): Fix reference. + * Makefile.in: Rebuilt. + +2013-02-10 Anthony Green + + * README: Update supported platforms. Update test results link. + +2013-02-09 Anthony Green + + * testsuite/libffi.call/negint.c: Remove forced -O2. + * testsuite/libffi.call/many2.c (foo): Remove GCCism. + * testsuite/libffi.call/ffitest.h: Add default PRIuPTR definition. + + * src/sparc/v8.S (ffi_closure_v8): Import ancient ulonglong + closure return type fix developed by Martin v. L?wis for cpython + fork. + +2013-02-08 Andreas Tobler + + * src/powerpc/ffi.c (ffi_prep_cif_machdep): Fix small struct + support. + * src/powerpc/sysv.S: Ditto. + +2013-02-08 Anthony Green + + * testsuite/libffi.call/cls_longdouble.c: Remove xfail for + arm*-*-*. + +2013-02-08 Anthony Green + + * src/sparc/ffi.c (ffi_prep_closure_loc): Fix cache flushing for GCC. + +2013-02-08 Matthias Klose + + * man/ffi_prep_cif.3: Clean up for debian linter. + +2013-02-08 Peter Bergner + + * src/powerpc/ffi.c (ffi_prep_args_SYSV): Account for FP args pushed + on the stack. + +2013-02-08 Anthony Green + + * Makefile.am (EXTRA_DIST): Add missing files. + * testsuite/Makefile.am (EXTRA_DIST): Ditto. + * Makefile.in: Rebuilt. + +2013-02-08 Anthony Green + + * configure.ac: Move sparc asm config checks to within functions + for compatibility with sun tools. + * configure: Rebuilt. + * src/sparc/ffi.c (ffi_prep_closure_loc): Flush cache on v9 + systems. + * src/sparc/v8.S (ffi_flush_icache): Implement a sparc v9 cache + flusher. + +2013-02-08 Nathan Rossi + + * src/microblaze/ffi.c (ffi_closure_call_SYSV): Fix handling of + small big-endian structures. + (ffi_prep_args): Ditto. + +2013-02-07 Anthony Green + + * src/sparc/v8.S (ffi_call_v8): Fix typo from last patch + (effectively hiding ffi_call_v8). + +2013-02-07 Anthony Green + + * configure.ac: Update bug reporting address. + * configure.in: Rebuild. + + * src/sparc/v8.S (ffi_flush_icache): Out-of-line cache flusher for + Sun compiler. + * src/sparc/ffi.c (ffi_call): Remove warning. + Call ffi_flush_icache for non-GCC builds. + (ffi_prep_closure_loc): Use ffi_flush_icache. + + * Makefile.am (EXTRA_DIST): Add libtool-ldflags. + * Makefile.in: Rebuilt. + * libtool-ldflags: New file. + +2013-02-07 Daniel Schepler + + * configure.ac: Correctly identify x32 systems as 64-bit. + * m4/libtool.m4: Remove libtool expr error. + * aclocal.m4, configure: Rebuilt. + +2013-02-07 Anthony Green + + * configure.ac: Fix GCC usage test. + * configure: Rebuilt. + * README: Mention LLVM/GCC x86_64 issue. + * testsuite/Makefile.in: Rebuilt. + +2013-02-07 Anthony Green + + * testsuite/libffi.call/cls_double_va.c (main): Replace // style + comments with /* */ for xlc compiler. + * testsuite/libffi.call/stret_large.c (main): Ditto. + * testsuite/libffi.call/stret_large2.c (main): Ditto. + * testsuite/libffi.call/nested_struct1.c (main): Ditto. + * testsuite/libffi.call/huge_struct.c (main): Ditto. + * testsuite/libffi.call/float_va.c (main): Ditto. + * testsuite/libffi.call/cls_struct_va1.c (main): Ditto. + * testsuite/libffi.call/cls_pointer_stack.c (main): Ditto. + * testsuite/libffi.call/cls_pointer.c (main): Ditto. + * testsuite/libffi.call/cls_longdouble_va.c (main): Ditto. + +2013-02-06 Anthony Green + + * man/ffi_prep_cif.3: Clean up for debian lintian checker. + +2013-02-06 Anthony Green + + * Makefile.am (pkgconfigdir): Add missing pkgconfig install bits. + * Makefile.in: Rebuild. + +2013-02-02 Mark H Weaver + + * src/x86/ffi64.c (ffi_call): Sign-extend integer arguments passed + via general purpose registers. + +2013-01-21 Nathan Rossi + + * README: Add MicroBlaze details. + * Makefile.am: Add MicroBlaze support. + * configure.ac: Likewise. + * src/microblaze/ffi.c: New. + * src/microblaze/ffitarget.h: Likewise. + * src/microblaze/sysv.S: Likewise. + +2013-01-21 Nathan Rossi + * testsuite/libffi.call/return_uc.c: Fixed issue. + +2013-01-21 Chris Zankel + + * README: Add Xtensa support. + * Makefile.am: Likewise. + * configure.ac: Likewise. + * Makefile.in Regenerate. + * configure: Likewise. + * src/prep_cif.c: Handle Xtensa. + * src/xtensa: New directory. + * src/xtensa/ffi.c: New file. + * src/xtensa/ffitarget.h: Ditto. + * src/xtensa/sysv.S: Ditto. + +2013-01-11 Anthony Green + + * src/powerpc/ffi_darwin.c (ffi_prep_args): Replace // style + comments with /* */ for xlc compiler. + * src/powerpc/aix.S (ffi_call_AIX): Ditto. + * testsuite/libffi.call/ffitest.h (allocate_mmap): Delete + deprecated inline function. + * testsuite/libffi.special/ffitestcxx.h: Ditto. + * README: Add update for AIX support. + +2013-01-11 Anthony Green + + * configure.ac: Robustify pc relative reloc check. + * m4/ax_cc_maxopt.m4: Don't -malign-double. This is an ABI + changing option for 32-bit x86. + * aclocal.m4, configure: Rebuilt. + * README: Update supported target list. + +2013-01-10 Anthony Green + + * README (tested): Add Compiler column to table. + +2013-01-10 Anthony Green + + * src/x86/ffi64.c (struct register_args): Make sse array and array + of unions for sunpro compiler compatibility. + +2013-01-10 Anthony Green + + * configure.ac: Test target platform size_t size. Handle both 32 + and 64-bit builds for x86_64-* and i?86-* targets (allowing for + CFLAG option to change default settings). + * configure, aclocal.m4: Rebuilt. + +2013-01-10 Anthony Green + + * testsuite/libffi.special/special.exp: Only run exception + handling tests when using GNU compiler. + + * m4/ax_compiler_vendor.m4: New file. + * configure.ac: Test for compiler vendor and don't use + AX_CFLAGS_WARN_ALL with the sun compiler. + * aclocal.m4, configure: Rebuilt. + +2013-01-10 Anthony Green + + * include/ffi_common.h: Don't use GCCisms to define types when + building with the SUNPRO compiler. + +2013-01-10 Anthony Green + + * configure.ac: Put local.exp in the right place. + * configure: Rebuilt. + + * src/x86/ffi.c: Update comment about regparm function attributes. + * src/x86/sysv.S (ffi_closure_SYSV): The SUNPRO compiler requires + that all function arguments be passed on the stack (no regparm + support). + +2013-01-08 Anthony Green + + * configure.ac: Generate local.exp. This sets CC_FOR_TARGET + when we are using the vendor compiler. + * testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): Point to + ../local.exp. + * configure, testsuite/Makefile.in: Rebuilt. + + * testsuite/libffi.call/call.exp: Run tests with different + options, depending on whether or not we are using gcc or the + vendor compiler. + * testsuite/lib/libffi.exp (libffi-init): Set using_gcc based on + whether or not we are building/testing with gcc. + +2013-01-08 Anthony Green + + * configure.ac: Switch x86 solaris target to X86 by default. + * configure: Rebuilt. + +2013-01-08 Anthony Green + + * configure.ac: Fix test for read-only eh_frame. + * configure: Rebuilt. + +2013-01-08 Anthony Green + + * src/x86/sysv.S, src/x86/unix64.S: Only emit DWARF unwind info + when building with the GNU toolchain. + * testsuite/libffi.call/ffitest.h (CHECK): Fix for Solaris vendor + compiler. + +2013-01-07 Thorsten Glaser + + * testsuite/libffi.call/cls_uchar_va.c, + testsuite/libffi.call/cls_ushort_va.c, + testsuite/libffi.call/va_1.c: Testsuite fixes. + +2013-01-07 Thorsten Glaser + + * src/m68k/ffi.c (CIF_FLAGS_SINT8, CIF_FLAGS_SINT16): Define. + (ffi_prep_cif_machdep): Fix 8-bit and 16-bit signed calls. + * src/m68k/sysv.S (ffi_call_SYSV, ffi_closure_SYSV): Ditto. + +2013-01-04 Anthony Green + + * Makefile.am (AM_CFLAGS): Don't automatically add -fexceptions + and -Wall. This is set in the configure script after testing for + GCC. + * Makefile.in: Rebuilt. + +2013-01-02 rofl0r + + * src/powerpc/ffi.c (ffi_prep_cif_machdep): Fix build error on ppc + when long double == double. + +2013-01-02 Reini Urban + + * Makefile.am (libffi_la_LDFLAGS): Add -no-undefined to LDFLAGS + (required for shared libs on cygwin/mingw). + * Makefile.in: Rebuilt. + +2012-10-31 Alan Modra + + * src/powerpc/linux64_closure.S: Add new ABI support. + * src/powerpc/linux64.S: Likewise. + +2012-10-30 Magnus Granberg + Pavel Labushev + + * configure.ac: New options pax_emutramp + * configure, fficonfig.h.in: Regenerated + * src/closures.c: New function emutramp_enabled_check() and + checks. + +2012-10-30 Frederick Cheung + + * configure.ac: Enable FFI_MAP_EXEC_WRIT for Darwin 12 (mountain + lion) and future version. + * configure: Rebuild. + +2012-10-30 James Greenhalgh + Marcus Shawcroft + + * README: Add details of aarch64 port. + * src/aarch64/ffi.c: New. + * src/aarch64/ffitarget.h: Likewise. + * src/aarch64/sysv.S: Likewise. + * Makefile.am: Support aarch64. + * configure.ac: Support aarch64. + * Makefile.in, configure: Rebuilt. + +2012-10-30 James Greenhalgh + Marcus Shawcroft + + * testsuite/lib/libffi.exp: Add support for aarch64. + * testsuite/libffi.call/cls_struct_va1.c: New. + * testsuite/libffi.call/cls_uchar_va.c: Likewise. + * testsuite/libffi.call/cls_uint_va.c: Likewise. + * testsuite/libffi.call/cls_ulong_va.c: Likewise. + * testsuite/libffi.call/cls_ushort_va.c: Likewise. + * testsuite/libffi.call/nested_struct11.c: Likewise. + * testsuite/libffi.call/uninitialized.c: Likewise. + * testsuite/libffi.call/va_1.c: Likewise. + * testsuite/libffi.call/va_struct1.c: Likewise. + * testsuite/libffi.call/va_struct2.c: Likewise. + * testsuite/libffi.call/va_struct3.c: Likewise. + +2012-10-12 Walter Lee + + * Makefile.am: Add TILE-Gx/TILEPro support. + * configure.ac: Likewise. + * Makefile.in: Regenerate. + * configure: Likewise. + * src/prep_cif.c (ffi_prep_cif_core): Handle TILE-Gx/TILEPro. + * src/tile: New directory. + * src/tile/ffi.c: New file. + * src/tile/ffitarget.h: Ditto. + * src/tile/tile.S: Ditto. + +2012-10-12 Matthias Klose + + * generate-osx-source-and-headers.py: Normalize whitespace. + +2012-09-14 David Edelsohn + + * configure: Regenerated. + +2012-08-26 Andrew Pinski + + PR libffi/53014 + * src/mips/ffi.c (ffi_prep_closure_loc): Allow n32 with soft-float and n64 with + soft-float. + +2012-08-08 Uros Bizjak + + * src/s390/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, + just return FFI_BAD_ABI when things are wrong. + +2012-07-18 H.J. Lu + + PR libffi/53982 + PR libffi/53973 + * src/x86/ffitarget.h: Check __ILP32__ instead of __LP64__ for x32. + (FFI_SIZEOF_JAVA_RAW): Defined to 4 for x32. + +2012-05-16 H.J. Lu + + * configure: Regenerated. + +2012-05-05 Nicolas Lelong + + * libffi.xcodeproj/project.pbxproj: Fixes. + * README: Update for iOS builds. + +2012-04-23 Alexandre Keunecke I. de Mendonca + + * configure.ac: Add Blackfin/sysv support + * Makefile.am: Add Blackfin/sysv support + * src/bfin/ffi.c: Add Blackfin/sysv support + * src/bfin/ffitarget.h: Add Blackfin/sysv support + +2012-04-11 Anthony Green + + * Makefile.am (EXTRA_DIST): Add new script. + * Makefile.in: Rebuilt. + +2012-04-11 Zachary Waldowski + + * generate-ios-source-and-headers.py, + libffi.xcodeproj/project.pbxproj: Support a Mac static library via + Xcode. Set iOS compatibility to 4.0. Move iOS trampoline + generation into an Xcode "run script" phase. Include both as + Xcode build scripts. Don't always regenerate config files. + +2012-04-10 Anthony Green + + * src/powerpc/ffi_darwin.c (ffi_prep_args): Add missing semicolon. + +2012-04-06 Anthony Green + + * Makefile.am (EXTRA_DIST): Add new iOS/xcode files. + * Makefile.in: Rebuilt. + +2012-04-06 Mike Lewis + + * generate-ios-source-and-headers.py: New file. + * libffi.xcodeproj/project.pbxproj: New file. + * README: Update instructions on building iOS binary. + * build-ios.sh: Delete. + +2012-04-06 Anthony Green + + * src/x86/ffi64.c (UINT128): Define differently for Intel and GNU + compilers, then use it. + +2012-04-06 H.J. Lu + + * m4/libtool.m4 (_LT_ENABLE_LOCK): Support x32. + +2012-04-06 Anthony Green + + * testsuite/Makefile.am (EXTRA_DIST): Add missing test cases. + * testsuite/Makefile.in: Rebuilt. + +2012-04-05 Zachary Waldowski + + * include/ffi.h.in: Add missing trampoline table fields. + * src/arm/sysv.S: Fix ENTRY definition, and wrap symbol references + in CNAME. + * src/x86/ffi.c: Wrap Windows specific code in ifdefs. + +2012-04-02 Peter Bergner + + * src/powerpc/ffi.c (ffi_prep_args_SYSV): Declare double_tmp. + Silence casting pointer to integer of different size warning. + Delete goto to previously deleted label. + (ffi_call): Silence possibly undefined warning. + (ffi_closure_helper_SYSV): Declare variable type. + +2012-04-02 Peter Rosin + + * src/x86/win32.S (ffi_call_win32): Sign/zero extend the return + value in the Intel version as is already done for the AT&T version. + (ffi_closure_SYSV): Likewise. + (ffi_closure_raw_SYSV): Likewise. + (ffi_closure_STDCALL): Likewise. + +2012-03-29 Peter Rosin + + * src/x86/win32.S (ffi_closure_raw_THISCALL): Unify the frame + generation, fix the ENDP label and remove the surplus third arg + from the 'lea' insn. + +2012-03-29 Peter Rosin + + * src/x86/win32.S (ffi_closure_raw_SYSV): Make the 'stubraw' label + visible outside the PROC, so that ffi_closure_raw_THISCALL can see + it. Also instruct the assembler to add a frame to the function. + +2012-03-23 Peter Rosin + + * Makefile.am (AM_CPPFLAGS): Add -DFFI_BUILDING. + * Makefile.in: Rebuilt. + * include/ffi.h.in [MSVC]: Add __declspec(dllimport) decorations + to all data exports, when compiling libffi clients using MSVC. + +2012-03-29 Peter Rosin + + * src/x86/ffitarget.h (ffi_abi): Add new ABI FFI_MS_CDECL and + make it the default for MSVC. + (FFI_TYPE_MS_STRUCT): New structure return convention. + * src/x86/ffi.c (ffi_prep_cif_machdep): Tweak the structure + return convention for FFI_MS_CDECL to be FFI_TYPE_MS_STRUCT + instead of an ordinary FFI_TYPE_STRUCT. + (ffi_prep_args): Treat FFI_TYPE_MS_STRUCT as FFI_TYPE_STRUCT. + (ffi_call): Likewise. + (ffi_prep_incoming_args_SYSV): Likewise. + (ffi_raw_call): Likewise. + (ffi_prep_closure_loc): Treat FFI_MS_CDECL as FFI_SYSV. + * src/x86/win32.S (ffi_closure_SYSV): For FFI_TYPE_MS_STRUCT, + return a pointer to the result structure in eax and don't pop + that pointer from the stack, the caller takes care of it. + (ffi_call_win32): Treat FFI_TYPE_MS_STRUCT as FFI_TYPE_STRUCT. + (ffi_closure_raw_SYSV): Likewise. + +2012-03-22 Peter Rosin + + * testsuite/libffi.call/closure_stdcall.c [MSVC]: Add inline + assembly version with Intel syntax. + * testsuite/libffi.call/closure_thiscall.c [MSVC]: Likewise. + +2012-03-23 Peter Rosin + + * testsuite/libffi.call/ffitest.h: Provide abstration of + __attribute__((fastcall)) in the form of a __FASTCALL__ + define. Define it to __fastcall for MSVC. + * testsuite/libffi.call/fastthis1_win32.c: Use the above. + * testsuite/libffi.call/fastthis2_win32.c: Likewise. + * testsuite/libffi.call/fastthis3_win32.c: Likewise. + * testsuite/libffi.call/strlen2_win32.c: Likewise. + * testsuite/libffi.call/struct1_win32.c: Likewise. + * testsuite/libffi.call/struct2_win32.c: Likewise. + +2012-03-22 Peter Rosin + + * src/x86/win32.S [MSVC] (ffi_closure_THISCALL): Remove the manual + frame on function entry, MASM adds one automatically. + +2012-03-22 Peter Rosin + + * testsuite/libffi.call/ffitest.h [MSVC]: Add kludge for missing + bits in the MSVC headers. + +2012-03-22 Peter Rosin + + * testsuite/libffi.call/cls_12byte.c: Adjust to the C89 style + with no declarations after statements. + * testsuite/libffi.call/cls_16byte.c: Likewise. + * testsuite/libffi.call/cls_18byte.c: Likewise. + * testsuite/libffi.call/cls_19byte.c: Likewise. + * testsuite/libffi.call/cls_1_1byte.c: Likewise. + * testsuite/libffi.call/cls_20byte.c: Likewise. + * testsuite/libffi.call/cls_20byte1.c: Likewise. + * testsuite/libffi.call/cls_24byte.c: Likewise. + * testsuite/libffi.call/cls_2byte.c: Likewise. + * testsuite/libffi.call/cls_3_1byte.c: Likewise. + * testsuite/libffi.call/cls_3byte1.c: Likewise. + * testsuite/libffi.call/cls_3byte2.c: Likewise. + * testsuite/libffi.call/cls_4_1byte.c: Likewise. + * testsuite/libffi.call/cls_4byte.c: Likewise. + * testsuite/libffi.call/cls_5_1_byte.c: Likewise. + * testsuite/libffi.call/cls_5byte.c: Likewise. + * testsuite/libffi.call/cls_64byte.c: Likewise. + * testsuite/libffi.call/cls_6_1_byte.c: Likewise. + * testsuite/libffi.call/cls_6byte.c: Likewise. + * testsuite/libffi.call/cls_7_1_byte.c: Likewise. + * testsuite/libffi.call/cls_7byte.c: Likewise. + * testsuite/libffi.call/cls_8byte.c: Likewise. + * testsuite/libffi.call/cls_9byte1.c: Likewise. + * testsuite/libffi.call/cls_9byte2.c: Likewise. + * testsuite/libffi.call/cls_align_double.c: Likewise. + * testsuite/libffi.call/cls_align_float.c: Likewise. + * testsuite/libffi.call/cls_align_longdouble.c: Likewise. + * testsuite/libffi.call/cls_align_longdouble_split.c: Likewise. + * testsuite/libffi.call/cls_align_longdouble_split2.c: Likewise. + * testsuite/libffi.call/cls_align_pointer.c: Likewise. + * testsuite/libffi.call/cls_align_sint16.c: Likewise. + * testsuite/libffi.call/cls_align_sint32.c: Likewise. + * testsuite/libffi.call/cls_align_sint64.c: Likewise. + * testsuite/libffi.call/cls_align_uint16.c: Likewise. + * testsuite/libffi.call/cls_align_uint32.c: Likewise. + * testsuite/libffi.call/cls_align_uint64.c: Likewise. + * testsuite/libffi.call/cls_dbls_struct.c: Likewise. + * testsuite/libffi.call/cls_pointer_stack.c: Likewise. + * testsuite/libffi.call/err_bad_typedef.c: Likewise. + * testsuite/libffi.call/huge_struct.c: Likewise. + * testsuite/libffi.call/nested_struct.c: Likewise. + * testsuite/libffi.call/nested_struct1.c: Likewise. + * testsuite/libffi.call/nested_struct10.c: Likewise. + * testsuite/libffi.call/nested_struct2.c: Likewise. + * testsuite/libffi.call/nested_struct3.c: Likewise. + * testsuite/libffi.call/nested_struct4.c: Likewise. + * testsuite/libffi.call/nested_struct5.c: Likewise. + * testsuite/libffi.call/nested_struct6.c: Likewise. + * testsuite/libffi.call/nested_struct7.c: Likewise. + * testsuite/libffi.call/nested_struct8.c: Likewise. + * testsuite/libffi.call/nested_struct9.c: Likewise. + * testsuite/libffi.call/stret_large.c: Likewise. + * testsuite/libffi.call/stret_large2.c: Likewise. + * testsuite/libffi.call/stret_medium.c: Likewise. + * testsuite/libffi.call/stret_medium2.c: Likewise. + * testsuite/libffi.call/struct1.c: Likewise. + * testsuite/libffi.call/struct1_win32.c: Likewise. + * testsuite/libffi.call/struct2.c: Likewise. + * testsuite/libffi.call/struct2_win32.c: Likewise. + * testsuite/libffi.call/struct3.c: Likewise. + * testsuite/libffi.call/struct4.c: Likewise. + * testsuite/libffi.call/struct5.c: Likewise. + * testsuite/libffi.call/struct6.c: Likewise. + * testsuite/libffi.call/struct7.c: Likewise. + * testsuite/libffi.call/struct8.c: Likewise. + * testsuite/libffi.call/struct9.c: Likewise. + * testsuite/libffi.call/testclosure.c: Likewise. + +2012-03-21 Peter Rosin + + * testsuite/libffi.call/float_va.c (float_va_fn): Use %f when + printing doubles (%lf is for long doubles). + (main): Likewise. + +2012-03-21 Peter Rosin + + * testsuite/lib/target-libpath.exp [*-*-cygwin*, *-*-mingw*] + (set_ld_library_path_env_vars): Add the library search dir to PATH + (and save PATH for later). + (restore_ld_library_path_env_vars): Restore PATH. + +2012-03-21 Peter Rosin + + * testsuite/lib/target-libpath.exp [*-*-cygwin*, *-*-mingw*] + (set_ld_library_path_env_vars): Add the library search dir to PATH + (and save PATH for later). + (restore_ld_library_path_env_vars): Restore PATH. + +2012-03-20 Peter Rosin + + * testsuite/libffi.call/strlen2_win32.c (main): Remove bug. + * src/x86/win32.S [MSVC] (ffi_closure_SYSV): Make the 'stub' label + visible outside the PROC, so that ffi_closure_THISCALL can see it. + +2012-03-20 Peter Rosin + + * testsuite/libffi.call/strlen2_win32.c (main): Remove bug. + * src/x86/win32.S [MSVC] (ffi_closure_SYSV): Make the 'stub' label + visible outside the PROC, so that ffi_closure_THISCALL can see it. + +2012-03-19 Alan Hourihane + + * src/m68k/ffi.c: Add MINT support. + * src/m68k/sysv.S: Ditto. + +2012-03-06 Chung-Lin Tang + + * src/arm/ffi.c (ffi_call): Add __ARM_EABI__ guard around call to + ffi_call_VFP(). + (ffi_prep_closure_loc): Add __ARM_EABI__ guard around use of + ffi_closure_VFP. + * src/arm/sysv.S: Add __ARM_EABI__ guard around VFP code. + +2012-03-19 chennam + + * src/powerpc/ffi_darwin.c (ffi_prep_closure_loc): Fix AIX closure + support. + +2012-03-13 Kaz Kojima + + * src/sh/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, + just return FFI_BAD_ABI when things are wrong. + * src/sh64/ffi.c (ffi_prep_closure_loc): Ditto. + +2012-03-09 David Edelsohn + + * src/powerpc/aix_closure.S (ffi_closure_ASM): Adjust for Darwin64 + change to return value of ffi_closure_helper_DARWIN and load type + from return type. + +2012-03-03 H.J. Lu + + * src/x86/ffi64.c (ffi_call): Cast the return value to unsigned + long. + (ffi_prep_closure_loc): Cast to 64bit address in trampoline. + (ffi_closure_unix64_inner): Cast return pointer to unsigned long + first. + + * src/x86/ffitarget.h (FFI_SIZEOF_ARG): Defined to 8 for x32. + (ffi_arg): Set to unsigned long long for x32. + (ffi_sarg): Set to long long for x32. + +2012-03-03 H.J. Lu + + * src/prep_cif.c (ffi_prep_cif_core): Properly check bad ABI. + +2012-03-03 Andoni Morales Alastruey + + * configure.ac: Add -no-undefined for both 32- and 64-bit x86 + windows-like hosts. + * configure: Rebuilt. + +2012-02-27 Mikael Pettersson + + PR libffi/52223 + * Makefile.am (FLAGS_TO_PASS): Define. + * Makefile.in: Regenerate. + +2012-02-23 Anthony Green + + * src/*/ffitarget.h: Ensure that users never include ffitarget.h + directly. + +2012-02-23 Kai Tietz + + PR libffi/52221 + * src/x86/ffi.c (ffi_closure_raw_THISCALL): New + prototype. + (ffi_prep_raw_closure_loc): Use ffi_closure_raw_THISCALL for + thiscall-convention. + (ffi_raw_call): Use ffi_prep_args_raw. + * src/x86/win32.S (ffi_closure_raw_THISCALL): Add + implementation for stub. + +2012-02-10 Kai Tietz + + * configure.ac (AM_LTLDFLAGS): Add -no-undefine for x64 + windows target. + * configure: Regenerated. + +2012-02-08 Kai Tietz + + * src/prep_cif.c (ffi_prep_cif): Allow for X86_WIN32 + also FFI_THISCALL. + * src/x86/ffi.c (ffi_closure_THISCALL): Add prototype. + (FFI_INIT_TRAMPOLINE_THISCALL): New trampoline code. + (ffi_prep_closure_loc): Add FFI_THISCALL support. + * src/x86/ffitarget.h (FFI_TRAMPOLINE_SIZE): Adjust size. + * src/x86/win32.S (ffi_closure_THISCALL): New closure code + for thiscall-calling convention. + * testsuite/libffi.call/closure_thiscall.c: New test. + +2012-01-28 Kai Tietz + + * src/libffi/src/x86/ffi.c (ffi_call_win32): Add new + argument to prototype for specify calling-convention. + (ffi_call): Add support for stdcall/thiscall convention. + (ffi_prep_args): Likewise. + (ffi_raw_call): Likewise. + * src/x86/ffitarget.h (ffi_abi): Add FFI_THISCALL and + FFI_FASTCALL. + * src/x86/win32.S (_ffi_call_win32): Add support for + fastcall/thiscall calling-convention calls. + * testsuite/libffi.call/fastthis1_win32.c: New test. + * testsuite/libffi.call/fastthis2_win32.c: New test. + * testsuite/libffi.call/fastthis3_win32.c: New test. + * testsuite/libffi.call/strlen2_win32.c: New test. + * testsuite/libffi.call/many2_win32.c: New test. + * testsuite/libffi.call/struct1_win32.c: New test. + * testsuite/libffi.call/struct2_win32.c: New test. + +2012-01-23 Uros Bizjak + + * src/alpha/ffi.c (ffi_prep_closure_loc): Check for bad ABI. + +2012-01-23 Anthony Green + Chris Young + + * configure.ac: Add Amiga support. + * configure: Rebuilt. + +2012-01-23 Dmitry Nadezhin + + * include/ffi_common.h (LIKELY, UNLIKELY): Fix definitions. + +2012-01-23 Andreas Schwab + + * src/m68k/sysv.S (ffi_call_SYSV): Properly test for plain + mc68000. Test for __HAVE_68881__ in addition to __MC68881__. + +2012-01-19 Jakub Jelinek + + PR rtl-optimization/48496 + * src/ia64/ffi.c (ffi_call): Fix up aliasing violations. + +2012-01-09 Rainer Orth + + * configure.ac (i?86-*-*): Set TARGET to X86_64. + * configure: Regenerate. + +2011-12-07 Andrew Pinski + + PR libffi/50051 + * src/mips/n32.S: Add ".set mips4". + +2011-11-21 Andreas Tobler + + * configure: Regenerate. + +2011-11-12 David Gilbert + + * doc/libffi.texi, include/ffi.h.in, include/ffi_common.h, + man/Makefile.am, man/ffi.3, man/ffi_prep_cif.3, + man/ffi_prep_cif_var.3, src/arm/ffi.c, src/arm/ffitarget.h, + src/cris/ffi.c, src/prep_cif.c, + testsuite/libffi.call/cls_double_va.c, + testsuite/libffi.call/cls_longdouble_va.c, + testsuite/libffi.call/float_va.c: Many changes to support variadic + function calls. + +2011-11-12 Kyle Moffett + + * src/powerpc/ffi.c, src/powerpc/ffitarget.h, + src/powerpc/ppc_closure.S, src/powerpc/sysv.S: Many changes for + softfloat powerpc variants. + +2011-11-12 Petr Salinger + + * configure.ac (FFI_EXEC_TRAMPOLINE_TABLE): Fix kfreebsd support. + * configure: Rebuilt. + +2011-11-12 Timothy Wall + + * src/arm/ffi.c (ffi_prep_args, ffi_prep_incoming_args_SYSV): Max + alignment of 4 for wince on ARM. + +2011-11-12 Kyle Moffett + Anthony Green + + * src/ppc/sysv.S, src/ppc/ffi.c: Remove use of ppc string + instructions (not available on some cores, like the PPC440). + +2011-11-12 Kimura Wataru + + * m4/ax_enable_builddir: Change from string comparison to numeric + comparison for wc output. + * configure.ac: Enable FFI_MMAP_EXEC_WRIT for darwin11 aka Mac OS + X 10.7. + * configure: Rebuilt. + +2011-11-12 Anthony Green + + * Makefile.am (AM_CCASFLAGS): Add -g option to build assembly + files with debug info. + * Makefile.in: Rebuilt. + +2011-11-12 Jasper Lievisse Adriaanse + + * README: Update list of supported OpenBSD systems. + +2011-11-12 Anthony Green + + * libtool-version: Update. + * Makefile.am (nodist_libffi_la_SOURCES): Add src/debug.c if + FFI_DEBUG. + (libffi_la_SOURCES): Remove src/debug.c + (EXTRA_DIST): Add src/debug.c + * Makefile.in: Rebuilt. + * README: Update for 3.0.11. + +2011-11-10 Richard Henderson + + * configure.ac (GCC_AS_CFI_PSEUDO_OP): Use it instead of inline check. + * configure, aclocal.m4: Rebuild. + +2011-09-04 Iain Sandoe + + PR libffi/49594 + * src/powerpc/darwin_closure.S (stubs): Make the stub binding + helper reference track the architecture pointer size. + +2011-08-25 Andrew Haley + + * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Remove hard-coded assembly + instructions. + * src/arm/sysv.S (ffi_arm_trampoline): Put them here instead. + +2011-07-11 Andrew Haley + + * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Clear icache. + +2011-06-29 Rainer Orth + + * testsuite/libffi.call/cls_double_va.c: Move PR number to comment. + * testsuite/libffi.call/cls_longdouble_va.c: Likewise. + +2011-06-29 Rainer Orth + + PR libffi/46660 + * testsuite/libffi.call/cls_double_va.c: xfail dg-output on + mips-sgi-irix6*. + * testsuite/libffi.call/cls_longdouble_va.c: Likewise. + +2011-06-14 Rainer Orth + + * testsuite/libffi.call/huge_struct.c (test_large_fn): Use PRIu8, + PRId8 instead of %hhu, %hhd. + * testsuite/libffi.call/ffitest.h [__alpha__ && __osf__] (PRId8, + PRIu8): Define. + [__sgi__] (PRId8, PRIu8): Define. + +2011-04-29 Rainer Orth + + * src/alpha/osf.S (UA_SI, FDE_ENCODING, FDE_ENCODE, FDE_ARANGE): + Define. + Use them to handle ELF vs. ECOFF differences. + [__osf__] (_GLOBAL__F_ffi_call_osf): Define. + +2011-03-30 Timothy Wall + + * src/powerpc/darwin.S: Fix unknown FDE encoding. + * src/powerpc/darwin_closure.S: ditto. + +2011-02-25 Anthony Green + + * src/powerpc/ffi.c (ffi_prep_closure_loc): Allow for more + 32-bit ABIs. + +2011-02-15 Anthony Green + + * m4/ax_cc_maxopt.m4: Don't -malign-double or use -ffast-math. + * configure: Rebuilt. + +2011-02-13 Ralf Wildenhues + + * configure: Regenerate. + +2011-02-13 Anthony Green + + * include/ffi_common.h (UNLIKELY, LIKELY): Define. + * src/x86/ffi64.c (UNLIKELY, LIKELY): Remove definition. + * src/prep_cif.c (UNLIKELY, LIKELY): Remove definition. + + * src/prep_cif.c (initialize_aggregate): Convert assertion into + FFI_BAD_TYPEDEF return. Initialize arg size and alignment to 0. + + * src/pa/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, + just return FFI_BAD_ABI when things are wrong. + * src/arm/ffi.c (ffi_prep_closure_loc): Ditto. + * src/powerpc/ffi.c (ffi_prep_closure_loc): Ditto. + * src/mips/ffi.c (ffi_prep_closure_loc): Ditto. + * src/ia64/ffi.c (ffi_prep_closure_loc): Ditto. + * src/avr32/ffi.c (ffi_prep_closure_loc): Ditto. + +2011-02-11 Anthony Green + + * src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, + just return FFI_BAD_ABI when things are wrong. + +2012-02-11 Eric Botcazou + + * src/sparc/v9.S (STACKFRAME): Bump to 176. + +2011-02-09 Stuart Shelton + + http://bugs.gentoo.org/show_bug.cgi?id=286911 + * src/mips/ffitarget.h: Clean up error messages. + * src/java_raw_api.c (ffi_java_translate_args): Cast raw arg to + ffi_raw*. + * include/ffi.h.in: Add pragma for SGI compiler. + +2011-02-09 Anthony Green + + * configure.ac: Add powerpc64-*-darwin* support. + +2011-02-09 Anthony Green + + * README: Mention Interix. + +2011-02-09 Jonathan Callen + + * configure.ac: Add Interix to win32/cygwin/mingw case. + * configure: Ditto. + * src/closures.c: Treat Interix like Cygwin, instead of as a + generic win32. + +2011-02-09 Anthony Green + + * testsuite/libffi.call/err_bad_typedef.c: Remove xfail. + * testsuite/libffi.call/err_bad_abi.c: Remove xfail. + * src/x86/ffi64.c (UNLIKELY, LIKELY): Define. + (ffi_prep_closure_loc): Check for bad ABI. + * src/prep_cif.c (UNLIKELY, LIKELY): Define. + (initialize_aggregate): Check for bad types. + +2011-02-09 Landon Fuller + + * Makefile.am (EXTRA_DIST): Add build-ios.sh, src/arm/gentramp.sh, + src/arm/trampoline.S. + (nodist_libffi_la_SOURCES): Add src/arc/trampoline.S. + * configure.ac (FFI_EXEC_TRAMPOLINE_TABLE): Define. + * src/arm/ffi.c (ffi_trampoline_table) + (ffi_closure_trampoline_table_page, ffi_trampoline_table_entry) + (FFI_TRAMPOLINE_CODELOC_CONFIG, FFI_TRAMPOLINE_CONFIG_PAGE_OFFSET) + (FFI_TRAMPOLINE_COUNT, ffi_trampoline_lock, ffi_trampoline_tables) + (ffi_trampoline_table_alloc, ffi_closure_alloc, ffi_closure_free): + Define for FFI_EXEC_TRAMPOLINE_TABLE case (iOS). + (ffi_prep_closure_loc): Handl FFI_EXEC_TRAMPOLINE_TABLE case + separately. + * src/arm/sysv.S: Handle Apple iOS host. + * src/closures.c: Handle FFI_EXEC_TRAMPOLINE_TABLE case. + * build-ios.sh: New file. + * fficonfig.h.in, configure, Makefile.in: Rebuilt. + * README: Mention ARM iOS. + +2011-02-08 Oren Held + + * src/dlmalloc.c (_STRUCT_MALLINFO): Define in order to avoid + redefinition of mallinfo on HP-UX. + +2011-02-08 Ginn Chen + + * src/sparc/ffi.c (ffi_call): Make compatible with Solaris Studio + aggregate return ABI. Flush cache. + (ffi_prep_closure_loc): Flush cache. + +2011-02-11 Anthony Green + + From Tom Honermann : + * src/powerpc/aix.S (ffi_call_AIX): Support for xlc toolchain on + AIX. Declare .ffi_prep_args. Insert nops after branch + instructions so that the AIX linker can insert TOC reload + instructions. + * src/powerpc/aix_closure.S: Declare .ffi_closure_helper_DARWIN. + +2011-02-08 Ed + + * src/powerpc/asm.h: Fix grammar nit in comment. + +2011-02-08 Uli Link + + * include/ffi.h.in (FFI_64_BIT_MAX): Define and use. + +2011-02-09 Rainer Orth + + PR libffi/46661 + * testsuite/libffi.call/cls_pointer.c (main): Cast void * to + uintptr_t first. + * testsuite/libffi.call/cls_pointer_stack.c (main): Likewise. + +2011-02-08 Rafael Avila de Espindola + + * configure.ac: Fix x86 test for pc related relocs. + * configure: Rebuilt. + +2011-02-07 Joel Sherrill + + * libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing. + Handle case when CPU variant does not have long double support. + * libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire, + and cores with soft floating point. + +2011-02-07 Joel Sherrill + + * configure.ac: Add mips*-*-rtems* support. + * configure: Regenerate. + * src/mips/ffitarget.h: Ensure needed constants are available + for targets which do not have sgidefs.h. + +2011-01-26 Dave Korn + + PR target/40125 + * configure.ac (AM_LTLDFLAGS): Add -bindir option for windows DLLs. + * configure: Regenerate. + +2010-12-18 Iain Sandoe + + PR libffi/29152 + PR libffi/42378 + * src/powerpc/darwin_closure.S: Provide Darwin64 implementation, + update comments. + * src/powerpc/ffitarget.h (POWERPC_DARWIN64): New, + (FFI_TRAMPOLINE_SIZE): Update for Darwin64. + * src/powerpc/darwin.S: Provide Darwin64 implementation, + update comments. + * src/powerpc/ffi_darwin.c: Likewise. + +2010-12-06 Rainer Orth + + * configure.ac (libffi_cv_as_ascii_pseudo_op): Use double + backslashes. + (libffi_cv_as_string_pseudo_op): Likewise. + * configure: Regenerate. + +2010-12-03 Chung-Lin Tang + + * src/arm/sysv.S (ffi_closure_SYSV): Add UNWIND to .pad directive. + (ffi_closure_VFP): Same. + (ffi_call_VFP): Move down to before ffi_closure_VFP. Add '.fpu vfp' + directive. + +2010-12-01 Rainer Orth + + * testsuite/libffi.call/ffitest.h [__sgi] (PRId64, PRIu64): Define. + (PRIuPTR): Define. + +2010-11-29 Richard Henderson + Rainer Orth + + * src/x86/sysv.S (FDE_ENCODING, FDE_ENCODE): Define. + (.eh_frame): Use FDE_ENCODING. + (.LASFDE1, .LASFDE2, LASFDE3): Simplify with FDE_ENCODE. + +2010-11-22 Jacek Caban + + * configure.ac: Check for symbol underscores on mingw-w64. + * configure: Rebuilt. + * src/x86/win64.S: Correctly access extern symbols in respect to + underscores. + +2010-11-15 Rainer Orth + + * testsuite/lib/libffi-dg.exp: Rename ... + * testsuite/lib/libffi.exp: ... to this. + * libffi/testsuite/libffi.call/call.exp: Don't load libffi-dg.exp. + * libffi/testsuite/libffi.special/special.exp: Likewise. + +2010-10-28 Chung-Lin Tang + + * src/arm/ffi.c (ffi_prep_args): Add VFP register argument handling + code, new parameter, and return value. Update comments. + (ffi_prep_cif_machdep): Add case for VFP struct return values. Add + call to layout_vfp_args(). + (ffi_call_SYSV): Update declaration. + (ffi_call_VFP): New declaration. + (ffi_call): Add VFP struct return conditions. Call ffi_call_VFP() + when ABI is FFI_VFP. + (ffi_closure_VFP): New declaration. + (ffi_closure_SYSV_inner): Add new vfp_args parameter, update call to + ffi_prep_incoming_args_SYSV(). + (ffi_prep_incoming_args_SYSV): Update parameters. Add VFP argument + case handling. + (ffi_prep_closure_loc): Pass ffi_closure_VFP to trampoline + construction under VFP hard-float. + (rec_vfp_type_p): New function. + (vfp_type_p): Same. + (place_vfp_arg): Same. + (layout_vfp_args): Same. + * src/arm/ffitarget.h (ffi_abi): Add FFI_VFP. Define FFI_DEFAULT_ABI + based on __ARM_PCS_VFP. + (FFI_EXTRA_CIF_FIELDS): Define for adding VFP hard-float specific + fields. + (FFI_TYPE_STRUCT_VFP_FLOAT): Define internally used type code. + (FFI_TYPE_STRUCT_VFP_DOUBLE): Same. + * src/arm/sysv.S (ffi_call_SYSV): Change call of ffi_prep_args() to + direct call. Move function pointer load upwards. + (ffi_call_VFP): New function. + (ffi_closure_VFP): Same. + + * testsuite/lib/libffi-dg.exp (check-flags): New function. + (dg-skip-if): New function. + * testsuite/libffi.call/cls_double_va.c: Skip if target is arm*-*-* + and compiler options include -mfloat-abi=hard. + * testsuite/libffi.call/cls_longdouble_va.c: Same. + +2010-10-01 Jakub Jelinek + + PR libffi/45677 + * src/x86/ffi64.c (ffi_prep_cif_machdep): Ensure cif->bytes is + a multiple of 8. + * testsuite/libffi.call/many2.c: New test. + +2010-08-20 Mark Wielaard + + * src/closures.c (open_temp_exec_file_mnt): Check if getmntent_r + returns NULL. + +2010-08-09 Andreas Tobler + + * configure.ac: Add target powerpc64-*-freebsd*. + * configure: Regenerate. + * testsuite/libffi.call/cls_align_longdouble_split.c: Pass + -mlong-double-128 only to linux targets. + * testsuite/libffi.call/cls_align_longdouble_split2.c: Likewise. + * testsuite/libffi.call/cls_longdouble.c: Likewise. + * testsuite/libffi.call/huge_struct.c: Likewise. + +2010-08-05 Dan Witte + + * Makefile.am: Pass FFI_DEBUG define to msvcc.sh for linking to the + debug CRT when --enable-debug is given. + * configure.ac: Define it. + * msvcc.sh: Translate -g and -DFFI_DEBUG appropriately. + +2010-08-04 Dan Witte + + * src/x86/ffitarget.h: Add X86_ANY define for all x86/x86_64 + platforms. + * src/x86/ffi.c: Remove redundant ifdef checks. + * src/prep_cif.c: Push stack space computation into src/x86/ffi.c + for X86_ANY so return value space doesn't get added twice. + +2010-08-03 Neil Rashbrooke + + * msvcc.sh: Don't pass -safeseh to ml64 because behavior is buggy. + +2010-07-22 Dan Witte + + * src/*/ffitarget.h: Make FFI_LAST_ABI one past the last valid ABI. + * src/prep_cif.c: Fix ABI assertion. + * src/cris/ffi.c: Ditto. + +2010-07-10 Evan Phoenix + + * src/closures.c (selinux_enabled_check): Fix strncmp usage bug. + +2010-07-07 Dan Hor?k + + * include/ffi.h.in: Protect #define with #ifndef. + * src/powerpc/ffitarget.h: Ditto. + * src/s390/ffitarget.h: Ditto. + * src/sparc/ffitarget.h: Ditto. + +2010-07-07 Neil Roberts + + * src/x86/sysv.S (ffi_call_SYSV): Align the stack pointer to + 16-bytes. + +2010-07-02 Jakub Jelinek + + * Makefile.am (AM_MAKEFLAGS): Pass also mandir to submakes. + * Makefile.in: Regenerated. + +2010-05-19 Rainer Orth + + * configure.ac (libffi_cv_as_x86_pcrel): Check for illegal in as + output, too. + (libffi_cv_as_ascii_pseudo_op): Check for .ascii. + (libffi_cv_as_string_pseudo_op): Check for .string. + * configure: Regenerate. + * fficonfig.h.in: Regenerate. + * src/x86/sysv.S (.eh_frame): Use .ascii, .string or error. + +2010-05-11 Dan Witte + + * doc/libffi.tex: Document previous change. + +2010-05-11 Makoto Kato + + * src/x86/ffi.c (ffi_call): Don't copy structs passed by value. + +2010-05-05 Michael Kohler + + * src/dlmalloc.c (dlfree): Fix spelling. + * src/ia64/ffi.c (ffi_prep_cif_machdep): Ditto. + * configure.ac: Ditto. + * configure: Rebuilt. + +2010-04-13 Dan Witte + + * msvcc.sh: Build with -W3 instead of -Wall. + * src/powerpc/ffi_darwin.c: Remove build warnings. + * src/x86/ffi.c: Ditto. + * src/x86/ffitarget.h: Ditto. + +2010-04-12 Dan Witte + Walter Meinl + + * configure.ac: Add OS/2 support. + * configure: Rebuilt. + * src/closures.c: Ditto. + * src/dlmalloc.c: Ditto. + * src/x86/win32.S: Ditto. + +2010-04-07 Jakub Jelinek + + * testsuite/libffi.call/err_bad_abi.c: Remove unused args variable. + +2010-04-02 Ralf Wildenhues + + * Makefile.in: Regenerate. + * aclocal.m4: Regenerate. + * include/Makefile.in: Regenerate. + * man/Makefile.in: Regenerate. + * testsuite/Makefile.in: Regenerate. + +2010-03-30 Dan Witte + + * msvcc.sh: Disable build warnings. + * README (tested): Clarify windows build procedure. + +2010-03-15 Rainer Orth + + * configure.ac (libffi_cv_as_x86_64_unwind_section_type): New test. + * configure: Regenerate. + * fficonfig.h.in: Regenerate. + * libffi/src/x86/unix64.S (.eh_frame) + [HAVE_AS_X86_64_UNWIND_SECTION_TYPE]: Use @unwind section type. + 2010-03-14 Matthias Klose * src/x86/ffi64.c: Fix typo in comment. * src/x86/ffi.c: Use /* ... */ comment style. +2010-02-24 Rainer Orth + + * doc/libffi.texi (The Closure API): Fix typo. + * doc/libffi.info: Remove. + +2010-02-15 Matthias Klose + + * src/arm/sysv.S (__ARM_ARCH__): Define for processor + __ARM_ARCH_7EM__. + +2010-01-15 Anthony Green + + * README: Add notes on building with Microsoft Visual C++. + +2010-01-15 Daniel Witte + + * msvcc.sh: New file. + + * src/x86/win32.S: Port assembly routines to MSVC and #ifdef. + * src/x86/ffi.c: Tweak function declaration and remove excess + parens. + * include/ffi.h.in: Add __declspec(align(8)) to typedef struct + ffi_closure. + + * src/x86/ffi.c: Merge ffi_call_SYSV and ffi_call_STDCALL into new + function ffi_call_win32 on X86_WIN32. + * src/x86/win32.S (ffi_call_SYSV): Rename to ffi_call_win32. + (ffi_call_STDCALL): Remove. + + * src/prep_cif.c (ffi_prep_cif): Move stack space allocation code + to ffi_prep_cif_machdep for x86. + * src/x86/ffi.c (ffi_prep_cif_machdep): To here. + +2010-01-15 Oliver Kiddle + + * src/x86/ffitarget.h (ffi_abi): Check for __i386 and __amd64 for + Sun Studio compiler compatibility. + +2010-01-12 Conrad Irwin + + * doc/libffi.texi: Add closure example. + 2010-01-07 Rainer Orth PR libffi/40701 @@ -148,6 +1500,13 @@ * src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE type on HP-UX. +2012-02-13 Kai Tietz + + PR libffi/52221 + * src/x86/ffi.c (ffi_prep_raw_closure_loc): Add thiscall + support for X86_WIN32. + (FFI_INIT_TRAMPOLINE_THISCALL): Fix displacement. + 2009-12-11 Eric Botcazou * src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long @@ -322,6 +1681,11 @@ * man/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. +2011-08-22 Jasper Lievisse Adriaanse + + * configure.ac: Add OpenBSD/hppa and OpenBSD/powerpc support. + * configure: Rebuilt. + 2009-07-30 Ralf Wildenhues * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force. diff --git a/Modules/_ctypes/libffi/ChangeLog.libffi b/Modules/_ctypes/libffi/ChangeLog.libffi --- a/Modules/_ctypes/libffi/ChangeLog.libffi +++ b/Modules/_ctypes/libffi/ChangeLog.libffi @@ -1,35 +1,6 @@ -2010-01-15 Anthony Green +2011-02-08 Andreas Tobler - * README: Add notes on building with Microsoft Visual C++. - -2010-01-15 Daniel Witte - - * msvcc.sh: New file. - - * src/x86/win32.S: Port assembly routines to MSVC and #ifdef. - * src/x86/ffi.c: Tweak function declaration and remove excess - parens. - * include/ffi.h.in: Add __declspec(align(8)) to typedef struct - ffi_closure. - - * src/x86/ffi.c: Merge ffi_call_SYSV and ffi_call_STDCALL into new - function ffi_call_win32 on X86_WIN32. - * src/x86/win32.S (ffi_call_SYSV): Rename to ffi_call_win32. - (ffi_call_STDCALL): Remove. - - * src/prep_cif.c (ffi_prep_cif): Move stack space allocation code - to ffi_prep_cif_machdep for x86. - * src/x86/ffi.c (ffi_prep_cif_machdep): To here. - -2010-01-15 Oliver Kiddle - - * src/x86/ffitarget.h (ffi_abi): Check for __i386 and __amd64 for - Sun Studio compiler compatibility. - -2010-01-12 Conrad Irwin - - * doc/libffi.texi: Add closure example. - * doc/libffi.info: Rebuilt. + * testsuite/lib/libffi.exp: Tweak for stand-alone mode. 2009-12-25 Samuli Suominen @@ -603,8 +574,8 @@ * Makefile.am, include/Makefile.am: Move headers to libffi_la_SOURCES for new automake. * Makefile.in, include/Makefile.in: Rebuilt. - - * testsuite/lib/wrapper.exp: Copied from gcc tree to allow for + + * testsuite/lib/wrapper.exp: Copied from gcc tree to allow for execution outside of gcc tree. * testsuite/lib/target-libpath.exp: Ditto. diff --git a/Modules/_ctypes/libffi/LICENSE b/Modules/_ctypes/libffi/LICENSE --- a/Modules/_ctypes/libffi/LICENSE +++ b/Modules/_ctypes/libffi/LICENSE @@ -1,4 +1,4 @@ -libffi - Copyright (c) 1996-2009 Anthony Green, Red Hat, Inc and others. +libffi - Copyright (c) 1996-2012 Anthony Green, Red Hat, Inc and others. See source files for details. Permission is hereby granted, free of charge, to any person obtaining @@ -9,8 +9,8 @@ permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF diff --git a/Modules/_ctypes/libffi/Makefile.am b/Modules/_ctypes/libffi/Makefile.am --- a/Modules/_ctypes/libffi/Makefile.am +++ b/Modules/_ctypes/libffi/Makefile.am @@ -2,37 +2,50 @@ AUTOMAKE_OPTIONS = foreign subdir-objects +ACLOCAL_AMFLAGS = -I m4 + SUBDIRS = include testsuite man -EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ - src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \ - src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \ - src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \ - src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \ - src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \ - src/ia64/unix.S \ - src/mips/ffi.c src/mips/n32.S src/mips/o32.S \ - src/mips/ffitarget.h \ - src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ - src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ - src/powerpc/ffi.c src/powerpc/sysv.S \ - src/powerpc/linux64.S src/powerpc/linux64_closure.S \ - src/powerpc/ppc_closure.S src/powerpc/asm.h \ - src/powerpc/aix.S src/powerpc/darwin.S \ - src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ - src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ - src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ - src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h \ - src/sh64/ffi.c src/sh64/sysv.S src/sh64/ffitarget.h \ - src/sparc/v8.S src/sparc/v9.S src/sparc/ffitarget.h \ - src/sparc/ffi.c src/x86/darwin64.S \ - src/x86/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/win64.S \ - src/x86/darwin.S src/x86/freebsd.S \ - src/x86/ffi64.c src/x86/unix64.S src/x86/ffitarget.h \ - src/pa/ffitarget.h src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \ - src/frv/ffi.c src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c \ - libtool-version ChangeLog.libffi m4/libtool.m4 \ - m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 +EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ + src/aarch64/ffi.c src/aarch64/ffitarget.h src/aarch64/sysv.S \ + build-ios.sh src/alpha/ffi.c src/alpha/osf.S \ + src/alpha/ffitarget.h src/arm/ffi.c src/arm/sysv.S \ + src/arm/ffitarget.h src/avr32/ffi.c src/avr32/sysv.S \ + src/avr32/ffitarget.h src/cris/ffi.c src/cris/sysv.S \ + src/cris/ffitarget.h src/ia64/ffi.c src/ia64/ffitarget.h \ + src/ia64/ia64_flags.h src/ia64/unix.S src/mips/ffi.c \ + src/mips/n32.S src/mips/o32.S src/metag/ffi.c \ + src/metag/ffitarget.h src/metag/sysv.S src/moxie/ffi.c \ + src/moxie/ffitarget.h src/moxie/eabi.S src/mips/ffitarget.h \ + src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ + src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ + src/microblaze/ffi.c src/microblaze/sysv.S \ + src/microblaze/ffitarget.h src/powerpc/ffi.c \ + src/powerpc/sysv.S src/powerpc/linux64.S \ + src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \ + src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S \ + src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ + src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ + src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ + src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c \ + src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S \ + src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c \ + src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S \ + src/x86/win32.S src/x86/darwin.S src/x86/win64.S \ + src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S \ + src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c \ + src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c \ + src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S \ + src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c \ + src/tile/ffitarget.h src/tile/tile.S libtool-version \ + src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S \ + ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4 \ + m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \ + m4/ltversion.m4 src/arm/gentramp.sh src/debug.c msvcc.sh \ + generate-ios-source-and-headers.py \ + generate-osx-source-and-headers.py \ + libffi.xcodeproj/project.pbxproj src/arm/trampoline.S \ + libtool-ldflags info_TEXINFOS = doc/libffi.texi @@ -69,6 +82,7 @@ "exec_prefix=$(exec_prefix)" \ "infodir=$(infodir)" \ "libdir=$(libdir)" \ + "mandir=$(mandir)" \ "prefix=$(prefix)" \ "AR=$(AR)" \ "AS=$(AS)" \ @@ -79,14 +93,15 @@ "RANLIB=$(RANLIB)" \ "DESTDIR=$(DESTDIR)" +# Subdir rules rely on $(FLAGS_TO_PASS) +FLAGS_TO_PASS = $(AM_MAKEFLAGS) + MAKEOVERRIDES= -ACLOCAL_AMFLAGS=$(ACLOCAL_AMFLAGS) -I m4 - -lib_LTLIBRARIES = libffi.la +toolexeclib_LTLIBRARIES = libffi.la noinst_LTLIBRARIES = libffi_convenience.la -libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c \ +libffi_la_SOURCES = src/prep_cif.c src/types.c \ src/raw_api.c src/java_raw_api.c src/closures.c pkgconfigdir = $(libdir)/pkgconfig @@ -94,9 +109,16 @@ nodist_libffi_la_SOURCES = +if FFI_DEBUG +nodist_libffi_la_SOURCES += src/debug.c +endif + if MIPS nodist_libffi_la_SOURCES += src/mips/ffi.c src/mips/o32.S src/mips/n32.S endif +if BFIN +nodist_libffi_la_SOURCES += src/bfin/ffi.c src/bfin/sysv.S +endif if X86 nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/sysv.S endif @@ -127,6 +149,12 @@ if M68K nodist_libffi_la_SOURCES += src/m68k/ffi.c src/m68k/sysv.S endif +if MOXIE +nodist_libffi_la_SOURCES += src/moxie/ffi.c src/moxie/eabi.S +endif +if MICROBLAZE +nodist_libffi_la_SOURCES += src/microblaze/ffi.c src/microblaze/sysv.S +endif if POWERPC nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S endif @@ -139,8 +167,14 @@ if POWERPC_FREEBSD nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S endif +if AARCH64 +nodist_libffi_la_SOURCES += src/aarch64/sysv.S src/aarch64/ffi.c +endif if ARM nodist_libffi_la_SOURCES += src/arm/sysv.S src/arm/ffi.c +if FFI_EXEC_TRAMPOLINE_TABLE +nodist_libffi_la_SOURCES += src/arm/trampoline.S +endif endif if AVR32 nodist_libffi_la_SOURCES += src/avr32/sysv.S src/avr32/ffi.c @@ -169,18 +203,23 @@ if PA_HPUX nodist_libffi_la_SOURCES += src/pa/hpux32.S src/pa/ffi.c endif +if TILE +nodist_libffi_la_SOURCES += src/tile/tile.S src/tile/ffi.c +endif +if XTENSA +nodist_libffi_la_SOURCES += src/xtensa/sysv.S src/xtensa/ffi.c +endif +if METAG +nodist_libffi_la_SOURCES += src/metag/sysv.S src/metag/ffi.c +endif libffi_convenience_la_SOURCES = $(libffi_la_SOURCES) nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) -AM_CFLAGS = -Wall -g -fexceptions +LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/libtool-ldflags $(LDFLAGS)) -libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) +libffi_la_LDFLAGS = -no-undefined -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src AM_CCASFLAGS = $(AM_CPPFLAGS) -# No install-html or install-pdf support in automake yet -.PHONY: install-html install-pdf -install-html: -install-pdf: diff --git a/Modules/_ctypes/libffi/Makefile.in b/Modules/_ctypes/libffi/Makefile.in --- a/Modules/_ctypes/libffi/Makefile.in +++ b/Modules/_ctypes/libffi/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.12.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -17,6 +16,23 @@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -36,31 +52,40 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ - at MIPS_TRUE@am__append_1 = src/mips/ffi.c src/mips/o32.S src/mips/n32.S - at X86_TRUE@am__append_2 = src/x86/ffi.c src/x86/sysv.S - at X86_FREEBSD_TRUE@am__append_3 = src/x86/ffi.c src/x86/freebsd.S - at X86_WIN32_TRUE@am__append_4 = src/x86/ffi.c src/x86/win32.S - at X86_WIN64_TRUE@am__append_5 = src/x86/ffi.c src/x86/win64.S - at X86_DARWIN_TRUE@am__append_6 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S - at SPARC_TRUE@am__append_7 = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S - at ALPHA_TRUE@am__append_8 = src/alpha/ffi.c src/alpha/osf.S - at IA64_TRUE@am__append_9 = src/ia64/ffi.c src/ia64/unix.S - at M32R_TRUE@am__append_10 = src/m32r/sysv.S src/m32r/ffi.c - at M68K_TRUE@am__append_11 = src/m68k/ffi.c src/m68k/sysv.S - at POWERPC_TRUE@am__append_12 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S - at POWERPC_AIX_TRUE@am__append_13 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S - at POWERPC_DARWIN_TRUE@am__append_14 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S - at POWERPC_FREEBSD_TRUE@am__append_15 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S - at ARM_TRUE@am__append_16 = src/arm/sysv.S src/arm/ffi.c - at AVR32_TRUE@am__append_17 = src/avr32/sysv.S src/avr32/ffi.c - at LIBFFI_CRIS_TRUE@am__append_18 = src/cris/sysv.S src/cris/ffi.c - at FRV_TRUE@am__append_19 = src/frv/eabi.S src/frv/ffi.c - at S390_TRUE@am__append_20 = src/s390/sysv.S src/s390/ffi.c - at X86_64_TRUE@am__append_21 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S - at SH_TRUE@am__append_22 = src/sh/sysv.S src/sh/ffi.c - at SH64_TRUE@am__append_23 = src/sh64/sysv.S src/sh64/ffi.c - at PA_LINUX_TRUE@am__append_24 = src/pa/linux.S src/pa/ffi.c - at PA_HPUX_TRUE@am__append_25 = src/pa/hpux32.S src/pa/ffi.c + at FFI_DEBUG_TRUE@am__append_1 = src/debug.c + at MIPS_TRUE@am__append_2 = src/mips/ffi.c src/mips/o32.S src/mips/n32.S + at BFIN_TRUE@am__append_3 = src/bfin/ffi.c src/bfin/sysv.S + at X86_TRUE@am__append_4 = src/x86/ffi.c src/x86/sysv.S + at X86_FREEBSD_TRUE@am__append_5 = src/x86/ffi.c src/x86/freebsd.S + at X86_WIN32_TRUE@am__append_6 = src/x86/ffi.c src/x86/win32.S + at X86_WIN64_TRUE@am__append_7 = src/x86/ffi.c src/x86/win64.S + at X86_DARWIN_TRUE@am__append_8 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S + at SPARC_TRUE@am__append_9 = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S + at ALPHA_TRUE@am__append_10 = src/alpha/ffi.c src/alpha/osf.S + at IA64_TRUE@am__append_11 = src/ia64/ffi.c src/ia64/unix.S + at M32R_TRUE@am__append_12 = src/m32r/sysv.S src/m32r/ffi.c + at M68K_TRUE@am__append_13 = src/m68k/ffi.c src/m68k/sysv.S + at MOXIE_TRUE@am__append_14 = src/moxie/ffi.c src/moxie/eabi.S + at MICROBLAZE_TRUE@am__append_15 = src/microblaze/ffi.c src/microblaze/sysv.S + at POWERPC_TRUE@am__append_16 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S + at POWERPC_AIX_TRUE@am__append_17 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S + at POWERPC_DARWIN_TRUE@am__append_18 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S + at POWERPC_FREEBSD_TRUE@am__append_19 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S + at AARCH64_TRUE@am__append_20 = src/aarch64/sysv.S src/aarch64/ffi.c + at ARM_TRUE@am__append_21 = src/arm/sysv.S src/arm/ffi.c + at ARM_TRUE@@FFI_EXEC_TRAMPOLINE_TABLE_TRUE at am__append_22 = src/arm/trampoline.S + at AVR32_TRUE@am__append_23 = src/avr32/sysv.S src/avr32/ffi.c + at LIBFFI_CRIS_TRUE@am__append_24 = src/cris/sysv.S src/cris/ffi.c + at FRV_TRUE@am__append_25 = src/frv/eabi.S src/frv/ffi.c + at S390_TRUE@am__append_26 = src/s390/sysv.S src/s390/ffi.c + at X86_64_TRUE@am__append_27 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S + at SH_TRUE@am__append_28 = src/sh/sysv.S src/sh/ffi.c + at SH64_TRUE@am__append_29 = src/sh64/sysv.S src/sh64/ffi.c + at PA_LINUX_TRUE@am__append_30 = src/pa/linux.S src/pa/ffi.c + at PA_HPUX_TRUE@am__append_31 = src/pa/hpux32.S src/pa/ffi.c + at TILE_TRUE@am__append_32 = src/tile/tile.S src/tile/ffi.c + at XTENSA_TRUE@am__append_33 = src/xtensa/sysv.S src/xtensa/ffi.c + at METAG_TRUE@am__append_34 = src/metag/sysv.S src/metag/ffi.c subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/doc/stamp-vti \ @@ -69,7 +94,19 @@ compile config.guess config.sub depcomp install-sh ltmain.sh \ mdate-sh missing texinfo.tex ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_cc_maxopt.m4 \ + $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_configure_args.m4 \ + $(top_srcdir)/m4/ax_enable_builddir.m4 \ + $(top_srcdir)/m4/ax_gcc_archflag.m4 \ + $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -100,51 +137,67 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(infodir)" \ +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)" \ "$(DESTDIR)$(pkgconfigdir)" -LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) +LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES) libffi_la_LIBADD = am__dirstamp = $(am__leading_dot)dirstamp -am_libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \ - src/raw_api.lo src/java_raw_api.lo src/closures.lo - at MIPS_TRUE@am__objects_1 = src/mips/ffi.lo src/mips/o32.lo \ +am_libffi_la_OBJECTS = src/prep_cif.lo src/types.lo src/raw_api.lo \ + src/java_raw_api.lo src/closures.lo + at FFI_DEBUG_TRUE@am__objects_1 = src/debug.lo + at MIPS_TRUE@am__objects_2 = src/mips/ffi.lo src/mips/o32.lo \ @MIPS_TRUE@ src/mips/n32.lo - at X86_TRUE@am__objects_2 = src/x86/ffi.lo src/x86/sysv.lo - at X86_FREEBSD_TRUE@am__objects_3 = src/x86/ffi.lo src/x86/freebsd.lo - at X86_WIN32_TRUE@am__objects_4 = src/x86/ffi.lo src/x86/win32.lo - at X86_WIN64_TRUE@am__objects_5 = src/x86/ffi.lo src/x86/win64.lo - at X86_DARWIN_TRUE@am__objects_6 = src/x86/ffi.lo src/x86/darwin.lo \ + at BFIN_TRUE@am__objects_3 = src/bfin/ffi.lo src/bfin/sysv.lo + at X86_TRUE@am__objects_4 = src/x86/ffi.lo src/x86/sysv.lo + at X86_FREEBSD_TRUE@am__objects_5 = src/x86/ffi.lo src/x86/freebsd.lo + at X86_WIN32_TRUE@am__objects_6 = src/x86/ffi.lo src/x86/win32.lo + at X86_WIN64_TRUE@am__objects_7 = src/x86/ffi.lo src/x86/win64.lo + at X86_DARWIN_TRUE@am__objects_8 = src/x86/ffi.lo src/x86/darwin.lo \ @X86_DARWIN_TRUE@ src/x86/ffi64.lo src/x86/darwin64.lo - at SPARC_TRUE@am__objects_7 = src/sparc/ffi.lo src/sparc/v8.lo \ + at SPARC_TRUE@am__objects_9 = src/sparc/ffi.lo src/sparc/v8.lo \ @SPARC_TRUE@ src/sparc/v9.lo - at ALPHA_TRUE@am__objects_8 = src/alpha/ffi.lo src/alpha/osf.lo - at IA64_TRUE@am__objects_9 = src/ia64/ffi.lo src/ia64/unix.lo - at M32R_TRUE@am__objects_10 = src/m32r/sysv.lo src/m32r/ffi.lo - at M68K_TRUE@am__objects_11 = src/m68k/ffi.lo src/m68k/sysv.lo - at POWERPC_TRUE@am__objects_12 = src/powerpc/ffi.lo src/powerpc/sysv.lo \ + at ALPHA_TRUE@am__objects_10 = src/alpha/ffi.lo src/alpha/osf.lo + at IA64_TRUE@am__objects_11 = src/ia64/ffi.lo src/ia64/unix.lo + at M32R_TRUE@am__objects_12 = src/m32r/sysv.lo src/m32r/ffi.lo + at M68K_TRUE@am__objects_13 = src/m68k/ffi.lo src/m68k/sysv.lo + at MOXIE_TRUE@am__objects_14 = src/moxie/ffi.lo src/moxie/eabi.lo + at MICROBLAZE_TRUE@am__objects_15 = src/microblaze/ffi.lo \ + at MICROBLAZE_TRUE@ src/microblaze/sysv.lo + at POWERPC_TRUE@am__objects_16 = src/powerpc/ffi.lo src/powerpc/sysv.lo \ @POWERPC_TRUE@ src/powerpc/ppc_closure.lo \ @POWERPC_TRUE@ src/powerpc/linux64.lo \ @POWERPC_TRUE@ src/powerpc/linux64_closure.lo - at POWERPC_AIX_TRUE@am__objects_13 = src/powerpc/ffi_darwin.lo \ + at POWERPC_AIX_TRUE@am__objects_17 = src/powerpc/ffi_darwin.lo \ @POWERPC_AIX_TRUE@ src/powerpc/aix.lo \ @POWERPC_AIX_TRUE@ src/powerpc/aix_closure.lo - at POWERPC_DARWIN_TRUE@am__objects_14 = src/powerpc/ffi_darwin.lo \ + at POWERPC_DARWIN_TRUE@am__objects_18 = src/powerpc/ffi_darwin.lo \ @POWERPC_DARWIN_TRUE@ src/powerpc/darwin.lo \ @POWERPC_DARWIN_TRUE@ src/powerpc/darwin_closure.lo - at POWERPC_FREEBSD_TRUE@am__objects_15 = src/powerpc/ffi.lo \ + at POWERPC_FREEBSD_TRUE@am__objects_19 = src/powerpc/ffi.lo \ @POWERPC_FREEBSD_TRUE@ src/powerpc/sysv.lo \ @POWERPC_FREEBSD_TRUE@ src/powerpc/ppc_closure.lo - at ARM_TRUE@am__objects_16 = src/arm/sysv.lo src/arm/ffi.lo - at AVR32_TRUE@am__objects_17 = src/avr32/sysv.lo src/avr32/ffi.lo - at LIBFFI_CRIS_TRUE@am__objects_18 = src/cris/sysv.lo src/cris/ffi.lo - at FRV_TRUE@am__objects_19 = src/frv/eabi.lo src/frv/ffi.lo - at S390_TRUE@am__objects_20 = src/s390/sysv.lo src/s390/ffi.lo - at X86_64_TRUE@am__objects_21 = src/x86/ffi64.lo src/x86/unix64.lo \ + at AARCH64_TRUE@am__objects_20 = src/aarch64/sysv.lo src/aarch64/ffi.lo + at ARM_TRUE@am__objects_21 = src/arm/sysv.lo src/arm/ffi.lo + at ARM_TRUE@@FFI_EXEC_TRAMPOLINE_TABLE_TRUE at am__objects_22 = src/arm/trampoline.lo + at AVR32_TRUE@am__objects_23 = src/avr32/sysv.lo src/avr32/ffi.lo + at LIBFFI_CRIS_TRUE@am__objects_24 = src/cris/sysv.lo src/cris/ffi.lo + at FRV_TRUE@am__objects_25 = src/frv/eabi.lo src/frv/ffi.lo + at S390_TRUE@am__objects_26 = src/s390/sysv.lo src/s390/ffi.lo + at X86_64_TRUE@am__objects_27 = src/x86/ffi64.lo src/x86/unix64.lo \ @X86_64_TRUE@ src/x86/ffi.lo src/x86/sysv.lo - at SH_TRUE@am__objects_22 = src/sh/sysv.lo src/sh/ffi.lo - at SH64_TRUE@am__objects_23 = src/sh64/sysv.lo src/sh64/ffi.lo - at PA_LINUX_TRUE@am__objects_24 = src/pa/linux.lo src/pa/ffi.lo - at PA_HPUX_TRUE@am__objects_25 = src/pa/hpux32.lo src/pa/ffi.lo + at SH_TRUE@am__objects_28 = src/sh/sysv.lo src/sh/ffi.lo + at SH64_TRUE@am__objects_29 = src/sh64/sysv.lo src/sh64/ffi.lo + at PA_LINUX_TRUE@am__objects_30 = src/pa/linux.lo src/pa/ffi.lo + at PA_HPUX_TRUE@am__objects_31 = src/pa/hpux32.lo src/pa/ffi.lo + at TILE_TRUE@am__objects_32 = src/tile/tile.lo src/tile/ffi.lo + at XTENSA_TRUE@am__objects_33 = src/xtensa/sysv.lo src/xtensa/ffi.lo + at METAG_TRUE@am__objects_34 = src/metag/sysv.lo src/metag/ffi.lo nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ $(am__objects_3) $(am__objects_4) $(am__objects_5) \ $(am__objects_6) $(am__objects_7) $(am__objects_8) \ @@ -153,17 +206,20 @@ $(am__objects_15) $(am__objects_16) $(am__objects_17) \ $(am__objects_18) $(am__objects_19) $(am__objects_20) \ $(am__objects_21) $(am__objects_22) $(am__objects_23) \ - $(am__objects_24) $(am__objects_25) + $(am__objects_24) $(am__objects_25) $(am__objects_26) \ + $(am__objects_27) $(am__objects_28) $(am__objects_29) \ + $(am__objects_30) $(am__objects_31) $(am__objects_32) \ + $(am__objects_33) $(am__objects_34) libffi_la_OBJECTS = $(am_libffi_la_OBJECTS) \ $(nodist_libffi_la_OBJECTS) libffi_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libffi_la_LDFLAGS) $(LDFLAGS) -o $@ libffi_convenience_la_LIBADD = -am__objects_26 = src/debug.lo src/prep_cif.lo src/types.lo \ - src/raw_api.lo src/java_raw_api.lo src/closures.lo -am_libffi_convenience_la_OBJECTS = $(am__objects_26) -am__objects_27 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \ +am__objects_35 = src/prep_cif.lo src/types.lo src/raw_api.lo \ + src/java_raw_api.lo src/closures.lo +am_libffi_convenience_la_OBJECTS = $(am__objects_35) +am__objects_36 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \ $(am__objects_4) $(am__objects_5) $(am__objects_6) \ $(am__objects_7) $(am__objects_8) $(am__objects_9) \ $(am__objects_10) $(am__objects_11) $(am__objects_12) \ @@ -171,8 +227,11 @@ $(am__objects_16) $(am__objects_17) $(am__objects_18) \ $(am__objects_19) $(am__objects_20) $(am__objects_21) \ $(am__objects_22) $(am__objects_23) $(am__objects_24) \ - $(am__objects_25) -nodist_libffi_convenience_la_OBJECTS = $(am__objects_27) + $(am__objects_25) $(am__objects_26) $(am__objects_27) \ + $(am__objects_28) $(am__objects_29) $(am__objects_30) \ + $(am__objects_31) $(am__objects_32) $(am__objects_33) \ + $(am__objects_34) +nodist_libffi_convenience_la_OBJECTS = $(am__objects_36) libffi_convenience_la_OBJECTS = $(am_libffi_convenience_la_OBJECTS) \ $(nodist_libffi_convenience_la_OBJECTS) DEFAULT_INCLUDES = -I. at am__isrc@ @@ -216,22 +275,31 @@ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac DATA = $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ - distdir dist dist-all distcheck + cscope distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags +CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ - { test ! -d "$(distdir)" \ - || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr "$(distdir)"; }; } + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ @@ -259,7 +327,10 @@ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best +DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ @@ -282,6 +353,7 @@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -289,6 +361,7 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ FGREP = @FGREP@ GREP = @GREP@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ @@ -307,6 +380,7 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -319,8 +393,10 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PRTDIAG = @PRTDIAG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -333,6 +409,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -340,6 +417,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -365,7 +443,6 @@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -376,6 +453,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ @@ -388,36 +466,48 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign subdir-objects +ACLOCAL_AMFLAGS = -I m4 SUBDIRS = include testsuite man -EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ - src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \ - src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \ - src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \ - src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \ - src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \ - src/ia64/unix.S \ - src/mips/ffi.c src/mips/n32.S src/mips/o32.S \ - src/mips/ffitarget.h \ - src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ - src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ - src/powerpc/ffi.c src/powerpc/sysv.S \ - src/powerpc/linux64.S src/powerpc/linux64_closure.S \ - src/powerpc/ppc_closure.S src/powerpc/asm.h \ - src/powerpc/aix.S src/powerpc/darwin.S \ - src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ - src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ - src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ - src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h \ - src/sh64/ffi.c src/sh64/sysv.S src/sh64/ffitarget.h \ - src/sparc/v8.S src/sparc/v9.S src/sparc/ffitarget.h \ - src/sparc/ffi.c src/x86/darwin64.S \ - src/x86/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/win64.S \ - src/x86/darwin.S src/x86/freebsd.S \ - src/x86/ffi64.c src/x86/unix64.S src/x86/ffitarget.h \ - src/pa/ffitarget.h src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \ - src/frv/ffi.c src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c \ - libtool-version ChangeLog.libffi m4/libtool.m4 \ - m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 +EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ + src/aarch64/ffi.c src/aarch64/ffitarget.h src/aarch64/sysv.S \ + build-ios.sh src/alpha/ffi.c src/alpha/osf.S \ + src/alpha/ffitarget.h src/arm/ffi.c src/arm/sysv.S \ + src/arm/ffitarget.h src/avr32/ffi.c src/avr32/sysv.S \ + src/avr32/ffitarget.h src/cris/ffi.c src/cris/sysv.S \ + src/cris/ffitarget.h src/ia64/ffi.c src/ia64/ffitarget.h \ + src/ia64/ia64_flags.h src/ia64/unix.S src/mips/ffi.c \ + src/mips/n32.S src/mips/o32.S src/metag/ffi.c \ + src/metag/ffitarget.h src/metag/sysv.S src/moxie/ffi.c \ + src/moxie/ffitarget.h src/moxie/eabi.S src/mips/ffitarget.h \ + src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ + src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ + src/microblaze/ffi.c src/microblaze/sysv.S \ + src/microblaze/ffitarget.h src/powerpc/ffi.c \ + src/powerpc/sysv.S src/powerpc/linux64.S \ + src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \ + src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S \ + src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ + src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ + src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ + src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c \ + src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S \ + src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c \ + src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S \ + src/x86/win32.S src/x86/darwin.S src/x86/win64.S \ + src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S \ + src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c \ + src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c \ + src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S \ + src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c \ + src/tile/ffitarget.h src/tile/tile.S libtool-version \ + src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S \ + ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4 \ + m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \ + m4/ltversion.m4 src/arm/gentramp.sh src/debug.c msvcc.sh \ + generate-ios-source-and-headers.py \ + generate-osx-source-and-headers.py \ + libffi.xcodeproj/project.pbxproj src/arm/trampoline.S \ + libtool-ldflags info_TEXINFOS = doc/libffi.texi @@ -448,6 +538,7 @@ "exec_prefix=$(exec_prefix)" \ "infodir=$(infodir)" \ "libdir=$(libdir)" \ + "mandir=$(mandir)" \ "prefix=$(prefix)" \ "AR=$(AR)" \ "AS=$(AS)" \ @@ -458,11 +549,13 @@ "RANLIB=$(RANLIB)" \ "DESTDIR=$(DESTDIR)" + +# Subdir rules rely on $(FLAGS_TO_PASS) +FLAGS_TO_PASS = $(AM_MAKEFLAGS) MAKEOVERRIDES = -ACLOCAL_AMFLAGS = $(ACLOCAL_AMFLAGS) -I m4 -lib_LTLIBRARIES = libffi.la +toolexeclib_LTLIBRARIES = libffi.la noinst_LTLIBRARIES = libffi_convenience.la -libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c \ +libffi_la_SOURCES = src/prep_cif.c src/types.c \ src/raw_api.c src/java_raw_api.c src/closures.c pkgconfigdir = $(libdir)/pkgconfig @@ -475,11 +568,14 @@ $(am__append_15) $(am__append_16) $(am__append_17) \ $(am__append_18) $(am__append_19) $(am__append_20) \ $(am__append_21) $(am__append_22) $(am__append_23) \ - $(am__append_24) $(am__append_25) + $(am__append_24) $(am__append_25) $(am__append_26) \ + $(am__append_27) $(am__append_28) $(am__append_29) \ + $(am__append_30) $(am__append_31) $(am__append_32) \ + $(am__append_33) $(am__append_34) libffi_convenience_la_SOURCES = $(libffi_la_SOURCES) nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) -AM_CFLAGS = -Wall -g -fexceptions -libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(AM_LTLDFLAGS) +LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/libtool-ldflags $(LDFLAGS)) +libffi_la_LDFLAGS = -no-undefined -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src AM_CCASFLAGS = $(AM_CPPFLAGS) all: fficonfig.h @@ -487,7 +583,7 @@ .SUFFIXES: .SUFFIXES: .S .c .dvi .lo .o .obj .ps -am--refresh: +am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ @@ -523,10 +619,8 @@ $(am__aclocal_m4_deps): fficonfig.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ - else :; fi + @if test ! -f $@; then rm -f stamp-h1; else :; fi + @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/fficonfig.h.in $(top_builddir)/config.status @rm -f stamp-h1 @@ -540,58 +634,63 @@ -rm -f fficonfig.h stamp-h1 libffi.pc: $(top_builddir)/config.status $(srcdir)/libffi.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ -install-libLTLIBRARIES: $(lib_LTLIBRARIES) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(toolexeclibdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \ } -uninstall-libLTLIBRARIES: +uninstall-toolexeclibLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$f"; \ done -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done +clean-toolexeclibLTLIBRARIES: + -test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES) + @list='$(toolexeclib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } src/$(am__dirstamp): @$(MKDIR_P) src @: > src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/$(DEPDIR) @: > src/$(DEPDIR)/$(am__dirstamp) -src/debug.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/prep_cif.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/types.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/raw_api.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/java_raw_api.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/closures.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) +src/debug.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/mips/$(am__dirstamp): @$(MKDIR_P) src/mips @: > src/mips/$(am__dirstamp) @@ -604,6 +703,16 @@ src/mips/$(DEPDIR)/$(am__dirstamp) src/mips/n32.lo: src/mips/$(am__dirstamp) \ src/mips/$(DEPDIR)/$(am__dirstamp) +src/bfin/$(am__dirstamp): + @$(MKDIR_P) src/bfin + @: > src/bfin/$(am__dirstamp) +src/bfin/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/bfin/$(DEPDIR) + @: > src/bfin/$(DEPDIR)/$(am__dirstamp) +src/bfin/ffi.lo: src/bfin/$(am__dirstamp) \ + src/bfin/$(DEPDIR)/$(am__dirstamp) +src/bfin/sysv.lo: src/bfin/$(am__dirstamp) \ + src/bfin/$(DEPDIR)/$(am__dirstamp) src/x86/$(am__dirstamp): @$(MKDIR_P) src/x86 @: > src/x86/$(am__dirstamp) @@ -678,6 +787,26 @@ src/m68k/$(DEPDIR)/$(am__dirstamp) src/m68k/sysv.lo: src/m68k/$(am__dirstamp) \ src/m68k/$(DEPDIR)/$(am__dirstamp) +src/moxie/$(am__dirstamp): + @$(MKDIR_P) src/moxie + @: > src/moxie/$(am__dirstamp) +src/moxie/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/moxie/$(DEPDIR) + @: > src/moxie/$(DEPDIR)/$(am__dirstamp) +src/moxie/ffi.lo: src/moxie/$(am__dirstamp) \ + src/moxie/$(DEPDIR)/$(am__dirstamp) +src/moxie/eabi.lo: src/moxie/$(am__dirstamp) \ + src/moxie/$(DEPDIR)/$(am__dirstamp) +src/microblaze/$(am__dirstamp): + @$(MKDIR_P) src/microblaze + @: > src/microblaze/$(am__dirstamp) +src/microblaze/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/microblaze/$(DEPDIR) + @: > src/microblaze/$(DEPDIR)/$(am__dirstamp) +src/microblaze/ffi.lo: src/microblaze/$(am__dirstamp) \ + src/microblaze/$(DEPDIR)/$(am__dirstamp) +src/microblaze/sysv.lo: src/microblaze/$(am__dirstamp) \ + src/microblaze/$(DEPDIR)/$(am__dirstamp) src/powerpc/$(am__dirstamp): @$(MKDIR_P) src/powerpc @: > src/powerpc/$(am__dirstamp) @@ -704,6 +833,16 @@ src/powerpc/$(DEPDIR)/$(am__dirstamp) src/powerpc/darwin_closure.lo: src/powerpc/$(am__dirstamp) \ src/powerpc/$(DEPDIR)/$(am__dirstamp) +src/aarch64/$(am__dirstamp): + @$(MKDIR_P) src/aarch64 + @: > src/aarch64/$(am__dirstamp) +src/aarch64/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/aarch64/$(DEPDIR) + @: > src/aarch64/$(DEPDIR)/$(am__dirstamp) +src/aarch64/sysv.lo: src/aarch64/$(am__dirstamp) \ + src/aarch64/$(DEPDIR)/$(am__dirstamp) +src/aarch64/ffi.lo: src/aarch64/$(am__dirstamp) \ + src/aarch64/$(DEPDIR)/$(am__dirstamp) src/arm/$(am__dirstamp): @$(MKDIR_P) src/arm @: > src/arm/$(am__dirstamp) @@ -714,6 +853,8 @@ src/arm/$(DEPDIR)/$(am__dirstamp) src/arm/ffi.lo: src/arm/$(am__dirstamp) \ src/arm/$(DEPDIR)/$(am__dirstamp) +src/arm/trampoline.lo: src/arm/$(am__dirstamp) \ + src/arm/$(DEPDIR)/$(am__dirstamp) src/avr32/$(am__dirstamp): @$(MKDIR_P) src/avr32 @: > src/avr32/$(am__dirstamp) @@ -786,125 +927,91 @@ src/pa/ffi.lo: src/pa/$(am__dirstamp) src/pa/$(DEPDIR)/$(am__dirstamp) src/pa/hpux32.lo: src/pa/$(am__dirstamp) \ src/pa/$(DEPDIR)/$(am__dirstamp) -libffi.la: $(libffi_la_OBJECTS) $(libffi_la_DEPENDENCIES) - $(libffi_la_LINK) -rpath $(libdir) $(libffi_la_OBJECTS) $(libffi_la_LIBADD) $(LIBS) -libffi_convenience.la: $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_DEPENDENCIES) +src/tile/$(am__dirstamp): + @$(MKDIR_P) src/tile + @: > src/tile/$(am__dirstamp) +src/tile/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/tile/$(DEPDIR) + @: > src/tile/$(DEPDIR)/$(am__dirstamp) +src/tile/tile.lo: src/tile/$(am__dirstamp) \ + src/tile/$(DEPDIR)/$(am__dirstamp) +src/tile/ffi.lo: src/tile/$(am__dirstamp) \ + src/tile/$(DEPDIR)/$(am__dirstamp) +src/xtensa/$(am__dirstamp): + @$(MKDIR_P) src/xtensa + @: > src/xtensa/$(am__dirstamp) +src/xtensa/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/xtensa/$(DEPDIR) + @: > src/xtensa/$(DEPDIR)/$(am__dirstamp) +src/xtensa/sysv.lo: src/xtensa/$(am__dirstamp) \ + src/xtensa/$(DEPDIR)/$(am__dirstamp) +src/xtensa/ffi.lo: src/xtensa/$(am__dirstamp) \ + src/xtensa/$(DEPDIR)/$(am__dirstamp) +src/metag/$(am__dirstamp): + @$(MKDIR_P) src/metag + @: > src/metag/$(am__dirstamp) +src/metag/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/metag/$(DEPDIR) + @: > src/metag/$(DEPDIR)/$(am__dirstamp) +src/metag/sysv.lo: src/metag/$(am__dirstamp) \ + src/metag/$(DEPDIR)/$(am__dirstamp) +src/metag/ffi.lo: src/metag/$(am__dirstamp) \ + src/metag/$(DEPDIR)/$(am__dirstamp) +libffi.la: $(libffi_la_OBJECTS) $(libffi_la_DEPENDENCIES) $(EXTRA_libffi_la_DEPENDENCIES) + $(libffi_la_LINK) -rpath $(toolexeclibdir) $(libffi_la_OBJECTS) $(libffi_la_LIBADD) $(LIBS) +libffi_convenience.la: $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_DEPENDENCIES) $(EXTRA_libffi_convenience_la_DEPENDENCIES) $(LINK) $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) - -rm -f src/alpha/ffi.$(OBJEXT) - -rm -f src/alpha/ffi.lo - -rm -f src/alpha/osf.$(OBJEXT) - -rm -f src/alpha/osf.lo - -rm -f src/arm/ffi.$(OBJEXT) - -rm -f src/arm/ffi.lo - -rm -f src/arm/sysv.$(OBJEXT) - -rm -f src/arm/sysv.lo - -rm -f src/avr32/ffi.$(OBJEXT) - -rm -f src/avr32/ffi.lo - -rm -f src/avr32/sysv.$(OBJEXT) - -rm -f src/avr32/sysv.lo - -rm -f src/closures.$(OBJEXT) - -rm -f src/closures.lo - -rm -f src/cris/ffi.$(OBJEXT) - -rm -f src/cris/ffi.lo - -rm -f src/cris/sysv.$(OBJEXT) - -rm -f src/cris/sysv.lo - -rm -f src/debug.$(OBJEXT) - -rm -f src/debug.lo - -rm -f src/frv/eabi.$(OBJEXT) - -rm -f src/frv/eabi.lo - -rm -f src/frv/ffi.$(OBJEXT) - -rm -f src/frv/ffi.lo - -rm -f src/ia64/ffi.$(OBJEXT) - -rm -f src/ia64/ffi.lo - -rm -f src/ia64/unix.$(OBJEXT) - -rm -f src/ia64/unix.lo - -rm -f src/java_raw_api.$(OBJEXT) - -rm -f src/java_raw_api.lo - -rm -f src/m32r/ffi.$(OBJEXT) - -rm -f src/m32r/ffi.lo - -rm -f src/m32r/sysv.$(OBJEXT) - -rm -f src/m32r/sysv.lo - -rm -f src/m68k/ffi.$(OBJEXT) - -rm -f src/m68k/ffi.lo - -rm -f src/m68k/sysv.$(OBJEXT) - -rm -f src/m68k/sysv.lo - -rm -f src/mips/ffi.$(OBJEXT) - -rm -f src/mips/ffi.lo - -rm -f src/mips/n32.$(OBJEXT) - -rm -f src/mips/n32.lo - -rm -f src/mips/o32.$(OBJEXT) - -rm -f src/mips/o32.lo - -rm -f src/pa/ffi.$(OBJEXT) - -rm -f src/pa/ffi.lo - -rm -f src/pa/hpux32.$(OBJEXT) - -rm -f src/pa/hpux32.lo - -rm -f src/pa/linux.$(OBJEXT) - -rm -f src/pa/linux.lo - -rm -f src/powerpc/aix.$(OBJEXT) - -rm -f src/powerpc/aix.lo - -rm -f src/powerpc/aix_closure.$(OBJEXT) - -rm -f src/powerpc/aix_closure.lo - -rm -f src/powerpc/darwin.$(OBJEXT) - -rm -f src/powerpc/darwin.lo - -rm -f src/powerpc/darwin_closure.$(OBJEXT) - -rm -f src/powerpc/darwin_closure.lo - -rm -f src/powerpc/ffi.$(OBJEXT) - -rm -f src/powerpc/ffi.lo - -rm -f src/powerpc/ffi_darwin.$(OBJEXT) - -rm -f src/powerpc/ffi_darwin.lo - -rm -f src/powerpc/linux64.$(OBJEXT) - -rm -f src/powerpc/linux64.lo - -rm -f src/powerpc/linux64_closure.$(OBJEXT) - -rm -f src/powerpc/linux64_closure.lo - -rm -f src/powerpc/ppc_closure.$(OBJEXT) - -rm -f src/powerpc/ppc_closure.lo - -rm -f src/powerpc/sysv.$(OBJEXT) - -rm -f src/powerpc/sysv.lo - -rm -f src/prep_cif.$(OBJEXT) - -rm -f src/prep_cif.lo - -rm -f src/raw_api.$(OBJEXT) - -rm -f src/raw_api.lo - -rm -f src/s390/ffi.$(OBJEXT) - -rm -f src/s390/ffi.lo - -rm -f src/s390/sysv.$(OBJEXT) - -rm -f src/s390/sysv.lo - -rm -f src/sh/ffi.$(OBJEXT) - -rm -f src/sh/ffi.lo - -rm -f src/sh/sysv.$(OBJEXT) - -rm -f src/sh/sysv.lo - -rm -f src/sh64/ffi.$(OBJEXT) - -rm -f src/sh64/ffi.lo - -rm -f src/sh64/sysv.$(OBJEXT) - -rm -f src/sh64/sysv.lo - -rm -f src/sparc/ffi.$(OBJEXT) - -rm -f src/sparc/ffi.lo - -rm -f src/sparc/v8.$(OBJEXT) - -rm -f src/sparc/v8.lo - -rm -f src/sparc/v9.$(OBJEXT) - -rm -f src/sparc/v9.lo - -rm -f src/types.$(OBJEXT) - -rm -f src/types.lo - -rm -f src/x86/darwin.$(OBJEXT) - -rm -f src/x86/darwin.lo - -rm -f src/x86/darwin64.$(OBJEXT) - -rm -f src/x86/darwin64.lo - -rm -f src/x86/ffi.$(OBJEXT) - -rm -f src/x86/ffi.lo - -rm -f src/x86/ffi64.$(OBJEXT) - -rm -f src/x86/ffi64.lo - -rm -f src/x86/freebsd.$(OBJEXT) - -rm -f src/x86/freebsd.lo - -rm -f src/x86/sysv.$(OBJEXT) - -rm -f src/x86/sysv.lo - -rm -f src/x86/unix64.$(OBJEXT) - -rm -f src/x86/unix64.lo - -rm -f src/x86/win32.$(OBJEXT) - -rm -f src/x86/win32.lo - -rm -f src/x86/win64.$(OBJEXT) - -rm -f src/x86/win64.lo + -rm -f src/*.$(OBJEXT) + -rm -f src/*.lo + -rm -f src/aarch64/*.$(OBJEXT) + -rm -f src/aarch64/*.lo + -rm -f src/alpha/*.$(OBJEXT) + -rm -f src/alpha/*.lo + -rm -f src/arm/*.$(OBJEXT) + -rm -f src/arm/*.lo + -rm -f src/avr32/*.$(OBJEXT) + -rm -f src/avr32/*.lo + -rm -f src/bfin/*.$(OBJEXT) + -rm -f src/bfin/*.lo + -rm -f src/cris/*.$(OBJEXT) + -rm -f src/cris/*.lo + -rm -f src/frv/*.$(OBJEXT) + -rm -f src/frv/*.lo + -rm -f src/ia64/*.$(OBJEXT) + -rm -f src/ia64/*.lo + -rm -f src/m32r/*.$(OBJEXT) + -rm -f src/m32r/*.lo + -rm -f src/m68k/*.$(OBJEXT) + -rm -f src/m68k/*.lo + -rm -f src/metag/*.$(OBJEXT) + -rm -f src/metag/*.lo + -rm -f src/microblaze/*.$(OBJEXT) + -rm -f src/microblaze/*.lo + -rm -f src/mips/*.$(OBJEXT) + -rm -f src/mips/*.lo + -rm -f src/moxie/*.$(OBJEXT) + -rm -f src/moxie/*.lo + -rm -f src/pa/*.$(OBJEXT) + -rm -f src/pa/*.lo + -rm -f src/powerpc/*.$(OBJEXT) + -rm -f src/powerpc/*.lo + -rm -f src/s390/*.$(OBJEXT) + -rm -f src/s390/*.lo + -rm -f src/sh/*.$(OBJEXT) + -rm -f src/sh/*.lo + -rm -f src/sh64/*.$(OBJEXT) + -rm -f src/sh64/*.lo + -rm -f src/sparc/*.$(OBJEXT) + -rm -f src/sparc/*.lo + -rm -f src/tile/*.$(OBJEXT) + -rm -f src/tile/*.lo + -rm -f src/x86/*.$(OBJEXT) + -rm -f src/x86/*.lo + -rm -f src/xtensa/*.$(OBJEXT) + -rm -f src/xtensa/*.lo distclean-compile: -rm -f *.tab.c @@ -915,12 +1022,17 @@ @AMDEP_TRUE@@am__include@ @am__quote at src/$(DEPDIR)/prep_cif.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/$(DEPDIR)/raw_api.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/$(DEPDIR)/types.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/aarch64/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/aarch64/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/alpha/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/alpha/$(DEPDIR)/osf.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/arm/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/arm/$(DEPDIR)/sysv.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/arm/$(DEPDIR)/trampoline.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/avr32/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/avr32/$(DEPDIR)/sysv.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/bfin/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/bfin/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/cris/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/cris/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/frv/$(DEPDIR)/eabi.Plo at am__quote@ @@ -931,9 +1043,15 @@ @AMDEP_TRUE@@am__include@ @am__quote at src/m32r/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/m68k/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/m68k/$(DEPDIR)/sysv.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/metag/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/metag/$(DEPDIR)/sysv.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/microblaze/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/microblaze/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/mips/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/mips/$(DEPDIR)/n32.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/mips/$(DEPDIR)/o32.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/moxie/$(DEPDIR)/eabi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/moxie/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/pa/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/pa/$(DEPDIR)/hpux32.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/pa/$(DEPDIR)/linux.Plo at am__quote@ @@ -956,6 +1074,8 @@ @AMDEP_TRUE@@am__include@ @am__quote at src/sparc/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/sparc/$(DEPDIR)/v8.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/sparc/$(DEPDIR)/v9.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/tile/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/tile/$(DEPDIR)/tile.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/darwin.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/darwin64.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/ffi.Plo at am__quote@ @@ -965,6 +1085,8 @@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/unix64.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/win32.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/win64.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/xtensa/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/xtensa/$(DEPDIR)/sysv.Plo at am__quote@ .S.o: @am__fastdepCCAS_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @@ -1020,22 +1142,29 @@ clean-libtool: -rm -rf .libs _libs -rm -rf src/.libs src/_libs + -rm -rf src/aarch64/.libs src/aarch64/_libs -rm -rf src/alpha/.libs src/alpha/_libs -rm -rf src/arm/.libs src/arm/_libs -rm -rf src/avr32/.libs src/avr32/_libs + -rm -rf src/bfin/.libs src/bfin/_libs -rm -rf src/cris/.libs src/cris/_libs -rm -rf src/frv/.libs src/frv/_libs -rm -rf src/ia64/.libs src/ia64/_libs -rm -rf src/m32r/.libs src/m32r/_libs -rm -rf src/m68k/.libs src/m68k/_libs + -rm -rf src/metag/.libs src/metag/_libs + -rm -rf src/microblaze/.libs src/microblaze/_libs -rm -rf src/mips/.libs src/mips/_libs + -rm -rf src/moxie/.libs src/moxie/_libs -rm -rf src/pa/.libs src/pa/_libs -rm -rf src/powerpc/.libs src/powerpc/_libs -rm -rf src/s390/.libs src/s390/_libs -rm -rf src/sh/.libs src/sh/_libs -rm -rf src/sh64/.libs src/sh64/_libs -rm -rf src/sparc/.libs src/sparc/_libs + -rm -rf src/tile/.libs src/tile/_libs -rm -rf src/x86/.libs src/x86/_libs + -rm -rf src/xtensa/.libs src/xtensa/_libs distclean-libtool: -rm -f libtool config.lt @@ -1068,12 +1197,12 @@ doc/libffi.dvi: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ - $(TEXI2DVI) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi + $(TEXI2DVI) --clean -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi doc/libffi.pdf: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ - $(TEXI2PDF) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi + $(TEXI2PDF) --clean -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi doc/libffi.html: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) rm -rf $(@:.html=.htp) @@ -1110,7 +1239,7 @@ @MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/doc/stamp-vti $(srcdir)/doc/version.texi .dvi.ps: TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ - $(DVIPS) -o $@ $< + $(DVIPS) -o $@ $< uninstall-dvi-am: @$(NORMAL_UNINSTALL) @@ -1132,9 +1261,7 @@ uninstall-info-am: @$(PRE_UNINSTALL) - @if test -d '$(DESTDIR)$(infodir)' && \ - (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ @@ -1206,8 +1333,11 @@ done install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) - test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -1221,18 +1351,16 @@ @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -1241,7 +1369,11 @@ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -1255,37 +1387,6 @@ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ @@ -1294,6 +1395,10 @@ list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done +cscopelist-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \ + done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -1357,8 +1462,32 @@ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) + +clean-cscope: + -rm -f cscope.files + +cscope.files: clean-cscope cscopelist-recursive cscopelist + +cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) @@ -1394,13 +1523,10 @@ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ @@ -1424,43 +1550,44 @@ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-info -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) dist-xz: distdir - tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz - $(am__remove_distdir) + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) + $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) + $(am__post_remove_distdir) -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another @@ -1468,21 +1595,21 @@ distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod a+w $(distdir) + chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) @@ -1492,6 +1619,7 @@ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ @@ -1515,13 +1643,21 @@ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 - $(am__remove_distdir) + $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: - @$(am__cd) '$(distuninstallcheck_dir)' \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ @@ -1542,7 +1678,7 @@ all-am: Makefile $(INFO_DEPS) $(LTLIBRARIES) $(DATA) fficonfig.h installdirs: installdirs-recursive installdirs-am: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(pkgconfigdir)"; do \ + for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive @@ -1555,10 +1691,15 @@ installcheck: installcheck-recursive install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -1569,12 +1710,16 @@ -rm -f doc/$(am__dirstamp) -rm -f src/$(DEPDIR)/$(am__dirstamp) -rm -f src/$(am__dirstamp) + -rm -f src/aarch64/$(DEPDIR)/$(am__dirstamp) + -rm -f src/aarch64/$(am__dirstamp) -rm -f src/alpha/$(DEPDIR)/$(am__dirstamp) -rm -f src/alpha/$(am__dirstamp) -rm -f src/arm/$(DEPDIR)/$(am__dirstamp) -rm -f src/arm/$(am__dirstamp) -rm -f src/avr32/$(DEPDIR)/$(am__dirstamp) -rm -f src/avr32/$(am__dirstamp) + -rm -f src/bfin/$(DEPDIR)/$(am__dirstamp) + -rm -f src/bfin/$(am__dirstamp) -rm -f src/cris/$(DEPDIR)/$(am__dirstamp) -rm -f src/cris/$(am__dirstamp) -rm -f src/frv/$(DEPDIR)/$(am__dirstamp) @@ -1585,8 +1730,14 @@ -rm -f src/m32r/$(am__dirstamp) -rm -f src/m68k/$(DEPDIR)/$(am__dirstamp) -rm -f src/m68k/$(am__dirstamp) + -rm -f src/metag/$(DEPDIR)/$(am__dirstamp) + -rm -f src/metag/$(am__dirstamp) + -rm -f src/microblaze/$(DEPDIR)/$(am__dirstamp) + -rm -f src/microblaze/$(am__dirstamp) -rm -f src/mips/$(DEPDIR)/$(am__dirstamp) -rm -f src/mips/$(am__dirstamp) + -rm -f src/moxie/$(DEPDIR)/$(am__dirstamp) + -rm -f src/moxie/$(am__dirstamp) -rm -f src/pa/$(DEPDIR)/$(am__dirstamp) -rm -f src/pa/$(am__dirstamp) -rm -f src/powerpc/$(DEPDIR)/$(am__dirstamp) @@ -1599,20 +1750,25 @@ -rm -f src/sh64/$(am__dirstamp) -rm -f src/sparc/$(DEPDIR)/$(am__dirstamp) -rm -f src/sparc/$(am__dirstamp) + -rm -f src/tile/$(DEPDIR)/$(am__dirstamp) + -rm -f src/tile/$(am__dirstamp) -rm -f src/x86/$(DEPDIR)/$(am__dirstamp) -rm -f src/x86/$(am__dirstamp) + -rm -f src/xtensa/$(DEPDIR)/$(am__dirstamp) + -rm -f src/xtensa/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive -clean-am: clean-aminfo clean-generic clean-libLTLIBRARIES \ - clean-libtool clean-noinstLTLIBRARIES mostlyclean-am +clean-am: clean-aminfo clean-generic clean-libtool \ + clean-noinstLTLIBRARIES clean-toolexeclibLTLIBRARIES \ + mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR) + -rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/metag/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags @@ -1635,8 +1791,11 @@ install-dvi-am: $(DVIS) @$(NORMAL_INSTALL) - test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)" @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -1645,22 +1804,28 @@ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ done -install-exec-am: install-libLTLIBRARIES +install-exec-am: install-toolexeclibLTLIBRARIES + +install-html: install-html-recursive install-html-am: $(HTMLS) @$(NORMAL_INSTALL) - test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)" @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ $(am__strip_dir) \ - if test -d "$$d$$p"; then \ + d2=$$d$$p; \ + if test -d "$$d2"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ - echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ - $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ + echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ else \ - list2="$$list2 $$d$$p"; \ + list2="$$list2 $$d2"; \ fi; \ done; \ test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \ @@ -1672,9 +1837,12 @@ install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) - test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)" @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \ + fi; \ for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ @@ -1692,8 +1860,7 @@ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done @$(POST_INSTALL) - @if (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + @if $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ @@ -1703,10 +1870,15 @@ else : ; fi install-man: +install-pdf: install-pdf-recursive + install-pdf-am: $(PDFS) @$(NORMAL_INSTALL) - test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)" @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -1718,8 +1890,11 @@ install-ps-am: $(PSS) @$(NORMAL_INSTALL) - test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)" @list='$(PSS)'; test -n "$(psdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -1732,7 +1907,7 @@ maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR) + -rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/metag/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-aminfo \ maintainer-clean-generic maintainer-clean-vti @@ -1751,41 +1926,39 @@ ps-am: $(PSS) uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ - uninstall-libLTLIBRARIES uninstall-pdf-am \ - uninstall-pkgconfigDATA uninstall-ps-am + uninstall-pdf-am uninstall-pkgconfigDATA uninstall-ps-am \ + uninstall-toolexeclibLTLIBRARIES .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ - ctags-recursive install-am install-strip tags-recursive + cscopelist-recursive ctags-recursive install-am install-strip \ + tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-aminfo \ - clean-generic clean-libLTLIBRARIES clean-libtool \ - clean-noinstLTLIBRARIES ctags ctags-recursive dist dist-all \ - dist-bzip2 dist-gzip dist-info dist-lzma dist-shar dist-tarZ \ - dist-xz dist-zip distcheck distclean distclean-compile \ - distclean-generic distclean-hdr distclean-libtool \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-libLTLIBRARIES \ - install-man install-pdf install-pdf-am install-pkgconfigDATA \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-aminfo maintainer-clean-generic \ - maintainer-clean-vti mostlyclean mostlyclean-aminfo \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - mostlyclean-vti pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am uninstall-dvi-am uninstall-html-am \ - uninstall-info-am uninstall-libLTLIBRARIES uninstall-pdf-am \ - uninstall-pkgconfigDATA uninstall-ps-am + clean-cscope clean-generic clean-libtool \ + clean-noinstLTLIBRARIES clean-toolexeclibLTLIBRARIES cscope \ + cscopelist cscopelist-recursive ctags ctags-recursive dist \ + dist-all dist-bzip2 dist-gzip dist-info dist-lzip dist-shar \ + dist-tarZ dist-xz dist-zip distcheck distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pkgconfigDATA install-ps \ + install-ps-am install-strip install-toolexeclibLTLIBRARIES \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti mostlyclean \ + mostlyclean-aminfo mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool mostlyclean-vti pdf pdf-am ps ps-am tags \ + tags-recursive uninstall uninstall-am uninstall-dvi-am \ + uninstall-html-am uninstall-info-am uninstall-pdf-am \ + uninstall-pkgconfigDATA uninstall-ps-am \ + uninstall-toolexeclibLTLIBRARIES -# No install-html or install-pdf support in automake yet -.PHONY: install-html install-pdf -install-html: -install-pdf: - # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/Modules/_ctypes/libffi/README b/Modules/_ctypes/libffi/README --- a/Modules/_ctypes/libffi/README +++ b/Modules/_ctypes/libffi/README @@ -1,7 +1,7 @@ Status ====== -libffi-3.0.10 was released on XXXXXXXXXX, 2010. Check the libffi web +libffi-3.0.13 was released on March 17, 2013. Check the libffi web page for updates: . @@ -43,46 +43,70 @@ For specific configuration details and testing status, please refer to the wiki page here: - http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.10 + http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.13 At the time of release, the following basic configurations have been tested: -|--------------+------------------| -| Architecture | Operating System | -|--------------+------------------| -| Alpha | Linux | -| Alpha | Tru64 | -| ARM | Linux | -| AVR32 | Linux | -| HPPA | HPUX | -| IA-64 | Linux | -| MIPS | IRIX | -| MIPS | Linux | -| MIPS64 | Linux | -| PowerPC | Linux | -| PowerPC | Mac OSX | -| PowerPC | FreeBSD | -| PowerPC64 | Linux | -| S390 | Linux | -| S390X | Linux | -| SPARC | Linux | -| SPARC | Solaris | -| SPARC64 | Linux | -| SPARC64 | FreeBSD | -| X86 | FreeBSD | -| X86 | kFreeBSD | -| X86 | Linux | -| X86 | Mac OSX | -| X86 | OpenBSD | -| X86 | Solaris | -| X86 | Windows/Cygwin | -| X86 | Windows/MingW | -| X86-64 | FreeBSD | -| X86-64 | Linux | -| X86-64 | OpenBSD | -| X86-64 | Windows/MingW | -|--------------+------------------| +|-----------------+------------------+-------------------------| +| Architecture | Operating System | Compiler | +|-----------------+------------------+-------------------------| +| AArch64 | Linux | GCC | +| Alpha | Linux | GCC | +| Alpha | Tru64 | GCC | +| ARM | Linux | GCC | +| ARM | iOS | GCC | +| AVR32 | Linux | GCC | +| Blackfin | uClinux | GCC | +| HPPA | HPUX | GCC | +| IA-64 | Linux | GCC | +| M68K | FreeMiNT | GCC | +| M68K | Linux | GCC | +| M68K | RTEMS | GCC | +| Meta | Linux | GCC | +| MicroBlaze | Linux | GCC | +| MIPS | IRIX | GCC | +| MIPS | Linux | GCC | +| MIPS | RTEMS | GCC | +| MIPS64 | Linux | GCC | +| Moxie | Bare metal | GCC +| PowerPC 32-bit | AIX | IBM XL C | +| PowerPC 64-bit | AIX | IBM XL C | +| PowerPC | AMIGA | GCC | +| PowerPC | Linux | GCC | +| PowerPC | Mac OSX | GCC | +| PowerPC | FreeBSD | GCC | +| PowerPC 64-bit | FreeBSD | GCC | +| PowerPC 64-bit | Linux | GCC | +| S390 | Linux | GCC | +| S390X | Linux | GCC | +| SPARC | Linux | GCC | +| SPARC | Solaris | GCC | +| SPARC | Solaris | Oracle Solaris Studio C | +| SPARC64 | Linux | GCC | +| SPARC64 | FreeBSD | GCC | +| SPARC64 | Solaris | Oracle Solaris Studio C | +| TILE-Gx/TILEPro | Linux | GCC | +| X86 | FreeBSD | GCC | +| X86 | GNU HURD | GCC | +| X86 | Interix | GCC | +| X86 | kFreeBSD | GCC | +| X86 | Linux | GCC | +| X86 | Mac OSX | GCC | +| X86 | OpenBSD | GCC | +| X86 | OS/2 | GCC | +| X86 | Solaris | GCC | +| X86 | Solaris | Oracle Solaris Studio C | +| X86 | Windows/Cygwin | GCC | +| X86 | Windows/MingW | GCC | +| X86-64 | FreeBSD | GCC | +| X86-64 | Linux | GCC | +| X86-64 | Linux/x32 | GCC | +| X86-64 | OpenBSD | GCC | +| X86-64 | Solaris | Oracle Solaris Studio C | +| X86-64 | Windows/MingW | GCC | +| Xtensa | Linux | GCC | +|-----------------+------------------+-------------------------| Please send additional platform test results to libffi-discuss at sourceware.org and feel free to update the wiki page @@ -113,14 +137,20 @@ Microsoft's Visual C++ compiler. In this case, use the msvcc.sh wrapper script during configuration like so: -path/to/configure --enable-shared --enable-static \ - CC=path/to/msvcc.sh LD=link \ - CPP=\"cl -nologo -EP\" +path/to/configure CC=path/to/msvcc.sh LD=link CPP=\"cl -nologo -EP\" + +For 64-bit Windows builds, use CC="path/to/msvcc.sh -m64". +You may also need to specify --build appropriately. When building with MSVC +under a MingW environment, you may need to remove the line in configure +that sets 'fix_srcfile_path' to a 'cygpath' command. ('cygpath' is not +present in MingW, and is not required when using MingW-style paths.) + +For iOS builds, the 'libffi.xcodeproj' Xcode project is available. Configure has many other options. Use "configure --help" to see them all. Once configure has finished, type "make". Note that you must be using -GNU make. You can ftp GNU make from prep.ai.mit.edu:/pub/gnu. +GNU make. You can ftp GNU make from ftp.gnu.org:/pub/gnu/make . To ensure that libffi is working as advertised, type "make check". This will require that you have DejaGNU installed. @@ -133,11 +163,53 @@ See the ChangeLog files for details. -3.0.10 ???-??-?? - Fix the N64 build on mips-sgi-irix6.5. +3.0.13 Mar-17-13 + Add Meta support. + Add missing Moxie bits. + Fix stack alignment bug on 32-bit x86. + Build fix for m68000 targets. + Build fix for soft-float Power targets. + Fix the install dir location for some platforms when building + with GCC (OS X, Solaris). + Fix Cygwin regression. + +3.0.12 Feb-11-13 + Add Moxie support. + Add AArch64 support. + Add Blackfin support. + Add TILE-Gx/TILEPro support. + Add MicroBlaze support. + Add Xtensa support. + Add support for PaX enabled kernels with MPROTECT. + Add support for native vendor compilers on + Solaris and AIX. + Work around LLVM/GCC interoperability issue on x86_64. + +3.0.11 Apr-11-12 + Lots of build fixes. + Add Amiga newer MacOS support. + Add support for variadic functions (ffi_prep_cif_var). + Add Linux/x32 support. + Add thiscall, fastcall and MSVC cdecl support on Windows. + Add Amiga and newer MacOS support. + Add m68k FreeMiNT support. + Integration with iOS' xcode build tools. + Fix Octeon and MC68881 support. + Fix code pessimizations. + +3.0.10 Aug-23-11 + Add support for Apple's iOS. + Add support for ARM VFP ABI. + Add RTEMS support for MIPS and M68K. + Fix instruction cache clearing problems on + ARM and SPARC. + Fix the N64 build on mips-sgi-irix6.5. + Enable builds with Microsoft's compiler. + Enable x86 builds with Oracle's Solaris compiler. + Fix support for calling code compiled with Oracle's Sparc + Solaris compiler. Testsuite fixes for Tru64 Unix. - Enable builds with Microsoft's compiler. - Enable x86 builds with Sun's compiler. + Additional platform support. 3.0.9 Dec-31-09 Add AVR32 and win64 ports. Add ARM softfp support. @@ -282,15 +354,19 @@ Major processor architecture ports were contributed by the following developers: +aarch64 Marcus Shawcroft, James Greenhalgh alpha Richard Henderson arm Raffaele Sena +blackfin Alexandre Keunecke I. de Mendonca cris Simon Posnjak, Hans-Peter Nilsson frv Anthony Green ia64 Hans Boehm m32r Kazuhiro Inaoka m68k Andreas Schwab +microblaze Nathan Rossi mips Anthony Green, Casey Marshall mips64 David Daney +moxie Anthony Green pa Randolph Chung, Dave Anglin, Andreas Tobler powerpc Geoffrey Keating, Andreas Tobler, David Edelsohn, John Hornkvist @@ -299,8 +375,10 @@ sh Kaz Kojima sh64 Kaz Kojima sparc Anthony Green, Gordon Irlam +tile-gx/tilepro Walter Lee x86 Anthony Green, Jon Beniston x86-64 Bo Thorsen +xtensa Chris Zankel Jesper Skov and Andrew Haley both did more than their fair share of stepping through the code and tracking down bugs. @@ -318,5 +396,6 @@ The list above is almost certainly incomplete and inaccurate. I'm happy to make corrections or additions upon request. -If you have a problem, or have found a bug, please send a note to -green at redhat.com. +If you have a problem, or have found a bug, please send a note to the +author at green at moxielogic.com, or the project mailing list at +libffi-discuss at sourceware.org. diff --git a/Modules/_ctypes/libffi/aclocal.m4 b/Modules/_ctypes/libffi/aclocal.m4 --- a/Modules/_ctypes/libffi/aclocal.m4 +++ b/Modules/_ctypes/libffi/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.11.1 -*- Autoconf -*- +# generated automatically by aclocal 1.12.2 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. + # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,28 +13,848 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],, -[m4_warning([this file was generated for autoconf 2.65. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically `autoreconf'.])]) +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- +# +# Copyright (C) 1999-2006, 2007, 2008, 2011 Free Software Foundation, Inc. +# Written by Thomas Tanner, 1999 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 18 LTDL_INIT + +# LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE]) +# ------------------------------------------ +# DIRECTORY contains the libltdl sources. It is okay to call this +# function multiple times, as long as the same DIRECTORY is always given. +AC_DEFUN([LT_CONFIG_LTDL_DIR], +[AC_BEFORE([$0], [LTDL_INIT]) +_$0($*) +])# LT_CONFIG_LTDL_DIR + +# We break this out into a separate macro, so that we can call it safely +# internally without being caught accidentally by the sed scan in libtoolize. +m4_defun([_LT_CONFIG_LTDL_DIR], +[dnl remove trailing slashes +m4_pushdef([_ARG_DIR], m4_bpatsubst([$1], [/*$])) +m4_case(_LTDL_DIR, + [], [dnl only set lt_ltdl_dir if _ARG_DIR is not simply `.' + m4_if(_ARG_DIR, [.], + [], + [m4_define([_LTDL_DIR], _ARG_DIR) + _LT_SHELL_INIT([lt_ltdl_dir=']_ARG_DIR['])])], + [m4_if(_ARG_DIR, _LTDL_DIR, + [], + [m4_fatal([multiple libltdl directories: `]_LTDL_DIR[', `]_ARG_DIR['])])]) +m4_popdef([_ARG_DIR]) +])# _LT_CONFIG_LTDL_DIR + +# Initialise: +m4_define([_LTDL_DIR], []) + + +# _LT_BUILD_PREFIX +# ---------------- +# If Autoconf is new enough, expand to `${top_build_prefix}', otherwise +# to `${top_builddir}/'. +m4_define([_LT_BUILD_PREFIX], +[m4_ifdef([AC_AUTOCONF_VERSION], + [m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.62]), + [-1], [m4_ifdef([_AC_HAVE_TOP_BUILD_PREFIX], + [${top_build_prefix}], + [${top_builddir}/])], + [${top_build_prefix}])], + [${top_builddir}/])[]dnl +]) + + +# LTDL_CONVENIENCE +# ---------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. LIBLTDL will be prefixed with +# '${top_build_prefix}' if available, otherwise with '${top_builddir}/', +# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single +# quotes!). If your package is not flat and you're not using automake, +# define top_build_prefix, top_builddir, and top_srcdir appropriately +# in your Makefiles. +AC_DEFUN([LTDL_CONVENIENCE], +[AC_BEFORE([$0], [LTDL_INIT])dnl +dnl Although the argument is deprecated and no longer documented, +dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one +dnl here make sure it is the same as any other declaration of libltdl's +dnl location! This also ensures lt_ltdl_dir is set when configure.ac is +dnl not yet using an explicit LT_CONFIG_LTDL_DIR. +m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl +_$0() +])# LTDL_CONVENIENCE + +# AC_LIBLTDL_CONVENIENCE accepted a directory argument in older libtools, +# now we have LT_CONFIG_LTDL_DIR: +AU_DEFUN([AC_LIBLTDL_CONVENIENCE], +[_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) +_LTDL_CONVENIENCE]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBLTDL_CONVENIENCE], []) + + +# _LTDL_CONVENIENCE +# ----------------- +# Code shared by LTDL_CONVENIENCE and LTDL_INIT([convenience]). +m4_defun([_LTDL_CONVENIENCE], +[case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; +esac +LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdlc.la" +LTDLDEPS=$LIBLTDL +LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" + +AC_SUBST([LIBLTDL]) +AC_SUBST([LTDLDEPS]) +AC_SUBST([LTDLINCL]) + +# For backwards non-gettext consistent compatibility... +INCLTDL="$LTDLINCL" +AC_SUBST([INCLTDL]) +])# _LTDL_CONVENIENCE + + +# LTDL_INSTALLABLE +# ---------------- +# sets LIBLTDL to the link flags for the libltdl installable library +# and LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called from here. If an installed libltdl +# is not found, LIBLTDL will be prefixed with '${top_build_prefix}' if +# available, otherwise with '${top_builddir}/', and LTDLINCL will be +# prefixed with '${top_srcdir}/' (note the single quotes!). If your +# package is not flat and you're not using automake, define top_build_prefix, +# top_builddir, and top_srcdir appropriately in your Makefiles. +# In the future, this macro may have to be called after LT_INIT. +AC_DEFUN([LTDL_INSTALLABLE], +[AC_BEFORE([$0], [LTDL_INIT])dnl +dnl Although the argument is deprecated and no longer documented, +dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one +dnl here make sure it is the same as any other declaration of libltdl's +dnl location! This also ensures lt_ltdl_dir is set when configure.ac is +dnl not yet using an explicit LT_CONFIG_LTDL_DIR. +m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl +_$0() +])# LTDL_INSTALLABLE + +# AC_LIBLTDL_INSTALLABLE accepted a directory argument in older libtools, +# now we have LT_CONFIG_LTDL_DIR: +AU_DEFUN([AC_LIBLTDL_INSTALLABLE], +[_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) +_LTDL_INSTALLABLE]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBLTDL_INSTALLABLE], []) + + +# _LTDL_INSTALLABLE +# ----------------- +# Code shared by LTDL_INSTALLABLE and LTDL_INIT([installable]). +m4_defun([_LTDL_INSTALLABLE], +[if test -f $prefix/lib/libltdl.la; then + lt_save_LDFLAGS="$LDFLAGS" + LDFLAGS="-L$prefix/lib $LDFLAGS" + AC_CHECK_LIB([ltdl], [lt_dlinit], [lt_lib_ltdl=yes]) + LDFLAGS="$lt_save_LDFLAGS" + if test x"${lt_lib_ltdl-no}" = xyes; then + if test x"$enable_ltdl_install" != xyes; then + # Don't overwrite $prefix/lib/libltdl.la without --enable-ltdl-install + AC_MSG_WARN([not overwriting libltdl at $prefix, force with `--enable-ltdl-install']) + enable_ltdl_install=no + fi + elif test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + fi +fi + +# If configure.ac declared an installable ltdl, and the user didn't override +# with --disable-ltdl-install, we will install the shipped libltdl. +case $enable_ltdl_install in + no) ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLDEPS= + LTDLINCL= + ;; + *) enable_ltdl_install=yes + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdl.la" + LTDLDEPS=$LIBLTDL + LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" + ;; +esac + +AC_SUBST([LIBLTDL]) +AC_SUBST([LTDLDEPS]) +AC_SUBST([LTDLINCL]) + +# For backwards non-gettext consistent compatibility... +INCLTDL="$LTDLINCL" +AC_SUBST([INCLTDL]) +])# LTDL_INSTALLABLE + + +# _LTDL_MODE_DISPATCH +# ------------------- +m4_define([_LTDL_MODE_DISPATCH], +[dnl If _LTDL_DIR is `.', then we are configuring libltdl itself: +m4_if(_LTDL_DIR, [], + [], + dnl if _LTDL_MODE was not set already, the default value is `subproject': + [m4_case(m4_default(_LTDL_MODE, [subproject]), + [subproject], [AC_CONFIG_SUBDIRS(_LTDL_DIR) + _LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"])], + [nonrecursive], [_LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"; lt_libobj_prefix="$lt_ltdl_dir/"])], + [recursive], [], + [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])dnl +dnl Be careful not to expand twice: +m4_define([$0], []) +])# _LTDL_MODE_DISPATCH + + +# _LT_LIBOBJ(MODULE_NAME) +# ----------------------- +# Like AC_LIBOBJ, except that MODULE_NAME goes into _LT_LIBOBJS instead +# of into LIBOBJS. +AC_DEFUN([_LT_LIBOBJ], [ + m4_pattern_allow([^_LT_LIBOBJS$]) + _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" +])# _LT_LIBOBJS + + +# LTDL_INIT([OPTIONS]) +# -------------------- +# Clients of libltdl can use this macro to allow the installer to +# choose between a shipped copy of the ltdl sources or a preinstalled +# version of the library. If the shipped ltdl sources are not in a +# subdirectory named libltdl, the directory name must be given by +# LT_CONFIG_LTDL_DIR. +AC_DEFUN([LTDL_INIT], +[dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +dnl We need to keep our own list of libobjs separate from our parent project, +dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while +dnl we look for our own LIBOBJs. +m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) +m4_pushdef([AC_LIBSOURCES]) + +dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: +m4_if(_LTDL_MODE, [], + [m4_define([_LTDL_MODE], m4_default([$2], [subproject])) + m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])], + [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])]) + +AC_ARG_WITH([included_ltdl], + [AS_HELP_STRING([--with-included-ltdl], + [use the GNU ltdl sources included here])]) + +if test "x$with_included_ltdl" != xyes; then + # We are not being forced to use the included libltdl sources, so + # decide whether there is a useful installed version we can use. + AC_CHECK_HEADER([ltdl.h], + [AC_CHECK_DECL([lt_dlinterface_register], + [AC_CHECK_LIB([ltdl], [lt_dladvise_preload], + [with_included_ltdl=no], + [with_included_ltdl=yes])], + [with_included_ltdl=yes], + [AC_INCLUDES_DEFAULT + #include ])], + [with_included_ltdl=yes], + [AC_INCLUDES_DEFAULT] + ) +fi + +dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE +dnl was called yet, then for old times' sake, we assume libltdl is in an +dnl eponymous directory: +AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])]) + +AC_ARG_WITH([ltdl_include], + [AS_HELP_STRING([--with-ltdl-include=DIR], + [use the ltdl headers installed in DIR])]) + +if test -n "$with_ltdl_include"; then + if test -f "$with_ltdl_include/ltdl.h"; then : + else + AC_MSG_ERROR([invalid ltdl include directory: `$with_ltdl_include']) + fi +else + with_ltdl_include=no +fi + +AC_ARG_WITH([ltdl_lib], + [AS_HELP_STRING([--with-ltdl-lib=DIR], + [use the libltdl.la installed in DIR])]) + +if test -n "$with_ltdl_lib"; then + if test -f "$with_ltdl_lib/libltdl.la"; then : + else + AC_MSG_ERROR([invalid ltdl library directory: `$with_ltdl_lib']) + fi +else + with_ltdl_lib=no +fi + +case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in + ,yes,no,no,) + m4_case(m4_default(_LTDL_TYPE, [convenience]), + [convenience], [_LTDL_CONVENIENCE], + [installable], [_LTDL_INSTALLABLE], + [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)]) + ;; + ,no,no,no,) + # If the included ltdl is not to be used, then use the + # preinstalled libltdl we found. + AC_DEFINE([HAVE_LTDL], [1], + [Define this if a modern libltdl is already installed]) + LIBLTDL=-lltdl + LTDLDEPS= + LTDLINCL= + ;; + ,no*,no,*) + AC_MSG_ERROR([`--with-ltdl-include' and `--with-ltdl-lib' options must be used together]) + ;; + *) with_included_ltdl=no + LIBLTDL="-L$with_ltdl_lib -lltdl" + LTDLDEPS= + LTDLINCL="-I$with_ltdl_include" + ;; +esac +INCLTDL="$LTDLINCL" + +# Report our decision... +AC_MSG_CHECKING([where to find libltdl headers]) +AC_MSG_RESULT([$LTDLINCL]) +AC_MSG_CHECKING([where to find libltdl library]) +AC_MSG_RESULT([$LIBLTDL]) + +_LTDL_SETUP + +dnl restore autoconf definition. +m4_popdef([AC_LIBOBJ]) +m4_popdef([AC_LIBSOURCES]) + +AC_CONFIG_COMMANDS_PRE([ + _ltdl_libobjs= + _ltdl_ltlibobjs= + if test -n "$_LT_LIBOBJS"; then + # Remove the extension. + _lt_sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed "$_lt_sed_drop_objext" | sort -u`; do + _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext" + _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo" + done + fi + AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs]) + AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs]) +]) + +# Only expand once: +m4_define([LTDL_INIT]) +])# LTDL_INIT + +# Old names: +AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)]) +AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)]) +AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIB_LTDL], []) +dnl AC_DEFUN([AC_WITH_LTDL], []) +dnl AC_DEFUN([LT_WITH_LTDL], []) + + +# _LTDL_SETUP +# ----------- +# Perform all the checks necessary for compilation of the ltdl objects +# -- including compiler checks and header checks. This is a public +# interface mainly for the benefit of libltdl's own configure.ac, most +# other users should call LTDL_INIT instead. +AC_DEFUN([_LTDL_SETUP], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_SYS_MODULE_EXT])dnl +AC_REQUIRE([LT_SYS_MODULE_PATH])dnl +AC_REQUIRE([LT_SYS_DLSEARCH_PATH])dnl +AC_REQUIRE([LT_LIB_DLLOAD])dnl +AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl +AC_REQUIRE([LT_FUNC_DLSYM_USCORE])dnl +AC_REQUIRE([LT_SYS_DLOPEN_DEPLIBS])dnl +AC_REQUIRE([gl_FUNC_ARGZ])dnl + +m4_require([_LT_CHECK_OBJDIR])dnl +m4_require([_LT_HEADER_DLFCN])dnl +m4_require([_LT_CHECK_DLPREOPEN])dnl +m4_require([_LT_DECL_SED])dnl + +dnl Don't require this, or it will be expanded earlier than the code +dnl that sets the variables it relies on: +_LT_ENABLE_INSTALL + +dnl _LTDL_MODE specific code must be called at least once: +_LTDL_MODE_DISPATCH + +# In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS +# the user used. This is so that ltdl.h can pick up the parent projects +# config.h file, The first file in AC_CONFIG_HEADERS must contain the +# definitions required by ltdl.c. +# FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility). +AC_CONFIG_COMMANDS_PRE([dnl +m4_pattern_allow([^LT_CONFIG_H$])dnl +m4_ifset([AH_HEADER], + [LT_CONFIG_H=AH_HEADER], + [m4_ifset([AC_LIST_HEADERS], + [LT_CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's,^[[ ]]*,,;s,[[ :]].*$,,'`], + [])])]) +AC_SUBST([LT_CONFIG_H]) + +AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], + [], [], [AC_INCLUDES_DEFAULT]) + +AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) +AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) + +m4_pattern_allow([LT_LIBEXT])dnl +AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) + +name= +eval "lt_libprefix=\"$libname_spec\"" +m4_pattern_allow([LT_LIBPREFIX])dnl +AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix]) + +name=ltdl +eval "LTDLOPEN=\"$libname_spec\"" +AC_SUBST([LTDLOPEN]) +])# _LTDL_SETUP + + +# _LT_ENABLE_INSTALL +# ------------------ +m4_define([_LT_ENABLE_INSTALL], +[AC_ARG_ENABLE([ltdl-install], + [AS_HELP_STRING([--enable-ltdl-install], [install libltdl])]) + +case ,${enable_ltdl_install},${enable_ltdl_convenience} in + *yes*) ;; + *) enable_ltdl_convenience=yes ;; +esac + +m4_ifdef([AM_CONDITIONAL], +[AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno) + AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)]) +])# _LT_ENABLE_INSTALL + + +# LT_SYS_DLOPEN_DEPLIBS +# --------------------- +AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_CACHE_CHECK([whether deplibs are loaded by dlopen], + [lt_cv_sys_dlopen_deplibs], + [# PORTME does your system automatically load deplibs for dlopen? + # or its logical equivalent (e.g. shl_load for HP-UX < 11) + # For now, we just catch OSes we know something about -- in the + # future, we'll try test this programmatically. + lt_cv_sys_dlopen_deplibs=unknown + case $host_os in + aix3*|aix4.1.*|aix4.2.*) + # Unknown whether this is true for these versions of AIX, but + # we want this `case' here to explicitly catch those versions. + lt_cv_sys_dlopen_deplibs=unknown + ;; + aix[[4-9]]*) + lt_cv_sys_dlopen_deplibs=yes + ;; + amigaos*) + case $host_cpu in + powerpc) + lt_cv_sys_dlopen_deplibs=no + ;; + esac + ;; + darwin*) + # Assuming the user has installed a libdl from somewhere, this is true + # If you are looking for one http://www.opendarwin.org/projects/dlcompat + lt_cv_sys_dlopen_deplibs=yes + ;; + freebsd* | dragonfly*) + lt_cv_sys_dlopen_deplibs=yes + ;; + gnu* | linux* | k*bsd*-gnu | kopensolaris*-gnu) + # GNU and its variants, using gnu ld.so (Glibc) + lt_cv_sys_dlopen_deplibs=yes + ;; + hpux10*|hpux11*) + lt_cv_sys_dlopen_deplibs=yes + ;; + interix*) + lt_cv_sys_dlopen_deplibs=yes + ;; + irix[[12345]]*|irix6.[[01]]*) + # Catch all versions of IRIX before 6.2, and indicate that we don't + # know how it worked for any of those versions. + lt_cv_sys_dlopen_deplibs=unknown + ;; + irix*) + # The case above catches anything before 6.2, and it's known that + # at 6.2 and later dlopen does load deplibs. + lt_cv_sys_dlopen_deplibs=yes + ;; + netbsd*) + lt_cv_sys_dlopen_deplibs=yes + ;; + openbsd*) + lt_cv_sys_dlopen_deplibs=yes + ;; + osf[[1234]]*) + # dlopen did load deplibs (at least at 4.x), but until the 5.x series, + # it did *not* use an RPATH in a shared library to find objects the + # library depends on, so we explicitly say `no'. + lt_cv_sys_dlopen_deplibs=no + ;; + osf5.0|osf5.0a|osf5.1) + # dlopen *does* load deplibs and with the right loader patch applied + # it even uses RPATH in a shared library to search for shared objects + # that the library depends on, but there's no easy way to know if that + # patch is installed. Since this is the case, all we can really + # say is unknown -- it depends on the patch being installed. If + # it is, this changes to `yes'. Without it, it would be `no'. + lt_cv_sys_dlopen_deplibs=unknown + ;; + osf*) + # the two cases above should catch all versions of osf <= 5.1. Read + # the comments above for what we know about them. + # At > 5.1, deplibs are loaded *and* any RPATH in a shared library + # is used to find them so we can finally say `yes'. + lt_cv_sys_dlopen_deplibs=yes + ;; + qnx*) + lt_cv_sys_dlopen_deplibs=yes + ;; + solaris*) + lt_cv_sys_dlopen_deplibs=yes + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + esac + ]) +if test "$lt_cv_sys_dlopen_deplibs" != yes; then + AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], + [Define if the OS needs help to load dependent libraries for dlopen().]) +fi +])# LT_SYS_DLOPEN_DEPLIBS + +# Old name: +AU_ALIAS([AC_LTDL_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], []) + + +# LT_SYS_MODULE_EXT +# ----------------- +AC_DEFUN([LT_SYS_MODULE_EXT], +[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([which extension is used for runtime loadable modules], + [libltdl_cv_shlibext], +[ +module=yes +eval libltdl_cv_shlibext=$shrext_cmds +module=no +eval libltdl_cv_shrext=$shrext_cmds + ]) +if test -n "$libltdl_cv_shlibext"; then + m4_pattern_allow([LT_MODULE_EXT])dnl + AC_DEFINE_UNQUOTED([LT_MODULE_EXT], ["$libltdl_cv_shlibext"], + [Define to the extension used for runtime loadable modules, say, ".so".]) +fi +if test "$libltdl_cv_shrext" != "$libltdl_cv_shlibext"; then + m4_pattern_allow([LT_SHARED_EXT])dnl + AC_DEFINE_UNQUOTED([LT_SHARED_EXT], ["$libltdl_cv_shrext"], + [Define to the shared library suffix, say, ".dylib".]) +fi +])# LT_SYS_MODULE_EXT + +# Old name: +AU_ALIAS([AC_LTDL_SHLIBEXT], [LT_SYS_MODULE_EXT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SHLIBEXT], []) + + +# LT_SYS_MODULE_PATH +# ------------------ +AC_DEFUN([LT_SYS_MODULE_PATH], +[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([which variable specifies run-time module search path], + [lt_cv_module_path_var], [lt_cv_module_path_var="$shlibpath_var"]) +if test -n "$lt_cv_module_path_var"; then + m4_pattern_allow([LT_MODULE_PATH_VAR])dnl + AC_DEFINE_UNQUOTED([LT_MODULE_PATH_VAR], ["$lt_cv_module_path_var"], + [Define to the name of the environment variable that determines the run-time module search path.]) +fi +])# LT_SYS_MODULE_PATH + +# Old name: +AU_ALIAS([AC_LTDL_SHLIBPATH], [LT_SYS_MODULE_PATH]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SHLIBPATH], []) + + +# LT_SYS_DLSEARCH_PATH +# -------------------- +AC_DEFUN([LT_SYS_DLSEARCH_PATH], +[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([for the default library search path], + [lt_cv_sys_dlsearch_path], + [lt_cv_sys_dlsearch_path="$sys_lib_dlsearch_path_spec"]) +if test -n "$lt_cv_sys_dlsearch_path"; then + sys_dlsearch_path= + for dir in $lt_cv_sys_dlsearch_path; do + if test -z "$sys_dlsearch_path"; then + sys_dlsearch_path="$dir" + else + sys_dlsearch_path="$sys_dlsearch_path$PATH_SEPARATOR$dir" + fi + done + m4_pattern_allow([LT_DLSEARCH_PATH])dnl + AC_DEFINE_UNQUOTED([LT_DLSEARCH_PATH], ["$sys_dlsearch_path"], + [Define to the system default library search path.]) +fi +])# LT_SYS_DLSEARCH_PATH + +# Old name: +AU_ALIAS([AC_LTDL_SYSSEARCHPATH], [LT_SYS_DLSEARCH_PATH]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SYSSEARCHPATH], []) + + +# _LT_CHECK_DLPREOPEN +# ------------------- +m4_defun([_LT_CHECK_DLPREOPEN], +[m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen], + [libltdl_cv_preloaded_symbols], + [if test -n "$lt_cv_sys_global_symbol_pipe"; then + libltdl_cv_preloaded_symbols=yes + else + libltdl_cv_preloaded_symbols=no + fi + ]) +if test x"$libltdl_cv_preloaded_symbols" = xyes; then + AC_DEFINE([HAVE_PRELOADED_SYMBOLS], [1], + [Define if libtool can extract symbol lists from object files.]) +fi +])# _LT_CHECK_DLPREOPEN + + +# LT_LIB_DLLOAD +# ------------- +AC_DEFUN([LT_LIB_DLLOAD], +[m4_pattern_allow([^LT_DLLOADERS$]) +LT_DLLOADERS= +AC_SUBST([LT_DLLOADERS]) + +AC_LANG_PUSH([C]) + +LIBADD_DLOPEN= +AC_SEARCH_LIBS([dlopen], [dl], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + if test "$ac_cv_search_dlopen" != "none required" ; then + LIBADD_DLOPEN="-ldl" + fi + libltdl_cv_lib_dl_dlopen="yes" + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H +# include +#endif + ]], [[dlopen(0, 0);]])], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + libltdl_cv_func_dlopen="yes" + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], + [AC_CHECK_LIB([svld], [dlopen], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + LIBADD_DLOPEN="-lsvld" libltdl_cv_func_dlopen="yes" + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"])])]) +if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes +then + lt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBADD_DLOPEN" + AC_CHECK_FUNCS([dlerror]) + LIBS="$lt_save_LIBS" +fi +AC_SUBST([LIBADD_DLOPEN]) + +LIBADD_SHL_LOAD= +AC_CHECK_FUNC([shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"], + [AC_CHECK_LIB([dld], [shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" + LIBADD_SHL_LOAD="-ldld"])]) +AC_SUBST([LIBADD_SHL_LOAD]) + +case $host_os in +darwin[[1567]].*) +# We only want this for pre-Mac OS X 10.4. + AC_CHECK_FUNC([_dyld_func_lookup], + [AC_DEFINE([HAVE_DYLD], [1], + [Define if you have the _dyld_func_lookup function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la"]) + ;; +beos*) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" + ;; +cygwin* | mingw* | os2* | pw32*) + AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include ]]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" + ;; +esac + +AC_CHECK_LIB([dld], [dld_link], + [AC_DEFINE([HAVE_DLD], [1], + [Define if you have the GNU dld library.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la"]) +AC_SUBST([LIBADD_DLD_LINK]) + +m4_pattern_allow([^LT_DLPREOPEN$]) +LT_DLPREOPEN= +if test -n "$LT_DLLOADERS" +then + for lt_loader in $LT_DLLOADERS; do + LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " + done + AC_DEFINE([HAVE_LIBDLLOADER], [1], + [Define if libdlloader will be built on this platform]) +fi +AC_SUBST([LT_DLPREOPEN]) + +dnl This isn't used anymore, but set it for backwards compatibility +LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" +AC_SUBST([LIBADD_DL]) + +AC_LANG_POP +])# LT_LIB_DLLOAD + +# Old name: +AU_ALIAS([AC_LTDL_DLLIB], [LT_LIB_DLLOAD]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_DLLIB], []) + + +# LT_SYS_SYMBOL_USCORE +# -------------------- +# does the compiler prefix global symbols with an underscore? +AC_DEFUN([LT_SYS_SYMBOL_USCORE], +[m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +AC_CACHE_CHECK([for _ prefix in compiled symbols], + [lt_cv_sys_symbol_underscore], + [lt_cv_sys_symbol_underscore=no + cat > conftest.$ac_ext <<_LT_EOF +void nm_test_func(){} +int main(){nm_test_func;return 0;} +_LT_EOF + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + ac_nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then + # See whether the symbols have a leading underscore. + if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then + lt_cv_sys_symbol_underscore=yes + else + if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then + : + else + echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD + fi + fi + else + echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.c >&AS_MESSAGE_LOG_FD + fi + rm -rf conftest* + ]) + sys_symbol_underscore=$lt_cv_sys_symbol_underscore + AC_SUBST([sys_symbol_underscore]) +])# LT_SYS_SYMBOL_USCORE + +# Old name: +AU_ALIAS([AC_LTDL_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SYMBOL_USCORE], []) + + +# LT_FUNC_DLSYM_USCORE +# -------------------- +AC_DEFUN([LT_FUNC_DLSYM_USCORE], +[AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl +if test x"$lt_cv_sys_symbol_underscore" = xyes; then + if test x"$libltdl_cv_func_dlopen" = xyes || + test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then + AC_CACHE_CHECK([whether we have to add an underscore for dlsym], + [libltdl_cv_need_uscore], + [libltdl_cv_need_uscore=unknown + save_LIBS="$LIBS" + LIBS="$LIBS $LIBADD_DLOPEN" + _LT_TRY_DLOPEN_SELF( + [libltdl_cv_need_uscore=no], [libltdl_cv_need_uscore=yes], + [], [libltdl_cv_need_uscore=cross]) + LIBS="$save_LIBS" + ]) + fi +fi + +if test x"$libltdl_cv_need_uscore" = xyes; then + AC_DEFINE([NEED_USCORE], [1], + [Define if dlsym() requires a leading underscore in symbol names.]) +fi +])# LT_FUNC_DLSYM_USCORE + +# Old name: +AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], []) + +# Copyright (C) 2002-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 8 + # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.11' +[am__api_version='1.12' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.1], [], +m4_if([$1], [1.12.2], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -50,14 +870,14 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.1])dnl +[AM_AUTOMAKE_VERSION([1.12.2])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # Figure out how to run the assembler. -*- Autoconf -*- -# Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -79,15 +899,17 @@ # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 2 + # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and @@ -106,7 +928,7 @@ # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you +# harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, @@ -132,22 +954,21 @@ # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1997-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 9 +# serial 10 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl @@ -166,16 +987,15 @@ Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 -# Free Software Foundation, Inc. +# Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 10 +# serial 17 -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing @@ -185,7 +1005,7 @@ # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was @@ -198,12 +1018,13 @@ AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], UPC, [depcc="$UPC" am_compiler_list=], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], @@ -211,8 +1032,9 @@ # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -251,16 +1073,16 @@ : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -269,16 +1091,16 @@ test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -326,7 +1148,7 @@ # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl @@ -336,28 +1158,34 @@ # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors]) +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' + am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -#serial 5 +# serial 6 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ @@ -376,7 +1204,7 @@ # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but + # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. @@ -388,21 +1216,19 @@ continue fi # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` @@ -420,7 +1246,7 @@ # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will +# is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], @@ -430,14 +1256,13 @@ # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 16 +# serial 19 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. @@ -483,31 +1308,41 @@ # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl +[AC_DIAGNOSE([obsolete], +[$0: two- and three-arguments forms are deprecated. For more info, see: +http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AM_PROG_MKDIR_P])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl @@ -518,28 +1353,35 @@ [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES(OBJC)], - [define([AC_PROG_OBJC], - defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +dnl Support for Objective C++ was only introduced in Autoconf 2.65, +dnl but we still cater to Autoconf 2.62. +m4_ifdef([AC_PROG_OBJCXX], +[AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl -dnl The `parallel-tests' driver may need to know about EXEEXT, so add the -dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) -dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], @@ -567,12 +1409,14 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 8 + # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. @@ -586,9 +1430,9 @@ install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi -AC_SUBST(install_sh)]) +AC_SUBST([install_sh])]) -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2003-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -612,20 +1456,19 @@ # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 5 +# serial 7 # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. -# Default is to disable them, unless `enable' is passed literally. -# For symmetry, `disable' may be passed as well. Anyway, the user +# Default is to disable them, unless 'enable' is passed literally. +# For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), @@ -633,13 +1476,14 @@ [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t at _MAINTAINER_MODE: $1])]) -AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], -[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - [USE_MAINTAINER_MODE=$enableval], - [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], + am_maintainer_other[ make rules and dependencies not useful + (and sometimes confusing) to the casual installer])], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE @@ -651,13 +1495,13 @@ # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 4 +# serial 5 # AM_MAKE_INCLUDE() # ----------------- @@ -676,7 +1520,7 @@ _am_result=none # First try GNU make style include. echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. +# Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include @@ -701,8 +1545,7 @@ rm -f confinc confmf ]) -# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -738,14 +1581,13 @@ # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1997-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 6 +# serial 7 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -775,45 +1617,19 @@ am_missing_run="$MISSING --run " else am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) + AC_MSG_WARN(['missing' script is too old or missing]) fi ]) -# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 4 +# serial 6 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -821,13 +1637,13 @@ [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) -# ------------------------------ +# -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- +# ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) @@ -840,22 +1656,18 @@ # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 5 +# serial 9 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -866,32 +1678,40 @@ esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac -# Do `set' in a subshell so we don't clobber the current shell's +# Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done test "$[2]" = conftest.file ) then @@ -901,43 +1721,61 @@ AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi -AC_MSG_RESULT(yes)]) +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 2 + # AM_PROG_INSTALL_STRIP # --------------------- -# One issue with vendor `install' (even GNU) is that you can't +# One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize +# always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# Copyright (C) 2006-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 2 +# serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- @@ -946,24 +1784,24 @@ AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- +# -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 2004-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 2 +# serial 3 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory @@ -974,10 +1812,11 @@ # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) @@ -985,7 +1824,7 @@ _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. +# Solaris sh will not grok spaces in the rhs of '-'. for _am_tool in $_am_tools do case $_am_tool in @@ -1046,6 +1885,16 @@ AC_SUBST([am__untar]) ]) # _AM_PROG_TAR +m4_include([m4/asmcfi.m4]) +m4_include([m4/ax_append_flag.m4]) +m4_include([m4/ax_cc_maxopt.m4]) +m4_include([m4/ax_cflags_warn_all.m4]) +m4_include([m4/ax_check_compile_flag.m4]) +m4_include([m4/ax_compiler_vendor.m4]) +m4_include([m4/ax_configure_args.m4]) +m4_include([m4/ax_enable_builddir.m4]) +m4_include([m4/ax_gcc_archflag.m4]) +m4_include([m4/ax_gcc_x86_cpuid.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) diff --git a/Modules/_ctypes/libffi/build-ios.sh b/Modules/_ctypes/libffi/build-ios.sh new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/build-ios.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +PLATFORM_IOS=/Developer/Platforms/iPhoneOS.platform/ +PLATFORM_IOS_SIM=/Developer/Platforms/iPhoneSimulator.platform/ +SDK_IOS_VERSION="4.2" +MIN_IOS_VERSION="3.0" +OUTPUT_DIR="universal-ios" + +build_target () { + local platform=$1 + local sdk=$2 + local arch=$3 + local triple=$4 + local builddir=$5 + + mkdir -p "${builddir}" + pushd "${builddir}" + export CC="${platform}"/Developer/usr/bin/gcc-4.2 + export CFLAGS="-arch ${arch} -isysroot ${sdk} -miphoneos-version-min=${MIN_IOS_VERSION}" + ../configure --host=${triple} && make + popd +} + +# Build all targets +build_target "${PLATFORM_IOS}" "${PLATFORM_IOS}/Developer/SDKs/iPhoneOS${SDK_IOS_VERSION}.sdk/" armv6 arm-apple-darwin10 armv6-ios +build_target "${PLATFORM_IOS}" "${PLATFORM_IOS}/Developer/SDKs/iPhoneOS${SDK_IOS_VERSION}.sdk/" armv7 arm-apple-darwin10 armv7-ios +build_target "${PLATFORM_IOS_SIM}" "${PLATFORM_IOS_SIM}/Developer/SDKs/iPhoneSimulator${SDK_IOS_VERSION}.sdk/" i386 i386-apple-darwin10 i386-ios-sim + +# Create universal output directories +mkdir -p "${OUTPUT_DIR}" +mkdir -p "${OUTPUT_DIR}/include" +mkdir -p "${OUTPUT_DIR}/include/armv6" +mkdir -p "${OUTPUT_DIR}/include/armv7" +mkdir -p "${OUTPUT_DIR}/include/i386" + +# Create the universal binary +lipo -create armv6-ios/.libs/libffi.a armv7-ios/.libs/libffi.a i386-ios-sim/.libs/libffi.a -output "${OUTPUT_DIR}/libffi.a" + +# Copy in the headers +copy_headers () { + local src=$1 + local dest=$2 + + # Fix non-relative header reference + sed 's//"ffitarget.h"/' < "${src}/include/ffi.h" > "${dest}/ffi.h" + cp "${src}/include/ffitarget.h" "${dest}" +} + +copy_headers armv6-ios "${OUTPUT_DIR}/include/armv6" +copy_headers armv7-ios "${OUTPUT_DIR}/include/armv7" +copy_headers i386-ios-sim "${OUTPUT_DIR}/include/i386" + +# Create top-level header +( +cat << EOF +#ifdef __arm__ + #include + #ifdef _ARM_ARCH_6 + #include "include/armv6/ffi.h" + #elif _ARM_ARCH_7 + #include "include/armv7/ffi.h" + #endif +#elif defined(__i386__) + #include "include/i386/ffi.h" +#endif +EOF +) > "${OUTPUT_DIR}/ffi.h" diff --git a/Modules/_ctypes/libffi/compile b/Modules/_ctypes/libffi/compile --- a/Modules/_ctypes/libffi/compile +++ b/Modules/_ctypes/libffi/compile @@ -1,9 +1,10 @@ #! /bin/sh # Wrapper for compilers which do not understand `-c -o'. -scriptversion=2005-05-14.22 +scriptversion=2009-10-06.20; # UTC -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software +# Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -17,8 +18,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -103,13 +103,13 @@ fi # Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. -# Note: use `[/.-]' here to ensure that we don't use the same name +# Note: use `[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break @@ -124,9 +124,9 @@ ret=$? if test -f "$cofile"; then - mv "$cofile" "$ofile" + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then - mv "${cofile}bj" "$ofile" + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" @@ -138,5 +138,6 @@ # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: diff --git a/Modules/_ctypes/libffi/config.guess b/Modules/_ctypes/libffi/config.guess --- a/Modules/_ctypes/libffi/config.guess +++ b/Modules/_ctypes/libffi/config.guess @@ -1,14 +1,14 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 -# Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012, 2013 Free Software Foundation, Inc. -timestamp='2009-11-19' +timestamp='2012-12-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -17,26 +17,22 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches at gnu.org. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -56,8 +52,9 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -144,7 +141,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -180,7 +177,7 @@ fi ;; *) - os=netbsd + os=netbsd ;; esac # The OS release @@ -201,6 +198,10 @@ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} @@ -223,7 +224,7 @@ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on @@ -269,7 +270,10 @@ # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -295,12 +299,12 @@ echo s390-ibm-zvmoe exit ;; *:OS400:*:*) - echo powerpc-ibm-os400 + echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -333,6 +337,9 @@ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" @@ -391,23 +398,23 @@ # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; @@ -477,8 +484,8 @@ echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ @@ -491,7 +498,7 @@ else echo i586-dg-dgux${UNAME_RELEASE} fi - exit ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; @@ -548,7 +555,7 @@ echo rs6000-ibm-aix3.2 fi exit ;; - *:AIX:*:[456]) + *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 @@ -591,52 +598,52 @@ 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac + esac ;; + esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >$dummy.c - #define _HPUX_SOURCE - #include - #include + #define _HPUX_SOURCE + #include + #include - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa @@ -727,22 +734,22 @@ exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; @@ -766,14 +773,14 @@ exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} @@ -785,30 +792,35 @@ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) - case ${UNAME_MACHINE} in + case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; @@ -854,6 +866,13 @@ i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -863,7 +882,7 @@ EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; - esac + esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} @@ -875,20 +894,29 @@ then echo ${UNAME_MACHINE}-unknown-linux-gnu else - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu @@ -930,7 +958,7 @@ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) - echo or32-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu @@ -956,7 +984,7 @@ echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu @@ -964,14 +992,17 @@ sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -980,11 +1011,11 @@ echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. + # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) @@ -1016,7 +1047,7 @@ fi exit ;; i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; @@ -1044,13 +1075,13 @@ exit ;; pc:*:*:*) # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp - exit ;; + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; @@ -1085,8 +1116,8 @@ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ @@ -1129,10 +1160,10 @@ echo ns32k-sni-sysv fi exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm @@ -1158,11 +1189,11 @@ exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-unknown-sysv${UNAME_RELEASE} fi - exit ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; @@ -1175,6 +1206,9 @@ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1227,7 +1261,10 @@ *:QNX:*:4*) echo i386-pc-qnx exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1272,13 +1309,13 @@ echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} + echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; @@ -1296,11 +1333,11 @@ i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - eval $set_cc_for_build cat >$dummy.c < printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else - "" + "" #endif - ); exit (0); + ); exit (0); #endif #endif diff --git a/Modules/_ctypes/libffi/config.sub b/Modules/_ctypes/libffi/config.sub --- a/Modules/_ctypes/libffi/config.sub +++ b/Modules/_ctypes/libffi/config.sub @@ -1,38 +1,33 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 -# Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012, 2013 Free Software Foundation, Inc. -timestamp='2009-11-07' +timestamp='2012-12-29' -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches with a ChangeLog entry to config-patches at gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -75,8 +70,9 @@ version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -123,13 +119,18 @@ # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] @@ -152,12 +153,12 @@ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; - -bluegene*) - os=-cnk + -bluegene*) + os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= @@ -173,10 +174,10 @@ os=-chorusos basic_machine=$1 ;; - -chorusrdb) - os=-chorusrdb + -chorusrdb) + os=-chorusrdb basic_machine=$1 - ;; + ;; -hiux*) os=-hiuxwe2 ;; @@ -221,6 +222,12 @@ -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -245,20 +252,27 @@ # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ + | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | arc \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ + | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -281,29 +295,39 @@ | moxie \ | mt \ | msp430 \ + | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ + | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ - | rx \ + | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ - | v850 | v850e \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) - # Motorola 68HC11/12. + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -313,6 +337,21 @@ basic_machine=mt-unknown ;; + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. @@ -327,25 +366,30 @@ # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ + | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | be32-* | be64-* \ | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -367,25 +411,29 @@ | mmix-* \ | mt-* \ | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ - | romp-* | rs6000-* | rx-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ | tron-* \ | ubicom32-* \ - | v850-* | v850e-* | vax-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) @@ -410,7 +458,7 @@ basic_machine=a29k-amd os=-udi ;; - abacus) + abacus) basic_machine=abacus-unknown ;; adobe68k) @@ -480,11 +528,20 @@ basic_machine=powerpc-ibm os=-cnk ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; c90) basic_machine=c90-cray os=-unicos ;; - cegcc) + cegcc) basic_machine=arm-unknown os=-cegcc ;; @@ -516,7 +573,7 @@ basic_machine=craynv-cray os=-unicosmp ;; - cr16) + cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; @@ -674,7 +731,6 @@ i370-ibm* | ibm*) basic_machine=i370-ibm ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 @@ -732,9 +788,13 @@ basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze*) basic_machine=microblaze-xilinx ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) basic_machine=i386-pc os=-mingw32 @@ -771,10 +831,18 @@ ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; + msys) + basic_machine=i386-pc + os=-msys + ;; mvs) basic_machine=i370-ibm os=-mvs ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 @@ -839,6 +907,12 @@ np1) basic_machine=np1-gould ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -921,9 +995,10 @@ ;; power) basic_machine=power-ibm ;; - ppc) basic_machine=powerpc-unknown + ppc | ppcbe) basic_machine=powerpc-unknown ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown @@ -948,7 +1023,11 @@ basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1017,6 +1096,9 @@ basic_machine=i860-stratus os=-sysv4 ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; sun2) basic_machine=m68000-sun ;; @@ -1073,20 +1155,8 @@ basic_machine=t90-cray os=-unicos ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; tile*) - basic_machine=tile-unknown + basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) @@ -1156,6 +1226,9 @@ xps | xps100) basic_machine=xps100-honeywell ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; ymp) basic_machine=ymp-cray os=-unicos @@ -1253,9 +1326,12 @@ if [ x"$os" != x"" ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases + # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; @@ -1277,21 +1353,22 @@ # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -kopensolaris* \ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ @@ -1338,7 +1415,7 @@ -opened*) os=-openedition ;; - -os400*) + -os400*) os=-os400 ;; -wince*) @@ -1387,7 +1464,7 @@ -sinix*) os=-sysv4 ;; - -tpf*) + -tpf*) os=-tpf ;; -triton*) @@ -1432,6 +1509,8 @@ -dicos*) os=-dicos ;; + -nacl*) + ;; -none) ;; *) @@ -1454,10 +1533,10 @@ # system, and we'll never get to this point. case $basic_machine in - score-*) + score-*) os=-elf ;; - spu-*) + spu-*) os=-elf ;; *-acorn) @@ -1469,8 +1548,20 @@ arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff + c4x-* | tic4x-*) + os=-coff + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff ;; # This must come before the *-dec entry. pdp10-*) @@ -1490,14 +1581,11 @@ ;; m68000-sun) os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 ;; m68*-cisco) os=-aout ;; - mep-*) + mep-*) os=-elf ;; mips*-cisco) @@ -1524,7 +1612,7 @@ *-ibm) os=-aix ;; - *-knuth) + *-knuth) os=-mmixware ;; *-wec) diff --git a/Modules/_ctypes/libffi/configure b/Modules/_ctypes/libffi/configure --- a/Modules/_ctypes/libffi/configure +++ b/Modules/_ctypes/libffi/configure @@ -1,13 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for libffi 3.0.10rc0. +# Generated by GNU Autoconf 2.69 for libffi 3.0.13. # -# Report bugs to . +# Report bugs to . # # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -91,6 +89,7 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -135,6 +134,31 @@ # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -168,11 +192,20 @@ else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes @@ -213,14 +246,25 @@ if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -231,8 +275,8 @@ $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf at gnu.org and -$0: http://gcc.gnu.org/bugs.html about your system, -$0: including any error possibly output before this +$0: http://github.com/atgreen/libffi/issues about your +$0: system, including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi @@ -319,10 +363,18 @@ test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -359,19 +411,19 @@ fi # as_fn_arith -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 - fi - $as_echo "$as_me: error: $1" >&2 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -444,6 +496,10 @@ chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -478,16 +534,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -499,28 +555,8 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -528,161 +564,14 @@ # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} -case X$lt_ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` - ;; -esac - -ECHO=${lt_ECHO-echo} -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<_LT_EOF -$* -_LT_EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$lt_ECHO"; then - if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if { echo_test_string=`eval $cmd`; } 2>/dev/null && - { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null - then - break - fi - done - fi - - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : - else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$ECHO" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - ECHO='print -r' - elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - ECHO='printf %s\n' - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - ECHO="$CONFIG_SHELL $0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - ECHO=echo - fi - fi - fi - fi - fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -lt_ECHO=$ECHO -if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then - lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" -fi - - - test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -701,9 +590,9 @@ # Identity of this package. PACKAGE_NAME='libffi' PACKAGE_TARNAME='libffi' -PACKAGE_VERSION='3.0.10rc0' -PACKAGE_STRING='libffi 3.0.10rc0' -PACKAGE_BUGREPORT='http://gcc.gnu.org/bugs.html' +PACKAGE_VERSION='3.0.13' +PACKAGE_STRING='libffi 3.0.13' +PACKAGE_BUGREPORT='http://github.com/atgreen/libffi/issues' PACKAGE_URL='' # Factoring default headers for most tests. @@ -748,10 +637,20 @@ LIBOBJS toolexeclibdir toolexecdir +FFI_DEBUG_FALSE +FFI_DEBUG_TRUE TARGETDIR TARGET +FFI_EXEC_TRAMPOLINE_TABLE +FFI_EXEC_TRAMPOLINE_TABLE_FALSE +FFI_EXEC_TRAMPOLINE_TABLE_TRUE +sys_symbol_underscore HAVE_LONG_DOUBLE ALLOCA +XTENSA_FALSE +XTENSA_TRUE +TILE_FALSE +TILE_TRUE PA64_HPUX_FALSE PA64_HPUX_TRUE PA_HPUX_FALSE @@ -774,6 +673,8 @@ AVR32_TRUE ARM_FALSE ARM_TRUE +AARCH64_FALSE +AARCH64_TRUE POWERPC_FREEBSD_FALSE POWERPC_FREEBSD_TRUE POWERPC_DARWIN_FALSE @@ -782,6 +683,12 @@ POWERPC_AIX_TRUE POWERPC_FALSE POWERPC_TRUE +MOXIE_FALSE +MOXIE_TRUE +METAG_FALSE +METAG_TRUE +MICROBLAZE_FALSE +MICROBLAZE_TRUE M68K_FALSE M68K_TRUE M32R_FALSE @@ -802,6 +709,8 @@ X86_TRUE SPARC_FALSE SPARC_TRUE +BFIN_FALSE +BFIN_TRUE MIPS_FALSE MIPS_TRUE AM_LTLDFLAGS @@ -811,15 +720,18 @@ MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE +PRTDIAG CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL -lt_ECHO +MANIFEST_TOOL RANLIB +ac_ct_AR AR +DLLTOOL OBJDUMP LN_S NM @@ -839,6 +751,7 @@ am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE +am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE @@ -875,6 +788,7 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM +ax_enable_builddir_sed target_os target_vendor target_cpu @@ -928,14 +842,19 @@ ac_subst_files='' ac_user_opts=' enable_option_checking +enable_builddir enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_gnu_ld +with_sysroot enable_libtool_lock +enable_portable_binary +with_gcc_arch enable_maintainer_mode +enable_pax_emutramp enable_debug enable_structs enable_raw_api @@ -1010,8 +929,9 @@ fi case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -1056,7 +976,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1082,7 +1002,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1286,7 +1206,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1302,7 +1222,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1332,8 +1252,8 @@ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information." + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) @@ -1341,7 +1261,7 @@ # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error "invalid variable name: \`$ac_envvar'" ;; + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1351,7 +1271,7 @@ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1359,13 +1279,13 @@ if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error "missing argument to $ac_option" + as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1388,7 +1308,7 @@ [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1402,8 +1322,6 @@ if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1418,9 +1336,9 @@ ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error "working directory cannot be determined" + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error "pwd does not report name of working directory" + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. @@ -1459,11 +1377,11 @@ fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1489,7 +1407,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libffi 3.0.10rc0 to adapt to many kinds of systems. +\`configure' configures libffi 3.0.13 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1503,7 +1421,7 @@ --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files @@ -1560,7 +1478,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libffi 3.0.10rc0:";; + short | recursive ) echo "Configuration of libffi 3.0.13:";; esac cat <<\_ACEOF @@ -1568,15 +1486,24 @@ --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors + --disable-builddir disable automatic build in subdir of sources + + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer + --enable-portable-binary + disable compiler optimizations that would produce + unportable binaries + --enable-maintainer-mode + enable make rules and dependencies not useful (and + sometimes confusing) to the casual installer + --enable-pax_emutramp enable pax emulated trampolines, for we can't use PROT_EXEC --enable-debug debugging mode --disable-structs omit code for struct support --disable-raw-api make the raw api unavailable @@ -1585,9 +1512,13 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pic try to use only PIC/non-PIC objects [default=use + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot=DIR Search for dependent libraries within DIR + (or the compiler's sysroot if not specified). + --with-gcc-arch= use architecture for gcc -march/-mtune, + instead of guessing Some influential environment variables: CC C compiler command @@ -1604,7 +1535,7 @@ Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to . +Report bugs to . _ACEOF ac_status=$? fi @@ -1667,10 +1598,10 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libffi configure 3.0.10rc0 -generated by GNU Autoconf 2.65 - -Copyright (C) 2009 Free Software Foundation, Inc. +libffi configure 3.0.13 +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1714,7 +1645,7 @@ ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1746,7 +1677,7 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -1760,7 +1691,7 @@ # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1774,7 +1705,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1792,7 +1723,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -1817,7 +1748,7 @@ mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } >/dev/null && { + test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : @@ -1828,7 +1759,7 @@ ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1870,7 +1801,7 @@ ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1883,7 +1814,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1938,10 +1869,193 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid; break +else + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=$ac_mid; break +else + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid +else + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + echo >>conftest.val; read $3 &5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1989,7 +2103,7 @@ else ac_header_preproc=no fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } @@ -2012,17 +2126,15 @@ $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( cat <<\_ASBOX -## ------------------------------------------- ## -## Report this to http://gcc.gnu.org/bugs.html ## -## ------------------------------------------- ## -_ASBOX +( $as_echo "## ------------------------------------------------------ ## +## Report this to http://github.com/atgreen/libffi/issues ## +## ------------------------------------------------------ ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -2031,193 +2143,69 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel -# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES -# -------------------------------------------- -# Tries to find the compile-time value of EXPR in a program that includes -# INCLUDES, setting VAR accordingly. Returns whether the value could be -# computed -ac_fn_c_compute_int () +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { -static int test_array [1 - 2 * !(($2) >= 0)]; -test_array [0] = 0 - +if (sizeof ($2)) + return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=0 ac_mid=0 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 - +if (sizeof (($2))) + return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid; break -else - as_fn_arith $ac_mid + 1 && ac_lo=$as_val - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val + +else + eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=-1 ac_mid=-1 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=$ac_mid; break -else - as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - ac_lo= ac_hi= -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid -else - as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in #(( -?*) eval "$3=\$ac_lo"; ac_retval=0 ;; -'') ac_retval=1 ;; -esac - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (($2) < 0) - { - long int i = longval (); - if (i != ($2)) - return 1; - fprintf (f, "%ld", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ($2)) - return 1; - fprintf (f, "%lu", i); - } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - echo >>conftest.val; read $3 &5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libffi $as_me 3.0.10rc0, which was -generated by GNU Autoconf 2.65. Invocation command line was +It was created by libffi $as_me 3.0.13, which was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2327,11 +2315,9 @@ { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( @@ -2365,11 +2351,9 @@ ) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do @@ -2382,11 +2366,9 @@ echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## -## ------------------- ## -_ASBOX +## ------------------- ##" echo for ac_var in $ac_subst_files do @@ -2400,11 +2382,9 @@ fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo cat confdefs.h echo @@ -2459,7 +2439,12 @@ ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site @@ -2474,7 +2459,11 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -2550,7 +2539,7 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2568,16 +2557,22 @@ ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - for ac_t in install-sh install.sh shtool; do - if test -f "$ac_dir/$ac_t"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/$ac_t -c" - break 2 - fi - done + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi done if test -z "$ac_aux_dir"; then - as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -2591,27 +2586,27 @@ # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; then : +if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && - as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -2629,14 +2624,14 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; then : +if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi @@ -2644,7 +2639,7 @@ $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -2662,14 +2657,14 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } -if test "${ac_cv_target+set}" = set; then : +if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi @@ -2677,7 +2672,7 @@ $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; -*) as_fn_error "invalid value of canonical target" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' @@ -2704,7 +2699,111 @@ . ${srcdir}/configure.host -am__api_version='1.11' + + # [$]@ is unsable in 2.60+ but earlier autoconf had no ac_configure_args + if test "${ac_configure_args+set}" != "set" ; then + ac_configure_args= + for ac_arg in ${1+"$@"}; do + ac_configure_args="$ac_configure_args '$ac_arg'" + done + fi + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + + +ax_enable_builddir="." +# Check whether --enable-builddir was given. +if test "${enable_builddir+set}" = set; then : + enableval=$enable_builddir; ax_enable_builddir="$enableval" +else + ax_enable_builddir="auto" +fi + +if test ".$ac_srcdir_defaulted" != ".no" ; then +if test ".$srcdir" = ".." ; then + if test -f config.status ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: toplevel srcdir already configured... skipping subdir build" >&5 +$as_echo "$as_me: toplevel srcdir already configured... skipping subdir build" >&6;} + else + test ".$ax_enable_builddir" = "." && ax_enable_builddir="." + test ".$ax_enable_builddir" = ".no" && ax_enable_builddir="." + test ".$TARGET" = "." && TARGET="$target" + test ".$ax_enable_builddir" = ".auto" && ax_enable_builddir="$TARGET" + if test ".$ax_enable_builddir" != ".." ; then # we know where to go and + as_dir=$ax_enable_builddir; as_fn_mkdir_p + echo __.$ax_enable_builddir.__ > $ax_enable_builddir/conftest.tmp + cd $ax_enable_builddir + if grep __.$ax_enable_builddir.__ conftest.tmp >/dev/null 2>/dev/null ; then + rm conftest.tmp + { $as_echo "$as_me:${as_lineno-$LINENO}: result: continue configure in default builddir \"./$ax_enable_builddir\"" >&5 +$as_echo "continue configure in default builddir \"./$ax_enable_builddir\"" >&6; } + else + as_fn_error $? "could not change to default builddir \"./$ax_enable_builddir\"" "$LINENO" 5 + fi + srcdir=`echo "$ax_enable_builddir" | + sed -e 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g;s,[/]$,,;'` + # going to restart from subdirectory location + test -f $srcdir/config.log && mv $srcdir/config.log . + test -f $srcdir/confdefs.h && mv $srcdir/confdefs.h . + test -f $srcdir/conftest.log && mv $srcdir/conftest.log . + test -f $srcdir/$cache_file && mv $srcdir/$cache_file . + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ....exec $SHELL $srcdir/$0 \"--srcdir=$srcdir\" \"--enable-builddir=$ax_enable_builddir\" ${1+\"$@\"}" >&5 +$as_echo "....exec $SHELL $srcdir/$0 \"--srcdir=$srcdir\" \"--enable-builddir=$ax_enable_builddir\" ${1+\"$@\"}" >&6; } + case "$0" in # restart + /\\*) eval $SHELL "'$0'" "'--srcdir=$srcdir'" "'--enable-builddir=$ax_enable_builddir'" $ac_configure_args ;; + *) eval $SHELL "'$srcdir/$0'" "'--srcdir=$srcdir'" "'--enable-builddir=$ax_enable_builddir'" $ac_configure_args ;; + esac ; exit $? + fi + fi +fi fi +test ".$ax_enable_builddir" = ".auto" && ax_enable_builddir="." +# Extract the first word of "gsed sed", so it can be a program name with args. +set dummy gsed sed; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ax_enable_builddir_sed+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ax_enable_builddir_sed in + [\\/]* | ?:[\\/]*) + ac_cv_path_ax_enable_builddir_sed="$ax_enable_builddir_sed" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ax_enable_builddir_sed="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_ax_enable_builddir_sed" && ac_cv_path_ax_enable_builddir_sed="sed" + ;; +esac +fi +ax_enable_builddir_sed=$ac_cv_path_ax_enable_builddir_sed +if test -n "$ax_enable_builddir_sed"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_enable_builddir_sed" >&5 +$as_echo "$ax_enable_builddir_sed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +ax_enable_builddir_auxdir="$am_aux_dir" +ac_config_commands="$ac_config_commands buildir" + + +am__api_version='1.12' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -2723,7 +2822,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then : +if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2743,7 +2842,7 @@ # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2801,56 +2900,71 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error "unsafe absolute working directory name" "$LINENO" 5;; + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; -esac - -# Do `set' in a subshell so we don't clobber the current shell's + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error "ls -t appears to fail. Make sure there is not a broken -alias in your environment" "$LINENO" 5 - fi - + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done test "$2" = conftest.file ) then # Ok. : else - as_fn_error "newly created file is older than distributed files! + as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. @@ -2861,9 +2975,6 @@ ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) @@ -2877,8 +2988,8 @@ am_missing_run="$MISSING --run " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then @@ -2890,17 +3001,17 @@ esac fi -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. +# will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then : +if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -2912,7 +3023,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2940,7 +3051,7 @@ set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -2952,7 +3063,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2993,7 +3104,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if test "${ac_cv_path_mkdir+set}" = set; then : + if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3003,7 +3114,7 @@ test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ @@ -3032,19 +3143,13 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } -mkdir_p="$MKDIR_P" -case $mkdir_p in - [\\/$]* | ?:[\\/]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac - for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then : +if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -3056,7 +3161,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3084,7 +3189,7 @@ $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -3092,7 +3197,7 @@ all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; @@ -3126,7 +3231,7 @@ am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then - as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi @@ -3142,7 +3247,7 @@ # Define the identity of the package. PACKAGE='libffi' - VERSION='3.0.10rc0' + VERSION='3.0.13' cat >>confdefs.h <<_ACEOF @@ -3170,13 +3275,19 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + # We need awk for the "check" target. The system "awk" is bad on # some platforms. -# Always define AMTAR for backward compatibility. - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' @@ -3187,9 +3298,12 @@ # We must force CC to /not/ be precious variables; otherwise # the wrong, non-multilib-adjusted value will be used in multilibs. # As a side effect, we have to subst CFLAGS ourselves. - - - +# Also save and restore CFLAGS, since AC_PROG_CC will come up with +# defaults of its own if none are provided. + + + +save_CFLAGS=$CFLAGS ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3200,7 +3314,7 @@ set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3212,7 +3326,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3240,7 +3354,7 @@ set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3252,7 +3366,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3293,7 +3407,7 @@ set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3305,7 +3419,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3333,7 +3447,7 @@ set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3346,7 +3460,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -3392,7 +3506,7 @@ set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3404,7 +3518,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3436,7 +3550,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3448,7 +3562,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3490,8 +3604,8 @@ test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3605,9 +3719,8 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3649,8 +3762,8 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3707,9 +3820,9 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. +as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi @@ -3720,7 +3833,7 @@ ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3760,8 +3873,8 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3771,7 +3884,7 @@ ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3808,7 +3921,7 @@ ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3886,7 +3999,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -3895,8 +4008,7 @@ /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -3999,7 +4111,7 @@ _am_result=none # First try GNU make style include. echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. +# Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include @@ -4032,6 +4144,7 @@ if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' + am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= @@ -4047,15 +4160,16 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : +if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -4089,16 +4203,16 @@ : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -4107,16 +4221,16 @@ test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -4170,6 +4284,7 @@ fi +CFLAGS=$save_CFLAGS @@ -4186,15 +4301,16 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CCAS_dependencies_compiler_type+set}" = set; then : +if ${am_cv_CCAS_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -4226,16 +4342,16 @@ : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -4244,16 +4360,16 @@ test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -4316,7 +4432,7 @@ fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4441,8 +4557,8 @@ -macro_version='2.2.6' -macro_revision='1.3012' +macro_version='2.4.2' +macro_revision='1.3337' @@ -4458,9 +4574,78 @@ ltmain="$ac_aux_dir/ltmain.sh" +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case "$ECHO" in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } -if test "${ac_cv_path_SED+set}" = set; then : +if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ @@ -4480,7 +4665,7 @@ for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue + as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in @@ -4515,7 +4700,7 @@ done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then - as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5 + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED @@ -4542,7 +4727,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -4556,7 +4741,7 @@ for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -4591,7 +4776,7 @@ done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then - as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP @@ -4605,7 +4790,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -4622,7 +4807,7 @@ for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -4657,7 +4842,7 @@ done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP @@ -4672,7 +4857,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } -if test "${ac_cv_path_FGREP+set}" = set; then : +if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 @@ -4689,7 +4874,7 @@ for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue + as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in @@ -4724,7 +4909,7 @@ done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then - as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP @@ -4803,7 +4988,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi -if test "${lt_cv_path_LD+set}" = set; then : +if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then @@ -4840,10 +5025,10 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then : +if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. @@ -4870,7 +5055,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if test "${lt_cv_path_NM+set}" = set; then : +if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then @@ -4923,14 +5108,17 @@ NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$ac_tool_prefix"; then - for ac_prog in "dumpbin -symbols" "link -dump -symbols" + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_DUMPBIN+set}" = set; then : +if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then @@ -4942,7 +5130,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4968,13 +5156,13 @@ fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in "dumpbin -symbols" "link -dump -symbols" + for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then : +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then @@ -4986,7 +5174,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5023,6 +5211,15 @@ fi fi + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" @@ -5037,18 +5234,18 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } -if test "${lt_cv_nm_interface+set}" = set; then : +if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:5045: $ac_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:5048: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:5051: output\"" >&5) + (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5072,7 +5269,7 @@ # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } -if test "${lt_cv_sys_max_cmd_len+set}" = set; then : +if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 @@ -5105,6 +5302,11 @@ lt_cv_sys_max_cmd_len=8192; ;; + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. @@ -5130,6 +5332,11 @@ lt_cv_sys_max_cmd_len=196608 ;; + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not @@ -5156,7 +5363,8 @@ ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -5169,8 +5377,8 @@ # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ - = "XX$teststring$teststring"; } >/dev/null 2>&1 && + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` @@ -5212,8 +5420,8 @@ # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes @@ -5262,9 +5470,83 @@ +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } -if test "${lt_cv_ld_reload_flag+set}" = set; then : +if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' @@ -5278,6 +5560,11 @@ esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' @@ -5300,7 +5587,7 @@ set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OBJDUMP+set}" = set; then : +if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then @@ -5312,7 +5599,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5340,7 +5627,7 @@ set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then @@ -5352,7 +5639,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5399,7 +5686,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } -if test "${lt_cv_deplibs_check_method+set}" = set; then : +if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' @@ -5441,16 +5728,18 @@ # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -cegcc) +cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' @@ -5480,6 +5769,10 @@ lt_cv_deplibs_check_method=pass_all ;; +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in @@ -5488,11 +5781,11 @@ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac @@ -5513,8 +5806,8 @@ lt_cv_deplibs_check_method=pass_all ;; -# This must be Linux ELF. -linux* | k*bsd*-gnu) +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; @@ -5595,6 +5888,21 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -5610,16 +5918,26 @@ + + + + + + + + + + if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AR+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5627,8 +5945,8 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="${ac_tool_prefix}ar" + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5638,10 +5956,10 @@ fi fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -5649,17 +5967,17 @@ fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5667,8 +5985,8 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AR="ar" + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5678,17 +5996,17 @@ fi fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_AR" = x; then - AR="false" + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) @@ -5696,18 +6014,226 @@ $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac AR=$ac_ct_AR fi -else - AR="$ac_cv_prog_AR" -fi - -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru - - - - +fi + +: ${AR=ar} +: ${AR_FLAGS=cru} + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi @@ -5720,7 +6246,7 @@ set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then : +if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -5732,7 +6258,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5760,7 +6286,7 @@ set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -5772,7 +6298,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5819,7 +6345,7 @@ set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then : +if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -5831,7 +6357,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5859,7 +6385,7 @@ set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -5871,7 +6397,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5921,14 +6447,26 @@ if test -n "$RANLIB"; then case $host_os in openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + @@ -5976,7 +6514,7 @@ # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then : +if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else @@ -6037,8 +6575,8 @@ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= @@ -6062,6 +6600,7 @@ # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ @@ -6074,6 +6613,7 @@ else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no @@ -6099,8 +6639,8 @@ test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then @@ -6115,6 +6655,18 @@ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + #ifdef __cplusplus extern "C" { #endif @@ -6126,7 +6678,7 @@ cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ -const struct { +LT_DLSYM_CONST struct { const char *name; void *address; } @@ -6152,8 +6704,8 @@ _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 @@ -6163,8 +6715,8 @@ test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi @@ -6201,23 +6753,71 @@ $as_echo "ok" >&6; } fi - - - - - - - - - - - - - - - - - +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi + + +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } @@ -6254,7 +6854,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 6257 "configure"' > conftest.$ac_ext + echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6305,7 +6905,14 @@ LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -6348,7 +6955,7 @@ CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if test "${lt_cv_cc_needs_belf+set}" = set; then : +if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c @@ -6389,7 +6996,7 @@ CFLAGS="$SAVE_CFLAGS" fi ;; -sparc*-*solaris*) +*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 @@ -6400,7 +7007,20 @@ case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" @@ -6416,6 +7036,123 @@ need_locks="$enable_libtool_lock" +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi + + + + + case $host_os in rhapsody* | darwin*) @@ -6424,7 +7161,7 @@ set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_DSYMUTIL+set}" = set; then : +if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then @@ -6436,7 +7173,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6464,7 +7201,7 @@ set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then : +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then @@ -6476,7 +7213,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6516,7 +7253,7 @@ set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_NMEDIT+set}" = set; then : +if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then @@ -6528,7 +7265,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6556,7 +7293,7 @@ set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then : +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then @@ -6568,7 +7305,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6608,7 +7345,7 @@ set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_LIPO+set}" = set; then : +if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then @@ -6620,7 +7357,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6648,7 +7385,7 @@ set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then : +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then @@ -6660,7 +7397,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6700,7 +7437,7 @@ set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OTOOL+set}" = set; then : +if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then @@ -6712,7 +7449,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6740,7 +7477,7 @@ set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then : +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then @@ -6752,7 +7489,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6792,7 +7529,7 @@ set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OTOOL64+set}" = set; then : +if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then @@ -6804,7 +7541,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6832,7 +7569,7 @@ set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then : +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then @@ -6844,7 +7581,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6907,7 +7644,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } -if test "${lt_cv_apple_cc_single_mod+set}" = set; then : +if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no @@ -6923,7 +7660,13 @@ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 @@ -6934,9 +7677,10 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if test "${lt_cv_ld_exported_symbols_list+set}" = set; then : +if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no @@ -6966,6 +7710,41 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; @@ -6993,7 +7772,7 @@ else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - if test "$DSYMUTIL" != ":"; then + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= @@ -7013,7 +7792,7 @@ CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -7043,7 +7822,7 @@ # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -7059,11 +7838,11 @@ ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext +rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi @@ -7102,7 +7881,7 @@ # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -7118,18 +7897,18 @@ ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext +rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -7141,7 +7920,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7258,8 +8037,7 @@ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -7273,7 +8051,7 @@ do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " -if test "x$ac_cv_header_dlfcn_h" = x""yes; then : +if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF @@ -7284,6 +8062,8 @@ + + # Set options @@ -7359,7 +8139,22 @@ # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : - withval=$with_pic; pic_mode="$withval" + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac else pic_mode=default fi @@ -7436,6 +8231,11 @@ + + + + + test -z "$LN_S" && LN_S="ln -s" @@ -7457,7 +8257,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } -if test "${lt_cv_objdir+set}" = set; then : +if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null @@ -7485,19 +8285,6 @@ - - - - - - - - - - - - - case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some @@ -7510,23 +8297,6 @@ ;; esac -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - # Global variables: ofile=libtool can_build_shared=yes @@ -7555,7 +8325,7 @@ *) break;; esac done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it @@ -7565,7 +8335,7 @@ if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : +if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in @@ -7631,7 +8401,7 @@ if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : +if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in @@ -7764,11 +8534,16 @@ lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then : +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no @@ -7784,15 +8559,15 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7787: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7791: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes @@ -7821,8 +8596,6 @@ lt_prog_compiler_pic= lt_prog_compiler_static= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' @@ -7870,6 +8643,12 @@ lt_prog_compiler_pic='-fno-common' ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag @@ -7912,6 +8691,15 @@ lt_prog_compiler_pic='-fPIC' ;; esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in @@ -7953,7 +8741,7 @@ lt_prog_compiler_static='-non_shared' ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -7974,7 +8762,13 @@ lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; - pgcc* | pgf77* | pgf90* | pgf95*) + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -7986,25 +8780,40 @@ # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; - xl*) - # IBM XL C 8.0/Fortran 10.1 on PPC + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' ;; esac ;; @@ -8036,7 +8845,7 @@ lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in - f77* | f90* | f95*) + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; @@ -8093,13 +8902,17 @@ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 -$as_echo "$lt_prog_compiler_pic" >&6; } - - - - - + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. @@ -8107,7 +8920,7 @@ if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if test "${lt_cv_prog_compiler_pic_works+set}" = set; then : +if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no @@ -8123,15 +8936,15 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8126: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8130: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes @@ -8160,13 +8973,18 @@ + + + + + # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if test "${lt_cv_prog_compiler_static_works+set}" = set; then : +if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no @@ -8179,7 +8997,7 @@ if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes @@ -8209,7 +9027,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o+set}" = set; then : +if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no @@ -8228,16 +9046,16 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8231: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8235: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes @@ -8264,7 +9082,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o+set}" = set; then : +if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no @@ -8283,16 +9101,16 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8286: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8290: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes @@ -8358,7 +9176,6 @@ hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported @@ -8405,7 +9222,33 @@ esac ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' @@ -8423,6 +9266,7 @@ fi supports_anon_versioning=no case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... @@ -8438,11 +9282,12 @@ ld_shlibs=no cat <<_LT_EOF 1>&2 -*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. _LT_EOF fi @@ -8478,10 +9323,12 @@ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -8499,6 +9346,11 @@ fi ;; + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no @@ -8514,7 +9366,7 @@ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - gnu* | linux* | tpf* | k*bsd*-gnu) + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in @@ -8524,15 +9376,16 @@ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then - tmp_addflag= + tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -8543,13 +9396,17 @@ lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; - xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 @@ -8565,17 +9422,16 @@ fi case $cc_basename in - xlf*) + xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld='-rpath $libdir' - archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac @@ -8589,8 +9445,8 @@ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; @@ -8608,8 +9464,8 @@ _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi @@ -8655,8 +9511,8 @@ *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi @@ -8696,8 +9552,10 @@ else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi @@ -8784,7 +9642,13 @@ allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -8797,25 +9661,32 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' @@ -8824,7 +9695,13 @@ else # Determine the default libpath from the value encoded in an # empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -8837,30 +9714,42 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' @@ -8892,20 +9781,64 @@ # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac ;; darwin* | rhapsody*) @@ -8915,7 +9848,12 @@ hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='' + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in @@ -8923,7 +9861,7 @@ *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=echo + output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" @@ -8941,10 +9879,6 @@ hardcode_shlibpath_var=no ;; - freebsd1*) - ld_shlibs=no - ;; - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little @@ -8957,7 +9891,7 @@ ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) + freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes @@ -8966,7 +9900,7 @@ # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no @@ -8974,7 +9908,7 @@ hpux9*) if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi @@ -8989,14 +9923,13 @@ ;; hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes @@ -9008,16 +9941,16 @@ ;; hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then + if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else @@ -9029,7 +9962,46 @@ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + ;; esac fi @@ -9057,26 +10029,39 @@ irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo(void) {} + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' @@ -9138,17 +10123,17 @@ hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' @@ -9158,13 +10143,13 @@ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -9177,9 +10162,9 @@ no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' - archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) @@ -9367,44 +10352,50 @@ # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 -$as_echo "$archive_cmds_need_lc" >&6; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi @@ -9562,11 +10553,6 @@ - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } @@ -9575,16 +10561,23 @@ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` - else - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= @@ -9597,7 +10590,7 @@ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done - lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; @@ -9617,7 +10610,13 @@ if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` - sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([A-Za-z]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi @@ -9643,7 +10642,7 @@ case $host_os in aix3*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH @@ -9652,7 +10651,7 @@ ;; aix[4-9]*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes @@ -9705,7 +10704,7 @@ m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; @@ -9717,7 +10716,7 @@ ;; bsdi[45]*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' @@ -9736,8 +10735,9 @@ need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + case $GCC,$cc_basename in + yes,*) + # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ @@ -9758,36 +10758,83 @@ cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' ;; *) + # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' + dynamic_linker='Win32 ld.exe' + ;; + esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -9808,7 +10855,7 @@ ;; dgux*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' @@ -9816,10 +10863,6 @@ shlibpath_var=LD_LIBRARY_PATH ;; -freebsd1*) - dynamic_linker=no - ;; - freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. @@ -9827,7 +10870,7 @@ objformat=`/usr/bin/objformat` else case $host_os in - freebsd[123]*) objformat=aout ;; + freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi @@ -9845,7 +10888,7 @@ esac shlibpath_var=LD_LIBRARY_PATH case $host_os in - freebsd2*) + freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) @@ -9865,12 +10908,26 @@ ;; gnu*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; @@ -9916,12 +10973,14 @@ soname_spec='${libname}${release}${shared_ext}$major' ;; esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 ;; interix[3-9]*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' @@ -9937,7 +10996,7 @@ nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; @@ -9974,9 +11033,9 @@ dynamic_linker=no ;; -# This must be Linux ELF. -linux* | k*bsd*-gnu) - version_type=linux +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -9984,12 +11043,17 @@ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -10002,13 +11066,17 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - shlibpath_overrides_runpath=yes + lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install @@ -10020,8 +11088,9 @@ # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -10052,7 +11121,7 @@ ;; newsos6) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -10121,7 +11190,7 @@ ;; solaris*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -10146,7 +11215,7 @@ ;; sysv4 | sysv4.3*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH @@ -10170,7 +11239,7 @@ sysv4*MP*) if test -d /usr/nec ;then - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH @@ -10201,7 +11270,7 @@ tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -10211,7 +11280,7 @@ ;; uts4*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH @@ -10323,6 +11392,11 @@ + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= @@ -10395,7 +11469,7 @@ # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10429,7 +11503,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else @@ -10443,12 +11517,12 @@ *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = x""yes; then : +if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } -if test "${ac_cv_lib_dld_shl_load+set}" = set; then : +if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10482,16 +11556,16 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = x""yes; then : +if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10525,12 +11599,12 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } -if test "${ac_cv_lib_svld_dlopen+set}" = set; then : +if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10564,12 +11638,12 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = x""yes; then : +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } -if test "${ac_cv_lib_dld_dld_link+set}" = set; then : +if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10603,7 +11677,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = x""yes; then : +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi @@ -10644,7 +11718,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } -if test "${lt_cv_dlopen_self+set}" = set; then : +if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10653,7 +11727,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10656 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10694,7 +11768,13 @@ # endif #endif -void fnord() { int i=42;} +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -10703,7 +11783,11 @@ if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } /* dlclose (self); */ } else @@ -10740,7 +11824,7 @@ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if test "${lt_cv_dlopen_self_static+set}" = set; then : +if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10749,7 +11833,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10752 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10790,7 +11874,13 @@ # endif #endif -void fnord() { int i=42;} +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -10799,7 +11889,11 @@ if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } /* dlclose (self); */ } else @@ -10968,6 +12062,8 @@ + + ac_config_commands="$ac_config_commands libtool" @@ -10978,6 +12074,1021 @@ +# Test for 64-bit build. +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 +$as_echo_n "checking size of size_t... " >&6; } +if ${ac_cv_sizeof_size_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_size_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (size_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_size_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5 +$as_echo "$ac_cv_sizeof_size_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t +_ACEOF + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler vendor" >&5 +$as_echo_n "checking for C compiler vendor... " >&6; } +if ${ax_cv_c_compiler_vendor+:} false; then : + $as_echo_n "(cached) " >&6 +else + # note: don't check for gcc first since some other compilers define __GNUC__ + vendors="intel: __ICC,__ECC,__INTEL_COMPILER + ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__ + pathscale: __PATHCC__,__PATHSCALE__ + clang: __clang__ + gnu: __GNUC__ + sun: __SUNPRO_C,__SUNPRO_CC + hp: __HP_cc,__HP_aCC + dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER + borland: __BORLANDC__,__TURBOC__ + comeau: __COMO__ + cray: _CRAYC + kai: __KCC + lcc: __LCC__ + sgi: __sgi,sgi + microsoft: _MSC_VER + metrowerks: __MWERKS__ + watcom: __WATCOMC__ + portland: __PGI + unknown: UNKNOWN" + for ventest in $vendors; do + case $ventest in + *:) vendor=$ventest; continue ;; + *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + #if !($vencpp) + thisisanerror; + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done + ax_cv_c_compiler_vendor=`echo $vendor | cut -d: -f1` + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_c_compiler_vendor" >&5 +$as_echo "$ax_cv_c_compiler_vendor" >&6; } + + + + + + +# Check whether --enable-portable-binary was given. +if test "${enable_portable_binary+set}" = set; then : + enableval=$enable_portable_binary; acx_maxopt_portable=$enableval +else + acx_maxopt_portable=no +fi + + +# Try to determine "good" native compiler flags if none specified via CFLAGS +if test "$ac_test_CFLAGS" != "set"; then + CFLAGS="" + case $ax_cv_c_compiler_vendor in + dec) CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host" + if test "x$acx_maxopt_portable" = xno; then + CFLAGS="$CFLAGS -arch host" + fi;; + + sun) CFLAGS="-native -fast -xO5 -dalign" + if test "x$acx_maxopt_portable" = xyes; then + CFLAGS="$CFLAGS -xarch=generic" + fi;; + + hp) CFLAGS="+Oall +Optrs_ansi +DSnative" + if test "x$acx_maxopt_portable" = xyes; then + CFLAGS="$CFLAGS +DAportable" + fi;; + + ibm) if test "x$acx_maxopt_portable" = xno; then + xlc_opt="-qarch=auto -qtune=auto" + else + xlc_opt="-qtune=auto" + fi + as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$xlc_opt" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $xlc_opt" >&5 +$as_echo_n "checking whether C compiler accepts $xlc_opt... " >&6; } +if eval \${$as_CACHEVAR+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS $xlc_opt" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_CACHEVAR=yes" +else + eval "$as_CACHEVAR=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +eval ac_res=\$$as_CACHEVAR + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : + CFLAGS="-O3 -qansialias -w $xlc_opt" +else + CFLAGS="-O3 -qansialias -w" + echo "******************************************************" + echo "* You seem to have the IBM C compiler. It is *" + echo "* recommended for best performance that you use: *" + echo "* *" + echo "* CFLAGS=-O3 -qarch=xxx -qtune=xxx -qansialias -w *" + echo "* ^^^ ^^^ *" + echo "* where xxx is pwr2, pwr3, 604, or whatever kind of *" + echo "* CPU you have. (Set the CFLAGS environment var. *" + echo "* and re-run configure.) For more info, man cc. *" + echo "******************************************************" +fi + + ;; + + intel) CFLAGS="-O3 -ansi_alias" + if test "x$acx_maxopt_portable" = xno; then + icc_archflag=unknown + icc_flags="" + case $host_cpu in + i686*|x86_64*) + # icc accepts gcc assembly syntax, so these should work: + +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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 0 output" >&5 +$as_echo_n "checking for x86 cpuid 0 output... " >&6; } +if ${ax_cv_gcc_x86_cpuid_0+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_gcc_x86_cpuid_0=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + int op = 0, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_gcc_x86_cpuid_0=`cat conftest_cpuid`; rm -f conftest_cpuid +else + ax_cv_gcc_x86_cpuid_0=unknown; rm -f conftest_cpuid +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_x86_cpuid_0" >&5 +$as_echo "$ax_cv_gcc_x86_cpuid_0" >&6; } +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 + + + +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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 1 output" >&5 +$as_echo_n "checking for x86 cpuid 1 output... " >&6; } +if ${ax_cv_gcc_x86_cpuid_1+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_gcc_x86_cpuid_1=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + int op = 1, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_gcc_x86_cpuid_1=`cat conftest_cpuid`; rm -f conftest_cpuid +else + ax_cv_gcc_x86_cpuid_1=unknown; rm -f conftest_cpuid +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_x86_cpuid_1" >&5 +$as_echo "$ax_cv_gcc_x86_cpuid_1" >&6; } +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 + + + case $ax_cv_gcc_x86_cpuid_0 in # see AX_GCC_ARCHFLAG + *:756e6547:*:*) # Intel + case $ax_cv_gcc_x86_cpuid_1 in + *6a?:*[234]:*:*|*6[789b]?:*:*:*) icc_flags="-xK";; + *f3[347]:*:*:*|*f41347:*:*:*) icc_flags="-xP -xN -xW -xK";; + *f??:*:*:*) icc_flags="-xN -xW -xK";; + esac ;; + esac ;; + esac + if test "x$icc_flags" != x; then + for flag in $icc_flags; do + as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$flag" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 +$as_echo_n "checking whether C compiler accepts $flag... " >&6; } +if eval \${$as_CACHEVAR+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS $flag" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_CACHEVAR=yes" +else + eval "$as_CACHEVAR=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +eval ac_res=\$$as_CACHEVAR + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : + icc_archflag=$flag; break +else + : +fi + + done + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for icc architecture flag" >&5 +$as_echo_n "checking for icc architecture flag... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $icc_archflag" >&5 +$as_echo "$icc_archflag" >&6; } + if test "x$icc_archflag" != xunknown; then + CFLAGS="$CFLAGS $icc_archflag" + fi + fi + ;; + + gnu) + # default optimization flags for gcc on all systems + CFLAGS="-O3 -fomit-frame-pointer" + + # -malign-double for x86 systems + # LIBFFI -- DON'T DO THIS - CHANGES ABI + # AX_CHECK_COMPILE_FLAG(-malign-double, CFLAGS="$CFLAGS -malign-double") + + # -fstrict-aliasing for gcc-2.95+ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstrict-aliasing" >&5 +$as_echo_n "checking whether C compiler accepts -fstrict-aliasing... " >&6; } +if ${ax_cv_check_cflags___fstrict_aliasing+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -fstrict-aliasing" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ax_cv_check_cflags___fstrict_aliasing=yes +else + ax_cv_check_cflags___fstrict_aliasing=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fstrict_aliasing" >&5 +$as_echo "$ax_cv_check_cflags___fstrict_aliasing" >&6; } +if test x"$ax_cv_check_cflags___fstrict_aliasing" = xyes; then : + CFLAGS="$CFLAGS -fstrict-aliasing" +else + : +fi + + + # note that we enable "unsafe" fp optimization with other compilers, too + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -ffast-math" >&5 +$as_echo_n "checking whether C compiler accepts -ffast-math... " >&6; } +if ${ax_cv_check_cflags___ffast_math+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -ffast-math" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ax_cv_check_cflags___ffast_math=yes +else + ax_cv_check_cflags___ffast_math=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___ffast_math" >&5 +$as_echo "$ax_cv_check_cflags___ffast_math" >&6; } +if test x"$ax_cv_check_cflags___ffast_math" = xyes; then : + CFLAGS="$CFLAGS -ffast-math" +else + : +fi + + + + + + +# Check whether --with-gcc-arch was given. +if test "${with_gcc_arch+set}" = set; then : + withval=$with_gcc_arch; ax_gcc_arch=$withval +else + ax_gcc_arch=yes +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc architecture flag" >&5 +$as_echo_n "checking for gcc architecture flag... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } +if ${ax_cv_gcc_archflag+:} false; then : + $as_echo_n "(cached) " >&6 +else + +ax_cv_gcc_archflag="unknown" + +if test "$GCC" = yes; then + +if test "x$ax_gcc_arch" = xyes; then +ax_gcc_arch="" +if test "$cross_compiling" = no; then +case $host_cpu in + i[3456]86*|x86_64*) # use cpuid codes + +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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 0 output" >&5 +$as_echo_n "checking for x86 cpuid 0 output... " >&6; } +if ${ax_cv_gcc_x86_cpuid_0+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_gcc_x86_cpuid_0=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + int op = 0, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_gcc_x86_cpuid_0=`cat conftest_cpuid`; rm -f conftest_cpuid +else + ax_cv_gcc_x86_cpuid_0=unknown; rm -f conftest_cpuid +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_x86_cpuid_0" >&5 +$as_echo "$ax_cv_gcc_x86_cpuid_0" >&6; } +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 + + + +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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 1 output" >&5 +$as_echo_n "checking for x86 cpuid 1 output... " >&6; } +if ${ax_cv_gcc_x86_cpuid_1+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_gcc_x86_cpuid_1=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + int op = 1, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_gcc_x86_cpuid_1=`cat conftest_cpuid`; rm -f conftest_cpuid +else + ax_cv_gcc_x86_cpuid_1=unknown; rm -f conftest_cpuid +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_x86_cpuid_1" >&5 +$as_echo "$ax_cv_gcc_x86_cpuid_1" >&6; } +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 + + + case $ax_cv_gcc_x86_cpuid_0 in + *:756e6547:*:*) # Intel + case $ax_cv_gcc_x86_cpuid_1 in + *5[48]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;; + *5??:*:*:*) ax_gcc_arch=pentium ;; + *0?6[3456]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *0?6a?:*[01]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *0?6a?:*[234]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *0?6[9de]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; + *0?6[78b]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *0?6f?:*:*:*|*1?66?:*:*:*) ax_gcc_arch="core2 pentium-m pentium3 pentiumpro" ;; + *1?6[7d]?:*:*:*) ax_gcc_arch="penryn core2 pentium-m pentium3 pentiumpro" ;; + *1?6[aef]?:*:*:*|*2?6[5cef]?:*:*:*) ax_gcc_arch="corei7 core2 pentium-m pentium3 pentiumpro" ;; + *1?6c?:*:*:*|*[23]?66?:*:*:*) ax_gcc_arch="atom core2 pentium-m pentium3 pentiumpro" ;; + *2?6[ad]?:*:*:*) ax_gcc_arch="corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;; + *0?6??:*:*:*) ax_gcc_arch=pentiumpro ;; + *6??:*:*:*) ax_gcc_arch="core2 pentiumpro" ;; + ?000?f3[347]:*:*:*|?000?f41347:*:*:*|?000?f6?:*:*:*) + case $host_cpu in + x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; + *) ax_gcc_arch="prescott pentium4 pentiumpro" ;; + esac ;; + ?000?f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; + esac ;; + *:68747541:*:*) # AMD + case $ax_cv_gcc_x86_cpuid_1 in + *5[67]?:*:*:*) ax_gcc_arch=k6 ;; + *5[8d]?:*:*:*) ax_gcc_arch="k6-2 k6" ;; + *5[9]?:*:*:*) ax_gcc_arch="k6-3 k6" ;; + *60?:*:*:*) ax_gcc_arch=k7 ;; + *6[12]?:*:*:*) ax_gcc_arch="athlon k7" ;; + *6[34]?:*:*:*) ax_gcc_arch="athlon-tbird k7" ;; + *67?:*:*:*) ax_gcc_arch="athlon-4 athlon k7" ;; + *6[68a]?:*:*:*) + +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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 0x80000006 output" >&5 +$as_echo_n "checking for x86 cpuid 0x80000006 output... " >&6; } +if ${ax_cv_gcc_x86_cpuid_0x80000006+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_gcc_x86_cpuid_0x80000006=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + int op = 0x80000006, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_gcc_x86_cpuid_0x80000006=`cat conftest_cpuid`; rm -f conftest_cpuid +else + ax_cv_gcc_x86_cpuid_0x80000006=unknown; rm -f conftest_cpuid +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_x86_cpuid_0x80000006" >&5 +$as_echo "$ax_cv_gcc_x86_cpuid_0x80000006" >&6; } +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 + + # L2 cache size + case $ax_cv_gcc_x86_cpuid_0x80000006 in + *:*:*[1-9a-f]??????:*) # (L2 = ecx >> 16) >= 256 + ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;; + *) ax_gcc_arch="athlon-4 athlon k7" ;; + esac ;; + ?00??f[4cef8b]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; + ?00??f5?:*:*:*) ax_gcc_arch="opteron k8" ;; + ?00??f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; + ?00??f??:*:*:*) ax_gcc_arch="k8" ;; + ?05??f??:*:*:*) ax_gcc_arch="btver1 amdfam10 k8" ;; + ?06??f??:*:*:*) ax_gcc_arch="bdver1 amdfam10 k8" ;; + *f??:*:*:*) ax_gcc_arch="amdfam10 k8" ;; + esac ;; + *:746e6543:*:*) # IDT + case $ax_cv_gcc_x86_cpuid_1 in + *54?:*:*:*) ax_gcc_arch=winchip-c6 ;; + *58?:*:*:*) ax_gcc_arch=winchip2 ;; + *6[78]?:*:*:*) ax_gcc_arch=c3 ;; + *69?:*:*:*) ax_gcc_arch="c3-2 c3" ;; + esac ;; + esac + if test x"$ax_gcc_arch" = x; then # fallback + case $host_cpu in + i586*) ax_gcc_arch=pentium ;; + i686*) ax_gcc_arch=pentiumpro ;; + esac + fi + ;; + + sparc*) + # Extract the first word of "prtdiag", so it can be a program name with args. +set dummy prtdiag; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PRTDIAG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PRTDIAG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PRTDIAG="$PRTDIAG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/platform/`uname -i`/sbin/:/usr/platform/`uname -m`/sbin/" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PRTDIAG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PRTDIAG" && ac_cv_path_PRTDIAG="prtdiag" + ;; +esac +fi +PRTDIAG=$ac_cv_path_PRTDIAG +if test -n "$PRTDIAG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PRTDIAG" >&5 +$as_echo "$PRTDIAG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null` + cputype=`echo "$cputype" | tr -d ' -' |tr $as_cr_LETTERS $as_cr_letters` + case $cputype in + *ultrasparciv*) ax_gcc_arch="ultrasparc4 ultrasparc3 ultrasparc v9" ;; + *ultrasparciii*) ax_gcc_arch="ultrasparc3 ultrasparc v9" ;; + *ultrasparc*) ax_gcc_arch="ultrasparc v9" ;; + *supersparc*|*tms390z5[05]*) ax_gcc_arch="supersparc v8" ;; + *hypersparc*|*rt62[056]*) ax_gcc_arch="hypersparc v8" ;; + *cypress*) ax_gcc_arch=cypress ;; + esac ;; + + alphaev5) ax_gcc_arch=ev5 ;; + alphaev56) ax_gcc_arch=ev56 ;; + alphapca56) ax_gcc_arch="pca56 ev56" ;; + alphapca57) ax_gcc_arch="pca57 pca56 ev56" ;; + alphaev6) ax_gcc_arch=ev6 ;; + alphaev67) ax_gcc_arch=ev67 ;; + alphaev68) ax_gcc_arch="ev68 ev67" ;; + alphaev69) ax_gcc_arch="ev69 ev68 ev67" ;; + alphaev7) ax_gcc_arch="ev7 ev69 ev68 ev67" ;; + alphaev79) ax_gcc_arch="ev79 ev7 ev69 ev68 ev67" ;; + + powerpc*) + cputype=`((grep cpu /proc/cpuinfo | head -n 1 | cut -d: -f2 | cut -d, -f1 | sed 's/ //g') ; /usr/bin/machine ; /bin/machine; grep CPU /var/run/dmesg.boot | head -n 1 | cut -d" " -f2) 2> /dev/null` + cputype=`echo $cputype | sed -e 's/ppc//g;s/ *//g'` + case $cputype in + *750*) ax_gcc_arch="750 G3" ;; + *740[0-9]*) ax_gcc_arch="$cputype 7400 G4" ;; + *74[4-5][0-9]*) ax_gcc_arch="$cputype 7450 G4" ;; + *74[0-9][0-9]*) ax_gcc_arch="$cputype G4" ;; + *970*) ax_gcc_arch="970 G5 power4";; + *POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";; + *POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";; + 603ev|8240) ax_gcc_arch="$cputype 603e 603";; + *) ax_gcc_arch=$cputype ;; + esac + ax_gcc_arch="$ax_gcc_arch powerpc" + ;; +esac +fi # not cross-compiling +fi # guess arch + +if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then +for arch in $ax_gcc_arch; do + if test "x$acx_maxopt_portable" = xyes; then # if we require portable code + flags="-mtune=$arch" + # -mcpu=$arch and m$arch generate nonportable code on every arch except + # x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr. + case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac + else + flags="-march=$arch -mcpu=$arch -m$arch" + fi + for flag in $flags; do + as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$flag" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 +$as_echo_n "checking whether C compiler accepts $flag... " >&6; } +if eval \${$as_CACHEVAR+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS $flag" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_CACHEVAR=yes" +else + eval "$as_CACHEVAR=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +eval ac_res=\$$as_CACHEVAR + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : + ax_cv_gcc_archflag=$flag; break +else + : +fi + + done + test "x$ax_cv_gcc_archflag" = xunknown || break +done +fi + +fi # $GCC=yes + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc architecture flag" >&5 +$as_echo_n "checking for gcc architecture flag... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_archflag" >&5 +$as_echo "$ax_cv_gcc_archflag" >&6; } +if test "x$ax_cv_gcc_archflag" = xunknown; then + : +else + CFLAGS="$CFLAGS $ax_cv_gcc_archflag" +fi + + ;; + esac + + if test -z "$CFLAGS"; then + echo "" + echo "********************************************************" + echo "* WARNING: Don't know the best CFLAGS for this system *" + echo "* Use ./configure CFLAGS=... to specify your own flags *" + echo "* (otherwise, a default of CFLAGS=-O3 will be used) *" + echo "********************************************************" + echo "" + CFLAGS="-O3" + fi + + as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$CFLAGS" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $CFLAGS" >&5 +$as_echo_n "checking whether C compiler accepts $CFLAGS... " >&6; } +if eval \${$as_CACHEVAR+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS $CFLAGS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_CACHEVAR=yes" +else + eval "$as_CACHEVAR=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +eval ac_res=\$$as_CACHEVAR + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : + : +else + + echo "" + echo "********************************************************" + echo "* WARNING: The guessed CFLAGS don't seem to work with *" + echo "* your compiler. *" + echo "* Use ./configure CFLAGS=... to specify your own flags *" + echo "********************************************************" + echo "" + CFLAGS="" + +fi + + +fi + +# The AX_CFLAGS_WARN_ALL macro doesn't currently work for sunpro +# compiler. +if test "$ax_cv_c_compiler_vendor" != "sun"; then + if ${CFLAGS+:} false; then : + case " $CFLAGS " in + *" "*) + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains "; } >&5 + (: CFLAGS already contains ) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + ;; + *) + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \""; } >&5 + (: CFLAGS="$CFLAGS ") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + CFLAGS="$CFLAGS " + ;; + esac +else + CFLAGS="" +fi + +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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking CFLAGS for maximum warnings" >&5 +$as_echo_n "checking CFLAGS for maximum warnings... " >&6; } +if ${ac_cv_cflags_warn_all+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_cflags_warn_all="no, unknown" +ac_save_CFLAGS="$CFLAGS" +for ac_arg in "-warn all % -warn all" "-pedantic % -Wall" "-xstrconst % -v" "-std1 % -verbose -w0 -warnprotos" "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" "-ansi -ansiE % -fullwarn" "+ESlit % +w1" "-Xc % -pvctl,fullmsg" "-h conform % -h msglevel 2" # +do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_cflags_warn_all=`echo $ac_arg | sed -e 's,.*% *,,'` ; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +CFLAGS="$ac_save_CFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags_warn_all" >&5 +$as_echo "$ac_cv_cflags_warn_all" >&6; } + +case ".$ac_cv_cflags_warn_all" in + .ok|.ok,*) ;; + .|.no|.no,*) ;; + *) if ${CFLAGS+:} false; then : + case " $CFLAGS " in + *" $ac_cv_cflags_warn_all "*) + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$ac_cv_cflags_warn_all"; } >&5 + (: CFLAGS already contains $ac_cv_cflags_warn_all) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + ;; + *) + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_warn_all\""; } >&5 + (: CFLAGS="$CFLAGS $ac_cv_cflags_warn_all") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + CFLAGS="$CFLAGS $ac_cv_cflags_warn_all" + ;; + esac +else + CFLAGS="$ac_cv_cflags_warn_all" +fi + ;; +esac + +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 + +if test "x$GCC" = "xyes"; then + CFLAGS="$CFLAGS -fexceptions" + touch local.exp +else + cat > local.exp <&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } @@ -11005,7 +13116,7 @@ for ac_header in sys/mman.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mman_h" = x""yes; then : +if test "x$ac_cv_header_sys_mman_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_MMAN_H 1 _ACEOF @@ -11017,7 +13128,7 @@ for ac_func in mmap do : ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" -if test "x$ac_cv_func_mmap" = x""yes; then : +if test "x$ac_cv_func_mmap" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MMAP 1 _ACEOF @@ -11027,7 +13138,7 @@ ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mman_h" = x""yes; then : +if test "x$ac_cv_header_sys_mman_h" = xyes; then : libffi_header_sys_mman_h=yes else libffi_header_sys_mman_h=no @@ -11035,7 +13146,7 @@ ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" -if test "x$ac_cv_func_mmap" = x""yes; then : +if test "x$ac_cv_func_mmap" = xyes; then : libffi_func_mmap=yes else libffi_func_mmap=no @@ -11049,7 +13160,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether read-only mmap of a plain file works" >&5 $as_echo_n "checking whether read-only mmap of a plain file works... " >&6; } -if test "${ac_cv_func_mmap_file+set}" = set; then : +if ${ac_cv_func_mmap_file+:} false; then : $as_echo_n "(cached) " >&6 else # Add a system to this blacklist if @@ -11068,7 +13179,7 @@ $as_echo "$ac_cv_func_mmap_file" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mmap from /dev/zero works" >&5 $as_echo_n "checking whether mmap from /dev/zero works... " >&6; } -if test "${ac_cv_func_mmap_dev_zero+set}" = set; then : +if ${ac_cv_func_mmap_dev_zero+:} false; then : $as_echo_n "(cached) " >&6 else # Add a system to this blacklist if it has mmap() but /dev/zero @@ -11094,7 +13205,7 @@ # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANON(YMOUS)" >&5 $as_echo_n "checking for MAP_ANON(YMOUS)... " >&6; } -if test "${ac_cv_decl_map_anon+set}" = set; then : +if ${ac_cv_decl_map_anon+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11130,7 +13241,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mmap with MAP_ANON(YMOUS) works" >&5 $as_echo_n "checking whether mmap with MAP_ANON(YMOUS) works... " >&6; } -if test "${ac_cv_func_mmap_anon+set}" = set; then : +if ${ac_cv_func_mmap_anon+:} false; then : $as_echo_n "(cached) " >&6 else # Add a system to this blacklist if it has mmap() and MAP_ANON or @@ -11178,9 +13289,13 @@ TARGETDIR="unknown" case "$host" in + aarch64*-*-*) + TARGET=AARCH64; TARGETDIR=aarch64 + ;; + alpha*-*-*) TARGET=ALPHA; TARGETDIR=alpha; - # Support 128-bit long double, changable via command-line switch. + # Support 128-bit long double, changeable via command-line switch. HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)' ;; @@ -11194,12 +13309,20 @@ amd64-*-freebsd*) TARGET=X86_64; TARGETDIR=x86 + ;; + + amd64-*-freebsd*) + TARGET=X86_64; TARGETDIR=x86 ;; avr32*-*-*) TARGET=AVR32; TARGETDIR=avr32 ;; + bfin*) + TARGET=BFIN; TARGETDIR=bfin + ;; + cris-*-*) TARGET=LIBFFI_CRIS; TARGETDIR=cris ;; @@ -11208,7 +13331,7 @@ TARGET=FRV; TARGETDIR=frv ;; - hppa*-*-linux* | parisc*-*-linux*) + hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*) TARGET=PA_LINUX; TARGETDIR=pa ;; hppa*64-*-hpux*) @@ -11221,22 +13344,65 @@ i?86-*-freebsd* | i?86-*-openbsd*) TARGET=X86_FREEBSD; TARGETDIR=x86 ;; - i?86-win32* | i?86-*-cygwin* | i?86-*-mingw*) + i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2* | i?86-*-interix*) TARGET=X86_WIN32; TARGETDIR=x86 - # All mingw/cygwin/win32 builds require this for sharedlib - AM_LTLDFLAGS="-no-undefined" + # All mingw/cygwin/win32 builds require -no-undefined for sharedlib. + # We must also check with_cross_host to decide if this is a native + # or cross-build and select where to install dlls appropriately. + if test -n "$with_cross_host" && + test x"$with_cross_host" != x"no"; then + AM_LTLDFLAGS='-no-undefined -bindir "$(toolexeclibdir)"'; + else + AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"'; + fi ;; i?86-*-darwin*) TARGET=X86_DARWIN; TARGETDIR=x86 ;; i?86-*-solaris2.1[0-9]*) - TARGET=X86_64; TARGETDIR=x86 - ;; + TARGETDIR=x86 + if test $ac_cv_sizeof_size_t = 4; then + TARGET=X86; + else + TARGET=X86_64; + fi + ;; + i*86-*-nto-qnx*) TARGET=X86; TARGETDIR=x86 ;; - i?86-*-*) - TARGET=X86; TARGETDIR=x86 + + x86_64-*-darwin*) + TARGET=X86_DARWIN; TARGETDIR=x86 + ;; + + x86_64-*-cygwin* | x86_64-*-mingw*) + TARGET=X86_WIN64; TARGETDIR=x86 + # All mingw/cygwin/win32 builds require -no-undefined for sharedlib. + # We must also check with_cross_host to decide if this is a native + # or cross-build and select where to install dlls appropriately. + if test -n "$with_cross_host" && + test x"$with_cross_host" != x"no"; then + AM_LTLDFLAGS='-no-undefined -bindir "$(toolexeclibdir)"'; + else + AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"'; + fi + ;; + + i?86-*-* | x86_64-*-*) + TARGETDIR=x86 + if test $ac_cv_sizeof_size_t = 4; then + case "$host" in + *-gnux32) + TARGET=X86_64 + ;; + *) + TARGET=X86 + ;; + esac + else + TARGET=X86_64; + fi ;; ia64*-*-*) @@ -11251,10 +13417,22 @@ TARGET=M68K; TARGETDIR=m68k ;; - mips-sgi-irix5.* | mips-sgi-irix6.*) + microblaze*-*-*) + TARGET=MICROBLAZE; TARGETDIR=microblaze + ;; + + moxie-*-*) + TARGET=MOXIE; TARGETDIR=moxie + ;; + + metag-*-*) + TARGET=METAG; TARGETDIR=metag + ;; + + mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) TARGET=MIPS_IRIX; TARGETDIR=mips ;; - mips*-*-linux*) + mips*-*-linux* | mips*-*-openbsd*) # Support 128-bit long double for NewABI. HAVE_LONG_DOUBLE='defined(__mips64)' TARGET=MIPS_IRIX; TARGETDIR=mips @@ -11263,18 +13441,24 @@ powerpc*-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc ;; + powerpc-*-amigaos*) + TARGET=POWERPC; TARGETDIR=powerpc + ;; powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc ;; - powerpc-*-darwin*) + powerpc-*-darwin* | powerpc64-*-darwin*) TARGET=POWERPC_DARWIN; TARGETDIR=powerpc ;; powerpc-*-aix* | rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc ;; - powerpc-*-freebsd*) + powerpc-*-freebsd* | powerpc-*-openbsd*) TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc ;; + powerpc64-*-freebsd*) + TARGET=POWERPC; TARGETDIR=powerpc + ;; powerpc*-*-rtems*) TARGET=POWERPC; TARGETDIR=powerpc ;; @@ -11294,24 +13478,21 @@ TARGET=SPARC; TARGETDIR=sparc ;; - x86_64-*-darwin*) - TARGET=X86_DARWIN; TARGETDIR=x86 - ;; - - x86_64-*-cygwin* | x86_64-*-mingw*) - TARGET=X86_WIN64; TARGETDIR=x86 - ;; - - x86_64-*-*) - TARGET=X86_64; TARGETDIR=x86 - ;; + tile*-*) + TARGET=TILE; TARGETDIR=tile + ;; + + xtensa*-*) + TARGET=XTENSA; TARGETDIR=xtensa + ;; + esac if test $TARGETDIR = unknown; then - as_fn_error "\"libffi has not been ported to $host.\"" "$LINENO" 5 + as_fn_error $? "\"libffi has not been ported to $host.\"" "$LINENO" 5 fi if expr x$TARGET : 'xMIPS' > /dev/null; then @@ -11322,6 +13503,14 @@ MIPS_FALSE= fi + if test x$TARGET = xBFIN; then + BFIN_TRUE= + BFIN_FALSE='#' +else + BFIN_TRUE='#' + BFIN_FALSE= +fi + if test x$TARGET = xSPARC; then SPARC_TRUE= SPARC_FALSE='#' @@ -11402,6 +13591,30 @@ M68K_FALSE= fi + if test x$TARGET = xMICROBLAZE; then + MICROBLAZE_TRUE= + MICROBLAZE_FALSE='#' +else + MICROBLAZE_TRUE='#' + MICROBLAZE_FALSE= +fi + + if test x$TARGET = xMETAG; then + METAG_TRUE= + METAG_FALSE='#' +else + METAG_TRUE='#' + METAG_FALSE= +fi + + if test x$TARGET = xMOXIE; then + MOXIE_TRUE= + MOXIE_FALSE='#' +else + MOXIE_TRUE='#' + MOXIE_FALSE= +fi + if test x$TARGET = xPOWERPC; then POWERPC_TRUE= POWERPC_FALSE='#' @@ -11434,6 +13647,14 @@ POWERPC_FREEBSD_FALSE= fi + if test x$TARGET = xAARCH64; then + AARCH64_TRUE= + AARCH64_FALSE='#' +else + AARCH64_TRUE='#' + AARCH64_FALSE= +fi + if test x$TARGET = xARM; then ARM_TRUE= ARM_FALSE='#' @@ -11522,10 +13743,26 @@ PA64_HPUX_FALSE= fi + if test x$TARGET = xTILE; then + TILE_TRUE= + TILE_FALSE='#' +else + TILE_TRUE='#' + TILE_FALSE= +fi + + if test x$TARGET = xXTENSA; then + XTENSA_TRUE= + XTENSA_FALSE='#' +else + XTENSA_TRUE='#' + XTENSA_FALSE= +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11638,7 +13875,7 @@ for ac_func in memcpy do : ac_fn_c_check_func "$LINENO" "memcpy" "ac_cv_func_memcpy" -if test "x$ac_cv_func_memcpy" = x""yes; then : +if test "x$ac_cv_func_memcpy" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MEMCPY 1 _ACEOF @@ -11646,11 +13883,22 @@ fi done +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } -if test "${ac_cv_working_alloca_h+set}" = set; then : +if ${ac_cv_working_alloca_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11683,7 +13931,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } -if test "${ac_cv_func_alloca_works+set}" = set; then : +if ${ac_cv_func_alloca_works+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11702,7 +13950,7 @@ #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ -char *alloca (); +void *alloca (size_t); # endif # endif # endif @@ -11746,7 +13994,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } -if test "${ac_cv_os_cray+set}" = set; then : +if ${ac_cv_os_cray+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11773,8 +14021,7 @@ for ac_func in _getb67 GETB67 getb67; do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func @@ -11788,7 +14035,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } -if test "${ac_cv_c_stack_direction+set}" = set; then : +if ${ac_cv_c_stack_direction+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -11798,23 +14045,20 @@ /* end confdefs.h. */ $ac_includes_default int -find_stack_direction () -{ - static char *addr = 0; - auto char dummy; - if (addr == 0) - { - addr = &dummy; - return find_stack_direction (); - } - else - return (&dummy > addr) ? 1 : -1; -} - -int -main () -{ - return find_stack_direction () < 0; +find_stack_direction (int *addr, int depth) +{ + int dir, dummy = 0; + if (! addr) + addr = &dummy; + *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; + dir = depth ? find_stack_direction (addr, depth - 1) : 0; + return dir + dummy; +} + +int +main (int argc, char **argv) +{ + return find_stack_direction (0, argc + !argv + 20) < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : @@ -11843,7 +14087,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 $as_echo_n "checking size of double... " >&6; } -if test "${ac_cv_sizeof_double+set}" = set; then : +if ${ac_cv_sizeof_double+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : @@ -11852,9 +14096,8 @@ if test "$ac_cv_type_double" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (double) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (double) +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_double=0 fi @@ -11877,7 +14120,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long double" >&5 $as_echo_n "checking size of long double... " >&6; } -if test "${ac_cv_sizeof_long_double+set}" = set; then : +if ${ac_cv_sizeof_long_double+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long double))" "ac_cv_sizeof_long_double" "$ac_includes_default"; then : @@ -11886,9 +14129,8 @@ if test "$ac_cv_type_long_double" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (long double) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (long double) +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_double=0 fi @@ -11922,7 +14164,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then : +if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown @@ -12140,18 +14382,18 @@ ;; #( *) - as_fn_error "unknown endianness + as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .cfi pseudo-op support" >&5 $as_echo_n "checking assembler .cfi pseudo-op support... " >&6; } -if test "${libffi_cv_as_cfi_pseudo_op+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - libffi_cv_as_cfi_pseudo_op=unknown +if ${gcc_cv_as_cfi_pseudo_op+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gcc_cv_as_cfi_pseudo_op=unknown cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ asm (".cfi_startproc\n\t.cfi_endproc"); @@ -12164,25 +14406,26 @@ } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - libffi_cv_as_cfi_pseudo_op=yes -else - libffi_cv_as_cfi_pseudo_op=no + gcc_cv_as_cfi_pseudo_op=yes +else + gcc_cv_as_cfi_pseudo_op=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_cfi_pseudo_op" >&5 -$as_echo "$libffi_cv_as_cfi_pseudo_op" >&6; } -if test "x$libffi_cv_as_cfi_pseudo_op" = xyes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_cfi_pseudo_op" >&5 +$as_echo "$gcc_cv_as_cfi_pseudo_op" >&6; } + if test "x$gcc_cv_as_cfi_pseudo_op" = xyes; then $as_echo "#define HAVE_AS_CFI_PSEUDO_OP 1" >>confdefs.h -fi + fi + if test x$TARGET = xSPARC; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler and linker support unaligned pc related relocs" >&5 $as_echo_n "checking assembler and linker support unaligned pc related relocs... " >&6; } -if test "${libffi_cv_as_sparc_ua_pcrel+set}" = set; then : +if ${libffi_cv_as_sparc_ua_pcrel+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12221,7 +14464,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .register pseudo-op support" >&5 $as_echo_n "checking assembler .register pseudo-op support... " >&6; } -if test "${libffi_cv_as_register_pseudo_op+set}" = set; then : +if ${libffi_cv_as_register_pseudo_op+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12229,11 +14472,11 @@ # Check if we have .register cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + +int +main () +{ asm (".register %g2, #scratch"); -int -main () -{ - ; return 0; } @@ -12258,7 +14501,7 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports pc related relocs" >&5 $as_echo_n "checking assembler supports pc related relocs... " >&6; } -if test "${libffi_cv_as_x86_pcrel+set}" = set; then : +if ${libffi_cv_as_x86_pcrel+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12276,77 +14519,255 @@ $as_echo "#define HAVE_AS_X86_PCREL 1" >>confdefs.h fi -fi - + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .ascii pseudo-op support" >&5 +$as_echo_n "checking assembler .ascii pseudo-op support... " >&6; } +if ${libffi_cv_as_ascii_pseudo_op+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libffi_cv_as_ascii_pseudo_op=unknown + # Check if we have .ascii + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +asm (".ascii \\"string\\""); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libffi_cv_as_ascii_pseudo_op=yes +else + libffi_cv_as_ascii_pseudo_op=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_ascii_pseudo_op" >&5 +$as_echo "$libffi_cv_as_ascii_pseudo_op" >&6; } + if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then + +$as_echo "#define HAVE_AS_ASCII_PSEUDO_OP 1" >>confdefs.h + + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .string pseudo-op support" >&5 +$as_echo_n "checking assembler .string pseudo-op support... " >&6; } +if ${libffi_cv_as_string_pseudo_op+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libffi_cv_as_string_pseudo_op=unknown + # Check if we have .string + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +asm (".string \\"string\\""); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libffi_cv_as_string_pseudo_op=yes +else + libffi_cv_as_string_pseudo_op=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_string_pseudo_op" >&5 +$as_echo "$libffi_cv_as_string_pseudo_op" >&6; } + if test "x$libffi_cv_as_string_pseudo_op" = xyes; then + +$as_echo "#define HAVE_AS_STRING_PSEUDO_OP 1" >>confdefs.h + + fi +fi + +# On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. +# Check whether --enable-pax_emutramp was given. +if test "${enable_pax_emutramp+set}" = set; then : + enableval=$enable_pax_emutramp; if test "$enable_pax_emutramp" = "yes"; then + +$as_echo "#define FFI_MMAP_EXEC_EMUTRAMP_PAX 1" >>confdefs.h + + fi +fi + + +if test x$TARGET = xX86_WIN64; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _ prefix in compiled symbols" >&5 +$as_echo_n "checking for _ prefix in compiled symbols... " >&6; } +if ${lt_cv_sys_symbol_underscore+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sys_symbol_underscore=no + cat > conftest.$ac_ext <<_LT_EOF +void nm_test_func(){} +int main(){nm_test_func;return 0;} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + ac_nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$ac_nlist"; then + # See whether the symbols have a leading underscore. + if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then + lt_cv_sys_symbol_underscore=yes + else + if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then + : + else + echo "configure: cannot find nm_test_func in $ac_nlist" >&5 + fi + fi + else + echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "configure: failed program was:" >&5 + cat conftest.c >&5 + fi + rm -rf conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_symbol_underscore" >&5 +$as_echo "$lt_cv_sys_symbol_underscore" >&6; } + sys_symbol_underscore=$lt_cv_sys_symbol_underscore + + + if test "x$sys_symbol_underscore" = xyes; then + +$as_echo "#define SYMBOL_UNDERSCORE 1" >>confdefs.h + + fi +fi + +FFI_EXEC_TRAMPOLINE_TABLE=0 case "$target" in - *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*) + *arm*-apple-darwin*) + FFI_EXEC_TRAMPOLINE_TABLE=1 + +$as_echo "#define FFI_EXEC_TRAMPOLINE_TABLE 1" >>confdefs.h + + ;; + *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) $as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h ;; esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .eh_frame section should be read-only" >&5 + if test x$FFI_EXEC_TRAMPOLINE_TABLE = x1; then + FFI_EXEC_TRAMPOLINE_TABLE_TRUE= + FFI_EXEC_TRAMPOLINE_TABLE_FALSE='#' +else + FFI_EXEC_TRAMPOLINE_TABLE_TRUE='#' + FFI_EXEC_TRAMPOLINE_TABLE_FALSE= +fi + + + +if test x$TARGET = xX86_64; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports unwind section type" >&5 +$as_echo_n "checking assembler supports unwind section type... " >&6; } +if ${libffi_cv_as_x86_64_unwind_section_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libffi_cv_as_x86_64_unwind_section_type=yes + echo '.section .eh_frame,"a", at unwind' > conftest.s + if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then + libffi_cv_as_x86_64_unwind_section_type=no + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_x86_64_unwind_section_type" >&5 +$as_echo "$libffi_cv_as_x86_64_unwind_section_type" >&6; } + if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then + +$as_echo "#define HAVE_AS_X86_64_UNWIND_SECTION_TYPE 1" >>confdefs.h + + fi +fi + +if test "x$GCC" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .eh_frame section should be read-only" >&5 $as_echo_n "checking whether .eh_frame section should be read-only... " >&6; } -if test "${libffi_cv_ro_eh_frame+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - libffi_cv_ro_eh_frame=no - echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c - if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then - if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then - libffi_cv_ro_eh_frame=yes - elif grep '.section.*eh_frame.*#alloc' conftest.c \ - | grep -v '#write' > /dev/null; then - libffi_cv_ro_eh_frame=yes - fi - fi - rm -f conftest.* +if ${libffi_cv_ro_eh_frame+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libffi_cv_ro_eh_frame=no + echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c + if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then + objdump -h conftest.o > conftest.dump 2>&1 + libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1` + libffi_test_line=`expr $libffi_eh_frame_line + 1`p + sed -n $libffi_test_line conftest.dump > conftest.line + if grep READONLY conftest.line > /dev/null; then + libffi_cv_ro_eh_frame=yes + fi + fi + rm -f conftest.* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_ro_eh_frame" >&5 $as_echo "$libffi_cv_ro_eh_frame" >&6; } -if test "x$libffi_cv_ro_eh_frame" = xyes; then + if test "x$libffi_cv_ro_eh_frame" = xyes; then $as_echo "#define HAVE_RO_EH_FRAME 1" >>confdefs.h $as_echo "#define EH_FRAME_FLAGS \"a\"" >>confdefs.h -else + else $as_echo "#define EH_FRAME_FLAGS \"aw\"" >>confdefs.h -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((visibility(\"hidden\")))" >&5 + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((visibility(\"hidden\")))" >&5 $as_echo_n "checking for __attribute__((visibility(\"hidden\")))... " >&6; } -if test "${libffi_cv_hidden_visibility_attribute+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c - libffi_cv_hidden_visibility_attribute=no - if { ac_try='${CC-cc} -Werror -S conftest.c -o conftest.s 1>&5' +if ${libffi_cv_hidden_visibility_attribute+:} false; then : + $as_echo_n "(cached) " >&6 +else + + echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1 ; }' > conftest.c + libffi_cv_hidden_visibility_attribute=no + if { ac_try='${CC-cc} -Werror -S conftest.c -o conftest.s 1>&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then - if grep '\.hidden.*foo' conftest.s >/dev/null; then - libffi_cv_hidden_visibility_attribute=yes - fi - fi - rm -f conftest.* + if grep '\.hidden.*foo' conftest.s >/dev/null; then + libffi_cv_hidden_visibility_attribute=yes + fi + fi + rm -f conftest.* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_hidden_visibility_attribute" >&5 $as_echo "$libffi_cv_hidden_visibility_attribute" >&6; } -if test $libffi_cv_hidden_visibility_attribute = yes; then + if test $libffi_cv_hidden_visibility_attribute = yes; then $as_echo "#define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1" >>confdefs.h + fi fi @@ -12365,6 +14786,14 @@ fi fi + if test "$enable_debug" = "yes"; then + FFI_DEBUG_TRUE= + FFI_DEBUG_FALSE='#' +else + FFI_DEBUG_TRUE='#' + FFI_DEBUG_FALSE= +fi + # Check whether --enable-structs was given. if test "${enable_structs+set}" = set; then : @@ -12375,6 +14804,14 @@ fi fi + if test "$enable_debug" = "yes"; then + FFI_DEBUG_TRUE= + FFI_DEBUG_FALSE='#' +else + FFI_DEBUG_TRUE='#' + FFI_DEBUG_FALSE= +fi + # Check whether --enable-raw-api was given. if test "${enable_raw_api+set}" = set; then : @@ -12396,27 +14833,27 @@ fi -if test -n "$with_cross_host" && - test x"$with_cross_host" != x"no"; then - toolexecdir='$(exec_prefix)/$(target_alias)' - toolexeclibdir='$(toolexecdir)/lib' -else - toolexecdir='$(libdir)/gcc-lib/$(target_alias)' +# These variables are only ever used when we cross-build to X86_WIN32. +# And we only support this with GCC, so... +if test "x$GCC" = "xyes"; then + if test -n "$with_cross_host" && + test x"$with_cross_host" != x"no"; then + toolexecdir='$(exec_prefix)/$(target_alias)' + toolexeclibdir='$(toolexecdir)/lib' + else + toolexecdir='$(libdir)/gcc-lib/$(target_alias)' + toolexeclibdir='$(libdir)' + fi + multi_os_directory=`$CC -print-multi-os-directory` + case $multi_os_directory in + .) ;; # Avoid trailing /. + ../*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; + esac + +else toolexeclibdir='$(libdir)' fi -multi_os_directory=`$CC -print-multi-os-directory` -case $multi_os_directory in - .) ;; # Avoid trailing /. - *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; -esac - - - -if test "${multilib}" = "yes"; then - multilib_arg="--enable-multilib" -else - multilib_arg= -fi + ac_config_commands="$ac_config_commands include" @@ -12499,10 +14936,21 @@ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -12518,6 +14966,7 @@ ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' @@ -12532,6 +14981,14 @@ LTLIBOBJS=$ac_ltlibobjs +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -12541,132 +14998,172 @@ fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error "conditional \"AMDEP\" was never defined. + as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error "conditional \"am__fastdepCC\" was never defined. + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then - as_fn_error "conditional \"am__fastdepCCAS\" was never defined. + as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then - as_fn_error "conditional \"MAINTAINER_MODE\" was never defined. + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${TESTSUBDIR_TRUE}" && test -z "${TESTSUBDIR_FALSE}"; then - as_fn_error "conditional \"TESTSUBDIR\" was never defined. + as_fn_error $? "conditional \"TESTSUBDIR\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${MIPS_TRUE}" && test -z "${MIPS_FALSE}"; then - as_fn_error "conditional \"MIPS\" was never defined. + as_fn_error $? "conditional \"MIPS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${BFIN_TRUE}" && test -z "${BFIN_FALSE}"; then + as_fn_error $? "conditional \"BFIN\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${SPARC_TRUE}" && test -z "${SPARC_FALSE}"; then - as_fn_error "conditional \"SPARC\" was never defined. + as_fn_error $? "conditional \"SPARC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_TRUE}" && test -z "${X86_FALSE}"; then - as_fn_error "conditional \"X86\" was never defined. + as_fn_error $? "conditional \"X86\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_FREEBSD_TRUE}" && test -z "${X86_FREEBSD_FALSE}"; then - as_fn_error "conditional \"X86_FREEBSD\" was never defined. + as_fn_error $? "conditional \"X86_FREEBSD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_WIN32_TRUE}" && test -z "${X86_WIN32_FALSE}"; then - as_fn_error "conditional \"X86_WIN32\" was never defined. + as_fn_error $? "conditional \"X86_WIN32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_WIN64_TRUE}" && test -z "${X86_WIN64_FALSE}"; then - as_fn_error "conditional \"X86_WIN64\" was never defined. + as_fn_error $? "conditional \"X86_WIN64\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_DARWIN_TRUE}" && test -z "${X86_DARWIN_FALSE}"; then - as_fn_error "conditional \"X86_DARWIN\" was never defined. + as_fn_error $? "conditional \"X86_DARWIN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ALPHA_TRUE}" && test -z "${ALPHA_FALSE}"; then - as_fn_error "conditional \"ALPHA\" was never defined. + as_fn_error $? "conditional \"ALPHA\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${IA64_TRUE}" && test -z "${IA64_FALSE}"; then - as_fn_error "conditional \"IA64\" was never defined. + as_fn_error $? "conditional \"IA64\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${M32R_TRUE}" && test -z "${M32R_FALSE}"; then - as_fn_error "conditional \"M32R\" was never defined. + as_fn_error $? "conditional \"M32R\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${M68K_TRUE}" && test -z "${M68K_FALSE}"; then - as_fn_error "conditional \"M68K\" was never defined. + as_fn_error $? "conditional \"M68K\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${MICROBLAZE_TRUE}" && test -z "${MICROBLAZE_FALSE}"; then + as_fn_error $? "conditional \"MICROBLAZE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${METAG_TRUE}" && test -z "${METAG_FALSE}"; then + as_fn_error $? "conditional \"METAG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MOXIE_TRUE}" && test -z "${MOXIE_FALSE}"; then + as_fn_error $? "conditional \"MOXIE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${POWERPC_TRUE}" && test -z "${POWERPC_FALSE}"; then - as_fn_error "conditional \"POWERPC\" was never defined. + as_fn_error $? "conditional \"POWERPC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${POWERPC_AIX_TRUE}" && test -z "${POWERPC_AIX_FALSE}"; then - as_fn_error "conditional \"POWERPC_AIX\" was never defined. + as_fn_error $? "conditional \"POWERPC_AIX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${POWERPC_DARWIN_TRUE}" && test -z "${POWERPC_DARWIN_FALSE}"; then - as_fn_error "conditional \"POWERPC_DARWIN\" was never defined. + as_fn_error $? "conditional \"POWERPC_DARWIN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${POWERPC_FREEBSD_TRUE}" && test -z "${POWERPC_FREEBSD_FALSE}"; then - as_fn_error "conditional \"POWERPC_FREEBSD\" was never defined. + as_fn_error $? "conditional \"POWERPC_FREEBSD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${AARCH64_TRUE}" && test -z "${AARCH64_FALSE}"; then + as_fn_error $? "conditional \"AARCH64\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${ARM_TRUE}" && test -z "${ARM_FALSE}"; then - as_fn_error "conditional \"ARM\" was never defined. + as_fn_error $? "conditional \"ARM\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AVR32_TRUE}" && test -z "${AVR32_FALSE}"; then - as_fn_error "conditional \"AVR32\" was never defined. + as_fn_error $? "conditional \"AVR32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${LIBFFI_CRIS_TRUE}" && test -z "${LIBFFI_CRIS_FALSE}"; then - as_fn_error "conditional \"LIBFFI_CRIS\" was never defined. + as_fn_error $? "conditional \"LIBFFI_CRIS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${FRV_TRUE}" && test -z "${FRV_FALSE}"; then - as_fn_error "conditional \"FRV\" was never defined. + as_fn_error $? "conditional \"FRV\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${S390_TRUE}" && test -z "${S390_FALSE}"; then - as_fn_error "conditional \"S390\" was never defined. + as_fn_error $? "conditional \"S390\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_64_TRUE}" && test -z "${X86_64_FALSE}"; then - as_fn_error "conditional \"X86_64\" was never defined. + as_fn_error $? "conditional \"X86_64\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${SH_TRUE}" && test -z "${SH_FALSE}"; then - as_fn_error "conditional \"SH\" was never defined. + as_fn_error $? "conditional \"SH\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${SH64_TRUE}" && test -z "${SH64_FALSE}"; then - as_fn_error "conditional \"SH64\" was never defined. + as_fn_error $? "conditional \"SH64\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${PA_LINUX_TRUE}" && test -z "${PA_LINUX_FALSE}"; then - as_fn_error "conditional \"PA_LINUX\" was never defined. + as_fn_error $? "conditional \"PA_LINUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${PA_HPUX_TRUE}" && test -z "${PA_HPUX_FALSE}"; then - as_fn_error "conditional \"PA_HPUX\" was never defined. + as_fn_error $? "conditional \"PA_HPUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${PA64_HPUX_TRUE}" && test -z "${PA64_HPUX_FALSE}"; then - as_fn_error "conditional \"PA64_HPUX\" was never defined. + as_fn_error $? "conditional \"PA64_HPUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi - - -: ${CONFIG_STATUS=./config.status} +if test -z "${TILE_TRUE}" && test -z "${TILE_FALSE}"; then + as_fn_error $? "conditional \"TILE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${XTENSA_TRUE}" && test -z "${XTENSA_FALSE}"; then + as_fn_error $? "conditional \"XTENSA\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +if test -z "${FFI_EXEC_TRAMPOLINE_TABLE_TRUE}" && test -z "${FFI_EXEC_TRAMPOLINE_TABLE_FALSE}"; then + as_fn_error $? "conditional \"FFI_EXEC_TRAMPOLINE_TABLE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${FFI_DEBUG_TRUE}" && test -z "${FFI_DEBUG_FALSE}"; then + as_fn_error $? "conditional \"FFI_DEBUG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${FFI_DEBUG_TRUE}" && test -z "${FFI_DEBUG_FALSE}"; then + as_fn_error $? "conditional \"FFI_DEBUG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -12767,6 +15264,7 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -12812,19 +15310,19 @@ (unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 - fi - $as_echo "$as_me: error: $1" >&2 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -12962,16 +15460,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -13020,7 +15518,7 @@ test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -13031,28 +15529,16 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -13073,8 +15559,8 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libffi $as_me 3.0.10rc0, which was -generated by GNU Autoconf 2.65. Invocation command line was +This file was extended by libffi $as_me 3.0.13, which was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -13137,17 +15623,17 @@ Configuration commands: $config_commands -Report bugs to ." +Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libffi config.status 3.0.10rc0 -configured by $0, generated by GNU Autoconf 2.65, +libffi config.status 3.0.13 +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -13165,11 +15651,16 @@ while test $# != 0 do case $1 in - --*=*) + --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; *) ac_option=$1 ac_optarg=$2 @@ -13191,6 +15682,7 @@ $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; @@ -13203,7 +15695,7 @@ ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - as_fn_error "ambiguous option: \`$1' + as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; @@ -13212,7 +15704,7 @@ ac_cs_silent=: ;; # This is an error. - -*) as_fn_error "unrecognized option: \`$1' + -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" @@ -13232,7 +15724,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' @@ -13256,6 +15748,14 @@ # # INIT-COMMANDS # +ax_enable_builddir_srcdir="$srcdir" # $srcdir +ax_enable_builddir_host="$HOST" # $HOST / $host +ax_enable_builddir_version="$VERSION" # $VERSION +ax_enable_builddir_package="$PACKAGE" # $PACKAGE +ax_enable_builddir_auxdir="$ax_enable_builddir_auxdir" # $AUX +ax_enable_builddir_sed="$ax_enable_builddir_sed" # $SED +ax_enable_builddir="$ax_enable_builddir" # $SUB + AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" @@ -13266,131 +15766,154 @@ sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' -macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' -macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' -enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' -pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' -host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' -host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' -host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' -build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' -build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' -build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' -SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' -Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' -GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' -EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' -FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' -LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' -NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' -LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' -ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' -exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' -lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' -reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' -AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' -STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' -RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' -CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' -compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' -GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' -objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' -SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' -ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' -need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' -LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' -OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' -libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' -module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' -fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' -need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' -version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' -runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' -libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' -soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' -finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' -old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' -striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + # Quote evaled strings. -for var in SED \ +for var in SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ GREP \ EGREP \ FGREP \ @@ -13403,8 +15926,13 @@ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ +archiver_list_spec \ STRIP \ RANLIB \ CC \ @@ -13414,14 +15942,14 @@ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -SHELL \ -ECHO \ +nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ lt_prog_compiler_wl \ -lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ +MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ @@ -13435,9 +15963,7 @@ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ -hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ -fix_srcfile_path \ exclude_expsyms \ include_expsyms \ file_list_spec \ @@ -13445,12 +15971,13 @@ libname_spec \ library_names_spec \ soname_spec \ +install_override_mode \ finish_eval \ old_striplib \ striplib; do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -13472,14 +15999,15 @@ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ +postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -13487,12 +16015,6 @@ esac done -# Fix-up fallback echo if it was mangled by the above quoting rules. -case \$lt_ECHO in -*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` - ;; -esac - ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' @@ -13523,6 +16045,7 @@ do case $ac_config_target in "fficonfig.h") CONFIG_HEADERS="$CONFIG_HEADERS fficonfig.h" ;; + "buildir") CONFIG_COMMANDS="$CONFIG_COMMANDS buildir" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "include") CONFIG_COMMANDS="$CONFIG_COMMANDS include" ;; @@ -13537,7 +16060,7 @@ "include/ffi_common.h") CONFIG_LINKS="$CONFIG_LINKS include/ffi_common.h:include/ffi_common.h" ;; "fficonfig.py") CONFIG_FILES="$CONFIG_FILES fficonfig.py" ;; - *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -13561,9 +16084,10 @@ # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -13571,12 +16095,13 @@ { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -13593,12 +16118,12 @@ fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' + ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -13607,18 +16132,18 @@ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -13626,7 +16151,7 @@ rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -13674,7 +16199,7 @@ rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -13706,21 +16231,29 @@ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// s/^[^=]*=[ ]*$// }' fi @@ -13732,7 +16265,7 @@ # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || +cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -13744,11 +16277,11 @@ # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -13833,7 +16366,7 @@ _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error "could not setup config headers machinery" "$LINENO" 5 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" @@ -13846,7 +16379,7 @@ esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -13865,7 +16398,7 @@ for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -13874,7 +16407,7 @@ [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -13900,8 +16433,8 @@ esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -14037,23 +16570,24 @@ s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 +which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # @@ -14062,21 +16596,21 @@ if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error "could not create -" "$LINENO" 5 + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" @@ -14130,19 +16664,19 @@ $as_echo "$as_me: linking $ac_source to $ac_file" >&6;} if test ! -r "$ac_source"; then - as_fn_error "$ac_source: file not found" "$LINENO" 5 + as_fn_error $? "$ac_source: file not found" "$LINENO" 5 fi rm -f "$ac_file" # Try a relative symlink, then a hard link, then a copy. - case $srcdir in + case $ac_source in [\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;; *) ac_rel_source=$ac_top_build_prefix$ac_source ;; esac ln -s "$ac_rel_source" "$ac_file" 2>/dev/null || ln "$ac_source" "$ac_file" 2>/dev/null || cp -p "$ac_source" "$ac_file" || - as_fn_error "cannot link or copy $ac_source to $ac_file" "$LINENO" 5 + as_fn_error $? "cannot link or copy $ac_source to $ac_file" "$LINENO" 5 fi ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 @@ -14152,6 +16686,150 @@ case $ac_file$ac_mode in + "buildir":C) ac_top_srcdir="$ax_enable_builddir_srcdir" + if test ".$ax_enable_builddir" = ".." ; then + if test -f "$top_srcdir/Makefile" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: skipping top_srcdir/Makefile - left untouched" >&5 +$as_echo "$as_me: skipping top_srcdir/Makefile - left untouched" >&6;} + else + { $as_echo "$as_me:${as_lineno-$LINENO}: skipping top_srcdir/Makefile - not created" >&5 +$as_echo "$as_me: skipping top_srcdir/Makefile - not created" >&6;} + fi + else + if test -f "$ac_top_srcdir/Makefile" ; then + a=`grep "^VERSION " "$ac_top_srcdir/Makefile"` ; b=`grep "^VERSION " Makefile` + test "$a" != "$b" && rm "$ac_top_srcdir/Makefile" + fi + if test -f "$ac_top_srcdir/Makefile" ; then + echo "$ac_top_srcdir/Makefile : $ac_top_srcdir/Makefile.in" > $tmp/conftemp.mk + echo " @ echo 'REMOVED,,,' >\$@" >> $tmp/conftemp.mk + eval "${MAKE-make} -f $tmp/conftemp.mk 2>/dev/null >/dev/null" + if grep '^REMOVED,,,' "$ac_top_srcdir/Makefile" >/dev/null + then rm $ac_top_srcdir/Makefile ; fi + cp $tmp/conftemp.mk $ac_top_srcdir/makefiles.mk~ ## DEBUGGING + fi + if test ! -f "$ac_top_srcdir/Makefile" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: create top_srcdir/Makefile guessed from local Makefile" >&5 +$as_echo "$as_me: create top_srcdir/Makefile guessed from local Makefile" >&6;} + x='`' ; cat >$tmp/conftemp.sed <<_EOF +/^\$/n +x +/^\$/bS +x +/\\\\\$/{H;d;} +{H;s/.*//;x;} +bM +:S +x +/\\\\\$/{h;d;} +{h;s/.*//;x;} +:M +s/\\(\\n\\) /\\1 /g +/^ /d +/^[ ]*[\\#]/d +/^VPATH *=/d +s/^srcdir *=.*/srcdir = ./ +s/^top_srcdir *=.*/top_srcdir = ./ +/[:=]/!d +/^\\./d +/ = /b +/ .= /b +/:/!b +s/:.*/:/ +s/ / /g +s/ \\([a-z][a-z-]*[a-zA-Z0-9]\\)\\([ :]\\)/ \\1 \\1-all\\2/g +s/^\\([a-z][a-z-]*[a-zA-Z0-9]\\)\\([ :]\\)/\\1 \\1-all\\2/ +s/ / /g +/^all all-all[ :]/i\\ +all-configured : all-all +s/ [a-zA-Z0-9-]*-all [a-zA-Z0-9-]*-all-all//g +/-all-all/d +a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $ax_enable_builddir_auxdir/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; use=$x basename "\$\@" -all $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$n * \$\@"; if test "\$\$n" -eq "0" ; then : \\\\\\ + ; BUILD=$x grep "^####.*|" Makefile |tail -1| sed -e 's/.*|//' $x ; fi \\\\\\ + ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ + ; test "\$\$use" = "\$\@" && BUILD=$x echo "\$\$BUILD" | tail -1 $x \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; (cd "\$\$i" && test ! -f configure && \$(MAKE) \$\$use) || exit; done +/dist-all *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $ax_enable_builddir_auxdir/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; found=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).tar.*" \\\\\\ + ; if test "\$\$found" -eq "0" ; then : \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\ + ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).tar.* \\\\\\ + ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done +/dist-[a-zA-Z0-9]*-all *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh ./config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; found=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).*" \\\\\\ + ; if test "\$\$found" -eq "0" ; then : \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\ + ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).* \\\\\\ + ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done +/distclean-all *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $ax_enable_builddir_auxdir/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile | sed -e 's/.*|//' $x \\\\\\ + ; use=$x basename "\$\@" -all $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$n * \$\@ (all local builds)" \\\\\\ + ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; echo "# rm -r \$\$i"; done ; echo "# (sleep 3)" ; sleep 3 \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; echo "\$\$i" | grep "^/" > /dev/null && continue \\\\\\ + ; echo "\$\$i" | grep "^../" > /dev/null && continue \\\\\\ + ; echo "rm -r \$\$i"; (rm -r "\$\$i") ; done ; rm Makefile +_EOF + cp "$tmp/conftemp.sed" "$ac_top_srcdir/makefile.sed~" ## DEBUGGING + $ax_enable_builddir_sed -f $tmp/conftemp.sed Makefile >$ac_top_srcdir/Makefile + if test -f "$ac_top_srcdir/Makefile.mk" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: extend top_srcdir/Makefile with top_srcdir/Makefile.mk" >&5 +$as_echo "$as_me: extend top_srcdir/Makefile with top_srcdir/Makefile.mk" >&6;} + cat $ac_top_srcdir/Makefile.mk >>$ac_top_srcdir/Makefile + fi ; xxxx="####" + echo "$xxxx CONFIGURATIONS FOR TOPLEVEL MAKEFILE: " >>$ac_top_srcdir/Makefile + # sanity check + if grep '^; echo "MAKE ' $ac_top_srcdir/Makefile >/dev/null ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: buggy sed found - it deletes tab in \"a\" text parts" >&5 +$as_echo "$as_me: buggy sed found - it deletes tab in \"a\" text parts" >&6;} + $ax_enable_builddir_sed -e '/^@ HOST=/s/^/ /' -e '/^; /s/^/ /' $ac_top_srcdir/Makefile \ + >$ac_top_srcdir/Makefile~ + (test -s $ac_top_srcdir/Makefile~ && mv $ac_top_srcdir/Makefile~ $ac_top_srcdir/Makefile) 2>/dev/null + fi + else + xxxx="\\#\\#\\#\\#" + # echo "/^$xxxx *$ax_enable_builddir_host /d" >$tmp/conftemp.sed + echo "s!^$xxxx [^|]* | *$ax_enable_builddir *\$!$xxxx ...... $ax_enable_builddir!" >$tmp/conftemp.sed + $ax_enable_builddir_sed -f "$tmp/conftemp.sed" "$ac_top_srcdir/Makefile" >$tmp/mkfile.tmp + cp "$tmp/conftemp.sed" "$ac_top_srcdir/makefiles.sed~" ## DEBUGGING + cp "$tmp/mkfile.tmp" "$ac_top_srcdir/makefiles.out~" ## DEBUGGING + if cmp -s "$ac_top_srcdir/Makefile" "$tmp/mkfile.tmp" 2>/dev/null ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: keeping top_srcdir/Makefile from earlier configure" >&5 +$as_echo "$as_me: keeping top_srcdir/Makefile from earlier configure" >&6;} + rm "$tmp/mkfile.tmp" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: reusing top_srcdir/Makefile from earlier configure" >&5 +$as_echo "$as_me: reusing top_srcdir/Makefile from earlier configure" >&6;} + mv "$tmp/mkfile.tmp" "$ac_top_srcdir/Makefile" + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: build in $ax_enable_builddir (HOST=$ax_enable_builddir_host)" >&5 +$as_echo "$as_me: build in $ax_enable_builddir (HOST=$ax_enable_builddir_host)" >&6;} + xxxx="####" + echo "$xxxx" "$ax_enable_builddir_host" "|$ax_enable_builddir" >>$ac_top_srcdir/Makefile + fi + ;; "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval @@ -14166,7 +16844,7 @@ # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but + # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. @@ -14200,21 +16878,19 @@ continue fi # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || @@ -14268,7 +16944,8 @@ # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. @@ -14316,6 +16993,15 @@ # Whether or not to optimize for fast installation. fast_install=$enable_fast_install +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + # The host system. host_alias=$host_alias host=$host @@ -14365,9 +17051,11 @@ # turn newlines into spaces. NL2SP=$lt_lt_NL2SP -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP @@ -14375,13 +17063,30 @@ # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method -# Command to use when deplibs_check_method == "file_magic". +# Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + # The archiver. AR=$lt_AR + +# Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + # A symbol stripping program. STRIP=$lt_STRIP @@ -14390,6 +17095,9 @@ old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + # A C compiler. LTCC=$lt_CC @@ -14408,21 +17116,24 @@ # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and in which our libraries should be installed. +lt_sysroot=$lt_sysroot + # The name of the directory that contains temporary libtool files. objdir=$objdir -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that does not interpret backslashes. -ECHO=$lt_ECHO - # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL @@ -14479,6 +17190,9 @@ # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds @@ -14518,6 +17232,10 @@ # The linker used to build libraries. LD=$lt_LD +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds @@ -14530,12 +17248,12 @@ # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic - # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static @@ -14585,10 +17303,6 @@ # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec -# If ld is used when linking, flag to hardcode \$libdir into a binary -# during linking. This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator @@ -14622,9 +17336,6 @@ # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path - # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols @@ -14640,6 +17351,9 @@ # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + # Specify filename containing input files. file_list_spec=$lt_file_list_spec @@ -14672,212 +17386,169 @@ # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $* )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} - -_LT_EOF - ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; - esac -} - -# sed scripts: -my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[^=]*=//' - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` -} - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$@"` -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` -} - -_LT_EOF -esac - -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1+=\$2" -} -_LT_EOF - ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1=\$$1\$2" -} - -_LT_EOF - ;; - esac - - - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + + mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" @@ -14897,7 +17568,7 @@ ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. @@ -14918,7 +17589,7 @@ exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit $? + $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 diff --git a/Modules/_ctypes/libffi/configure.ac b/Modules/_ctypes/libffi/configure.ac --- a/Modules/_ctypes/libffi/configure.ac +++ b/Modules/_ctypes/libffi/configure.ac @@ -1,11 +1,11 @@ dnl Process this with autoconf to create configure # -# file from libffi - slightly patched for ctypes +# file from libffi - slightly patched for Python's ctypes # -AC_PREREQ(2.63) +AC_PREREQ(2.68) -AC_INIT([libffi], [3.0.10rc0], [http://gcc.gnu.org/bugs.html]) +AC_INIT([libffi], [3.0.13], [http://github.com/atgreen/libffi/issues]) AC_CONFIG_HEADERS([fficonfig.h]) AC_CANONICAL_SYSTEM @@ -13,18 +13,24 @@ . ${srcdir}/configure.host +AX_ENABLE_BUILDDIR + AM_INIT_AUTOMAKE # The same as in boehm-gc and libstdc++. Have to borrow it from there. # We must force CC to /not/ be precious variables; otherwise # the wrong, non-multilib-adjusted value will be used in multilibs. # As a side effect, we have to subst CFLAGS ourselves. +# Also save and restore CFLAGS, since AC_PROG_CC will come up with +# defaults of its own if none are provided. m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) m4_define([_AC_ARG_VAR_PRECIOUS],[]) +save_CFLAGS=$CFLAGS AC_PROG_CC +CFLAGS=$save_CFLAGS m4_undefine([_AC_ARG_VAR_PRECIOUS]) -m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) +m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) AC_SUBST(CFLAGS) @@ -33,6 +39,26 @@ AC_PROG_LIBTOOL AC_CONFIG_MACRO_DIR([m4]) +# Test for 64-bit build. +AC_CHECK_SIZEOF([size_t]) + +AX_COMPILER_VENDOR +AX_CC_MAXOPT +# The AX_CFLAGS_WARN_ALL macro doesn't currently work for sunpro +# compiler. +if test "$ax_cv_c_compiler_vendor" != "sun"; then + AX_CFLAGS_WARN_ALL +fi + +if test "x$GCC" = "xyes"; then + CFLAGS="$CFLAGS -fexceptions" + touch local.exp +else + cat > local.exp < /dev/null]) +AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN) AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) AM_CONDITIONAL(X86, test x$TARGET = xX86) AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD) @@ -191,10 +288,14 @@ AM_CONDITIONAL(IA64, test x$TARGET = xIA64) AM_CONDITIONAL(M32R, test x$TARGET = xM32R) AM_CONDITIONAL(M68K, test x$TARGET = xM68K) +AM_CONDITIONAL(MICROBLAZE, test x$TARGET = xMICROBLAZE) +AM_CONDITIONAL(METAG, test x$TARGET = xMETAG) +AM_CONDITIONAL(MOXIE, test x$TARGET = xMOXIE) AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC) AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX) AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN) AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD) +AM_CONDITIONAL(AARCH64, test x$TARGET = xAARCH64) AM_CONDITIONAL(ARM, test x$TARGET = xARM) AM_CONDITIONAL(AVR32, test x$TARGET = xAVR32) AM_CONDITIONAL(LIBFFI_CRIS, test x$TARGET = xLIBFFI_CRIS) @@ -206,6 +307,8 @@ AM_CONDITIONAL(PA_LINUX, test x$TARGET = xPA_LINUX) AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX) AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX) +AM_CONDITIONAL(TILE, test x$TARGET = xTILE) +AM_CONDITIONAL(XTENSA, test x$TARGET = xXTENSA) AC_HEADER_STDC AC_CHECK_FUNCS(memcpy) @@ -228,17 +331,7 @@ AC_C_BIGENDIAN -AC_CACHE_CHECK([assembler .cfi pseudo-op support], - libffi_cv_as_cfi_pseudo_op, [ - libffi_cv_as_cfi_pseudo_op=unknown - AC_TRY_COMPILE([asm (".cfi_startproc\n\t.cfi_endproc");],, - [libffi_cv_as_cfi_pseudo_op=yes], - [libffi_cv_as_cfi_pseudo_op=no]) -]) -if test "x$libffi_cv_as_cfi_pseudo_op" = xyes; then - AC_DEFINE(HAVE_AS_CFI_PSEUDO_OP, 1, - [Define if your assembler supports .cfi_* directives.]) -fi +GCC_AS_CFI_PSEUDO_OP if test x$TARGET = xSPARC; then AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs], @@ -261,7 +354,7 @@ libffi_cv_as_register_pseudo_op, [ libffi_cv_as_register_pseudo_op=unknown # Check if we have .register - AC_TRY_COMPILE([asm (".register %g2, #scratch");],, + AC_TRY_COMPILE(,[asm (".register %g2, #scratch");], [libffi_cv_as_register_pseudo_op=yes], [libffi_cv_as_register_pseudo_op=no]) ]) @@ -284,54 +377,122 @@ AC_DEFINE(HAVE_AS_X86_PCREL, 1, [Define if your assembler supports PC relative relocs.]) fi + + AC_CACHE_CHECK([assembler .ascii pseudo-op support], + libffi_cv_as_ascii_pseudo_op, [ + libffi_cv_as_ascii_pseudo_op=unknown + # Check if we have .ascii + AC_TRY_COMPILE(,[asm (".ascii \\"string\\"");], + [libffi_cv_as_ascii_pseudo_op=yes], + [libffi_cv_as_ascii_pseudo_op=no]) + ]) + if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then + AC_DEFINE(HAVE_AS_ASCII_PSEUDO_OP, 1, + [Define if your assembler supports .ascii.]) + fi + + AC_CACHE_CHECK([assembler .string pseudo-op support], + libffi_cv_as_string_pseudo_op, [ + libffi_cv_as_string_pseudo_op=unknown + # Check if we have .string + AC_TRY_COMPILE(,[asm (".string \\"string\\"");], + [libffi_cv_as_string_pseudo_op=yes], + [libffi_cv_as_string_pseudo_op=no]) + ]) + if test "x$libffi_cv_as_string_pseudo_op" = xyes; then + AC_DEFINE(HAVE_AS_STRING_PSEUDO_OP, 1, + [Define if your assembler supports .string.]) + fi fi +# On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. +AC_ARG_ENABLE(pax_emutramp, + [ --enable-pax_emutramp enable pax emulated trampolines, for we can't use PROT_EXEC], + if test "$enable_pax_emutramp" = "yes"; then + AC_DEFINE(FFI_MMAP_EXEC_EMUTRAMP_PAX, 1, + [Define this if you want to enable pax emulated trampolines]) + fi) + +if test x$TARGET = xX86_WIN64; then + LT_SYS_SYMBOL_USCORE + if test "x$sys_symbol_underscore" = xyes; then + AC_DEFINE(SYMBOL_UNDERSCORE, 1, [Define if symbols are underscored.]) + fi +fi + +FFI_EXEC_TRAMPOLINE_TABLE=0 case "$target" in - *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*) + *arm*-apple-darwin*) + FFI_EXEC_TRAMPOLINE_TABLE=1 + AC_DEFINE(FFI_EXEC_TRAMPOLINE_TABLE, 1, + [Cannot use PROT_EXEC on this target, so, we revert to + alternative means]) + ;; + *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1, [Cannot use malloc on this target, so, we revert to alternative means]) ;; esac +AM_CONDITIONAL(FFI_EXEC_TRAMPOLINE_TABLE, test x$FFI_EXEC_TRAMPOLINE_TABLE = x1) +AC_SUBST(FFI_EXEC_TRAMPOLINE_TABLE) -AC_CACHE_CHECK([whether .eh_frame section should be read-only], - libffi_cv_ro_eh_frame, [ - libffi_cv_ro_eh_frame=no - echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c - if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then - if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then - libffi_cv_ro_eh_frame=yes - elif grep '.section.*eh_frame.*#alloc' conftest.c \ - | grep -v '#write' > /dev/null; then - libffi_cv_ro_eh_frame=yes - fi +if test x$TARGET = xX86_64; then + AC_CACHE_CHECK([assembler supports unwind section type], + libffi_cv_as_x86_64_unwind_section_type, [ + libffi_cv_as_x86_64_unwind_section_type=yes + echo '.section .eh_frame,"a", at unwind' > conftest.s + if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then + libffi_cv_as_x86_64_unwind_section_type=no fi - rm -f conftest.* - ]) -if test "x$libffi_cv_ro_eh_frame" = xyes; then - AC_DEFINE(HAVE_RO_EH_FRAME, 1, - [Define if .eh_frame sections should be read-only.]) - AC_DEFINE(EH_FRAME_FLAGS, "a", - [Define to the flags needed for the .section .eh_frame directive.]) -else - AC_DEFINE(EH_FRAME_FLAGS, "aw", - [Define to the flags needed for the .section .eh_frame directive.]) + ]) + if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then + AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1, + [Define if your assembler supports unwind section type.]) + fi fi -AC_CACHE_CHECK([for __attribute__((visibility("hidden")))], - libffi_cv_hidden_visibility_attribute, [ - echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c - libffi_cv_hidden_visibility_attribute=no - if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then - if grep '\.hidden.*foo' conftest.s >/dev/null; then - libffi_cv_hidden_visibility_attribute=yes - fi - fi - rm -f conftest.* - ]) -if test $libffi_cv_hidden_visibility_attribute = yes; then - AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1, - [Define if __attribute__((visibility("hidden"))) is supported.]) +if test "x$GCC" = "xyes"; then + AC_CACHE_CHECK([whether .eh_frame section should be read-only], + libffi_cv_ro_eh_frame, [ + libffi_cv_ro_eh_frame=no + echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c + if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then + objdump -h conftest.o > conftest.dump 2>&1 + libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1` + libffi_test_line=`expr $libffi_eh_frame_line + 1`p + sed -n $libffi_test_line conftest.dump > conftest.line + if grep READONLY conftest.line > /dev/null; then + libffi_cv_ro_eh_frame=yes + fi + fi + rm -f conftest.* + ]) + if test "x$libffi_cv_ro_eh_frame" = xyes; then + AC_DEFINE(HAVE_RO_EH_FRAME, 1, + [Define if .eh_frame sections should be read-only.]) + AC_DEFINE(EH_FRAME_FLAGS, "a", + [Define to the flags needed for the .section .eh_frame directive. ]) + else + AC_DEFINE(EH_FRAME_FLAGS, "aw", + [Define to the flags needed for the .section .eh_frame directive. ]) + fi + + AC_CACHE_CHECK([for __attribute__((visibility("hidden")))], + libffi_cv_hidden_visibility_attribute, [ + echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1 ; }' > conftest.c + libffi_cv_hidden_visibility_attribute=no + if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then + if grep '\.hidden.*foo' conftest.s >/dev/null; then + libffi_cv_hidden_visibility_attribute=yes + fi + fi + rm -f conftest.* + ]) + if test $libffi_cv_hidden_visibility_attribute = yes; then + AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1, + [Define if __attribute__((visibility("hidden"))) is supported.]) + fi fi AH_BOTTOM([ @@ -360,12 +521,14 @@ if test "$enable_debug" = "yes"; then AC_DEFINE(FFI_DEBUG, 1, [Define this if you want extra debugging.]) fi) +AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes") AC_ARG_ENABLE(structs, [ --disable-structs omit code for struct support], if test "$enable_structs" = "no"; then AC_DEFINE(FFI_NO_STRUCTS, 1, [Define this is you do not want support for aggregate types.]) fi) +AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes") AC_ARG_ENABLE(raw-api, [ --disable-raw-api make the raw api unavailable], @@ -379,28 +542,28 @@ AC_DEFINE(USING_PURIFY, 1, [Define this if you are using Purify and want to suppress spurious messages.]) fi) -if test -n "$with_cross_host" && - test x"$with_cross_host" != x"no"; then - toolexecdir='$(exec_prefix)/$(target_alias)' - toolexeclibdir='$(toolexecdir)/lib' +# These variables are only ever used when we cross-build to X86_WIN32. +# And we only support this with GCC, so... +if test "x$GCC" = "xyes"; then + if test -n "$with_cross_host" && + test x"$with_cross_host" != x"no"; then + toolexecdir='$(exec_prefix)/$(target_alias)' + toolexeclibdir='$(toolexecdir)/lib' + else + toolexecdir='$(libdir)/gcc-lib/$(target_alias)' + toolexeclibdir='$(libdir)' + fi + multi_os_directory=`$CC -print-multi-os-directory` + case $multi_os_directory in + .) ;; # Avoid trailing /. + ../*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; + esac + AC_SUBST(toolexecdir) else - toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' fi -multi_os_directory=`$CC -print-multi-os-directory` -case $multi_os_directory in - .) ;; # Avoid trailing /. - *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; -esac -AC_SUBST(toolexecdir) AC_SUBST(toolexeclibdir) -if test "${multilib}" = "yes"; then - multilib_arg="--enable-multilib" -else - multilib_arg= -fi - AC_CONFIG_COMMANDS(include, [test -d include || mkdir include]) AC_CONFIG_COMMANDS(src, [ test -d src || mkdir src diff --git a/Modules/_ctypes/libffi/depcomp b/Modules/_ctypes/libffi/depcomp --- a/Modules/_ctypes/libffi/depcomp +++ b/Modules/_ctypes/libffi/depcomp @@ -1,10 +1,10 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2006-10-15.18 +scriptversion=2009-04-28.21; # UTC -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software -# Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free +# Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,9 +17,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -87,6 +85,15 @@ depmode=dashmstdout fi +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u="sed s,\\\\\\\\,/,g" + depmode=msvisualcpp +fi + case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what @@ -192,14 +199,14 @@ ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' -' ' ' >> $depfile - echo >> $depfile +' ' ' >> "$depfile" + echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile + >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile @@ -215,34 +222,39 @@ # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. - stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u "$@" -M fi stat=$? - if test -f "$tmpdepfile"; then : - else - stripped=`echo "$stripped" | sed 's,^.*/,,'` - tmpdepfile="$stripped.u" - fi - if test $stat -eq 0; then : else - rm -f "$tmpdepfile" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done if test -f "$tmpdepfile"; then - outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile @@ -323,7 +335,12 @@ if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. - sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi @@ -399,7 +416,7 @@ # Remove the call to Libtool. if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do + while test "X$1" != 'X--mode=compile'; do shift done shift @@ -450,32 +467,39 @@ "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do + while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift - cleared=no - for arg in "$@"; do + cleared=no eat=no + for arg + do case $cleared in no) set ""; shift cleared=yes ;; esac + if test $eat = yes; then + eat=no + continue + fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done - obj_suffix="`echo $object | sed 's/^.*\././'`" + obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" @@ -495,7 +519,7 @@ # Remove the call to Libtool. if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do + while test "X$1" != 'X--mode=compile'; do shift done shift @@ -533,13 +557,27 @@ msvisualcpp) # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. + # always write the preprocessed file to stdout. "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + IFS=" " for arg do case "$arg" in + -o) + shift + ;; + $object) + shift + ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift @@ -552,16 +590,23 @@ ;; esac done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + none) exec "$@" ;; @@ -580,5 +625,6 @@ # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: diff --git a/Modules/_ctypes/libffi/doc/libffi.texi b/Modules/_ctypes/libffi/doc/libffi.texi --- a/Modules/_ctypes/libffi/doc/libffi.texi +++ b/Modules/_ctypes/libffi/doc/libffi.texi @@ -19,7 +19,7 @@ This manual is for Libffi, a portable foreign-function interface library. -Copyright @copyright{} 2008, 2010 Red Hat, Inc. +Copyright @copyright{} 2008, 2010, 2011 Red Hat, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -133,8 +133,6 @@ you want. @ref{Multiple ABIs} for more information. @var{nargs} is the number of arguments that this function accepts. - at samp{libffi} does not yet handle varargs functions; see @ref{Missing -Features} for more information. @var{rtype} is a pointer to an @code{ffi_type} structure that describes the return type of the function. @xref{Types}. @@ -150,6 +148,30 @@ is invalid. @end defun +If the function being called is variadic (varargs) then + at code{ffi_prep_cif_var} must be used instead of @code{ffi_prep_cif}. + + at findex ffi_prep_cif_var + at defun ffi_status ffi_prep_cif_var (ffi_cif *@var{cif}, ffi_abi var{abi}, unsigned int @var{nfixedargs}, unsigned int var{ntotalargs}, ffi_type *@var{rtype}, ffi_type **@var{argtypes}) +This initializes @var{cif} according to the given parameters for +a call to a variadic function. In general it's operation is the +same as for @code{ffi_prep_cif} except that: + + at var{nfixedargs} is the number of fixed arguments, prior to any +variadic arguments. It must be greater than zero. + + at var{ntotalargs} the total number of arguments, including variadic +and fixed arguments. + +Note that, different cif's must be prepped for calls to the same +function when different numbers of arguments are passed. + +Also note that a call to @code{ffi_prep_cif_var} with + at var{nfixedargs}=@var{nototalargs} is NOT equivalent to a call to + at code{ffi_prep_cif}. + + at end defun + To call a function using an initialized @code{ffi_cif}, use the @code{ffi_call} function: @@ -171,7 +193,9 @@ @var{avalues} is a vector of @code{void *} pointers that point to the memory locations holding the argument values for a call. If @var{cif} declares that the function has no arguments (i.e., @var{nargs} was 0), -then @var{avalues} is ignored. +then @var{avalues} is ignored. Note that argument values may be +modified by the callee (for instance, structs passed by value); the +burden of copying pass-by-value arguments is placed on the caller. @end defun @@ -336,7 +360,7 @@ new @code{ffi_type} object for it. @tindex ffi_type - at deftp ffi_type + at deftp {Data type} ffi_type The @code{ffi_type} has the following members: @table @code @item size_t size @@ -438,7 +462,7 @@ heap. Memory management for closures is handled by a pair of functions: - at findex ffi_closure_alloca + at findex ffi_closure_alloc @defun void *ffi_closure_alloc (size_t @var{size}, void **@var{code}) Allocate a chunk of memory holding @var{size} bytes. This returns a pointer to the writable address, and sets *@var{code} to the @@ -570,9 +594,7 @@ @itemize @bullet @item -There is no support for calling varargs functions. This may work on -some platforms, depending on how the ABI is defined, but it is not -reliable. +Variadic closures. @item There is no support for bit fields in structures. @@ -589,6 +611,8 @@ @c anything else? @end itemize +Note that variadic support is very new and tested on a relatively +small number of platforms. @node Index @unnumbered Index diff --git a/Modules/_ctypes/libffi/doc/stamp-vti b/Modules/_ctypes/libffi/doc/stamp-vti --- a/Modules/_ctypes/libffi/doc/stamp-vti +++ b/Modules/_ctypes/libffi/doc/stamp-vti @@ -1,4 +1,4 @@ - at set UPDATED 14 February 2008 - at set UPDATED-MONTH February 2008 - at set EDITION 3.0.8 - at set VERSION 3.0.8 + at set UPDATED 16 March 2013 + at set UPDATED-MONTH March 2013 + at set EDITION 3.0.13 + at set VERSION 3.0.13 diff --git a/Modules/_ctypes/libffi/doc/version.texi b/Modules/_ctypes/libffi/doc/version.texi --- a/Modules/_ctypes/libffi/doc/version.texi +++ b/Modules/_ctypes/libffi/doc/version.texi @@ -1,4 +1,4 @@ - at set UPDATED 14 February 2008 - at set UPDATED-MONTH February 2008 - at set EDITION 3.0.8 - at set VERSION 3.0.8 + at set UPDATED 16 March 2013 + at set UPDATED-MONTH March 2013 + at set EDITION 3.0.13 + at set VERSION 3.0.13 diff --git a/Modules/_ctypes/libffi/fficonfig.h.in b/Modules/_ctypes/libffi/fficonfig.h.in --- a/Modules/_ctypes/libffi/fficonfig.h.in +++ b/Modules/_ctypes/libffi/fficonfig.h.in @@ -17,6 +17,12 @@ /* Define this if you want extra debugging. */ #undef FFI_DEBUG +/* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ +#undef FFI_EXEC_TRAMPOLINE_TABLE + +/* Define this if you want to enable pax emulated trampolines */ +#undef FFI_MMAP_EXEC_EMUTRAMP_PAX + /* Cannot use malloc on this target, so, we revert to alternative means */ #undef FFI_MMAP_EXEC_WRIT @@ -33,6 +39,9 @@ */ #undef HAVE_ALLOCA_H +/* Define if your assembler supports .ascii. */ +#undef HAVE_AS_ASCII_PSEUDO_OP + /* Define if your assembler supports .cfi_* directives. */ #undef HAVE_AS_CFI_PSEUDO_OP @@ -43,6 +52,12 @@ */ #undef HAVE_AS_SPARC_UA_PCREL +/* Define if your assembler supports .string. */ +#undef HAVE_AS_STRING_PSEUDO_OP + +/* Define if your assembler supports unwind section type. */ +#undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE + /* Define if your assembler supports PC relative relocs. */ #undef HAVE_AS_X86_PCREL @@ -148,6 +163,9 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Define if symbols are underscored. */ +#undef SYMBOL_UNDERSCORE + /* Define this if you are using Purify and want to suppress spurious messages. */ #undef USING_PURIFY @@ -167,6 +185,9 @@ # endif #endif +/* Define to `unsigned int' if does not define. */ +#undef size_t + #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE #ifdef LIBFFI_ASM diff --git a/Modules/_ctypes/libffi/generate-ios-source-and-headers.py b/Modules/_ctypes/libffi/generate-ios-source-and-headers.py new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/generate-ios-source-and-headers.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python + +import subprocess +import re +import os +import errno +import collections +import sys + +class Platform(object): + pass + +sdk_re = re.compile(r'.*-sdk ([a-zA-Z0-9.]*)') + +def sdkinfo(sdkname): + ret = {} + for line in subprocess.Popen(['xcodebuild', '-sdk', sdkname, '-version'], stdout=subprocess.PIPE).stdout: + kv = line.strip().split(': ', 1) + if len(kv) == 2: + k,v = kv + ret[k] = v + return ret + +sim_sdk_info = sdkinfo('iphonesimulator') +device_sdk_info = sdkinfo('iphoneos') + +def latest_sdks(): + latest_sim = None + latest_device = None + for line in subprocess.Popen(['xcodebuild', '-showsdks'], stdout=subprocess.PIPE).stdout: + match = sdk_re.match(line) + if match: + if 'Simulator' in line: + latest_sim = match.group(1) + elif 'iOS' in line: + latest_device = match.group(1) + + return latest_sim, latest_device + +sim_sdk, device_sdk = latest_sdks() + +class simulator_platform(Platform): + sdk='iphonesimulator' + arch = 'i386' + name = 'simulator' + triple = 'i386-apple-darwin10' + sdkroot = sim_sdk_info['Path'] + + prefix = "#if !defined(__arm__) && defined(__i386__)\n\n" + suffix = "\n\n#endif" + +class device_platform(Platform): + sdk='iphoneos' + name = 'ios' + arch = 'armv7' + triple = 'arm-apple-darwin10' + sdkroot = device_sdk_info['Path'] + + prefix = "#ifdef __arm__\n\n" + suffix = "\n\n#endif" + + +def move_file(src_dir, dst_dir, filename, file_suffix=None, prefix='', suffix=''): + if not os.path.exists(dst_dir): + os.makedirs(dst_dir) + + out_filename = filename + + if file_suffix: + split_name = os.path.splitext(filename) + out_filename = "%s_%s%s" % (split_name[0], file_suffix, split_name[1]) + + with open(os.path.join(src_dir, filename)) as in_file: + with open(os.path.join(dst_dir, out_filename), 'w') as out_file: + if prefix: + out_file.write(prefix) + + out_file.write(in_file.read()) + + if suffix: + out_file.write(suffix) + +headers_seen = collections.defaultdict(set) + +def move_source_tree(src_dir, dest_dir, dest_include_dir, arch=None, prefix=None, suffix=None): + for root, dirs, files in os.walk(src_dir, followlinks=True): + relroot = os.path.relpath(root,src_dir) + + def move_dir(arch, prefix='', suffix='', files=[]): + for file in files: + file_suffix = None + if file.endswith('.h'): + if dest_include_dir: + file_suffix = arch + if arch: + headers_seen[file].add(arch) + move_file(root, dest_include_dir, file, arch, prefix=prefix, suffix=suffix) + + elif dest_dir: + outroot = os.path.join(dest_dir, relroot) + move_file(root, outroot, file, prefix=prefix, suffix=suffix) + + if relroot == '.': + move_dir(arch=arch, + files=files, + prefix=prefix, + suffix=suffix) + elif relroot == 'arm': + move_dir(arch='arm', + prefix="#ifdef __arm__\n\n", + suffix="\n\n#endif", + files=files) + elif relroot == 'x86': + move_dir(arch='i386', + prefix="#if !defined(__arm__) && defined(__i386__)\n\n", + suffix="\n\n#endif", + files=files) + +def build_target(platform): + def xcrun_cmd(cmd): + return subprocess.check_output(['xcrun', '-sdk', platform.sdkroot, '-find', cmd]).strip() + + build_dir = 'build_' + platform.name + if not os.path.exists(build_dir): + os.makedirs(build_dir) + env = dict(CC=xcrun_cmd('clang'), + LD=xcrun_cmd('ld'), + CFLAGS='-arch %s -isysroot %s -miphoneos-version-min=4.0' % (platform.arch, platform.sdkroot)) + working_dir=os.getcwd() + try: + os.chdir(build_dir) + subprocess.check_call(['../configure', '-host', platform.triple], env=env) + move_source_tree('.', None, '../ios/include', + arch=platform.arch, + prefix=platform.prefix, + suffix=platform.suffix) + move_source_tree('./include', None, '../ios/include', + arch=platform.arch, + prefix=platform.prefix, + suffix=platform.suffix) + finally: + os.chdir(working_dir) + + for header_name, archs in headers_seen.iteritems(): + basename, suffix = os.path.splitext(header_name) + +def main(): + move_source_tree('src', 'ios/src', 'ios/include') + move_source_tree('include', None, 'ios/include') + build_target(simulator_platform) + build_target(device_platform) + + for header_name, archs in headers_seen.iteritems(): + basename, suffix = os.path.splitext(header_name) + with open(os.path.join('ios/include', header_name), 'w') as header: + for arch in archs: + header.write('#include <%s_%s%s>\n' % (basename, arch, suffix)) + +if __name__ == '__main__': + main() diff --git a/Modules/_ctypes/libffi/generate-osx-source-and-headers.py b/Modules/_ctypes/libffi/generate-osx-source-and-headers.py new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/generate-osx-source-and-headers.py @@ -0,0 +1,153 @@ +#!/usr/bin/env python +import subprocess +import re +import os +import errno +import collections +import sys + +class Platform(object): + pass + +sdk_re = re.compile(r'.*-sdk ([a-zA-Z0-9.]*)') + +def sdkinfo(sdkname): + ret = {} + for line in subprocess.Popen(['xcodebuild', '-sdk', sdkname, '-version'], stdout=subprocess.PIPE).stdout: + kv = line.strip().split(': ', 1) + if len(kv) == 2: + k,v = kv + ret[k] = v + return ret + +desktop_sdk_info = sdkinfo('macosx') + +def latest_sdks(): + latest_desktop = None + for line in subprocess.Popen(['xcodebuild', '-showsdks'], stdout=subprocess.PIPE).stdout: + match = sdk_re.match(line) + if match: + if 'OS X' in line: + latest_desktop = match.group(1) + + return latest_desktop + +desktop_sdk = latest_sdks() + +class desktop_platform_32(Platform): + sdk='macosx' + arch = 'i386' + name = 'mac32' + triple = 'i386-apple-darwin10' + sdkroot = desktop_sdk_info['Path'] + + prefix = "#if defined(__i386__) && !defined(__x86_64__)\n\n" + suffix = "\n\n#endif" + +class desktop_platform_64(Platform): + sdk='macosx' + arch = 'x86_64' + name = 'mac' + triple = 'x86_64-apple-darwin10' + sdkroot = desktop_sdk_info['Path'] + + prefix = "#if !defined(__i386__) && defined(__x86_64__)\n\n" + suffix = "\n\n#endif" + +def move_file(src_dir, dst_dir, filename, file_suffix=None, prefix='', suffix=''): + if not os.path.exists(dst_dir): + os.makedirs(dst_dir) + + out_filename = filename + + if file_suffix: + split_name = os.path.splitext(filename) + out_filename = "%s_%s%s" % (split_name[0], file_suffix, split_name[1]) + + with open(os.path.join(src_dir, filename)) as in_file: + with open(os.path.join(dst_dir, out_filename), 'w') as out_file: + if prefix: + out_file.write(prefix) + + out_file.write(in_file.read()) + + if suffix: + out_file.write(suffix) + +headers_seen = collections.defaultdict(set) + +def move_source_tree(src_dir, dest_dir, dest_include_dir, arch=None, prefix=None, suffix=None): + for root, dirs, files in os.walk(src_dir, followlinks=True): + relroot = os.path.relpath(root,src_dir) + + def move_dir(arch, prefix='', suffix='', files=[]): + for file in files: + file_suffix = None + if file.endswith('.h'): + if dest_include_dir: + file_suffix = arch + if arch: + headers_seen[file].add(arch) + move_file(root, dest_include_dir, file, arch, prefix=prefix, suffix=suffix) + + elif dest_dir: + outroot = os.path.join(dest_dir, relroot) + move_file(root, outroot, file, prefix=prefix, suffix=suffix) + + if relroot == '.': + move_dir(arch=arch, + files=files, + prefix=prefix, + suffix=suffix) + elif relroot == 'x86': + move_dir(arch='i386', + prefix="#if defined(__i386__) && !defined(__x86_64__)\n\n", + suffix="\n\n#endif", + files=files) + move_dir(arch='x86_64', + prefix="#if !defined(__i386__) && defined(__x86_64__)\n\n", + suffix="\n\n#endif", + files=files) + +def build_target(platform): + def xcrun_cmd(cmd): + return subprocess.check_output(['xcrun', '-sdk', platform.sdkroot, '-find', cmd]).strip() + + build_dir = 'build_' + platform.name + if not os.path.exists(build_dir): + os.makedirs(build_dir) + env = dict(CC=xcrun_cmd('clang'), + LD=xcrun_cmd('ld'), + CFLAGS='-arch %s -isysroot %s -mmacosx-version-min=10.6' % (platform.arch, platform.sdkroot)) + working_dir=os.getcwd() + try: + os.chdir(build_dir) + subprocess.check_call(['../configure', '-host', platform.triple], env=env) + move_source_tree('.', None, '../osx/include', + arch=platform.arch, + prefix=platform.prefix, + suffix=platform.suffix) + move_source_tree('./include', None, '../osx/include', + arch=platform.arch, + prefix=platform.prefix, + suffix=platform.suffix) + finally: + os.chdir(working_dir) + + for header_name, archs in headers_seen.iteritems(): + basename, suffix = os.path.splitext(header_name) + +def main(): + move_source_tree('src', 'osx/src', 'osx/include') + move_source_tree('include', None, 'osx/include') + build_target(desktop_platform_32) + build_target(desktop_platform_64) + + for header_name, archs in headers_seen.iteritems(): + basename, suffix = os.path.splitext(header_name) + with open(os.path.join('osx/include', header_name), 'w') as header: + for arch in archs: + header.write('#include <%s_%s%s>\n' % (basename, arch, suffix)) + +if __name__ == '__main__': + main() diff --git a/Modules/_ctypes/libffi/include/Makefile.in b/Modules/_ctypes/libffi/include/Makefile.in --- a/Modules/_ctypes/libffi/include/Makefile.in +++ b/Modules/_ctypes/libffi/include/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.12.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,6 +15,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -39,7 +55,19 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/ffi.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_cc_maxopt.m4 \ + $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_configure_args.m4 \ + $(top_srcdir)/m4/ax_enable_builddir.m4 \ + $(top_srcdir)/m4/ax_gcc_archflag.m4 \ + $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -49,6 +77,11 @@ CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -70,6 +103,12 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } am__installdirs = "$(DESTDIR)$(includesdir)" HEADERS = $(nodist_includes_HEADERS) ETAGS = etags @@ -78,6 +117,7 @@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ +AM_LTLDFLAGS = @AM_LTLDFLAGS@ AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -95,6 +135,7 @@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -102,6 +143,7 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ FGREP = @FGREP@ GREP = @GREP@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ @@ -120,6 +162,7 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -132,8 +175,10 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PRTDIAG = @PRTDIAG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -146,6 +191,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -153,6 +199,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -178,7 +225,6 @@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -189,6 +235,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ @@ -248,8 +295,11 @@ -rm -rf .libs _libs install-nodist_includesHEADERS: $(nodist_includes_HEADERS) @$(NORMAL_INSTALL) - test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includesdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includesdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -263,9 +313,7 @@ @$(NORMAL_UNINSTALL) @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(includesdir)" && rm -f $$files + dir='$(DESTDIR)$(includesdir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -316,6 +364,20 @@ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -366,10 +428,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -451,7 +518,7 @@ .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool ctags distclean distclean-generic \ + clean-libtool cscopelist ctags distclean distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ diff --git a/Modules/_ctypes/libffi/include/ffi.h.in b/Modules/_ctypes/libffi/include/ffi.h.in --- a/Modules/_ctypes/libffi/include/ffi.h.in +++ b/Modules/_ctypes/libffi/include/ffi.h.in @@ -1,16 +1,17 @@ /* -----------------------------------------------------------------*-C-*- - libffi @VERSION@ - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. + libffi @VERSION@ - Copyright (c) 2011 Anthony Green + - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the ``Software''), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF @@ -57,7 +58,9 @@ #endif /* Specify which architecture libffi is configured for. */ +#ifndef @TARGET@ #define @TARGET@ +#endif /* ---- System configuration information --------------------------------- */ @@ -75,15 +78,31 @@ /* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). But we can find it either under the correct ANSI name, or under GNU C's internal name. */ + +#define FFI_64_BIT_MAX 9223372036854775807 + #ifdef LONG_LONG_MAX # define FFI_LONG_LONG_MAX LONG_LONG_MAX #else # ifdef LLONG_MAX # define FFI_LONG_LONG_MAX LLONG_MAX +# ifdef _AIX52 /* or newer has C99 LLONG_MAX */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif /* _AIX52 or newer */ # else # ifdef __GNUC__ # define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ # endif +# ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */ +# ifndef __PPC64__ +# if defined (__IBMC__) || defined (__IBMCPP__) +# define FFI_LONG_LONG_MAX LONGLONG_MAX +# endif +# endif /* __PPC64__ */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif # endif #endif @@ -130,39 +149,53 @@ #endif #if LONG_MAX == 2147483647 -# if FFI_LONG_LONG_MAX != 9223372036854775807 +# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX #error "no 64-bit data type supported" # endif -#elif LONG_MAX != 9223372036854775807 +#elif LONG_MAX != FFI_64_BIT_MAX #error "long size not supported" #endif #if LONG_MAX == 2147483647 # define ffi_type_ulong ffi_type_uint32 # define ffi_type_slong ffi_type_sint32 -#elif LONG_MAX == 9223372036854775807 +#elif LONG_MAX == FFI_64_BIT_MAX # define ffi_type_ulong ffi_type_uint64 # define ffi_type_slong ffi_type_sint64 #else #error "long size not supported" #endif +/* Need minimal decorations for DLLs to works on Windows. */ +/* GCC has autoimport and autoexport. Rely on Libtool to */ +/* help MSVC export from a DLL, but always declare data */ +/* to be imported for MSVC clients. This costs an extra */ +/* indirection for MSVC clients using the static version */ +/* of the library, but don't worry about that. Besides, */ +/* as a workaround, they can define FFI_BUILDING if they */ +/* *know* they are going to link with the static library. */ +#if defined _MSC_VER && !defined FFI_BUILDING +#define FFI_EXTERN extern __declspec(dllimport) +#else +#define FFI_EXTERN extern +#endif + /* These are defined in types.c */ -extern ffi_type ffi_type_void; -extern ffi_type ffi_type_uint8; -extern ffi_type ffi_type_sint8; -extern ffi_type ffi_type_uint16; -extern ffi_type ffi_type_sint16; -extern ffi_type ffi_type_uint32; -extern ffi_type ffi_type_sint32; -extern ffi_type ffi_type_uint64; -extern ffi_type ffi_type_sint64; -extern ffi_type ffi_type_float; -extern ffi_type ffi_type_double; -extern ffi_type ffi_type_pointer; +FFI_EXTERN ffi_type ffi_type_void; +FFI_EXTERN ffi_type ffi_type_uint8; +FFI_EXTERN ffi_type ffi_type_sint8; +FFI_EXTERN ffi_type ffi_type_uint16; +FFI_EXTERN ffi_type ffi_type_sint16; +FFI_EXTERN ffi_type ffi_type_uint32; +FFI_EXTERN ffi_type ffi_type_sint32; +FFI_EXTERN ffi_type ffi_type_uint64; +FFI_EXTERN ffi_type ffi_type_sint64; +FFI_EXTERN ffi_type ffi_type_float; +FFI_EXTERN ffi_type ffi_type_double; +FFI_EXTERN ffi_type ffi_type_pointer; #if @HAVE_LONG_DOUBLE@ -extern ffi_type ffi_type_longdouble; +FFI_EXTERN ffi_type ffi_type_longdouble; #else #define ffi_type_longdouble ffi_type_double #endif @@ -188,12 +221,21 @@ #endif } ffi_cif; +/* Used internally, but overridden by some architectures */ +ffi_status ffi_prep_cif_core(ffi_cif *cif, + ffi_abi abi, + unsigned int isvariadic, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type *rtype, + ffi_type **atypes); + /* ---- Definitions for the raw API -------------------------------------- */ #ifndef FFI_SIZEOF_ARG # if LONG_MAX == 2147483647 # define FFI_SIZEOF_ARG 4 -# elif LONG_MAX == 9223372036854775807 +# elif LONG_MAX == FFI_64_BIT_MAX # define FFI_SIZEOF_ARG 8 # endif #endif @@ -255,7 +297,12 @@ __declspec(align(8)) #endif typedef struct { +#if @FFI_EXEC_TRAMPOLINE_TABLE@ + void *trampoline_table; + void *trampoline_table_entry; +#else char tramp[FFI_TRAMPOLINE_SIZE]; +#endif ffi_cif *cif; void (*fun)(ffi_cif*,void*,void**,void*); void *user_data; @@ -263,6 +310,9 @@ } ffi_closure __attribute__((aligned (8))); #else } ffi_closure; +# ifdef __sgi +# pragma pack 0 +# endif #endif void *ffi_closure_alloc (size_t size, void **code); @@ -281,9 +331,16 @@ void *user_data, void*codeloc); +#ifdef __sgi +# pragma pack 8 +#endif typedef struct { +#if @FFI_EXEC_TRAMPOLINE_TABLE@ + void *trampoline_table; + void *trampoline_table_entry; +#else char tramp[FFI_TRAMPOLINE_SIZE]; - +#endif ffi_cif *cif; #if !FFI_NATIVE_RAW_API @@ -303,7 +360,12 @@ } ffi_raw_closure; typedef struct { +#if @FFI_EXEC_TRAMPOLINE_TABLE@ + void *trampoline_table; + void *trampoline_table_entry; +#else char tramp[FFI_TRAMPOLINE_SIZE]; +#endif ffi_cif *cif; @@ -359,6 +421,13 @@ ffi_type *rtype, ffi_type **atypes); +ffi_status ffi_prep_cif_var(ffi_cif *cif, + ffi_abi abi, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type *rtype, + ffi_type **atypes); + void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, diff --git a/Modules/_ctypes/libffi/include/ffi_common.h b/Modules/_ctypes/libffi/include/ffi_common.h --- a/Modules/_ctypes/libffi/include/ffi_common.h +++ b/Modules/_ctypes/libffi/include/ffi_common.h @@ -1,7 +1,8 @@ /* ----------------------------------------------------------------------- - ffi_common.h - Copyright (c) 1996 Red Hat, Inc. - Copyright (C) 2007 Free Software Foundation, Inc - + ffi_common.h - Copyright (C) 2011, 2012 Anthony Green + Copyright (C) 2007 Free Software Foundation, Inc + Copyright (c) 1996 Red Hat, Inc. + Common internal definitions and macros. Only necessary for building libffi. ----------------------------------------------------------------------- */ @@ -74,6 +75,8 @@ /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif); +ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif, + unsigned int nfixedargs, unsigned int ntotalargs); /* Extended cif, used in callback from assembly routine */ typedef struct @@ -84,7 +87,7 @@ } extended_cif; /* Terse sized type definitions. */ -#if defined(_MSC_VER) || defined(__sgi) +#if defined(_MSC_VER) || defined(__sgi) || defined(__SUNPRO_C) typedef unsigned char UINT8; typedef signed char SINT8; typedef unsigned short UINT16; @@ -112,11 +115,14 @@ typedef float FLOAT32; +#ifndef __GNUC__ +#define __builtin_expect(x, expected_value) (x) +#endif +#define LIKELY(x) __builtin_expect(!!(x),1) +#define UNLIKELY(x) __builtin_expect((x)!=0,0) #ifdef __cplusplus } #endif #endif - - diff --git a/Modules/_ctypes/libffi/install-sh b/Modules/_ctypes/libffi/install-sh --- a/Modules/_ctypes/libffi/install-sh +++ b/Modules/_ctypes/libffi/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2004-12-17.09 +scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -39,38 +39,68 @@ # when there is no Makefile. # # This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. +# from scratch. + +nl=' +' +IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi -# put in absolute paths if you don't have them in your path; or use env. vars. +# Put in absolute file names if you don't have them in your path; +# or use environment vars. -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} -chmodcmd="$chmodprog 0755" +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog chowncmd= -chgrpcmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" + src= dst= dir_arg= -dstarg= +dst_arg= + +copy_on_change=false no_target_directory= -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... @@ -80,81 +110,86 @@ In the 4th, create DIRECTORIES. Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG " -while test -n "$1"; do +while test $# -ne 0; do case $1 in - -c) shift - continue;; + -c) ;; - -d) dir_arg=true - shift - continue;; + -C) copy_on_change=true;; + + -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; + shift;; - --help) echo "$usage"; exit 0;; + --help) echo "$usage"; exit $?;; - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; -o) chowncmd="$chownprog $2" - shift - shift - continue;; + shift;; - -s) stripcmd=$stripprog - shift - continue;; + -s) stripcmd=$stripprog;; - -t) dstarg=$2 - shift - shift - continue;; + -t) dst_arg=$2 + shift;; - -T) no_target_directory=true - shift - continue;; + -T) no_target_directory=true;; - --version) echo "$0 $scriptversion"; exit 0;; + --version) echo "$0 $scriptversion"; exit $?;; - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done + --) shift break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; esac + shift done -if test -z "$1"; then +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 @@ -164,24 +199,47 @@ exit 0 fi +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + for src do # Protect names starting with `-'. case $src in - -*) src=./$src ;; + -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src - src= + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. @@ -190,71 +248,199 @@ exit 1 fi - if test -z "$dstarg"; then + if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi - dst=$dstarg + dst=$dst_arg # Protect names starting with `-'. case $dst in - -*) dst=./$dst ;; + -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 + echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi - dst=$dst/`basename "$src"` + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? fi fi - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + obsolete_mkdir_used=false - # Make sure that the destination directory exists. + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi - pathcomp= + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true fi - pathcomp=$pathcomp/ - done + fi fi if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else - dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ @@ -262,10 +448,9 @@ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # @@ -273,51 +458,63 @@ # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 - } - else - : - fi - } && + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit 1; } + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi done -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} - # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: diff --git a/Modules/_ctypes/libffi/libffi.xcodeproj/project.pbxproj b/Modules/_ctypes/libffi/libffi.xcodeproj/project.pbxproj new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/libffi.xcodeproj/project.pbxproj @@ -0,0 +1,579 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 6C43CBDC1534F76F00162364 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBBD1534F76F00162364 /* ffi.c */; }; + 6C43CBDD1534F76F00162364 /* sysv.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBBF1534F76F00162364 /* sysv.S */; }; + 6C43CBDE1534F76F00162364 /* trampoline.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBC01534F76F00162364 /* trampoline.S */; }; + 6C43CBE61534F76F00162364 /* darwin.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBC91534F76F00162364 /* darwin.S */; }; + 6C43CBE81534F76F00162364 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBCB1534F76F00162364 /* ffi.c */; }; + 6C43CC1F1534F77800162364 /* darwin.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC051534F77800162364 /* darwin.S */; }; + 6C43CC201534F77800162364 /* darwin64.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC061534F77800162364 /* darwin64.S */; }; + 6C43CC211534F77800162364 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC071534F77800162364 /* ffi.c */; }; + 6C43CC221534F77800162364 /* ffi64.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC081534F77800162364 /* ffi64.c */; }; + 6C43CC2F1534F7BE00162364 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC281534F7BE00162364 /* closures.c */; }; + 6C43CC301534F7BE00162364 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC281534F7BE00162364 /* closures.c */; }; + 6C43CC351534F7BE00162364 /* java_raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2B1534F7BE00162364 /* java_raw_api.c */; }; + 6C43CC361534F7BE00162364 /* java_raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2B1534F7BE00162364 /* java_raw_api.c */; }; + 6C43CC371534F7BE00162364 /* prep_cif.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2C1534F7BE00162364 /* prep_cif.c */; }; + 6C43CC381534F7BE00162364 /* prep_cif.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2C1534F7BE00162364 /* prep_cif.c */; }; + 6C43CC391534F7BE00162364 /* raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2D1534F7BE00162364 /* raw_api.c */; }; + 6C43CC3A1534F7BE00162364 /* raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2D1534F7BE00162364 /* raw_api.c */; }; + 6C43CC3B1534F7BE00162364 /* types.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2E1534F7BE00162364 /* types.c */; }; + 6C43CC3C1534F7BE00162364 /* types.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2E1534F7BE00162364 /* types.c */; }; + 6C43CC971535032600162364 /* ffi.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC8D1535032600162364 /* ffi.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CC981535032600162364 /* ffi_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC8E1535032600162364 /* ffi_common.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CC991535032600162364 /* ffi_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC8F1535032600162364 /* ffi_i386.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CC9A1535032600162364 /* ffi_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC901535032600162364 /* ffi_x86_64.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CC9B1535032600162364 /* fficonfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC911535032600162364 /* fficonfig.h */; }; + 6C43CC9C1535032600162364 /* fficonfig_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC921535032600162364 /* fficonfig_i386.h */; }; + 6C43CC9D1535032600162364 /* fficonfig_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC931535032600162364 /* fficonfig_x86_64.h */; }; + 6C43CC9E1535032600162364 /* ffitarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC941535032600162364 /* ffitarget.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CC9F1535032600162364 /* ffitarget_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC951535032600162364 /* ffitarget_i386.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCA01535032600162364 /* ffitarget_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC961535032600162364 /* ffitarget_x86_64.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCAD1535039600162364 /* ffi.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA21535039600162364 /* ffi.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCAE1535039600162364 /* ffi_armv7.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA31535039600162364 /* ffi_armv7.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCAF1535039600162364 /* ffi_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA41535039600162364 /* ffi_common.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCB01535039600162364 /* ffi_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA51535039600162364 /* ffi_i386.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCB11535039600162364 /* fficonfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA61535039600162364 /* fficonfig.h */; }; + 6C43CCB21535039600162364 /* fficonfig_armv7.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA71535039600162364 /* fficonfig_armv7.h */; }; + 6C43CCB31535039600162364 /* fficonfig_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA81535039600162364 /* fficonfig_i386.h */; }; + 6C43CCB41535039600162364 /* ffitarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA91535039600162364 /* ffitarget.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCB51535039600162364 /* ffitarget_arm.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCAA1535039600162364 /* ffitarget_arm.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCB61535039600162364 /* ffitarget_armv7.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCAB1535039600162364 /* ffitarget_armv7.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6C43CCB71535039600162364 /* ffitarget_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCAC1535039600162364 /* ffitarget_i386.h */; settings = {ATTRIBUTES = (Public, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 6C43CB3D1534E9D100162364 /* libffi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libffi.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 6C43CBBD1534F76F00162364 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = ""; }; + 6C43CBBF1534F76F00162364 /* sysv.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = sysv.S; sourceTree = ""; }; + 6C43CBC01534F76F00162364 /* trampoline.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = trampoline.S; sourceTree = ""; }; + 6C43CBC91534F76F00162364 /* darwin.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin.S; sourceTree = ""; }; + 6C43CBCB1534F76F00162364 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = ""; }; + 6C43CC051534F77800162364 /* darwin.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin.S; sourceTree = ""; }; + 6C43CC061534F77800162364 /* darwin64.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin64.S; sourceTree = ""; }; + 6C43CC071534F77800162364 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = ""; }; + 6C43CC081534F77800162364 /* ffi64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi64.c; sourceTree = ""; }; + 6C43CC281534F7BE00162364 /* closures.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = closures.c; path = src/closures.c; sourceTree = SOURCE_ROOT; }; + 6C43CC2B1534F7BE00162364 /* java_raw_api.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = java_raw_api.c; path = src/java_raw_api.c; sourceTree = SOURCE_ROOT; }; + 6C43CC2C1534F7BE00162364 /* prep_cif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = prep_cif.c; path = src/prep_cif.c; sourceTree = SOURCE_ROOT; }; + 6C43CC2D1534F7BE00162364 /* raw_api.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = raw_api.c; path = src/raw_api.c; sourceTree = SOURCE_ROOT; }; + 6C43CC2E1534F7BE00162364 /* types.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = types.c; path = src/types.c; sourceTree = SOURCE_ROOT; }; + 6C43CC8D1535032600162364 /* ffi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi.h; sourceTree = ""; }; + 6C43CC8E1535032600162364 /* ffi_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_common.h; sourceTree = ""; }; + 6C43CC8F1535032600162364 /* ffi_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_i386.h; sourceTree = ""; }; + 6C43CC901535032600162364 /* ffi_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_x86_64.h; sourceTree = ""; }; + 6C43CC911535032600162364 /* fficonfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig.h; sourceTree = ""; }; + 6C43CC921535032600162364 /* fficonfig_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_i386.h; sourceTree = ""; }; + 6C43CC931535032600162364 /* fficonfig_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_x86_64.h; sourceTree = ""; }; + 6C43CC941535032600162364 /* ffitarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget.h; sourceTree = ""; }; + 6C43CC951535032600162364 /* ffitarget_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_i386.h; sourceTree = ""; }; + 6C43CC961535032600162364 /* ffitarget_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_x86_64.h; sourceTree = ""; }; + 6C43CCA21535039600162364 /* ffi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi.h; sourceTree = ""; }; + 6C43CCA31535039600162364 /* ffi_armv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_armv7.h; sourceTree = ""; }; + 6C43CCA41535039600162364 /* ffi_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_common.h; sourceTree = ""; }; + 6C43CCA51535039600162364 /* ffi_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_i386.h; sourceTree = ""; }; + 6C43CCA61535039600162364 /* fficonfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig.h; sourceTree = ""; }; + 6C43CCA71535039600162364 /* fficonfig_armv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_armv7.h; sourceTree = ""; }; + 6C43CCA81535039600162364 /* fficonfig_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_i386.h; sourceTree = ""; }; + 6C43CCA91535039600162364 /* ffitarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget.h; sourceTree = ""; }; + 6C43CCAA1535039600162364 /* ffitarget_arm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_arm.h; sourceTree = ""; }; + 6C43CCAB1535039600162364 /* ffitarget_armv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_armv7.h; sourceTree = ""; }; + 6C43CCAC1535039600162364 /* ffitarget_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_i386.h; sourceTree = ""; }; + F6F980BA147386130008F121 /* libffi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libffi.a; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 6C43CB3A1534E9D100162364 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F6F980B7147386130008F121 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 6C43CBAF1534F76F00162364 /* iOS */ = { + isa = PBXGroup; + children = ( + 6C43CCA11535039600162364 /* include */, + 6C43CBBB1534F76F00162364 /* src */, + ); + name = iOS; + path = ios; + sourceTree = ""; + }; + 6C43CBBB1534F76F00162364 /* src */ = { + isa = PBXGroup; + children = ( + 6C43CBC81534F76F00162364 /* x86 */, + 6C43CBBC1534F76F00162364 /* arm */, + ); + path = src; + sourceTree = ""; + }; + 6C43CBBC1534F76F00162364 /* arm */ = { + isa = PBXGroup; + children = ( + 6C43CBBD1534F76F00162364 /* ffi.c */, + 6C43CBBF1534F76F00162364 /* sysv.S */, + 6C43CBC01534F76F00162364 /* trampoline.S */, + ); + path = arm; + sourceTree = ""; + }; + 6C43CBC81534F76F00162364 /* x86 */ = { + isa = PBXGroup; + children = ( + 6C43CBC91534F76F00162364 /* darwin.S */, + 6C43CBCB1534F76F00162364 /* ffi.c */, + ); + path = x86; + sourceTree = ""; + }; + 6C43CBF01534F77800162364 /* OS X */ = { + isa = PBXGroup; + children = ( + 6C43CC8C1535032600162364 /* include */, + 6C43CBFC1534F77800162364 /* src */, + ); + name = "OS X"; + path = osx; + sourceTree = ""; + }; + 6C43CBFC1534F77800162364 /* src */ = { + isa = PBXGroup; + children = ( + 6C43CC041534F77800162364 /* x86 */, + ); + path = src; + sourceTree = ""; + }; + 6C43CC041534F77800162364 /* x86 */ = { + isa = PBXGroup; + children = ( + 6C43CC051534F77800162364 /* darwin.S */, + 6C43CC061534F77800162364 /* darwin64.S */, + 6C43CC071534F77800162364 /* ffi.c */, + 6C43CC081534F77800162364 /* ffi64.c */, + ); + path = x86; + sourceTree = ""; + }; + 6C43CC3D1534F7C400162364 /* src */ = { + isa = PBXGroup; + children = ( + 6C43CC281534F7BE00162364 /* closures.c */, + 6C43CC2B1534F7BE00162364 /* java_raw_api.c */, + 6C43CC2C1534F7BE00162364 /* prep_cif.c */, + 6C43CC2D1534F7BE00162364 /* raw_api.c */, + 6C43CC2E1534F7BE00162364 /* types.c */, + ); + name = src; + path = ios; + sourceTree = ""; + }; + 6C43CC8C1535032600162364 /* include */ = { + isa = PBXGroup; + children = ( + 6C43CC8D1535032600162364 /* ffi.h */, + 6C43CC8E1535032600162364 /* ffi_common.h */, + 6C43CC8F1535032600162364 /* ffi_i386.h */, + 6C43CC901535032600162364 /* ffi_x86_64.h */, + 6C43CC911535032600162364 /* fficonfig.h */, + 6C43CC921535032600162364 /* fficonfig_i386.h */, + 6C43CC931535032600162364 /* fficonfig_x86_64.h */, + 6C43CC941535032600162364 /* ffitarget.h */, + 6C43CC951535032600162364 /* ffitarget_i386.h */, + 6C43CC961535032600162364 /* ffitarget_x86_64.h */, + ); + path = include; + sourceTree = ""; + }; + 6C43CCA11535039600162364 /* include */ = { + isa = PBXGroup; + children = ( + 6C43CCA21535039600162364 /* ffi.h */, + 6C43CCA31535039600162364 /* ffi_armv7.h */, + 6C43CCA41535039600162364 /* ffi_common.h */, + 6C43CCA51535039600162364 /* ffi_i386.h */, + 6C43CCA61535039600162364 /* fficonfig.h */, + 6C43CCA71535039600162364 /* fficonfig_armv7.h */, + 6C43CCA81535039600162364 /* fficonfig_i386.h */, + 6C43CCA91535039600162364 /* ffitarget.h */, + 6C43CCAA1535039600162364 /* ffitarget_arm.h */, + 6C43CCAB1535039600162364 /* ffitarget_armv7.h */, + 6C43CCAC1535039600162364 /* ffitarget_i386.h */, + ); + path = include; + sourceTree = ""; + }; + F6B0839514721EE50031D8A1 = { + isa = PBXGroup; + children = ( + 6C43CC3D1534F7C400162364 /* src */, + 6C43CBAF1534F76F00162364 /* iOS */, + 6C43CBF01534F77800162364 /* OS X */, + F6F980C6147386260008F121 /* Products */, + ); + sourceTree = ""; + }; + F6F980C6147386260008F121 /* Products */ = { + isa = PBXGroup; + children = ( + F6F980BA147386130008F121 /* libffi.a */, + 6C43CB3D1534E9D100162364 /* libffi.a */, + ); + name = Products; + path = ../..; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 6C43CB3B1534E9D100162364 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 6C43CC971535032600162364 /* ffi.h in Headers */, + 6C43CC981535032600162364 /* ffi_common.h in Headers */, + 6C43CC991535032600162364 /* ffi_i386.h in Headers */, + 6C43CC9A1535032600162364 /* ffi_x86_64.h in Headers */, + 6C43CC9E1535032600162364 /* ffitarget.h in Headers */, + 6C43CC9F1535032600162364 /* ffitarget_i386.h in Headers */, + 6C43CCA01535032600162364 /* ffitarget_x86_64.h in Headers */, + 6C43CC9B1535032600162364 /* fficonfig.h in Headers */, + 6C43CC9C1535032600162364 /* fficonfig_i386.h in Headers */, + 6C43CC9D1535032600162364 /* fficonfig_x86_64.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F6F980B8147386130008F121 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 6C43CCAD1535039600162364 /* ffi.h in Headers */, + 6C43CCAE1535039600162364 /* ffi_armv7.h in Headers */, + 6C43CCAF1535039600162364 /* ffi_common.h in Headers */, + 6C43CCB01535039600162364 /* ffi_i386.h in Headers */, + 6C43CCB41535039600162364 /* ffitarget.h in Headers */, + 6C43CCB51535039600162364 /* ffitarget_arm.h in Headers */, + 6C43CCB61535039600162364 /* ffitarget_armv7.h in Headers */, + 6C43CCB71535039600162364 /* ffitarget_i386.h in Headers */, + 6C43CCB11535039600162364 /* fficonfig.h in Headers */, + 6C43CCB21535039600162364 /* fficonfig_armv7.h in Headers */, + 6C43CCB31535039600162364 /* fficonfig_i386.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 6C43CB3C1534E9D100162364 /* libffi OS X */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6C43CB4A1534E9D100162364 /* Build configuration list for PBXNativeTarget "libffi OS X" */; + buildPhases = ( + 6C43CC401534FF3B00162364 /* Generate Source and Headers */, + 6C43CB391534E9D100162364 /* Sources */, + 6C43CB3A1534E9D100162364 /* Frameworks */, + 6C43CB3B1534E9D100162364 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "libffi OS X"; + productName = "ffi OS X"; + productReference = 6C43CB3D1534E9D100162364 /* libffi.a */; + productType = "com.apple.product-type.library.static"; + }; + F6F980B9147386130008F121 /* libffi iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = F6F980C4147386130008F121 /* Build configuration list for PBXNativeTarget "libffi iOS" */; + buildPhases = ( + 6C43CC3E1534F8E200162364 /* Generate Trampoline */, + 6C43CC3F1534FF1B00162364 /* Generate Source and Headers */, + F6F980B6147386130008F121 /* Sources */, + F6F980B7147386130008F121 /* Frameworks */, + F6F980B8147386130008F121 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "libffi iOS"; + productName = ffi; + productReference = F6F980BA147386130008F121 /* libffi.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + F6B0839714721EE50031D8A1 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0430; + }; + buildConfigurationList = F6B0839A14721EE50031D8A1 /* Build configuration list for PBXProject "libffi" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = F6B0839514721EE50031D8A1; + productRefGroup = F6B0839514721EE50031D8A1; + projectDirPath = ""; + projectRoot = ""; + targets = ( + F6F980B9147386130008F121 /* libffi iOS */, + 6C43CB3C1534E9D100162364 /* libffi OS X */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXShellScriptBuildPhase section */ + 6C43CC3E1534F8E200162364 /* Generate Trampoline */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Generate Trampoline"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /usr/bin/python; + shellScript = "import subprocess\nimport re\nimport os\nimport errno\nimport sys\n\ndef main():\n with open('src/arm/trampoline.S', 'w') as tramp_out:\n p = subprocess.Popen(['bash', 'src/arm/gentramp.sh'], stdout=tramp_out)\n p.wait()\n\nif __name__ == '__main__':\n main()"; + }; + 6C43CC3F1534FF1B00162364 /* Generate Source and Headers */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Generate Source and Headers"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/usr/bin/python generate-ios-source-and-headers.py"; + }; + 6C43CC401534FF3B00162364 /* Generate Source and Headers */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Generate Source and Headers"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/usr/bin/python generate-osx-source-and-headers.py"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 6C43CB391534E9D100162364 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6C43CC1F1534F77800162364 /* darwin.S in Sources */, + 6C43CC201534F77800162364 /* darwin64.S in Sources */, + 6C43CC211534F77800162364 /* ffi.c in Sources */, + 6C43CC221534F77800162364 /* ffi64.c in Sources */, + 6C43CC301534F7BE00162364 /* closures.c in Sources */, + 6C43CC361534F7BE00162364 /* java_raw_api.c in Sources */, + 6C43CC381534F7BE00162364 /* prep_cif.c in Sources */, + 6C43CC3A1534F7BE00162364 /* raw_api.c in Sources */, + 6C43CC3C1534F7BE00162364 /* types.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F6F980B6147386130008F121 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6C43CBDC1534F76F00162364 /* ffi.c in Sources */, + 6C43CBDD1534F76F00162364 /* sysv.S in Sources */, + 6C43CBDE1534F76F00162364 /* trampoline.S in Sources */, + 6C43CBE61534F76F00162364 /* darwin.S in Sources */, + 6C43CBE81534F76F00162364 /* ffi.c in Sources */, + 6C43CC2F1534F7BE00162364 /* closures.c in Sources */, + 6C43CC351534F7BE00162364 /* java_raw_api.c in Sources */, + 6C43CC371534F7BE00162364 /* prep_cif.c in Sources */, + 6C43CC391534F7BE00162364 /* raw_api.c in Sources */, + 6C43CC3B1534F7BE00162364 /* types.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 6C43CB4B1534E9D100162364 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + DSTROOT = /tmp/ffi.dst; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\"", + ); + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + MACOSX_DEPLOYMENT_TARGET = 10.6; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = ffi; + SDKROOT = macosx; + }; + name = Debug; + }; + 6C43CB4C1534E9D100162364 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DSTROOT = /tmp/ffi.dst; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\"", + ); + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + MACOSX_DEPLOYMENT_TARGET = 10.6; + PRODUCT_NAME = ffi; + SDKROOT = macosx; + }; + name = Release; + }; + F6B083AB14721EE50031D8A1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VALUE = NO; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ios/include; + SDKROOT = iphoneos; + }; + name = Debug; + }; + F6B083AC14721EE50031D8A1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PREPROCESSOR_DEFINITIONS = ""; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VALUE = NO; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ios/include; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + F6F980C2147386130008F121 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + armv6, + armv7, + ); + DSTROOT = /tmp/ffi.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_THUMB_SUPPORT = NO; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = ffi; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + F6F980C3147386130008F121 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + armv6, + armv7, + ); + DSTROOT = /tmp/ffi.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_THUMB_SUPPORT = NO; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = ffi; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 6C43CB4A1534E9D100162364 /* Build configuration list for PBXNativeTarget "libffi OS X" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6C43CB4B1534E9D100162364 /* Debug */, + 6C43CB4C1534E9D100162364 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + F6B0839A14721EE50031D8A1 /* Build configuration list for PBXProject "libffi" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F6B083AB14721EE50031D8A1 /* Debug */, + F6B083AC14721EE50031D8A1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + F6F980C4147386130008F121 /* Build configuration list for PBXNativeTarget "libffi iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F6F980C2147386130008F121 /* Debug */, + F6F980C3147386130008F121 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = F6B0839714721EE50031D8A1 /* Project object */; +} diff --git a/Modules/_ctypes/libffi/libtool-ldflags b/Modules/_ctypes/libffi/libtool-ldflags new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/libtool-ldflags @@ -0,0 +1,106 @@ +#! /bin/sh + +# Script to translate LDFLAGS into a form suitable for use with libtool. + +# Copyright (C) 2005 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. + +# Contributed by CodeSourcery, LLC. + +# This script is designed to be used from a Makefile that uses libtool +# to build libraries as follows: +# +# LTLDFLAGS = $(shell libtool-ldflags $(LDFLAGS)) +# +# Then, use (LTLDFLAGS) in place of $(LDFLAGS) in your link line. + +# The output of the script. This string is built up as we process the +# arguments. +result= +prev_arg= + +for arg +do + case $arg in + -f*|--*) + # Libtool does not ascribe any special meaning options + # that begin with -f or with a double-dash. So, it will + # think these options are linker options, and prefix them + # with "-Wl,". Then, the compiler driver will ignore the + # options. So, we prefix these options with -Xcompiler to + # make clear to libtool that they are in fact compiler + # options. + case $prev_arg in + -Xpreprocessor|-Xcompiler|-Xlinker) + # This option is already prefixed; don't prefix it again. + ;; + *) + result="$result -Xcompiler" + ;; + esac + ;; + *) + # We do not want to add -Xcompiler to other options because + # that would prevent libtool itself from recognizing them. + ;; + esac + prev_arg=$arg + + # If $(LDFLAGS) is (say): + # a "b'c d" e + # then the user expects that: + # $(LD) $(LDFLAGS) + # will pass three arguments to $(LD): + # 1) a + # 2) b'c d + # 3) e + # We must ensure, therefore, that the arguments are appropriately + # quoted so that using: + # libtool --mode=link ... $(LTLDFLAGS) + # will result in the same number of arguments being passed to + # libtool. In other words, when this script was invoked, the shell + # removed one level of quoting, present in $(LDFLAGS); we have to put + # it back. + + # Quote any embedded single quotes. + case $arg in + *"'"*) + # The following command creates the script: + # 1s,^X,,;s|'|'"'"'|g + # which removes a leading X, and then quotes and embedded single + # quotes. + sed_script="1s,^X,,;s|'|'\"'\"'|g" + # Add a leading "X" so that if $arg starts with a dash, + # the echo command will not try to interpret the argument + # as a command-line option. + arg="X$arg" + # Generate the quoted string. + quoted_arg=`echo "$arg" | sed -e "$sed_script"` + ;; + *) + quoted_arg=$arg + ;; + esac + # Surround the entire argument with single quotes. + quoted_arg="'"$quoted_arg"'" + + # Add it to the string. + result="$result $quoted_arg" +done + +# Output the string we have built up. +echo "$result" diff --git a/Modules/_ctypes/libffi/libtool-version b/Modules/_ctypes/libffi/libtool-version --- a/Modules/_ctypes/libffi/libtool-version +++ b/Modules/_ctypes/libffi/libtool-version @@ -26,4 +26,4 @@ # release, then set age to 0. # # CURRENT:REVISION:AGE -5:10:0 +6:1:0 diff --git a/Modules/_ctypes/libffi/ltmain.sh b/Modules/_ctypes/libffi/ltmain.sh --- a/Modules/_ctypes/libffi/ltmain.sh +++ b/Modules/_ctypes/libffi/ltmain.sh @@ -1,9 +1,9 @@ -# Generated from ltmain.m4sh. - -# ltmain.sh (GNU libtool) 2.2.6 + +# libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -32,50 +32,57 @@ # # Provide generalized library-building support services. # -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print informational messages (default) -# --version print version information -# -h, --help print short or long help message +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --no-quiet, --no-silent +# print informational messages (default) +# --no-warn don't display warning messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print more informational messages than default +# --no-verbose don't print the extra informational messages +# --version print version information +# -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory # -# MODE-ARGS vary depending on the MODE. +# MODE-ARGS vary depending on the MODE. When passed as first option, +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.2.6 -# automake: $automake_version -# autoconf: $autoconf_version +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.4.2 +# automake: $automake_version +# autoconf: $autoconf_version # # Report bugs to . - -PROGRAM=ltmain.sh +# GNU libtool home page: . +# General help using GNU software: . + +PROGRAM=libtool PACKAGE=libtool -VERSION=2.2.6 +VERSION=2.4.2 TIMESTAMP="" -package_revision=1.3012 +package_revision=1.3337 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then @@ -91,10 +98,15 @@ BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + # NLS nuisances: We save the old values to restore during execute mode. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES @@ -107,24 +119,28 @@ lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL $lt_unset CDPATH +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" : ${CP="cp -f"} -: ${ECHO="echo"} -: ${EGREP="/bin/grep -E"} -: ${FGREP="/bin/grep -F"} -: ${GREP="/bin/grep"} -: ${LN_S="ln -s"} +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} -: ${SED="/bin/sed"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} @@ -144,6 +160,27 @@ dirname="s,/[^/]*$,," basename="s,^.*/,," +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} # func_dirname may be replaced by extended shell implementation + + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "${1}" | $SED "$basename"` +} # func_basename may be replaced by extended shell implementation + + # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: @@ -158,33 +195,183 @@ # those functions but instead duplicate the functionality here. func_dirname_and_basename () { - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` +} # func_dirname_and_basename may be replaced by extended shell implementation + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname may be replaced by extended shell implementation + + +# These SED scripts presuppose an absolute path with a trailing slash. +pathcar='s,^/\([^/]*\).*$,\1,' +pathcdr='s,^/[^/]*,,' +removedotparts=':dotsl + s@/\./@/@g + t dotsl + s,/\.$,/,' +collapseslashes='s@/\{1,\}@/@g' +finalslash='s,/*$,/,' + +# func_normal_abspath PATH +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +# value returned in "$func_normal_abspath_result" +func_normal_abspath () +{ + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` + while :; do + # Processed it all yet? + if test "$func_normal_abspath_tpath" = / ; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result" ; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + +# func_relative_path SRCDIR DSTDIR +# generates a relative path from SRCDIR to DSTDIR, with a trailing +# slash if non-empty, suitable for immediately appending a filename +# without needing to append a separator. +# value returned in "$func_relative_path_result" +func_relative_path () +{ + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=${func_dirname_result} + if test "x$func_relative_path_tlibdir" = x ; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test "x$func_stripname_result" != x ; then + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} - -# Generated shell functions inserted here. - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" + + # Normalisation. If bindir is libdir, return empty string, + # else relative path ending with a slash; either way, target + # file name can be directly appended. + if test ! -z "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result/" + func_relative_path_result=$func_stripname_result + fi +} # The name of this program: -# In the unlikely event $progname began with a '-', it would play havoc with -# func_echo (imagine progname=-n), so we prepend ./ in that case: func_dirname_and_basename "$progpath" progname=$func_basename_result -case $progname in - -*) progname=./$progname ;; -esac # Make sure we have an absolute path for reexecution: case $progpath in @@ -196,7 +383,7 @@ ;; *) save_IFS="$IFS" - IFS=: + IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break @@ -215,6 +402,15 @@ # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' + +# Sed substitution that converts a w32 file name or path +# which contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. @@ -243,7 +439,7 @@ # name if it has been set yet. func_echo () { - $ECHO "$progname${mode+: }$mode: $*" + $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... @@ -258,18 +454,25 @@ : } +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + # func_error arg... # Echo program name prefixed message to standard error. func_error () { - $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 + $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { - $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 + $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : @@ -326,9 +529,9 @@ case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done - my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do @@ -378,7 +581,7 @@ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi - $ECHO "X$my_tmpdir" | $Xsed + $ECHO "$my_tmpdir" } @@ -392,7 +595,7 @@ { case $1 in *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac @@ -419,7 +622,7 @@ { case $1 in *[\\\`\"]*) - my_arg=`$ECHO "X$1" | $Xsed \ + my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; @@ -488,15 +691,39 @@ fi } - - +# func_tr_sh +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} # func_version # Echo version message to standard output and exit. func_version () { - $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { + $opt_debug + + $SED -n '/(C)/!b go + :more + /\./!{ + N + s/\n# / / + b more + } + :go + /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ @@ -509,22 +736,28 @@ # Echo short help message to standard output and exit. func_usage () { - $SED -n '/^# Usage:/,/# -h/ { + $opt_debug + + $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" - $ECHO + echo $ECHO "run \`$progname --help | more' for full usage" exit $? } -# func_help -# Echo long help message to standard output and exit. +# func_help [NOEXIT] +# Echo long help message to standard output and exit, +# unless 'noexit' is passed as argument. func_help () { + $opt_debug + $SED -n '/^# Usage:/,/# Report bugs to/ { + :print s/^# // s/^# *$// s*\$progname*'$progname'* @@ -534,11 +767,18 @@ s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ + s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p - }' < "$progpath" - exit $? + d + } + /^# .* home page:/b print + /^# General help using/b print + ' < "$progpath" + ret=$? + if test -z "$1"; then + exit $ret + fi } # func_missing_arg argname @@ -546,63 +786,106 @@ # exit_cmd. func_missing_arg () { - func_error "missing argument for $1" + $opt_debug + + func_error "missing argument for $1." exit_cmd=exit } + +# func_split_short_opt shortopt +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +func_split_short_opt () +{ + my_sed_short_opt='1s/^\(..\).*$/\1/;q' + my_sed_short_rest='1s/^..\(.*\)$/\1/;q' + + func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` + func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` +} # func_split_short_opt may be replaced by extended shell implementation + + +# func_split_long_opt longopt +# Set func_split_long_opt_name and func_split_long_opt_arg shell +# variables after splitting LONGOPT at the `=' sign. +func_split_long_opt () +{ + my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' + my_sed_long_arg='1s/^--[^=]*=//' + + func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` + func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` +} # func_split_long_opt may be replaced by extended shell implementation + exit_cmd=: -# Check that we have a working $ECHO. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell, and then maybe $ECHO will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null || echo $max_cmd_len` +} # func_len may be replaced by extended shell implementation + + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` +} # func_lo2o may be replaced by extended shell implementation + + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` +} # func_xform may be replaced by extended shell implementation + + # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. @@ -636,16 +919,16 @@ # Display the features supported by this script. func_features () { - $ECHO "host: $host" + echo "host: $host" if test "$build_libtool_libs" = yes; then - $ECHO "enable shared libraries" + echo "enable shared libraries" else - $ECHO "disable shared libraries" + echo "disable shared libraries" fi if test "$build_old_libs" = yes; then - $ECHO "enable static libraries" + echo "enable static libraries" else - $ECHO "disable static libraries" + echo "disable static libraries" fi exit $? @@ -692,133 +975,6 @@ esac } -# Parse options once, thoroughly. This comes as soon as possible in -# the script to make things like `libtool --version' happen quickly. -{ - - # Shorthand for --mode=foo, only valid as the first argument - case $1 in - clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; - compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; - execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; - finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; - install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; - link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; - uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; - esac - - # Parse non-mode specific arguments: - while test "$#" -gt 0; do - opt="$1" - shift - - case $opt in - --config) func_config ;; - - --debug) preserve_args="$preserve_args $opt" - func_echo "enabling shell trace mode" - opt_debug='set -x' - $opt_debug - ;; - - -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break - execute_dlfiles="$execute_dlfiles $1" - shift - ;; - - --dry-run | -n) opt_dry_run=: ;; - --features) func_features ;; - --finish) mode="finish" ;; - - --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break - case $1 in - # Valid mode arguments: - clean) ;; - compile) ;; - execute) ;; - finish) ;; - install) ;; - link) ;; - relink) ;; - uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; - esac - - mode="$1" - shift - ;; - - --preserve-dup-deps) - opt_duplicate_deps=: ;; - - --quiet|--silent) preserve_args="$preserve_args $opt" - opt_silent=: - ;; - - --verbose| -v) preserve_args="$preserve_args $opt" - opt_silent=false - ;; - - --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break - preserve_args="$preserve_args $opt $1" - func_enable_tag "$1" # tagname is set here - shift - ;; - - # Separate optargs to long options: - -dlopen=*|--mode=*|--tag=*) - func_opt_split "$opt" - set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} - shift - ;; - - -\?|-h) func_usage ;; - --help) opt_help=: ;; - --version) func_version ;; - - -*) func_fatal_help "unrecognized option \`$opt'" ;; - - *) nonopt="$opt" - break - ;; - esac - done - - - case $host in - *cygwin* | *mingw* | *pw32* | *cegcc*) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: - ;; - *) - opt_duplicate_compiler_generated_deps=$opt_duplicate_deps - ;; - esac - - # Having warned about all mis-specified options, bail out if - # anything was wrong. - $exit_cmd $EXIT_FAILURE -} - # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. @@ -855,38 +1011,219 @@ } +# Shorthand for --mode=foo, only valid as the first argument +case $1 in +clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; +compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; +execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; +finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; +install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; +link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; +uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; +esac + + + +# Option defaults: +opt_debug=: +opt_dry_run=false +opt_config=false +opt_preserve_dup_deps=false +opt_features=false +opt_finish=false +opt_help=false +opt_help_all=false +opt_silent=: +opt_warning=: +opt_verbose=: +opt_silent=false +opt_verbose=false + + +# Parse options once, thoroughly. This comes as soon as possible in the +# script to make things like `--version' happen as quickly as we can. +{ + # this just eases exit handling + while test $# -gt 0; do + opt="$1" + shift + case $opt in + --debug|-x) opt_debug='set -x' + func_echo "enabling shell trace mode" + $opt_debug + ;; + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + --config) + opt_config=: +func_config + ;; + --dlopen|-dlopen) + optarg="$1" + opt_dlopen="${opt_dlopen+$opt_dlopen +}$optarg" + shift + ;; + --preserve-dup-deps) + opt_preserve_dup_deps=: + ;; + --features) + opt_features=: +func_features + ;; + --finish) + opt_finish=: +set dummy --mode finish ${1+"$@"}; shift + ;; + --help) + opt_help=: + ;; + --help-all) + opt_help_all=: +opt_help=': help-all' + ;; + --mode) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_mode="$optarg" +case $optarg in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; +esac + shift + ;; + --no-silent|--no-quiet) + opt_silent=false +func_append preserve_args " $opt" + ;; + --no-warning|--no-warn) + opt_warning=false +func_append preserve_args " $opt" + ;; + --no-verbose) + opt_verbose=false +func_append preserve_args " $opt" + ;; + --silent|--quiet) + opt_silent=: +func_append preserve_args " $opt" + opt_verbose=false + ;; + --verbose|-v) + opt_verbose=: +func_append preserve_args " $opt" +opt_silent=false + ;; + --tag) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_tag="$optarg" +func_append preserve_args " $opt $optarg" +func_enable_tag "$optarg" + shift + ;; + + -\?|-h) func_usage ;; + --help) func_help ;; + --version) func_version ;; + + # Separate optargs to long options: + --*=*) + func_split_long_opt "$opt" + set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-n*|-v*) + func_split_short_opt "$opt" + set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognized option \`$opt'" ;; + *) set dummy "$opt" ${1+"$@"}; shift; break ;; + esac + done + + # Validate options: + + # save first non-option argument + if test "$#" -gt 0; then + nonopt="$opt" + shift + fi + + # preserve --debug + test "$opt_debug" = : || func_append preserve_args " --debug" + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test "$opt_mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$opt_mode' for more information." + } + + + # Bail if the options were screwed + $exit_cmd $EXIT_FAILURE +} + + + + ## ----------- ## ## Main. ## ## ----------- ## -$opt_help || { - # Sanity checks first: - func_check_version_match - - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi - - test -z "$mode" && func_fatal_error "error: you must specify a MODE." - - - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" - - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$mode' for more information." -} - - # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out @@ -950,12 +1287,9 @@ # temporary ltwrapper_script. func_ltwrapper_scriptname () { - func_ltwrapper_scriptname_result="" - if func_ltwrapper_executable_p "$1"; then - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" - fi + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file @@ -1001,6 +1335,37 @@ } +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case "$lt_sysroot:$1" in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result="=$func_stripname_result" + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. @@ -1013,13 +1378,15 @@ if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" + func_append_quoted CC_quoted "$arg" done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) @@ -1030,11 +1397,13 @@ CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" + func_append_quoted CC_quoted "$arg" done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in - " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. @@ -1097,6 +1466,486 @@ } } + +################################################## +# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # +################################################## + +# func_convert_core_file_wine_to_w32 ARG +# Helper function used by file name conversion functions when $build is *nix, +# and $host is mingw, cygwin, or some other w32 environment. Relies on a +# correctly configured wine environment available, with the winepath program +# in $build's $PATH. +# +# ARG is the $build file name to be converted to w32 format. +# Result is available in $func_convert_core_file_wine_to_w32_result, and will +# be empty on error (or when ARG is empty) +func_convert_core_file_wine_to_w32 () +{ + $opt_debug + func_convert_core_file_wine_to_w32_result="$1" + if test -n "$1"; then + # Unfortunately, winepath does not exit with a non-zero error code, so we + # are forced to check the contents of stdout. On the other hand, if the + # command is not found, the shell will set an exit code of 127 and print + # *an error message* to stdout. So we must check for both error code of + # zero AND non-empty stdout, which explains the odd construction: + func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` + if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$lt_sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $opt_debug + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result="" + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result" ; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $opt_debug + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $opt_debug + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $opt_debug + if test -z "$2" && test -n "$1" ; then + func_error "Could not determine host file name corresponding to" + func_error " \`$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result="$1" + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $opt_debug + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " \`$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result="$3" + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $opt_debug + case $4 in + $1 ) func_to_host_path_result="$3$func_to_host_path_result" + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via `$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $opt_debug + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $opt_debug + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result="$1" +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result="$func_convert_core_msys_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via `$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $opt_debug + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd="func_convert_path_${func_stripname_result}" + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $opt_debug + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result="$1" +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_msys_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + # func_mode_compile arg... func_mode_compile () { @@ -1137,12 +1986,12 @@ ;; -pie | -fpie | -fPIE) - pie_flag="$pie_flag $arg" + func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) - later="$later $arg" + func_append later " $arg" continue ;; @@ -1163,15 +2012,14 @@ save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" - func_quote_for_eval "$arg" - lastarg="$lastarg $func_quote_for_eval_result" + func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. - base_compile="$base_compile $lastarg" + func_append base_compile " $lastarg" continue ;; @@ -1187,8 +2035,7 @@ esac # case $arg_mode # Aesthetically quote the previous argument. - func_quote_for_eval "$lastarg" - base_compile="$base_compile $func_quote_for_eval_result" + func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in @@ -1213,7 +2060,7 @@ *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ - *.[fF][09]? | *.for | *.java | *.obj | *.sx) + *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; @@ -1288,7 +2135,7 @@ # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then - output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= @@ -1319,17 +2166,16 @@ $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi - removelist="$removelist $output_obj" + func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist - removelist="$removelist $lockfile" + func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result @@ -1349,7 +2195,7 @@ if test -z "$output_obj"; then # Place PIC objects in $objdir - command="$command -o $lobj" + func_append command " -o $lobj" fi func_show_eval_locale "$command" \ @@ -1396,11 +2242,11 @@ command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then - command="$command -o $obj" + func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" + func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' @@ -1445,13 +2291,13 @@ } $opt_help || { -test "$mode" = compile && func_mode_compile ${1+"$@"} + test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. - case $mode in + case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. @@ -1482,10 +2328,11 @@ -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. @@ -1538,7 +2385,7 @@ The following components of INSTALL-COMMAND are treated specially: - -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." @@ -1558,6 +2405,8 @@ -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) @@ -1586,6 +2435,11 @@ -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. @@ -1619,18 +2473,44 @@ ;; *) - func_fatal_help "invalid operation mode \`$mode'" + func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac - $ECHO + echo $ECHO "Try \`$progname --help' for more information about other modes." - - exit $? -} - - # Now that we've collected a possible --mode arg, show help if necessary - $opt_help && func_mode_help +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test "$opt_help" = :; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | sed -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + sed '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi # func_mode_execute arg... @@ -1643,13 +2523,16 @@ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do + for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" @@ -1671,7 +2554,7 @@ dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" + func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" @@ -1712,7 +2595,7 @@ for file do case $file in - -*) ;; + -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then @@ -1728,8 +2611,7 @@ ;; esac # Quote arguments (to preserve shell metacharacters). - func_quote_for_eval "$file" - args="$args $func_quote_for_eval_result" + func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then @@ -1754,29 +2636,66 @@ # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - $ECHO "export $shlibpath_var" + echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } -test "$mode" = execute && func_mode_execute ${1+"$@"} +test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug - libdirs="$nonopt" + libs= + libdirs= admincmds= + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "\`$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument \`$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and \`=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. @@ -1786,7 +2705,7 @@ if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || admincmds="$admincmds + $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done @@ -1795,53 +2714,55 @@ # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS - $ECHO "X----------------------------------------------------------------------" | $Xsed - $ECHO "Libraries have been installed in:" - for libdir in $libdirs; do - $ECHO " $libdir" - done - $ECHO - $ECHO "If you ever happen to want to link against installed libraries" - $ECHO "in a given directory, LIBDIR, you must either use libtool, and" - $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" - $ECHO "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" - $ECHO " during execution" + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" fi - if test -n "$runpath_var"; then - $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" - $ECHO " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $ECHO " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $ECHO " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - $ECHO - - $ECHO "See any operating system documentation about shared libraries for" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" - $ECHO "pages." - ;; - *) - $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - $ECHO "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS } -test "$mode" = finish && func_mode_finish ${1+"$@"} +test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... @@ -1852,7 +2773,7 @@ # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. - $ECHO "X$nonopt" | $GREP shtool >/dev/null; then + case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " @@ -1866,7 +2787,12 @@ # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" - install_prog="$install_prog$func_quote_for_eval_result" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac # We need to accept at least all the BSD install flags. dest= @@ -1876,10 +2802,12 @@ install_type= isdir=no stripme= + no_mode=: for arg do + arg2= if test -n "$dest"; then - files="$files $dest" + func_append files " $dest" dest=$arg continue fi @@ -1887,10 +2815,9 @@ case $arg in -d) isdir=yes ;; -f) - case " $install_prog " in - *[\\\ /]cp\ *) ;; - *) prev=$arg ;; - esac + if $install_cp; then :; else + prev=$arg + fi ;; -g | -m | -o) prev=$arg @@ -1904,6 +2831,10 @@ *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then + if test "x$prev" = x-m && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi prev= else dest=$arg @@ -1914,7 +2845,11 @@ # Aesthetically quote the argument. func_quote_for_eval "$arg" - install_prog="$install_prog $func_quote_for_eval_result" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ @@ -1923,6 +2858,13 @@ test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" @@ -1977,10 +2919,13 @@ case $file in *.$libext) # Do the static libraries later. - staticlibs="$staticlibs $file" + func_append staticlibs " $file" ;; *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" @@ -1994,23 +2939,23 @@ if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; + *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; + *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" - dir="$dir$objdir" + func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that @@ -2023,9 +2968,9 @@ if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else - relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" @@ -2043,7 +2988,7 @@ test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. - func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in @@ -2083,7 +3028,7 @@ func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) @@ -2183,7 +3128,7 @@ if test -f "$lib"; then func_source "$lib" fi - libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no @@ -2202,7 +3147,7 @@ file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. - relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" @@ -2221,7 +3166,7 @@ } else # Install the binary that we compiled earlier. - file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi @@ -2257,11 +3202,13 @@ # Set up the ranlib parameters. oldlib="$destdir/$name" + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then - func_show_eval "$old_striplib $oldlib" 'exit $?' + func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. @@ -2280,7 +3227,7 @@ fi } -test "$mode" = install && func_mode_install ${1+"$@"} +test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p @@ -2323,6 +3270,22 @@ extern \"C\" { #endif +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + /* External symbol declarations for the compiler. */\ " @@ -2332,10 +3295,11 @@ $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. - progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do - func_verbose "extracting global C symbols from \`$progfile'" - $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then @@ -2371,7 +3335,7 @@ eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in - *cygwin | *mingw* | *cegcc* ) + *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; @@ -2384,10 +3348,52 @@ func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename="" + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname" ; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename="$func_basename_result" + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename" ; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac done $opt_dry_run || { @@ -2415,36 +3421,19 @@ if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else - $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi - $ECHO >> "$output_objdir/$my_dlsyms" "\ + echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; -" - case $host in - *cygwin* | *mingw* | *cegcc* ) - $ECHO >> "$output_objdir/$my_dlsyms" "\ -/* DATA imports from DLLs on WIN32 con't be const, because - runtime relocations are performed -- see ld's documentation - on pseudo-relocs. */" - lt_dlsym_const= ;; - *osf5*) - echo >> "$output_objdir/$my_dlsyms" "\ -/* This system does not cope well with relocations in const data */" - lt_dlsym_const= ;; - *) - lt_dlsym_const=const ;; - esac - - $ECHO >> "$output_objdir/$my_dlsyms" "\ -extern $lt_dlsym_const lt_dlsymlist +extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; -$lt_dlsym_const lt_dlsymlist +LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," @@ -2457,7 +3446,7 @@ eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac - $ECHO >> "$output_objdir/$my_dlsyms" "\ + echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; @@ -2484,7 +3473,7 @@ # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; @@ -2500,7 +3489,7 @@ for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; - *) symtab_cflags="$symtab_cflags $arg" ;; + *) func_append symtab_cflags " $arg" ;; esac done @@ -2515,16 +3504,16 @@ case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; @@ -2538,8 +3527,8 @@ # really was required. # Nullify the symbol file. - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } @@ -2549,6 +3538,7 @@ # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug @@ -2559,9 +3549,11 @@ win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ @@ -2590,6 +3582,131 @@ $ECHO "$win32_libid_type" } +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $opt_debug + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $opt_debug + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive which possess that section. Heuristic: eliminate + # all those which have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $opt_debug + if func_cygming_gnu_implib_p "$1" ; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1" ; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result="" + fi +} # func_extract_an_archive dir oldlib @@ -2598,7 +3715,18 @@ $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' + if test "$lock_old_archive_extraction" = yes; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test "$lock_old_archive_extraction" = yes; then + $opt_dry_run || rm -f "$lockfile" + fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else @@ -2669,7 +3797,7 @@ darwin_file= darwin_files= for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ @@ -2684,248 +3812,13 @@ func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } - -# func_emit_wrapper_part1 [arg=no] -# -# Emit the first part of a libtool wrapper script on stdout. -# For more information, see the description associated with -# func_emit_wrapper(), below. -func_emit_wrapper_part1 () -{ - func_emit_wrapper_part1_arg1=no - if test -n "$1" ; then - func_emit_wrapper_part1_arg1=$1 - fi - - $ECHO "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# Be Bourne compatible -if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: - generated_by_libtool_version='$macro_version' - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$ECHO are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - ECHO=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$ECHO works! - : - else - # Restart under the correct shell, and then maybe \$ECHO will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $ECHO "\ - - # Find the directory that this script lives in. - thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` - done -" -} -# end: func_emit_wrapper_part1 - -# func_emit_wrapper_part2 [arg=no] -# -# Emit the second part of a libtool wrapper script on stdout. -# For more information, see the description associated with -# func_emit_wrapper(), below. -func_emit_wrapper_part2 () -{ - func_emit_wrapper_part2_arg1=no - if test -n "$1" ; then - func_emit_wrapper_part2_arg1=$1 - fi - - $ECHO "\ - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 - if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then - # special case for '.' - if test \"\$thisdir\" = \".\"; then - thisdir=\`pwd\` - fi - # remove .libs from thisdir - case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; - $objdir ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $ECHO "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $MKDIR \"\$progdir\" - else - $RM \"\$progdir/\$file\" - fi" - - $ECHO "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $ECHO \"\$relink_command_output\" >&2 - $RM \"\$progdir/\$file\" - exit 1 - fi - fi - - $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $RM \"\$progdir/\$program\"; - $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $RM \"\$progdir/\$file\" - fi" - else - $ECHO "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $ECHO "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $ECHO "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $ECHO "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 - fi - else - # The program doesn't exist. - \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 - $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" -} -# end: func_emit_wrapper_part2 - - # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. @@ -2942,188 +3835,301 @@ # behavior. func_emit_wrapper () { - func_emit_wrapper_arg1=no - if test -n "$1" ; then - func_emit_wrapper_arg1=$1 - fi - - # split this up so that func_emit_cwrapperexe_src - # can call each part independently. - func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" - func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" -} - - -# func_to_host_path arg + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # -# Convert paths to host format when used with build tools. -# Intended for use with "native" mingw (where libtool itself -# is running under the msys shell), or in the following cross- -# build environments: -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# where wine is equipped with the `winepath' executable. -# In the native mingw case, the (msys) shell automatically -# converts paths for any non-msys applications it launches, -# but that facility isn't available from inside the cwrapper. -# Similar accommodations are necessary for $host mingw and -# $build cygwin. Calling this function does no harm for other -# $host/$build combinations not listed above. +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. # -# ARG is the path (on $build) that should be converted to -# the proper representation for $host. The result is stored -# in $func_to_host_path_result. -func_to_host_path () -{ - func_to_host_path_result="$1" - if test -n "$1" ; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - case $build in - *mingw* ) # actually, msys - # awkward: cmd appends spaces to result - lt_sed_strip_trailing_spaces="s/[ ]*\$//" - func_to_host_path_tmp1=`( cmd //c echo "$1" |\ - $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_path_tmp1=`cygpath -w "$1"` - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # Unfortunately, winepath does not exit with a non-zero - # error code, so we are forced to check the contents of - # stdout. On the other hand, if the command is not - # found, the shell will set an exit code of 127 and print - # *an error message* to stdout. So we must check for both - # error code of zero AND non-empty stdout, which explains - # the odd construction: - func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` - if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` - else - # Allow warning below. - func_to_host_path_result="" - fi - ;; - esac - if test -z "$func_to_host_path_result" ; then - func_error "Could not determine host path corresponding to" - func_error " '$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_path_result="$1" - fi - ;; +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ which is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options which match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + case \" \$* \" in + *\\ --lt-*) + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done ;; + esac + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; esac fi -} -# end: func_to_host_path - -# func_to_host_pathlist arg -# -# Convert pathlists to host format when used with build tools. -# See func_to_host_path(), above. This function supports the -# following $build/$host combinations (but does no harm for -# combinations not listed here): -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# -# Path separators are also converted from $build format to -# $host format. If ARG begins or ends with a path separator -# character, it is preserved (but converted to $host format) -# on output. -# -# ARG is a pathlist (on $build) that should be converted to -# the proper representation on $host. The result is stored -# in $func_to_host_pathlist_result. -func_to_host_pathlist () -{ - func_to_host_pathlist_result="$1" - if test -n "$1" ; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_to_host_pathlist_tmp2="$1" - # Once set for this call, this variable should not be - # reassigned. It is used in tha fallback case. - func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e 's|^:*||' -e 's|:*$||'` - case $build in - *mingw* ) # Actually, msys. - # Awkward: cmd appends spaces to result. - lt_sed_strip_trailing_spaces="s/[ ]*\$//" - func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ - $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # unfortunately, winepath doesn't convert pathlists - func_to_host_pathlist_result="" - func_to_host_pathlist_oldIFS=$IFS - IFS=: - for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do - IFS=$func_to_host_pathlist_oldIFS - if test -n "$func_to_host_pathlist_f" ; then - func_to_host_path "$func_to_host_pathlist_f" - if test -n "$func_to_host_path_result" ; then - if test -z "$func_to_host_pathlist_result" ; then - func_to_host_pathlist_result="$func_to_host_path_result" - else - func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" - fi - fi - fi - IFS=: - done - IFS=$func_to_host_pathlist_oldIFS - ;; - esac - if test -z "$func_to_host_pathlist_result" ; then - func_error "Could not determine the host path(s) corresponding to" - func_error " '$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This may break if $1 contains DOS-style drive - # specifications. The fix is not to complicate the expression - # below, but for the user to provide a working wine installation - # with winepath so that path translation in the cross-to-mingw - # case works properly. - lt_replace_pathsep_nix_to_dos="s|:|;|g" - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ - $SED -e "$lt_replace_pathsep_nix_to_dos"` - fi - # Now, add the leading and trailing path separators back - case "$1" in - :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" - ;; - esac - case "$1" in - *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" - ;; - esac - ;; - esac + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 fi -} -# end: func_to_host_pathlist +fi\ +" +} + # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout @@ -3141,31 +4147,23 @@ This wrapper executable should never be moved out of the build directory. If it is, it will not operate correctly. - - Currently, it simply execs the wrapper *script* "$SHELL $output", - but could eventually absorb all of the scripts functionality and - exec $objdir/$outputname directly. */ EOF cat <<"EOF" +#ifdef _MSC_VER +# define _CRT_SECURE_NO_DEPRECATE 1 +#endif #include #include #ifdef _MSC_VER # include # include # include -# define setmode _setmode #else # include # include # ifdef __CYGWIN__ # include -# define HAVE_SETENV -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif # endif #endif #include @@ -3177,6 +4175,44 @@ #include #include +/* declarations of non-ANSI functions */ +#if defined(__MINGW32__) +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined(__CYGWIN__) +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined (other platforms) ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined(_MSC_VER) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +# ifndef _INTPTR_T_DEFINED +# define _INTPTR_T_DEFINED +# define intptr_t int +# endif +#elif defined(__MINGW32__) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined(__CYGWIN__) +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined (other platforms) ... */ +#endif + #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) @@ -3192,14 +4228,7 @@ # define S_IXGRP 0 #endif -#ifdef _MSC_VER -# define S_IXUSR _S_IEXEC -# define stat _stat -# ifndef _INTPTR_T_DEFINED -# define intptr_t int -# endif -#endif - +/* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' @@ -3230,10 +4259,6 @@ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ -#ifdef __CYGWIN__ -# define FOPEN_WB "wb" -#endif - #ifndef FOPEN_WB # define FOPEN_WB "w" #endif @@ -3246,22 +4271,13 @@ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) -#undef LTWRAPPER_DEBUGPRINTF -#if defined DEBUGWRAPPER -# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args -static void -ltwrapper_debugprintf (const char *fmt, ...) -{ - va_list args; - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); -} +#if defined(LT_DEBUGWRAPPER) +static int lt_debug = 1; #else -# define LTWRAPPER_DEBUGPRINTF(args) +static int lt_debug = 0; #endif -const char *program_name = NULL; +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); @@ -3271,41 +4287,27 @@ int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); -void lt_fatal (const char *message, ...); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); -void lt_opt_process_env_set (const char *arg); -void lt_opt_process_env_prepend (const char *arg); -void lt_opt_process_env_append (const char *arg); -int lt_split_name_value (const char *arg, char** name, char** value); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); - -static const char *script_text_part1 = +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); EOF - func_emit_wrapper_part1 yes | - $SED -e 's/\([\\"]\)/\\\1/g' \ - -e 's/^/ "/' -e 's/$/\\n"/' - echo ";" cat <"))); + + lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", + nonnull (lt_argv_zero)); for (i = 0; i < newargc; i++) { - LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); + lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", + i, nonnull (newargz[i])); } EOF @@ -3560,11 +4523,14 @@ mingw*) cat <<"EOF" /* execv doesn't actually work on mingw as expected on unix */ + newargz = prepare_spawn (newargz); rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); if (rval == -1) { /* failed to start process */ - LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); + lt_debugprintf (__FILE__, __LINE__, + "(main) failed to launch target \"%s\": %s\n", + lt_argv_zero, nonnull (strerror (errno))); return 127; } return rval; @@ -3586,7 +4552,7 @@ { void *p = (void *) malloc (num); if (!p) - lt_fatal ("Memory exhausted"); + lt_fatal (__FILE__, __LINE__, "memory exhausted"); return p; } @@ -3620,8 +4586,8 @@ { struct stat st; - LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", - path ? (*path ? path : "EMPTY!") : "NULL!")); + lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", + nonempty (path)); if ((!path) || (!*path)) return 0; @@ -3638,8 +4604,8 @@ int rval = 0; struct stat st; - LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", - path ? (*path ? path : "EMPTY!") : "NULL!")); + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); if ((!path) || (!*path)) return 0; @@ -3665,8 +4631,8 @@ int tmp_len; char *concat_name; - LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", - wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; @@ -3719,7 +4685,8 @@ { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); @@ -3744,7 +4711,8 @@ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); @@ -3770,8 +4738,9 @@ int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { - LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", - tmp_pathspec)); + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) @@ -3793,8 +4762,9 @@ } else { - char *errstr = strerror (errno); - lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); @@ -3807,7 +4777,8 @@ tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { - lt_fatal ("Could not follow symlinks for %s", pathspec); + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif @@ -3833,11 +4804,25 @@ return str; } +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + static void -lt_error_core (int exit_status, const char *mode, +lt_error_core (int exit_status, const char *file, + int line, const char *mode, const char *message, va_list ap) { - fprintf (stderr, "%s: %s: ", program_name, mode); + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); @@ -3846,20 +4831,32 @@ } void -lt_fatal (const char *message, ...) +lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + void lt_setenv (const char *name, const char *value) { - LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", - (name ? name : ""), - (value ? value : ""))); + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ @@ -3904,95 +4901,12 @@ return new_value; } -int -lt_split_name_value (const char *arg, char** name, char** value) -{ - const char *p; - int len; - if (!arg || !*arg) - return 1; - - p = strchr (arg, (int)'='); - - if (!p) - return 1; - - *value = xstrdup (++p); - - len = strlen (arg) - strlen (*value); - *name = XMALLOC (char, len); - strncpy (*name, arg, len-1); - (*name)[len - 1] = '\0'; - - return 0; -} - -void -lt_opt_process_env_set (const char *arg) -{ - char *name = NULL; - char *value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); - } - - lt_setenv (name, value); - XFREE (name); - XFREE (value); -} - -void -lt_opt_process_env_prepend (const char *arg) -{ - char *name = NULL; - char *value = NULL; - char *new_value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); - } - - new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - XFREE (name); - XFREE (value); -} - -void -lt_opt_process_env_append (const char *arg) -{ - char *name = NULL; - char *value = NULL; - char *new_value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); - } - - new_value = lt_extend_str (getenv (name), value, 1); - lt_setenv (name, new_value); - XFREE (new_value); - XFREE (name); - XFREE (value); -} - void lt_update_exe_path (const char *name, const char *value) { - LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - (name ? name : ""), - (value ? value : ""))); + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); if (name && *name && value && *value) { @@ -4011,9 +4925,9 @@ void lt_update_lib_path (const char *name, const char *value) { - LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - (name ? name : ""), - (value ? value : ""))); + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); if (name && *name && value && *value) { @@ -4023,11 +4937,158 @@ } } - EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -n -e ' +s/^\(.\{79\}\)\(..*\)/\1\ +\2/ +h +s/\([\\"]\)/\\\1/g +s/$/\\n/ +s/\([^\n]*\).*/ fputs ("\1", f);/p +g +D' + cat <<"EOF" +} +EOF } # end: func_emit_cwrapperexe_src +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $opt_debug + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + # func_mode_link arg... func_mode_link () { @@ -4072,6 +5133,7 @@ new_inherited_linker_flags= avoid_version=no + bindir= dlfiles= dlprefiles= dlself=no @@ -4164,6 +5226,11 @@ esac case $prev in + bindir) + bindir="$arg" + prev= + continue + ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. @@ -4195,9 +5262,9 @@ ;; *) if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" + func_append dlfiles " $arg" else - dlprefiles="$dlprefiles $arg" + func_append dlprefiles " $arg" fi prev= continue @@ -4221,7 +5288,7 @@ *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; - *) deplibs="$deplibs $qarg.ltframework" # this is fixed later + *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; @@ -4240,7 +5307,7 @@ moreargs= for fil in `cat "$save_arg"` do -# moreargs="$moreargs $fil" +# func_append moreargs " $fil" arg=$fil # A libtool-controlled object. @@ -4269,7 +5336,7 @@ if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" + func_append dlfiles " $pic_object" prev= continue else @@ -4281,7 +5348,7 @@ # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" + func_append dlprefiles " $pic_object" prev= fi @@ -4351,12 +5418,12 @@ if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; - *) rpath="$rpath $arg" ;; + *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; + *) func_append xrpath " $arg" ;; esac fi prev= @@ -4368,28 +5435,28 @@ continue ;; weak) - weak_libs="$weak_libs $arg" + func_append weak_libs " $arg" prev= continue ;; xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) - compiler_flags="$compiler_flags $qarg" + func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" @@ -4425,6 +5492,11 @@ continue ;; + -bindir) + prev=bindir + continue + ;; + -dlopen) prev=dlfiles continue @@ -4475,15 +5547,16 @@ ;; -L*) - func_stripname '-L' '' "$arg" - dir=$func_stripname_result - if test -z "$dir"; then + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; @@ -4495,24 +5568,30 @@ ;; esac case "$deplibs " in - *" -L$dir "*) ;; + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; - *) dllsearchpath="$dllsearchpath:$dir";; + *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; + *) func_append dllsearchpath ":$testbindir";; esac ;; esac @@ -4522,7 +5601,7 @@ -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; @@ -4536,7 +5615,7 @@ ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs System.ltframework" + func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) @@ -4556,7 +5635,7 @@ ;; esac fi - deplibs="$deplibs $arg" + func_append deplibs " $arg" continue ;; @@ -4568,21 +5647,22 @@ # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot) - compiler_flags="$compiler_flags $arg" + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - compiler_flags="$compiler_flags $arg" + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; + * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; @@ -4649,13 +5729,17 @@ # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; + *) func_append xrpath " $dir" ;; esac continue ;; @@ -4708,8 +5792,8 @@ for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" - arg="$arg $wl$func_quote_for_eval_result" - compiler_flags="$compiler_flags $func_quote_for_eval_result" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" @@ -4724,9 +5808,9 @@ for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" - arg="$arg $wl$func_quote_for_eval_result" - compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" - linker_flags="$linker_flags $func_quote_for_eval_result" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" @@ -4754,23 +5838,27 @@ arg="$func_quote_for_eval_result" ;; - # -64, -mips[0-9] enable 64-bit mode on the SGI compiler - # -r[0-9][0-9]* specifies the processor on the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler - # +DA*, +DD* enable 64-bit mode on the HP compiler - # -q* pass through compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* pass through architecture-specific - # compiler args for GCC - # -F/path gives path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC - # @file GCC response files + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" - compiler_flags="$compiler_flags $arg" + func_append compiler_flags " $arg" continue ;; @@ -4782,7 +5870,7 @@ *.$objext) # A standard object. - objs="$objs $arg" + func_append objs " $arg" ;; *.lo) @@ -4813,7 +5901,7 @@ if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" + func_append dlfiles " $pic_object" prev= continue else @@ -4825,7 +5913,7 @@ # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" + func_append dlprefiles " $pic_object" prev= fi @@ -4870,24 +5958,25 @@ *.$libext) # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" + func_append deplibs " $arg" + func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. + func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" + func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" + func_append dlprefiles " $func_resolve_sysroot_result" prev= else - deplibs="$deplibs $arg" + func_append deplibs " $func_resolve_sysroot_result" fi continue ;; @@ -4925,7 +6014,7 @@ if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi @@ -4934,6 +6023,8 @@ func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" @@ -4954,12 +6045,12 @@ # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do - if $opt_duplicate_deps ; then + if $opt_preserve_dup_deps ; then case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi - libs="$libs $deplib" + func_append libs " $deplib" done if test "$linkmode" = lib; then @@ -4972,9 +6063,9 @@ if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac - pre_post_deps="$pre_post_deps $pre_post_dep" + func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= @@ -5041,17 +6132,19 @@ for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= + func_resolve_sysroot "$lib" case $lib in - *.la) func_source "$lib" ;; + *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do - deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` + func_basename "$deplib" + deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; - *) deplibs="$deplibs $deplib" ;; + *) func_append deplibs " $deplib" ;; esac done done @@ -5067,16 +6160,17 @@ lib= found=no case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else - compiler_flags="$compiler_flags $deplib" + func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi @@ -5161,7 +6255,7 @@ if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi @@ -5174,7 +6268,8 @@ test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then @@ -5188,7 +6283,8 @@ finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" @@ -5199,17 +6295,21 @@ -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" - dir=$func_stripname_result + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; + *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; - *.la) lib="$deplib" ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" @@ -5227,7 +6327,7 @@ match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi @@ -5237,15 +6337,15 @@ ;; esac if test "$valid_a_lib" != yes; then - $ECHO + echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because the file extensions .$libext of this argument makes me believe" - $ECHO "*** that it is just a static archive that I should not use here." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." else - $ECHO + echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" @@ -5272,11 +6372,11 @@ if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. - newdlprefiles="$newdlprefiles $deplib" + func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else - newdlfiles="$newdlfiles $deplib" + func_append newdlfiles " $deplib" fi fi continue @@ -5318,20 +6418,20 @@ # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; - *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi - dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then @@ -5342,20 +6442,20 @@ func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" - if $opt_duplicate_deps ; then + if $opt_preserve_dup_deps ; then case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi - tmp_libs="$tmp_libs $deplib" + func_append tmp_libs " $deplib" done continue fi # $pass = conv @@ -5363,9 +6463,15 @@ # Get the name of the library we link against. linklib= - for l in $old_library $library_names; do - linklib="$l" - done + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || + test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi @@ -5382,9 +6488,9 @@ # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" + func_append dlprefiles " $lib $dependency_libs" else - newdlfiles="$newdlfiles $lib" + func_append newdlfiles " $lib" fi continue fi # $pass = dlopen @@ -5406,14 +6512,14 @@ # Find the relevant object directory and library name. if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else - dir="$libdir" - absdir="$libdir" + dir="$lt_sysroot$libdir" + absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else @@ -5421,12 +6527,12 @@ dir="$ladir" absdir="$abs_ladir" # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" @@ -5437,20 +6543,46 @@ if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi + case "$host" in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac fi # $pass = dlpreopen if test -z "$libdir"; then @@ -5468,7 +6600,7 @@ if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" + func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no @@ -5481,7 +6613,8 @@ for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? @@ -5492,12 +6625,12 @@ # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi - if $opt_duplicate_deps ; then + if $opt_preserve_dup_deps ; then case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi - tmp_libs="$tmp_libs $deplib" + func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... @@ -5512,7 +6645,7 @@ # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; - *) temp_rpath="$temp_rpath$absdir:" ;; + *) func_append temp_rpath "$absdir:" ;; esac fi @@ -5524,7 +6657,7 @@ *) case "$compile_rpath " in *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" + *) func_append compile_rpath " $absdir" ;; esac ;; esac @@ -5533,7 +6666,7 @@ *) case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" + *) func_append finalize_rpath " $libdir" ;; esac ;; esac @@ -5558,12 +6691,12 @@ case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded - notinst_deplibs="$notinst_deplibs $lib" + func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" + func_append notinst_deplibs " $lib" need_relink=yes fi ;; @@ -5580,7 +6713,7 @@ fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - $ECHO + echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else @@ -5598,7 +6731,7 @@ *) case "$compile_rpath " in *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" + *) func_append compile_rpath " $absdir" ;; esac ;; esac @@ -5607,7 +6740,7 @@ *) case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" + *) func_append finalize_rpath " $libdir" ;; esac ;; esac @@ -5661,7 +6794,7 @@ linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" - if test "$linkmode" = prog || test "$mode" != relink; then + if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= @@ -5683,9 +6816,9 @@ if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then - $ECHO - $ECHO "*** And there doesn't seem to be a static archive available" - $ECHO "*** The link will probably fail, sorry" + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi @@ -5712,12 +6845,12 @@ test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" + add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" + func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi @@ -5739,7 +6872,7 @@ if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then @@ -5753,13 +6886,13 @@ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi - if test "$linkmode" = prog || test "$mode" = relink; then + if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= @@ -5773,7 +6906,7 @@ elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then @@ -5790,7 +6923,7 @@ if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" + func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi @@ -5825,21 +6958,21 @@ # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - $ECHO + echo $ECHO "*** Warning: This system can not link to static lib archive $lib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then - $ECHO "*** But as you try to build a module library, libtool will still create " - $ECHO "*** a static module, that should work as long as the dlopening application" - $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - $ECHO - $ECHO "*** However, this would only work if libtool was able to extract symbol" - $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" - $ECHO "*** not find such a program. So, this module is probably useless." - $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module @@ -5867,37 +7000,46 @@ temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; + *) func_append xrpath " $temp_xrpath";; esac;; - *) temp_deplibs="$temp_deplibs $libdir";; + *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi - newlib_search_path="$newlib_search_path $absdir" + func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" - if $opt_duplicate_deps ; then + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps ; then case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi - tmp_libs="$tmp_libs $deplib" + func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do + path= case $deplib in -L*) path="$deplib" ;; *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." - dir="$func_dirname_result" + dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; @@ -5924,8 +7066,8 @@ if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi - compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" + func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi @@ -5958,7 +7100,7 @@ compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else - compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" @@ -5975,7 +7117,7 @@ for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; + *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= @@ -6033,10 +7175,10 @@ -L*) case " $tmp_libs " in *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; + *) func_append tmp_libs " $deplib" ;; esac ;; - *) tmp_libs="$tmp_libs $deplib" ;; + *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" @@ -6052,7 +7194,7 @@ ;; esac if test -n "$i" ; then - tmp_libs="$tmp_libs $i" + func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs @@ -6093,7 +7235,7 @@ # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" - objs="$objs$old_deplibs" + func_append objs "$old_deplibs" ;; lib) @@ -6126,10 +7268,10 @@ if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else - $ECHO + echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" - libobjs="$libobjs $objs" + func_append libobjs " $objs" fi fi @@ -6188,13 +7330,14 @@ # which has an extra 1 added just for fun # case $version_type in + # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; - freebsd-aout|freebsd-elf|sunos) + freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" @@ -6304,7 +7447,7 @@ versuffix="$major.$revision" ;; - linux) + linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" @@ -6327,7 +7470,7 @@ done # Make executables depend on our current version. - verstring="$verstring:${current}.0" + func_append verstring ":${current}.0" ;; qnx) @@ -6395,10 +7538,10 @@ fi func_generate_dlsyms "$libname" "$libname" "yes" - libobjs="$libobjs $symfileobj" + func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= - if test "$mode" != relink; then + if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= @@ -6414,7 +7557,7 @@ continue fi fi - removelist="$removelist $p" + func_append removelist " $p" ;; *) ;; esac @@ -6425,27 +7568,28 @@ # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" + func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do - # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` - # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` - # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; + *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then @@ -6459,7 +7603,7 @@ for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; + *) func_append dlfiles " $lib" ;; esac done @@ -6469,19 +7613,19 @@ for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; + *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework - deplibs="$deplibs System.ltframework" + func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. @@ -6498,7 +7642,7 @@ *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" + func_append deplibs " -lc" fi ;; esac @@ -6547,7 +7691,7 @@ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" i="" ;; esac @@ -6558,21 +7702,21 @@ set dummy $deplib_matches; shift deplib_match=$1 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" else droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: dynamic linker does not accept needed library $i." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which I believe you do not have" - $ECHO "*** because a test_compile did reveal that the linker did not use it for" - $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which I believe you do not have" + echo "*** because a test_compile did reveal that the linker did not use it for" + echo "*** its dynamic dependency list that programs get resolved with at runtime." fi fi ;; *) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" ;; esac done @@ -6590,7 +7734,7 @@ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" i="" ;; esac @@ -6601,29 +7745,29 @@ set dummy $deplib_matches; shift deplib_match=$1 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" else droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: dynamic linker does not accept needed library $i." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because a test_compile did reveal that the linker did not use this one" - $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because a test_compile did reveal that the linker did not use this one" + echo "*** as a dynamic dependency that programs can get resolved with at runtime." fi fi else droppeddeps=yes - $ECHO + echo $ECHO "*** Warning! Library $i is needed by this library but I was not able to" - $ECHO "*** make it link in! You will probably need to install it or some" - $ECHO "*** library that it depends on before this library will be fully" - $ECHO "*** functional. Installing it before continuing would be even better." + echo "*** make it link in! You will probably need to install it or some" + echo "*** library that it depends on before this library will be fully" + echo "*** functional. Installing it before continuing would be even better." fi ;; *) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" ;; esac done @@ -6640,15 +7784,27 @@ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` + if test -n "$file_magic_glob"; then + libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` + else + libnameglob=$libname + fi + test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + if test "$want_nocaseglob" = yes; then + shopt -s nocaseglob + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | @@ -6665,13 +7821,13 @@ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi @@ -6680,12 +7836,12 @@ fi if test -n "$a_deplib" ; then droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because I did check the linker path looking for a file starting" + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else @@ -6696,7 +7852,7 @@ ;; *) # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. @@ -6712,7 +7868,7 @@ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" ;; esac @@ -6723,9 +7879,9 @@ potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test - if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi @@ -6734,12 +7890,12 @@ fi if test -n "$a_deplib" ; then droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because I did check the linker path looking for a file starting" + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else @@ -6750,32 +7906,32 @@ ;; *) # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" - tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ - -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi - if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | - $GREP . >/dev/null; then - $ECHO + case $tmp_deplibs in + *[!\ \ ]*) + echo if test "X$deplibs_check_method" = "Xnone"; then - $ECHO "*** Warning: inter-library dependencies are not supported in this platform." + echo "*** Warning: inter-library dependencies are not supported in this platform." else - $ECHO "*** Warning: inter-library dependencies are not known to be supported." + echo "*** Warning: inter-library dependencies are not known to be supported." fi - $ECHO "*** All declared inter-library dependencies are being dropped." + echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes - fi + ;; + esac ;; esac versuffix=$versuffix_save @@ -6787,23 +7943,23 @@ case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then - $ECHO - $ECHO "*** Warning: libtool could not satisfy all declared inter-library" + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" - $ECHO "*** a static module, that should work as long as the dlopening" - $ECHO "*** application is linked with the -dlopen flag." + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - $ECHO - $ECHO "*** However, this would only work if libtool was able to extract symbol" - $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" - $ECHO "*** not find such a program. So, this module is probably useless." - $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" @@ -6813,16 +7969,16 @@ build_libtool_libs=no fi else - $ECHO "*** The inter-library dependencies that have been dropped here will be" - $ECHO "*** automatically added whenever a program is linked with this library" - $ECHO "*** or is declared to -dlopen it." + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then - $ECHO - $ECHO "*** Since this library must not contain undefined symbols," - $ECHO "*** because either the platform does not support them or" - $ECHO "*** it was explicitly requested with -no-undefined," - $ECHO "*** libtool will only create a static version of it." + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module @@ -6839,9 +7995,9 @@ # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) - newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac @@ -6854,7 +8010,7 @@ *) case " $deplibs " in *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; + func_append new_libs " -L$path/$objdir" ;; esac ;; esac @@ -6864,10 +8020,10 @@ -L*) case " $new_libs " in *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" @@ -6879,15 +8035,22 @@ # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then + # Remove ${wl} instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" + test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else @@ -6896,18 +8059,18 @@ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" + func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; + *) func_append perm_rpath " $libdir" ;; esac fi done @@ -6915,17 +8078,13 @@ if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi + eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do - rpath="$rpath$dir:" + func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi @@ -6933,7 +8092,7 @@ fi shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi @@ -6959,18 +8118,18 @@ linknames= for link do - linknames="$linknames $link" + func_append linknames " $link" done # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" - delfiles="$delfiles $export_symbols" + func_append delfiles " $export_symbols" fi orig_export_symbols= @@ -7001,14 +8160,46 @@ $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do + for cmd1 in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" - func_len " $cmd" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test "$try_normal_branch" = yes \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then func_show_eval "$cmd" 'exit $?' skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=${output_objdir}/${output_la}.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." @@ -7029,7 +8220,7 @@ if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then @@ -7041,7 +8232,7 @@ # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi @@ -7051,7 +8242,7 @@ case " $convenience " in *" $test_deplib "*) ;; *) - tmp_deplibs="$tmp_deplibs $test_deplib" + func_append tmp_deplibs " $test_deplib" ;; esac done @@ -7071,21 +8262,21 @@ test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" + func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" + func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then + if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi @@ -7130,7 +8321,8 @@ save_libobjs=$libobjs fi save_output=$output - output_la=`$ECHO "X$output" | $Xsed -e "$basename"` + func_basename "$output" + output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. @@ -7143,13 +8335,16 @@ if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" - $ECHO 'INPUT (' > $output + echo 'INPUT (' > $output for obj in $save_libobjs do - $ECHO "$obj" >> $output + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output done - $ECHO ')' >> $output - delfiles="$delfiles $output" + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" @@ -7163,10 +8358,12 @@ fi for obj do - $ECHO "$obj" >> $output + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output done - delfiles="$delfiles $output" - output=$firstobj\"$file_list_spec$output\" + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." @@ -7190,17 +8387,19 @@ # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext - objlist=$obj + objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result @@ -7210,11 +8409,12 @@ # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi - delfiles="$delfiles $output" + func_append delfiles " $output" else output= @@ -7248,7 +8448,7 @@ lt_exit=$? # Restore the uninstalled library and exit - if test "$mode" = relink; then + if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) @@ -7269,7 +8469,7 @@ if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then @@ -7281,7 +8481,7 @@ # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi @@ -7322,10 +8522,10 @@ # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $dlprefiles - libobjs="$libobjs $func_extract_archives_result" + func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi @@ -7341,7 +8541,7 @@ lt_exit=$? # Restore the uninstalled library and exit - if test "$mode" = relink; then + if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) @@ -7353,7 +8553,7 @@ IFS="$save_ifs" # Restore the uninstalled library and exit - if test "$mode" = relink; then + if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then @@ -7434,18 +8634,21 @@ if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` + reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi + # If we're not building shared, we need to use non_pic_objs + test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" + # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' @@ -7505,8 +8708,8 @@ case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac @@ -7517,14 +8720,14 @@ if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" + func_append compile_command " ${wl}-bind_at_load" + func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac @@ -7538,7 +8741,7 @@ *) case " $compile_deplibs " in *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; + func_append new_libs " -L$path/$objdir" ;; esac ;; esac @@ -7548,17 +8751,17 @@ -L*) case " $new_libs " in *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. @@ -7566,7 +8769,7 @@ # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; + *) func_append finalize_rpath " $libdir" ;; esac done fi @@ -7585,18 +8788,18 @@ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" + func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; + *) func_append perm_rpath " $libdir" ;; esac fi case $host in @@ -7605,12 +8808,12 @@ case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; - *) dllsearchpath="$dllsearchpath:$libdir";; + *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; + *) func_append dllsearchpath ":$testbindir";; esac ;; esac @@ -7636,18 +8839,18 @@ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" + func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + *) func_append finalize_perm_rpath " $libdir" ;; esac fi done @@ -7661,8 +8864,8 @@ if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. - compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" @@ -7674,15 +8877,15 @@ wrappers_required=yes case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=no + ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; - *cegcc) - # Disable wrappers for cegcc, we are cross compiling anyway. - wrappers_required=no - ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no @@ -7691,13 +8894,19 @@ esac if test "$wrappers_required" = no; then # Replace the output file specification. - compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' @@ -7720,7 +8929,7 @@ # We should set the runpath_var. rpath= for dir in $perm_rpath; do - rpath="$rpath$dir:" + func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi @@ -7728,7 +8937,7 @@ # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" + func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi @@ -7738,11 +8947,18 @@ # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. - link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + exit $EXIT_SUCCESS fi @@ -7757,7 +8973,7 @@ if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then - relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= @@ -7769,13 +8985,19 @@ fi # Replace the output file specification. - link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + # Now create the wrapper script. func_verbose "creating $output" @@ -7793,18 +9015,7 @@ fi done relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $ECHO for shipping. - if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then - case $progpath in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; - *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; - esac - qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. @@ -7884,7 +9095,7 @@ else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then - oldobjs="$oldobjs $symfileobj" + func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" @@ -7892,10 +9103,10 @@ if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $addlibs - oldobjs="$oldobjs $func_extract_archives_result" + func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. @@ -7906,10 +9117,10 @@ # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $dlprefiles - oldobjs="$oldobjs $func_extract_archives_result" + func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have @@ -7925,9 +9136,9 @@ done | sort | sort -uc >/dev/null 2>&1); then : else - $ECHO "copying selected object files to avoid basename conflicts..." + echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= @@ -7951,18 +9162,30 @@ esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" ;; - *) oldobjs="$oldobjs $obj" ;; + *) func_append oldobjs " $obj" ;; esac done fi + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." @@ -8036,7 +9259,7 @@ done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi @@ -8056,12 +9279,23 @@ *.la) func_basename "$deplib" name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + func_resolve_sysroot "$deplib" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" - newdependency_libs="$newdependency_libs $libdir/$name" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" @@ -8075,9 +9309,9 @@ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" - newdlfiles="$newdlfiles $libdir/$name" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; - *) newdlfiles="$newdlfiles $lib" ;; + *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" @@ -8094,7 +9328,7 @@ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" - newdlprefiles="$newdlprefiles $libdir/$name" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done @@ -8106,7 +9340,7 @@ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac - newdlfiles="$newdlfiles $abs" + func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= @@ -8115,15 +9349,33 @@ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac - newdlprefiles="$newdlprefiles $abs" + func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test "x$bindir" != x ; + then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; esac $ECHO > $output "\ # $outputname - a libtool library file @@ -8182,7 +9434,7 @@ exit $EXIT_SUCCESS } -{ test "$mode" = link || test "$mode" = relink; } && +{ test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} @@ -8202,9 +9454,9 @@ for arg do case $arg in - -f) RM="$RM $arg"; rmforce=yes ;; - -*) RM="$RM $arg" ;; - *) files="$files $arg" ;; + -f) func_append RM " $arg"; rmforce=yes ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; esac done @@ -8213,24 +9465,23 @@ rmdirs= - origobjdir="$objdir" for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then - objdir="$origobjdir" + odir="$objdir" else - objdir="$dir/$origobjdir" + odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" - test "$mode" = uninstall && objdir="$dir" - - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then + test "$opt_mode" = uninstall && odir="$dir" + + # Remember odir for removal later, being careful to avoid duplicates + if test "$opt_mode" = clean; then case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; esac fi @@ -8256,18 +9507,17 @@ # Delete the libtool libraries and symlinks. for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" + func_append rmfiles " $odir/$n" done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - - case "$mode" in + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case "$opt_mode" in clean) - case " $library_names " in - # " " in the beginning catches empty $dlname + case " $library_names " in *" $dlname "*) ;; - *) rmfiles="$rmfiles $objdir/$dlname" ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac - test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then @@ -8295,19 +9545,19 @@ # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" + func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" + func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) - if test "$mode" = clean ; then + if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) @@ -8317,7 +9567,7 @@ noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe - rmfiles="$rmfiles $file" + func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. @@ -8326,7 +9576,7 @@ func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result - rmfiles="$rmfiles $func_ltwrapper_scriptname_result" + func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename @@ -8334,12 +9584,12 @@ # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" + func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" + func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi @@ -8347,7 +9597,6 @@ esac func_show_eval "$RM $rmfiles" 'exit_status=1' done - objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do @@ -8359,16 +9608,16 @@ exit $exit_status } -{ test "$mode" = uninstall || test "$mode" = clean; } && +{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} -test -z "$mode" && { +test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$mode'" + func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" diff --git a/Modules/_ctypes/libffi/m4/asmcfi.m4 b/Modules/_ctypes/libffi/m4/asmcfi.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/asmcfi.m4 @@ -0,0 +1,13 @@ +AC_DEFUN([GCC_AS_CFI_PSEUDO_OP], +[AC_CACHE_CHECK([assembler .cfi pseudo-op support], + gcc_cv_as_cfi_pseudo_op, [ + gcc_cv_as_cfi_pseudo_op=unknown + AC_TRY_COMPILE([asm (".cfi_startproc\n\t.cfi_endproc");],, + [gcc_cv_as_cfi_pseudo_op=yes], + [gcc_cv_as_cfi_pseudo_op=no]) + ]) + if test "x$gcc_cv_as_cfi_pseudo_op" = xyes; then + AC_DEFINE(HAVE_AS_CFI_PSEUDO_OP, 1, + [Define if your assembler supports .cfi_* directives.]) + fi +]) diff --git a/Modules/_ctypes/libffi/m4/ax_append_flag.m4 b/Modules/_ctypes/libffi/m4/ax_append_flag.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_append_flag.m4 @@ -0,0 +1,69 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) +# +# DESCRIPTION +# +# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space +# added in between. +# +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. +# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains +# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly +# FLAG. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 2 + +AC_DEFUN([AX_APPEND_FLAG], +[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX +AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])dnl +AS_VAR_SET_IF(FLAGS, + [case " AS_VAR_GET(FLAGS) " in + *" $1 "*) + AC_RUN_LOG([: FLAGS already contains $1]) + ;; + *) + AC_RUN_LOG([: FLAGS="$FLAGS $1"]) + AS_VAR_SET(FLAGS, ["AS_VAR_GET(FLAGS) $1"]) + ;; + esac], + [AS_VAR_SET(FLAGS,["$1"])]) +AS_VAR_POPDEF([FLAGS])dnl +])dnl AX_APPEND_FLAG diff --git a/Modules/_ctypes/libffi/m4/ax_cc_maxopt.m4 b/Modules/_ctypes/libffi/m4/ax_cc_maxopt.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_cc_maxopt.m4 @@ -0,0 +1,181 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_cc_maxopt.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CC_MAXOPT +# +# DESCRIPTION +# +# Try to turn on "good" C optimization flags for various compilers and +# architectures, for some definition of "good". (In our case, good for +# FFTW and hopefully for other scientific codes. Modify as needed.) +# +# The user can override the flags by setting the CFLAGS environment +# variable. The user can also specify --enable-portable-binary in order to +# disable any optimization flags that might result in a binary that only +# runs on the host architecture. +# +# Note also that the flags assume that ANSI C aliasing rules are followed +# by the code (e.g. for gcc's -fstrict-aliasing), and that floating-point +# computations can be re-ordered as needed. +# +# Requires macros: AX_CHECK_COMPILE_FLAG, AX_COMPILER_VENDOR, +# AX_GCC_ARCHFLAG, AX_GCC_X86_CPUID. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 13 + +AC_DEFUN([AX_CC_MAXOPT], +[ +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AX_COMPILER_VENDOR]) +AC_REQUIRE([AC_CANONICAL_HOST]) + +AC_ARG_ENABLE(portable-binary, [AS_HELP_STRING([--enable-portable-binary], [disable compiler optimizations that would produce unportable binaries])], + acx_maxopt_portable=$enableval, acx_maxopt_portable=no) + +# Try to determine "good" native compiler flags if none specified via CFLAGS +if test "$ac_test_CFLAGS" != "set"; then + CFLAGS="" + case $ax_cv_c_compiler_vendor in + dec) CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host" + if test "x$acx_maxopt_portable" = xno; then + CFLAGS="$CFLAGS -arch host" + fi;; + + sun) CFLAGS="-native -fast -xO5 -dalign" + if test "x$acx_maxopt_portable" = xyes; then + CFLAGS="$CFLAGS -xarch=generic" + fi;; + + hp) CFLAGS="+Oall +Optrs_ansi +DSnative" + if test "x$acx_maxopt_portable" = xyes; then + CFLAGS="$CFLAGS +DAportable" + fi;; + + ibm) if test "x$acx_maxopt_portable" = xno; then + xlc_opt="-qarch=auto -qtune=auto" + else + xlc_opt="-qtune=auto" + fi + AX_CHECK_COMPILE_FLAG($xlc_opt, + CFLAGS="-O3 -qansialias -w $xlc_opt", + [CFLAGS="-O3 -qansialias -w" + echo "******************************************************" + echo "* You seem to have the IBM C compiler. It is *" + echo "* recommended for best performance that you use: *" + echo "* *" + echo "* CFLAGS=-O3 -qarch=xxx -qtune=xxx -qansialias -w *" + echo "* ^^^ ^^^ *" + echo "* where xxx is pwr2, pwr3, 604, or whatever kind of *" + echo "* CPU you have. (Set the CFLAGS environment var. *" + echo "* and re-run configure.) For more info, man cc. *" + echo "******************************************************"]) + ;; + + intel) CFLAGS="-O3 -ansi_alias" + if test "x$acx_maxopt_portable" = xno; then + icc_archflag=unknown + icc_flags="" + case $host_cpu in + i686*|x86_64*) + # icc accepts gcc assembly syntax, so these should work: + AX_GCC_X86_CPUID(0) + AX_GCC_X86_CPUID(1) + case $ax_cv_gcc_x86_cpuid_0 in # see AX_GCC_ARCHFLAG + *:756e6547:*:*) # Intel + case $ax_cv_gcc_x86_cpuid_1 in + *6a?:*[[234]]:*:*|*6[[789b]]?:*:*:*) icc_flags="-xK";; + *f3[[347]]:*:*:*|*f4[1347]:*:*:*) icc_flags="-xP -xN -xW -xK";; + *f??:*:*:*) icc_flags="-xN -xW -xK";; + esac ;; + esac ;; + esac + if test "x$icc_flags" != x; then + for flag in $icc_flags; do + AX_CHECK_COMPILE_FLAG($flag, [icc_archflag=$flag; break]) + done + fi + AC_MSG_CHECKING([for icc architecture flag]) + AC_MSG_RESULT($icc_archflag) + if test "x$icc_archflag" != xunknown; then + CFLAGS="$CFLAGS $icc_archflag" + fi + fi + ;; + + gnu) + # default optimization flags for gcc on all systems + CFLAGS="-O3 -fomit-frame-pointer" + + # -malign-double for x86 systems + # LIBFFI -- DON'T DO THIS - CHANGES ABI + # AX_CHECK_COMPILE_FLAG(-malign-double, CFLAGS="$CFLAGS -malign-double") + + # -fstrict-aliasing for gcc-2.95+ + AX_CHECK_COMPILE_FLAG(-fstrict-aliasing, + CFLAGS="$CFLAGS -fstrict-aliasing") + + # note that we enable "unsafe" fp optimization with other compilers, too + AX_CHECK_COMPILE_FLAG(-ffast-math, CFLAGS="$CFLAGS -ffast-math") + + AX_GCC_ARCHFLAG($acx_maxopt_portable) + ;; + esac + + if test -z "$CFLAGS"; then + echo "" + echo "********************************************************" + echo "* WARNING: Don't know the best CFLAGS for this system *" + echo "* Use ./configure CFLAGS=... to specify your own flags *" + echo "* (otherwise, a default of CFLAGS=-O3 will be used) *" + echo "********************************************************" + echo "" + CFLAGS="-O3" + fi + + AX_CHECK_COMPILE_FLAG($CFLAGS, [], [ + echo "" + echo "********************************************************" + echo "* WARNING: The guessed CFLAGS don't seem to work with *" + echo "* your compiler. *" + echo "* Use ./configure CFLAGS=... to specify your own flags *" + echo "********************************************************" + echo "" + CFLAGS="" + ]) + +fi +]) diff --git a/Modules/_ctypes/libffi/m4/ax_cflags_warn_all.m4 b/Modules/_ctypes/libffi/m4/ax_cflags_warn_all.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_cflags_warn_all.m4 @@ -0,0 +1,122 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] +# AX_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] +# AX_FCFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] +# +# DESCRIPTION +# +# Try to find a compiler option that enables most reasonable warnings. +# +# For the GNU compiler it will be -Wall (and -ansi -pedantic) The result +# is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default. +# +# Currently this macro knows about the GCC, Solaris, Digital Unix, AIX, +# HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and +# Intel compilers. For a given compiler, the Fortran flags are much more +# experimental than their C equivalents. +# +# - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS +# - $2 add-value-if-not-found : nothing +# - $3 action-if-found : add value to shellvariable +# - $4 action-if-not-found : nothing +# +# NOTE: These macros depend on AX_APPEND_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2010 Rhys Ulerich +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 14 + +AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl +AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl +AS_VAR_PUSHDEF([VAR],[ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl +AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], +VAR,[VAR="no, unknown" +ac_save_[]FLAGS="$[]FLAGS" +for ac_arg dnl +in "-warn all % -warn all" dnl Intel + "-pedantic % -Wall" dnl GCC + "-xstrconst % -v" dnl Solaris C + "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix + "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX + "-ansi -ansiE % -fullwarn" dnl IRIX + "+ESlit % +w1" dnl HP-UX C + "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) + "-h conform % -h msglevel 2" dnl Cray C (Unicos) + # +do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) +done +FLAGS="$ac_save_[]FLAGS" +]) +AS_VAR_POPDEF([FLAGS])dnl +AC_REQUIRE([AX_APPEND_FLAG]) +case ".$VAR" in + .ok|.ok,*) m4_ifvaln($3,$3) ;; + .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;; + *) m4_default($3,[AX_APPEND_FLAG([$VAR], [$1])]) ;; +esac +AS_VAR_POPDEF([VAR])dnl +])dnl AX_FLAGS_WARN_ALL +dnl implementation tactics: +dnl the for-argument contains a list of options. The first part of +dnl these does only exist to detect the compiler - usually it is +dnl a global option to enable -ansi or -extrawarnings. All other +dnl compilers will fail about it. That was needed since a lot of +dnl compilers will give false positives for some option-syntax +dnl like -Woption or -Xoption as they think of it is a pass-through +dnl to later compile stages or something. The "%" is used as a +dnl delimiter. A non-option comment can be given after "%%" marks +dnl which will be shown but not added to the respective C/CXXFLAGS. + +AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl +AC_LANG_PUSH([C]) +AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) +AC_LANG_POP([C]) +]) + +AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl +AC_LANG_PUSH([C++]) +AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) +AC_LANG_POP([C++]) +]) + +AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl +AC_LANG_PUSH([Fortran]) +AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) +AC_LANG_POP([Fortran]) +]) diff --git a/Modules/_ctypes/libffi/m4/ax_check_compile_flag.m4 b/Modules/_ctypes/libffi/m4/ax_check_compile_flag.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_check_compile_flag.m4 @@ -0,0 +1,72 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 2 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS diff --git a/Modules/_ctypes/libffi/m4/ax_compiler_vendor.m4 b/Modules/_ctypes/libffi/m4/ax_compiler_vendor.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_compiler_vendor.m4 @@ -0,0 +1,84 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPILER_VENDOR +# +# DESCRIPTION +# +# Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun, +# hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft, +# watcom, etc. The vendor is returned in the cache variable +# $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 11 + +AC_DEFUN([AX_COMPILER_VENDOR], +[AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, + [# note: don't check for gcc first since some other compilers define __GNUC__ + vendors="intel: __ICC,__ECC,__INTEL_COMPILER + ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__ + pathscale: __PATHCC__,__PATHSCALE__ + clang: __clang__ + gnu: __GNUC__ + sun: __SUNPRO_C,__SUNPRO_CC + hp: __HP_cc,__HP_aCC + dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER + borland: __BORLANDC__,__TURBOC__ + comeau: __COMO__ + cray: _CRAYC + kai: __KCC + lcc: __LCC__ + sgi: __sgi,sgi + microsoft: _MSC_VER + metrowerks: __MWERKS__ + watcom: __WATCOMC__ + portland: __PGI + unknown: UNKNOWN" + for ventest in $vendors; do + case $ventest in + *:) vendor=$ventest; continue ;; + *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;; + esac + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ + #if !($vencpp) + thisisanerror; + #endif + ])], [break]) + done + ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1` + ]) +]) diff --git a/Modules/_ctypes/libffi/m4/ax_configure_args.m4 b/Modules/_ctypes/libffi/m4/ax_configure_args.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_configure_args.m4 @@ -0,0 +1,70 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_configure_args.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CONFIGURE_ARGS +# +# DESCRIPTION +# +# Helper macro for AX_ENABLE_BUILDDIR. +# +# The traditional way of starting a subdir-configure is running the script +# with ${1+"$@"} but since autoconf 2.60 this is broken. Instead we have +# to rely on eval'ing $ac_configure_args however some old autoconf +# versions do not provide that. To ensure maximum portability of autoconf +# extension macros this helper can be AC_REQUIRE'd so that +# $ac_configure_args will alsways be present. +# +# Sadly, the traditional "exec $SHELL" of the enable_builddir macros is +# spoiled now and must be replaced by "eval + exit $?". +# +# Example: +# +# AC_DEFUN([AX_ENABLE_SUBDIR],[dnl +# AC_REQUIRE([AX_CONFIGURE_ARGS])dnl +# eval $SHELL $ac_configure_args || exit $? +# ...]) +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 9 + +AC_DEFUN([AX_CONFIGURE_ARGS],[ + # [$]@ is unsable in 2.60+ but earlier autoconf had no ac_configure_args + if test "${ac_configure_args+set}" != "set" ; then + ac_configure_args= + for ac_arg in ${1+"[$]@"}; do + ac_configure_args="$ac_configure_args '$ac_arg'" + done + fi +]) diff --git a/Modules/_ctypes/libffi/m4/ax_enable_builddir.m4 b/Modules/_ctypes/libffi/m4/ax_enable_builddir.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_enable_builddir.m4 @@ -0,0 +1,300 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_enable_builddir.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_ENABLE_BUILDDIR [(dirstring-or-command [,Makefile.mk [,-all]])] +# +# DESCRIPTION +# +# If the current configure was run within the srcdir then we move all +# configure-files into a subdir and let the configure steps continue +# there. We provide an option --disable-builddir to suppress the move into +# a separate builddir. +# +# Defaults: +# +# $1 = $host (overridden with $HOST) +# $2 = Makefile.mk +# $3 = -all +# +# This macro must be called before AM_INIT_AUTOMAKE. It creates a default +# toplevel srcdir Makefile from the information found in the created +# toplevel builddir Makefile. It just copies the variables and +# rule-targets, each extended with a default rule-execution that recurses +# into the build directory of the current "HOST". You can override the +# auto-dection through `config.guess` and build-time of course, as in +# +# make HOST=i386-mingw-cross +# +# which can of course set at configure time as well using +# +# configure --host=i386-mingw-cross +# +# After the default has been created, additional rules can be appended +# that will not just recurse into the subdirectories and only ever exist +# in the srcdir toplevel makefile - these parts are read from the $2 = +# Makefile.mk file +# +# The automatic rules are usually scanning the toplevel Makefile for lines +# like '#### $host |$builddir' to recognize the place where to recurse +# into. Usually, the last one is the only one used. However, almost all +# targets have an additional "*-all" rule which makes the script to +# recurse into _all_ variants of the current HOST (!!) setting. The "-all" +# suffix can be overriden for the macro as well. +# +# a special rule is only given for things like "dist" that will copy the +# tarball from the builddir to the sourcedir (or $(PUB)) for reason of +# convenience. +# +# LICENSE +# +# Copyright (c) 2009 Guido U. Draheim +# Copyright (c) 2009 Alan Jenkins +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 23 + +AC_DEFUN([AX_ENABLE_BUILDDIR],[ +AC_REQUIRE([AC_CANONICAL_HOST])[]dnl +AC_REQUIRE([AX_CONFIGURE_ARGS])[]dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])[]dnl +AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl +AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl +AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl +AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl +SUB="." +AC_ARG_ENABLE([builddir], AS_HELP_STRING( + [--disable-builddir],[disable automatic build in subdir of sources]) + ,[SUB="$enableval"], [SUB="auto"]) +if test ".$ac_srcdir_defaulted" != ".no" ; then +if test ".$srcdir" = ".." ; then + if test -f config.status ; then + AC_MSG_NOTICE(toplevel srcdir already configured... skipping subdir build) + else + test ".$SUB" = "." && SUB="." + test ".$SUB" = ".no" && SUB="." + test ".$TARGET" = "." && TARGET="$target" + test ".$SUB" = ".auto" && SUB="m4_ifval([$1], [$1],[$TARGET])" + if test ".$SUB" != ".." ; then # we know where to go and + AS_MKDIR_P([$SUB]) + echo __.$SUB.__ > $SUB/conftest.tmp + cd $SUB + if grep __.$SUB.__ conftest.tmp >/dev/null 2>/dev/null ; then + rm conftest.tmp + AC_MSG_RESULT([continue configure in default builddir "./$SUB"]) + else + AC_MSG_ERROR([could not change to default builddir "./$SUB"]) + fi + srcdir=`echo "$SUB" | + sed -e 's,^\./,,;s,[[^/]]$,&/,;s,[[^/]]*/,../,g;s,[[/]]$,,;'` + # going to restart from subdirectory location + test -f $srcdir/config.log && mv $srcdir/config.log . + test -f $srcdir/confdefs.h && mv $srcdir/confdefs.h . + test -f $srcdir/conftest.log && mv $srcdir/conftest.log . + test -f $srcdir/$cache_file && mv $srcdir/$cache_file . + AC_MSG_RESULT(....exec $SHELL $srcdir/[$]0 "--srcdir=$srcdir" "--enable-builddir=$SUB" ${1+"[$]@"}) + case "[$]0" in # restart + [/\\]*) eval $SHELL "'[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;; + *) eval $SHELL "'$srcdir/[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;; + esac ; exit $? + fi + fi +fi fi +test ".$SUB" = ".auto" && SUB="." +dnl ac_path_prog uses "set dummy" to override $@ which would defeat the "exec" +AC_PATH_PROG(SED,gsed sed, sed) +AUX="$am_aux_dir" +AS_VAR_POPDEF([SED])dnl +AS_VAR_POPDEF([AUX])dnl +AS_VAR_POPDEF([SUB])dnl +AC_CONFIG_COMMANDS([buildir],[dnl .............. config.status .............. +AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl +AS_VAR_PUSHDEF([TOP],[top_srcdir])dnl +AS_VAR_PUSHDEF([SRC],[ac_top_srcdir])dnl +AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl +AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl +pushdef([END],[Makefile.mk])dnl +pushdef([_ALL],[ifelse([$3],,[-all],[$3])])dnl + SRC="$ax_enable_builddir_srcdir" + if test ".$SUB" = ".." ; then + if test -f "$TOP/Makefile" ; then + AC_MSG_NOTICE([skipping TOP/Makefile - left untouched]) + else + AC_MSG_NOTICE([skipping TOP/Makefile - not created]) + fi + else + if test -f "$SRC/Makefile" ; then + a=`grep "^VERSION " "$SRC/Makefile"` ; b=`grep "^VERSION " Makefile` + test "$a" != "$b" && rm "$SRC/Makefile" + fi + if test -f "$SRC/Makefile" ; then + echo "$SRC/Makefile : $SRC/Makefile.in" > $tmp/conftemp.mk + echo " []@ echo 'REMOVED,,,' >\$[]@" >> $tmp/conftemp.mk + eval "${MAKE-make} -f $tmp/conftemp.mk 2>/dev/null >/dev/null" + if grep '^REMOVED,,,' "$SRC/Makefile" >/dev/null + then rm $SRC/Makefile ; fi + cp $tmp/conftemp.mk $SRC/makefiles.mk~ ## DEBUGGING + fi + if test ! -f "$SRC/Makefile" ; then + AC_MSG_NOTICE([create TOP/Makefile guessed from local Makefile]) + x='`' ; cat >$tmp/conftemp.sed <<_EOF +/^\$/n +x +/^\$/bS +x +/\\\\\$/{H;d;} +{H;s/.*//;x;} +bM +:S +x +/\\\\\$/{h;d;} +{h;s/.*//;x;} +:M +s/\\(\\n\\) /\\1 /g +/^ /d +/^[[ ]]*[[\\#]]/d +/^VPATH *=/d +s/^srcdir *=.*/srcdir = ./ +s/^top_srcdir *=.*/top_srcdir = ./ +/[[:=]]/!d +/^\\./d +dnl Now handle rules (i.e. lines containing ":" but not " = "). +/ = /b +/ .= /b +/:/!b +s/:.*/:/ +s/ / /g +s/ \\([[a-z]][[a-z-]]*[[a-zA-Z0-9]]\\)\\([[ :]]\\)/ \\1 \\1[]_ALL\\2/g +s/^\\([[a-z]][[a-z-]]*[[a-zA-Z0-9]]\\)\\([[ :]]\\)/\\1 \\1[]_ALL\\2/ +s/ / /g +/^all all[]_ALL[[ :]]/i\\ +all-configured : all[]_ALL +dnl dist-all exists... and would make for dist-all-all +s/ [[a-zA-Z0-9-]]*[]_ALL [[a-zA-Z0-9-]]*[]_ALL[]_ALL//g +/[]_ALL[]_ALL/d +a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$n * \$\@"; if test "\$\$n" -eq "0" ; then : \\\\\\ + ; BUILD=$x grep "^####.*|" Makefile |tail -1| sed -e 's/.*|//' $x ; fi \\\\\\ + ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ + ; test "\$\$use" = "\$\@" && BUILD=$x echo "\$\$BUILD" | tail -1 $x \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; (cd "\$\$i" && test ! -f configure && \$(MAKE) \$\$use) || exit; done +dnl special rule add-on: "dist" copies the tarball to $(PUB). (source tree) +/dist[]_ALL *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; found=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).tar.*" \\\\\\ + ; if test "\$\$found" -eq "0" ; then : \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\ + ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).tar.* \\\\\\ + ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done +dnl special rule add-on: "dist-foo" copies all the archives to $(PUB). (source tree) +/dist-[[a-zA-Z0-9]]*[]_ALL *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh ./config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; found=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).*" \\\\\\ + ; if test "\$\$found" -eq "0" ; then : \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\ + ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).* \\\\\\ + ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done +dnl special rule add-on: "distclean" removes all local builddirs completely +/distclean[]_ALL *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile | sed -e 's/.*|//' $x \\\\\\ + ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$n * \$\@ (all local builds)" \\\\\\ + ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; echo "# rm -r \$\$i"; done ; echo "# (sleep 3)" ; sleep 3 \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; echo "\$\$i" | grep "^/" > /dev/null && continue \\\\\\ + ; echo "\$\$i" | grep "^../" > /dev/null && continue \\\\\\ + ; echo "rm -r \$\$i"; (rm -r "\$\$i") ; done ; rm Makefile +_EOF + cp "$tmp/conftemp.sed" "$SRC/makefile.sed~" ## DEBUGGING + $SED -f $tmp/conftemp.sed Makefile >$SRC/Makefile + if test -f "$SRC/m4_ifval([$2],[$2],[END])" ; then + AC_MSG_NOTICE([extend TOP/Makefile with TOP/m4_ifval([$2],[$2],[END])]) + cat $SRC/END >>$SRC/Makefile + fi ; xxxx="####" + echo "$xxxx CONFIGURATIONS FOR TOPLEVEL MAKEFILE: " >>$SRC/Makefile + # sanity check + if grep '^; echo "MAKE ' $SRC/Makefile >/dev/null ; then + AC_MSG_NOTICE([buggy sed found - it deletes tab in "a" text parts]) + $SED -e '/^@ HOST=/s/^/ /' -e '/^; /s/^/ /' $SRC/Makefile \ + >$SRC/Makefile~ + (test -s $SRC/Makefile~ && mv $SRC/Makefile~ $SRC/Makefile) 2>/dev/null + fi + else + xxxx="\\#\\#\\#\\#" + # echo "/^$xxxx *$ax_enable_builddir_host /d" >$tmp/conftemp.sed + echo "s!^$xxxx [[^|]]* | *$SUB *\$!$xxxx ...... $SUB!" >$tmp/conftemp.sed + $SED -f "$tmp/conftemp.sed" "$SRC/Makefile" >$tmp/mkfile.tmp + cp "$tmp/conftemp.sed" "$SRC/makefiles.sed~" ## DEBUGGING + cp "$tmp/mkfile.tmp" "$SRC/makefiles.out~" ## DEBUGGING + if cmp -s "$SRC/Makefile" "$tmp/mkfile.tmp" 2>/dev/null ; then + AC_MSG_NOTICE([keeping TOP/Makefile from earlier configure]) + rm "$tmp/mkfile.tmp" + else + AC_MSG_NOTICE([reusing TOP/Makefile from earlier configure]) + mv "$tmp/mkfile.tmp" "$SRC/Makefile" + fi + fi + AC_MSG_NOTICE([build in $SUB (HOST=$ax_enable_builddir_host)]) + xxxx="####" + echo "$xxxx" "$ax_enable_builddir_host" "|$SUB" >>$SRC/Makefile + fi +popdef([END])dnl +AS_VAR_POPDEF([SED])dnl +AS_VAR_POPDEF([AUX])dnl +AS_VAR_POPDEF([SRC])dnl +AS_VAR_POPDEF([TOP])dnl +AS_VAR_POPDEF([SUB])dnl +],[dnl +ax_enable_builddir_srcdir="$srcdir" # $srcdir +ax_enable_builddir_host="$HOST" # $HOST / $host +ax_enable_builddir_version="$VERSION" # $VERSION +ax_enable_builddir_package="$PACKAGE" # $PACKAGE +ax_enable_builddir_auxdir="$ax_enable_builddir_auxdir" # $AUX +ax_enable_builddir_sed="$ax_enable_builddir_sed" # $SED +ax_enable_builddir="$ax_enable_builddir" # $SUB +])dnl +]) diff --git a/Modules/_ctypes/libffi/m4/ax_gcc_archflag.m4 b/Modules/_ctypes/libffi/m4/ax_gcc_archflag.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_gcc_archflag.m4 @@ -0,0 +1,225 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_gcc_archflag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_ARCHFLAG([PORTABLE?], [ACTION-SUCCESS], [ACTION-FAILURE]) +# +# DESCRIPTION +# +# This macro tries to guess the "native" arch corresponding to the target +# architecture for use with gcc's -march=arch or -mtune=arch flags. If +# found, the cache variable $ax_cv_gcc_archflag is set to this flag and +# ACTION-SUCCESS is executed; otherwise $ax_cv_gcc_archflag is set to +# "unknown" and ACTION-FAILURE is executed. The default ACTION-SUCCESS is +# to add $ax_cv_gcc_archflag to the end of $CFLAGS. +# +# PORTABLE? should be either [yes] (default) or [no]. In the former case, +# the flag is set to -mtune (or equivalent) so that the architecture is +# only used for tuning, but the instruction set used is still portable. In +# the latter case, the flag is set to -march (or equivalent) so that +# architecture-specific instructions are enabled. +# +# The user can specify --with-gcc-arch= in order to override the +# macro's choice of architecture, or --without-gcc-arch to disable this. +# +# When cross-compiling, or if $CC is not gcc, then ACTION-FAILURE is +# called unless the user specified --with-gcc-arch manually. +# +# Requires macros: AX_CHECK_COMPILE_FLAG, AX_GCC_X86_CPUID +# +# (The main emphasis here is on recent CPUs, on the principle that doing +# high-performance computing on old hardware is uncommon.) +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# Copyright (c) 2012 Tsukasa Oi +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 11 + +AC_DEFUN([AX_GCC_ARCHFLAG], +[AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_CANONICAL_HOST]) + +AC_ARG_WITH(gcc-arch, [AS_HELP_STRING([--with-gcc-arch=], [use architecture for gcc -march/-mtune, instead of guessing])], + ax_gcc_arch=$withval, ax_gcc_arch=yes) + +AC_MSG_CHECKING([for gcc architecture flag]) +AC_MSG_RESULT([]) +AC_CACHE_VAL(ax_cv_gcc_archflag, +[ +ax_cv_gcc_archflag="unknown" + +if test "$GCC" = yes; then + +if test "x$ax_gcc_arch" = xyes; then +ax_gcc_arch="" +if test "$cross_compiling" = no; then +case $host_cpu in + i[[3456]]86*|x86_64*) # use cpuid codes + AX_GCC_X86_CPUID(0) + AX_GCC_X86_CPUID(1) + case $ax_cv_gcc_x86_cpuid_0 in + *:756e6547:*:*) # Intel + case $ax_cv_gcc_x86_cpuid_1 in + *5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;; + *5??:*:*:*) ax_gcc_arch=pentium ;; + *0?6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *0?6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *0?6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *0?6[[9de]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; + *0?6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *0?6f?:*:*:*|*1?66?:*:*:*) ax_gcc_arch="core2 pentium-m pentium3 pentiumpro" ;; + *1?6[[7d]]?:*:*:*) ax_gcc_arch="penryn core2 pentium-m pentium3 pentiumpro" ;; + *1?6[[aef]]?:*:*:*|*2?6[[5cef]]?:*:*:*) ax_gcc_arch="corei7 core2 pentium-m pentium3 pentiumpro" ;; + *1?6c?:*:*:*|*[[23]]?66?:*:*:*) ax_gcc_arch="atom core2 pentium-m pentium3 pentiumpro" ;; + *2?6[[ad]]?:*:*:*) ax_gcc_arch="corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;; + *0?6??:*:*:*) ax_gcc_arch=pentiumpro ;; + *6??:*:*:*) ax_gcc_arch="core2 pentiumpro" ;; + ?000?f3[[347]]:*:*:*|?000?f4[1347]:*:*:*|?000?f6?:*:*:*) + case $host_cpu in + x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; + *) ax_gcc_arch="prescott pentium4 pentiumpro" ;; + esac ;; + ?000?f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; + esac ;; + *:68747541:*:*) # AMD + case $ax_cv_gcc_x86_cpuid_1 in + *5[[67]]?:*:*:*) ax_gcc_arch=k6 ;; + *5[[8d]]?:*:*:*) ax_gcc_arch="k6-2 k6" ;; + *5[[9]]?:*:*:*) ax_gcc_arch="k6-3 k6" ;; + *60?:*:*:*) ax_gcc_arch=k7 ;; + *6[[12]]?:*:*:*) ax_gcc_arch="athlon k7" ;; + *6[[34]]?:*:*:*) ax_gcc_arch="athlon-tbird k7" ;; + *67?:*:*:*) ax_gcc_arch="athlon-4 athlon k7" ;; + *6[[68a]]?:*:*:*) + AX_GCC_X86_CPUID(0x80000006) # L2 cache size + case $ax_cv_gcc_x86_cpuid_0x80000006 in + *:*:*[[1-9a-f]]??????:*) # (L2 = ecx >> 16) >= 256 + ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;; + *) ax_gcc_arch="athlon-4 athlon k7" ;; + esac ;; + ?00??f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; + ?00??f5?:*:*:*) ax_gcc_arch="opteron k8" ;; + ?00??f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; + ?00??f??:*:*:*) ax_gcc_arch="k8" ;; + ?05??f??:*:*:*) ax_gcc_arch="btver1 amdfam10 k8" ;; + ?06??f??:*:*:*) ax_gcc_arch="bdver1 amdfam10 k8" ;; + *f??:*:*:*) ax_gcc_arch="amdfam10 k8" ;; + esac ;; + *:746e6543:*:*) # IDT + case $ax_cv_gcc_x86_cpuid_1 in + *54?:*:*:*) ax_gcc_arch=winchip-c6 ;; + *58?:*:*:*) ax_gcc_arch=winchip2 ;; + *6[[78]]?:*:*:*) ax_gcc_arch=c3 ;; + *69?:*:*:*) ax_gcc_arch="c3-2 c3" ;; + esac ;; + esac + if test x"$ax_gcc_arch" = x; then # fallback + case $host_cpu in + i586*) ax_gcc_arch=pentium ;; + i686*) ax_gcc_arch=pentiumpro ;; + esac + fi + ;; + + sparc*) + AC_PATH_PROG([PRTDIAG], [prtdiag], [prtdiag], [$PATH:/usr/platform/`uname -i`/sbin/:/usr/platform/`uname -m`/sbin/]) + cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null` + cputype=`echo "$cputype" | tr -d ' -' |tr $as_cr_LETTERS $as_cr_letters` + case $cputype in + *ultrasparciv*) ax_gcc_arch="ultrasparc4 ultrasparc3 ultrasparc v9" ;; + *ultrasparciii*) ax_gcc_arch="ultrasparc3 ultrasparc v9" ;; + *ultrasparc*) ax_gcc_arch="ultrasparc v9" ;; + *supersparc*|*tms390z5[[05]]*) ax_gcc_arch="supersparc v8" ;; + *hypersparc*|*rt62[[056]]*) ax_gcc_arch="hypersparc v8" ;; + *cypress*) ax_gcc_arch=cypress ;; + esac ;; + + alphaev5) ax_gcc_arch=ev5 ;; + alphaev56) ax_gcc_arch=ev56 ;; + alphapca56) ax_gcc_arch="pca56 ev56" ;; + alphapca57) ax_gcc_arch="pca57 pca56 ev56" ;; + alphaev6) ax_gcc_arch=ev6 ;; + alphaev67) ax_gcc_arch=ev67 ;; + alphaev68) ax_gcc_arch="ev68 ev67" ;; + alphaev69) ax_gcc_arch="ev69 ev68 ev67" ;; + alphaev7) ax_gcc_arch="ev7 ev69 ev68 ev67" ;; + alphaev79) ax_gcc_arch="ev79 ev7 ev69 ev68 ev67" ;; + + powerpc*) + cputype=`((grep cpu /proc/cpuinfo | head -n 1 | cut -d: -f2 | cut -d, -f1 | sed 's/ //g') ; /usr/bin/machine ; /bin/machine; grep CPU /var/run/dmesg.boot | head -n 1 | cut -d" " -f2) 2> /dev/null` + cputype=`echo $cputype | sed -e 's/ppc//g;s/ *//g'` + case $cputype in + *750*) ax_gcc_arch="750 G3" ;; + *740[[0-9]]*) ax_gcc_arch="$cputype 7400 G4" ;; + *74[[4-5]][[0-9]]*) ax_gcc_arch="$cputype 7450 G4" ;; + *74[[0-9]][[0-9]]*) ax_gcc_arch="$cputype G4" ;; + *970*) ax_gcc_arch="970 G5 power4";; + *POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";; + *POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";; + 603ev|8240) ax_gcc_arch="$cputype 603e 603";; + *) ax_gcc_arch=$cputype ;; + esac + ax_gcc_arch="$ax_gcc_arch powerpc" + ;; +esac +fi # not cross-compiling +fi # guess arch + +if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then +for arch in $ax_gcc_arch; do + if test "x[]m4_default([$1],yes)" = xyes; then # if we require portable code + flags="-mtune=$arch" + # -mcpu=$arch and m$arch generate nonportable code on every arch except + # x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr. + case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac + else + flags="-march=$arch -mcpu=$arch -m$arch" + fi + for flag in $flags; do + AX_CHECK_COMPILE_FLAG($flag, [ax_cv_gcc_archflag=$flag; break]) + done + test "x$ax_cv_gcc_archflag" = xunknown || break +done +fi + +fi # $GCC=yes +]) +AC_MSG_CHECKING([for gcc architecture flag]) +AC_MSG_RESULT($ax_cv_gcc_archflag) +if test "x$ax_cv_gcc_archflag" = xunknown; then + m4_default([$3],:) +else + m4_default([$2], [CFLAGS="$CFLAGS $ax_cv_gcc_archflag"]) +fi +]) diff --git a/Modules/_ctypes/libffi/m4/ax_gcc_x86_cpuid.m4 b/Modules/_ctypes/libffi/m4/ax_gcc_x86_cpuid.m4 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/m4/ax_gcc_x86_cpuid.m4 @@ -0,0 +1,79 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_gcc_x86_cpuid.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_X86_CPUID(OP) +# +# DESCRIPTION +# +# On Pentium and later x86 processors, with gcc or a compiler that has a +# compatible syntax for inline assembly instructions, run a small program +# that executes the cpuid instruction with input OP. This can be used to +# detect the CPU type. +# +# On output, the values of the eax, ebx, ecx, and edx registers are stored +# as hexadecimal strings as "eax:ebx:ecx:edx" in the cache variable +# ax_cv_gcc_x86_cpuid_OP. +# +# If the cpuid instruction fails (because you are running a +# cross-compiler, or because you are not using gcc, or because you are on +# a processor that doesn't have this instruction), ax_cv_gcc_x86_cpuid_OP +# is set to the string "unknown". +# +# This macro mainly exists to be used in AX_GCC_ARCHFLAG. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 7 + +AC_DEFUN([AX_GCC_X86_CPUID], +[AC_REQUIRE([AC_PROG_CC]) +AC_LANG_PUSH([C]) +AC_CACHE_CHECK(for x86 cpuid $1 output, ax_cv_gcc_x86_cpuid_$1, + [AC_RUN_IFELSE([AC_LANG_PROGRAM([#include ], [ + int op = $1, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; +])], + [ax_cv_gcc_x86_cpuid_$1=`cat conftest_cpuid`; rm -f conftest_cpuid], + [ax_cv_gcc_x86_cpuid_$1=unknown; rm -f conftest_cpuid], + [ax_cv_gcc_x86_cpuid_$1=unknown])]) +AC_LANG_POP([C]) +]) diff --git a/Modules/_ctypes/libffi/m4/libtool.m4 b/Modules/_ctypes/libffi/m4/libtool.m4 --- a/Modules/_ctypes/libffi/m4/libtool.m4 +++ b/Modules/_ctypes/libffi/m4/libtool.m4 @@ -1,7 +1,8 @@ # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives @@ -10,7 +11,8 @@ m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. @@ -37,7 +39,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) -# serial 56 LT_INIT +# serial 57 LT_INIT # LT_PREREQ(VERSION) @@ -66,6 +68,7 @@ # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl @@ -82,6 +85,8 @@ AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) @@ -118,7 +123,7 @@ *) break;; esac done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) @@ -138,6 +143,11 @@ m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl +dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl @@ -160,10 +170,13 @@ dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our @@ -179,7 +192,6 @@ _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl -_LT_PROG_ECHO_BACKSLASH case $host_os in aix3*) @@ -193,23 +205,6 @@ ;; esac -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([["`\\]]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - # Global variables: ofile=libtool can_build_shared=yes @@ -250,6 +245,28 @@ ])# _LT_SETUP +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' @@ -408,7 +425,7 @@ # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS @@ -418,7 +435,7 @@ # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # -# ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) @@ -517,12 +534,20 @@ LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -533,9 +558,9 @@ # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -543,16 +568,38 @@ esac done -# Fix-up fallback echo if it was mangled by the above quoting rules. -case \$lt_ECHO in -*'\\\[$]0 --fallback-echo"')dnl " - lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` - ;; -esac - _LT_OUTPUT_LIBTOOL_INIT ]) +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# `#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test $lt_write_fail = 0 && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- @@ -562,20 +609,11 @@ AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) -cat >"$CONFIG_LT" <<_LTEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate a libtool stub with the current configuration. - +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AS_SHELL_SANITIZE -_AS_PREPARE - -exec AS_MESSAGE_FD>&1 exec AS_MESSAGE_LOG_FD>>config.log { echo @@ -601,7 +639,7 @@ m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. -Copyright (C) 2008 Free Software Foundation, Inc. +Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." @@ -646,15 +684,13 @@ # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. -if test "$no_create" != yes; then - lt_cl_success=: - test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" - exec AS_MESSAGE_LOG_FD>/dev/null - $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false - exec AS_MESSAGE_LOG_FD>>config.log - $lt_cl_success || AS_EXIT(1) -fi +lt_cl_success=: +test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT @@ -717,15 +753,12 @@ # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - _LT_PROG_XSI_SHELLFNS - - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + _LT_PROG_REPLACE_SHELLFNS + + mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], @@ -770,6 +803,7 @@ m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], @@ -791,6 +825,31 @@ ])# _LT_LANG +m4_ifndef([AC_PROG_GO], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GOC], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GOC, gccgo) +if test -z "$GOC"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GOC"; then + AC_CHECK_PROG(GOC, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef + + # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], @@ -821,6 +880,10 @@ m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) @@ -831,11 +894,13 @@ AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER @@ -921,7 +986,13 @@ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD @@ -929,6 +1000,7 @@ rm -rf libconftest.dylib* rm -f conftest.* fi]) + AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no @@ -940,6 +1012,34 @@ [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) + + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; @@ -967,7 +1067,7 @@ else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - if test "$DSYMUTIL" != ":"; then + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= @@ -977,8 +1077,8 @@ ]) -# _LT_DARWIN_LINKER_FEATURES -# -------------------------- +# _LT_DARWIN_LINKER_FEATURES([TAG]) +# --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ @@ -987,7 +1087,13 @@ _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(whole_archive_flag_spec, $1)='' + if test "$lt_cv_ld_force_load" = "yes"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], + [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in @@ -995,7 +1101,7 @@ *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=echo + output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" @@ -1011,203 +1117,142 @@ fi ]) -# _LT_SYS_MODULE_PATH_AIX -# ----------------------- +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl -AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_SHELL_INIT +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + # _LT_PROG_ECHO_BACKSLASH # ----------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script which will find a shell with a builtin +# printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], -[_LT_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$lt_ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case "$ECHO" in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; esac -ECHO=${lt_ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<_LT_EOF -[$]* -_LT_EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$lt_ECHO"; then - if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if { echo_test_string=`eval $cmd`; } 2>/dev/null && - { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null - then - break - fi - done - fi - - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : - else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$ECHO" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - ECHO='print -r' - elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - ECHO='printf %s\n' - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - ECHO="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - ECHO=echo - fi - fi - fi - fi - fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -lt_ECHO=$ECHO -if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(lt_ECHO) -]) +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], - [An echo program that does not interpret backslashes]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[ --with-sysroot[=DIR] Search for dependent libraries within DIR + (or the compiler's sysroot if not specified).], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([${with_sysroot}]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and in which our libraries should be installed.])]) + # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], @@ -1236,7 +1281,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in @@ -1279,7 +1324,14 @@ LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -1329,14 +1381,27 @@ CFLAGS="$SAVE_CFLAGS" fi ;; -sparc*-*solaris*) +*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" @@ -1354,14 +1419,47 @@ ])# _LT_ENABLE_LOCK +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], -[AC_CHECK_TOOL(AR, ar, false) -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1]) +[_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: @@ -1380,18 +1478,27 @@ if test -n "$RANLIB"; then case $host_os in openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE @@ -1416,15 +1523,15 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes @@ -1464,7 +1571,7 @@ if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes @@ -1527,6 +1634,11 @@ lt_cv_sys_max_cmd_len=8192; ;; + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. @@ -1552,6 +1664,11 @@ lt_cv_sys_max_cmd_len=196608 ;; + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not @@ -1578,7 +1695,8 @@ ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -1591,8 +1709,8 @@ # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ - = "XX$teststring$teststring"; } >/dev/null 2>&1 && + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` @@ -1643,7 +1761,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -[#line __oline__ "configure" +[#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -1684,7 +1802,13 @@ # endif #endif -void fnord() { int i=42;} +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -1693,7 +1817,11 @@ if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } /* dlclose (self); */ } else @@ -1869,16 +1997,16 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes @@ -2037,6 +2165,7 @@ m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ @@ -2045,16 +2174,23 @@ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` - else - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= @@ -2067,7 +2203,7 @@ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done - lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; @@ -2087,7 +2223,13 @@ if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` - sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) @@ -2113,7 +2255,7 @@ case $host_os in aix3*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH @@ -2122,7 +2264,7 @@ ;; aix[[4-9]]*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes @@ -2175,7 +2317,7 @@ m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; @@ -2187,7 +2329,7 @@ ;; bsdi[[45]]*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' @@ -2206,8 +2348,9 @@ need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + case $GCC,$cc_basename in + yes,*) + # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ @@ -2228,36 +2371,83 @@ cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac + dynamic_linker='Win32 ld.exe' ;; + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + *) + # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' ;; esac - dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -2278,7 +2468,7 @@ ;; dgux*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' @@ -2286,10 +2476,6 @@ shlibpath_var=LD_LIBRARY_PATH ;; -freebsd1*) - dynamic_linker=no - ;; - freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. @@ -2297,7 +2483,7 @@ objformat=`/usr/bin/objformat` else case $host_os in - freebsd[[123]]*) objformat=aout ;; + freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi @@ -2315,7 +2501,7 @@ esac shlibpath_var=LD_LIBRARY_PATH case $host_os in - freebsd2*) + freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) @@ -2335,12 +2521,26 @@ ;; gnu*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; @@ -2386,12 +2586,14 @@ soname_spec='${libname}${release}${shared_ext}$major' ;; esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 ;; interix[[3-9]]*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' @@ -2407,7 +2609,7 @@ nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; @@ -2444,9 +2646,9 @@ dynamic_linker=no ;; -# This must be Linux ELF. -linux* | k*bsd*-gnu) - version_type=linux +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -2454,16 +2656,21 @@ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install @@ -2475,8 +2682,9 @@ # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -2507,7 +2715,7 @@ ;; newsos6) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -2576,7 +2784,7 @@ ;; solaris*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -2601,7 +2809,7 @@ ;; sysv4 | sysv4.3*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH @@ -2625,7 +2833,7 @@ sysv4*MP*) if test -d /usr/nec ;then - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH @@ -2656,7 +2864,7 @@ tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -2666,7 +2874,7 @@ ;; uts4*) - version_type=linux + version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH @@ -2708,6 +2916,8 @@ The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], @@ -2820,6 +3030,7 @@ AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], @@ -2941,6 +3152,11 @@ esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' @@ -2949,8 +3165,8 @@ fi ;; esac -_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl -_LT_DECL([], [reload_cmds], [2])dnl +_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl +_LT_TAGDECL([], [reload_cmds], [2])dnl ])# _LT_CMD_RELOAD @@ -3002,16 +3218,18 @@ # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -cegcc) +cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' @@ -3041,6 +3259,10 @@ lt_cv_deplibs_check_method=pass_all ;; +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in @@ -3049,11 +3271,11 @@ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac @@ -3074,8 +3296,8 @@ lt_cv_deplibs_check_method=pass_all ;; -# This must be Linux ELF. -linux* | k*bsd*-gnu) +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; @@ -3153,6 +3375,21 @@ ;; esac ]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -3160,7 +3397,11 @@ _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method == "file_magic"]) + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD @@ -3217,7 +3458,19 @@ NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. - AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" @@ -3230,13 +3483,13 @@ AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -3251,6 +3504,67 @@ dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + # LT_LIB_M # -------- @@ -3259,7 +3573,7 @@ [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) @@ -3287,7 +3601,12 @@ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, @@ -3304,6 +3623,7 @@ m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl @@ -3371,8 +3691,8 @@ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= @@ -3396,6 +3716,7 @@ # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ @@ -3408,6 +3729,7 @@ else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no @@ -3429,7 +3751,7 @@ if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -3441,6 +3763,18 @@ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t at _DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT@&t at _DLSYM_CONST +#else +# define LT@&t at _DLSYM_CONST const +#endif + #ifdef __cplusplus extern "C" { #endif @@ -3452,7 +3786,7 @@ cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ -const struct { +LT@&t at _DLSYM_CONST struct { const char *name; void *address; } @@ -3478,15 +3812,15 @@ _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi @@ -3519,6 +3853,13 @@ AC_MSG_RESULT(ok) fi +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], @@ -3529,6 +3870,8 @@ _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS @@ -3540,7 +3883,6 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= -AC_MSG_CHECKING([for $compiler option to produce PIC]) m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then @@ -3591,6 +3933,11 @@ # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. @@ -3640,6 +3987,12 @@ ;; esac ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; dgux*) case $cc_basename in ec++*) @@ -3696,7 +4049,7 @@ ;; esac ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler @@ -3729,8 +4082,8 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - xlc* | xlC*) - # IBM XL 8.0 on PPC + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' @@ -3792,7 +4145,7 @@ ;; solaris*) case $cc_basename in - CC*) + CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' @@ -3896,6 +4249,12 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag @@ -3938,6 +4297,15 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi + ;; + esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in @@ -3980,7 +4348,7 @@ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -4001,7 +4369,13 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; - pgcc* | pgf77* | pgf90* | pgf95*) + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4013,25 +4387,40 @@ # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - xl*) - # IBM XL C 8.0/Fortran 10.1 on PPC + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ F* | *Sun*Fortran*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + *Intel*\ [[CF]]*Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *Portland\ Group*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; esac ;; @@ -4063,7 +4452,7 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in - f77* | f90* | f95*) + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; @@ -4120,9 +4509,11 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac -AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. @@ -4141,6 +4532,8 @@ _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # @@ -4161,6 +4554,7 @@ m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl @@ -4169,27 +4563,37 @@ AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; + ;; cygwin* | mingw* | cegcc*) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - ;; + case $cc_basename in + cl*) + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; + ;; esac - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= @@ -4204,7 +4608,6 @@ _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported @@ -4252,7 +4655,33 @@ esac _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' @@ -4270,6 +4699,7 @@ fi supports_anon_versioning=no case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... @@ -4285,11 +4715,12 @@ _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 -*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. _LT_EOF fi @@ -4325,10 +4756,12 @@ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -4346,6 +4779,11 @@ fi ;; + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -4361,7 +4799,7 @@ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - gnu* | linux* | tpf* | k*bsd*-gnu) + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in @@ -4371,15 +4809,16 @@ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then - tmp_addflag= + tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -4390,13 +4829,17 @@ lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; - xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 @@ -4412,17 +4855,16 @@ fi case $cc_basename in - xlf*) + xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac @@ -4436,8 +4878,8 @@ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; @@ -4455,8 +4897,8 @@ _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -4502,8 +4944,8 @@ *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -4543,8 +4985,10 @@ else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi @@ -4631,9 +5075,9 @@ _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' @@ -4642,14 +5086,19 @@ else # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' @@ -4681,20 +5130,64 @@ # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac ;; darwin* | rhapsody*) @@ -4707,10 +5200,6 @@ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; - freebsd1*) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little @@ -4723,7 +5212,7 @@ ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) + freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes @@ -4732,7 +5221,7 @@ # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -4740,7 +5229,7 @@ hpux9*) if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi @@ -4755,14 +5244,13 @@ ;; hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes @@ -4774,16 +5262,16 @@ ;; hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then + if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else @@ -4795,7 +5283,14 @@ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi @@ -4823,19 +5318,34 @@ irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE(int foo(void) {}, - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - ) - LDFLAGS="$save_LDFLAGS" + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS="$save_LDFLAGS"]) + if test "$lt_cv_irix_exported_symbol" = yes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' @@ -4897,17 +5407,17 @@ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' @@ -4917,13 +5427,13 @@ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -4936,9 +5446,9 @@ _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) @@ -5114,36 +5624,38 @@ # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi @@ -5180,9 +5692,6 @@ _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], - [[If ld is used when linking, flag to hardcode $libdir into a binary - during linking. This must work even if $libdir does not exist]]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], @@ -5208,8 +5717,6 @@ to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [fix_srcfile_path], [1], - [Fix the shell variable $srcfile for the compiler]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], @@ -5220,6 +5727,8 @@ [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented @@ -5313,14 +5822,15 @@ ])# _LT_LANG_C_CONFIG -# _LT_PROG_CXX -# ------------ -# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ -# compiler, we have our own version here. -m4_defun([_LT_PROG_CXX], -[ -pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) -AC_PROG_CXX +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then @@ -5328,22 +5838,6 @@ else _lt_caught_CXX_error=yes fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_CXX - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_CXX], []) - - -# _LT_LANG_CXX_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a C++ compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_CXX_CONFIG], -[AC_REQUIRE([_LT_PROG_CXX])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no @@ -5355,7 +5849,6 @@ _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported @@ -5365,6 +5858,8 @@ _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no @@ -5396,6 +5891,7 @@ # Allow CC to be a program name with arguments. lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX @@ -5413,6 +5909,7 @@ fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -5434,8 +5931,8 @@ # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -5467,7 +5964,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no @@ -5576,10 +6073,10 @@ _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' @@ -5588,14 +6085,19 @@ else # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. @@ -5625,28 +6127,75 @@ ;; cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; @@ -5669,7 +6218,7 @@ esac ;; - freebsd[[12]]*) + freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no @@ -5688,6 +6237,11 @@ gnu*) ;; + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: @@ -5712,11 +6266,11 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no @@ -5777,7 +6331,7 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then @@ -5787,10 +6341,10 @@ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi @@ -5820,7 +6374,7 @@ case $cc_basename in CC*) # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -5831,9 +6385,9 @@ *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -5844,7 +6398,7 @@ _LT_TAGVAR(inherit_rpath, $1)=yes ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler @@ -5862,7 +6416,7 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -5899,26 +6453,26 @@ pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in - *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; - *) # Version 6 will use weak symbols + *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; @@ -5926,7 +6480,7 @@ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ @@ -5945,9 +6499,9 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; - xl*) + xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -5967,13 +6521,13 @@ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. - output_verbose_link_cmd='echo' + output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is @@ -6042,7 +6596,7 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi - output_verbose_link_cmd=echo + output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -6077,15 +6631,15 @@ case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; @@ -6101,17 +6655,17 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac @@ -6121,7 +6675,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support @@ -6157,7 +6711,7 @@ solaris*) case $cc_basename in - CC*) + CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' @@ -6178,7 +6732,7 @@ esac _LT_TAGVAR(link_all_deplibs, $1)=yes - output_verbose_link_cmd='echo' + output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is @@ -6198,14 +6752,14 @@ if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. @@ -6216,7 +6770,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' @@ -6270,6 +6824,10 @@ CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' @@ -6325,6 +6883,7 @@ fi # test -n "$compiler" CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC @@ -6339,6 +6898,29 @@ ])# _LT_LANG_CXX_CONFIG +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose @@ -6347,6 +6929,7 @@ # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= @@ -6396,7 +6979,20 @@ } }; _LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF ]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then @@ -6408,7 +7004,7 @@ pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do - case $p in + case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. @@ -6417,13 +7013,22 @@ test $p = "-R"; then prev=$p continue - else - prev= fi + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) + case ${prev} in + -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. @@ -6443,8 +7048,10 @@ _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi + prev= ;; + *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. @@ -6480,6 +7087,7 @@ fi $RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], @@ -6516,7 +7124,7 @@ solaris*) case $cc_basename in - CC*) + CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as @@ -6560,32 +7168,16 @@ ])# _LT_SYS_HIDDEN_LIBDEPS -# _LT_PROG_F77 -# ------------ -# Since AC_PROG_F77 is broken, in that it returns the empty string -# if there is no fortran compiler, we have our own version here. -m4_defun([_LT_PROG_F77], -[ -pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) -AC_PROG_F77 -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_F77 - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_F77], []) - - # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], -[AC_REQUIRE([_LT_PROG_F77])dnl -AC_LANG_PUSH(Fortran 77) +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= @@ -6595,7 +7187,6 @@ _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no @@ -6604,6 +7195,8 @@ _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no @@ -6643,7 +7236,9 @@ # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} + CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -6697,38 +7292,24 @@ GCC=$lt_save_GCC CC="$lt_save_CC" + CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG -# _LT_PROG_FC -# ----------- -# Since AC_PROG_FC is broken, in that it returns the empty string -# if there is no fortran compiler, we have our own version here. -m4_defun([_LT_PROG_FC], -[ -pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) -AC_PROG_FC -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_FC - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_FC], []) - - # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], -[AC_REQUIRE([_LT_PROG_FC])dnl -AC_LANG_PUSH(Fortran) +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= @@ -6738,7 +7319,6 @@ _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no @@ -6747,6 +7327,8 @@ _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no @@ -6786,7 +7368,9 @@ # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} + CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu @@ -6842,7 +7426,8 @@ fi # test -n "$compiler" GCC=$lt_save_GCC - CC="$lt_save_CC" + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP @@ -6879,10 +7464,12 @@ _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. -lt_save_CC="$CC" +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" @@ -6892,6 +7479,8 @@ _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change @@ -6911,10 +7500,82 @@ AC_LANG_RESTORE GCC=$lt_save_GCC -CC="$lt_save_CC" +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GOC-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG + + # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler @@ -6946,9 +7607,11 @@ # Allow CC to be a program name with arguments. lt_save_CC="$CC" +lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} +CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -6961,7 +7624,8 @@ GCC=$lt_save_GCC AC_LANG_RESTORE -CC="$lt_save_CC" +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG @@ -6981,6 +7645,13 @@ dnl AC_DEFUN([LT_AC_PROG_GCJ], []) +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GOC, gccgo,) +]) + + # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], @@ -7020,6 +7691,15 @@ AC_SUBST([OBJDUMP]) ]) +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) # _LT_DECL_SED # ------------ @@ -7113,8 +7793,8 @@ # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes @@ -7153,208 +7833,162 @@ ])# _LT_CHECK_SHELL_FEATURES -# _LT_PROG_XSI_SHELLFNS -# --------------------- -# Bourne and XSI compatible variants of some useful shell functions. -m4_defun([_LT_PROG_XSI_SHELLFNS], -[case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $[*] )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} - -_LT_EOF +# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) +# ------------------------------------------------------ +# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and +# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. +m4_defun([_LT_PROG_FUNCTION_REPLACE], +[dnl { +sed -e '/^$1 ()$/,/^} # $1 /c\ +$1 ()\ +{\ +m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) +} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: +]) + + +# _LT_PROG_REPLACE_SHELLFNS +# ------------------------- +# Replace existing portable implementations of several shell functions with +# equivalent extended shell implementations where those features are available.. +m4_defun([_LT_PROG_REPLACE_SHELLFNS], +[if test x"$xsi_shell" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl + func_split_long_opt_name=${1%%=*} + func_split_long_opt_arg=${1#*=}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) + + _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) + + _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) + + _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) +fi + +if test x"$lt_shell_append" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) + + _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl + func_quote_for_eval "${2}" +dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ + eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) +fi +]) + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine which file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} - -dnl func_dirname_and_basename -dnl A portable version of this function is already defined in general.m4sh -dnl so there is no need for it here. - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; - esac -} - -# sed scripts: -my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[[^=]]*=//' - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` -} - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$[@]"` -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` -} - -_LT_EOF + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; esac - -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]+=\$[2]" -} -_LT_EOF +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]=\$$[1]\$[2]" -} - -_LT_EOF - ;; - esac +esac ]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/Modules/_ctypes/libffi/m4/ltoptions.m4 b/Modules/_ctypes/libffi/m4/ltoptions.m4 --- a/Modules/_ctypes/libffi/m4/ltoptions.m4 +++ b/Modules/_ctypes/libffi/m4/ltoptions.m4 @@ -1,13 +1,14 @@ # Helper functions for option handling. -*- Autoconf -*- # -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, +# Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 6 ltoptions.m4 +# serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) @@ -125,7 +126,7 @@ [enable_win32_dll=yes case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) @@ -133,13 +134,13 @@ esac test -z "$AS" && AS=as -_LT_DECL([], [AS], [0], [Assembler program])dnl +_LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], @@ -325,9 +326,24 @@ # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic], + [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) diff --git a/Modules/_ctypes/libffi/m4/ltversion.m4 b/Modules/_ctypes/libffi/m4/ltversion.m4 --- a/Modules/_ctypes/libffi/m4/ltversion.m4 +++ b/Modules/_ctypes/libffi/m4/ltversion.m4 @@ -7,17 +7,17 @@ # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# Generated from ltversion.in. +# @configure_input@ -# serial 3012 ltversion.m4 +# serial 3337 ltversion.m4 # This file is part of GNU Libtool -m4_define([LT_PACKAGE_VERSION], [2.2.6]) -m4_define([LT_PACKAGE_REVISION], [1.3012]) +m4_define([LT_PACKAGE_VERSION], [2.4.2]) +m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.2.6' -macro_revision='1.3012' +[macro_version='2.4.2' +macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) diff --git a/Modules/_ctypes/libffi/m4/lt~obsolete.m4 b/Modules/_ctypes/libffi/m4/lt~obsolete.m4 --- a/Modules/_ctypes/libffi/m4/lt~obsolete.m4 +++ b/Modules/_ctypes/libffi/m4/lt~obsolete.m4 @@ -1,13 +1,13 @@ # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # -# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 4 lt~obsolete.m4 +# serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # @@ -77,7 +77,6 @@ m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) @@ -90,3 +89,10 @@ m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/Modules/_ctypes/libffi/man/Makefile.am b/Modules/_ctypes/libffi/man/Makefile.am --- a/Modules/_ctypes/libffi/man/Makefile.am +++ b/Modules/_ctypes/libffi/man/Makefile.am @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS=foreign -EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 +EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 -man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 +man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 diff --git a/Modules/_ctypes/libffi/man/Makefile.in b/Modules/_ctypes/libffi/man/Makefile.in --- a/Modules/_ctypes/libffi/man/Makefile.in +++ b/Modules/_ctypes/libffi/man/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.12.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,6 +14,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -37,7 +53,19 @@ subdir = man DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_cc_maxopt.m4 \ + $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_configure_args.m4 \ + $(top_srcdir)/m4/ax_enable_builddir.m4 \ + $(top_srcdir)/m4/ax_gcc_archflag.m4 \ + $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -47,6 +75,11 @@ CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -68,6 +101,12 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } man3dir = $(mandir)/man3 am__installdirs = "$(DESTDIR)$(man3dir)" NROFF = nroff @@ -76,6 +115,7 @@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ +AM_LTLDFLAGS = @AM_LTLDFLAGS@ AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -93,6 +133,7 @@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -100,6 +141,7 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ FGREP = @FGREP@ GREP = @GREP@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ @@ -118,6 +160,7 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -130,8 +173,10 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PRTDIAG = @PRTDIAG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -144,6 +189,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -151,6 +197,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -176,7 +223,6 @@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -187,6 +233,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ @@ -199,8 +246,8 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign -EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 -man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 +EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 +man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 all: all-am .SUFFIXES: @@ -242,11 +289,18 @@ -rm -rf .libs _libs install-man3: $(man_MANS) @$(NORMAL_INSTALL) - test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" - @list=''; test -n "$(man3dir)" || exit 0; \ - { for i in $$list; do echo "$$i"; done; \ - l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.3[a-z]*$$/p'; \ + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man3dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.3[a-z]*$$/p'; \ + fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ @@ -275,15 +329,15 @@ sed -n '/\.3[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ - test -z "$$files" || { \ - echo " ( cd '$(DESTDIR)$(man3dir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(man3dir)" && rm -f $$files; } + dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: +cscope cscopelist: + distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ @@ -292,10 +346,10 @@ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ - echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ + echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ - echo " typically \`make maintainer-clean' will remove them" >&2; \ + echo " typically 'make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @@ -345,10 +399,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: diff --git a/Modules/_ctypes/libffi/man/ffi.3 b/Modules/_ctypes/libffi/man/ffi.3 --- a/Modules/_ctypes/libffi/man/ffi.3 +++ b/Modules/_ctypes/libffi/man/ffi.3 @@ -16,6 +16,15 @@ .Fa "ffi_type **atypes" .Fc .Ft void +.Fo ffi_prep_cif_var +.Fa "ffi_cif *cif" +.Fa "ffi_abi abi" +.Fa "unsigned int nfixedargs" +.Fa "unsigned int ntotalargs" +.Fa "ffi_type *rtype" +.Fa "ffi_type **atypes" +.Fc +.Ft void .Fo ffi_call .Fa "ffi_cif *cif" .Fa "void (*fn)(void)" @@ -28,4 +37,5 @@ the called function's interface at compile time. .Sh SEE ALSO .Xr ffi_prep_cif 3 , +.Xr ffi_prep_cif_var 3 , .Xr ffi_call 3 diff --git a/Modules/_ctypes/libffi/man/ffi_prep_cif.3 b/Modules/_ctypes/libffi/man/ffi_prep_cif.3 --- a/Modules/_ctypes/libffi/man/ffi_prep_cif.3 +++ b/Modules/_ctypes/libffi/man/ffi_prep_cif.3 @@ -37,7 +37,9 @@ points to an .Nm ffi_type that describes the data type, size and alignment of the -return value. +return value. Note that to call a variadic function +.Nm ffi_prep_cif_var +must be used instead. .Sh RETURN VALUES Upon successful completion, .Nm ffi_prep_cif @@ -59,8 +61,8 @@ .Nm FFI_BAD_ABI will be returned. Available ABIs are defined in -.Nm -. +.Nm . .Sh SEE ALSO .Xr ffi 3 , -.Xr ffi_call 3 +.Xr ffi_call 3 , +.Xr ffi_prep_cif_var 3 diff --git a/Modules/_ctypes/libffi/man/ffi_prep_cif_var.3 b/Modules/_ctypes/libffi/man/ffi_prep_cif_var.3 new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/man/ffi_prep_cif_var.3 @@ -0,0 +1,73 @@ +.Dd January 25, 2011 +.Dt ffi_prep_cif_var 3 +.Sh NAME +.Nm ffi_prep_cif_var +.Nd Prepare a +.Nm ffi_cif +structure for use with +.Nm ffi_call +for variadic functions. +.Sh SYNOPSIS +.In ffi.h +.Ft ffi_status +.Fo ffi_prep_cif_var +.Fa "ffi_cif *cif" +.Fa "ffi_abi abi" +.Fa "unsigned int nfixedargs" +.Fa "unsigned int ntotalargs" +.Fa "ffi_type *rtype" +.Fa "ffi_type **atypes" +.Fc +.Sh DESCRIPTION +The +.Nm ffi_prep_cif_var +function prepares a +.Nm ffi_cif +structure for use with +.Nm ffi_call +for variadic functions. +.Fa abi +specifies a set of calling conventions to use. +.Fa atypes +is an array of +.Fa ntotalargs +pointers to +.Nm ffi_type +structs that describe the data type, size and alignment of each argument. +.Fa rtype +points to an +.Nm ffi_type +that describes the data type, size and alignment of the +return value. +.Fa nfixedargs +must contain the number of fixed (non-variadic) arguments. +Note that to call a non-variadic function +.Nm ffi_prep_cif +must be used. +.Sh RETURN VALUES +Upon successful completion, +.Nm ffi_prep_cif_var +returns +.Nm FFI_OK . +It will return +.Nm FFI_BAD_TYPEDEF +if +.Fa cif +is +.Nm NULL +or +.Fa atypes +or +.Fa rtype +is malformed. If +.Fa abi +does not refer to a valid ABI, +.Nm FFI_BAD_ABI +will be returned. Available ABIs are +defined in +.Nm +. +.Sh SEE ALSO +.Xr ffi 3 , +.Xr ffi_call 3 , +.Xr ffi_prep_cif 3 diff --git a/Modules/_ctypes/libffi/missing b/Modules/_ctypes/libffi/missing --- a/Modules/_ctypes/libffi/missing +++ b/Modules/_ctypes/libffi/missing @@ -1,10 +1,10 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2005-06-08.21 +scriptversion=2009-04-28.21; # UTC -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify @@ -18,9 +18,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -33,6 +31,8 @@ fi run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. @@ -44,7 +44,7 @@ msg="missing on your system" -case "$1" in +case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= @@ -77,6 +77,7 @@ aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c @@ -86,6 +87,9 @@ tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. + Send bug reports to ." exit $? ;; @@ -103,15 +107,22 @@ esac +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect -# the program). -case "$1" in - lex|yacc) +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) # Not GNU programs, they don't have --version. ;; - tar) + tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 @@ -135,7 +146,7 @@ # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. -case "$1" in +case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if @@ -145,7 +156,7 @@ touch aclocal.m4 ;; - autoconf) + autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the @@ -154,7 +165,7 @@ touch configure ;; - autoheader) + autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want @@ -164,7 +175,7 @@ test -z "$files" && files="config.h" touch_files= for f in $files; do - case "$f" in + case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; @@ -184,7 +195,7 @@ while read f; do touch "$f"; done ;; - autom4te) + autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the @@ -192,8 +203,8 @@ You can get \`$1' as part of \`Autoconf' from any GNU archive site." - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else @@ -207,80 +218,78 @@ fi ;; - bison|yacc) + bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then + if test $# -ne 1; then eval LASTARG="\${$#}" - case "$LASTARG" in + case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi - if [ ! -f y.tab.h ]; then + if test ! -f y.tab.h; then echo >y.tab.h fi - if [ ! -f y.tab.c ]; then + if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; - lex|flex) + lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c - if [ $# -ne 1 ]; then + if test $# -ne 1; then eval LASTARG="\${$#}" - case "$LASTARG" in + case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi - if [ ! -f lex.yy.c ]; then + if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; - help2man) + help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" - exit 1 + exit $? fi ;; - makeinfo) + makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file @@ -289,11 +298,17 @@ DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi @@ -303,7 +318,7 @@ touch $file ;; - tar) + tar*) shift # We have already tried tar in the generic part. @@ -317,13 +332,13 @@ fi firstarg="$1" if shift; then - case "$firstarg" in + case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac - case "$firstarg" in + case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 @@ -356,5 +371,6 @@ # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: diff --git a/Modules/_ctypes/libffi/msvcc.sh b/Modules/_ctypes/libffi/msvcc.sh --- a/Modules/_ctypes/libffi/msvcc.sh +++ b/Modules/_ctypes/libffi/msvcc.sh @@ -42,13 +42,11 @@ # format and translated into something sensible for cl or ml. # -# Disable specific warnings, and enable warnings-as-errors so we catch any -# mistranslated args. -nowarn="-wd4127 -wd4820 -wd4706 -wd4100 -wd4255 -wd4668 -wd4053 -wd4324" -args="-nologo -W3 -WX $nowarn" +args="-nologo -W3" md=-MD cl="cl" ml="ml" +safeseh="-safeseh" output= while [ $# -gt 0 ] @@ -66,15 +64,28 @@ -m64) cl="cl" # "$MSVC/x86_amd64/cl" ml="ml64" # "$MSVC/x86_amd64/ml64" + safeseh= + shift 1 + ;; + -O0) + args="$args -Od" shift 1 ;; -O*) - args="$args $1" + # If we're optimizing, make sure we explicitly turn on some optimizations + # that are implicitly disabled by debug symbols (-Zi). + args="$args $1 -OPT:REF -OPT:ICF -INCREMENTAL:NO" shift 1 ;; -g) - # Can't specify -RTC1 or -Zi in opt. -Gy is ok. Use -OPT:REF? - args="$args -D_DEBUG -RTC1 -Zi" + # Enable debug symbol generation. + args="$args -Zi -DEBUG" + shift 1 + ;; + -DFFI_DEBUG) + # Link against debug CRT and enable runtime error checks. + args="$args -RTC1" + defines="$defines $1" md=-MDd shift 1 ;; @@ -111,7 +122,8 @@ shift 1 ;; -Wall) - args="$args -Wall" + # -Wall on MSVC is overzealous, and we already build with -W3. Nothing + # to do here. shift 1 ;; -Werror) @@ -166,7 +178,7 @@ echo "$cl -nologo -EP $includes $defines $src > $ppsrc" "$cl" -nologo -EP $includes $defines $src > $ppsrc || exit $? output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')" - args="-nologo -safeseh $single $output $ppsrc" + args="-nologo $safeseh $single $output $ppsrc" echo "$ml $args" eval "\"$ml\" $args" diff --git a/Modules/_ctypes/libffi/src/aarch64/ffi.c b/Modules/_ctypes/libffi/src/aarch64/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/aarch64/ffi.c @@ -0,0 +1,1076 @@ +/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include +#include + +#include + +/* Stack alignment requirement in bytes */ +#define AARCH64_STACK_ALIGN 16 + +#define N_X_ARG_REG 8 +#define N_V_ARG_REG 8 + +#define AARCH64_FFI_WITH_V (1 << AARCH64_FFI_WITH_V_BIT) + +union _d +{ + UINT64 d; + UINT32 s[2]; +}; + +struct call_context +{ + UINT64 x [AARCH64_N_XREG]; + struct + { + union _d d[2]; + } v [AARCH64_N_VREG]; +}; + +static void * +get_x_addr (struct call_context *context, unsigned n) +{ + return &context->x[n]; +} + +static void * +get_s_addr (struct call_context *context, unsigned n) +{ +#if defined __AARCH64EB__ + return &context->v[n].d[1].s[1]; +#else + return &context->v[n].d[0].s[0]; +#endif +} + +static void * +get_d_addr (struct call_context *context, unsigned n) +{ +#if defined __AARCH64EB__ + return &context->v[n].d[1]; +#else + return &context->v[n].d[0]; +#endif +} + +static void * +get_v_addr (struct call_context *context, unsigned n) +{ + return &context->v[n]; +} + +/* Return the memory location at which a basic type would reside + were it to have been stored in register n. */ + +static void * +get_basic_type_addr (unsigned short type, struct call_context *context, + unsigned n) +{ + switch (type) + { + case FFI_TYPE_FLOAT: + return get_s_addr (context, n); + case FFI_TYPE_DOUBLE: + return get_d_addr (context, n); + case FFI_TYPE_LONGDOUBLE: + return get_v_addr (context, n); + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_INT: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + return get_x_addr (context, n); + default: + FFI_ASSERT (0); + return NULL; + } +} + +/* Return the alignment width for each of the basic types. */ + +static size_t +get_basic_type_alignment (unsigned short type) +{ + switch (type) + { + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + return sizeof (UINT64); + case FFI_TYPE_LONGDOUBLE: + return sizeof (long double); + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + return sizeof (UINT64); + + default: + FFI_ASSERT (0); + return 0; + } +} + +/* Return the size in bytes for each of the basic types. */ + +static size_t +get_basic_type_size (unsigned short type) +{ + switch (type) + { + case FFI_TYPE_FLOAT: + return sizeof (UINT32); + case FFI_TYPE_DOUBLE: + return sizeof (UINT64); + case FFI_TYPE_LONGDOUBLE: + return sizeof (long double); + case FFI_TYPE_UINT8: + return sizeof (UINT8); + case FFI_TYPE_SINT8: + return sizeof (SINT8); + case FFI_TYPE_UINT16: + return sizeof (UINT16); + case FFI_TYPE_SINT16: + return sizeof (SINT16); + case FFI_TYPE_UINT32: + return sizeof (UINT32); + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + return sizeof (SINT32); + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + return sizeof (UINT64); + case FFI_TYPE_SINT64: + return sizeof (SINT64); + + default: + FFI_ASSERT (0); + return 0; + } +} + +extern void +ffi_call_SYSV (unsigned (*)(struct call_context *context, unsigned char *, + extended_cif *), + struct call_context *context, + extended_cif *, + unsigned, + void (*fn)(void)); + +extern void +ffi_closure_SYSV (ffi_closure *); + +/* Test for an FFI floating point representation. */ + +static unsigned +is_floating_type (unsigned short type) +{ + return (type == FFI_TYPE_FLOAT || type == FFI_TYPE_DOUBLE + || type == FFI_TYPE_LONGDOUBLE); +} + +/* Test for a homogeneous structure. */ + +static unsigned short +get_homogeneous_type (ffi_type *ty) +{ + if (ty->type == FFI_TYPE_STRUCT && ty->elements) + { + unsigned i; + unsigned short candidate_type + = get_homogeneous_type (ty->elements[0]); + for (i =1; ty->elements[i]; i++) + { + unsigned short iteration_type = 0; + /* If we have a nested struct, we must find its homogeneous type. + If that fits with our candidate type, we are still + homogeneous. */ + if (ty->elements[i]->type == FFI_TYPE_STRUCT + && ty->elements[i]->elements) + { + iteration_type = get_homogeneous_type (ty->elements[i]); + } + else + { + iteration_type = ty->elements[i]->type; + } + + /* If we are not homogeneous, return FFI_TYPE_STRUCT. */ + if (candidate_type != iteration_type) + return FFI_TYPE_STRUCT; + } + return candidate_type; + } + + /* Base case, we have no more levels of nesting, so we + are a basic type, and so, trivially homogeneous in that type. */ + return ty->type; +} + +/* Determine the number of elements within a STRUCT. + + Note, we must handle nested structs. + + If ty is not a STRUCT this function will return 0. */ + +static unsigned +element_count (ffi_type *ty) +{ + if (ty->type == FFI_TYPE_STRUCT && ty->elements) + { + unsigned n; + unsigned elems = 0; + for (n = 0; ty->elements[n]; n++) + { + if (ty->elements[n]->type == FFI_TYPE_STRUCT + && ty->elements[n]->elements) + elems += element_count (ty->elements[n]); + else + elems++; + } + return elems; + } + return 0; +} + +/* Test for a homogeneous floating point aggregate. + + A homogeneous floating point aggregate is a homogeneous aggregate of + a half- single- or double- precision floating point type with one + to four elements. Note that this includes nested structs of the + basic type. */ + +static int +is_hfa (ffi_type *ty) +{ + if (ty->type == FFI_TYPE_STRUCT + && ty->elements[0] + && is_floating_type (get_homogeneous_type (ty))) + { + unsigned n = element_count (ty); + return n >= 1 && n <= 4; + } + return 0; +} + +/* Test if an ffi_type is a candidate for passing in a register. + + This test does not check that sufficient registers of the + appropriate class are actually available, merely that IFF + sufficient registers are available then the argument will be passed + in register(s). + + Note that an ffi_type that is deemed to be a register candidate + will always be returned in registers. + + Returns 1 if a register candidate else 0. */ + +static int +is_register_candidate (ffi_type *ty) +{ + switch (ty->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + case FFI_TYPE_UINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_UINT64: + case FFI_TYPE_POINTER: + case FFI_TYPE_SINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_SINT32: + case FFI_TYPE_INT: + case FFI_TYPE_SINT64: + return 1; + + case FFI_TYPE_STRUCT: + if (is_hfa (ty)) + { + return 1; + } + else if (ty->size > 16) + { + /* Too large. Will be replaced with a pointer to memory. The + pointer MAY be passed in a register, but the value will + not. This test specifically fails since the argument will + never be passed by value in registers. */ + return 0; + } + else + { + /* Might be passed in registers depending on the number of + registers required. */ + return (ty->size + 7) / 8 < N_X_ARG_REG; + } + break; + + default: + FFI_ASSERT (0); + break; + } + + return 0; +} + +/* Test if an ffi_type argument or result is a candidate for a vector + register. */ + +static int +is_v_register_candidate (ffi_type *ty) +{ + return is_floating_type (ty->type) + || (ty->type == FFI_TYPE_STRUCT && is_hfa (ty)); +} + +/* Representation of the procedure call argument marshalling + state. + + The terse state variable names match the names used in the AARCH64 + PCS. */ + +struct arg_state +{ + unsigned ngrn; /* Next general-purpose register number. */ + unsigned nsrn; /* Next vector register number. */ + unsigned nsaa; /* Next stack offset. */ +}; + +/* Initialize a procedure call argument marshalling state. */ +static void +arg_init (struct arg_state *state, unsigned call_frame_size) +{ + state->ngrn = 0; + state->nsrn = 0; + state->nsaa = 0; +} + +/* Return the number of available consecutive core argument + registers. */ + +static unsigned +available_x (struct arg_state *state) +{ + return N_X_ARG_REG - state->ngrn; +} + +/* Return the number of available consecutive vector argument + registers. */ + +static unsigned +available_v (struct arg_state *state) +{ + return N_V_ARG_REG - state->nsrn; +} + +static void * +allocate_to_x (struct call_context *context, struct arg_state *state) +{ + FFI_ASSERT (state->ngrn < N_X_ARG_REG) + return get_x_addr (context, (state->ngrn)++); +} + +static void * +allocate_to_s (struct call_context *context, struct arg_state *state) +{ + FFI_ASSERT (state->nsrn < N_V_ARG_REG) + return get_s_addr (context, (state->nsrn)++); +} + +static void * +allocate_to_d (struct call_context *context, struct arg_state *state) +{ + FFI_ASSERT (state->nsrn < N_V_ARG_REG) + return get_d_addr (context, (state->nsrn)++); +} + +static void * +allocate_to_v (struct call_context *context, struct arg_state *state) +{ + FFI_ASSERT (state->nsrn < N_V_ARG_REG) + return get_v_addr (context, (state->nsrn)++); +} + +/* Allocate an aligned slot on the stack and return a pointer to it. */ +static void * +allocate_to_stack (struct arg_state *state, void *stack, unsigned alignment, + unsigned size) +{ + void *allocation; + + /* Round up the NSAA to the larger of 8 or the natural + alignment of the argument's type. */ + state->nsaa = ALIGN (state->nsaa, alignment); + state->nsaa = ALIGN (state->nsaa, alignment); + state->nsaa = ALIGN (state->nsaa, 8); + + allocation = stack + state->nsaa; + + state->nsaa += size; + return allocation; +} + +static void +copy_basic_type (void *dest, void *source, unsigned short type) +{ + /* This is neccessary to ensure that basic types are copied + sign extended to 64-bits as libffi expects. */ + switch (type) + { + case FFI_TYPE_FLOAT: + *(float *) dest = *(float *) source; + break; + case FFI_TYPE_DOUBLE: + *(double *) dest = *(double *) source; + break; + case FFI_TYPE_LONGDOUBLE: + *(long double *) dest = *(long double *) source; + break; + case FFI_TYPE_UINT8: + *(ffi_arg *) dest = *(UINT8 *) source; + break; + case FFI_TYPE_SINT8: + *(ffi_sarg *) dest = *(SINT8 *) source; + break; + case FFI_TYPE_UINT16: + *(ffi_arg *) dest = *(UINT16 *) source; + break; + case FFI_TYPE_SINT16: + *(ffi_sarg *) dest = *(SINT16 *) source; + break; + case FFI_TYPE_UINT32: + *(ffi_arg *) dest = *(UINT32 *) source; + break; + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + *(ffi_sarg *) dest = *(SINT32 *) source; + break; + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + *(ffi_arg *) dest = *(UINT64 *) source; + break; + case FFI_TYPE_SINT64: + *(ffi_sarg *) dest = *(SINT64 *) source; + break; + + default: + FFI_ASSERT (0); + } +} + +static void +copy_hfa_to_reg_or_stack (void *memory, + ffi_type *ty, + struct call_context *context, + unsigned char *stack, + struct arg_state *state) +{ + unsigned elems = element_count (ty); + if (available_v (state) < elems) + { + /* There are insufficient V registers. Further V register allocations + are prevented, the NSAA is adjusted (by allocate_to_stack ()) + and the argument is copied to memory at the adjusted NSAA. */ + state->nsrn = N_V_ARG_REG; + memcpy (allocate_to_stack (state, stack, ty->alignment, ty->size), + memory, + ty->size); + } + else + { + int i; + unsigned short type = get_homogeneous_type (ty); + unsigned elems = element_count (ty); + for (i = 0; i < elems; i++) + { + void *reg = allocate_to_v (context, state); + copy_basic_type (reg, memory, type); + memory += get_basic_type_size (type); + } + } +} + +/* Either allocate an appropriate register for the argument type, or if + none are available, allocate a stack slot and return a pointer + to the allocated space. */ + +static void * +allocate_to_register_or_stack (struct call_context *context, + unsigned char *stack, + struct arg_state *state, + unsigned short type) +{ + size_t alignment = get_basic_type_alignment (type); + size_t size = alignment; + switch (type) + { + case FFI_TYPE_FLOAT: + /* This is the only case for which the allocated stack size + should not match the alignment of the type. */ + size = sizeof (UINT32); + /* Fall through. */ + case FFI_TYPE_DOUBLE: + if (state->nsrn < N_V_ARG_REG) + return allocate_to_d (context, state); + state->nsrn = N_V_ARG_REG; + break; + case FFI_TYPE_LONGDOUBLE: + if (state->nsrn < N_V_ARG_REG) + return allocate_to_v (context, state); + state->nsrn = N_V_ARG_REG; + break; + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_INT: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + if (state->ngrn < N_X_ARG_REG) + return allocate_to_x (context, state); + state->ngrn = N_X_ARG_REG; + break; + default: + FFI_ASSERT (0); + } + + return allocate_to_stack (state, stack, alignment, size); +} + +/* Copy a value to an appropriate register, or if none are + available, to the stack. */ + +static void +copy_to_register_or_stack (struct call_context *context, + unsigned char *stack, + struct arg_state *state, + void *value, + unsigned short type) +{ + copy_basic_type ( + allocate_to_register_or_stack (context, stack, state, type), + value, + type); +} + +/* Marshall the arguments from FFI representation to procedure call + context and stack. */ + +static unsigned +aarch64_prep_args (struct call_context *context, unsigned char *stack, + extended_cif *ecif) +{ + int i; + struct arg_state state; + + arg_init (&state, ALIGN(ecif->cif->bytes, 16)); + + for (i = 0; i < ecif->cif->nargs; i++) + { + ffi_type *ty = ecif->cif->arg_types[i]; + switch (ty->type) + { + case FFI_TYPE_VOID: + FFI_ASSERT (0); + break; + + /* If the argument is a basic type the argument is allocated to an + appropriate register, or if none are available, to the stack. */ + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + copy_to_register_or_stack (context, stack, &state, + ecif->avalue[i], ty->type); + break; + + case FFI_TYPE_STRUCT: + if (is_hfa (ty)) + { + copy_hfa_to_reg_or_stack (ecif->avalue[i], ty, context, + stack, &state); + } + else if (ty->size > 16) + { + /* If the argument is a composite type that is larger than 16 + bytes, then the argument has been copied to memory, and + the argument is replaced by a pointer to the copy. */ + + copy_to_register_or_stack (context, stack, &state, + &(ecif->avalue[i]), FFI_TYPE_POINTER); + } + else if (available_x (&state) >= (ty->size + 7) / 8) + { + /* If the argument is a composite type and the size in + double-words is not more than the number of available + X registers, then the argument is copied into consecutive + X registers. */ + int j; + for (j = 0; j < (ty->size + 7) / 8; j++) + { + memcpy (allocate_to_x (context, &state), + &(((UINT64 *) ecif->avalue[i])[j]), + sizeof (UINT64)); + } + } + else + { + /* Otherwise, there are insufficient X registers. Further X + register allocations are prevented, the NSAA is adjusted + (by allocate_to_stack ()) and the argument is copied to + memory at the adjusted NSAA. */ + state.ngrn = N_X_ARG_REG; + + memcpy (allocate_to_stack (&state, stack, ty->alignment, + ty->size), ecif->avalue + i, ty->size); + } + break; + + default: + FFI_ASSERT (0); + break; + } + } + + return ecif->cif->aarch64_flags; +} + +ffi_status +ffi_prep_cif_machdep (ffi_cif *cif) +{ + /* Round the stack up to a multiple of the stack alignment requirement. */ + cif->bytes = + (cif->bytes + (AARCH64_STACK_ALIGN - 1)) & ~ (AARCH64_STACK_ALIGN - 1); + + /* Initialize our flags. We are interested if this CIF will touch a + vector register, if so we will enable context save and load to + those registers, otherwise not. This is intended to be friendly + to lazy float context switching in the kernel. */ + cif->aarch64_flags = 0; + + if (is_v_register_candidate (cif->rtype)) + { + cif->aarch64_flags |= AARCH64_FFI_WITH_V; + } + else + { + int i; + for (i = 0; i < cif->nargs; i++) + if (is_v_register_candidate (cif->arg_types[i])) + { + cif->aarch64_flags |= AARCH64_FFI_WITH_V; + break; + } + } + + return FFI_OK; +} + +/* Call a function with the provided arguments and capture the return + value. */ +void +ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + ecif.rvalue = rvalue; + + switch (cif->abi) + { + case FFI_SYSV: + { + struct call_context context; + unsigned stack_bytes; + + /* Figure out the total amount of stack space we need, the + above call frame space needs to be 16 bytes aligned to + ensure correct alignment of the first object inserted in + that space hence the ALIGN applied to cif->bytes.*/ + stack_bytes = ALIGN(cif->bytes, 16); + + memset (&context, 0, sizeof (context)); + if (is_register_candidate (cif->rtype)) + { + ffi_call_SYSV (aarch64_prep_args, &context, &ecif, stack_bytes, fn); + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_INT: + case FFI_TYPE_SINT64: + { + void *addr = get_basic_type_addr (cif->rtype->type, + &context, 0); + copy_basic_type (rvalue, addr, cif->rtype->type); + break; + } + + case FFI_TYPE_STRUCT: + if (is_hfa (cif->rtype)) + { + int j; + unsigned short type = get_homogeneous_type (cif->rtype); + unsigned elems = element_count (cif->rtype); + for (j = 0; j < elems; j++) + { + void *reg = get_basic_type_addr (type, &context, j); + copy_basic_type (rvalue, reg, type); + rvalue += get_basic_type_size (type); + } + } + else if ((cif->rtype->size + 7) / 8 < N_X_ARG_REG) + { + unsigned size = ALIGN (cif->rtype->size, sizeof (UINT64)); + memcpy (rvalue, get_x_addr (&context, 0), size); + } + else + { + FFI_ASSERT (0); + } + break; + + default: + FFI_ASSERT (0); + break; + } + } + else + { + memcpy (get_x_addr (&context, 8), &rvalue, sizeof (UINT64)); + ffi_call_SYSV (aarch64_prep_args, &context, &ecif, + stack_bytes, fn); + } + break; + } + + default: + FFI_ASSERT (0); + break; + } +} + +static unsigned char trampoline [] = +{ 0x70, 0x00, 0x00, 0x58, /* ldr x16, 1f */ + 0x91, 0x00, 0x00, 0x10, /* adr x17, 2f */ + 0x00, 0x02, 0x1f, 0xd6 /* br x16 */ +}; + +/* Build a trampoline. */ + +#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX,FLAGS) \ + ({unsigned char *__tramp = (unsigned char*)(TRAMP); \ + UINT64 __fun = (UINT64)(FUN); \ + UINT64 __ctx = (UINT64)(CTX); \ + UINT64 __flags = (UINT64)(FLAGS); \ + memcpy (__tramp, trampoline, sizeof (trampoline)); \ + memcpy (__tramp + 12, &__fun, sizeof (__fun)); \ + memcpy (__tramp + 20, &__ctx, sizeof (__ctx)); \ + memcpy (__tramp + 28, &__flags, sizeof (__flags)); \ + __clear_cache(__tramp, __tramp + FFI_TRAMPOLINE_SIZE); \ + }) + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; + + FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_SYSV, codeloc, + cif->aarch64_flags); + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + +/* Primary handler to setup and invoke a function within a closure. + + A closure when invoked enters via the assembler wrapper + ffi_closure_SYSV(). The wrapper allocates a call context on the + stack, saves the interesting registers (from the perspective of + the calling convention) into the context then passes control to + ffi_closure_SYSV_inner() passing the saved context and a pointer to + the stack at the point ffi_closure_SYSV() was invoked. + + On the return path the assembler wrapper will reload call context + regsiters. + + ffi_closure_SYSV_inner() marshalls the call context into ffi value + desriptors, invokes the wrapped function, then marshalls the return + value back into the call context. */ + +void +ffi_closure_SYSV_inner (ffi_closure *closure, struct call_context *context, + void *stack) +{ + ffi_cif *cif = closure->cif; + void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); + void *rvalue = NULL; + int i; + struct arg_state state; + + arg_init (&state, ALIGN(cif->bytes, 16)); + + for (i = 0; i < cif->nargs; i++) + { + ffi_type *ty = cif->arg_types[i]; + + switch (ty->type) + { + case FFI_TYPE_VOID: + FFI_ASSERT (0); + break; + + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_INT: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + avalue[i] = allocate_to_register_or_stack (context, stack, + &state, ty->type); + break; + + case FFI_TYPE_STRUCT: + if (is_hfa (ty)) + { + unsigned n = element_count (ty); + if (available_v (&state) < n) + { + state.nsrn = N_V_ARG_REG; + avalue[i] = allocate_to_stack (&state, stack, ty->alignment, + ty->size); + } + else + { + switch (get_homogeneous_type (ty)) + { + case FFI_TYPE_FLOAT: + { + /* Eeek! We need a pointer to the structure, + however the homogeneous float elements are + being passed in individual S registers, + therefore the structure is not represented as + a contiguous sequence of bytes in our saved + register context. We need to fake up a copy + of the structure layed out in memory + correctly. The fake can be tossed once the + closure function has returned hence alloca() + is sufficient. */ + int j; + UINT32 *p = avalue[i] = alloca (ty->size); + for (j = 0; j < element_count (ty); j++) + memcpy (&p[j], + allocate_to_s (context, &state), + sizeof (*p)); + break; + } + + case FFI_TYPE_DOUBLE: + { + /* Eeek! We need a pointer to the structure, + however the homogeneous float elements are + being passed in individual S registers, + therefore the structure is not represented as + a contiguous sequence of bytes in our saved + register context. We need to fake up a copy + of the structure layed out in memory + correctly. The fake can be tossed once the + closure function has returned hence alloca() + is sufficient. */ + int j; + UINT64 *p = avalue[i] = alloca (ty->size); + for (j = 0; j < element_count (ty); j++) + memcpy (&p[j], + allocate_to_d (context, &state), + sizeof (*p)); + break; + } + + case FFI_TYPE_LONGDOUBLE: + memcpy (&avalue[i], + allocate_to_v (context, &state), + sizeof (*avalue)); + break; + + default: + FFI_ASSERT (0); + break; + } + } + } + else if (ty->size > 16) + { + /* Replace Composite type of size greater than 16 with a + pointer. */ + memcpy (&avalue[i], + allocate_to_register_or_stack (context, stack, + &state, FFI_TYPE_POINTER), + sizeof (avalue[i])); + } + else if (available_x (&state) >= (ty->size + 7) / 8) + { + avalue[i] = get_x_addr (context, state.ngrn); + state.ngrn += (ty->size + 7) / 8; + } + else + { + state.ngrn = N_X_ARG_REG; + + avalue[i] = allocate_to_stack (&state, stack, ty->alignment, + ty->size); + } + break; + + default: + FFI_ASSERT (0); + break; + } + } + + /* Figure out where the return value will be passed, either in + registers or in a memory block allocated by the caller and passed + in x8. */ + + if (is_register_candidate (cif->rtype)) + { + /* Register candidates are *always* returned in registers. */ + + /* Allocate a scratchpad for the return value, we will let the + callee scrible the result into the scratch pad then move the + contents into the appropriate return value location for the + call convention. */ + rvalue = alloca (cif->rtype->size); + (closure->fun) (cif, rvalue, avalue, closure->user_data); + + /* Copy the return value into the call context so that it is returned + as expected to our caller. */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + break; + + case FFI_TYPE_UINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + case FFI_TYPE_SINT64: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + { + void *addr = get_basic_type_addr (cif->rtype->type, context, 0); + copy_basic_type (addr, rvalue, cif->rtype->type); + break; + } + case FFI_TYPE_STRUCT: + if (is_hfa (cif->rtype)) + { + int i; + unsigned short type = get_homogeneous_type (cif->rtype); + unsigned elems = element_count (cif->rtype); + for (i = 0; i < elems; i++) + { + void *reg = get_basic_type_addr (type, context, i); + copy_basic_type (reg, rvalue, type); + rvalue += get_basic_type_size (type); + } + } + else if ((cif->rtype->size + 7) / 8 < N_X_ARG_REG) + { + unsigned size = ALIGN (cif->rtype->size, sizeof (UINT64)) ; + memcpy (get_x_addr (context, 0), rvalue, size); + } + else + { + FFI_ASSERT (0); + } + break; + default: + FFI_ASSERT (0); + break; + } + } + else + { + memcpy (&rvalue, get_x_addr (context, 8), sizeof (UINT64)); + (closure->fun) (cif, rvalue, avalue, closure->user_data); + } +} + diff --git a/Modules/_ctypes/libffi/src/aarch64/ffitarget.h b/Modules/_ctypes/libffi/src/aarch64/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/aarch64/ffitarget.h @@ -0,0 +1,59 @@ +/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi + { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV + } ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 36 +#define FFI_NATIVE_RAW_API 0 + +/* ---- Internal ---- */ + + +#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_flags + +#define AARCH64_FFI_WITH_V_BIT 0 + +#define AARCH64_N_XREG 32 +#define AARCH64_N_VREG 32 +#define AARCH64_CALL_CONTEXT_SIZE (AARCH64_N_XREG * 8 + AARCH64_N_VREG * 16) + +#endif diff --git a/Modules/_ctypes/libffi/src/aarch64/sysv.S b/Modules/_ctypes/libffi/src/aarch64/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/aarch64/sysv.S @@ -0,0 +1,307 @@ +/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#define LIBFFI_ASM +#include +#include + +#define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off +#define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off +#define cfi_restore(reg) .cfi_restore reg +#define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg + + .text + .globl ffi_call_SYSV + .type ffi_call_SYSV, #function + +/* ffi_call_SYSV() + + Create a stack frame, setup an argument context, call the callee + and extract the result. + + The maximum required argument stack size is provided, + ffi_call_SYSV() allocates that stack space then calls the + prepare_fn to populate register context and stack. The + argument passing registers are loaded from the register + context and the callee called, on return the register passing + register are saved back to the context. Our caller will + extract the return value from the final state of the saved + register context. + + Prototype: + + extern unsigned + ffi_call_SYSV (void (*)(struct call_context *context, unsigned char *, + extended_cif *), + struct call_context *context, + extended_cif *, + unsigned required_stack_size, + void (*fn)(void)); + + Therefore on entry we have: + + x0 prepare_fn + x1 &context + x2 &ecif + x3 bytes + x4 fn + + This function uses the following stack frame layout: + + == + saved x30(lr) + x29(fp)-> saved x29(fp) + saved x24 + saved x23 + saved x22 + sp' -> saved x21 + ... + sp -> (constructed callee stack arguments) + == + + Voila! */ + +#define ffi_call_SYSV_FS (8 * 4) + + .cfi_startproc +ffi_call_SYSV: + stp x29, x30, [sp, #-16]! + cfi_adjust_cfa_offset (16) + cfi_rel_offset (x29, 0) + cfi_rel_offset (x30, 8) + + mov x29, sp + cfi_def_cfa_register (x29) + sub sp, sp, #ffi_call_SYSV_FS + + stp x21, x22, [sp, 0] + cfi_rel_offset (x21, 0 - ffi_call_SYSV_FS) + cfi_rel_offset (x22, 8 - ffi_call_SYSV_FS) + + stp x23, x24, [sp, 16] + cfi_rel_offset (x23, 16 - ffi_call_SYSV_FS) + cfi_rel_offset (x24, 24 - ffi_call_SYSV_FS) + + mov x21, x1 + mov x22, x2 + mov x24, x4 + + /* Allocate the stack space for the actual arguments, many + arguments will be passed in registers, but we assume + worst case and allocate sufficient stack for ALL of + the arguments. */ + sub sp, sp, x3 + + /* unsigned (*prepare_fn) (struct call_context *context, + unsigned char *stack, extended_cif *ecif); + */ + mov x23, x0 + mov x0, x1 + mov x1, sp + /* x2 already in place */ + blr x23 + + /* Preserve the flags returned. */ + mov x23, x0 + + /* Figure out if we should touch the vector registers. */ + tbz x23, #AARCH64_FFI_WITH_V_BIT, 1f + + /* Load the vector argument passing registers. */ + ldp q0, q1, [x21, #8*32 + 0] + ldp q2, q3, [x21, #8*32 + 32] + ldp q4, q5, [x21, #8*32 + 64] + ldp q6, q7, [x21, #8*32 + 96] +1: + /* Load the core argument passing registers. */ + ldp x0, x1, [x21, #0] + ldp x2, x3, [x21, #16] + ldp x4, x5, [x21, #32] + ldp x6, x7, [x21, #48] + + /* Don't forget x8 which may be holding the address of a return buffer. + */ + ldr x8, [x21, #8*8] + + blr x24 + + /* Save the core argument passing registers. */ + stp x0, x1, [x21, #0] + stp x2, x3, [x21, #16] + stp x4, x5, [x21, #32] + stp x6, x7, [x21, #48] + + /* Note nothing useful ever comes back in x8! */ + + /* Figure out if we should touch the vector registers. */ + tbz x23, #AARCH64_FFI_WITH_V_BIT, 1f + + /* Save the vector argument passing registers. */ + stp q0, q1, [x21, #8*32 + 0] + stp q2, q3, [x21, #8*32 + 32] + stp q4, q5, [x21, #8*32 + 64] + stp q6, q7, [x21, #8*32 + 96] +1: + /* All done, unwind our stack frame. */ + ldp x21, x22, [x29, # - ffi_call_SYSV_FS] + cfi_restore (x21) + cfi_restore (x22) + + ldp x23, x24, [x29, # - ffi_call_SYSV_FS + 16] + cfi_restore (x23) + cfi_restore (x24) + + mov sp, x29 + cfi_def_cfa_register (sp) + + ldp x29, x30, [sp], #16 + cfi_adjust_cfa_offset (-16) + cfi_restore (x29) + cfi_restore (x30) + + ret + + .cfi_endproc + .size ffi_call_SYSV, .-ffi_call_SYSV + +#define ffi_closure_SYSV_FS (8 * 2 + AARCH64_CALL_CONTEXT_SIZE) + +/* ffi_closure_SYSV + + Closure invocation glue. This is the low level code invoked directly by + the closure trampoline to setup and call a closure. + + On entry x17 points to a struct trampoline_data, x16 has been clobbered + all other registers are preserved. + + We allocate a call context and save the argument passing registers, + then invoked the generic C ffi_closure_SYSV_inner() function to do all + the real work, on return we load the result passing registers back from + the call context. + + On entry + + extern void + ffi_closure_SYSV (struct trampoline_data *); + + struct trampoline_data + { + UINT64 *ffi_closure; + UINT64 flags; + }; + + This function uses the following stack frame layout: + + == + saved x30(lr) + x29(fp)-> saved x29(fp) + saved x22 + saved x21 + ... + sp -> call_context + == + + Voila! */ + + .text + .globl ffi_closure_SYSV + .cfi_startproc +ffi_closure_SYSV: + stp x29, x30, [sp, #-16]! + cfi_adjust_cfa_offset (16) + cfi_rel_offset (x29, 0) + cfi_rel_offset (x30, 8) + + mov x29, sp + + sub sp, sp, #ffi_closure_SYSV_FS + cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) + + stp x21, x22, [x29, #-16] + cfi_rel_offset (x21, 0) + cfi_rel_offset (x22, 8) + + /* Load x21 with &call_context. */ + mov x21, sp + /* Preserve our struct trampoline_data * */ + mov x22, x17 + + /* Save the rest of the argument passing registers. */ + stp x0, x1, [x21, #0] + stp x2, x3, [x21, #16] + stp x4, x5, [x21, #32] + stp x6, x7, [x21, #48] + /* Don't forget we may have been given a result scratch pad address. + */ + str x8, [x21, #64] + + /* Figure out if we should touch the vector registers. */ + ldr x0, [x22, #8] + tbz x0, #AARCH64_FFI_WITH_V_BIT, 1f + + /* Save the argument passing vector registers. */ + stp q0, q1, [x21, #8*32 + 0] + stp q2, q3, [x21, #8*32 + 32] + stp q4, q5, [x21, #8*32 + 64] + stp q6, q7, [x21, #8*32 + 96] +1: + /* Load &ffi_closure.. */ + ldr x0, [x22, #0] + mov x1, x21 + /* Compute the location of the stack at the point that the + trampoline was called. */ + add x2, x29, #16 + + bl ffi_closure_SYSV_inner + + /* Figure out if we should touch the vector registers. */ + ldr x0, [x22, #8] + tbz x0, #AARCH64_FFI_WITH_V_BIT, 1f + + /* Load the result passing vector registers. */ + ldp q0, q1, [x21, #8*32 + 0] + ldp q2, q3, [x21, #8*32 + 32] + ldp q4, q5, [x21, #8*32 + 64] + ldp q6, q7, [x21, #8*32 + 96] +1: + /* Load the result passing core registers. */ + ldp x0, x1, [x21, #0] + ldp x2, x3, [x21, #16] + ldp x4, x5, [x21, #32] + ldp x6, x7, [x21, #48] + /* Note nothing usefull is returned in x8. */ + + /* We are done, unwind our frame. */ + ldp x21, x22, [x29, #-16] + cfi_restore (x21) + cfi_restore (x22) + + mov sp, x29 + cfi_adjust_cfa_offset (-ffi_closure_SYSV_FS) + + ldp x29, x30, [sp], #16 + cfi_adjust_cfa_offset (-16) + cfi_restore (x29) + cfi_restore (x30) + + ret + .cfi_endproc + .size ffi_closure_SYSV, .-ffi_closure_SYSV diff --git a/Modules/_ctypes/libffi/src/alpha/ffi.c b/Modules/_ctypes/libffi/src/alpha/ffi.c --- a/Modules/_ctypes/libffi/src/alpha/ffi.c +++ b/Modules/_ctypes/libffi/src/alpha/ffi.c @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998, 2001, 2007, 2008 Red Hat, Inc. + ffi.c - Copyright (c) 2012 Anthony Green + Copyright (c) 1998, 2001, 2007, 2008 Red Hat, Inc. Alpha Foreign Function Interface @@ -178,6 +179,9 @@ { unsigned int *tramp; + if (cif->abi != FFI_OSF) + return FFI_BAD_ABI; + tramp = (unsigned int *) &closure->tramp[0]; tramp[0] = 0x47fb0401; /* mov $27,$1 */ tramp[1] = 0xa77b0010; /* ldq $27,16($27) */ diff --git a/Modules/_ctypes/libffi/src/alpha/ffitarget.h b/Modules/_ctypes/libffi/src/alpha/ffitarget.h --- a/Modules/_ctypes/libffi/src/alpha/ffitarget.h +++ b/Modules/_ctypes/libffi/src/alpha/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for Alpha. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; diff --git a/Modules/_ctypes/libffi/src/alpha/osf.S b/Modules/_ctypes/libffi/src/alpha/osf.S --- a/Modules/_ctypes/libffi/src/alpha/osf.S +++ b/Modules/_ctypes/libffi/src/alpha/osf.S @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - osf.S - Copyright (c) 1998, 2001, 2007, 2008 Red Hat + osf.S - Copyright (c) 1998, 2001, 2007, 2008, 2011 Red Hat Alpha/OSF Foreign Function Interface @@ -299,33 +299,51 @@ #endif #ifdef __ELF__ +# define UA_SI .4byte +# define FDE_ENCODING 0x1b /* pcrel sdata4 */ +# define FDE_ENCODE(X) .4byte X-. +# define FDE_ARANGE(X) .4byte X +#elif defined __osf__ +# define UA_SI .align 0; .long +# define FDE_ENCODING 0x50 /* aligned absolute */ +# define FDE_ENCODE(X) .align 3; .quad X +# define FDE_ARANGE(X) .align 0; .quad X +#endif + +#ifdef __ELF__ .section .eh_frame,EH_FRAME_FLAGS, at progbits +#elif defined __osf__ + .data + .align 3 + .globl _GLOBAL__F_ffi_call_osf +_GLOBAL__F_ffi_call_osf: +#endif __FRAME_BEGIN__: - .4byte $LECIE1-$LSCIE1 # Length of Common Information Entry + UA_SI $LECIE1-$LSCIE1 # Length of Common Information Entry $LSCIE1: - .4byte 0x0 # CIE Identifier Tag + UA_SI 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .byte 0x1 # uleb128 0x1; CIE Code Alignment Factor .byte 0x78 # sleb128 -8; CIE Data Alignment Factor .byte 26 # CIE RA Column .byte 0x1 # uleb128 0x1; Augmentation size - .byte 0x1b # FDE Encoding (pcrel sdata4) + .byte FDE_ENCODING # FDE Encoding .byte 0xc # DW_CFA_def_cfa .byte 30 # uleb128 column 30 .byte 0 # uleb128 offset 0 .align 3 $LECIE1: $LSFDE1: - .4byte $LEFDE1-$LASFDE1 # FDE Length + UA_SI $LEFDE1-$LASFDE1 # FDE Length $LASFDE1: - .4byte $LASFDE1-__FRAME_BEGIN__ # FDE CIE offset - .4byte $LFB1-. # FDE initial location - .4byte $LFE1-$LFB1 # FDE address range + UA_SI $LASFDE1-__FRAME_BEGIN__ # FDE CIE offset + FDE_ENCODE($LFB1) # FDE initial location + FDE_ARANGE($LFE1-$LFB1) # FDE address range .byte 0x0 # uleb128 0x0; Augmentation size .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI1-$LFB1 + UA_SI $LCFI1-$LFB1 .byte 0x9a # DW_CFA_offset, column 26 .byte 4 # uleb128 4*-8 .byte 0x8f # DW_CFA_offset, column 15 @@ -335,32 +353,35 @@ .byte 32 # uleb128 offset 32 .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI2-$LCFI1 + UA_SI $LCFI2-$LCFI1 .byte 0xda # DW_CFA_restore, column 26 .align 3 $LEFDE1: $LSFDE3: - .4byte $LEFDE3-$LASFDE3 # FDE Length + UA_SI $LEFDE3-$LASFDE3 # FDE Length $LASFDE3: - .4byte $LASFDE3-__FRAME_BEGIN__ # FDE CIE offset - .4byte $LFB2-. # FDE initial location - .4byte $LFE2-$LFB2 # FDE address range + UA_SI $LASFDE3-__FRAME_BEGIN__ # FDE CIE offset + FDE_ENCODE($LFB2) # FDE initial location + FDE_ARANGE($LFE2-$LFB2) # FDE address range .byte 0x0 # uleb128 0x0; Augmentation size .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI5-$LFB2 + UA_SI $LCFI5-$LFB2 .byte 0xe # DW_CFA_def_cfa_offset .byte 0x80,0x1 # uleb128 128 .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI6-$LCFI5 + UA_SI $LCFI6-$LCFI5 .byte 0x9a # DW_CFA_offset, column 26 .byte 16 # uleb128 offset 16*-8 .align 3 $LEFDE3: +#if defined __osf__ + .align 0 + .long 0 # End of Table +#endif -#ifdef __linux__ +#if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"", at progbits #endif -#endif diff --git a/Modules/_ctypes/libffi/src/arm/ffi.c b/Modules/_ctypes/libffi/src/arm/ffi.c --- a/Modules/_ctypes/libffi/src/arm/ffi.c +++ b/Modules/_ctypes/libffi/src/arm/ffi.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998, 2008 Red Hat, Inc. - + ffi.c - Copyright (c) 2011 Timothy Wall + Copyright (c) 2011 Plausible Labs Cooperative, Inc. + Copyright (c) 2011 Anthony Green + Copyright (c) 2011 Free Software Foundation + Copyright (c) 1998, 2008, 2011 Red Hat, Inc. + ARM Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining @@ -29,12 +33,20 @@ #include +/* Forward declares. */ +static int vfp_type_p (ffi_type *); +static void layout_vfp_args (ffi_cif *); + /* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments */ - -void ffi_prep_args(char *stack, extended_cif *ecif) + has been allocated for the function's arguments + + The vfp_space parameter is the load area for VFP regs, the return + value is cif->vfp_used (word bitset of VFP regs used for passing + arguments). These are only used for the VFP hard-float ABI. +*/ +int ffi_prep_args(char *stack, extended_cif *ecif, float *vfp_space) { - register unsigned int i; + register unsigned int i, vi = 0; register void **p_argv; register char *argp; register ffi_type **p_arg; @@ -53,10 +65,31 @@ i--, p_arg++) { size_t z; + size_t alignment; + + /* Allocated in VFP registers. */ + if (ecif->cif->abi == FFI_VFP + && vi < ecif->cif->vfp_nargs && vfp_type_p (*p_arg)) + { + float* vfp_slot = vfp_space + ecif->cif->vfp_args[vi++]; + if ((*p_arg)->type == FFI_TYPE_FLOAT) + *((float*)vfp_slot) = *((float*)*p_argv); + else if ((*p_arg)->type == FFI_TYPE_DOUBLE) + *((double*)vfp_slot) = *((double*)*p_argv); + else + memcpy(vfp_slot, *p_argv, (*p_arg)->size); + p_argv++; + continue; + } /* Align if necessary */ - if (((*p_arg)->alignment - 1) & (unsigned) argp) { - argp = (char *) ALIGN(argp, (*p_arg)->alignment); + alignment = (*p_arg)->alignment; +#ifdef _WIN32_WCE + if (alignment > 4) + alignment = 4; +#endif + if ((alignment - 1) & (unsigned) argp) { + argp = (char *) ALIGN(argp, alignment); } if ((*p_arg)->type == FFI_TYPE_STRUCT) @@ -103,13 +136,15 @@ p_argv++; argp += z; } - - return; + + /* Indicate the VFP registers used. */ + return ecif->cif->vfp_used; } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { + int type_code; /* Round the stack up to a multiple of 8 bytes. This isn't needed everywhere, but it is on some platforms, and it doesn't harm anything when it isn't needed. */ @@ -130,7 +165,14 @@ break; case FFI_TYPE_STRUCT: - if (cif->rtype->size <= 4) + if (cif->abi == FFI_VFP + && (type_code = vfp_type_p (cif->rtype)) != 0) + { + /* A Composite Type passed in VFP registers, either + FFI_TYPE_STRUCT_VFP_FLOAT or FFI_TYPE_STRUCT_VFP_DOUBLE. */ + cif->flags = (unsigned) type_code; + } + else if (cif->rtype->size <= 4) /* A Composite Type not larger than 4 bytes is returned in r0. */ cif->flags = (unsigned)FFI_TYPE_INT; else @@ -145,11 +187,30 @@ break; } + /* Map out the register placements of VFP register args. + The VFP hard-float calling conventions are slightly more sophisticated than + the base calling conventions, so we do it here instead of in ffi_prep_args(). */ + if (cif->abi == FFI_VFP) + layout_vfp_args (cif); + return FFI_OK; } -extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, - unsigned, unsigned, unsigned *, void (*fn)(void)); +/* Perform machine dependent cif processing for variadic calls */ +ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif, + unsigned int nfixedargs, + unsigned int ntotalargs) +{ + /* VFP variadic calls actually use the SYSV ABI */ + if (cif->abi == FFI_VFP) + cif->abi = FFI_SYSV; + + return ffi_prep_cif_machdep(cif); +} + +/* Prototypes for assembly functions, in sysv.S */ +extern void ffi_call_SYSV (void (*fn)(void), extended_cif *, unsigned, unsigned, unsigned *); +extern void ffi_call_VFP (void (*fn)(void), extended_cif *, unsigned, unsigned, unsigned *); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { @@ -157,6 +218,8 @@ int small_struct = (cif->flags == FFI_TYPE_INT && cif->rtype->type == FFI_TYPE_STRUCT); + int vfp_struct = (cif->flags == FFI_TYPE_STRUCT_VFP_FLOAT + || cif->flags == FFI_TYPE_STRUCT_VFP_DOUBLE); ecif.cif = cif; ecif.avalue = avalue; @@ -173,38 +236,53 @@ } else if (small_struct) ecif.rvalue = &temp; + else if (vfp_struct) + { + /* Largest case is double x 4. */ + ecif.rvalue = alloca(32); + } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: - ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, - fn); + ffi_call_SYSV (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); + break; + case FFI_VFP: +#ifdef __ARM_EABI__ + ffi_call_VFP (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); break; +#endif + default: FFI_ASSERT(0); break; } if (small_struct) memcpy (rvalue, &temp, cif->rtype->size); + else if (vfp_struct) + memcpy (rvalue, ecif.rvalue, cif->rtype->size); } /** private members **/ static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, - void** args, ffi_cif* cif); + void** args, ffi_cif* cif, float *vfp_stack); void ffi_closure_SYSV (ffi_closure *); +void ffi_closure_VFP (ffi_closure *); + /* This function is jumped to by the trampoline */ unsigned int -ffi_closure_SYSV_inner (closure, respp, args) +ffi_closure_SYSV_inner (closure, respp, args, vfp_args) ffi_closure *closure; void **respp; void *args; + void *vfp_args; { // our various things... ffi_cif *cif; @@ -219,7 +297,7 @@ * a structure, it will re-set RESP to point to the * structure return address. */ - ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif, vfp_args); (closure->fun) (cif, *respp, arg_area, closure->user_data); @@ -229,10 +307,12 @@ /*@-exportheader@*/ static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, - void **avalue, ffi_cif *cif) + void **avalue, ffi_cif *cif, + /* Used only under VFP hard-float ABI. */ + float *vfp_stack) /*@=exportheader@*/ { - register unsigned int i; + register unsigned int i, vi = 0; register void **p_argv; register char *argp; register ffi_type **p_arg; @@ -249,10 +329,23 @@ for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { size_t z; + size_t alignment; + + if (cif->abi == FFI_VFP + && vi < cif->vfp_nargs && vfp_type_p (*p_arg)) + { + *p_argv++ = (void*)(vfp_stack + cif->vfp_args[vi++]); + continue; + } - size_t alignment = (*p_arg)->alignment; + alignment = (*p_arg)->alignment; if (alignment < 4) alignment = 4; +#ifdef _WIN32_WCE + else + if (alignment > 4) + alignment = 4; +#endif /* Align if necessary */ if ((alignment - 1) & (unsigned) argp) { argp = (char *) ALIGN(argp, alignment); @@ -273,18 +366,237 @@ /* How to make a trampoline. */ +extern unsigned int ffi_arm_trampoline[3]; + +#if FFI_EXEC_TRAMPOLINE_TABLE + +#include +#include +#include +#include + +extern void *ffi_closure_trampoline_table_page; + +typedef struct ffi_trampoline_table ffi_trampoline_table; +typedef struct ffi_trampoline_table_entry ffi_trampoline_table_entry; + +struct ffi_trampoline_table { + /* contigious writable and executable pages */ + vm_address_t config_page; + vm_address_t trampoline_page; + + /* free list tracking */ + uint16_t free_count; + ffi_trampoline_table_entry *free_list; + ffi_trampoline_table_entry *free_list_pool; + + ffi_trampoline_table *prev; + ffi_trampoline_table *next; +}; + +struct ffi_trampoline_table_entry { + void *(*trampoline)(); + ffi_trampoline_table_entry *next; +}; + +/* Override the standard architecture trampoline size */ +// XXX TODO - Fix +#undef FFI_TRAMPOLINE_SIZE +#define FFI_TRAMPOLINE_SIZE 12 + +/* The trampoline configuration is placed at 4080 bytes prior to the trampoline's entry point */ +#define FFI_TRAMPOLINE_CODELOC_CONFIG(codeloc) ((void **) (((uint8_t *) codeloc) - 4080)); + +/* The first 16 bytes of the config page are unused, as they are unaddressable from the trampoline page. */ +#define FFI_TRAMPOLINE_CONFIG_PAGE_OFFSET 16 + +/* Total number of trampolines that fit in one trampoline table */ +#define FFI_TRAMPOLINE_COUNT ((PAGE_SIZE - FFI_TRAMPOLINE_CONFIG_PAGE_OFFSET) / FFI_TRAMPOLINE_SIZE) + +static pthread_mutex_t ffi_trampoline_lock = PTHREAD_MUTEX_INITIALIZER; +static ffi_trampoline_table *ffi_trampoline_tables = NULL; + +static ffi_trampoline_table * +ffi_trampoline_table_alloc () +{ + ffi_trampoline_table *table = NULL; + + /* Loop until we can allocate two contigious pages */ + while (table == NULL) { + vm_address_t config_page = 0x0; + kern_return_t kt; + + /* Try to allocate two pages */ + kt = vm_allocate (mach_task_self (), &config_page, PAGE_SIZE*2, VM_FLAGS_ANYWHERE); + if (kt != KERN_SUCCESS) { + fprintf(stderr, "vm_allocate() failure: %d at %s:%d\n", kt, __FILE__, __LINE__); + break; + } + + /* Now drop the second half of the allocation to make room for the trampoline table */ + vm_address_t trampoline_page = config_page+PAGE_SIZE; + kt = vm_deallocate (mach_task_self (), trampoline_page, PAGE_SIZE); + if (kt != KERN_SUCCESS) { + fprintf(stderr, "vm_deallocate() failure: %d at %s:%d\n", kt, __FILE__, __LINE__); + break; + } + + /* Remap the trampoline table to directly follow the config page */ + vm_prot_t cur_prot; + vm_prot_t max_prot; + + kt = vm_remap (mach_task_self (), &trampoline_page, PAGE_SIZE, 0x0, FALSE, mach_task_self (), (vm_address_t) &ffi_closure_trampoline_table_page, FALSE, &cur_prot, &max_prot, VM_INHERIT_SHARE); + + /* If we lost access to the destination trampoline page, drop our config allocation mapping and retry */ + if (kt != KERN_SUCCESS) { + /* Log unexpected failures */ + if (kt != KERN_NO_SPACE) { + fprintf(stderr, "vm_remap() failure: %d at %s:%d\n", kt, __FILE__, __LINE__); + } + + vm_deallocate (mach_task_self (), config_page, PAGE_SIZE); + continue; + } + + /* We have valid trampoline and config pages */ + table = calloc (1, sizeof(ffi_trampoline_table)); + table->free_count = FFI_TRAMPOLINE_COUNT; + table->config_page = config_page; + table->trampoline_page = trampoline_page; + + /* Create and initialize the free list */ + table->free_list_pool = calloc(FFI_TRAMPOLINE_COUNT, sizeof(ffi_trampoline_table_entry)); + + uint16_t i; + for (i = 0; i < table->free_count; i++) { + ffi_trampoline_table_entry *entry = &table->free_list_pool[i]; + entry->trampoline = (void *) (table->trampoline_page + (i * FFI_TRAMPOLINE_SIZE)); + + if (i < table->free_count - 1) + entry->next = &table->free_list_pool[i+1]; + } + + table->free_list = table->free_list_pool; + } + + return table; +} + +void * +ffi_closure_alloc (size_t size, void **code) +{ + /* Create the closure */ + ffi_closure *closure = malloc(size); + if (closure == NULL) + return NULL; + + pthread_mutex_lock(&ffi_trampoline_lock); + + /* Check for an active trampoline table with available entries. */ + ffi_trampoline_table *table = ffi_trampoline_tables; + if (table == NULL || table->free_list == NULL) { + table = ffi_trampoline_table_alloc (); + if (table == NULL) { + free(closure); + return NULL; + } + + /* Insert the new table at the top of the list */ + table->next = ffi_trampoline_tables; + if (table->next != NULL) + table->next->prev = table; + + ffi_trampoline_tables = table; + } + + /* Claim the free entry */ + ffi_trampoline_table_entry *entry = ffi_trampoline_tables->free_list; + ffi_trampoline_tables->free_list = entry->next; + ffi_trampoline_tables->free_count--; + entry->next = NULL; + + pthread_mutex_unlock(&ffi_trampoline_lock); + + /* Initialize the return values */ + *code = entry->trampoline; + closure->trampoline_table = table; + closure->trampoline_table_entry = entry; + + return closure; +} + +void +ffi_closure_free (void *ptr) +{ + ffi_closure *closure = ptr; + + pthread_mutex_lock(&ffi_trampoline_lock); + + /* Fetch the table and entry references */ + ffi_trampoline_table *table = closure->trampoline_table; + ffi_trampoline_table_entry *entry = closure->trampoline_table_entry; + + /* Return the entry to the free list */ + entry->next = table->free_list; + table->free_list = entry; + table->free_count++; + + /* If all trampolines within this table are free, and at least one other table exists, deallocate + * the table */ + if (table->free_count == FFI_TRAMPOLINE_COUNT && ffi_trampoline_tables != table) { + /* Remove from the list */ + if (table->prev != NULL) + table->prev->next = table->next; + + if (table->next != NULL) + table->next->prev = table->prev; + + /* Deallocate pages */ + kern_return_t kt; + kt = vm_deallocate (mach_task_self (), table->config_page, PAGE_SIZE); + if (kt != KERN_SUCCESS) + fprintf(stderr, "vm_deallocate() failure: %d at %s:%d\n", kt, __FILE__, __LINE__); + + kt = vm_deallocate (mach_task_self (), table->trampoline_page, PAGE_SIZE); + if (kt != KERN_SUCCESS) + fprintf(stderr, "vm_deallocate() failure: %d at %s:%d\n", kt, __FILE__, __LINE__); + + /* Deallocate free list */ + free (table->free_list_pool); + free (table); + } else if (ffi_trampoline_tables != table) { + /* Otherwise, bump this table to the top of the list */ + table->prev = NULL; + table->next = ffi_trampoline_tables; + if (ffi_trampoline_tables != NULL) + ffi_trampoline_tables->prev = table; + + ffi_trampoline_tables = table; + } + + pthread_mutex_unlock (&ffi_trampoline_lock); + + /* Free the closure */ + free (closure); +} + +#else + #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ ({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ unsigned int __fun = (unsigned int)(FUN); \ unsigned int __ctx = (unsigned int)(CTX); \ - *(unsigned int*) &__tramp[0] = 0xe92d000f; /* stmfd sp!, {r0-r3} */ \ - *(unsigned int*) &__tramp[4] = 0xe59f0000; /* ldr r0, [pc] */ \ - *(unsigned int*) &__tramp[8] = 0xe59ff000; /* ldr pc, [pc] */ \ + unsigned char *insns = (unsigned char *)(CTX); \ + memcpy (__tramp, ffi_arm_trampoline, sizeof ffi_arm_trampoline); \ *(unsigned int*) &__tramp[12] = __ctx; \ *(unsigned int*) &__tramp[16] = __fun; \ - __clear_cache((&__tramp[0]), (&__tramp[19])); \ + __clear_cache((&__tramp[0]), (&__tramp[19])); /* Clear data mapping. */ \ + __clear_cache(insns, insns + 3 * sizeof (unsigned int)); \ + /* Clear instruction \ + mapping. */ \ }) +#endif /* the cif must already be prep'ed */ @@ -295,15 +607,150 @@ void *user_data, void *codeloc) { - FFI_ASSERT (cif->abi == FFI_SYSV); + void (*closure_func)(ffi_closure*) = NULL; + if (cif->abi == FFI_SYSV) + closure_func = &ffi_closure_SYSV; +#ifdef __ARM_EABI__ + else if (cif->abi == FFI_VFP) + closure_func = &ffi_closure_VFP; +#endif + else + return FFI_BAD_ABI; + +#if FFI_EXEC_TRAMPOLINE_TABLE + void **config = FFI_TRAMPOLINE_CODELOC_CONFIG(codeloc); + config[0] = closure; + config[1] = closure_func; +#else FFI_INIT_TRAMPOLINE (&closure->tramp[0], \ - &ffi_closure_SYSV, \ + closure_func, \ codeloc); - +#endif + closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } + +/* Below are routines for VFP hard-float support. */ + +static int rec_vfp_type_p (ffi_type *t, int *elt, int *elnum) +{ + switch (t->type) + { + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + *elt = (int) t->type; + *elnum = 1; + return 1; + + case FFI_TYPE_STRUCT_VFP_FLOAT: + *elt = FFI_TYPE_FLOAT; + *elnum = t->size / sizeof (float); + return 1; + + case FFI_TYPE_STRUCT_VFP_DOUBLE: + *elt = FFI_TYPE_DOUBLE; + *elnum = t->size / sizeof (double); + return 1; + + case FFI_TYPE_STRUCT:; + { + int base_elt = 0, total_elnum = 0; + ffi_type **el = t->elements; + while (*el) + { + int el_elt = 0, el_elnum = 0; + if (! rec_vfp_type_p (*el, &el_elt, &el_elnum) + || (base_elt && base_elt != el_elt) + || total_elnum + el_elnum > 4) + return 0; + base_elt = el_elt; + total_elnum += el_elnum; + el++; + } + *elnum = total_elnum; + *elt = base_elt; + return 1; + } + default: ; + } + return 0; +} + +static int vfp_type_p (ffi_type *t) +{ + int elt, elnum; + if (rec_vfp_type_p (t, &elt, &elnum)) + { + if (t->type == FFI_TYPE_STRUCT) + { + if (elnum == 1) + t->type = elt; + else + t->type = (elt == FFI_TYPE_FLOAT + ? FFI_TYPE_STRUCT_VFP_FLOAT + : FFI_TYPE_STRUCT_VFP_DOUBLE); + } + return (int) t->type; + } + return 0; +} + +static void place_vfp_arg (ffi_cif *cif, ffi_type *t) +{ + int reg = cif->vfp_reg_free; + int nregs = t->size / sizeof (float); + int align = ((t->type == FFI_TYPE_STRUCT_VFP_FLOAT + || t->type == FFI_TYPE_FLOAT) ? 1 : 2); + /* Align register number. */ + if ((reg & 1) && align == 2) + reg++; + while (reg + nregs <= 16) + { + int s, new_used = 0; + for (s = reg; s < reg + nregs; s++) + { + new_used |= (1 << s); + if (cif->vfp_used & (1 << s)) + { + reg += align; + goto next_reg; + } + } + /* Found regs to allocate. */ + cif->vfp_used |= new_used; + cif->vfp_args[cif->vfp_nargs++] = reg; + + /* Update vfp_reg_free. */ + if (cif->vfp_used & (1 << cif->vfp_reg_free)) + { + reg += nregs; + while (cif->vfp_used & (1 << reg)) + reg += 1; + cif->vfp_reg_free = reg; + } + return; + next_reg: ; + } +} + +static void layout_vfp_args (ffi_cif *cif) +{ + int i; + /* Init VFP fields */ + cif->vfp_used = 0; + cif->vfp_nargs = 0; + cif->vfp_reg_free = 0; + memset (cif->vfp_args, -1, 16); /* Init to -1. */ + + for (i = 0; i < cif->nargs; i++) + { + ffi_type *t = cif->arg_types[i]; + if (vfp_type_p (t)) + place_vfp_arg (cif, t); + } +} diff --git a/Modules/_ctypes/libffi/src/arm/ffitarget.h b/Modules/_ctypes/libffi/src/arm/ffitarget.h --- a/Modules/_ctypes/libffi/src/arm/ffitarget.h +++ b/Modules/_ctypes/libffi/src/arm/ffitarget.h @@ -1,5 +1,8 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 2010 CodeSourcery + Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for ARM. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +30,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; @@ -34,11 +41,27 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, + FFI_VFP, + FFI_LAST_ABI, +#ifdef __ARM_PCS_VFP + FFI_DEFAULT_ABI = FFI_VFP, +#else FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 +#endif } ffi_abi; #endif +#define FFI_EXTRA_CIF_FIELDS \ + int vfp_used; \ + short vfp_reg_free, vfp_nargs; \ + signed char vfp_args[16] \ + +/* Internally used. */ +#define FFI_TYPE_STRUCT_VFP_FLOAT (FFI_TYPE_LAST + 1) +#define FFI_TYPE_STRUCT_VFP_DOUBLE (FFI_TYPE_LAST + 2) + +#define FFI_TARGET_SPECIFIC_VARIADIC + /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 @@ -46,4 +69,3 @@ #define FFI_NATIVE_RAW_API 0 #endif - diff --git a/Modules/_ctypes/libffi/src/arm/gentramp.sh b/Modules/_ctypes/libffi/src/arm/gentramp.sh new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/arm/gentramp.sh @@ -0,0 +1,118 @@ +#!/bin/sh + +# ----------------------------------------------------------------------- +# gentramp.sh - Copyright (c) 2010, Plausible Labs Cooperative, Inc. +# +# ARM Trampoline Page Generator +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# ``Software''), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# ----------------------------------------------------------------------- + +PROGNAME=$0 + +# Each trampoline is exactly 3 instructions, or 12 bytes. If any of these values change, +# the entire arm trampoline implementation must be updated to match, too. + +# Size of an individual trampoline, in bytes +TRAMPOLINE_SIZE=12 + +# Page size, in bytes +PAGE_SIZE=4096 + +# Compute the size of the reachable config page; The first 16 bytes of the config page +# are unreachable due to our maximum pc-relative ldr offset. +PAGE_AVAIL=`expr $PAGE_SIZE - 16` + +# Compute the number of of available trampolines. +TRAMPOLINE_COUNT=`expr $PAGE_AVAIL / $TRAMPOLINE_SIZE` + +header () { + echo "# GENERATED CODE - DO NOT EDIT" + echo "# This file was generated by $PROGNAME" + echo "" + + # Write out the license header +cat << EOF +# Copyright (c) 2010, Plausible Labs Cooperative, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# ``Software''), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# ----------------------------------------------------------------------- + +EOF + + # Write out the trampoline table, aligned to the page boundary + echo ".text" + echo ".align 12" + echo ".globl _ffi_closure_trampoline_table_page" + echo "_ffi_closure_trampoline_table_page:" +} + + +# WARNING - Don't modify the trampoline code size without also updating the relevent libffi code +trampoline () { + cat << END + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + +END +} + +main () { + # Write out the header + header + + # Write out the trampolines + local i=0 + while [ $i -lt ${TRAMPOLINE_COUNT} ]; do + trampoline + local i=`expr $i + 1` + done +} + +main diff --git a/Modules/_ctypes/libffi/src/arm/sysv.S b/Modules/_ctypes/libffi/src/arm/sysv.S --- a/Modules/_ctypes/libffi/src/arm/sysv.S +++ b/Modules/_ctypes/libffi/src/arm/sysv.S @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 1998, 2008 Red Hat, Inc. + sysv.S - Copyright (c) 1998, 2008, 2011 Red Hat, Inc. + Copyright (c) 2011 Plausible Labs Cooperative, Inc. ARM Foreign Function Interface @@ -39,7 +40,11 @@ #else #define CNAME(x) x #endif +#ifdef __APPLE__ +#define ENTRY(x) .globl _##x; _##x: +#else #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): +#endif /* __APPLE__ */ #endif #ifdef __ELF__ @@ -48,6 +53,12 @@ #define LSYM(x) x #endif +/* Use the SOFTFP return value ABI on Mac OS X, as per the iOS ABI + Function Call Guide */ +#ifdef __APPLE__ +#define __SOFTFP__ +#endif + /* We need a better way of testing for this, but for now, this is all we can do. */ @ This selects the minimum architecture level required. @@ -105,21 +116,33 @@ .align 0 .thumb .thumb_func +#ifdef __APPLE__ + ENTRY($0) +#else ENTRY(\name) +#endif bx pc nop .arm UNWIND .fnstart /* A hook to tell gdb that we've switched to ARM mode. Also used to call directly from other local arm routines. */ -_L__\name: +#ifdef __APPLE__ +_L__$0: +#else +_L__\name: +#endif .endm #else .macro ARM_FUNC_START name .text .align 0 .arm +#ifdef __APPLE__ + ENTRY($0) +#else ENTRY(\name) +#endif UNWIND .fnstart .endm #endif @@ -141,13 +164,11 @@ #endif .endm - @ r0: ffi_prep_args @ r1: &ecif @ r2: cif->bytes @ r3: fig->flags @ sp+0: ecif.rvalue - @ sp+4: fn @ This assumes we are using gas. ARM_FUNC_START ffi_call_SYSV @@ -162,24 +183,23 @@ sub sp, fp, r2 @ Place all of the ffi_prep_args in position - mov ip, r0 mov r0, sp @ r1 already set @ Call ffi_prep_args(stack, &ecif) - call_reg(ip) + bl CNAME(ffi_prep_args) @ move first 4 parameters in registers ldmia sp, {r0-r3} @ and adjust stack - ldr ip, [fp, #8] - cmp ip, #16 - movhs ip, #16 - add sp, sp, ip + sub lr, fp, sp @ cif->bytes == fp - sp + ldr ip, [fp] @ load fn() in advance + cmp lr, #16 + movhs lr, #16 + add sp, sp, lr @ call (fn) (...) - ldr ip, [fp, #28] call_reg(ip) @ Remove the space we pushed for the args @@ -224,11 +244,19 @@ #endif LSYM(Lepilogue): - RETLDM "r0-r3,fp" +#if defined (__INTERWORKING__) + ldmia sp!, {r0-r3,fp, lr} + bx lr +#else + ldmia sp!, {r0-r3,fp, pc} +#endif .ffi_call_SYSV_end: UNWIND .fnend +#ifdef __ELF__ .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) +#endif + /* unsigned int FFI_HIDDEN @@ -244,11 +272,11 @@ stmfd sp!, {ip, lr} UNWIND .save {r0, lr} add r2, sp, #8 - .pad #16 + UNWIND .pad #16 sub sp, sp, #16 str sp, [sp, #8] add r1, sp, #8 - bl ffi_closure_SYSV_inner + bl CNAME(ffi_closure_SYSV_inner) cmp r0, #FFI_TYPE_INT beq .Lretint @@ -300,7 +328,177 @@ .ffi_closure_SYSV_end: UNWIND .fnend +#ifdef __ELF__ .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) +#endif + + +/* Below are VFP hard-float ABI call and closure implementations. + Add VFP FPU directive here. This is only compiled into the library + under EABI. */ +#ifdef __ARM_EABI__ + .fpu vfp + + @ r0: fn + @ r1: &ecif + @ r2: cif->bytes + @ r3: fig->flags + @ sp+0: ecif.rvalue + +ARM_FUNC_START ffi_call_VFP + @ Save registers + stmfd sp!, {r0-r3, fp, lr} + UNWIND .save {r0-r3, fp, lr} + mov fp, sp + UNWIND .setfp fp, sp + + @ Make room for all of the new args. + sub sp, sp, r2 + + @ Make room for loading VFP args + sub sp, sp, #64 + + @ Place all of the ffi_prep_args in position + mov r0, sp + @ r1 already set + sub r2, fp, #64 @ VFP scratch space + + @ Call ffi_prep_args(stack, &ecif, vfp_space) + bl CNAME(ffi_prep_args) + + @ Load VFP register args if needed + cmp r0, #0 + beq LSYM(Lbase_args) + + @ Load only d0 if possible + cmp r0, #3 + sub ip, fp, #64 + flddle d0, [ip] + fldmiadgt ip, {d0-d7} + +LSYM(Lbase_args): + @ move first 4 parameters in registers + ldmia sp, {r0-r3} + + @ and adjust stack + sub lr, ip, sp @ cif->bytes == (fp - 64) - sp + ldr ip, [fp] @ load fn() in advance + cmp lr, #16 + movhs lr, #16 + add sp, sp, lr + + @ call (fn) (...) + call_reg(ip) + + @ Remove the space we pushed for the args + mov sp, fp + + @ Load r2 with the pointer to storage for + @ the return value + ldr r2, [sp, #24] + + @ Load r3 with the return type code + ldr r3, [sp, #12] + + @ If the return value pointer is NULL, + @ assume no return value. + cmp r2, #0 + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_INT + streq r0, [r2] + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_SINT64 + stmeqia r2, {r0, r1} + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_FLOAT + fstseq s0, [r2] + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_DOUBLE + fstdeq d0, [r2] + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_STRUCT_VFP_FLOAT + cmpne r3, #FFI_TYPE_STRUCT_VFP_DOUBLE + fstmiadeq r2, {d0-d3} + +LSYM(Lepilogue_vfp): + RETLDM "r0-r3,fp" + +.ffi_call_VFP_end: + UNWIND .fnend + .size CNAME(ffi_call_VFP),.ffi_call_VFP_end-CNAME(ffi_call_VFP) + + +ARM_FUNC_START ffi_closure_VFP + fstmfdd sp!, {d0-d7} + @ r0-r3, then d0-d7 + UNWIND .pad #80 + add ip, sp, #80 + stmfd sp!, {ip, lr} + UNWIND .save {r0, lr} + add r2, sp, #72 + add r3, sp, #8 + UNWIND .pad #72 + sub sp, sp, #72 + str sp, [sp, #64] + add r1, sp, #64 + bl CNAME(ffi_closure_SYSV_inner) + + cmp r0, #FFI_TYPE_INT + beq .Lretint_vfp + + cmp r0, #FFI_TYPE_FLOAT + beq .Lretfloat_vfp + + cmp r0, #FFI_TYPE_DOUBLE + cmpne r0, #FFI_TYPE_LONGDOUBLE + beq .Lretdouble_vfp + + cmp r0, #FFI_TYPE_SINT64 + beq .Lretlonglong_vfp + + cmp r0, #FFI_TYPE_STRUCT_VFP_FLOAT + beq .Lretfloat_struct_vfp + + cmp r0, #FFI_TYPE_STRUCT_VFP_DOUBLE + beq .Lretdouble_struct_vfp + +.Lclosure_epilogue_vfp: + add sp, sp, #72 + ldmfd sp, {sp, pc} + +.Lretfloat_vfp: + flds s0, [sp] + b .Lclosure_epilogue_vfp +.Lretdouble_vfp: + fldd d0, [sp] + b .Lclosure_epilogue_vfp +.Lretint_vfp: + ldr r0, [sp] + b .Lclosure_epilogue_vfp +.Lretlonglong_vfp: + ldmia sp, {r0, r1} + b .Lclosure_epilogue_vfp +.Lretfloat_struct_vfp: + fldmiad sp, {d0-d1} + b .Lclosure_epilogue_vfp +.Lretdouble_struct_vfp: + fldmiad sp, {d0-d3} + b .Lclosure_epilogue_vfp + +.ffi_closure_VFP_end: + UNWIND .fnend + .size CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP) +#endif + +ENTRY(ffi_arm_trampoline) + stmfd sp!, {r0-r3} + ldr r0, [pc] + ldr pc, [pc] #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",%progbits diff --git a/Modules/_ctypes/libffi/src/arm/trampoline.S b/Modules/_ctypes/libffi/src/arm/trampoline.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/arm/trampoline.S @@ -0,0 +1,4450 @@ +# GENERATED CODE - DO NOT EDIT +# This file was generated by src/arm/gentramp.sh + +# Copyright (c) 2010, Plausible Labs Cooperative, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# Software''), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED AS IS'', WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# ----------------------------------------------------------------------- + +.text +.align 12 +.globl _ffi_closure_trampoline_table_page +_ffi_closure_trampoline_table_page: + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + diff --git a/Modules/_ctypes/libffi/src/avr32/ffi.c b/Modules/_ctypes/libffi/src/avr32/ffi.c --- a/Modules/_ctypes/libffi/src/avr32/ffi.c +++ b/Modules/_ctypes/libffi/src/avr32/ffi.c @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2009 Bradley Smith + ffi.c - Copyright (c) 2011 Anthony Green + Copyright (c) 2009 Bradley Smith AVR32 Foreign Function Interface @@ -394,7 +395,8 @@ void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { - FFI_ASSERT(cif->abi == FFI_SYSV); + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; unsigned char *__tramp = (unsigned char*)(&closure->tramp[0]); unsigned int __fun = (unsigned int)(&ffi_closure_SYSV); diff --git a/Modules/_ctypes/libffi/src/avr32/ffitarget.h b/Modules/_ctypes/libffi/src/avr32/ffitarget.h --- a/Modules/_ctypes/libffi/src/avr32/ffitarget.h +++ b/Modules/_ctypes/libffi/src/avr32/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2009 Bradley Smith + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 2009 Bradley Smith Target configuration macros for AVR32. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; @@ -34,8 +39,8 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/bfin/ffi.c b/Modules/_ctypes/libffi/src/bfin/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/bfin/ffi.c @@ -0,0 +1,195 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2012 Alexandre K. I. de Mendonca + + Blackfin Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ +#include +#include + +#include +#include + +/* Maximum number of GPRs available for argument passing. */ +#define MAX_GPRARGS 3 + +/* + * Return types + */ +#define FFIBFIN_RET_VOID 0 +#define FFIBFIN_RET_BYTE 1 +#define FFIBFIN_RET_HALFWORD 2 +#define FFIBFIN_RET_INT64 3 +#define FFIBFIN_RET_INT32 4 + +/*====================================================================*/ +/* PROTOTYPE * + /*====================================================================*/ +void ffi_prep_args(unsigned char *, extended_cif *); + +/*====================================================================*/ +/* Externals */ +/* (Assembly) */ +/*====================================================================*/ + +extern void ffi_call_SYSV(unsigned, extended_cif *, void(*)(unsigned char *, extended_cif *), unsigned, void *, void(*fn)(void)); + +/*====================================================================*/ +/* Implementation */ +/* */ +/*====================================================================*/ + + +/* + * This function calculates the return type (size) based on type. + */ + +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + /* --------------------------------------* + * Return handling * + * --------------------------------------*/ + switch (cif->rtype->type) { + case FFI_TYPE_VOID: + cif->flags = FFIBFIN_RET_VOID; + break; + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + cif->flags = FFIBFIN_RET_HALFWORD; + break; + case FFI_TYPE_UINT8: + cif->flags = FFIBFIN_RET_BYTE; + break; + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_FLOAT: + case FFI_TYPE_POINTER: + case FFI_TYPE_SINT8: + cif->flags = FFIBFIN_RET_INT32; + break; + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_DOUBLE: + cif->flags = FFIBFIN_RET_INT64; + break; + case FFI_TYPE_STRUCT: + if (cif->rtype->size <= 4){ + cif->flags = FFIBFIN_RET_INT32; + }else if (cif->rtype->size == 8){ + cif->flags = FFIBFIN_RET_INT64; + }else{ + //it will return via a hidden pointer in P0 + cif->flags = FFIBFIN_RET_VOID; + } + break; + default: + FFI_ASSERT(0); + break; + } + return FFI_OK; +} + +/* + * This will prepare the arguments and will call the assembly routine + * cif = the call interface + * fn = the function to be called + * rvalue = the return value + * avalue = the arguments + */ +void ffi_call(ffi_cif *cif, void(*fn)(void), void *rvalue, void **avalue) +{ + int ret_type = cif->flags; + extended_cif ecif; + ecif.cif = cif; + ecif.avalue = avalue; + ecif.rvalue = rvalue; + + switch (cif->abi) { + case FFI_SYSV: + ffi_call_SYSV(cif->bytes, &ecif, ffi_prep_args, ret_type, ecif.rvalue, fn); + break; + default: + FFI_ASSERT(0); + break; + } +} + + +/* +* This function prepares the parameters (copies them from the ecif to the stack) +* to call the function (ffi_prep_args is called by the assembly routine in file +* sysv.S, which also calls the actual function) +*/ +void ffi_prep_args(unsigned char *stack, extended_cif *ecif) +{ + register unsigned int i = 0; + void **p_argv; + unsigned char *argp; + ffi_type **p_arg; + argp = stack; + p_argv = ecif->avalue; + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; + (i != 0); + i--, p_arg++) { + size_t z; + z = (*p_arg)->size; + if (z < sizeof(int)) { + z = sizeof(int); + switch ((*p_arg)->type) { + case FFI_TYPE_SINT8: { + signed char v = *(SINT8 *)(* p_argv); + signed int t = v; + *(signed int *) argp = t; + } + break; + case FFI_TYPE_UINT8: { + unsigned char v = *(UINT8 *)(* p_argv); + unsigned int t = v; + *(unsigned int *) argp = t; + } + break; + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int) * (SINT16 *)(* p_argv); + break; + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int) * (UINT16 *)(* p_argv); + break; + case FFI_TYPE_STRUCT: + memcpy(argp, *p_argv, (*p_arg)->size); + break; + default: + FFI_ASSERT(0); + break; + } + } else if (z == sizeof(int)) { + *(unsigned int *) argp = (unsigned int) * (UINT32 *)(* p_argv); + } else { + memcpy(argp, *p_argv, z); + } + p_argv++; + argp += z; + } +} + + + diff --git a/Modules/_ctypes/libffi/src/bfin/ffitarget.h b/Modules/_ctypes/libffi/src/bfin/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/bfin/ffitarget.h @@ -0,0 +1,43 @@ +/* ----------------------------------------------------------------------- + ffitarget.h - Copyright (c) 2012 Alexandre K. I. de Mendonca + + Blackfin Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV +} ffi_abi; +#endif + +#endif + diff --git a/Modules/_ctypes/libffi/src/bfin/sysv.S b/Modules/_ctypes/libffi/src/bfin/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/bfin/sysv.S @@ -0,0 +1,177 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2012 Alexandre K. I. de Mendonca + + Blackfin Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + +.text +.align 4 + + /* + There is a "feature" in the bfin toolchain that it puts a _ before funcion names + that's why the function here it's called _ffi_call_SYSV and not ffi_call_SYSV + */ + .global _ffi_call_SYSV; + .type _ffi_call_SYSV, STT_FUNC; + .func ffi_call_SYSV + + /* + cif->bytes = R0 (fp+8) + &ecif = R1 (fp+12) + ffi_prep_args = R2 (fp+16) + ret_type = stack (fp+20) + ecif.rvalue = stack (fp+24) + fn = stack (fp+28) + got (fp+32) + There is room for improvement here (we can use temporary registers + instead of saving the values in the memory) + REGS: + P5 => Stack pointer (function arguments) + R5 => cif->bytes + R4 => ret->type + + FP-20 = P3 + FP-16 = SP (parameters area) + FP-12 = SP (temp) + FP-08 = function return part 1 [R0] + FP-04 = function return part 2 [R1] + */ + +_ffi_call_SYSV: +.prologue: + LINK 20; + [FP-20] = P3; + [FP+8] = R0; + [FP+12] = R1; + [FP+16] = R2; + +.allocate_stack: + //alocate cif->bytes into the stack + R1 = [FP+8]; + R0 = SP; + R0 = R0 - R1; + R1 = 4; + R0 = R0 - R1; + [FP-12] = SP; + SP = R0; + [FP-16] = SP; + +.call_prep_args: + //get the addr of prep_args + P0 = [P3 + _ffi_prep_args at FUNCDESC_GOT17M4]; + P1 = [P0]; + P3 = [P0+4]; + R0 = [FP-16];//SP (parameter area) + R1 = [FP+12];//ecif + call (P1); + +.call_user_function: + //ajust SP so as to allow the user function access the parameters on the stack + SP = [FP-16]; //point to function parameters + R0 = [SP]; + R1 = [SP+4]; + R2 = [SP+8]; + //load user function address + P0 = FP; + P0 +=28; + P1 = [P0]; + P1 = [P1]; + P3 = [P0+4]; + /* + For functions returning aggregate values (struct) occupying more than 8 bytes, + the caller allocates the return value object on the stack and the address + of this object is passed to the callee as a hidden argument in register P0. + */ + P0 = [FP+24]; + + call (P1); + SP = [FP-12]; +.compute_return: + P2 = [FP-20]; + [FP-8] = R0; + [FP-4] = R1; + + R0 = [FP+20]; + R1 = R0 << 2; + + R0 = [P2+.rettable at GOT17M4]; + R0 = R1 + R0; + P2 = R0; + R1 = [P2]; + + P2 = [FP+-20]; + R0 = [P2+.rettable at GOT17M4]; + R0 = R1 + R0; + P2 = R0; + R0 = [FP-8]; + R1 = [FP-4]; + jump (P2); + +/* +#define FFIBFIN_RET_VOID 0 +#define FFIBFIN_RET_BYTE 1 +#define FFIBFIN_RET_HALFWORD 2 +#define FFIBFIN_RET_INT64 3 +#define FFIBFIN_RET_INT32 4 +*/ +.align 4 +.align 4 +.rettable: + .dd .epilogue - .rettable + .dd .rbyte - .rettable; + .dd .rhalfword - .rettable; + .dd .rint64 - .rettable; + .dd .rint32 - .rettable; + +.rbyte: + P0 = [FP+24]; + R0 = R0.B (Z); + [P0] = R0; + JUMP .epilogue +.rhalfword: + P0 = [FP+24]; + R0 = R0.L; + [P0] = R0; + JUMP .epilogue +.rint64: + P0 = [FP+24];// &rvalue + [P0] = R0; + [P0+4] = R1; + JUMP .epilogue +.rint32: + P0 = [FP+24]; + [P0] = R0; +.epilogue: + R0 = [FP+8]; + R1 = [FP+12]; + R2 = [FP+16]; + P3 = [FP-20]; + UNLINK; + RTS; + +.size _ffi_call_SYSV,.-_ffi_call_SYSV; +.endfunc diff --git a/Modules/_ctypes/libffi/src/closures.c b/Modules/_ctypes/libffi/src/closures.c --- a/Modules/_ctypes/libffi/src/closures.c +++ b/Modules/_ctypes/libffi/src/closures.c @@ -1,6 +1,7 @@ /* ----------------------------------------------------------------------- - closures.c - Copyright (c) 2007 Red Hat, Inc. - Copyright (C) 2007, 2009 Free Software Foundation, Inc + closures.c - Copyright (c) 2007, 2009, 2010 Red Hat, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc + Copyright (c) 2011 Plausible Labs Cooperative, Inc. Code to allocate and deallocate memory for closures. @@ -32,7 +33,7 @@ #include #include -#ifndef FFI_MMAP_EXEC_WRIT +#if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE # if __gnu_linux__ /* This macro indicates it may be forbidden to map anonymous memory with both write and execute permission. Code compiled when this @@ -44,7 +45,7 @@ # define FFI_MMAP_EXEC_WRIT 1 # define HAVE_MNTENT 1 # endif -# if defined(X86_WIN32) || defined(X86_WIN64) +# if defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__) /* Windows systems may have Data Execution Protection (DEP) enabled, which requires the use of VirtualMalloc/VirtualFree to alloc/free executable memory. */ @@ -63,7 +64,11 @@ #if FFI_CLOSURES -# if FFI_MMAP_EXEC_WRIT +# if FFI_EXEC_TRAMPOLINE_TABLE + +// Per-target implementation; It's unclear what can reasonable be shared between two OS/architecture implementations. + +# elif FFI_MMAP_EXEC_WRIT /* !FFI_EXEC_TRAMPOLINE_TABLE */ #define USE_LOCKS 1 #define USE_DL_PREFIX 1 @@ -146,7 +151,7 @@ p = strchr (p + 1, ' '); if (p == NULL) break; - if (strncmp (p + 1, "selinuxfs ", 10) != 0) + if (strncmp (p + 1, "selinuxfs ", 10) == 0) { free (buf); fclose (f); @@ -167,7 +172,26 @@ #endif /* !FFI_MMAP_EXEC_SELINUX */ -#elif defined (__CYGWIN__) +/* On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. */ +#ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX +#include + +static int emutramp_enabled = -1; + +static int +emutramp_enabled_check (void) +{ + if (getenv ("FFI_DISABLE_EMUTRAMP") == NULL) + return 1; + else + return 0; +} + +#define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \ + : (emutramp_enabled = emutramp_enabled_check ())) +#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */ + +#elif defined (__CYGWIN__) || defined(__INTERIX) #include @@ -176,6 +200,10 @@ #endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */ +#ifndef FFI_MMAP_EXEC_EMUTRAMP_PAX +#define is_emutramp_enabled() 0 +#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */ + /* Declare all functions defined in dlmalloc.c as static. */ static void *dlmalloc(size_t); static void dlfree(void*); @@ -193,11 +221,11 @@ static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED; static void dlmalloc_stats(void) MAYBE_UNUSED; -#if !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__) +#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) /* Use these for mmap and munmap within dlmalloc.c. */ static void *dlmmap(void *, size_t, int, int, int, off_t); static int dlmunmap(void *, size_t); -#endif /* !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__) */ +#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */ #define mmap dlmmap #define munmap dlmunmap @@ -207,7 +235,7 @@ #undef mmap #undef munmap -#if !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__) +#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) /* A mutex used to synchronize access to *exec* variables in this file. */ static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -294,7 +322,7 @@ struct mntent mnt; char buf[MAXPATHLEN * 3]; - if (getmntent_r (last_mntent, &mnt, buf, sizeof (buf))) + if (getmntent_r (last_mntent, &mnt, buf, sizeof (buf)) == NULL) return -1; if (hasmntopt (&mnt, "ro") @@ -453,6 +481,12 @@ printf ("mapping in %zi\n", length); #endif + if (execfd == -1 && is_emutramp_enabled ()) + { + ptr = mmap (start, length, prot & ~PROT_EXEC, flags, fd, offset); + return ptr; + } + if (execfd == -1 && !is_selinux_enabled ()) { ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset); @@ -522,7 +556,7 @@ } #endif -#endif /* !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__) */ +#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */ /* Allocate a chunk of memory with the given size. Returns a pointer to the writable address, and sets *CODE to the executable diff --git a/Modules/_ctypes/libffi/src/cris/ffi.c b/Modules/_ctypes/libffi/src/cris/ffi.c --- a/Modules/_ctypes/libffi/src/cris/ffi.c +++ b/Modules/_ctypes/libffi/src/cris/ffi.c @@ -153,21 +153,24 @@ return (struct_count); } -ffi_status -ffi_prep_cif (ffi_cif * cif, - ffi_abi abi, unsigned int nargs, - ffi_type * rtype, ffi_type ** atypes) +ffi_status FFI_HIDDEN +ffi_prep_cif_core (ffi_cif * cif, + ffi_abi abi, unsigned int isvariadic, + unsigned int nfixedargs, unsigned int ntotalargs, + ffi_type * rtype, ffi_type ** atypes) { unsigned bytes = 0; unsigned int i; ffi_type **ptr; FFI_ASSERT (cif != NULL); - FFI_ASSERT ((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI)); + FFI_ASSERT((!isvariadic) || (nfixedargs >= 1)); + FFI_ASSERT(nfixedargs <= ntotalargs); + FFI_ASSERT (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI); cif->abi = abi; cif->arg_types = atypes; - cif->nargs = nargs; + cif->nargs = ntotalargs; cif->rtype = rtype; cif->flags = 0; diff --git a/Modules/_ctypes/libffi/src/cris/ffitarget.h b/Modules/_ctypes/libffi/src/cris/ffitarget.h --- a/Modules/_ctypes/libffi/src/cris/ffitarget.h +++ b/Modules/_ctypes/libffi/src/cris/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for CRIS. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; @@ -34,8 +39,8 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/dlmalloc.c b/Modules/_ctypes/libffi/src/dlmalloc.c --- a/Modules/_ctypes/libffi/src/dlmalloc.c +++ b/Modules/_ctypes/libffi/src/dlmalloc.c @@ -100,7 +100,7 @@ If you don't like either of these options, you can define CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything - else. And if you are sure that your program using malloc has + else. And if if you are sure that your program using malloc has no errors or vulnerabilities, you can define INSECURE to 1, which might (or might not) provide a small performance improvement. @@ -457,13 +457,16 @@ #define LACKS_ERRNO_H #define MALLOC_FAILURE_ACTION #define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */ -#elif !defined _GNU_SOURCE -/* mremap() on Linux requires this via sys/mman.h - * See roundup issue 10309 - */ -#define _GNU_SOURCE 1 #endif /* WIN32 */ +#ifdef __OS2__ +#define INCL_DOS +#include +#define HAVE_MMAP 1 +#define HAVE_MORECORE 0 +#define LACKS_SYS_MMAN_H +#endif /* __OS2__ */ + #if defined(DARWIN) || defined(_DARWIN) /* Mac OSX docs advise not to use sbrk; it seems better to use mmap */ #ifndef HAVE_MORECORE @@ -599,7 +602,7 @@ declaration needed is the mallinfo struct that is returned (by-copy) by mallinfo(). The malloinfo struct contains a bunch of fields that are not even meaningful in this version of malloc. These fields are - instead filled by mallinfo() with other numbers that might be of + are instead filled by mallinfo() with other numbers that might be of interest. HAVE_USR_INCLUDE_MALLOC_H should be set if you have a @@ -619,6 +622,9 @@ #include "/usr/include/malloc.h" #else /* HAVE_USR_INCLUDE_MALLOC_H */ +/* HP-UX's stdlib.h redefines mallinfo unless _STRUCT_MALLINFO is defined */ +#define _STRUCT_MALLINFO + struct mallinfo { MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */ MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */ @@ -1293,7 +1299,7 @@ #define IS_MMAPPED_BIT (SIZE_T_ONE) #define USE_MMAP_BIT (SIZE_T_ONE) -#ifndef WIN32 +#if !defined(WIN32) && !defined (__OS2__) #define CALL_MUNMAP(a, s) munmap((a), (s)) #define MMAP_PROT (PROT_READ|PROT_WRITE) #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) @@ -1316,6 +1322,42 @@ #endif /* MAP_ANONYMOUS */ #define DIRECT_MMAP(s) CALL_MMAP(s) + +#elif defined(__OS2__) + +/* OS/2 MMAP via DosAllocMem */ +static void* os2mmap(size_t size) { + void* ptr; + if (DosAllocMem(&ptr, size, OBJ_ANY|PAG_COMMIT|PAG_READ|PAG_WRITE) && + DosAllocMem(&ptr, size, PAG_COMMIT|PAG_READ|PAG_WRITE)) + return MFAIL; + return ptr; +} + +#define os2direct_mmap(n) os2mmap(n) + +/* This function supports releasing coalesed segments */ +static int os2munmap(void* ptr, size_t size) { + while (size) { + ULONG ulSize = size; + ULONG ulFlags = 0; + if (DosQueryMem(ptr, &ulSize, &ulFlags) != 0) + return -1; + if ((ulFlags & PAG_BASE) == 0 ||(ulFlags & PAG_COMMIT) == 0 || + ulSize > size) + return -1; + if (DosFreeMem(ptr) != 0) + return -1; + ptr = ( void * ) ( ( char * ) ptr + ulSize ); + size -= ulSize; + } + return 0; +} + +#define CALL_MMAP(s) os2mmap(s) +#define CALL_MUNMAP(a, s) os2munmap((a), (s)) +#define DIRECT_MMAP(s) os2direct_mmap(s) + #else /* WIN32 */ /* Win32 MMAP via VirtualAlloc */ @@ -1392,7 +1434,7 @@ unique mparams values are initialized only once. */ -#ifndef WIN32 +#if !defined(WIN32) && !defined(__OS2__) /* By default use posix locks */ #include #define MLOCK_T pthread_mutex_t @@ -1406,6 +1448,16 @@ static MLOCK_T magic_init_mutex = PTHREAD_MUTEX_INITIALIZER; +#elif defined(__OS2__) +#define MLOCK_T HMTX +#define INITIAL_LOCK(l) DosCreateMutexSem(0, l, 0, FALSE) +#define ACQUIRE_LOCK(l) DosRequestMutexSem(*l, SEM_INDEFINITE_WAIT) +#define RELEASE_LOCK(l) DosReleaseMutexSem(*l) +#if HAVE_MORECORE +static MLOCK_T morecore_mutex; +#endif /* HAVE_MORECORE */ +static MLOCK_T magic_init_mutex; + #else /* WIN32 */ /* Because lock-protected regions have bounded times, and there @@ -1564,7 +1616,7 @@ Each freshly allocated chunk must have both cinuse and pinuse set. That is, each allocated chunk borders either a previously allocated and still in-use chunk, or the base of its memory arena. This is - ensured by making all allocations from the `lowest' part of any + ensured by making all allocations from the the `lowest' part of any found chunk. Further, no free chunk physically borders another one, so each free chunk is known to be preceded and followed by either inuse chunks or the ends of memory. @@ -1770,12 +1822,12 @@ of the same size are arranged in a circularly-linked list, with only the oldest chunk (the next to be used, in our FIFO ordering) actually in the tree. (Tree members are distinguished by a non-null - parent pointer.) If a chunk with the same size as an existing node + parent pointer.) If a chunk with the same size an an existing node is inserted, it is linked off the existing node using pointers that work in the same way as fd/bk pointers of small chunks. Each tree contains a power of 2 sized range of chunk sizes (the - smallest is 0x100 <= x < 0x180), which is divided in half at each + smallest is 0x100 <= x < 0x180), which is is divided in half at each tree level, with the chunks in the smaller half of the range (0x100 <= x < 0x140 for the top nose) in the left subtree and the larger half (0x140 <= x < 0x180) in the right subtree. This is, of course, @@ -2497,10 +2549,15 @@ } RELEASE_MAGIC_INIT_LOCK(); -#ifndef WIN32 +#if !defined(WIN32) && !defined(__OS2__) mparams.page_size = malloc_getpagesize; mparams.granularity = ((DEFAULT_GRANULARITY != 0)? DEFAULT_GRANULARITY : mparams.page_size); +#elif defined (__OS2__) + /* if low-memory is used, os2munmap() would break + if it were anything other than 64k */ + mparams.page_size = 4096u; + mparams.granularity = 65536u; #else /* WIN32 */ { SYSTEM_INFO system_info; @@ -3380,7 +3437,7 @@ least-preferred order): 1. A call to MORECORE that can normally contiguously extend memory. (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or - main space is mmapped or a previous contiguous call failed) + or main space is mmapped or a previous contiguous call failed) 2. A call to MMAP new space (disabled if not HAVE_MMAP). Note that under the default settings, if MORECORE is unable to fulfill a request, and HAVE_MMAP is true, then mmap is @@ -4197,7 +4254,7 @@ void dlfree(void* mem) { /* - Consolidate freed chunks with preceeding or succeeding bordering + Consolidate freed chunks with preceding or succeeding bordering free chunks, if they exist, and then place in a bin. Intermixed with special cases for top, dv, mmapped chunks, and usage errors. */ diff --git a/Modules/_ctypes/libffi/src/frv/ffitarget.h b/Modules/_ctypes/libffi/src/frv/ffitarget.h --- a/Modules/_ctypes/libffi/src/frv/ffitarget.h +++ b/Modules/_ctypes/libffi/src/frv/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2004 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2004 Red Hat, Inc. Target configuration macros for FR-V Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- System specific configurations ----------------------------------- */ #ifndef LIBFFI_ASM @@ -35,13 +40,9 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, - -#ifdef FRV FFI_EABI, - FFI_DEFAULT_ABI = FFI_EABI, -#endif - - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_EABI } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/ia64/ffi.c b/Modules/_ctypes/libffi/src/ia64/ffi.c --- a/Modules/_ctypes/libffi/src/ia64/ffi.c +++ b/Modules/_ctypes/libffi/src/ia64/ffi.c @@ -1,6 +1,7 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998, 2007, 2008 Red Hat, Inc. + ffi.c - Copyright (c) 1998, 2007, 2008, 2012 Red Hat, Inc. Copyright (c) 2000 Hewlett Packard Company + Copyright (c) 2011 Anthony Green IA64 Foreign Function Interface @@ -84,7 +85,7 @@ #define ldf_fill(result, addr) \ asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr)); -/* Return the size of the C type associated with TYPE, which will +/* Return the size of the C type associated with with TYPE. Which will be one of the FFI_IA64_TYPE_HFA_* values. */ static size_t @@ -184,7 +185,7 @@ break; case FFI_TYPE_LONGDOUBLE: - /* Similarly, except that HFA is true for double extended, + /* Similarly, except that that HFA is true for double extended, but not quad precision. Both have sizeof == 16, so tell the difference based on the precision. */ if (LDBL_MANT_DIG == 64 && nested) @@ -225,7 +226,7 @@ int flags; /* Adjust cif->bytes to include space for the bits of the ia64_args frame - that preceeds the integer register portion. The estimate that the + that precedes the integer register portion. The estimate that the generic bits did for the argument space required is good enough for the integer component. */ cif->bytes += offsetof(struct ia64_args, gp_regs[0]); @@ -324,13 +325,17 @@ case FFI_TYPE_FLOAT: if (gpcount < 8 && fpcount < 8) stf_spill (&stack->fp_regs[fpcount++], *(float *)avalue[i]); - stack->gp_regs[gpcount++] = *(UINT32 *)avalue[i]; + { + UINT32 tmp; + memcpy (&tmp, avalue[i], sizeof (UINT32)); + stack->gp_regs[gpcount++] = tmp; + } break; case FFI_TYPE_DOUBLE: if (gpcount < 8 && fpcount < 8) stf_spill (&stack->fp_regs[fpcount++], *(double *)avalue[i]); - stack->gp_regs[gpcount++] = *(UINT64 *)avalue[i]; + memcpy (&stack->gp_regs[gpcount++], avalue[i], sizeof (UINT64)); break; case FFI_TYPE_LONGDOUBLE: @@ -425,7 +430,8 @@ struct ffi_ia64_trampoline_struct *tramp; struct ia64_fd *fd; - FFI_ASSERT (cif->abi == FFI_UNIX); + if (cif->abi != FFI_UNIX) + return FFI_BAD_ABI; tramp = (struct ffi_ia64_trampoline_struct *)closure->tramp; fd = (struct ia64_fd *)(void *)ffi_closure_unix; diff --git a/Modules/_ctypes/libffi/src/ia64/ffitarget.h b/Modules/_ctypes/libffi/src/ia64/ffitarget.h --- a/Modules/_ctypes/libffi/src/ia64/ffitarget.h +++ b/Modules/_ctypes/libffi/src/ia64/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for IA-64. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #ifndef LIBFFI_ASM typedef unsigned long long ffi_arg; typedef signed long long ffi_sarg; @@ -34,8 +39,8 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_UNIX, /* Linux and all Unix variants use the same conventions */ - FFI_DEFAULT_ABI = FFI_UNIX, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_UNIX } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/java_raw_api.c b/Modules/_ctypes/libffi/src/java_raw_api.c --- a/Modules/_ctypes/libffi/src/java_raw_api.c +++ b/Modules/_ctypes/libffi/src/java_raw_api.c @@ -311,7 +311,7 @@ ffi_raw_closure *cl = (ffi_raw_closure*)user_data; ffi_java_ptrarray_to_raw (cif, avalue, raw); - (*cl->fun) (cif, rvalue, raw, cl->user_data); + (*cl->fun) (cif, rvalue, (ffi_raw*)raw, cl->user_data); ffi_java_raw_to_rvalue (cif, rvalue); } diff --git a/Modules/_ctypes/libffi/src/m32r/ffitarget.h b/Modules/_ctypes/libffi/src/m32r/ffitarget.h --- a/Modules/_ctypes/libffi/src/m32r/ffitarget.h +++ b/Modules/_ctypes/libffi/src/m32r/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2004 Renesas Technology. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 2004 Renesas Technology. Target configuration macros for M32R. Permission is hereby granted, free of charge, to any person obtaining @@ -26,6 +27,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM @@ -36,8 +41,8 @@ { FFI_FIRST_ABI = 0, FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/m68k/ffi.c b/Modules/_ctypes/libffi/src/m68k/ffi.c --- a/Modules/_ctypes/libffi/src/m68k/ffi.c +++ b/Modules/_ctypes/libffi/src/m68k/ffi.c @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- ffi.c - - m68k Foreign Function Interface + + m68k Foreign Function Interface ----------------------------------------------------------------------- */ #include @@ -9,8 +9,17 @@ #include #include +#ifdef __rtems__ +void rtems_cache_flush_multiple_data_lines( const void *, size_t ); +#else #include +#ifdef __MINT__ +#include +#include +#else #include +#endif +#endif void ffi_call_SYSV (extended_cif *, unsigned, unsigned, @@ -35,8 +44,12 @@ argp = stack; - if (ecif->cif->rtype->type == FFI_TYPE_STRUCT - && !ecif->cif->flags) + if ( +#ifdef __MINT__ + (ecif->cif->rtype->type == FFI_TYPE_LONGDOUBLE) || +#endif + (((ecif->cif->rtype->type == FFI_TYPE_STRUCT) + && !ecif->cif->flags))) struct_value_ptr = ecif->rvalue; else struct_value_ptr = NULL; @@ -47,12 +60,12 @@ i != 0; i--, p_arg++) { - size_t z; + size_t z = (*p_arg)->size; + int type = (*p_arg)->type; - z = (*p_arg)->size; if (z < sizeof (int)) { - switch ((*p_arg)->type) + switch (type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int) *(SINT8 *) *p_argv; @@ -71,7 +84,14 @@ break; case FFI_TYPE_STRUCT: +#ifdef __MINT__ + if (z == 1 || z == 2) + memcpy (argp + 2, *p_argv, z); + else + memcpy (argp, *p_argv, z); +#else memcpy (argp + sizeof (int) - z, *p_argv, z); +#endif break; default: @@ -103,6 +123,8 @@ #define CIF_FLAGS_POINTER 32 #define CIF_FLAGS_STRUCT1 64 #define CIF_FLAGS_STRUCT2 128 +#define CIF_FLAGS_SINT8 256 +#define CIF_FLAGS_SINT16 512 /* Perform machine dependent cif processing */ ffi_status @@ -116,17 +138,34 @@ break; case FFI_TYPE_STRUCT: + if (cif->rtype->elements[0]->type == FFI_TYPE_STRUCT && + cif->rtype->elements[1]) + { + cif->flags = 0; + break; + } + switch (cif->rtype->size) { case 1: +#ifdef __MINT__ + cif->flags = CIF_FLAGS_STRUCT2; +#else cif->flags = CIF_FLAGS_STRUCT1; +#endif break; case 2: cif->flags = CIF_FLAGS_STRUCT2; break; +#ifdef __MINT__ + case 3: +#endif case 4: cif->flags = CIF_FLAGS_INT; break; +#ifdef __MINT__ + case 7: +#endif case 8: cif->flags = CIF_FLAGS_DINT; break; @@ -144,9 +183,15 @@ cif->flags = CIF_FLAGS_DOUBLE; break; +#if (FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE) case FFI_TYPE_LONGDOUBLE: +#ifdef __MINT__ + cif->flags = 0; +#else cif->flags = CIF_FLAGS_LDOUBLE; +#endif break; +#endif case FFI_TYPE_POINTER: cif->flags = CIF_FLAGS_POINTER; @@ -157,6 +202,14 @@ cif->flags = CIF_FLAGS_DINT; break; + case FFI_TYPE_SINT16: + cif->flags = CIF_FLAGS_SINT16; + break; + + case FFI_TYPE_SINT8: + cif->flags = CIF_FLAGS_SINT8; + break; + default: cif->flags = CIF_FLAGS_INT; break; @@ -212,6 +265,26 @@ size_t z; z = (*p_arg)->size; +#ifdef __MINT__ + if (cif->flags && + cif->rtype->type == FFI_TYPE_STRUCT && + (z == 1 || z == 2)) + { + *p_argv = (void *) (argp + 2); + + z = 4; + } + else + if (cif->flags && + cif->rtype->type == FFI_TYPE_STRUCT && + (z == 3 || z == 4)) + { + *p_argv = (void *) (argp); + + z = 4; + } + else +#endif if (z <= 4) { *p_argv = (void *) (argp + 4 - z); @@ -255,19 +328,31 @@ void *user_data, void *codeloc) { - FFI_ASSERT (cif->abi == FFI_SYSV); + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; *(unsigned short *)closure->tramp = 0x207c; *(void **)(closure->tramp + 2) = codeloc; *(unsigned short *)(closure->tramp + 6) = 0x4ef9; - if (cif->rtype->type == FFI_TYPE_STRUCT - && !cif->flags) + + if ( +#ifdef __MINT__ + (cif->rtype->type == FFI_TYPE_LONGDOUBLE) || +#endif + (((cif->rtype->type == FFI_TYPE_STRUCT) + && !cif->flags))) *(void **)(closure->tramp + 8) = ffi_closure_struct_SYSV; else *(void **)(closure->tramp + 8) = ffi_closure_SYSV; +#ifdef __rtems__ + rtems_cache_flush_multiple_data_lines( codeloc, FFI_TRAMPOLINE_SIZE ); +#elif defined(__MINT__) + Ssystem(S_FLUSHCACHE, codeloc, FFI_TRAMPOLINE_SIZE); +#else syscall(SYS_cacheflush, codeloc, FLUSH_SCOPE_LINE, FLUSH_CACHE_BOTH, FFI_TRAMPOLINE_SIZE); +#endif closure->cif = cif; closure->user_data = user_data; @@ -275,4 +360,3 @@ return FFI_OK; } - diff --git a/Modules/_ctypes/libffi/src/m68k/ffitarget.h b/Modules/_ctypes/libffi/src/m68k/ffitarget.h --- a/Modules/_ctypes/libffi/src/m68k/ffitarget.h +++ b/Modules/_ctypes/libffi/src/m68k/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for Motorola 68K. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; @@ -34,8 +39,8 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/m68k/sysv.S b/Modules/_ctypes/libffi/src/m68k/sysv.S --- a/Modules/_ctypes/libffi/src/m68k/sysv.S +++ b/Modules/_ctypes/libffi/src/m68k/sysv.S @@ -1,8 +1,11 @@ /* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 1998 Andreas Schwab - Copyright (c) 2008 Red Hat, Inc. - - m68k Foreign Function Interface + + sysv.S - Copyright (c) 2012 Alan Hourihane + Copyright (c) 1998, 2012 Andreas Schwab + Copyright (c) 2008 Red Hat, Inc. + Copyright (c) 2012 Thorsten Glaser + + m68k Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -41,13 +44,19 @@ #define CFI_ENDPROC() #endif +#ifdef __MINT__ +#define CALLFUNC(funcname) _ ## funcname +#else +#define CALLFUNC(funcname) funcname +#endif + .text - .globl ffi_call_SYSV - .type ffi_call_SYSV, at function + .globl CALLFUNC(ffi_call_SYSV) + .type CALLFUNC(ffi_call_SYSV), at function .align 4 -ffi_call_SYSV: +CALLFUNC(ffi_call_SYSV): CFI_STARTPROC() link %fp,#0 CFI_OFFSET(14,-8) @@ -62,14 +71,18 @@ move.l 8(%fp),-(%sp) pea 4(%sp) #if !defined __PIC__ - jsr ffi_prep_args + jsr CALLFUNC(ffi_prep_args) #else - bsr.l ffi_prep_args at PLTPC + bsr.l CALLFUNC(ffi_prep_args at PLTPC) #endif addq.l #8,%sp | Pass pointer to struct value, if any +#ifdef __MINT__ + move.l %d0,%a1 +#else move.l %a0,%a1 +#endif | Call the function move.l 24(%fp),%a0 @@ -85,7 +98,12 @@ move.l 16(%fp),%d2 | If the return value pointer is NULL, assume no return value. + | NOTE: On the mc68000, tst on an address register is not supported. +#if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__) + cmp.w #0, %a1 +#else tst.l %a1 +#endif jbeq noretval btst #0,%d2 @@ -103,25 +121,44 @@ retfloat: btst #2,%d2 jbeq retdouble +#if defined(__MC68881__) || defined(__HAVE_68881__) fmove.s %fp0,(%a1) +#else + move.l %d0,(%a1) +#endif jbra epilogue retdouble: btst #3,%d2 jbeq retlongdouble +#if defined(__MC68881__) || defined(__HAVE_68881__) fmove.d %fp0,(%a1) +#else + move.l %d0,(%a1)+ + move.l %d1,(%a1) +#endif jbra epilogue retlongdouble: btst #4,%d2 jbeq retpointer +#if defined(__MC68881__) || defined(__HAVE_68881__) fmove.x %fp0,(%a1) +#else + move.l %d0,(%a1)+ + move.l %d1,(%a1)+ + move.l %d2,(%a1) +#endif jbra epilogue retpointer: btst #5,%d2 jbeq retstruct1 +#ifdef __MINT__ + move.l %d0,(%a1) +#else move.l %a0,(%a1) +#endif jbra epilogue retstruct1: @@ -132,8 +169,28 @@ retstruct2: btst #7,%d2 + jbeq retsint8 + move.w %d0,(%a1) + jbra epilogue + +retsint8: + btst #8,%d2 + jbeq retsint16 + | NOTE: On the mc68000, extb is not supported. 8->16, then 16->32. +#if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__) + ext.w %d0 + ext.l %d0 +#else + extb.l %d0 +#endif + move.l %d0,(%a1) + jbra epilogue + +retsint16: + btst #9,%d2 jbeq noretval - move.w %d0,(%a1) + ext.l %d0 + move.l %d0,(%a1) noretval: epilogue: @@ -141,13 +198,13 @@ unlk %fp rts CFI_ENDPROC() - .size ffi_call_SYSV,.-ffi_call_SYSV + .size CALLFUNC(ffi_call_SYSV),.-CALLFUNC(ffi_call_SYSV) - .globl ffi_closure_SYSV - .type ffi_closure_SYSV, @function + .globl CALLFUNC(ffi_closure_SYSV) + .type CALLFUNC(ffi_closure_SYSV), @function .align 4 -ffi_closure_SYSV: +CALLFUNC(ffi_closure_SYSV): CFI_STARTPROC() link %fp,#-12 CFI_OFFSET(14,-8) @@ -157,16 +214,18 @@ pea -12(%fp) move.l %a0,-(%sp) #if !defined __PIC__ - jsr ffi_closure_SYSV_inner + jsr CALLFUNC(ffi_closure_SYSV_inner) #else - bsr.l ffi_closure_SYSV_inner at PLTPC + bsr.l CALLFUNC(ffi_closure_SYSV_inner at PLTPC) #endif lsr.l #1,%d0 jne 1f jcc .Lcls_epilogue + | CIF_FLAGS_INT move.l -12(%fp),%d0 .Lcls_epilogue: + | no CIF_FLAGS_* unlk %fp rts 1: @@ -174,43 +233,80 @@ lsr.l #2,%d0 jne 1f jcs .Lcls_ret_float + | CIF_FLAGS_DINT move.l (%a0)+,%d0 move.l (%a0),%d1 jra .Lcls_epilogue .Lcls_ret_float: +#if defined(__MC68881__) || defined(__HAVE_68881__) fmove.s (%a0),%fp0 +#else + move.l (%a0),%d0 +#endif jra .Lcls_epilogue 1: lsr.l #2,%d0 jne 1f jcs .Lcls_ret_ldouble + | CIF_FLAGS_DOUBLE +#if defined(__MC68881__) || defined(__HAVE_68881__) fmove.d (%a0),%fp0 +#else + move.l (%a0)+,%d0 + move.l (%a0),%d1 +#endif jra .Lcls_epilogue .Lcls_ret_ldouble: +#if defined(__MC68881__) || defined(__HAVE_68881__) fmove.x (%a0),%fp0 +#else + move.l (%a0)+,%d0 + move.l (%a0)+,%d1 + move.l (%a0),%d2 +#endif jra .Lcls_epilogue 1: lsr.l #2,%d0 - jne .Lcls_ret_struct2 + jne 1f jcs .Lcls_ret_struct1 + | CIF_FLAGS_POINTER move.l (%a0),%a0 move.l %a0,%d0 jra .Lcls_epilogue .Lcls_ret_struct1: move.b (%a0),%d0 jra .Lcls_epilogue -.Lcls_ret_struct2: +1: + lsr.l #2,%d0 + jne 1f + jcs .Lcls_ret_sint8 + | CIF_FLAGS_STRUCT2 move.w (%a0),%d0 jra .Lcls_epilogue +.Lcls_ret_sint8: + move.l (%a0),%d0 + | NOTE: On the mc68000, extb is not supported. 8->16, then 16->32. +#if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__) + ext.w %d0 + ext.l %d0 +#else + extb.l %d0 +#endif + jra .Lcls_epilogue +1: + | CIF_FLAGS_SINT16 + move.l (%a0),%d0 + ext.l %d0 + jra .Lcls_epilogue CFI_ENDPROC() - .size ffi_closure_SYSV,.-ffi_closure_SYSV + .size CALLFUNC(ffi_closure_SYSV),.-CALLFUNC(ffi_closure_SYSV) - .globl ffi_closure_struct_SYSV - .type ffi_closure_struct_SYSV, @function + .globl CALLFUNC(ffi_closure_struct_SYSV) + .type CALLFUNC(ffi_closure_struct_SYSV), @function .align 4 -ffi_closure_struct_SYSV: +CALLFUNC(ffi_closure_struct_SYSV): CFI_STARTPROC() link %fp,#0 CFI_OFFSET(14,-8) @@ -220,14 +316,14 @@ move.l %a1,-(%sp) move.l %a0,-(%sp) #if !defined __PIC__ - jsr ffi_closure_SYSV_inner + jsr CALLFUNC(ffi_closure_SYSV_inner) #else - bsr.l ffi_closure_SYSV_inner at PLTPC + bsr.l CALLFUNC(ffi_closure_SYSV_inner at PLTPC) #endif unlk %fp rts CFI_ENDPROC() - .size ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV + .size CALLFUNC(ffi_closure_struct_SYSV),.-CALLFUNC(ffi_closure_struct_SYSV) #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"", at progbits diff --git a/Modules/_ctypes/libffi/src/metag/ffi.c b/Modules/_ctypes/libffi/src/metag/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/metag/ffi.c @@ -0,0 +1,330 @@ +/* ---------------------------------------------------------------------- + ffi.c - Copyright (c) 2013 Imagination Technologies + + Meta Foreign Function Interface + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + `Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED `AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +----------------------------------------------------------------------- */ + +#include +#include + +#include + +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) + +/* + * ffi_prep_args is called by the assembly routine once stack space has been + * allocated for the function's arguments + */ + +unsigned int ffi_prep_args(char *stack, extended_cif *ecif) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + + /* Store return value */ + if ( ecif->cif->flags == FFI_TYPE_STRUCT ) { + argp -= 4; + *(void **) argp = ecif->rvalue; + } + + p_argv = ecif->avalue; + + /* point to next location */ + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++, p_argv++) + { + size_t z; + + /* Move argp to address of argument */ + z = (*p_arg)->size; + argp -= z; + + /* Align if necessary */ + argp = (char *) ALIGN_DOWN(ALIGN_DOWN(argp, (*p_arg)->alignment), 4); + + if (z < sizeof(int)) { + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); + break; + case FFI_TYPE_UINT8: + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); + break; + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); + break; + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); + case FFI_TYPE_STRUCT: + memcpy(argp, *p_argv, (*p_arg)->size); + break; + default: + FFI_ASSERT(0); + } + } else if ( z == sizeof(int)) { + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + } else { + memcpy(argp, *p_argv, z); + } + } + + /* return the size of the arguments to be passed in registers, + padded to an 8 byte boundary to preserve stack alignment */ + return ALIGN(MIN(stack - argp, 6*4), 8); +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + ffi_type **ptr; + unsigned i, bytes = 0; + + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { + if ((*ptr)->size == 0) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the argument type, do this + check after the initialization. */ + FFI_ASSERT_VALID_TYPE(*ptr); + + /* Add any padding if necessary */ + if (((*ptr)->alignment - 1) & bytes) + bytes = ALIGN(bytes, (*ptr)->alignment); + + bytes += ALIGN((*ptr)->size, 4); + } + + /* Ensure arg space is aligned to an 8-byte boundary */ + bytes = ALIGN(bytes, 8); + + /* Make space for the return structure pointer */ + if (cif->rtype->type == FFI_TYPE_STRUCT) { + bytes += sizeof(void*); + + /* Ensure stack is aligned to an 8-byte boundary */ + bytes = ALIGN(bytes, 8); + } + + cif->bytes = bytes; + + /* Set the return type flag */ + switch (cif->rtype->type) { + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + cif->flags = (unsigned) cif->rtype->type; + break; + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + cif->flags = (unsigned) FFI_TYPE_SINT64; + break; + case FFI_TYPE_STRUCT: + /* Meta can store return values which are <= 64 bits */ + if (cif->rtype->size <= 4) + /* Returned to D0Re0 as 32-bit value */ + cif->flags = (unsigned)FFI_TYPE_INT; + else if ((cif->rtype->size > 4) && (cif->rtype->size <= 8)) + /* Returned valued is stored to D1Re0|R0Re0 */ + cif->flags = (unsigned)FFI_TYPE_DOUBLE; + else + /* value stored in memory */ + cif->flags = (unsigned)FFI_TYPE_STRUCT; + break; + default: + cif->flags = (unsigned)FFI_TYPE_INT; + break; + } + return FFI_OK; +} + +extern void ffi_call_SYSV(void (*fn)(void), extended_cif *, unsigned, unsigned, double *); + +/* + * Exported in API. Entry point + * cif -> ffi_cif object + * fn -> function pointer + * rvalue -> pointer to return value + * avalue -> vector of void * pointers pointing to memory locations holding the + * arguments + */ +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + int small_struct = (((cif->flags == FFI_TYPE_INT) || (cif->flags == FFI_TYPE_DOUBLE)) && (cif->rtype->type == FFI_TYPE_STRUCT)); + ecif.cif = cif; + ecif.avalue = avalue; + + double temp; + + /* + * If the return value is a struct and we don't have a return value address + * then we need to make one + */ + + if ((rvalue == NULL ) && (cif->flags == FFI_TYPE_STRUCT)) + ecif.rvalue = alloca(cif->rtype->size); + else if (small_struct) + ecif.rvalue = &temp; + else + ecif.rvalue = rvalue; + + switch (cif->abi) { + case FFI_SYSV: + ffi_call_SYSV(fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); + break; + default: + FFI_ASSERT(0); + break; + } + + if (small_struct) + memcpy (rvalue, &temp, cif->rtype->size); +} + +/* private members */ + +static void ffi_prep_incoming_args_SYSV (char *, void **, void **, + ffi_cif*, float *); + +void ffi_closure_SYSV (ffi_closure *); + +/* Do NOT change that without changing the FFI_TRAMPOLINE_SIZE */ +extern unsigned int ffi_metag_trampoline[10]; /* 10 instructions */ + +/* end of private members */ + +/* + * __tramp: trampoline memory location + * __fun: assembly routine + * __ctx: memory location for wrapper + * + * At this point, tramp[0] == __ctx ! + */ +void ffi_init_trampoline(unsigned char *__tramp, unsigned int __fun, unsigned int __ctx) { + memcpy (__tramp, ffi_metag_trampoline, sizeof(ffi_metag_trampoline)); + *(unsigned int*) &__tramp[40] = __ctx; + *(unsigned int*) &__tramp[44] = __fun; + /* This will flush the instruction cache */ + __builtin_meta2_cachewd(&__tramp[0], 1); + __builtin_meta2_cachewd(&__tramp[47], 1); +} + + + +/* the cif must already be prepared */ + +ffi_status +ffi_prep_closure_loc (ffi_closure *closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + void (*closure_func)(ffi_closure*) = NULL; + + if (cif->abi == FFI_SYSV) + closure_func = &ffi_closure_SYSV; + else + return FFI_BAD_ABI; + + ffi_init_trampoline( + (unsigned char*)&closure->tramp[0], + (unsigned int)closure_func, + (unsigned int)codeloc); + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + + +/* This function is jumped to by the trampoline */ +unsigned int ffi_closure_SYSV_inner (closure, respp, args, vfp_args) + ffi_closure *closure; + void **respp; + void *args; + void *vfp_args; +{ + ffi_cif *cif; + void **arg_area; + + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + + /* + * This call will initialize ARG_AREA, such that each + * element in that array points to the corresponding + * value on the stack; and if the function returns + * a structure, it will re-set RESP to point to the + * structure return address. + */ + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif, vfp_args); + + (closure->fun) ( cif, *respp, arg_area, closure->user_data); + + return cif->flags; +} + +static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, + void **avalue, ffi_cif *cif, + float *vfp_stack) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + /* stack points to original arguments */ + argp = stack; + + /* Store return value */ + if ( cif->flags == FFI_TYPE_STRUCT ) { + argp -= 4; + *rvalue = *(void **) argp; + } + + p_argv = avalue; + + for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { + size_t z; + size_t alignment; + + alignment = (*p_arg)->alignment; + if (alignment < 4) + alignment = 4; + if ((alignment - 1) & (unsigned)argp) + argp = (char *) ALIGN(argp, alignment); + + z = (*p_arg)->size; + *p_argv = (void*) argp; + p_argv++; + argp -= z; + } + return; +} diff --git a/Modules/_ctypes/libffi/src/metag/ffitarget.h b/Modules/_ctypes/libffi/src/metag/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/metag/ffitarget.h @@ -0,0 +1,53 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2013 Imagination Technologies Ltd. + Target configuration macros for Meta + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_DEFAULT_ABI = FFI_SYSV, + FFI_LAST_ABI = FFI_DEFAULT_ABI + 1, +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 48 +#define FFI_NATIVE_RAW_API 0 + +#endif + diff --git a/Modules/_ctypes/libffi/src/metag/sysv.S b/Modules/_ctypes/libffi/src/metag/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/metag/sysv.S @@ -0,0 +1,311 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2013 Imagination Technologies Ltd. + + Meta Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include +#ifdef HAVE_MACHINE_ASM_H +#include +#else +#ifdef __USER_LABEL_PREFIX__ +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b + +/* Use the right prefix for global labels. */ +#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x) +#else +#define CNAME(x) x +#endif +#define ENTRY(x) .globl CNAME(x); .type CNAME(x), %function; CNAME(x): +#endif + +#ifdef __ELF__ +#define LSYM(x) .x +#else +#define LSYM(x) x +#endif + +.macro call_reg x= + .text + .balign 4 + mov D1RtP, \x + swap D1RtP, PC +.endm + +! Save register arguments +.macro SAVE_ARGS + .text + .balign 4 + setl [A0StP++], D0Ar6, D1Ar5 + setl [A0StP++], D0Ar4, D1Ar3 + setl [A0StP++], D0Ar2, D1Ar1 +.endm + +! Save retrun, frame pointer and other regs +.macro SAVE_REGS regs= + .text + .balign 4 + setl [A0StP++], D0FrT, D1RtP + ! Needs to be a pair of regs + .ifnc "\regs","" + setl [A0StP++], \regs + .endif +.endm + +! Declare a global function +.macro METAG_FUNC_START name + .text + .balign 4 + ENTRY(\name) +.endm + +! Return registers from the stack. Reverse SAVE_REGS operation +.macro RET_REGS regs=, cond= + .ifnc "\regs", "" + getl \regs, [--A0StP] + .endif + getl D0FrT, D1RtP, [--A0StP] +.endm + +! Return arguments +.macro RET_ARGS + getl D0Ar2, D1Ar1, [--A0StP] + getl D0Ar4, D1Ar3, [--A0StP] + getl D0Ar6, D1Ar5, [--A0StP] +.endm + + + ! D1Ar1: fn + ! D0Ar2: &ecif + ! D1Ar3: cif->bytes + ! D0Ar4: fig->flags + ! D1Ar5: ecif.rvalue + + ! This assumes we are using GNU as +METAG_FUNC_START ffi_call_SYSV + ! Save argument registers + + SAVE_ARGS + + ! new frame + mov D0FrT, A0FrP + add A0FrP, A0StP, #0 + + ! Preserve the old frame pointer + SAVE_REGS "D1.5, D0.5" + + ! Make room for new args. cifs->bytes is the total space for input + ! and return arguments + + add A0StP, A0StP, D1Ar3 + + ! Preserve cifs->bytes & fn + mov D0.5, D1Ar3 + mov D1.5, D1Ar1 + + ! Place all of the ffi_prep_args in position + mov D1Ar1, A0StP + + ! Call ffi_prep_args(stack, &ecif) +#ifdef __PIC__ + callr D1RtP, CNAME(ffi_prep_args at PLT) +#else + callr D1RtP, CNAME(ffi_prep_args) +#endif + + ! Restore fn pointer + + ! The foreign stack should look like this + ! XXXXX XXXXXX <--- stack pointer + ! FnArgN rvalue + ! FnArgN+2 FnArgN+1 + ! FnArgN+4 FnArgN+3 + ! .... + ! + + ! A0StP now points to the first (or return) argument + 4 + + ! Preserve cif->bytes + getl D0Ar2, D1Ar1, [--A0StP] + getl D0Ar4, D1Ar3, [--A0StP] + getl D0Ar6, D1Ar5, [--A0StP] + + ! Place A0StP to the first argument again + add A0StP, A0StP, #24 ! That's because we loaded 6 regs x 4 byte each + + ! A0FrP points to the initial stack without the reserved space for the + ! cifs->bytes, whilst A0StP points to the stack after the space allocation + + ! fn was the first argument of ffi_call_SYSV. + ! The stack at this point looks like this: + ! + ! A0StP(on entry to _SYSV) -> Arg6 Arg5 | low + ! Arg4 Arg3 | + ! Arg2 Arg1 | + ! A0FrP ----> D0FrtP D1RtP | + ! D1.5 D0.5 | + ! A0StP(bf prep_args) -> FnArgn FnArgn-1 | + ! FnArgn-2FnArgn-3 | + ! ................ | <= cifs->bytes + ! FnArg4 FnArg3 | + ! A0StP (prv_A0StP+cifs->bytes) FnArg2 FnArg1 | high + ! + ! fn was in Arg1 so it's located in in A0FrP+#-0xC + ! + + ! D0Re0 contains the size of arguments stored in registers + sub A0StP, A0StP, D0Re0 + + ! Arg1 is the function pointer for the foreign call. This has been + ! preserved in D1.5 + + ! Time to call (fn). Arguments should be like this: + ! Arg1-Arg6 are loaded to regs + ! The rest of the arguments are stored in stack pointed by A0StP + + call_reg D1.5 + + ! Reset stack. + + mov A0StP, A0FrP + + ! Load Arg1 with the pointer to storage for the return type + ! This was stored in Arg5 + + getd D1Ar1, [A0FrP+#-20] + + ! Load D0Ar2 with the return type code. This was stored in Arg4 (flags) + + getd D0Ar2, [A0FrP+#-16] + + ! We are ready to start processing the return value + ! D0Re0 (and D1Re0) hold the return value + + ! If the return value is NULL, assume no return value + cmp D1Ar1, #0 + beq LSYM(Lepilogue) + + ! return INT + cmp D0Ar2, #FFI_TYPE_INT + ! Sadly, there is no setd{cc} instruction so we need to workaround that + bne .INT64 + setd [D1Ar1], D0Re0 + b LSYM(Lepilogue) + + ! return INT64 +.INT64: + cmp D0Ar2, #FFI_TYPE_SINT64 + setleq [D1Ar1], D0Re0, D1Re0 + + ! return DOUBLE + cmp D0Ar2, #FFI_TYPE_DOUBLE + setl [D1AR1++], D0Re0, D1Re0 + +LSYM(Lepilogue): + ! At this point, the stack pointer points right after the argument + ! saved area. We need to restore 4 regs, therefore we need to move + ! 16 bytes ahead. + add A0StP, A0StP, #16 + RET_REGS "D1.5, D0.5" + RET_ARGS + getd D0Re0, [A0StP] + mov A0FrP, D0FrT + swap D1RtP, PC + +.ffi_call_SYSV_end: + .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) + + +/* + (called by ffi_metag_trampoline) + void ffi_closure_SYSV (ffi_closure*) + + (called by ffi_closure_SYSV) + unsigned int FFI_HIDDEN + ffi_closure_SYSV_inner (closure,respp, args) + ffi_closure *closure; + void **respp; + void *args; +*/ + +METAG_FUNC_START ffi_closure_SYSV + ! We assume that D1Ar1 holds the address of the + ! ffi_closure struct. We will use that to fetch the + ! arguments. The stack pointer points to an empty space + ! and it is ready to store more data. + + ! D1Ar1 is ready + ! Allocate stack space for return value + add A0StP, A0StP, #8 + ! Store it to D0Ar2 + sub D0Ar2, A0StP, #8 + + sub D1Ar3, A0FrP, #4 + + ! D1Ar3 contains the address of the original D1Ar1 argument + ! We need to subtract #4 later on + + ! Preverve D0Ar2 + mov D0.5, D0Ar2 + +#ifdef __PIC__ + callr D1RtP, CNAME(ffi_closure_SYSV_inner at PLT) +#else + callr D1RtP, CNAME(ffi_closure_SYSV_inner) +#endif + + ! Check the return value and store it to D0.5 + cmp D0Re0, #FFI_TYPE_INT + beq .Lretint + cmp D0Re0, #FFI_TYPE_DOUBLE + beq .Lretdouble +.Lclosure_epilogue: + sub A0StP, A0StP, #8 + RET_REGS "D1.5, D0.5" + RET_ARGS + swap D1RtP, PC + +.Lretint: + setd [D0.5], D0Re0 + b .Lclosure_epilogue +.Lretdouble: + setl [D0.5++], D0Re0, D1Re0 + b .Lclosure_epilogue +.ffi_closure_SYSV_end: +.size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) + + +ENTRY(ffi_metag_trampoline) + SAVE_ARGS + ! New frame + mov A0FrP, A0StP + SAVE_REGS "D1.5, D0.5" + mov D0.5, PC + ! Load D1Ar1 the value of ffi_metag_trampoline + getd D1Ar1, [D0.5 + #8] + ! Jump to ffi_closure_SYSV + getd PC, [D0.5 + #12] diff --git a/Modules/_ctypes/libffi/src/microblaze/ffi.c b/Modules/_ctypes/libffi/src/microblaze/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/microblaze/ffi.c @@ -0,0 +1,321 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2012, 2013 Xilinx, Inc + + MicroBlaze Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +extern void ffi_call_SYSV(void (*)(void*, extended_cif*), extended_cif*, + unsigned int, unsigned int, unsigned int*, void (*fn)(void), + unsigned int, unsigned int); + +extern void ffi_closure_SYSV(void); + +#define WORD_SIZE sizeof(unsigned int) +#define ARGS_REGISTER_SIZE (WORD_SIZE * 6) +#define WORD_ALIGN(x) ALIGN(x, WORD_SIZE) + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ +void ffi_prep_args(void* stack, extended_cif* ecif) +{ + unsigned int i; + ffi_type** p_arg; + void** p_argv; + void* stack_args_p = stack; + + p_argv = ecif->avalue; + + if (ecif == NULL || ecif->cif == NULL) { + return; /* no description to prepare */ + } + + if ((ecif->cif->rtype != NULL) && + (ecif->cif->rtype->type == FFI_TYPE_STRUCT)) + { + /* if return type is a struct which is referenced on the stack/reg5, + * by a pointer. Stored the return value pointer in r5. + */ + char* addr = stack_args_p; + memcpy(addr, &(ecif->rvalue), WORD_SIZE); + stack_args_p += WORD_SIZE; + } + + if (ecif->avalue == NULL) { + return; /* no arguments to prepare */ + } + + for (i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; + i++, p_arg++) + { + size_t size = (*p_arg)->size; + int type = (*p_arg)->type; + void* value = p_argv[i]; + char* addr = stack_args_p; + int aligned_size = WORD_ALIGN(size); + + /* force word alignment on the stack */ + stack_args_p += aligned_size; + + switch (type) + { + case FFI_TYPE_UINT8: + *(unsigned int *)addr = (unsigned int)*(UINT8*)(value); + break; + case FFI_TYPE_SINT8: + *(signed int *)addr = (signed int)*(SINT8*)(value); + break; + case FFI_TYPE_UINT16: + *(unsigned int *)addr = (unsigned int)*(UINT16*)(value); + break; + case FFI_TYPE_SINT16: + *(signed int *)addr = (signed int)*(SINT16*)(value); + break; + case FFI_TYPE_STRUCT: +#if __BIG_ENDIAN__ + /* + * MicroBlaze toolchain appears to emit: + * bsrli r5, r5, 8 (caller) + * ... + * + * ... + * bslli r5, r5, 8 (callee) + * + * For structs like "struct a { uint8_t a[3]; };", when passed + * by value. + * + * Structs like "struct b { uint16_t a; };" are also expected + * to be packed strangely in registers. + * + * This appears to be because the microblaze toolchain expects + * "struct b == uint16_t", which is only any issue for big + * endian. + * + * The following is a work around for big-endian only, for the + * above mentioned case, it will re-align the contents of a + * <= 3-byte struct value. + */ + if (size < WORD_SIZE) + { + memcpy (addr + (WORD_SIZE - size), value, size); + break; + } +#endif + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + case FFI_TYPE_FLOAT: + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_DOUBLE: + default: + memcpy(addr, value, aligned_size); + } + } +} + +ffi_status ffi_prep_cif_machdep(ffi_cif* cif) +{ + /* check ABI */ + switch (cif->abi) + { + case FFI_SYSV: + break; + default: + return FFI_BAD_ABI; + } + return FFI_OK; +} + +void ffi_call(ffi_cif* cif, void (*fn)(void), void* rvalue, void** avalue) +{ + extended_cif ecif; + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { + ecif.rvalue = alloca(cif->rtype->size); + } else { + ecif.rvalue = rvalue; + } + + switch (cif->abi) + { + case FFI_SYSV: + ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, + ecif.rvalue, fn, cif->rtype->type, cif->rtype->size); + break; + default: + FFI_ASSERT(0); + break; + } +} + +void ffi_closure_call_SYSV(void* register_args, void* stack_args, + ffi_closure* closure, void* rvalue, + unsigned int* rtype, unsigned int* rsize) +{ + /* prepare arguments for closure call */ + ffi_cif* cif = closure->cif; + ffi_type** arg_types = cif->arg_types; + + /* re-allocate data for the args. This needs to be done in order to keep + * multi-word objects (e.g. structs) in contigious memory. Callers are not + * required to store the value of args in the lower 6 words in the stack + * (although they are allocated in the stack). + */ + char* stackclone = alloca(cif->bytes); + void** avalue = alloca(cif->nargs * sizeof(void*)); + void* struct_rvalue = NULL; + char* ptr = stackclone; + int i; + + /* copy registers into stack clone */ + int registers_used = cif->bytes; + if (registers_used > ARGS_REGISTER_SIZE) { + registers_used = ARGS_REGISTER_SIZE; + } + memcpy(stackclone, register_args, registers_used); + + /* copy stack allocated args into stack clone */ + if (cif->bytes > ARGS_REGISTER_SIZE) { + int stack_used = cif->bytes - ARGS_REGISTER_SIZE; + memcpy(stackclone + ARGS_REGISTER_SIZE, stack_args, stack_used); + } + + /* preserve struct type return pointer passing */ + if ((cif->rtype != NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { + struct_rvalue = *((void**)ptr); + ptr += WORD_SIZE; + } + + /* populate arg pointer list */ + for (i = 0; i < cif->nargs; i++) + { + switch (arg_types[i]->type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: +#ifdef __BIG_ENDIAN__ + avalue[i] = ptr + 3; +#else + avalue[i] = ptr; +#endif + break; + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: +#ifdef __BIG_ENDIAN__ + avalue[i] = ptr + 2; +#else + avalue[i] = ptr; +#endif + break; + case FFI_TYPE_STRUCT: +#if __BIG_ENDIAN__ + /* + * Work around strange ABI behaviour. + * (see info in ffi_prep_args) + */ + if (arg_types[i]->size < WORD_SIZE) + { + memcpy (ptr, ptr + (WORD_SIZE - arg_types[i]->size), arg_types[i]->size); + } +#endif + avalue[i] = (void*)ptr; + break; + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_DOUBLE: + avalue[i] = ptr; + break; + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + case FFI_TYPE_FLOAT: + default: + /* default 4-byte argument */ + avalue[i] = ptr; + break; + } + ptr += WORD_ALIGN(arg_types[i]->size); + } + + /* set the return type info passed back to the wrapper */ + *rsize = cif->rtype->size; + *rtype = cif->rtype->type; + if (struct_rvalue != NULL) { + closure->fun(cif, struct_rvalue, avalue, closure->user_data); + /* copy struct return pointer value into function return value */ + *((void**)rvalue) = struct_rvalue; + } else { + closure->fun(cif, rvalue, avalue, closure->user_data); + } +} + +ffi_status ffi_prep_closure_loc( + ffi_closure* closure, ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void* user_data, void* codeloc) +{ + unsigned long* tramp = (unsigned long*)&(closure->tramp[0]); + unsigned long cls = (unsigned long)codeloc; + unsigned long fn = 0; + unsigned long fn_closure_call_sysv = (unsigned long)ffi_closure_call_SYSV; + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + switch (cif->abi) + { + case FFI_SYSV: + fn = (unsigned long)ffi_closure_SYSV; + + /* load r11 (temp) with fn */ + /* imm fn(upper) */ + tramp[0] = 0xb0000000 | ((fn >> 16) & 0xffff); + /* addik r11, r0, fn(lower) */ + tramp[1] = 0x31600000 | (fn & 0xffff); + + /* load r12 (temp) with cls */ + /* imm cls(upper) */ + tramp[2] = 0xb0000000 | ((cls >> 16) & 0xffff); + /* addik r12, r0, cls(lower) */ + tramp[3] = 0x31800000 | (cls & 0xffff); + + /* load r3 (temp) with ffi_closure_call_SYSV */ + /* imm fn_closure_call_sysv(upper) */ + tramp[4] = 0xb0000000 | ((fn_closure_call_sysv >> 16) & 0xffff); + /* addik r3, r0, fn_closure_call_sysv(lower) */ + tramp[5] = 0x30600000 | (fn_closure_call_sysv & 0xffff); + /* branch/jump to address stored in r11 (fn) */ + tramp[6] = 0x98085800; /* bra r11 */ + + break; + default: + return FFI_BAD_ABI; + } + return FFI_OK; +} diff --git a/Modules/_ctypes/libffi/src/microblaze/ffitarget.h b/Modules/_ctypes/libffi/src/microblaze/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/microblaze/ffitarget.h @@ -0,0 +1,53 @@ +/* ----------------------------------------------------------------------- + ffitarget.h - Copyright (c) 2012, 2013 Xilinx, Inc + + Target configuration macros for MicroBlaze. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV +} ffi_abi; +#endif + +/* Definitions for closures */ + +#define FFI_CLOSURES 1 +#define FFI_NATIVE_RAW_API 0 + +#define FFI_TRAMPOLINE_SIZE (4*8) + +#endif diff --git a/Modules/_ctypes/libffi/src/microblaze/sysv.S b/Modules/_ctypes/libffi/src/microblaze/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/microblaze/sysv.S @@ -0,0 +1,302 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2012, 2013 Xilinx, Inc + + MicroBlaze Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + + /* + * arg[0] (r5) = ffi_prep_args, + * arg[1] (r6) = &ecif, + * arg[2] (r7) = cif->bytes, + * arg[3] (r8) = cif->flags, + * arg[4] (r9) = ecif.rvalue, + * arg[5] (r10) = fn + * arg[6] (sp[0]) = cif->rtype->type + * arg[7] (sp[4]) = cif->rtype->size + */ + .text + .globl ffi_call_SYSV + .type ffi_call_SYSV, @function +ffi_call_SYSV: + /* push callee saves */ + addik r1, r1, -20 + swi r19, r1, 0 /* Frame Pointer */ + swi r20, r1, 4 /* PIC register */ + swi r21, r1, 8 /* PIC register */ + swi r22, r1, 12 /* save for locals */ + swi r23, r1, 16 /* save for locals */ + + /* save the r5-r10 registers in the stack */ + addik r1, r1, -24 /* increment sp to store 6x 32-bit words */ + swi r5, r1, 0 + swi r6, r1, 4 + swi r7, r1, 8 + swi r8, r1, 12 + swi r9, r1, 16 + swi r10, r1, 20 + + /* save function pointer */ + addik r3, r5, 0 /* copy ffi_prep_args into r3 */ + addik r22, r1, 0 /* save sp for unallocated args into r22 (callee-saved) */ + addik r23, r10, 0 /* save function address into r23 (callee-saved) */ + + /* prepare stack with allocation for n (bytes = r7) args */ + rsub r1, r7, r1 /* subtract bytes from sp */ + + /* prep args for ffi_prep_args call */ + addik r5, r1, 0 /* store stack pointer into arg[0] */ + /* r6 still holds ecif for arg[1] */ + + /* Call ffi_prep_args(stack, &ecif). */ + addik r1, r1, -4 + swi r15, r1, 0 /* store the link register in the frame */ + brald r15, r3 + nop /* branch has delay slot */ + lwi r15, r1, 0 + addik r1, r1, 4 /* restore the link register from the frame */ + /* returns calling stack pointer location */ + + /* prepare args for fn call, prep_args populates them onto the stack */ + lwi r5, r1, 0 /* arg[0] */ + lwi r6, r1, 4 /* arg[1] */ + lwi r7, r1, 8 /* arg[2] */ + lwi r8, r1, 12 /* arg[3] */ + lwi r9, r1, 16 /* arg[4] */ + lwi r10, r1, 20 /* arg[5] */ + + /* call (fn) (...). */ + addik r1, r1, -4 + swi r15, r1, 0 /* store the link register in the frame */ + brald r15, r23 + nop /* branch has delay slot */ + lwi r15, r1, 0 + addik r1, r1, 4 /* restore the link register from the frame */ + + /* Remove the space we pushed for the args. */ + addik r1, r22, 0 /* restore old SP */ + + /* restore this functions parameters */ + lwi r5, r1, 0 /* arg[0] */ + lwi r6, r1, 4 /* arg[1] */ + lwi r7, r1, 8 /* arg[2] */ + lwi r8, r1, 12 /* arg[3] */ + lwi r9, r1, 16 /* arg[4] */ + lwi r10, r1, 20 /* arg[5] */ + addik r1, r1, 24 /* decrement sp to de-allocate 6x 32-bit words */ + + /* If the return value pointer is NULL, assume no return value. */ + beqi r9, ffi_call_SYSV_end + + lwi r22, r1, 48 /* get return type (20 for locals + 28 for arg[6]) */ + lwi r23, r1, 52 /* get return size (20 for locals + 32 for arg[7]) */ + + /* Check if return type is actually a struct, do nothing */ + rsubi r11, r22, FFI_TYPE_STRUCT + beqi r11, ffi_call_SYSV_end + + /* Return 8bit */ + rsubi r11, r23, 1 + beqi r11, ffi_call_SYSV_store8 + + /* Return 16bit */ + rsubi r11, r23, 2 + beqi r11, ffi_call_SYSV_store16 + + /* Return 32bit */ + rsubi r11, r23, 4 + beqi r11, ffi_call_SYSV_store32 + + /* Return 64bit */ + rsubi r11, r23, 8 + beqi r11, ffi_call_SYSV_store64 + + /* Didnt match anything */ + bri ffi_call_SYSV_end + +ffi_call_SYSV_store64: + swi r3, r9, 0 /* store word r3 into return value */ + swi r4, r9, 4 /* store word r4 into return value */ + bri ffi_call_SYSV_end + +ffi_call_SYSV_store32: + swi r3, r9, 0 /* store word r3 into return value */ + bri ffi_call_SYSV_end + +ffi_call_SYSV_store16: +#ifdef __BIG_ENDIAN__ + shi r3, r9, 2 /* store half-word r3 into return value */ +#else + shi r3, r9, 0 /* store half-word r3 into return value */ +#endif + bri ffi_call_SYSV_end + +ffi_call_SYSV_store8: +#ifdef __BIG_ENDIAN__ + sbi r3, r9, 3 /* store byte r3 into return value */ +#else + sbi r3, r9, 0 /* store byte r3 into return value */ +#endif + bri ffi_call_SYSV_end + +ffi_call_SYSV_end: + /* callee restores */ + lwi r19, r1, 0 /* frame pointer */ + lwi r20, r1, 4 /* PIC register */ + lwi r21, r1, 8 /* PIC register */ + lwi r22, r1, 12 + lwi r23, r1, 16 + addik r1, r1, 20 + + /* return from sub-routine (with delay slot) */ + rtsd r15, 8 + nop + + .size ffi_call_SYSV, . - ffi_call_SYSV + +/* ------------------------------------------------------------------------- */ + + /* + * args passed into this function, are passed down to the callee. + * this function is the target of the closure trampoline, as such r12 is + * a pointer to the closure object. + */ + .text + .globl ffi_closure_SYSV + .type ffi_closure_SYSV, @function +ffi_closure_SYSV: + /* push callee saves */ + addik r11, r1, 28 /* save stack args start location (excluding regs/link) */ + addik r1, r1, -12 + swi r19, r1, 0 /* Frame Pointer */ + swi r20, r1, 4 /* PIC register */ + swi r21, r1, 8 /* PIC register */ + + /* store register args on stack */ + addik r1, r1, -24 + swi r5, r1, 0 + swi r6, r1, 4 + swi r7, r1, 8 + swi r8, r1, 12 + swi r9, r1, 16 + swi r10, r1, 20 + + /* setup args */ + addik r5, r1, 0 /* register_args */ + addik r6, r11, 0 /* stack_args */ + addik r7, r12, 0 /* closure object */ + addik r1, r1, -8 /* allocate return value */ + addik r8, r1, 0 /* void* rvalue */ + addik r1, r1, -8 /* allocate for reutrn type/size values */ + addik r9, r1, 0 /* void* rtype */ + addik r10, r1, 4 /* void* rsize */ + + /* call the wrap_call function */ + addik r1, r1, -28 /* allocate args + link reg */ + swi r15, r1, 0 /* store the link register in the frame */ + brald r15, r3 + nop /* branch has delay slot */ + lwi r15, r1, 0 + addik r1, r1, 28 /* restore the link register from the frame */ + +ffi_closure_SYSV_prepare_return: + lwi r9, r1, 0 /* rtype */ + lwi r10, r1, 4 /* rsize */ + addik r1, r1, 8 /* de-allocate return info values */ + + /* Check if return type is actually a struct, store 4 bytes */ + rsubi r11, r9, FFI_TYPE_STRUCT + beqi r11, ffi_closure_SYSV_store32 + + /* Return 8bit */ + rsubi r11, r10, 1 + beqi r11, ffi_closure_SYSV_store8 + + /* Return 16bit */ + rsubi r11, r10, 2 + beqi r11, ffi_closure_SYSV_store16 + + /* Return 32bit */ + rsubi r11, r10, 4 + beqi r11, ffi_closure_SYSV_store32 + + /* Return 64bit */ + rsubi r11, r10, 8 + beqi r11, ffi_closure_SYSV_store64 + + /* Didnt match anything */ + bri ffi_closure_SYSV_end + +ffi_closure_SYSV_store64: + lwi r3, r1, 0 /* store word r3 into return value */ + lwi r4, r1, 4 /* store word r4 into return value */ + /* 64 bits == 2 words, no sign extend occurs */ + bri ffi_closure_SYSV_end + +ffi_closure_SYSV_store32: + lwi r3, r1, 0 /* store word r3 into return value */ + /* 32 bits == 1 word, no sign extend occurs */ + bri ffi_closure_SYSV_end + +ffi_closure_SYSV_store16: +#ifdef __BIG_ENDIAN__ + lhui r3, r1, 2 /* store half-word r3 into return value */ +#else + lhui r3, r1, 0 /* store half-word r3 into return value */ +#endif + rsubi r11, r9, FFI_TYPE_SINT16 + bnei r11, ffi_closure_SYSV_end + sext16 r3, r3 /* fix sign extend of sint8 */ + bri ffi_closure_SYSV_end + +ffi_closure_SYSV_store8: +#ifdef __BIG_ENDIAN__ + lbui r3, r1, 3 /* store byte r3 into return value */ +#else + lbui r3, r1, 0 /* store byte r3 into return value */ +#endif + rsubi r11, r9, FFI_TYPE_SINT8 + bnei r11, ffi_closure_SYSV_end + sext8 r3, r3 /* fix sign extend of sint8 */ + bri ffi_closure_SYSV_end + +ffi_closure_SYSV_end: + addik r1, r1, 8 /* de-allocate return value */ + + /* de-allocate stored args */ + addik r1, r1, 24 + + /* callee restores */ + lwi r19, r1, 0 /* frame pointer */ + lwi r20, r1, 4 /* PIC register */ + lwi r21, r1, 8 /* PIC register */ + addik r1, r1, 12 + + /* return from sub-routine (with delay slot) */ + rtsd r15, 8 + nop + + .size ffi_closure_SYSV, . - ffi_closure_SYSV diff --git a/Modules/_ctypes/libffi/src/mips/ffi.c b/Modules/_ctypes/libffi/src/mips/ffi.c --- a/Modules/_ctypes/libffi/src/mips/ffi.c +++ b/Modules/_ctypes/libffi/src/mips/ffi.c @@ -1,6 +1,7 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1996, 2007, 2008 Red Hat, Inc. - Copyright (c) 2008 David Daney + ffi.c - Copyright (c) 2011 Anthony Green + Copyright (c) 2008 David Daney + Copyright (c) 1996, 2007, 2008, 2011 Red Hat, Inc. MIPS Foreign Function Interface @@ -37,7 +38,11 @@ #endif #ifndef USE__BUILTIN___CLEAR_CACHE -#include +# if defined(__OpenBSD__) +# include +# else +# include +# endif #endif #ifdef FFI_DEBUG @@ -662,10 +667,19 @@ char *clear_location = (char *) codeloc; #if defined(FFI_MIPS_O32) - FFI_ASSERT(cif->abi == FFI_O32 || cif->abi == FFI_O32_SOFT_FLOAT); + if (cif->abi != FFI_O32 && cif->abi != FFI_O32_SOFT_FLOAT) + return FFI_BAD_ABI; fn = ffi_closure_O32; -#else /* FFI_MIPS_N32 */ - FFI_ASSERT(cif->abi == FFI_N32 || cif->abi == FFI_N64); +#else +#if _MIPS_SIM ==_ABIN32 + if (cif->abi != FFI_N32 + && cif->abi != FFI_N32_SOFT_FLOAT) + return FFI_BAD_ABI; +#else + if (cif->abi != FFI_N64 + && cif->abi != FFI_N64_SOFT_FLOAT) + return FFI_BAD_ABI; +#endif fn = ffi_closure_N32; #endif /* FFI_MIPS_O32 */ diff --git a/Modules/_ctypes/libffi/src/mips/ffitarget.h b/Modules/_ctypes/libffi/src/mips/ffitarget.h --- a/Modules/_ctypes/libffi/src/mips/ffitarget.h +++ b/Modules/_ctypes/libffi/src/mips/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for MIPS. Permission is hereby granted, free of charge, to any person obtaining @@ -27,11 +28,23 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #ifdef linux # include -#else +#elif defined(__rtems__) +/* + * Subprogram calling convention - copied from sgidefs.h + */ +#define _MIPS_SIM_ABI32 1 +#define _MIPS_SIM_NABI32 2 +#define _MIPS_SIM_ABI64 3 +#elif !defined(__OpenBSD__) # include #endif + # ifndef _ABIN32 # define _ABIN32 _MIPS_SIM_NABI32 # endif @@ -43,7 +56,7 @@ # endif #if !defined(_MIPS_SIM) --- something is very wrong -- +# error -- something is very wrong -- #else # if (_MIPS_SIM==_ABIN32 && defined(_ABIN32)) || (_MIPS_SIM==_ABI64 && defined(_ABI64)) # define FFI_MIPS_N32 @@ -51,7 +64,7 @@ # if (_MIPS_SIM==_ABIO32 && defined(_ABIO32)) # define FFI_MIPS_O32 # else --- this is an unsupported platform -- +# error -- this is an unsupported platform -- # endif # endif #endif @@ -186,30 +199,29 @@ FFI_O32_SOFT_FLOAT, FFI_N32_SOFT_FLOAT, FFI_N64_SOFT_FLOAT, + FFI_LAST_ABI, #ifdef FFI_MIPS_O32 #ifdef __mips_soft_float - FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT, + FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT #else - FFI_DEFAULT_ABI = FFI_O32, + FFI_DEFAULT_ABI = FFI_O32 #endif #else # if _MIPS_SIM==_ABI64 # ifdef __mips_soft_float - FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT, + FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT # else - FFI_DEFAULT_ABI = FFI_N64, + FFI_DEFAULT_ABI = FFI_N64 # endif # else # ifdef __mips_soft_float - FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT, + FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT # else - FFI_DEFAULT_ABI = FFI_N32, + FFI_DEFAULT_ABI = FFI_N32 # endif # endif #endif - - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 } ffi_abi; #define FFI_EXTRA_CIF_FIELDS unsigned rstruct_flag diff --git a/Modules/_ctypes/libffi/src/mips/n32.S b/Modules/_ctypes/libffi/src/mips/n32.S --- a/Modules/_ctypes/libffi/src/mips/n32.S +++ b/Modules/_ctypes/libffi/src/mips/n32.S @@ -43,6 +43,7 @@ #ifdef __GNUC__ .abicalls #endif + .set mips4 .text .align 2 .globl ffi_call_N32 diff --git a/Modules/_ctypes/libffi/src/moxie/eabi.S b/Modules/_ctypes/libffi/src/moxie/eabi.S --- a/Modules/_ctypes/libffi/src/moxie/eabi.S +++ b/Modules/_ctypes/libffi/src/moxie/eabi.S @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- - eabi.S - Copyright (c) 2004 Anthony Green + eabi.S - Copyright (c) 2012, 2013 Anthony Green - FR-V Assembly glue. + Moxie Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -34,95 +34,68 @@ .globl ffi_call_EABI .type ffi_call_EABI, @function - # gr8 : ffi_prep_args - # gr9 : &ecif - # gr10: cif->bytes - # gr11: fig->flags - # gr12: ecif.rvalue - # gr13: fn + # $r0 : ffi_prep_args + # $r1 : &ecif + # $r2 : cif->bytes + # $r3 : fig->flags + # $r4 : ecif.rvalue + # $r5 : fn -ffi_call_EABI: - addi sp, #-80, sp - sti fp, @(sp, #24) - addi sp, #24, fp - movsg lr, gr5 +ffi_call_EABI: + push $sp, $r6 + push $sp, $r7 + push $sp, $r8 + dec $sp, 24 - /* Make room for the new arguments. */ - /* subi sp, fp, gr10 */ - - /* Store return address and incoming args on stack. */ - sti gr5, @(fp, #8) - sti gr8, @(fp, #-4) - sti gr9, @(fp, #-8) - sti gr10, @(fp, #-12) - sti gr11, @(fp, #-16) - sti gr12, @(fp, #-20) - sti gr13, @(fp, #-24) - - sub sp, gr10, sp + /* Store incoming args on stack. */ + sto.l 0($sp), $r0 /* ffi_prep_args */ + sto.l 4($sp), $r1 /* ecif */ + sto.l 8($sp), $r2 /* bytes */ + sto.l 12($sp), $r3 /* flags */ + sto.l 16($sp), $r4 /* &rvalue */ + sto.l 20($sp), $r5 /* fn */ /* Call ffi_prep_args. */ - ldi @(fp, #-4), gr4 - addi sp, #0, gr8 - ldi @(fp, #-8), gr9 -#ifdef __FRV_FDPIC__ - ldd @(gr4, gr0), gr14 - calll @(gr14, gr0) -#else - calll @(gr4, gr0) -#endif + mov $r6, $r4 /* Save result buffer */ + mov $r7, $r5 /* Save the target fn */ + mov $r8, $r3 /* Save the flags */ + sub.l $sp, $r2 /* Allocate stack space */ + mov $r0, $sp /* We can stomp over $r0 */ + /* $r1 is already set up */ + jsra ffi_prep_args - /* ffi_prep_args returns the new stack pointer. */ - mov gr8, gr4 - - ldi @(sp, #0), gr8 - ldi @(sp, #4), gr9 - ldi @(sp, #8), gr10 - ldi @(sp, #12), gr11 - ldi @(sp, #16), gr12 - ldi @(sp, #20), gr13 - - /* Always copy the return value pointer into the hidden - parameter register. This is only strictly necessary - when we're returning an aggregate type, but it doesn't - hurt to do this all the time, and it saves a branch. */ - ldi @(fp, #-20), gr3 - - /* Use the ffi_prep_args return value for the new sp. */ - mov gr4, sp + /* Load register arguments. */ + ldo.l $r0, 0($sp) + ldo.l $r1, 4($sp) + ldo.l $r2, 8($sp) + ldo.l $r3, 12($sp) + ldo.l $r4, 16($sp) + ldo.l $r5, 20($sp) /* Call the target function. */ - ldi @(fp, -24), gr4 -#ifdef __FRV_FDPIC__ - ldd @(gr4, gr0), gr14 - calll @(gr14, gr0) -#else - calll @(gr4, gr0) -#endif + jsr $r7 - /* Store the result. */ - ldi @(fp, #-16), gr10 /* fig->flags */ - ldi @(fp, #-20), gr4 /* ecif.rvalue */ + ldi.l $r7, 0xffffffff + cmp $r8, $r7 + beq retstruct - /* Is the return value stored in two registers? */ - cmpi gr10, #8, icc0 - bne icc0, 0, .L2 - /* Yes, save them. */ - sti gr8, @(gr4, #0) - sti gr9, @(gr4, #4) - bra .L3 -.L2: - /* Is the return value a structure? */ - cmpi gr10, #-1, icc0 - beq icc0, 0, .L3 - /* No, save a 4 byte return value. */ - sti gr8, @(gr4, #0) -.L3: + ldi.l $r7, 4 + cmp $r8, $r7 + bgt ret2reg - /* Restore the stack, and return. */ - ldi @(fp, 8), gr5 - ld @(fp, gr0), fp - addi sp,#80,sp - jmpl @(gr5,gr0) + st.l ($r6), $r0 + jmpa retdone + +ret2reg: + st.l ($r6), $r0 + sto.l 4($r6), $r1 + +retstruct: +retdone: + /* Return. */ + ldo.l $r6, -4($fp) + ldo.l $r7, -8($fp) + ldo.l $r8, -12($fp) + ret .size ffi_call_EABI, .-ffi_call_EABI diff --git a/Modules/_ctypes/libffi/src/moxie/ffi.c b/Modules/_ctypes/libffi/src/moxie/ffi.c --- a/Modules/_ctypes/libffi/src/moxie/ffi.c +++ b/Modules/_ctypes/libffi/src/moxie/ffi.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (C) 2009 Anthony Green + ffi.c - Copyright (C) 2012, 2013 Anthony Green Moxie Foreign Function Interface @@ -43,6 +43,12 @@ p_argv = ecif->avalue; argp = stack; + if (ecif->cif->rtype->type == FFI_TYPE_STRUCT) + { + *(void **) argp = ecif->rvalue; + argp += 4; + } + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++) @@ -56,17 +62,6 @@ z = sizeof(void*); *(void **) argp = *p_argv; } - /* if ((*p_arg)->type == FFI_TYPE_FLOAT) - { - if (count > 24) - { - // This is going on the stack. Turn it into a double. - *(double *) argp = (double) *(float*)(* p_argv); - z = sizeof(double); - } - else - *(void **) argp = *(void **)(* p_argv); - } */ else if (z < sizeof(int)) { z = sizeof(int); @@ -147,8 +142,7 @@ } else ecif.rvalue = rvalue; - - + switch (cif->abi) { case FFI_EABI: @@ -165,19 +159,25 @@ unsigned arg4, unsigned arg5, unsigned arg6) { /* This function is called by a trampoline. The trampoline stows a - pointer to the ffi_closure object in gr7. We must save this + pointer to the ffi_closure object in $r7. We must save this pointer in a place that will persist while we do our work. */ - register ffi_closure *creg __asm__ ("gr7"); + register ffi_closure *creg __asm__ ("$r12"); ffi_closure *closure = creg; /* Arguments that don't fit in registers are found on the stack at a fixed offset above the current frame pointer. */ - register char *frame_pointer __asm__ ("fp"); - char *stack_args = frame_pointer + 16; + register char *frame_pointer __asm__ ("$fp"); + + /* Pointer to a struct return value. */ + void *struct_rvalue = (void *) arg1; + + /* 6 words reserved for register args + 3 words from jsr */ + char *stack_args = frame_pointer + 9*4; /* Lay the register arguments down in a continuous chunk of memory. */ unsigned register_args[6] = { arg1, arg2, arg3, arg4, arg5, arg6 }; + char *register_args_ptr = (char *) register_args; ffi_cif *cif = closure->cif; ffi_type **arg_types = cif->arg_types; @@ -185,6 +185,12 @@ char *ptr = (char *) register_args; int i; + /* preserve struct type return pointer passing */ + if ((cif->rtype != NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { + ptr += 4; + register_args_ptr = (char *)®ister_args[1]; + } + /* Find the address of each argument. */ for (i = 0; i < cif->nargs; i++) { @@ -201,6 +207,7 @@ case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_FLOAT: + case FFI_TYPE_POINTER: avalue[i] = ptr; break; case FFI_TYPE_STRUCT: @@ -216,30 +223,21 @@ /* If we've handled more arguments than fit in registers, start looking at the those passed on the stack. */ - if (ptr == ((char *)register_args + (6*4))) + if (ptr == ®ister_args[6]) ptr = stack_args; } /* Invoke the closure. */ - if (cif->rtype->type == FFI_TYPE_STRUCT) + if (cif->rtype && (cif->rtype->type == FFI_TYPE_STRUCT)) { - /* The caller allocates space for the return structure, and - passes a pointer to this space in gr3. Use this value directly - as the return value. */ - register void *return_struct_ptr __asm__("gr3"); - (closure->fun) (cif, return_struct_ptr, avalue, closure->user_data); + (closure->fun) (cif, struct_rvalue, avalue, closure->user_data); } else { /* Allocate space for the return value and call the function. */ long long rvalue; (closure->fun) (cif, &rvalue, avalue, closure->user_data); - - /* Functions return 4-byte or smaller results in gr8. 8-byte - values also use gr9. We fill the both, even for small return - values, just to avoid a branch. */ - asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue)); - asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1])); + asm ("mov $r12, %0\n ld.l $r0, ($r12)\n ldo.l $r1, 4($r12)" : : "r" (&rvalue)); } } @@ -250,27 +248,25 @@ void *user_data, void *codeloc) { - unsigned int *tramp = (unsigned int *) &closure->tramp[0]; + unsigned short *tramp = (unsigned short *) &closure->tramp[0]; unsigned long fn = (long) ffi_closure_eabi; unsigned long cls = (long) codeloc; - int i; + + if (cif->abi != FFI_EABI) + return FFI_BAD_ABI; fn = (unsigned long) ffi_closure_eabi; - tramp[0] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ - tramp[1] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ - tramp[2] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ - tramp[3] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ - tramp[4] = 0x80300006; /* jmpl @(gr0, gr6) */ + tramp[0] = 0x01e0; /* ldi.l $r7, .... */ + tramp[1] = cls >> 16; + tramp[2] = cls & 0xffff; + tramp[3] = 0x1a00; /* jmpa .... */ + tramp[4] = fn >> 16; + tramp[5] = fn & 0xffff; closure->cif = cif; closure->fun = fun; closure->user_data = user_data; - /* Cache flushing. */ - for (i = 0; i < FFI_TRAMPOLINE_SIZE; i++) - __asm__ volatile ("dcf @(%0,%1)\n\tici @(%2,%1)" :: "r" (tramp), "r" (i), - "r" (codeloc)); - return FFI_OK; } diff --git a/Modules/_ctypes/libffi/src/moxie/ffitarget.h b/Modules/_ctypes/libffi/src/moxie/ffitarget.h --- a/Modules/_ctypes/libffi/src/moxie/ffitarget.h +++ b/Modules/_ctypes/libffi/src/moxie/ffitarget.h @@ -1,5 +1,5 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2009 Anthony Green + ffitarget.h - Copyright (c) 2012, 2013 Anthony Green Target configuration macros for Moxie Permission is hereby granted, free of charge, to any person obtaining @@ -35,22 +35,18 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, - -#ifdef MOXIE FFI_EABI, FFI_DEFAULT_ABI = FFI_EABI, -#endif - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ -#define FFI_CLOSURES 0 +#define FFI_CLOSURES 1 #define FFI_NATIVE_RAW_API 0 -/* Trampolines are 5 4-byte instructions long. */ -#define FFI_TRAMPOLINE_SIZE (5*4) +/* Trampolines are 12-bytes long. See ffi_prep_closure_loc. */ +#define FFI_TRAMPOLINE_SIZE (12) #endif diff --git a/Modules/_ctypes/libffi/src/pa/ffi.c b/Modules/_ctypes/libffi/src/pa/ffi.c --- a/Modules/_ctypes/libffi/src/pa/ffi.c +++ b/Modules/_ctypes/libffi/src/pa/ffi.c @@ -1,9 +1,11 @@ /* ----------------------------------------------------------------------- - ffi.c - (c) 2003-2004 Randolph Chung + ffi.c - (c) 2011 Anthony Green (c) 2008 Red Hat, Inc. - + (c) 2006 Free Software Foundation, Inc. + (c) 2003-2004 Randolph Chung + HPPA Foreign Function Interface - HP-UX PA ABI support (c) 2006 Free Software Foundation, Inc. + HP-UX PA ABI support Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -633,7 +635,8 @@ UINT32 *tmp; #endif - FFI_ASSERT (cif->abi == FFI_PA32); + if (cif->abi != FFI_PA32) + return FFI_BAD_ABI; /* Make a small trampoline that will branch to our handler function. Use PC-relative addressing. */ diff --git a/Modules/_ctypes/libffi/src/pa/ffitarget.h b/Modules/_ctypes/libffi/src/pa/ffitarget.h --- a/Modules/_ctypes/libffi/src/pa/ffitarget.h +++ b/Modules/_ctypes/libffi/src/pa/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for hppa. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- System specific configurations ----------------------------------- */ #ifndef LIBFFI_ASM @@ -38,21 +43,22 @@ #ifdef PA_LINUX FFI_PA32, - FFI_DEFAULT_ABI = FFI_PA32, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_PA32 #endif #ifdef PA_HPUX FFI_PA32, - FFI_DEFAULT_ABI = FFI_PA32, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_PA32 #endif #ifdef PA64_HPUX #error "PA64_HPUX FFI is not yet implemented" FFI_PA64, - FFI_DEFAULT_ABI = FFI_PA64, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_PA64 #endif - - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/powerpc/aix.S b/Modules/_ctypes/libffi/src/powerpc/aix.S --- a/Modules/_ctypes/libffi/src/powerpc/aix.S +++ b/Modules/_ctypes/libffi/src/powerpc/aix.S @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - aix.S - Copyright (c) 2002,2009 Free Software Foundation, Inc. + aix.S - Copyright (c) 2002, 2009 Free Software Foundation, Inc. based on darwin.S by John Hornkvist PowerPC Assembly glue. @@ -79,6 +79,8 @@ .set f20,20 .set f21,21 + .extern .ffi_prep_args + #define LIBFFI_ASM #include #include @@ -125,6 +127,7 @@ /* Call ffi_prep_args. */ mr r4, r1 bl .ffi_prep_args + nop /* Now do the call. */ ld r0, 0(r29) @@ -134,7 +137,7 @@ mtcrf 0x40, r31 mtctr r0 /* Load all those argument registers. */ - // We have set up a nice stack frame, just load it into registers. + /* We have set up a nice stack frame, just load it into registers. */ ld r3, 40+(1*8)(r1) ld r4, 40+(2*8)(r1) ld r5, 40+(3*8)(r1) @@ -147,7 +150,7 @@ L1: /* Load all the FP registers. */ - bf 6,L2 // 2f + 0x18 + bf 6,L2 /* 2f + 0x18 */ lfd f1,-32-(13*8)(r28) lfd f2,-32-(12*8)(r28) lfd f3,-32-(11*8)(r28) @@ -226,6 +229,7 @@ /* Call ffi_prep_args. */ mr r4, r1 bl .ffi_prep_args + nop /* Now do the call. */ lwz r0, 0(r29) @@ -235,7 +239,7 @@ mtcrf 0x40, r31 mtctr r0 /* Load all those argument registers. */ - // We have set up a nice stack frame, just load it into registers. + /* We have set up a nice stack frame, just load it into registers. */ lwz r3, 20+(1*4)(r1) lwz r4, 20+(2*4)(r1) lwz r5, 20+(3*4)(r1) @@ -248,7 +252,7 @@ L1: /* Load all the FP registers. */ - bf 6,L2 // 2f + 0x18 + bf 6,L2 /* 2f + 0x18 */ lfd f1,-16-(13*8)(r28) lfd f2,-16-(12*8)(r28) lfd f3,-16-(11*8)(r28) @@ -303,7 +307,7 @@ #endif .long 0 .byte 0,0,0,1,128,4,0,0 -//END(ffi_call_AIX) +/* END(ffi_call_AIX) */ .csect .text[PR] .align 2 @@ -321,4 +325,4 @@ blr .long 0 .byte 0,0,0,0,0,0,0,0 -//END(ffi_call_DARWIN) +/* END(ffi_call_DARWIN) */ diff --git a/Modules/_ctypes/libffi/src/powerpc/aix_closure.S b/Modules/_ctypes/libffi/src/powerpc/aix_closure.S --- a/Modules/_ctypes/libffi/src/powerpc/aix_closure.S +++ b/Modules/_ctypes/libffi/src/powerpc/aix_closure.S @@ -79,6 +79,8 @@ .set f20,20 .set f21,21 + .extern .ffi_closure_helper_DARWIN + #define LIBFFI_ASM #define JUMPTARGET(name) name #define L(x) x @@ -165,6 +167,7 @@ /* look up the proper starting point in table */ /* by using return type as offset */ + lhz r3, 10(r3) /* load type from return type */ ld r4, LC..60(2) /* get address of jump table */ sldi r3, r3, 4 /* now multiply return type by 16 */ ld r0, 240+16(r1) /* load return address */ @@ -337,8 +340,9 @@ /* look up the proper starting point in table */ /* by using return type as offset */ + lhz r3, 6(r3) /* load type from return type */ lwz r4, LC..60(2) /* get address of jump table */ - slwi r3, r3, 4 /* now multiply return type by 4 */ + slwi r3, r3, 4 /* now multiply return type by 16 */ lwz r0, 176+8(r1) /* load return address */ add r3, r3, r4 /* add contents of table to table address */ mtctr r3 diff --git a/Modules/_ctypes/libffi/src/powerpc/asm.h b/Modules/_ctypes/libffi/src/powerpc/asm.h --- a/Modules/_ctypes/libffi/src/powerpc/asm.h +++ b/Modules/_ctypes/libffi/src/powerpc/asm.h @@ -42,7 +42,7 @@ /* If compiled for profiling, call `_mcount' at the start of each function. */ #ifdef PROF -/* The mcount code relies on a the return address being on the stack +/* The mcount code relies on the return address being on the stack to locate our caller and so it can restore it; so store one just for its benefit. */ #ifdef PIC diff --git a/Modules/_ctypes/libffi/src/powerpc/darwin.S b/Modules/_ctypes/libffi/src/powerpc/darwin.S --- a/Modules/_ctypes/libffi/src/powerpc/darwin.S +++ b/Modules/_ctypes/libffi/src/powerpc/darwin.S @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- darwin.S - Copyright (c) 2000 John Hornkvist - Copyright (c) 2004 Free Software Foundation, Inc. + Copyright (c) 2004, 2010 Free Software Foundation, Inc. PowerPC Assembly glue. @@ -24,51 +24,92 @@ OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ +#define LIBFFI_ASM #if defined(__ppc64__) #define MODE_CHOICE(x, y) y #else #define MODE_CHOICE(x, y) x #endif -#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ +#define machine_choice MODE_CHOICE(ppc7400,ppc64) -#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ +; Define some pseudo-opcodes for size-independent load & store of GPRs ... +#define lgu MODE_CHOICE(lwzu, ldu) +#define lg MODE_CHOICE(lwz,ld) +#define sg MODE_CHOICE(stw,std) +#define sgu MODE_CHOICE(stwu,stdu) +#define sgux MODE_CHOICE(stwux,stdux) -#define LIBFFI_ASM +; ... and the size of GPRs and their storage indicator. +#define GPR_BYTES MODE_CHOICE(4,8) +#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ +#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ + +; From the ABI doc: "Mac OS X ABI Function Call Guide" Version 2009-02-04. +#define LINKAGE_SIZE MODE_CHOICE(24,48) +#define PARAM_AREA MODE_CHOICE(32,64) +#define SAVED_LR_OFFSET MODE_CHOICE(8,16) /* save position for lr */ + +/* If there is any FP stuff we make space for all of the regs. */ +#define SAVED_FPR_COUNT 13 +#define FPR_SIZE 8 +#define RESULT_BYTES 16 + +/* This should be kept in step with the same value in ffi_darwin.c. */ +#define ASM_NEEDS_REGISTERS 4 +#define SAVE_REGS_SIZE (ASM_NEEDS_REGISTERS * GPR_BYTES) + #include #include + #define JUMPTARGET(name) name #define L(x) x -.text + + .text .align 2 -.globl _ffi_prep_args + .globl _ffi_prep_args -.text .align 2 -.globl _ffi_call_DARWIN -.text - .align 2 + .globl _ffi_call_DARWIN + + /* We arrive here with: + r3 = ptr to extended cif. + r4 = -bytes. + r5 = cif flags. + r6 = ptr to return value. + r7 = fn pointer (user func). + r8 = fn pointer (ffi_prep_args). + r9 = ffi_type* for the ret val. */ + _ffi_call_DARWIN: -LFB0: +Lstartcode: mr r12,r8 /* We only need r12 until the call, - so it doesn't have to be saved. */ + so it does not have to be saved. */ LFB1: /* Save the old stack pointer as AP. */ mr r8,r1 LCFI0: + + /* Save the retval type in parents frame. */ + sg r9,(LINKAGE_SIZE+6*GPR_BYTES)(r8) + /* Allocate the stack space we need. */ - stwux r1,r1,r4 + sgux r1,r1,r4 /* Save registers we use. */ mflr r9 + sg r9,SAVED_LR_OFFSET(r8) - stw r28,-16(r8) - stw r29,-12(r8) - stw r30,-8(r8) - stw r31,-4(r8) + sg r28,-(4 * GPR_BYTES)(r8) + sg r29,-(3 * GPR_BYTES)(r8) + sg r30,-(2 * GPR_BYTES)(r8) + sg r31,-( GPR_BYTES)(r8) - stw r9,8(r8) - stw r2,20(r1) +#if !defined(POWERPC_DARWIN) + /* The TOC slot is reserved in the Darwin ABI and r2 is volatile. */ + sg r2,(5 * GPR_BYTES)(r1) +#endif + LCFI1: /* Save arguments over call. */ @@ -77,14 +118,17 @@ mr r29,r7 /* function address, */ mr r28,r8 /* our AP. */ LCFI2: - /* Call ffi_prep_args. */ + /* Call ffi_prep_args. r3 = extended cif, r4 = stack ptr copy. */ mr r4,r1 li r9,0 mtctr r12 /* r12 holds address of _ffi_prep_args. */ bctrl - lwz r2,20(r1) +#if !defined(POWERPC_DARWIN) + /* The TOC slot is reserved in the Darwin ABI and r2 is volatile. */ + lg r2,(5 * GPR_BYTES)(r1) +#endif /* Now do the call. Set up cr1 with bits 4-7 of the flags. */ mtcrf 0x40,r31 @@ -92,71 +136,130 @@ mtctr r29 /* Load all those argument registers. We have set up a nice stack frame, just load it into registers. */ - lwz r3,20+(1*4)(r1) - lwz r4,20+(2*4)(r1) - lwz r5,20+(3*4)(r1) - lwz r6,20+(4*4)(r1) + lg r3, (LINKAGE_SIZE )(r1) + lg r4, (LINKAGE_SIZE + GPR_BYTES)(r1) + lg r5, (LINKAGE_SIZE + 2 * GPR_BYTES)(r1) + lg r6, (LINKAGE_SIZE + 3 * GPR_BYTES)(r1) nop - lwz r7,20+(5*4)(r1) - lwz r8,20+(6*4)(r1) - lwz r9,20+(7*4)(r1) - lwz r10,20+(8*4)(r1) + lg r7, (LINKAGE_SIZE + 4 * GPR_BYTES)(r1) + lg r8, (LINKAGE_SIZE + 5 * GPR_BYTES)(r1) + lg r9, (LINKAGE_SIZE + 6 * GPR_BYTES)(r1) + lg r10,(LINKAGE_SIZE + 7 * GPR_BYTES)(r1) L1: - /* Load all the FP registers. */ + /* ... Load all the FP registers. */ bf 6,L2 /* No floats to load. */ - lfd f1,-16-(13*8)(r28) - lfd f2,-16-(12*8)(r28) - lfd f3,-16-(11*8)(r28) - lfd f4,-16-(10*8)(r28) + lfd f1, -SAVE_REGS_SIZE-(13*FPR_SIZE)(r28) + lfd f2, -SAVE_REGS_SIZE-(12*FPR_SIZE)(r28) + lfd f3, -SAVE_REGS_SIZE-(11*FPR_SIZE)(r28) + lfd f4, -SAVE_REGS_SIZE-(10*FPR_SIZE)(r28) nop - lfd f5,-16-(9*8)(r28) - lfd f6,-16-(8*8)(r28) - lfd f7,-16-(7*8)(r28) - lfd f8,-16-(6*8)(r28) + lfd f5, -SAVE_REGS_SIZE-( 9*FPR_SIZE)(r28) + lfd f6, -SAVE_REGS_SIZE-( 8*FPR_SIZE)(r28) + lfd f7, -SAVE_REGS_SIZE-( 7*FPR_SIZE)(r28) + lfd f8, -SAVE_REGS_SIZE-( 6*FPR_SIZE)(r28) nop - lfd f9,-16-(5*8)(r28) - lfd f10,-16-(4*8)(r28) - lfd f11,-16-(3*8)(r28) - lfd f12,-16-(2*8)(r28) + lfd f9, -SAVE_REGS_SIZE-( 5*FPR_SIZE)(r28) + lfd f10,-SAVE_REGS_SIZE-( 4*FPR_SIZE)(r28) + lfd f11,-SAVE_REGS_SIZE-( 3*FPR_SIZE)(r28) + lfd f12,-SAVE_REGS_SIZE-( 2*FPR_SIZE)(r28) nop - lfd f13,-16-(1*8)(r28) + lfd f13,-SAVE_REGS_SIZE-( 1*FPR_SIZE)(r28) L2: mr r12,r29 /* Put the target address in r12 as specified. */ mtctr r12 nop nop + /* Make the call. */ bctrl /* Now, deal with the return value. */ - mtcrf 0x01,r31 - bt 30,L(done_return_value) - bt 29,L(fp_return_value) - stw r3,0(r30) - bf 28,L(done_return_value) - stw r4,4(r30) + /* m64 structure returns can occupy the same set of registers as + would be used to pass such a structure as arg0 - so take care + not to step on any possibly hot regs. */ - /* Fall through. */ + /* Get the flags.. */ + mtcrf 0x03,r31 ; we need c6 & cr7 now. + ; FLAG_RETURNS_NOTHING also covers struct ret-by-ref. + bt 30,L(done_return_value) ; FLAG_RETURNS_NOTHING + bf 27,L(scalar_return_value) ; not FLAG_RETURNS_STRUCT + + /* OK, so we have a struct. */ +#if defined(__ppc64__) + bt 31,L(maybe_return_128) ; FLAG_RETURNS_128BITS, special case -L(done_return_value): - /* Restore the registers we used and return. */ - lwz r9,8(r28) - lwz r31,-4(r28) - mtlr r9 - lwz r30,-8(r28) - lwz r29,-12(r28) - lwz r28,-16(r28) - lwz r1,0(r1) - blr + /* OK, we have to map the return back to a mem struct. + We are about to trample the parents param area, so recover the + return type. r29 is free, since the call is done. */ + lg r29,(LINKAGE_SIZE + 6 * GPR_BYTES)(r28) + + sg r3, (LINKAGE_SIZE )(r28) + sg r4, (LINKAGE_SIZE + GPR_BYTES)(r28) + sg r5, (LINKAGE_SIZE + 2 * GPR_BYTES)(r28) + sg r6, (LINKAGE_SIZE + 3 * GPR_BYTES)(r28) + nop + sg r7, (LINKAGE_SIZE + 4 * GPR_BYTES)(r28) + sg r8, (LINKAGE_SIZE + 5 * GPR_BYTES)(r28) + sg r9, (LINKAGE_SIZE + 6 * GPR_BYTES)(r28) + sg r10,(LINKAGE_SIZE + 7 * GPR_BYTES)(r28) + /* OK, so do the block move - we trust that memcpy will not trample + the fprs... */ + mr r3,r30 ; dest + addi r4,r28,LINKAGE_SIZE ; source + /* The size is a size_t, should be long. */ + lg r5,0(r29) + /* Figure out small structs */ + cmpi 0,r5,4 + bgt L3 ; 1, 2 and 4 bytes have special rules. + cmpi 0,r5,3 + beq L3 ; not 3 + addi r4,r4,8 + subf r4,r5,r4 +L3: + bl _memcpy + + /* ... do we need the FP registers? - recover the flags.. */ + mtcrf 0x03,r31 ; we need c6 & cr7 now. + bf 29,L(done_return_value) /* No floats in the struct. */ + stfd f1, -SAVE_REGS_SIZE-(13*FPR_SIZE)(r28) + stfd f2, -SAVE_REGS_SIZE-(12*FPR_SIZE)(r28) + stfd f3, -SAVE_REGS_SIZE-(11*FPR_SIZE)(r28) + stfd f4, -SAVE_REGS_SIZE-(10*FPR_SIZE)(r28) + nop + stfd f5, -SAVE_REGS_SIZE-( 9*FPR_SIZE)(r28) + stfd f6, -SAVE_REGS_SIZE-( 8*FPR_SIZE)(r28) + stfd f7, -SAVE_REGS_SIZE-( 7*FPR_SIZE)(r28) + stfd f8, -SAVE_REGS_SIZE-( 6*FPR_SIZE)(r28) + nop + stfd f9, -SAVE_REGS_SIZE-( 5*FPR_SIZE)(r28) + stfd f10,-SAVE_REGS_SIZE-( 4*FPR_SIZE)(r28) + stfd f11,-SAVE_REGS_SIZE-( 3*FPR_SIZE)(r28) + stfd f12,-SAVE_REGS_SIZE-( 2*FPR_SIZE)(r28) + nop + stfd f13,-SAVE_REGS_SIZE-( 1*FPR_SIZE)(r28) + + mr r3,r29 ; ffi_type * + mr r4,r30 ; dest + addi r5,r28,-SAVE_REGS_SIZE-(13*FPR_SIZE) ; fprs + xor r6,r6,r6 + sg r6,(LINKAGE_SIZE + 7 * GPR_BYTES)(r28) + addi r6,r28,(LINKAGE_SIZE + 7 * GPR_BYTES) ; point to a zeroed counter. + bl _darwin64_struct_floats_to_mem + + b L(done_return_value) +#else + stw r3,0(r30) ; m32 the only struct return in reg is 4 bytes. +#endif + b L(done_return_value) L(fp_return_value): /* Do we have long double to store? */ - bf 31,L(fd_return_value) + bf 31,L(fd_return_value) ; FLAG_RETURNS_128BITS stfd f1,0(r30) - stfd f2,8(r30) + stfd f2,FPR_SIZE(r30) b L(done_return_value) L(fd_return_value): @@ -170,21 +273,57 @@ stfs f1,0(r30) b L(done_return_value) +L(scalar_return_value): + bt 29,L(fp_return_value) ; FLAG_RETURNS_FP + ; ffi_arg is defined as unsigned long. + sg r3,0(r30) ; Save the reg. + bf 28,L(done_return_value) ; not FLAG_RETURNS_64BITS + +#if defined(__ppc64__) +L(maybe_return_128): + std r3,0(r30) + bf 31,L(done_return_value) ; not FLAG_RETURNS_128BITS + std r4,8(r30) +#else + stw r4,4(r30) +#endif + + /* Fall through. */ + /* We want this at the end to simplify eh epilog computation. */ + +L(done_return_value): + /* Restore the registers we used and return. */ + lg r29,SAVED_LR_OFFSET(r28) + ; epilog + lg r31,-(1 * GPR_BYTES)(r28) + mtlr r29 + lg r30,-(2 * GPR_BYTES)(r28) + lg r29,-(3 * GPR_BYTES)(r28) + lg r28,-(4 * GPR_BYTES)(r28) + lg r1,0(r1) + blr LFE1: + .align 1 /* END(_ffi_call_DARWIN) */ /* Provide a null definition of _ffi_call_AIX. */ -.text - .align 2 -.globl _ffi_call_AIX -.text + .text + .globl _ffi_call_AIX .align 2 _ffi_call_AIX: blr /* END(_ffi_call_AIX) */ -.data -.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms +/* EH stuff. */ + +#define EH_DATA_ALIGN_FACT MODE_CHOICE(0x7c,0x78) + + .static_data + .align LOG2_GPR_BYTES +LLFB0$non_lazy_ptr: + .g_long Lstartcode + + .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support EH_frame1: .set L$set$0,LECIE1-LSCIE1 .long L$set$0 ; Length of Common Information Entry @@ -193,16 +332,17 @@ .byte 0x1 ; CIE Version .ascii "zR\0" ; CIE Augmentation .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor - .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor + .byte EH_DATA_ALIGN_FACT ; sleb128 -4; CIE Data Alignment Factor .byte 0x41 ; CIE RA Column .byte 0x1 ; uleb128 0x1; Augmentation size - .byte 0x90 ; FDE Encoding (indirect pcrel) + .byte 0x10 ; FDE Encoding (indirect pcrel) .byte 0xc ; DW_CFA_def_cfa .byte 0x1 ; uleb128 0x1 .byte 0x0 ; uleb128 0x0 .align LOG2_GPR_BYTES LECIE1: -.globl _ffi_call_DARWIN.eh + + .globl _ffi_call_DARWIN.eh _ffi_call_DARWIN.eh: LSFDE1: .set L$set$1,LEFDE1-LASFDE1 @@ -210,11 +350,11 @@ LASFDE1: .long LASFDE1-EH_frame1 ; FDE CIE offset .g_long LLFB0$non_lazy_ptr-. ; FDE initial location - .set L$set$3,LFE1-LFB0 + .set L$set$3,LFE1-Lstartcode .g_long L$set$3 ; FDE address range .byte 0x0 ; uleb128 0x0; Augmentation size .byte 0x4 ; DW_CFA_advance_loc4 - .set L$set$4,LCFI0-LFB1 + .set L$set$4,LCFI0-Lstartcode .long L$set$4 .byte 0xd ; DW_CFA_def_cfa_register .byte 0x08 ; uleb128 0x08 @@ -239,7 +379,5 @@ .byte 0x1c ; uleb128 0x1c .align LOG2_GPR_BYTES LEFDE1: -.data - .align LOG2_GPR_BYTES -LLFB0$non_lazy_ptr: - .g_long LFB0 + .align 1 + diff --git a/Modules/_ctypes/libffi/src/powerpc/darwin_closure.S b/Modules/_ctypes/libffi/src/powerpc/darwin_closure.S --- a/Modules/_ctypes/libffi/src/powerpc/darwin_closure.S +++ b/Modules/_ctypes/libffi/src/powerpc/darwin_closure.S @@ -1,6 +1,7 @@ /* ----------------------------------------------------------------------- - darwin_closure.S - Copyright (c) 2002, 2003, 2004, Free Software Foundation, - Inc. based on ppc_closure.S + darwin_closure.S - Copyright (c) 2002, 2003, 2004, 2010, + Free Software Foundation, Inc. + based on ppc_closure.S PowerPC Assembly glue. @@ -33,91 +34,177 @@ #define MODE_CHOICE(x, y) x #endif -#define lgu MODE_CHOICE(lwzu, ldu) +#define machine_choice MODE_CHOICE(ppc7400,ppc64) -#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ +; Define some pseudo-opcodes for size-independent load & store of GPRs ... +#define lgu MODE_CHOICE(lwzu, ldu) +#define lg MODE_CHOICE(lwz,ld) +#define sg MODE_CHOICE(stw,std) +#define sgu MODE_CHOICE(stwu,stdu) -#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ +; ... and the size of GPRs and their storage indicator. +#define GPR_BYTES MODE_CHOICE(4,8) +#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ +#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ + +; From the ABI doc: "Mac OS X ABI Function Call Guide" Version 2009-02-04. +#define LINKAGE_SIZE MODE_CHOICE(24,48) +#define PARAM_AREA MODE_CHOICE(32,64) + +#define SAVED_CR_OFFSET MODE_CHOICE(4,8) /* save position for CR */ +#define SAVED_LR_OFFSET MODE_CHOICE(8,16) /* save position for lr */ + +/* WARNING: if ffi_type is changed... here be monsters. + Offsets of items within the result type. */ +#define FFI_TYPE_TYPE MODE_CHOICE(6,10) +#define FFI_TYPE_ELEM MODE_CHOICE(8,16) + +#define SAVED_FPR_COUNT 13 +#define FPR_SIZE 8 +/* biggest m64 struct ret is 8GPRS + 13FPRS = 168 bytes - rounded to 16bytes = 176. */ +#define RESULT_BYTES MODE_CHOICE(16,176) + +; The whole stack frame **MUST** be 16byte-aligned. +#define SAVE_SIZE (((LINKAGE_SIZE+PARAM_AREA+SAVED_FPR_COUNT*FPR_SIZE+RESULT_BYTES)+15) & -16LL) +#define PAD_SIZE (SAVE_SIZE-(LINKAGE_SIZE+PARAM_AREA+SAVED_FPR_COUNT*FPR_SIZE+RESULT_BYTES)) + +#define PARENT_PARM_BASE (SAVE_SIZE+LINKAGE_SIZE) +#define FP_SAVE_BASE (LINKAGE_SIZE+PARAM_AREA) + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 +; We no longer need the pic symbol stub for Darwin >= 9. +#define BLCLS_HELP _ffi_closure_helper_DARWIN +#define STRUCT_RETVALUE_P _darwin64_struct_ret_by_value_p +#define PASS_STR_FLOATS _darwin64_pass_struct_floats +#undef WANT_STUB +#else +#define BLCLS_HELP L_ffi_closure_helper_DARWIN$stub +#define STRUCT_RETVALUE_P L_darwin64_struct_ret_by_value_p$stub +#define PASS_STR_FLOATS L_darwin64_pass_struct_floats$stub +#define WANT_STUB +#endif + +/* m32/m64 + + The stack layout looks like this: + + | Additional params... | | Higher address + ~ ~ ~ + | Parameters (at least 8*4/8=32/64) | | NUM_GPR_ARG_REGISTERS + |--------------------------------------------| | + | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | + |--------------------------------------------| | + | Reserved 2*4/8 | | + |--------------------------------------------| | + | Space for callee`s LR 4/8 | | + |--------------------------------------------| | + | Saved CR [low word for m64] 4/8 | | + |--------------------------------------------| | + | Current backchain pointer 4/8 |-/ Parent`s frame. + |--------------------------------------------| <+ <<< on entry to + | Result Bytes 16/176 | | + |--------------------------------------------| | + ~ padding to 16-byte alignment ~ ~ + |--------------------------------------------| | + | NUM_FPR_ARG_REGISTERS slots | | + | here fp13 .. fp1 13*8 | | + |--------------------------------------------| | + | R3..R10 8*4/8=32/64 | | NUM_GPR_ARG_REGISTERS + |--------------------------------------------| | + | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | + |--------------------------------------------| | stack | + | Reserved [compiler,binder] 2*4/8 | | grows | + |--------------------------------------------| | down V + | Space for callees LR 4/8 | | + |--------------------------------------------| | lower addresses + | Saved CR [low word for m64] 4/8 | | + |--------------------------------------------| | stack pointer here + | Current backchain pointer 4/8 |-/ during + |--------------------------------------------| <<< call. + +*/ .file "darwin_closure.S" -.text - .align LOG2_GPR_BYTES -.globl _ffi_closure_ASM -.text + .machine machine_choice + + .text + .globl _ffi_closure_ASM .align LOG2_GPR_BYTES _ffi_closure_ASM: LFB1: - mflr r0 /* extract return address */ - stw r0,8(r1) /* save the return address */ +Lstartcode: + mflr r0 /* extract return address */ + sg r0,SAVED_LR_OFFSET(r1) /* save the return address */ LCFI0: - /* 24 Bytes (Linkage Area) - 32 Bytes (outgoing parameter area, always reserved) - 104 Bytes (13*8 from FPR) - 16 Bytes (result) - 176 Bytes */ - - stwu r1,-176(r1) /* skip over caller save area - keep stack aligned to 16. */ + sgu r1,-SAVE_SIZE(r1) /* skip over caller save area + keep stack aligned to 16. */ LCFI1: /* We want to build up an area for the parameters passed in registers. (both floating point and integer) */ - /* We store gpr 3 to gpr 10 (aligned to 4) - in the parents outgoing area. */ - stw r3,200(r1) - stw r4,204(r1) - stw r5,208(r1) - stw r6,212(r1) - stw r7,216(r1) - stw r8,220(r1) - stw r9,224(r1) - stw r10,228(r1) + /* Put gpr 3 to gpr 10 in the parents outgoing area... + ... the remainder of any params that overflowed the regs will + follow here. */ + sg r3, (PARENT_PARM_BASE )(r1) + sg r4, (PARENT_PARM_BASE + GPR_BYTES )(r1) + sg r5, (PARENT_PARM_BASE + GPR_BYTES * 2)(r1) + sg r6, (PARENT_PARM_BASE + GPR_BYTES * 3)(r1) + sg r7, (PARENT_PARM_BASE + GPR_BYTES * 4)(r1) + sg r8, (PARENT_PARM_BASE + GPR_BYTES * 5)(r1) + sg r9, (PARENT_PARM_BASE + GPR_BYTES * 6)(r1) + sg r10,(PARENT_PARM_BASE + GPR_BYTES * 7)(r1) - /* We save fpr 1 to fpr 13. (aligned to 8) */ - stfd f1,56(r1) - stfd f2,64(r1) - stfd f3,72(r1) - stfd f4,80(r1) - stfd f5,88(r1) - stfd f6,96(r1) - stfd f7,104(r1) - stfd f8,112(r1) - stfd f9,120(r1) - stfd f10,128(r1) - stfd f11,136(r1) - stfd f12,144(r1) - stfd f13,152(r1) + /* We save fpr 1 to fpr 14 in our own save frame. */ + stfd f1, (FP_SAVE_BASE )(r1) + stfd f2, (FP_SAVE_BASE + FPR_SIZE )(r1) + stfd f3, (FP_SAVE_BASE + FPR_SIZE * 2 )(r1) + stfd f4, (FP_SAVE_BASE + FPR_SIZE * 3 )(r1) + stfd f5, (FP_SAVE_BASE + FPR_SIZE * 4 )(r1) + stfd f6, (FP_SAVE_BASE + FPR_SIZE * 5 )(r1) + stfd f7, (FP_SAVE_BASE + FPR_SIZE * 6 )(r1) + stfd f8, (FP_SAVE_BASE + FPR_SIZE * 7 )(r1) + stfd f9, (FP_SAVE_BASE + FPR_SIZE * 8 )(r1) + stfd f10,(FP_SAVE_BASE + FPR_SIZE * 9 )(r1) + stfd f11,(FP_SAVE_BASE + FPR_SIZE * 10)(r1) + stfd f12,(FP_SAVE_BASE + FPR_SIZE * 11)(r1) + stfd f13,(FP_SAVE_BASE + FPR_SIZE * 12)(r1) /* Set up registers for the routine that actually does the work get the context pointer from the trampoline. */ - mr r3,r11 + mr r3,r11 /* Now load up the pointer to the result storage. */ - addi r4,r1,160 + addi r4,r1,(SAVE_SIZE-RESULT_BYTES) /* Now load up the pointer to the saved gpr registers. */ - addi r5,r1,200 + addi r5,r1,PARENT_PARM_BASE /* Now load up the pointer to the saved fpr registers. */ - addi r6,r1,56 + addi r6,r1,FP_SAVE_BASE /* Make the call. */ - bl Lffi_closure_helper_DARWIN$stub + bl BLCLS_HELP - /* Now r3 contains the return type - so use it to look up in a table + /* r3 contains the rtype pointer... save it since we will need + it later. */ + sg r3,LINKAGE_SIZE(r1) ; ffi_type * result_type + lg r0,0(r3) ; size => r0 + lhz r3,FFI_TYPE_TYPE(r3) ; type => r3 + + /* The helper will have intercepted struture returns and inserted + the caller`s destination address for structs returned by ref. */ + + /* r3 contains the return type so use it to look up in a table so we know how to deal with each type. */ - /* Look up the proper starting point in table - by using return type as offset. */ - addi r5,r1,160 /* Get pointer to results area. */ - bl Lget_ret_type0_addr /* Get pointer to Lret_type0 into LR. */ - mflr r4 /* Move to r4. */ - slwi r3,r3,4 /* Now multiply return type by 16. */ - add r3,r3,r4 /* Add contents of table to table address. */ - mtctr r3 - bctr /* Jump to it. */ + addi r5,r1,(SAVE_SIZE-RESULT_BYTES) /* Otherwise, our return is here. */ + bl Lget_ret_type0_addr /* Get pointer to Lret_type0 into LR. */ + mflr r4 /* Move to r4. */ + slwi r3,r3,4 /* Now multiply return type by 16. */ + add r3,r3,r4 /* Add contents of table to table address. */ + mtctr r3 + bctr /* Jump to it. */ LFE1: /* Each of the ret_typeX code fragments has to be exactly 16 bytes long (4 instructions). For cache effectiveness we align to a 16 byte boundary @@ -140,7 +227,7 @@ /* case FFI_TYPE_INT */ Lret_type1: - lwz r3,0(r5) + lg r3,0(r5) b Lfinish nop nop @@ -168,85 +255,224 @@ /* case FFI_TYPE_UINT8 */ Lret_type5: +#if defined(__ppc64__) + lbz r3,7(r5) +#else lbz r3,3(r5) +#endif b Lfinish nop nop /* case FFI_TYPE_SINT8 */ Lret_type6: +#if defined(__ppc64__) + lbz r3,7(r5) +#else lbz r3,3(r5) +#endif extsb r3,r3 b Lfinish nop /* case FFI_TYPE_UINT16 */ Lret_type7: +#if defined(__ppc64__) + lhz r3,6(r5) +#else lhz r3,2(r5) +#endif b Lfinish nop nop /* case FFI_TYPE_SINT16 */ Lret_type8: +#if defined(__ppc64__) + lha r3,6(r5) +#else lha r3,2(r5) +#endif b Lfinish nop nop /* case FFI_TYPE_UINT32 */ Lret_type9: +#if defined(__ppc64__) + lwz r3,4(r5) +#else lwz r3,0(r5) +#endif b Lfinish nop nop /* case FFI_TYPE_SINT32 */ Lret_type10: +#if defined(__ppc64__) + lwz r3,4(r5) +#else lwz r3,0(r5) +#endif b Lfinish nop nop /* case FFI_TYPE_UINT64 */ Lret_type11: +#if defined(__ppc64__) + lg r3,0(r5) + b Lfinish + nop +#else lwz r3,0(r5) lwz r4,4(r5) b Lfinish +#endif nop /* case FFI_TYPE_SINT64 */ Lret_type12: +#if defined(__ppc64__) + lg r3,0(r5) + b Lfinish + nop +#else lwz r3,0(r5) lwz r4,4(r5) b Lfinish +#endif nop /* case FFI_TYPE_STRUCT */ Lret_type13: +#if defined(__ppc64__) + lg r3,0(r5) ; we need at least this... + cmpi 0,r0,4 + bgt Lstructend ; not a special small case + b Lsmallstruct ; see if we need more. +#else + cmpi 0,r0,4 + bgt Lfinish ; not by value + lg r3,0(r5) + b Lfinish +#endif +/* case FFI_TYPE_POINTER */ +Lret_type14: + lg r3,0(r5) b Lfinish nop nop - nop -/* case FFI_TYPE_POINTER */ -Lret_type14: - lwz r3,0(r5) - b Lfinish - nop - nop +#if defined(__ppc64__) +Lsmallstruct: + beq Lfour ; continuation of Lret13. + cmpi 0,r0,3 + beq Lfinish ; don`t adjust this - can`t be any floats here... + srdi r3,r3,48 + cmpi 0,r0,2 + beq Lfinish ; .. or here .. + srdi r3,r3,8 + b Lfinish ; .. or here. + +Lfour: + lg r6,LINKAGE_SIZE(r1) ; get the result type + lg r6,FFI_TYPE_ELEM(r6) ; elements array pointer + lg r6,0(r6) ; first element + lhz r0,FFI_TYPE_TYPE(r6) ; OK go the type + cmpi 0,r0,2 ; FFI_TYPE_FLOAT + bne Lfourint + lfs f1,0(r5) ; just one float in the struct. + b Lfinish + +Lfourint: + srdi r3,r3,32 ; four bytes. + b Lfinish + +Lstructend: + lg r3,LINKAGE_SIZE(r1) ; get the result type + bl STRUCT_RETVALUE_P + cmpi 0,r3,0 + beq Lfinish ; nope. + /* Recover a pointer to the results. */ + addi r11,r1,(SAVE_SIZE-RESULT_BYTES) + lg r3,0(r11) ; we need at least this... + lg r4,8(r11) + cmpi 0,r0,16 + beq Lfinish ; special case 16 bytes we don't consider floats. + + /* OK, frustratingly, the process of saving the struct to mem might have + messed with the FPRs, so we have to re-load them :(. + We`ll use our FPRs space again - calling: + void darwin64_pass_struct_floats (ffi_type *s, char *src, + unsigned *nfpr, double **fprs) + We`ll temporarily pinch the first two slots of the param area for local + vars used by the routine. */ + xor r6,r6,r6 + addi r5,r1,PARENT_PARM_BASE ; some space + sg r6,0(r5) ; *nfpr zeroed. + addi r6,r5,8 ; **fprs + addi r3,r1,FP_SAVE_BASE ; pointer to FPRs space + sg r3,0(r6) + mr r4,r11 ; the struct is here... + lg r3,LINKAGE_SIZE(r1) ; ffi_type * result_type. + bl PASS_STR_FLOATS ; get struct floats into FPR save space. + /* See if we used any floats */ + lwz r0,(SAVE_SIZE-RESULT_BYTES)(r1) + cmpi 0,r0,0 + beq Lstructints ; nope. + /* OK load `em up... */ + lfd f1, (FP_SAVE_BASE )(r1) + lfd f2, (FP_SAVE_BASE + FPR_SIZE )(r1) + lfd f3, (FP_SAVE_BASE + FPR_SIZE * 2 )(r1) + lfd f4, (FP_SAVE_BASE + FPR_SIZE * 3 )(r1) + lfd f5, (FP_SAVE_BASE + FPR_SIZE * 4 )(r1) + lfd f6, (FP_SAVE_BASE + FPR_SIZE * 5 )(r1) + lfd f7, (FP_SAVE_BASE + FPR_SIZE * 6 )(r1) + lfd f8, (FP_SAVE_BASE + FPR_SIZE * 7 )(r1) + lfd f9, (FP_SAVE_BASE + FPR_SIZE * 8 )(r1) + lfd f10,(FP_SAVE_BASE + FPR_SIZE * 9 )(r1) + lfd f11,(FP_SAVE_BASE + FPR_SIZE * 10)(r1) + lfd f12,(FP_SAVE_BASE + FPR_SIZE * 11)(r1) + lfd f13,(FP_SAVE_BASE + FPR_SIZE * 12)(r1) + + /* point back at our saved struct. */ +Lstructints: + addi r11,r1,(SAVE_SIZE-RESULT_BYTES) + lg r3,0(r11) ; we end up picking the + lg r4,8(r11) ; first two again. + lg r5,16(r11) + lg r6,24(r11) + lg r7,32(r11) + lg r8,40(r11) + lg r9,48(r11) + lg r10,56(r11) +#endif /* case done */ Lfinish: - addi r1,r1,176 /* Restore stack pointer. */ - lwz r0,8(r1) /* Get return address. */ - mtlr r0 /* Reset link register. */ + addi r1,r1,SAVE_SIZE /* Restore stack pointer. */ + lg r0,SAVED_LR_OFFSET(r1) /* Get return address. */ + mtlr r0 /* Reset link register. */ blr - +Lendcode: + .align 1 + /* END(ffi_closure_ASM) */ -.data -.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support +/* EH frame stuff. */ +#define EH_DATA_ALIGN_FACT MODE_CHOICE(0x7c,0x78) +/* 176, 400 */ +#define EH_FRAME_OFFSETA MODE_CHOICE(176,0x90) +#define EH_FRAME_OFFSETB MODE_CHOICE(1,3) + + .static_data + .align LOG2_GPR_BYTES +LLFB1$non_lazy_ptr: + .g_long Lstartcode + + .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support EH_frame1: .set L$set$0,LECIE1-LSCIE1 .long L$set$0 ; Length of Common Information Entry @@ -255,16 +481,16 @@ .byte 0x1 ; CIE Version .ascii "zR\0" ; CIE Augmentation .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor - .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor + .byte EH_DATA_ALIGN_FACT ; sleb128 -4; CIE Data Alignment Factor .byte 0x41 ; CIE RA Column .byte 0x1 ; uleb128 0x1; Augmentation size - .byte 0x90 ; FDE Encoding (indirect pcrel) + .byte 0x10 ; FDE Encoding (indirect pcrel) .byte 0xc ; DW_CFA_def_cfa .byte 0x1 ; uleb128 0x1 .byte 0x0 ; uleb128 0x0 .align LOG2_GPR_BYTES LECIE1: -.globl _ffi_closure_ASM.eh + .globl _ffi_closure_ASM.eh _ffi_closure_ASM.eh: LSFDE1: .set L$set$1,LEFDE1-LASFDE1 @@ -273,45 +499,78 @@ LASFDE1: .long LASFDE1-EH_frame1 ; FDE CIE offset .g_long LLFB1$non_lazy_ptr-. ; FDE initial location - .set L$set$3,LFE1-LFB1 + .set L$set$3,LFE1-Lstartcode .g_long L$set$3 ; FDE address range .byte 0x0 ; uleb128 0x0; Augmentation size .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$3,LCFI1-LCFI0 .long L$set$3 .byte 0xe ; DW_CFA_def_cfa_offset - .byte 176,1 ; uleb128 176 + .byte EH_FRAME_OFFSETA,EH_FRAME_OFFSETB ; uleb128 176,1/190,3 .byte 0x4 ; DW_CFA_advance_loc4 - .set L$set$4,LCFI0-LFB1 + .set L$set$4,LCFI0-Lstartcode .long L$set$4 .byte 0x11 ; DW_CFA_offset_extended_sf .byte 0x41 ; uleb128 0x41 .byte 0x7e ; sleb128 -2 .align LOG2_GPR_BYTES LEFDE1: -.data - .align LOG2_GPR_BYTES -LDFCM0: -.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 - .align LOG2_GPR_BYTES -Lffi_closure_helper_DARWIN$stub: -#if 1 + .align 1 + +#ifdef WANT_STUB + .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 + .align 5 +L_ffi_closure_helper_DARWIN$stub: .indirect_symbol _ffi_closure_helper_DARWIN - mflr r0 - bcl 20,31,LO$ffi_closure_helper_DARWIN -LO$ffi_closure_helper_DARWIN: - mflr r11 - addis r11,r11,ha16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN) - mtlr r0 - lgu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN)(r11) - mtctr r12 + mflr r0 + bcl 20,31,"L00000000001$spb" +"L00000000001$spb": + mflr r11 + addis r11,r11,ha16(L_ffi_closure_helper_DARWIN$lazy_ptr-"L00000000001$spb") + mtlr r0 + lwzu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr-"L00000000001$spb")(r11) + mtctr r12 bctr -.lazy_symbol_pointer + .lazy_symbol_pointer L_ffi_closure_helper_DARWIN$lazy_ptr: .indirect_symbol _ffi_closure_helper_DARWIN - .g_long dyld_stub_binding_helper + .g_long dyld_stub_binding_helper + +#if defined(__ppc64__) + .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 + .align 5 +L_darwin64_struct_ret_by_value_p$stub: + .indirect_symbol _darwin64_struct_ret_by_value_p + mflr r0 + bcl 20,31,"L00000000002$spb" +"L00000000002$spb": + mflr r11 + addis r11,r11,ha16(L_darwin64_struct_ret_by_value_p$lazy_ptr-"L00000000002$spb") + mtlr r0 + lwzu r12,lo16(L_darwin64_struct_ret_by_value_p$lazy_ptr-"L00000000002$spb")(r11) + mtctr r12 + bctr + .lazy_symbol_pointer +L_darwin64_struct_ret_by_value_p$lazy_ptr: + .indirect_symbol _darwin64_struct_ret_by_value_p + .g_long dyld_stub_binding_helper + + .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 + .align 5 +L_darwin64_pass_struct_floats$stub: + .indirect_symbol _darwin64_pass_struct_floats + mflr r0 + bcl 20,31,"L00000000003$spb" +"L00000000003$spb": + mflr r11 + addis r11,r11,ha16(L_darwin64_pass_struct_floats$lazy_ptr-"L00000000003$spb") + mtlr r0 + lwzu r12,lo16(L_darwin64_pass_struct_floats$lazy_ptr-"L00000000003$spb")(r11) + mtctr r12 + bctr + .lazy_symbol_pointer +L_darwin64_pass_struct_floats$lazy_ptr: + .indirect_symbol _darwin64_pass_struct_floats + .g_long dyld_stub_binding_helper +# endif #endif -.data - .align LOG2_GPR_BYTES -LLFB1$non_lazy_ptr: - .g_long LFB1 diff --git a/Modules/_ctypes/libffi/src/powerpc/ffi.c b/Modules/_ctypes/libffi/src/powerpc/ffi.c --- a/Modules/_ctypes/libffi/src/powerpc/ffi.c +++ b/Modules/_ctypes/libffi/src/powerpc/ffi.c @@ -1,7 +1,9 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998 Geoffrey Keating - Copyright (C) 2007, 2008 Free Software Foundation, Inc - Copyright (C) 2008 Red Hat, Inc + ffi.c - Copyright (C) 2011 Anthony Green + Copyright (C) 2011 Kyle Moffett + Copyright (C) 2008 Red Hat, Inc + Copyright (C) 2007, 2008 Free Software Foundation, Inc + Copyright (c) 1998 Geoffrey Keating PowerPC Foreign Function Interface @@ -39,32 +41,33 @@ /* The assembly depends on these exact flags. */ FLAG_RETURNS_SMST = 1 << (31-31), /* Used for FFI_SYSV small structs. */ FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */ +#ifndef __NO_FPRS__ FLAG_RETURNS_FP = 1 << (31-29), +#endif FLAG_RETURNS_64BITS = 1 << (31-28), FLAG_RETURNS_128BITS = 1 << (31-27), /* cr6 */ + FLAG_SYSV_SMST_R4 = 1 << (31-26), /* use r4 for FFI_SYSV 8 byte structs. */ FLAG_SYSV_SMST_R3 = 1 << (31-25), /* use r3 for FFI_SYSV 4 byte structs. */ - /* Bits (31-24) through (31-19) store shift value for SMST */ FLAG_ARG_NEEDS_COPY = 1 << (31- 7), +#ifndef __NO_FPRS__ FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ +#endif FLAG_4_GPR_ARGUMENTS = 1 << (31- 5), FLAG_RETVAL_REFERENCE = 1 << (31- 4) }; /* About the SYSV ABI. */ -unsigned int NUM_GPR_ARG_REGISTERS = 8; +#define ASM_NEEDS_REGISTERS 4 +#define NUM_GPR_ARG_REGISTERS 8 #ifndef __NO_FPRS__ -unsigned int NUM_FPR_ARG_REGISTERS = 8; -#else -unsigned int NUM_FPR_ARG_REGISTERS = 0; +# define NUM_FPR_ARG_REGISTERS 8 #endif -enum { ASM_NEEDS_REGISTERS = 4 }; - /* ffi_prep_args_SYSV is called by the assembly routine once stack space has been allocated for the function's arguments. @@ -113,10 +116,12 @@ valp gpr_base; int intarg_count; +#ifndef __NO_FPRS__ /* 'fpr_base' points at the space for fpr1, and grows upwards as we use FPR registers. */ valp fpr_base; int fparg_count; +#endif /* 'copy_space' grows down as we put structures in it. It should stay 16-byte aligned. */ @@ -125,9 +130,8 @@ /* 'next_arg' grows up as we put parameters in it. */ valp next_arg; - int i, ii MAYBE_UNUSED; + int i; ffi_type **ptr; - double double_tmp; union { void **v; char **c; @@ -143,21 +147,23 @@ size_t struct_copy_size; unsigned gprvalue; - if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) - NUM_FPR_ARG_REGISTERS = 0; - stacktop.c = (char *) stack + bytes; gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS; intarg_count = 0; +#ifndef __NO_FPRS__ + double double_tmp; fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS; fparg_count = 0; copy_space.c = ((flags & FLAG_FP_ARGUMENTS) ? fpr_base.c : gpr_base.c); +#else + copy_space.c = gpr_base.c; +#endif next_arg.u = stack + 2; /* Check that everything starts aligned properly. */ - FFI_ASSERT (((unsigned) (char *) stack & 0xF) == 0); - FFI_ASSERT (((unsigned) copy_space.c & 0xF) == 0); - FFI_ASSERT (((unsigned) stacktop.c & 0xF) == 0); + FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0); + FFI_ASSERT (((unsigned long) copy_space.c & 0xF) == 0); + FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0); FFI_ASSERT ((bytes & 0xF) == 0); FFI_ASSERT (copy_space.c >= next_arg.c); @@ -174,12 +180,28 @@ i > 0; i--, ptr++, p_argv.v++) { - switch ((*ptr)->type) - { + unsigned short typenum = (*ptr)->type; + + /* We may need to handle some values depending on ABI */ + if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) { + if (typenum == FFI_TYPE_FLOAT) + typenum = FFI_TYPE_UINT32; + if (typenum == FFI_TYPE_DOUBLE) + typenum = FFI_TYPE_UINT64; + if (typenum == FFI_TYPE_LONGDOUBLE) + typenum = FFI_TYPE_UINT128; + } else if (ecif->cif->abi != FFI_LINUX) { +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + if (typenum == FFI_TYPE_LONGDOUBLE) + typenum = FFI_TYPE_STRUCT; +#endif + } + + /* Now test the translated value */ + switch (typenum) { +#ifndef __NO_FPRS__ case FFI_TYPE_FLOAT: /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ - if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) - goto soft_float_prep; double_tmp = **p_argv.f; if (fparg_count >= NUM_FPR_ARG_REGISTERS) { @@ -195,8 +217,6 @@ case FFI_TYPE_DOUBLE: /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ - if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) - goto soft_double_prep; double_tmp = **p_argv.d; if (fparg_count >= NUM_FPR_ARG_REGISTERS) @@ -218,43 +238,6 @@ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: - if ((ecif->cif->abi != FFI_LINUX) - && (ecif->cif->abi != FFI_LINUX_SOFT_FLOAT)) - goto do_struct; - /* The soft float ABI for long doubles works like this, - a long double is passed in four consecutive gprs if available. - A maximum of 2 long doubles can be passed in gprs. - If we do not have 4 gprs left, the long double is passed on the - stack, 4-byte aligned. */ - if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) - { - unsigned int int_tmp = (*p_argv.ui)[0]; - if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3) - { - if (intarg_count < NUM_GPR_ARG_REGISTERS) - intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; - *next_arg.u = int_tmp; - next_arg.u++; - for (ii = 1; ii < 4; ii++) - { - int_tmp = (*p_argv.ui)[ii]; - *next_arg.u = int_tmp; - next_arg.u++; - } - } - else - { - *gpr_base.u++ = int_tmp; - for (ii = 1; ii < 4; ii++) - { - int_tmp = (*p_argv.ui)[ii]; - *gpr_base.u++ = int_tmp; - } - } - intarg_count +=4; - } - else - { double_tmp = (*p_argv.d)[0]; if (fparg_count >= NUM_FPR_ARG_REGISTERS - 1) @@ -280,13 +263,40 @@ fparg_count += 2; FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); - } break; #endif +#endif /* have FPRs */ + + /* + * The soft float ABI for long doubles works like this, a long double + * is passed in four consecutive GPRs if available. A maximum of 2 + * long doubles can be passed in gprs. If we do not have 4 GPRs + * left, the long double is passed on the stack, 4-byte aligned. + */ + case FFI_TYPE_UINT128: { + unsigned int int_tmp = (*p_argv.ui)[0]; + unsigned int ii; + if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3) { + if (intarg_count < NUM_GPR_ARG_REGISTERS) + intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; + *(next_arg.u++) = int_tmp; + for (ii = 1; ii < 4; ii++) { + int_tmp = (*p_argv.ui)[ii]; + *(next_arg.u++) = int_tmp; + } + } else { + *(gpr_base.u++) = int_tmp; + for (ii = 1; ii < 4; ii++) { + int_tmp = (*p_argv.ui)[ii]; + *(gpr_base.u++) = int_tmp; + } + } + intarg_count += 4; + break; + } case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: - soft_double_prep: if (intarg_count == NUM_GPR_ARG_REGISTERS-1) intarg_count++; if (intarg_count >= NUM_GPR_ARG_REGISTERS) @@ -319,9 +329,6 @@ break; case FFI_TYPE_STRUCT: -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - do_struct: -#endif struct_copy_size = ((*ptr)->size + 15) & ~0xF; copy_space.c -= struct_copy_size; memcpy (copy_space.c, *p_argv.c, (*ptr)->size); @@ -349,7 +356,6 @@ case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: case FFI_TYPE_POINTER: - soft_float_prep: gprvalue = **p_argv.ui; @@ -366,8 +372,16 @@ /* Check that we didn't overrun the stack... */ FFI_ASSERT (copy_space.c >= next_arg.c); FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS); + /* The assert below is testing that the number of integer arguments agrees + with the number found in ffi_prep_cif_machdep(). However, intarg_count + is incremeneted whenever we place an FP arg on the stack, so account for + that before our assert test. */ +#ifndef __NO_FPRS__ + if (fparg_count > NUM_FPR_ARG_REGISTERS) + intarg_count -= fparg_count - NUM_FPR_ARG_REGISTERS; FFI_ASSERT (fpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); +#endif FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); } @@ -604,9 +618,6 @@ unsigned type = cif->rtype->type; unsigned size = cif->rtype->size; - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - NUM_FPR_ARG_REGISTERS = 0; - if (cif->abi != FFI_LINUX64) { /* All the machine-independent calculation of cif->bytes will be wrong. @@ -646,13 +657,26 @@ - Single/double FP values in fpr1, long double in fpr1,fpr2. - soft-float float/doubles are treated as UINT32/UINT64 respectivley. - soft-float long doubles are returned in gpr3-gpr6. */ + /* First translate for softfloat/nonlinux */ + if (cif->abi == FFI_LINUX_SOFT_FLOAT) { + if (type == FFI_TYPE_FLOAT) + type = FFI_TYPE_UINT32; + if (type == FFI_TYPE_DOUBLE) + type = FFI_TYPE_UINT64; + if (type == FFI_TYPE_LONGDOUBLE) + type = FFI_TYPE_UINT128; + } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) { +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + if (type == FFI_TYPE_LONGDOUBLE) + type = FFI_TYPE_STRUCT; +#endif + } + switch (type) { +#ifndef __NO_FPRS__ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: - if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64 - && cif->abi != FFI_LINUX_SOFT_FLOAT) - goto byref; flags |= FLAG_RETURNS_128BITS; /* Fall through. */ #endif @@ -660,11 +684,13 @@ flags |= FLAG_RETURNS_64BITS; /* Fall through. */ case FFI_TYPE_FLOAT: - /* With FFI_LINUX_SOFT_FLOAT no fp registers are used. */ - if (cif->abi != FFI_LINUX_SOFT_FLOAT) - flags |= FLAG_RETURNS_FP; + flags |= FLAG_RETURNS_FP; break; +#endif + case FFI_TYPE_UINT128: + flags |= FLAG_RETURNS_128BITS; + /* Fall through. */ case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: flags |= FLAG_RETURNS_64BITS; @@ -699,9 +725,7 @@ } } } -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - byref: -#endif + intarg_count++; flags |= FLAG_RETVAL_REFERENCE; /* Fall through. */ @@ -722,39 +746,36 @@ Stuff on the stack needs to keep proper alignment. */ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { - switch ((*ptr)->type) - { + unsigned short typenum = (*ptr)->type; + + /* We may need to handle some values depending on ABI */ + if (cif->abi == FFI_LINUX_SOFT_FLOAT) { + if (typenum == FFI_TYPE_FLOAT) + typenum = FFI_TYPE_UINT32; + if (typenum == FFI_TYPE_DOUBLE) + typenum = FFI_TYPE_UINT64; + if (typenum == FFI_TYPE_LONGDOUBLE) + typenum = FFI_TYPE_UINT128; + } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) { +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + if (typenum == FFI_TYPE_LONGDOUBLE) + typenum = FFI_TYPE_STRUCT; +#endif + } + + switch (typenum) { +#ifndef __NO_FPRS__ case FFI_TYPE_FLOAT: - /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - goto soft_float_cif; fparg_count++; /* floating singles are not 8-aligned on stack */ break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: - if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) - goto do_struct; - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - { - if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3 - || intarg_count < NUM_GPR_ARG_REGISTERS) - /* A long double in FFI_LINUX_SOFT_FLOAT can use only - a set of four consecutive gprs. If we have not enough, - we have to adjust the intarg_count value. */ - intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; - intarg_count += 4; - break; - } - else - fparg_count++; + fparg_count++; /* Fall thru */ #endif case FFI_TYPE_DOUBLE: - /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - goto soft_double_cif; fparg_count++; /* If this FP arg is going on the stack, it must be 8-byte-aligned. */ @@ -763,10 +784,21 @@ && intarg_count % 2 != 0) intarg_count++; break; +#endif + case FFI_TYPE_UINT128: + /* + * A long double in FFI_LINUX_SOFT_FLOAT can use only a set + * of four consecutive gprs. If we do not have enough, we + * have to adjust the intarg_count value. + */ + if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3 + && intarg_count < NUM_GPR_ARG_REGISTERS) + intarg_count = NUM_GPR_ARG_REGISTERS; + intarg_count += 4; + break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: - soft_double_cif: /* 'long long' arguments are passed as two words, but either both words must fit in registers or both go on the stack. If they go on the stack, they must @@ -783,9 +815,6 @@ break; case FFI_TYPE_STRUCT: -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - do_struct: -#endif /* We must allocate space for a copy of these to enforce pass-by-value. Pad the space up to a multiple of 16 bytes (the maximum alignment required for anything under @@ -793,12 +822,20 @@ struct_copy_size += ((*ptr)->size + 15) & ~0xF; /* Fall through (allocate space for the pointer). */ - default: - soft_float_cif: + case FFI_TYPE_POINTER: + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: /* Everything else is passed as a 4-byte word in a GPR, either the object itself or a pointer to it. */ intarg_count++; break; + default: + FFI_ASSERT (0); } } else @@ -827,16 +864,29 @@ intarg_count += ((*ptr)->size + 7) / 8; break; - default: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: /* Everything else is passed as a 8-byte word in a GPR, either the object itself or a pointer to it. */ intarg_count++; break; + default: + FFI_ASSERT (0); } } +#ifndef __NO_FPRS__ if (fparg_count != 0) flags |= FLAG_FP_ARGUMENTS; +#endif if (intarg_count > 4) flags |= FLAG_4_GPR_ARGUMENTS; if (struct_copy_size != 0) @@ -844,21 +894,27 @@ if (cif->abi != FFI_LINUX64) { +#ifndef __NO_FPRS__ /* Space for the FPR registers, if needed. */ if (fparg_count != 0) bytes += NUM_FPR_ARG_REGISTERS * sizeof (double); +#endif /* Stack space. */ if (intarg_count > NUM_GPR_ARG_REGISTERS) bytes += (intarg_count - NUM_GPR_ARG_REGISTERS) * sizeof (int); +#ifndef __NO_FPRS__ if (fparg_count > NUM_FPR_ARG_REGISTERS) bytes += (fparg_count - NUM_FPR_ARG_REGISTERS) * sizeof (double); +#endif } else { +#ifndef __NO_FPRS__ /* Space for the FPR registers, if needed. */ if (fparg_count != 0) bytes += NUM_FPR_ARG_REGISTERS64 * sizeof (double); +#endif /* Stack space. */ if (intarg_count > NUM_GPR_ARG_REGISTERS64) @@ -886,28 +942,41 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { + /* + * The final SYSV ABI says that structures smaller or equal 8 bytes + * are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them + * in memory. + * + * Just to keep things simple for the assembly code, we will always + * bounce-buffer struct return values less than or equal to 8 bytes. + * This allows the ASM to handle SYSV small structures by directly + * writing r3 and r4 to memory without worrying about struct size. + */ + unsigned int smst_buffer[2]; extended_cif ecif; + unsigned int rsize = 0; ecif.cif = cif; ecif.avalue = avalue; - /* If the return value is a struct and we don't have a return */ - /* value address then we need to make one */ - - if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) - { - ecif.rvalue = alloca(cif->rtype->size); - } - else - ecif.rvalue = rvalue; - + /* Ensure that we have a valid struct return value */ + ecif.rvalue = rvalue; + if (cif->rtype->type == FFI_TYPE_STRUCT) { + rsize = cif->rtype->size; + if (rsize <= 8) + ecif.rvalue = smst_buffer; + else if (!rvalue) + ecif.rvalue = alloca(rsize); + } switch (cif->abi) { #ifndef POWERPC64 +# ifndef __NO_FPRS__ case FFI_SYSV: case FFI_GCC_SYSV: case FFI_LINUX: +# endif case FFI_LINUX_SOFT_FLOAT: ffi_call_SYSV (&ecif, -cif->bytes, cif->flags, ecif.rvalue, fn); break; @@ -920,6 +989,10 @@ FFI_ASSERT (0); break; } + + /* Check for a bounce-buffered return value */ + if (rvalue && ecif.rvalue == smst_buffer) + memcpy(rvalue, smst_buffer, rsize); } @@ -949,14 +1022,19 @@ #ifdef POWERPC64 void **tramp = (void **) &closure->tramp[0]; - FFI_ASSERT (cif->abi == FFI_LINUX64); + if (cif->abi != FFI_LINUX64) + return FFI_BAD_ABI; /* Copy function address and TOC from ffi_closure_LINUX64. */ memcpy (tramp, (char *) ffi_closure_LINUX64, 16); tramp[2] = codeloc; #else unsigned int *tramp; - FFI_ASSERT (cif->abi == FFI_GCC_SYSV || cif->abi == FFI_SYSV); + if (! (cif->abi == FFI_GCC_SYSV + || cif->abi == FFI_SYSV + || cif->abi == FFI_LINUX + || cif->abi == FFI_LINUX_SOFT_FLOAT)) + return FFI_BAD_ABI; tramp = (unsigned int *) &closure->tramp[0]; tramp[0] = 0x7c0802a6; /* mflr r0 */ @@ -1011,32 +1089,38 @@ void ** avalue; ffi_type ** arg_types; long i, avn; - long nf; /* number of floating registers already used */ - long ng; /* number of general registers already used */ - ffi_cif * cif; - double temp; - unsigned size; +#ifndef __NO_FPRS__ + long nf = 0; /* number of floating registers already used */ +#endif + long ng = 0; /* number of general registers already used */ - cif = closure->cif; + ffi_cif *cif = closure->cif; + unsigned size = cif->rtype->size; + unsigned short rtypenum = cif->rtype->type; + avalue = alloca (cif->nargs * sizeof (void *)); - size = cif->rtype->size; - nf = 0; - ng = 0; + /* First translate for softfloat/nonlinux */ + if (cif->abi == FFI_LINUX_SOFT_FLOAT) { + if (rtypenum == FFI_TYPE_FLOAT) + rtypenum = FFI_TYPE_UINT32; + if (rtypenum == FFI_TYPE_DOUBLE) + rtypenum = FFI_TYPE_UINT64; + if (rtypenum == FFI_TYPE_LONGDOUBLE) + rtypenum = FFI_TYPE_UINT128; + } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) { +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + if (rtypenum == FFI_TYPE_LONGDOUBLE) + rtypenum = FFI_TYPE_STRUCT; +#endif + } + /* Copy the caller's structure return value address so that the closure returns the data directly to the caller. For FFI_SYSV the result is passed in r3/r4 if the struct size is less or equal 8 bytes. */ - - if ((cif->rtype->type == FFI_TYPE_STRUCT - && !((cif->abi == FFI_SYSV) && (size <= 8))) -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - || (cif->rtype->type == FFI_TYPE_LONGDOUBLE - && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) -#endif - ) - { + if (rtypenum == FFI_TYPE_STRUCT && ((cif->abi != FFI_SYSV) || (size > 8))) { rvalue = (void *) *pgr; ng++; pgr++; @@ -1047,10 +1131,109 @@ arg_types = cif->arg_types; /* Grab the addresses of the arguments from the stack frame. */ - while (i < avn) - { - switch (arg_types[i]->type) - { + while (i < avn) { + unsigned short typenum = arg_types[i]->type; + + /* We may need to handle some values depending on ABI */ + if (cif->abi == FFI_LINUX_SOFT_FLOAT) { + if (typenum == FFI_TYPE_FLOAT) + typenum = FFI_TYPE_UINT32; + if (typenum == FFI_TYPE_DOUBLE) + typenum = FFI_TYPE_UINT64; + if (typenum == FFI_TYPE_LONGDOUBLE) + typenum = FFI_TYPE_UINT128; + } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) { +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + if (typenum == FFI_TYPE_LONGDOUBLE) + typenum = FFI_TYPE_STRUCT; +#endif + } + + switch (typenum) { +#ifndef __NO_FPRS__ + case FFI_TYPE_FLOAT: + /* unfortunately float values are stored as doubles + * in the ffi_closure_SYSV code (since we don't check + * the type in that routine). + */ + + /* there are 8 64bit floating point registers */ + + if (nf < 8) + { + double temp = pfr->d; + pfr->f = (float) temp; + avalue[i] = pfr; + nf++; + pfr++; + } + else + { + /* FIXME? here we are really changing the values + * stored in the original calling routines outgoing + * parameter stack. This is probably a really + * naughty thing to do but... + */ + avalue[i] = pst; + pst += 1; + } + break; + + case FFI_TYPE_DOUBLE: + /* On the outgoing stack all values are aligned to 8 */ + /* there are 8 64bit floating point registers */ + + if (nf < 8) + { + avalue[i] = pfr; + nf++; + pfr++; + } + else + { + if (((long) pst) & 4) + pst++; + avalue[i] = pst; + pst += 2; + } + break; + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: + if (nf < 7) + { + avalue[i] = pfr; + pfr += 2; + nf += 2; + } + else + { + if (((long) pst) & 4) + pst++; + avalue[i] = pst; + pst += 4; + nf = 8; + } + break; +#endif +#endif /* have FPRS */ + + case FFI_TYPE_UINT128: + /* + * Test if for the whole long double, 4 gprs are available. + * otherwise the stuff ends up on the stack. + */ + if (ng < 5) { + avalue[i] = pgr; + pgr += 4; + ng += 4; + } else { + avalue[i] = pst; + pst += 4; + ng = 8+4; + } + break; + case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: /* there are 8 gpr registers used to pass values */ @@ -1086,7 +1269,6 @@ case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_POINTER: - soft_float_closure: /* there are 8 gpr registers used to pass values */ if (ng < 8) { @@ -1102,9 +1284,6 @@ break; case FFI_TYPE_STRUCT: -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - do_struct: -#endif /* Structs are passed by reference. The address will appear in a gpr if it is one of the first 8 arguments. */ if (ng < 8) @@ -1122,7 +1301,6 @@ case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: - soft_double_closure: /* passing long long ints are complex, they must * be passed in suitable register pairs such as * (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10) @@ -1154,99 +1332,8 @@ } break; - case FFI_TYPE_FLOAT: - /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - goto soft_float_closure; - /* unfortunately float values are stored as doubles - * in the ffi_closure_SYSV code (since we don't check - * the type in that routine). - */ - - /* there are 8 64bit floating point registers */ - - if (nf < 8) - { - temp = pfr->d; - pfr->f = (float) temp; - avalue[i] = pfr; - nf++; - pfr++; - } - else - { - /* FIXME? here we are really changing the values - * stored in the original calling routines outgoing - * parameter stack. This is probably a really - * naughty thing to do but... - */ - avalue[i] = pst; - pst += 1; - } - break; - - case FFI_TYPE_DOUBLE: - /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - goto soft_double_closure; - /* On the outgoing stack all values are aligned to 8 */ - /* there are 8 64bit floating point registers */ - - if (nf < 8) - { - avalue[i] = pfr; - nf++; - pfr++; - } - else - { - if (((long) pst) & 4) - pst++; - avalue[i] = pst; - pst += 2; - } - break; - -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) - goto do_struct; - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - { /* Test if for the whole long double, 4 gprs are available. - otherwise the stuff ends up on the stack. */ - if (ng < 5) - { - avalue[i] = pgr; - pgr += 4; - ng += 4; - } - else - { - avalue[i] = pst; - pst += 4; - ng = 8; - } - break; - } - if (nf < 7) - { - avalue[i] = pfr; - pfr += 2; - nf += 2; - } - else - { - if (((long) pst) & 4) - pst++; - avalue[i] = pst; - pst += 4; - nf = 8; - } - break; -#endif - default: - FFI_ASSERT (0); + FFI_ASSERT (0); } i++; @@ -1263,39 +1350,9 @@ already used and we never have a struct with size zero. That is the reason for the subtraction of 1. See the comment in ffitarget.h about ordering. */ - if (cif->abi == FFI_SYSV && cif->rtype->type == FFI_TYPE_STRUCT - && size <= 8) + if (cif->abi == FFI_SYSV && rtypenum == FFI_TYPE_STRUCT && size <= 8) return (FFI_SYSV_TYPE_SMALL_STRUCT - 1) + size; -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - else if (cif->rtype->type == FFI_TYPE_LONGDOUBLE - && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) - return FFI_TYPE_STRUCT; -#endif - /* With FFI_LINUX_SOFT_FLOAT floats and doubles are handled like UINT32 - respectivley UINT64. */ - if (cif->abi == FFI_LINUX_SOFT_FLOAT) - { - switch (cif->rtype->type) - { - case FFI_TYPE_FLOAT: - return FFI_TYPE_UINT32; - break; - case FFI_TYPE_DOUBLE: - return FFI_TYPE_UINT64; - break; -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - return FFI_TYPE_UINT128; - break; -#endif - default: - return cif->rtype->type; - } - } - else - { - return cif->rtype->type; - } + return rtypenum; } int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_closure *, void *, diff --git a/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c b/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c --- a/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c +++ b/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c @@ -3,7 +3,7 @@ Copyright (C) 1998 Geoffrey Keating Copyright (C) 2001 John Hornkvist - Copyright (C) 2002, 2006, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. FFI support for Darwin and AIX. @@ -35,11 +35,17 @@ extern void ffi_closure_ASM (void); enum { - /* The assembly depends on these exact flags. */ - FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */ - FLAG_RETURNS_FP = 1 << (31-29), - FLAG_RETURNS_64BITS = 1 << (31-28), - FLAG_RETURNS_128BITS = 1 << (31-31), + /* The assembly depends on these exact flags. + For Darwin64 (when FLAG_RETURNS_STRUCT is set): + FLAG_RETURNS_FP indicates that the structure embeds FP data. + FLAG_RETURNS_128BITS signals a special struct size that is not + expanded for float content. */ + FLAG_RETURNS_128BITS = 1 << (31-31), /* These go in cr7 */ + FLAG_RETURNS_NOTHING = 1 << (31-30), + FLAG_RETURNS_FP = 1 << (31-29), + FLAG_RETURNS_64BITS = 1 << (31-28), + + FLAG_RETURNS_STRUCT = 1 << (31-27), /* This goes in cr6 */ FLAG_ARG_NEEDS_COPY = 1 << (31- 7), FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ @@ -50,43 +56,61 @@ /* About the DARWIN ABI. */ enum { NUM_GPR_ARG_REGISTERS = 8, - NUM_FPR_ARG_REGISTERS = 13 + NUM_FPR_ARG_REGISTERS = 13, + LINKAGE_AREA_GPRS = 6 }; -enum { ASM_NEEDS_REGISTERS = 4 }; + +enum { ASM_NEEDS_REGISTERS = 4 }; /* r28-r31 */ /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments. + + m32/m64 The stack layout we want looks like this: | Return address from ffi_call_DARWIN | higher addresses |--------------------------------------------| - | Previous backchain pointer 4 | stack pointer here + | Previous backchain pointer 4/8 | stack pointer here |--------------------------------------------|<+ <<< on entry to - | Saved r28-r31 4*4 | | ffi_call_DARWIN + | ASM_NEEDS_REGISTERS=r28-r31 4*(4/8) | | ffi_call_DARWIN |--------------------------------------------| | - | Parameters (at least 8*4=32) | | + | When we have any FP activity... the | | + | FPRs occupy NUM_FPR_ARG_REGISTERS slots | | + | here fp13 .. fp1 from high to low addr. | | + ~ ~ ~ + | Parameters (at least 8*4/8=32/64) | | NUM_GPR_ARG_REGISTERS |--------------------------------------------| | - | Space for GPR2 4 | | + | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | |--------------------------------------------| | stack | - | Reserved 2*4 | | grows | + | Reserved 2*4/8 | | grows | |--------------------------------------------| | down V - | Space for callee's LR 4 | | + | Space for callee's LR 4/8 | | |--------------------------------------------| | lower addresses - | Saved CR 4 | | + | Saved CR [low word for m64] 4/8 | | |--------------------------------------------| | stack pointer here - | Current backchain pointer 4 |-/ during + | Current backchain pointer 4/8 |-/ during |--------------------------------------------| <<< ffi_call_DARWIN */ +#if defined(POWERPC_DARWIN64) +static void +darwin64_pass_struct_by_value + (ffi_type *, char *, unsigned, unsigned *, double **, unsigned long **); +#endif + +/* This depends on GPR_SIZE = sizeof (unsigned long) */ + void ffi_prep_args (extended_cif *ecif, unsigned long *const stack) { const unsigned bytes = ecif->cif->bytes; const unsigned flags = ecif->cif->flags; const unsigned nargs = ecif->cif->nargs; +#if !defined(POWERPC_DARWIN64) const ffi_abi abi = ecif->cif->abi; +#endif /* 'stacktop' points at the previous backchain pointer. */ unsigned long *const stacktop = stack + (bytes / sizeof(unsigned long)); @@ -94,18 +118,19 @@ /* 'fpr_base' points at the space for fpr1, and grows upwards as we use FPR registers. */ double *fpr_base = (double *) (stacktop - ASM_NEEDS_REGISTERS) - NUM_FPR_ARG_REGISTERS; - int fparg_count = 0; - + int gp_count = 0, fparg_count = 0; /* 'next_arg' grows up as we put parameters in it. */ - unsigned long *next_arg = stack + 6; /* 6 reserved positions. */ + unsigned long *next_arg = stack + LINKAGE_AREA_GPRS; /* 6 reserved positions. */ int i; double double_tmp; void **p_argv = ecif->avalue; unsigned long gprvalue; ffi_type** ptr = ecif->cif->arg_types; +#if !defined(POWERPC_DARWIN64) char *dest_cpy; +#endif unsigned size_al = 0; /* Check that everything starts aligned properly. */ @@ -130,25 +155,30 @@ the size of the floating-point parameter are skipped. */ case FFI_TYPE_FLOAT: double_tmp = *(float *) *p_argv; - if (fparg_count >= NUM_FPR_ARG_REGISTERS) - *(double *)next_arg = double_tmp; - else + if (fparg_count < NUM_FPR_ARG_REGISTERS) *fpr_base++ = double_tmp; +#if defined(POWERPC_DARWIN) + *(float *)next_arg = *(float *) *p_argv; +#else + *(double *)next_arg = double_tmp; +#endif next_arg++; + gp_count++; fparg_count++; FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); break; case FFI_TYPE_DOUBLE: double_tmp = *(double *) *p_argv; - if (fparg_count >= NUM_FPR_ARG_REGISTERS) - *(double *)next_arg = double_tmp; - else + if (fparg_count < NUM_FPR_ARG_REGISTERS) *fpr_base++ = double_tmp; + *(double *)next_arg = double_tmp; #ifdef POWERPC64 next_arg++; + gp_count++; #else next_arg += 2; + gp_count += 2; #endif fparg_count++; FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); @@ -157,30 +187,41 @@ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: -#ifdef POWERPC64 +# if defined(POWERPC64) && !defined(POWERPC_DARWIN64) + /* ??? This will exceed the regs count when the value starts at fp13 + and it will not put the extra bit on the stack. */ if (fparg_count < NUM_FPR_ARG_REGISTERS) *(long double *) fpr_base++ = *(long double *) *p_argv; else *(long double *) next_arg = *(long double *) *p_argv; next_arg += 2; fparg_count += 2; -#else +# else double_tmp = ((double *) *p_argv)[0]; if (fparg_count < NUM_FPR_ARG_REGISTERS) *fpr_base++ = double_tmp; - else - *(double *) next_arg = double_tmp; + *(double *) next_arg = double_tmp; +# if defined(POWERPC_DARWIN64) + next_arg++; + gp_count++; +# else next_arg += 2; + gp_count += 2; +# endif fparg_count++; - double_tmp = ((double *) *p_argv)[1]; if (fparg_count < NUM_FPR_ARG_REGISTERS) *fpr_base++ = double_tmp; - else - *(double *) next_arg = double_tmp; + *(double *) next_arg = double_tmp; +# if defined(POWERPC_DARWIN64) + next_arg++; + gp_count++; +# else next_arg += 2; + gp_count += 2; +# endif fparg_count++; -#endif +# endif FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); break; #endif @@ -192,6 +233,7 @@ #else *(long long *) next_arg = *(long long *) *p_argv; next_arg += 2; + gp_count += 2; #endif break; case FFI_TYPE_POINTER: @@ -211,32 +253,35 @@ goto putgpr; case FFI_TYPE_STRUCT: -#ifdef POWERPC64 - dest_cpy = (char *) next_arg; size_al = (*ptr)->size; - if ((*ptr)->elements[0]->type == 3) - size_al = ALIGN((*ptr)->size, 8); - if (size_al < 3 && abi == FFI_DARWIN) - dest_cpy += 4 - size_al; - - memcpy ((char *) dest_cpy, (char *) *p_argv, size_al); - next_arg += (size_al + 7) / 8; +#if defined(POWERPC_DARWIN64) + next_arg = (unsigned long *)ALIGN((char *)next_arg, (*ptr)->alignment); + darwin64_pass_struct_by_value (*ptr, (char *) *p_argv, + (unsigned) size_al, + (unsigned int *) &fparg_count, + &fpr_base, &next_arg); #else dest_cpy = (char *) next_arg; + /* If the first member of the struct is a double, then include enough + padding in the struct size to align it to double-word. */ + if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) + size_al = ALIGN((*ptr)->size, 8); + +# if defined(POWERPC64) + FFI_ASSERT (abi != FFI_DARWIN); + memcpy ((char *) dest_cpy, (char *) *p_argv, size_al); + next_arg += (size_al + 7) / 8; +# else /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, SI 4 bytes) are aligned as if they were those modes. Structures with 3 byte in size are padded upwards. */ - size_al = (*ptr)->size; - /* If the first member of the struct is a double, then align - the struct to double-word. */ - if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) - size_al = ALIGN((*ptr)->size, 8); if (size_al < 3 && abi == FFI_DARWIN) dest_cpy += 4 - size_al; memcpy((char *) dest_cpy, (char *) *p_argv, size_al); next_arg += (size_al + 3) / 4; +# endif #endif break; @@ -249,6 +294,7 @@ gprvalue = *(unsigned int *) *p_argv; putgpr: *next_arg++ = gprvalue; + gp_count++; break; default: break; @@ -256,14 +302,275 @@ } /* Check that we didn't overrun the stack... */ - //FFI_ASSERT(gpr_base <= stacktop - ASM_NEEDS_REGISTERS); - //FFI_ASSERT((unsigned *)fpr_base - // <= stacktop - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); - //FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); + /* FFI_ASSERT(gpr_base <= stacktop - ASM_NEEDS_REGISTERS); + FFI_ASSERT((unsigned *)fpr_base + <= stacktop - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); + FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); */ } +#if defined(POWERPC_DARWIN64) + +/* See if we can put some of the struct into fprs. + This should not be called for structures of size 16 bytes, since these are not + broken out this way. */ +static void +darwin64_scan_struct_for_floats (ffi_type *s, unsigned *nfpr) +{ + int i; + + FFI_ASSERT (s->type == FFI_TYPE_STRUCT) + + for (i = 0; s->elements[i] != NULL; i++) + { + ffi_type *p = s->elements[i]; + switch (p->type) + { + case FFI_TYPE_STRUCT: + darwin64_scan_struct_for_floats (p, nfpr); + break; + case FFI_TYPE_LONGDOUBLE: + (*nfpr) += 2; + break; + case FFI_TYPE_DOUBLE: + case FFI_TYPE_FLOAT: + (*nfpr) += 1; + break; + default: + break; + } + } +} + +static int +darwin64_struct_size_exceeds_gprs_p (ffi_type *s, char *src, unsigned *nfpr) +{ + unsigned struct_offset=0, i; + + for (i = 0; s->elements[i] != NULL; i++) + { + char *item_base; + ffi_type *p = s->elements[i]; + /* Find the start of this item (0 for the first one). */ + if (i > 0) + struct_offset = ALIGN(struct_offset, p->alignment); + + item_base = src + struct_offset; + + switch (p->type) + { + case FFI_TYPE_STRUCT: + if (darwin64_struct_size_exceeds_gprs_p (p, item_base, nfpr)) + return 1; + break; + case FFI_TYPE_LONGDOUBLE: + if (*nfpr >= NUM_FPR_ARG_REGISTERS) + return 1; + (*nfpr) += 1; + item_base += 8; + /* FALL THROUGH */ + case FFI_TYPE_DOUBLE: + if (*nfpr >= NUM_FPR_ARG_REGISTERS) + return 1; + (*nfpr) += 1; + break; + case FFI_TYPE_FLOAT: + if (*nfpr >= NUM_FPR_ARG_REGISTERS) + return 1; + (*nfpr) += 1; + break; + default: + /* If we try and place any item, that is non-float, once we've + exceeded the 8 GPR mark, then we can't fit the struct. */ + if ((unsigned long)item_base >= 8*8) + return 1; + break; + } + /* now count the size of what we just used. */ + struct_offset += p->size; + } + return 0; +} + +/* Can this struct be returned by value? */ +int +darwin64_struct_ret_by_value_p (ffi_type *s) +{ + unsigned nfp = 0; + + FFI_ASSERT (s && s->type == FFI_TYPE_STRUCT); + + /* The largest structure we can return is 8long + 13 doubles. */ + if (s->size > 168) + return 0; + + /* We can't pass more than 13 floats. */ + darwin64_scan_struct_for_floats (s, &nfp); + if (nfp > 13) + return 0; + + /* If there are not too many floats, and the struct is + small enough to accommodate in the GPRs, then it must be OK. */ + if (s->size <= 64) + return 1; + + /* Well, we have to look harder. */ + nfp = 0; + if (darwin64_struct_size_exceeds_gprs_p (s, NULL, &nfp)) + return 0; + + return 1; +} + +void +darwin64_pass_struct_floats (ffi_type *s, char *src, + unsigned *nfpr, double **fprs) +{ + int i; + double *fpr_base = *fprs; + unsigned struct_offset = 0; + + /* We don't assume anything about the alignment of the source. */ + for (i = 0; s->elements[i] != NULL; i++) + { + char *item_base; + ffi_type *p = s->elements[i]; + /* Find the start of this item (0 for the first one). */ + if (i > 0) + struct_offset = ALIGN(struct_offset, p->alignment); + item_base = src + struct_offset; + + switch (p->type) + { + case FFI_TYPE_STRUCT: + darwin64_pass_struct_floats (p, item_base, nfpr, + &fpr_base); + break; + case FFI_TYPE_LONGDOUBLE: + if (*nfpr < NUM_FPR_ARG_REGISTERS) + *fpr_base++ = *(double *)item_base; + (*nfpr) += 1; + item_base += 8; + /* FALL THROUGH */ + case FFI_TYPE_DOUBLE: + if (*nfpr < NUM_FPR_ARG_REGISTERS) + *fpr_base++ = *(double *)item_base; + (*nfpr) += 1; + break; + case FFI_TYPE_FLOAT: + if (*nfpr < NUM_FPR_ARG_REGISTERS) + *fpr_base++ = (double) *(float *)item_base; + (*nfpr) += 1; + break; + default: + break; + } + /* now count the size of what we just used. */ + struct_offset += p->size; + } + /* Update the scores. */ + *fprs = fpr_base; +} + +/* Darwin64 special rules. + Break out a struct into params and float registers. */ +static void +darwin64_pass_struct_by_value (ffi_type *s, char *src, unsigned size, + unsigned *nfpr, double **fprs, unsigned long **arg) +{ + unsigned long *next_arg = *arg; + char *dest_cpy = (char *)next_arg; + + FFI_ASSERT (s->type == FFI_TYPE_STRUCT) + + if (!size) + return; + + /* First... special cases. */ + if (size < 3 + || (size == 4 + && s->elements[0] + && s->elements[0]->type != FFI_TYPE_FLOAT)) + { + /* Must be at least one GPR, padding is unspecified in value, + let's make it zero. */ + *next_arg = 0UL; + dest_cpy += 8 - size; + memcpy ((char *) dest_cpy, src, size); + next_arg++; + } + else if (size == 16) + { + memcpy ((char *) dest_cpy, src, size); + next_arg += 2; + } + else + { + /* now the general case, we consider embedded floats. */ + memcpy ((char *) dest_cpy, src, size); + darwin64_pass_struct_floats (s, src, nfpr, fprs); + next_arg += (size+7)/8; + } + + *arg = next_arg; +} + +double * +darwin64_struct_floats_to_mem (ffi_type *s, char *dest, double *fprs, unsigned *nf) +{ + int i; + unsigned struct_offset = 0; + + /* We don't assume anything about the alignment of the source. */ + for (i = 0; s->elements[i] != NULL; i++) + { + char *item_base; + ffi_type *p = s->elements[i]; + /* Find the start of this item (0 for the first one). */ + if (i > 0) + struct_offset = ALIGN(struct_offset, p->alignment); + item_base = dest + struct_offset; + + switch (p->type) + { + case FFI_TYPE_STRUCT: + fprs = darwin64_struct_floats_to_mem (p, item_base, fprs, nf); + break; + case FFI_TYPE_LONGDOUBLE: + if (*nf < NUM_FPR_ARG_REGISTERS) + { + *(double *)item_base = *fprs++ ; + (*nf) += 1; + } + item_base += 8; + /* FALL THROUGH */ + case FFI_TYPE_DOUBLE: + if (*nf < NUM_FPR_ARG_REGISTERS) + { + *(double *)item_base = *fprs++ ; + (*nf) += 1; + } + break; + case FFI_TYPE_FLOAT: + if (*nf < NUM_FPR_ARG_REGISTERS) + { + *(float *)item_base = (float) *fprs++ ; + (*nf) += 1; + } + break; + default: + break; + } + /* now count the size of what we just used. */ + struct_offset += p->size; + } + return fprs; +} + +#endif + /* Adjust the size of S to be correct for Darwin. - On Darwin, the first field of a structure has natural alignment. */ + On Darwin m32, the first field of a structure has natural alignment. + On Darwin m64, all fields have natural alignment. */ static void darwin_adjust_aggregate_sizes (ffi_type *s) @@ -280,22 +587,29 @@ int align; p = s->elements[i]; - darwin_adjust_aggregate_sizes (p); - if (i == 0 - && (p->type == FFI_TYPE_UINT64 - || p->type == FFI_TYPE_SINT64 - || p->type == FFI_TYPE_DOUBLE - || p->alignment == 8)) - align = 8; + if (p->type == FFI_TYPE_STRUCT) + darwin_adjust_aggregate_sizes (p); +#if defined(POWERPC_DARWIN64) + /* Natural alignment for all items. */ + align = p->alignment; +#else + /* Natrual alignment for the first item... */ + if (i == 0) + align = p->alignment; else if (p->alignment == 16 || p->alignment < 4) + /* .. subsequent items with vector or align < 4 have natural align. */ align = p->alignment; else + /* .. or align is 4. */ align = 4; +#endif + /* Pad, if necessary, before adding the current item. */ s->size = ALIGN(s->size, align) + p->size; } s->size = ALIGN(s->size, s->alignment); + /* This should not be necessary on m64, but harmless. */ if (s->elements[0]->type == FFI_TYPE_UINT64 || s->elements[0]->type == FFI_TYPE_SINT64 || s->elements[0]->type == FFI_TYPE_DOUBLE @@ -344,10 +658,10 @@ ffi_prep_cif_machdep (ffi_cif *cif) { /* All this is for the DARWIN ABI. */ - int i; + unsigned i; ffi_type **ptr; unsigned bytes; - int fparg_count = 0, intarg_count = 0; + unsigned fparg_count = 0, intarg_count = 0; unsigned flags = 0; unsigned size_al = 0; @@ -372,16 +686,25 @@ /* Space for the frame pointer, callee's LR, CR, etc, and for the asm's temp regs. */ - bytes = (6 + ASM_NEEDS_REGISTERS) * sizeof(long); + bytes = (LINKAGE_AREA_GPRS + ASM_NEEDS_REGISTERS) * sizeof(unsigned long); - /* Return value handling. The rules are as follows: + /* Return value handling. + The rules m32 are as follows: - 32-bit (or less) integer values are returned in gpr3; - - Structures of size <= 4 bytes also returned in gpr3; - - 64-bit integer values and structures between 5 and 8 bytes are returned - in gpr3 and gpr4; + - structures of size <= 4 bytes also returned in gpr3; + - 64-bit integer values [??? and structures between 5 and 8 bytes] are + returned in gpr3 and gpr4; - Single/double FP values are returned in fpr1; - Long double FP (if not equivalent to double) values are returned in fpr1 and fpr2; + m64: + - 64-bit or smaller integral values are returned in GPR3 + - Single/double FP values are returned in fpr1; + - Long double FP values are returned in fpr1 and fpr2; + m64 Structures: + - If the structure could be accommodated in registers were it to be the + first argument to a routine, then it is returned in those registers. + m32/m64 structures otherwise: - Larger structures values are allocated space and a pointer is passed as the first argument. */ switch (cif->rtype->type) @@ -410,9 +733,42 @@ break; case FFI_TYPE_STRUCT: +#if defined(POWERPC_DARWIN64) + { + /* Can we fit the struct into regs? */ + if (darwin64_struct_ret_by_value_p (cif->rtype)) + { + unsigned nfpr = 0; + flags |= FLAG_RETURNS_STRUCT; + if (cif->rtype->size != 16) + darwin64_scan_struct_for_floats (cif->rtype, &nfpr) ; + else + flags |= FLAG_RETURNS_128BITS; + /* Will be 0 for 16byte struct. */ + if (nfpr) + flags |= FLAG_RETURNS_FP; + } + else /* By ref. */ + { + flags |= FLAG_RETVAL_REFERENCE; + flags |= FLAG_RETURNS_NOTHING; + intarg_count++; + } + } +#elif defined(DARWIN_PPC) + if (cif->rtype->size <= 4) + flags |= FLAG_RETURNS_STRUCT; + else /* else by reference. */ + { + flags |= FLAG_RETVAL_REFERENCE; + flags |= FLAG_RETURNS_NOTHING; + intarg_count++; + } +#else /* assume we pass by ref. */ flags |= FLAG_RETVAL_REFERENCE; flags |= FLAG_RETURNS_NOTHING; intarg_count++; +#endif break; case FFI_TYPE_VOID: flags |= FLAG_RETURNS_NOTHING; @@ -425,57 +781,83 @@ /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest - goes on the stack. Structures are passed as a pointer to a copy of - the structure. Stuff on the stack needs to keep proper alignment. */ + goes on the stack. + ??? Structures are passed as a pointer to a copy of the structure. + Stuff on the stack needs to keep proper alignment. + For m64 the count is effectively of half-GPRs. */ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { + unsigned align_words; switch ((*ptr)->type) { case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: fparg_count++; +#if !defined(POWERPC_DARWIN64) /* If this FP arg is going on the stack, it must be 8-byte-aligned. */ if (fparg_count > NUM_FPR_ARG_REGISTERS - && intarg_count%2 != 0) + && (intarg_count & 0x01) != 0) intarg_count++; +#endif break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: fparg_count += 2; /* If this FP arg is going on the stack, it must be - 8-byte-aligned. */ - if (fparg_count > NUM_FPR_ARG_REGISTERS - && intarg_count%2 != 0) - intarg_count++; - intarg_count +=2; + 16-byte-aligned. */ + if (fparg_count >= NUM_FPR_ARG_REGISTERS) +#if defined (POWERPC64) + intarg_count = ALIGN(intarg_count, 2); +#else + intarg_count = ALIGN(intarg_count, 4); +#endif break; #endif case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: +#if defined(POWERPC64) + intarg_count++; +#else /* 'long long' arguments are passed as two words, but either both words must fit in registers or both go on the stack. If they go on the stack, they must be 8-byte-aligned. */ if (intarg_count == NUM_GPR_ARG_REGISTERS-1 - || (intarg_count >= NUM_GPR_ARG_REGISTERS && intarg_count%2 != 0)) + || (intarg_count >= NUM_GPR_ARG_REGISTERS + && (intarg_count & 0x01) != 0)) intarg_count++; intarg_count += 2; +#endif break; case FFI_TYPE_STRUCT: size_al = (*ptr)->size; +#if defined(POWERPC_DARWIN64) + align_words = (*ptr)->alignment >> 3; + if (align_words) + intarg_count = ALIGN(intarg_count, align_words); + /* Base size of the struct. */ + intarg_count += (size_al + 7) / 8; + /* If 16 bytes then don't worry about floats. */ + if (size_al != 16) + /* Scan through for floats to be placed in regs. */ + darwin64_scan_struct_for_floats (*ptr, &fparg_count) ; +#else + align_words = (*ptr)->alignment >> 2; + if (align_words) + intarg_count = ALIGN(intarg_count, align_words); /* If the first member of the struct is a double, then align - the struct to double-word. */ + the struct to double-word. if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) - size_al = ALIGN((*ptr)->size, 8); -#ifdef POWERPC64 + size_al = ALIGN((*ptr)->size, 8); */ +# ifdef POWERPC64 intarg_count += (size_al + 7) / 8; -#else +# else intarg_count += (size_al + 3) / 4; +# endif #endif break; @@ -490,9 +872,18 @@ if (fparg_count != 0) flags |= FLAG_FP_ARGUMENTS; +#if defined(POWERPC_DARWIN64) + /* Space to image the FPR registers, if needed - which includes when they might be + used in a struct return. */ + if (fparg_count != 0 + || ((flags & FLAG_RETURNS_STRUCT) + && (flags & FLAG_RETURNS_FP))) + bytes += NUM_FPR_ARG_REGISTERS * sizeof(double); +#else /* Space for the FPR registers, if needed. */ if (fparg_count != 0) bytes += NUM_FPR_ARG_REGISTERS * sizeof(double); +#endif /* Stack space. */ #ifdef POWERPC64 @@ -506,7 +897,7 @@ bytes += NUM_GPR_ARG_REGISTERS * sizeof(long); /* The stack space allocated needs to be a multiple of 16 bytes. */ - bytes = (bytes + 15) & ~0xF; + bytes = ALIGN(bytes, 16) ; cif->flags = flags; cif->bytes = bytes; @@ -516,8 +907,9 @@ extern void ffi_call_AIX(extended_cif *, long, unsigned, unsigned *, void (*fn)(void), void (*fn2)(void)); + extern void ffi_call_DARWIN(extended_cif *, long, unsigned, unsigned *, - void (*fn)(void), void (*fn2)(void)); + void (*fn)(void), void (*fn2)(void), ffi_type*); void ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) @@ -542,11 +934,11 @@ { case FFI_AIX: ffi_call_AIX(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn, - ffi_prep_args); + FFI_FN(ffi_prep_args)); break; case FFI_DARWIN: ffi_call_DARWIN(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn, - ffi_prep_args); + FFI_FN(ffi_prep_args), cif->rtype); break; default: FFI_ASSERT(0); @@ -566,58 +958,48 @@ } aix_fd; /* here I'd like to add the stack frame layout we use in darwin_closure.S - and aix_clsoure.S + and aix_closure.S - SP previous -> +---------------------------------------+ <--- child frame - | back chain to caller 4 | - +---------------------------------------+ 4 - | saved CR 4 | - +---------------------------------------+ 8 - | saved LR 4 | - +---------------------------------------+ 12 - | reserved for compilers 4 | - +---------------------------------------+ 16 - | reserved for binders 4 | - +---------------------------------------+ 20 - | saved TOC pointer 4 | - +---------------------------------------+ 24 - | always reserved 8*4=32 (previous GPRs)| - | according to the linkage convention | - | from AIX | - +---------------------------------------+ 56 - | our FPR area 13*8=104 | - | f1 | - | . | - | f13 | - +---------------------------------------+ 160 - | result area 8 | - +---------------------------------------+ 168 - | alignement to the next multiple of 16 | -SP current --> +---------------------------------------+ 176 <- parent frame - | back chain to caller 4 | - +---------------------------------------+ 180 - | saved CR 4 | - +---------------------------------------+ 184 - | saved LR 4 | - +---------------------------------------+ 188 - | reserved for compilers 4 | - +---------------------------------------+ 192 - | reserved for binders 4 | - +---------------------------------------+ 196 - | saved TOC pointer 4 | - +---------------------------------------+ 200 - | always reserved 8*4=32 we store our | - | GPRs here | - | r3 | - | . | - | r10 | - +---------------------------------------+ 232 - | overflow part | - +---------------------------------------+ xxx - | ???? | - +---------------------------------------+ xxx + m32/m64 + + The stack layout looks like this: + + | Additional params... | | Higher address + ~ ~ ~ + | Parameters (at least 8*4/8=32/64) | | NUM_GPR_ARG_REGISTERS + |--------------------------------------------| | + | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | + |--------------------------------------------| | + | Reserved 2*4/8 | | + |--------------------------------------------| | + | Space for callee's LR 4/8 | | + |--------------------------------------------| | + | Saved CR [low word for m64] 4/8 | | + |--------------------------------------------| | + | Current backchain pointer 4/8 |-/ Parent's frame. + |--------------------------------------------| <+ <<< on entry to ffi_closure_ASM + | Result Bytes 16 | | + |--------------------------------------------| | + ~ padding to 16-byte alignment ~ ~ + |--------------------------------------------| | + | NUM_FPR_ARG_REGISTERS slots | | + | here fp13 .. fp1 13*8 | | + |--------------------------------------------| | + | R3..R10 8*4/8=32/64 | | NUM_GPR_ARG_REGISTERS + |--------------------------------------------| | + | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | + |--------------------------------------------| | stack | + | Reserved [compiler,binder] 2*4/8 | | grows | + |--------------------------------------------| | down V + | Space for callee's LR 4/8 | | + |--------------------------------------------| | lower addresses + | Saved CR [low word for m64] 4/8 | | + |--------------------------------------------| | stack pointer here + | Current backchain pointer 4/8 |-/ during + |--------------------------------------------| <<< ffi_closure_ASM. */ + ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, @@ -631,30 +1013,44 @@ switch (cif->abi) { - case FFI_DARWIN: + case FFI_DARWIN: - FFI_ASSERT (cif->abi == FFI_DARWIN); + FFI_ASSERT (cif->abi == FFI_DARWIN); - tramp = (unsigned int *) &closure->tramp[0]; - tramp[0] = 0x7c0802a6; /* mflr r0 */ - tramp[1] = 0x429f000d; /* bcl- 20,4*cr7+so,0x10 */ - tramp[4] = 0x7d6802a6; /* mflr r11 */ - tramp[5] = 0x818b0000; /* lwz r12,0(r11) function address */ - tramp[6] = 0x7c0803a6; /* mtlr r0 */ - tramp[7] = 0x7d8903a6; /* mtctr r12 */ - tramp[8] = 0x816b0004; /* lwz r11,4(r11) static chain */ - tramp[9] = 0x4e800420; /* bctr */ - tramp[2] = (unsigned long) ffi_closure_ASM; /* function */ - tramp[3] = (unsigned long) codeloc; /* context */ + tramp = (unsigned int *) &closure->tramp[0]; +#if defined(POWERPC_DARWIN64) + tramp[0] = 0x7c0802a6; /* mflr r0 */ + tramp[1] = 0x429f0015; /* bcl- 20,4*cr7+so, +0x18 (L1) */ + /* We put the addresses here. */ + tramp[6] = 0x7d6802a6; /*L1: mflr r11 */ + tramp[7] = 0xe98b0000; /* ld r12,0(r11) function address */ + tramp[8] = 0x7c0803a6; /* mtlr r0 */ + tramp[9] = 0x7d8903a6; /* mtctr r12 */ + tramp[10] = 0xe96b0008; /* lwz r11,8(r11) static chain */ + tramp[11] = 0x4e800420; /* bctr */ - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; + *((unsigned long *)&tramp[2]) = (unsigned long) ffi_closure_ASM; /* function */ + *((unsigned long *)&tramp[4]) = (unsigned long) codeloc; /* context */ +#else + tramp[0] = 0x7c0802a6; /* mflr r0 */ + tramp[1] = 0x429f000d; /* bcl- 20,4*cr7+so,0x10 */ + tramp[4] = 0x7d6802a6; /* mflr r11 */ + tramp[5] = 0x818b0000; /* lwz r12,0(r11) function address */ + tramp[6] = 0x7c0803a6; /* mtlr r0 */ + tramp[7] = 0x7d8903a6; /* mtctr r12 */ + tramp[8] = 0x816b0004; /* lwz r11,4(r11) static chain */ + tramp[9] = 0x4e800420; /* bctr */ + tramp[2] = (unsigned long) ffi_closure_ASM; /* function */ + tramp[3] = (unsigned long) codeloc; /* context */ +#endif + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; - /* Flush the icache. Only necessary on Darwin. */ - flush_range(codeloc, FFI_TRAMPOLINE_SIZE); + /* Flush the icache. Only necessary on Darwin. */ + flush_range(codeloc, FFI_TRAMPOLINE_SIZE); - break; + break; case FFI_AIX: @@ -669,10 +1065,10 @@ closure->cif = cif; closure->fun = fun; closure->user_data = user_data; + break; default: - - FFI_ASSERT(0); + return FFI_BAD_ABI; break; } return FFI_OK; @@ -708,7 +1104,7 @@ double d; } ffi_dblfl; -int +ffi_type * ffi_closure_helper_DARWIN (ffi_closure *, void *, unsigned long *, ffi_dblfl *); @@ -719,7 +1115,7 @@ up space for a return value, ffi_closure_ASM invokes the following helper function to do most of the work. */ -int +ffi_type * ffi_closure_helper_DARWIN (ffi_closure *closure, void *rvalue, unsigned long *pgr, ffi_dblfl *pfr) { @@ -741,16 +1137,32 @@ ffi_cif * cif; ffi_dblfl * end_pfr = pfr + NUM_FPR_ARG_REGISTERS; unsigned size_al; +#if defined(POWERPC_DARWIN64) + unsigned fpsused = 0; +#endif cif = closure->cif; avalue = alloca (cif->nargs * sizeof(void *)); - /* Copy the caller's structure return value address so that the closure - returns the data directly to the caller. */ if (cif->rtype->type == FFI_TYPE_STRUCT) { +#if defined(POWERPC_DARWIN64) + if (!darwin64_struct_ret_by_value_p (cif->rtype)) + { + /* Won't fit into the regs - return by ref. */ + rvalue = (void *) *pgr; + pgr++; + } +#elif defined(DARWIN_PPC) + if (cif->rtype->size > 4) + { + rvalue = (void *) *pgr; + pgr++; + } +#else /* assume we return by ref. */ rvalue = (void *) *pgr; pgr++; +#endif } i = 0; @@ -764,7 +1176,7 @@ { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: -#ifdef POWERPC64 +#if defined(POWERPC64) avalue[i] = (char *) pgr + 7; #else avalue[i] = (char *) pgr + 3; @@ -774,7 +1186,7 @@ case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: -#ifdef POWERPC64 +#if defined(POWERPC64) avalue[i] = (char *) pgr + 6; #else avalue[i] = (char *) pgr + 2; @@ -784,7 +1196,7 @@ case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: -#ifdef POWERPC64 +#if defined(POWERPC64) avalue[i] = (char *) pgr + 4; #else case FFI_TYPE_POINTER: @@ -794,34 +1206,53 @@ break; case FFI_TYPE_STRUCT: -#ifdef POWERPC64 size_al = arg_types[i]->size; - if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE) - size_al = ALIGN (arg_types[i]->size, 8); - if (size_al < 3 && cif->abi == FFI_DARWIN) - avalue[i] = (void *) pgr + 8 - size_al; - else - avalue[i] = (void *) pgr; +#if defined(POWERPC_DARWIN64) + pgr = (unsigned long *)ALIGN((char *)pgr, arg_types[i]->alignment); + if (size_al < 3 || size_al == 4) + { + avalue[i] = ((char *)pgr)+8-size_al; + if (arg_types[i]->elements[0]->type == FFI_TYPE_FLOAT + && fpsused < NUM_FPR_ARG_REGISTERS) + { + *(float *)pgr = (float) *(double *)pfr; + pfr++; + fpsused++; + } + } + else + { + if (size_al != 16) + pfr = (ffi_dblfl *) + darwin64_struct_floats_to_mem (arg_types[i], (char *)pgr, + (double *)pfr, &fpsused); + avalue[i] = pgr; + } pgr += (size_al + 7) / 8; #else - /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, - SI 4 bytes) are aligned as if they were those modes. */ - size_al = arg_types[i]->size; /* If the first member of the struct is a double, then align the struct to double-word. */ if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE) size_al = ALIGN(arg_types[i]->size, 8); +# if defined(POWERPC64) + FFI_ASSERT (cif->abi != FFI_DARWIN); + avalue[i] = pgr; + pgr += (size_al + 7) / 8; +# else + /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, + SI 4 bytes) are aligned as if they were those modes. */ if (size_al < 3 && cif->abi == FFI_DARWIN) - avalue[i] = (void*) pgr + 4 - size_al; + avalue[i] = (char*) pgr + 4 - size_al; else - avalue[i] = (void*) pgr; + avalue[i] = pgr; pgr += (size_al + 3) / 4; +# endif #endif break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: -#ifdef POWERPC64 +#if defined(POWERPC64) case FFI_TYPE_POINTER: avalue[i] = pgr; pgr++; @@ -924,5 +1355,5 @@ (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_ASM to perform return type promotions. */ - return cif->rtype->type; + return cif->rtype; } diff --git a/Modules/_ctypes/libffi/src/powerpc/ffitarget.h b/Modules/_ctypes/libffi/src/powerpc/ffitarget.h --- a/Modules/_ctypes/libffi/src/powerpc/ffitarget.h +++ b/Modules/_ctypes/libffi/src/powerpc/ffitarget.h @@ -1,6 +1,8 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. - Copyright (C) 2007, 2008 Free Software Foundation, Inc + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (C) 2007, 2008, 2010 Free Software Foundation, Inc + Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for PowerPC. Permission is hereby granted, free of charge, to any person obtaining @@ -28,15 +30,28 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- System specific configurations ----------------------------------- */ #if defined (POWERPC) && defined (__powerpc64__) /* linux64 */ +#ifndef POWERPC64 #define POWERPC64 -#elif defined (POWERPC_DARWIN) && defined (__ppc64__) /* Darwin */ +#endif +#elif defined (POWERPC_DARWIN) && defined (__ppc64__) /* Darwin64 */ +#ifndef POWERPC64 #define POWERPC64 +#endif +#ifndef POWERPC_DARWIN64 +#define POWERPC_DARWIN64 +#endif #elif defined (POWERPC_AIX) && defined (__64BIT__) /* AIX64 */ +#ifndef POWERPC64 #define POWERPC64 #endif +#endif #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; @@ -51,18 +66,14 @@ FFI_LINUX64, FFI_LINUX, FFI_LINUX_SOFT_FLOAT, -# ifdef POWERPC64 +# if defined(POWERPC64) FFI_DEFAULT_ABI = FFI_LINUX64, +# elif defined(__NO_FPRS__) + FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT, +# elif (__LDBL_MANT_DIG__ == 106) + FFI_DEFAULT_ABI = FFI_LINUX, # else -# if (!defined(__NO_FPRS__) && (__LDBL_MANT_DIG__ == 106)) - FFI_DEFAULT_ABI = FFI_LINUX, -# else -# ifdef __NO_FPRS__ - FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT, -# else FFI_DEFAULT_ABI = FFI_GCC_SYSV, -# endif -# endif # endif #endif @@ -108,9 +119,13 @@ #define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2) #if defined(POWERPC64) || defined(POWERPC_AIX) -#define FFI_TRAMPOLINE_SIZE 24 +# if defined(POWERPC_DARWIN64) +# define FFI_TRAMPOLINE_SIZE 48 +# else +# define FFI_TRAMPOLINE_SIZE 24 +# endif #else /* POWERPC || POWERPC_AIX */ -#define FFI_TRAMPOLINE_SIZE 40 +# define FFI_TRAMPOLINE_SIZE 40 #endif #ifndef LIBFFI_ASM diff --git a/Modules/_ctypes/libffi/src/powerpc/linux64.S b/Modules/_ctypes/libffi/src/powerpc/linux64.S --- a/Modules/_ctypes/libffi/src/powerpc/linux64.S +++ b/Modules/_ctypes/libffi/src/powerpc/linux64.S @@ -30,16 +30,25 @@ #include #ifdef __powerpc64__ - .hidden ffi_call_LINUX64, .ffi_call_LINUX64 - .globl ffi_call_LINUX64, .ffi_call_LINUX64 + .hidden ffi_call_LINUX64 + .globl ffi_call_LINUX64 .section ".opd","aw" .align 3 ffi_call_LINUX64: +#ifdef _CALL_LINUX + .quad .L.ffi_call_LINUX64,.TOC. at tocbase,0 + .type ffi_call_LINUX64, at function + .text +.L.ffi_call_LINUX64: +#else + .hidden .ffi_call_LINUX64 + .globl .ffi_call_LINUX64 .quad .ffi_call_LINUX64,.TOC. at tocbase,0 .size ffi_call_LINUX64,24 .type .ffi_call_LINUX64, at function .text .ffi_call_LINUX64: +#endif .LFB1: mflr %r0 std %r28, -32(%r1) @@ -58,7 +67,11 @@ /* Call ffi_prep_args64. */ mr %r4, %r1 +#ifdef _CALL_LINUX + bl ffi_prep_args64 +#else bl .ffi_prep_args64 +#endif ld %r0, 0(%r29) ld %r2, 8(%r29) @@ -137,7 +150,11 @@ .LFE1: .long 0 .byte 0,12,0,1,128,4,0,0 +#ifdef _CALL_LINUX + .size ffi_call_LINUX64,.-.L.ffi_call_LINUX64 +#else .size .ffi_call_LINUX64,.-.ffi_call_LINUX64 +#endif .section .eh_frame,EH_FRAME_FLAGS, at progbits .Lframe1: diff --git a/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S b/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S --- a/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S +++ b/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S @@ -32,16 +32,24 @@ #ifdef __powerpc64__ FFI_HIDDEN (ffi_closure_LINUX64) - FFI_HIDDEN (.ffi_closure_LINUX64) - .globl ffi_closure_LINUX64, .ffi_closure_LINUX64 + .globl ffi_closure_LINUX64 .section ".opd","aw" .align 3 ffi_closure_LINUX64: +#ifdef _CALL_LINUX + .quad .L.ffi_closure_LINUX64,.TOC. at tocbase,0 + .type ffi_closure_LINUX64, at function + .text +.L.ffi_closure_LINUX64: +#else + FFI_HIDDEN (.ffi_closure_LINUX64) + .globl .ffi_closure_LINUX64 .quad .ffi_closure_LINUX64,.TOC. at tocbase,0 .size ffi_closure_LINUX64,24 .type .ffi_closure_LINUX64, at function .text .ffi_closure_LINUX64: +#endif .LFB1: # save general regs into parm save area std %r3, 48(%r1) @@ -91,7 +99,11 @@ addi %r6, %r1, 128 # make the call +#ifdef _CALL_LINUX + bl ffi_closure_helper_LINUX64 +#else bl .ffi_closure_helper_LINUX64 +#endif .Lret: # now r3 contains the return type @@ -194,7 +206,11 @@ .LFE1: .long 0 .byte 0,12,0,1,128,0,0,0 +#ifdef _CALL_LINUX + .size ffi_closure_LINUX64,.-.L.ffi_closure_LINUX64 +#else .size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64 +#endif .section .eh_frame,EH_FRAME_FLAGS, at progbits .Lframe1: diff --git a/Modules/_ctypes/libffi/src/powerpc/ppc_closure.S b/Modules/_ctypes/libffi/src/powerpc/ppc_closure.S --- a/Modules/_ctypes/libffi/src/powerpc/ppc_closure.S +++ b/Modules/_ctypes/libffi/src/powerpc/ppc_closure.S @@ -122,22 +122,41 @@ blr # case FFI_TYPE_FLOAT +#ifndef __NO_FPRS__ lfs %f1,112+0(%r1) mtlr %r0 addi %r1,%r1,144 +#else + nop + nop + nop +#endif blr # case FFI_TYPE_DOUBLE +#ifndef __NO_FPRS__ lfd %f1,112+0(%r1) mtlr %r0 addi %r1,%r1,144 +#else + nop + nop + nop +#endif blr # case FFI_TYPE_LONGDOUBLE +#ifndef __NO_FPRS__ lfd %f1,112+0(%r1) lfd %f2,112+8(%r1) mtlr %r0 b .Lfinish +#else + nop + nop + nop + blr +#endif # case FFI_TYPE_UINT8 lbz %r3,112+3(%r1) diff --git a/Modules/_ctypes/libffi/src/powerpc/sysv.S b/Modules/_ctypes/libffi/src/powerpc/sysv.S --- a/Modules/_ctypes/libffi/src/powerpc/sysv.S +++ b/Modules/_ctypes/libffi/src/powerpc/sysv.S @@ -83,6 +83,7 @@ nop 1: +#ifndef __NO_FPRS__ /* Load all the FP registers. */ bf- 6,2f lfd %f1,-16-(8*4)-(8*8)(%r28) @@ -94,6 +95,7 @@ lfd %f6,-16-(8*4)-(3*8)(%r28) lfd %f7,-16-(8*4)-(2*8)(%r28) lfd %f8,-16-(8*4)-(1*8)(%r28) +#endif 2: /* Make the call. */ @@ -103,7 +105,9 @@ mtcrf 0x01,%r31 /* cr7 */ bt- 31,L(small_struct_return_value) bt- 30,L(done_return_value) +#ifndef __NO_FPRS__ bt- 29,L(fp_return_value) +#endif stw %r3,0(%r30) bf+ 28,L(done_return_value) stw %r4,4(%r30) @@ -124,6 +128,7 @@ lwz %r1,0(%r1) blr +#ifndef __NO_FPRS__ L(fp_return_value): bf 28,L(float_return_value) stfd %f1,0(%r30) @@ -134,6 +139,7 @@ L(float_return_value): stfs %f1,0(%r30) b L(done_return_value) +#endif L(small_struct_return_value): extrwi %r6,%r31,2,19 /* number of bytes padding = shift/8 */ diff --git a/Modules/_ctypes/libffi/src/prep_cif.c b/Modules/_ctypes/libffi/src/prep_cif.c --- a/Modules/_ctypes/libffi/src/prep_cif.c +++ b/Modules/_ctypes/libffi/src/prep_cif.c @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - prep_cif.c - Copyright (c) 1996, 1998, 2007 Red Hat, Inc. + prep_cif.c - Copyright (c) 2011, 2012 Anthony Green + Copyright (c) 1996, 1998, 2007 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -37,17 +38,21 @@ { ffi_type **ptr; - FFI_ASSERT(arg != NULL); + if (UNLIKELY(arg == NULL || arg->elements == NULL)) + return FFI_BAD_TYPEDEF; - FFI_ASSERT(arg->elements != NULL); - FFI_ASSERT(arg->size == 0); - FFI_ASSERT(arg->alignment == 0); + arg->size = 0; + arg->alignment = 0; ptr = &(arg->elements[0]); + if (UNLIKELY(ptr == 0)) + return FFI_BAD_TYPEDEF; + while ((*ptr) != NULL) { - if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) + if (UNLIKELY(((*ptr)->size == 0) + && (initialize_aggregate((*ptr)) != FFI_OK))) return FFI_BAD_TYPEDEF; /* Perform a sanity check on the argument type */ @@ -85,19 +90,38 @@ /* Perform machine independent ffi_cif preparation, then call machine dependent routine. */ -ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, - ffi_type *rtype, ffi_type **atypes) +/* For non variadic functions isvariadic should be 0 and + nfixedargs==ntotalargs. + + For variadic calls, isvariadic should be 1 and nfixedargs + and ntotalargs set as appropriate. nfixedargs must always be >=1 */ + + +ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi, + unsigned int isvariadic, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type *rtype, ffi_type **atypes) { unsigned bytes = 0; unsigned int i; ffi_type **ptr; FFI_ASSERT(cif != NULL); - FFI_ASSERT((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI)); + FFI_ASSERT((!isvariadic) || (nfixedargs >= 1)); + FFI_ASSERT(nfixedargs <= ntotalargs); + +#ifndef X86_WIN32 + if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI)) + return FFI_BAD_ABI; +#else + if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI || abi == FFI_THISCALL)) + return FFI_BAD_ABI; +#endif cif->abi = abi; cif->arg_types = atypes; - cif->nargs = nargs; + cif->nargs = ntotalargs; cif->rtype = rtype; cif->flags = 0; @@ -110,12 +134,19 @@ FFI_ASSERT_VALID_TYPE(cif->rtype); /* x86, x86-64 and s390 stack space allocation is handled in prep_machdep. */ -#if !defined M68K && !defined __i386__ && !defined __x86_64__ && !defined S390 && !defined PA +#if !defined M68K && !defined X86_ANY && !defined S390 && !defined PA /* Make space for the return structure pointer */ if (cif->rtype->type == FFI_TYPE_STRUCT #ifdef SPARC && (cif->abi != FFI_V9 || cif->rtype->size > 32) #endif +#ifdef TILE + && (cif->rtype->size > 10 * FFI_SIZEOF_ARG) +#endif +#ifdef XTENSA + && (cif->rtype->size > 16) +#endif + ) bytes = STACK_ARG_SIZE(sizeof(void*)); #endif @@ -131,7 +162,7 @@ check after the initialization. */ FFI_ASSERT_VALID_TYPE(*ptr); -#if !defined __i386__ && !defined __x86_64__ && !defined S390 && !defined PA +#if !defined X86_ANY && !defined S390 && !defined PA #ifdef SPARC if (((*ptr)->type == FFI_TYPE_STRUCT && ((*ptr)->size > 16 || cif->abi != FFI_V9)) @@ -145,6 +176,20 @@ if (((*ptr)->alignment - 1) & bytes) bytes = ALIGN(bytes, (*ptr)->alignment); +#ifdef TILE + if (bytes < 10 * FFI_SIZEOF_ARG && + bytes + STACK_ARG_SIZE((*ptr)->size) > 10 * FFI_SIZEOF_ARG) + { + /* An argument is never split between the 10 parameter + registers and the stack. */ + bytes = 10 * FFI_SIZEOF_ARG; + } +#endif +#ifdef XTENSA + if (bytes <= 6*4 && bytes + STACK_ARG_SIZE((*ptr)->size) > 6*4) + bytes = 6*4; +#endif + bytes += STACK_ARG_SIZE((*ptr)->size); } #endif @@ -153,10 +198,31 @@ cif->bytes = bytes; /* Perform machine dependent cif processing */ +#ifdef FFI_TARGET_SPECIFIC_VARIADIC + if (isvariadic) + return ffi_prep_cif_machdep_var(cif, nfixedargs, ntotalargs); +#endif + return ffi_prep_cif_machdep(cif); } #endif /* not __CRIS__ */ +ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, + ffi_type *rtype, ffi_type **atypes) +{ + return ffi_prep_cif_core(cif, abi, 0, nargs, nargs, rtype, atypes); +} + +ffi_status ffi_prep_cif_var(ffi_cif *cif, + ffi_abi abi, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type *rtype, + ffi_type **atypes) +{ + return ffi_prep_cif_core(cif, abi, 1, nfixedargs, ntotalargs, rtype, atypes); +} + #if FFI_CLOSURES ffi_status diff --git a/Modules/_ctypes/libffi/src/s390/ffi.c b/Modules/_ctypes/libffi/src/s390/ffi.c --- a/Modules/_ctypes/libffi/src/s390/ffi.c +++ b/Modules/_ctypes/libffi/src/s390/ffi.c @@ -750,7 +750,8 @@ void *user_data, void *codeloc) { - FFI_ASSERT (cif->abi == FFI_SYSV); + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; #ifndef __s390x__ *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */ diff --git a/Modules/_ctypes/libffi/src/s390/ffitarget.h b/Modules/_ctypes/libffi/src/s390/ffitarget.h --- a/Modules/_ctypes/libffi/src/s390/ffitarget.h +++ b/Modules/_ctypes/libffi/src/s390/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for S390. Permission is hereby granted, free of charge, to any person obtaining @@ -27,9 +28,15 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #if defined (__s390x__) +#ifndef S390X #define S390X #endif +#endif /* ---- System specific configurations ----------------------------------- */ @@ -40,8 +47,8 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/sh/ffi.c b/Modules/_ctypes/libffi/src/sh/ffi.c --- a/Modules/_ctypes/libffi/src/sh/ffi.c +++ b/Modules/_ctypes/libffi/src/sh/ffi.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Kaz Kojima + ffi.c - Copyright (c) 2002-2008, 2012 Kaz Kojima Copyright (c) 2008 Red Hat, Inc. SuperH Foreign Function Interface @@ -463,7 +463,8 @@ unsigned int *tramp; unsigned int insn; - FFI_ASSERT (cif->abi == FFI_GCC_SYSV); + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; tramp = (unsigned int *) &closure->tramp[0]; /* Set T bit if the function returns a struct pointed with R2. */ diff --git a/Modules/_ctypes/libffi/src/sh/ffitarget.h b/Modules/_ctypes/libffi/src/sh/ffitarget.h --- a/Modules/_ctypes/libffi/src/sh/ffitarget.h +++ b/Modules/_ctypes/libffi/src/sh/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for SuperH. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM @@ -36,8 +41,8 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/sh64/ffi.c b/Modules/_ctypes/libffi/src/sh64/ffi.c --- a/Modules/_ctypes/libffi/src/sh64/ffi.c +++ b/Modules/_ctypes/libffi/src/sh64/ffi.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2003, 2004, 2006, 2007 Kaz Kojima + ffi.c - Copyright (c) 2003, 2004, 2006, 2007, 2012 Kaz Kojima Copyright (c) 2008 Anthony Green SuperH SHmedia Foreign Function Interface @@ -302,7 +302,8 @@ { unsigned int *tramp; - FFI_ASSERT (cif->abi == FFI_GCC_SYSV); + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; tramp = (unsigned int *) &closure->tramp[0]; /* Since ffi_closure is an aligned object, the ffi trampoline is diff --git a/Modules/_ctypes/libffi/src/sh64/ffitarget.h b/Modules/_ctypes/libffi/src/sh64/ffitarget.h --- a/Modules/_ctypes/libffi/src/sh64/ffitarget.h +++ b/Modules/_ctypes/libffi/src/sh64/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for SuperH - SHmedia. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM @@ -36,8 +41,8 @@ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #define FFI_EXTRA_CIF_FIELDS long long flags2 diff --git a/Modules/_ctypes/libffi/src/sparc/ffi.c b/Modules/_ctypes/libffi/src/sparc/ffi.c --- a/Modules/_ctypes/libffi/src/sparc/ffi.c +++ b/Modules/_ctypes/libffi/src/sparc/ffi.c @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1996, 2003, 2004, 2007, 2008 Red Hat, Inc. + ffi.c - Copyright (c) 2011, 2013 Anthony Green + Copyright (c) 1996, 2003-2004, 2007-2008 Red Hat, Inc. SPARC Foreign Function Interface @@ -375,6 +376,10 @@ unsigned, unsigned *, void (*fn)(void)); #endif +#ifndef __GNUC__ +void ffi_flush_icache (void *, size_t); +#endif + void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; @@ -406,8 +411,54 @@ /* We don't yet support calling 32bit code from 64bit */ FFI_ASSERT(0); #else - ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes, - cif->flags, rvalue, fn); + if (rvalue && (cif->rtype->type == FFI_TYPE_STRUCT +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + || cif->flags == FFI_TYPE_LONGDOUBLE +#endif + )) + { + /* For v8, we need an "unimp" with size of returning struct */ + /* behind "call", so we alloc some executable space for it. */ + /* l7 is used, we need to make sure v8.S doesn't use %l7. */ + unsigned int *call_struct = NULL; + ffi_closure_alloc(32, (void **)&call_struct); + if (call_struct) + { + unsigned long f = (unsigned long)fn; + call_struct[0] = 0xae10001f; /* mov %i7, %l7 */ + call_struct[1] = 0xbe10000f; /* mov %o7, %i7 */ + call_struct[2] = 0x03000000 | f >> 10; /* sethi %hi(fn), %g1 */ + call_struct[3] = 0x9fc06000 | (f & 0x3ff); /* jmp %g1+%lo(fn), %o7 */ + call_struct[4] = 0x01000000; /* nop */ + if (cif->rtype->size < 0x7f) + call_struct[5] = cif->rtype->size; /* unimp */ + else + call_struct[5] = 0x01000000; /* nop */ + call_struct[6] = 0x81c7e008; /* ret */ + call_struct[7] = 0xbe100017; /* mov %l7, %i7 */ +#ifdef __GNUC__ + asm volatile ("iflush %0; iflush %0+8; iflush %0+16; iflush %0+24" : : + "r" (call_struct) : "memory"); + /* SPARC v8 requires 5 instructions for flush to be visible */ + asm volatile ("nop; nop; nop; nop; nop"); +#else + ffi_flush_icache (call_struct, 32); +#endif + ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes, + cif->flags, rvalue, call_struct); + ffi_closure_free(call_struct); + } + else + { + ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes, + cif->flags, rvalue, fn); + } + } + else + { + ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes, + cif->flags, rvalue, fn); + } #endif break; case FFI_V9: @@ -425,7 +476,6 @@ FFI_ASSERT(0); break; } - } @@ -447,7 +497,8 @@ #ifdef SPARC64 /* Trampoline address is equal to the closure address. We take advantage of that to reduce the trampoline size by 8 bytes. */ - FFI_ASSERT (cif->abi == FFI_V9); + if (cif->abi != FFI_V9) + return FFI_BAD_ABI; fn = (unsigned long) ffi_closure_v9; tramp[0] = 0x83414000; /* rd %pc, %g1 */ tramp[1] = 0xca586010; /* ldx [%g1+16], %g5 */ @@ -456,7 +507,8 @@ *((unsigned long *) &tramp[4]) = fn; #else unsigned long ctx = (unsigned long) codeloc; - FFI_ASSERT (cif->abi == FFI_V8); + if (cif->abi != FFI_V8) + return FFI_BAD_ABI; fn = (unsigned long) ffi_closure_v8; tramp[0] = 0x03000000 | fn >> 10; /* sethi %hi(fn), %g1 */ tramp[1] = 0x05000000 | ctx >> 10; /* sethi %hi(ctx), %g2 */ @@ -468,13 +520,17 @@ closure->fun = fun; closure->user_data = user_data; - /* Flush the Icache. FIXME: alignment isn't certain, assume 8 bytes */ + /* Flush the Icache. closure is 8 bytes aligned. */ +#ifdef __GNUC__ #ifdef SPARC64 - asm volatile ("flush %0" : : "r" (closure) : "memory"); - asm volatile ("flush %0" : : "r" (((char *) closure) + 8) : "memory"); + asm volatile ("flush %0; flush %0+8" : : "r" (closure) : "memory"); #else - asm volatile ("iflush %0" : : "r" (closure) : "memory"); - asm volatile ("iflush %0" : : "r" (((char *) closure) + 8) : "memory"); + asm volatile ("iflush %0; iflush %0+8" : : "r" (closure) : "memory"); + /* SPARC v8 requires 5 instructions for flush to be visible */ + asm volatile ("nop; nop; nop; nop; nop"); +#endif +#else + ffi_flush_icache (closure, 16); #endif return FFI_OK; diff --git a/Modules/_ctypes/libffi/src/sparc/ffitarget.h b/Modules/_ctypes/libffi/src/sparc/ffitarget.h --- a/Modules/_ctypes/libffi/src/sparc/ffitarget.h +++ b/Modules/_ctypes/libffi/src/sparc/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for SPARC. Permission is hereby granted, free of charge, to any person obtaining @@ -27,11 +28,17 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- System specific configurations ----------------------------------- */ #if defined(__arch64__) || defined(__sparcv9) +#ifndef SPARC64 #define SPARC64 #endif +#endif #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; @@ -42,12 +49,12 @@ FFI_V8, FFI_V8PLUS, FFI_V9, + FFI_LAST_ABI, #ifdef SPARC64 - FFI_DEFAULT_ABI = FFI_V9, + FFI_DEFAULT_ABI = FFI_V9 #else - FFI_DEFAULT_ABI = FFI_V8, + FFI_DEFAULT_ABI = FFI_V8 #endif - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 } ffi_abi; #endif diff --git a/Modules/_ctypes/libffi/src/sparc/v8.S b/Modules/_ctypes/libffi/src/sparc/v8.S --- a/Modules/_ctypes/libffi/src/sparc/v8.S +++ b/Modules/_ctypes/libffi/src/sparc/v8.S @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - v8.S - Copyright (c) 1996, 1997, 2003, 2004, 2008 Red Hat, Inc. + v8.S - Copyright (c) 2013 The Written Word, Inc. + Copyright (c) 1996, 1997, 2003, 2004, 2008 Red Hat, Inc. SPARC Foreign Function Interface @@ -31,11 +32,39 @@ #define STACKFRAME 96 /* Minimum stack framesize for SPARC */ #define ARGS (64+4) /* Offset of register area in frame */ -.text +#ifndef __GNUC__ + .text + .align 8 +.globl ffi_flush_icache +.globl _ffi_flush_icache + +ffi_flush_icache: +_ffi_flush_icache: + add %o0, %o1, %o2 +#ifdef SPARC64 +1: flush %o0 +#else +1: iflush %o0 +#endif + add %o0, 8, %o0 + cmp %o0, %o2 + blt 1b + nop + nop + nop + nop + nop + retl + nop +.ffi_flush_icache_end: + .size ffi_flush_icache,.ffi_flush_icache_end-ffi_flush_icache +#endif + + .text .align 8 .globl ffi_call_v8 .globl _ffi_call_v8 - + ffi_call_v8: _ffi_call_v8: .LLFB1: diff --git a/Modules/_ctypes/libffi/src/sparc/v9.S b/Modules/_ctypes/libffi/src/sparc/v9.S --- a/Modules/_ctypes/libffi/src/sparc/v9.S +++ b/Modules/_ctypes/libffi/src/sparc/v9.S @@ -32,7 +32,7 @@ /* Only compile this in for 64bit builds, because otherwise the object file will have inproper architecture due to used instructions. */ -#define STACKFRAME 128 /* Minimum stack framesize for SPARC */ +#define STACKFRAME 176 /* Minimum stack framesize for SPARC 64-bit */ #define STACK_BIAS 2047 #define ARGS (128) /* Offset of register area in frame */ diff --git a/Modules/_ctypes/libffi/src/tile/ffi.c b/Modules/_ctypes/libffi/src/tile/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/tile/ffi.c @@ -0,0 +1,355 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2012 Tilera Corp. + + TILE Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include +#include +#include +#include +#include +#include +#include + + +/* The first 10 registers are used to pass arguments and return values. */ +#define NUM_ARG_REGS 10 + +/* Performs a raw function call with the given NUM_ARG_REGS register arguments + and the specified additional stack arguments (if any). */ +extern void ffi_call_tile(ffi_sarg reg_args[NUM_ARG_REGS], + const ffi_sarg *stack_args, + size_t stack_args_bytes, + void (*fnaddr)(void)) + FFI_HIDDEN; + +/* This handles the raw call from the closure stub, cleaning up the + parameters and delegating to ffi_closure_tile_inner. */ +extern void ffi_closure_tile(void) FFI_HIDDEN; + + +ffi_status +ffi_prep_cif_machdep(ffi_cif *cif) +{ + /* We always allocate room for all registers. Even if we don't + use them as parameters, they get returned in the same array + as struct return values so we need to make room. */ + if (cif->bytes < NUM_ARG_REGS * FFI_SIZEOF_ARG) + cif->bytes = NUM_ARG_REGS * FFI_SIZEOF_ARG; + + if (cif->rtype->size > NUM_ARG_REGS * FFI_SIZEOF_ARG) + cif->flags = FFI_TYPE_STRUCT; + else + cif->flags = FFI_TYPE_INT; + + /* Nothing to do. */ + return FFI_OK; +} + + +static long +assign_to_ffi_arg(ffi_sarg *out, void *in, const ffi_type *type, + int write_to_reg) +{ + switch (type->type) + { + case FFI_TYPE_SINT8: + *out = *(SINT8 *)in; + return 1; + + case FFI_TYPE_UINT8: + *out = *(UINT8 *)in; + return 1; + + case FFI_TYPE_SINT16: + *out = *(SINT16 *)in; + return 1; + + case FFI_TYPE_UINT16: + *out = *(UINT16 *)in; + return 1; + + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: +#ifndef __LP64__ + case FFI_TYPE_POINTER: +#endif + /* Note that even unsigned 32-bit quantities are sign extended + on tilegx when stored in a register. */ + *out = *(SINT32 *)in; + return 1; + + case FFI_TYPE_FLOAT: +#ifdef __tilegx__ + if (write_to_reg) + { + /* Properly sign extend the value. */ + union { float f; SINT32 s32; } val; + val.f = *(float *)in; + *out = val.s32; + } + else +#endif + { + *(float *)out = *(float *)in; + } + return 1; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_DOUBLE: +#ifdef __LP64__ + case FFI_TYPE_POINTER: +#endif + *(UINT64 *)out = *(UINT64 *)in; + return sizeof(UINT64) / FFI_SIZEOF_ARG; + + case FFI_TYPE_STRUCT: + memcpy(out, in, type->size); + return (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG; + + case FFI_TYPE_VOID: + /* Must be a return type. Nothing to do. */ + return 0; + + default: + FFI_ASSERT(0); + return -1; + } +} + + +void +ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + ffi_sarg * const arg_mem = alloca(cif->bytes); + ffi_sarg * const reg_args = arg_mem; + ffi_sarg * const stack_args = ®_args[NUM_ARG_REGS]; + ffi_sarg *argp = arg_mem; + ffi_type ** const arg_types = cif->arg_types; + const long num_args = cif->nargs; + long i; + + if (cif->flags == FFI_TYPE_STRUCT) + { + /* Pass a hidden pointer to the return value. We make sure there + is scratch space for the callee to store the return value even if + our caller doesn't care about it. */ + *argp++ = (intptr_t)(rvalue ? rvalue : alloca(cif->rtype->size)); + + /* No more work needed to return anything. */ + rvalue = NULL; + } + + for (i = 0; i < num_args; i++) + { + ffi_type *type = arg_types[i]; + void * const arg_in = avalue[i]; + ptrdiff_t arg_word = argp - arg_mem; + +#ifndef __tilegx__ + /* Doubleword-aligned values are always in an even-number register + pair, or doubleword-aligned stack slot if out of registers. */ + long align = arg_word & (type->alignment > FFI_SIZEOF_ARG); + argp += align; + arg_word += align; +#endif + + if (type->type == FFI_TYPE_STRUCT) + { + const size_t arg_size_in_words = + (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG; + + if (arg_word < NUM_ARG_REGS && + arg_word + arg_size_in_words > NUM_ARG_REGS) + { + /* Args are not allowed to span registers and the stack. */ + argp = stack_args; + } + + memcpy(argp, arg_in, type->size); + argp += arg_size_in_words; + } + else + { + argp += assign_to_ffi_arg(argp, arg_in, arg_types[i], 1); + } + } + + /* Actually do the call. */ + ffi_call_tile(reg_args, stack_args, + cif->bytes - (NUM_ARG_REGS * FFI_SIZEOF_ARG), fn); + + if (rvalue != NULL) + assign_to_ffi_arg(rvalue, reg_args, cif->rtype, 0); +} + + +/* Template code for closure. */ +extern const UINT64 ffi_template_tramp_tile[] FFI_HIDDEN; + + +ffi_status +ffi_prep_closure_loc (ffi_closure *closure, + ffi_cif *cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) +{ +#ifdef __tilegx__ + /* TILE-Gx */ + SINT64 c; + SINT64 h; + int s; + UINT64 *out; + + if (cif->abi != FFI_UNIX) + return FFI_BAD_ABI; + + out = (UINT64 *)closure->tramp; + + c = (intptr_t)closure; + h = (intptr_t)ffi_closure_tile; + s = 0; + + /* Find the smallest shift count that doesn't lose information + (i.e. no need to explicitly insert high bits of the address that + are just the sign extension of the low bits). */ + while ((c >> s) != (SINT16)(c >> s) || (h >> s) != (SINT16)(h >> s)) + s += 16; + +#define OPS(a, b, shift) \ + (create_Imm16_X0((a) >> (shift)) | create_Imm16_X1((b) >> (shift))) + + /* Emit the moveli. */ + *out++ = ffi_template_tramp_tile[0] | OPS(c, h, s); + for (s -= 16; s >= 0; s -= 16) + *out++ = ffi_template_tramp_tile[1] | OPS(c, h, s); + +#undef OPS + + *out++ = ffi_template_tramp_tile[2]; + +#else + /* TILEPro */ + UINT64 *out; + intptr_t delta; + + if (cif->abi != FFI_UNIX) + return FFI_BAD_ABI; + + out = (UINT64 *)closure->tramp; + delta = (intptr_t)ffi_closure_tile - (intptr_t)codeloc; + + *out++ = ffi_template_tramp_tile[0] | create_JOffLong_X1(delta >> 3); +#endif + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + invalidate_icache(closure->tramp, (char *)out - closure->tramp, + getpagesize()); + + return FFI_OK; +} + + +/* This is called by the assembly wrapper for closures. This does + all of the work. On entry reg_args[0] holds the values the registers + had when the closure was invoked. On return reg_args[1] holds the register + values to be returned to the caller (many of which may be garbage). */ +void FFI_HIDDEN +ffi_closure_tile_inner(ffi_closure *closure, + ffi_sarg reg_args[2][NUM_ARG_REGS], + ffi_sarg *stack_args) +{ + ffi_cif * const cif = closure->cif; + void ** const avalue = alloca(cif->nargs * sizeof(void *)); + void *rvalue; + ffi_type ** const arg_types = cif->arg_types; + ffi_sarg * const reg_args_in = reg_args[0]; + ffi_sarg * const reg_args_out = reg_args[1]; + ffi_sarg * argp; + long i, arg_word, nargs = cif->nargs; + /* Use a union to guarantee proper alignment for double. */ + union { ffi_sarg arg[NUM_ARG_REGS]; double d; UINT64 u64; } closure_ret; + + /* Start out reading register arguments. */ + argp = reg_args_in; + + /* Copy the caller's structure return address to that the closure + returns the data directly to the caller. */ + if (cif->flags == FFI_TYPE_STRUCT) + { + /* Return by reference via hidden pointer. */ + rvalue = (void *)(intptr_t)*argp++; + arg_word = 1; + } + else + { + /* Return the value in registers. */ + rvalue = &closure_ret; + arg_word = 0; + } + + /* Grab the addresses of the arguments. */ + for (i = 0; i < nargs; i++) + { + ffi_type * const type = arg_types[i]; + const size_t arg_size_in_words = + (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG; + +#ifndef __tilegx__ + /* Doubleword-aligned values are always in an even-number register + pair, or doubleword-aligned stack slot if out of registers. */ + long align = arg_word & (type->alignment > FFI_SIZEOF_ARG); + argp += align; + arg_word += align; +#endif + + if (arg_word == NUM_ARG_REGS || + (arg_word < NUM_ARG_REGS && + arg_word + arg_size_in_words > NUM_ARG_REGS)) + { + /* Switch to reading arguments from the stack. */ + argp = stack_args; + arg_word = NUM_ARG_REGS; + } + + avalue[i] = argp; + argp += arg_size_in_words; + arg_word += arg_size_in_words; + } + + /* Invoke the closure. */ + closure->fun(cif, rvalue, avalue, closure->user_data); + + if (cif->flags != FFI_TYPE_STRUCT) + { + /* Canonicalize for register representation. */ + assign_to_ffi_arg(reg_args_out, &closure_ret, cif->rtype, 1); + } +} diff --git a/Modules/_ctypes/libffi/src/tile/ffitarget.h b/Modules/_ctypes/libffi/src/tile/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/tile/ffitarget.h @@ -0,0 +1,65 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2012 Tilera Corp. + Target configuration macros for TILE. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM + +#include + +typedef uint_reg_t ffi_arg; +typedef int_reg_t ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_UNIX, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_UNIX +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ +#define FFI_CLOSURES 1 + +#ifdef __tilegx__ +/* We always pass 8-byte values, even in -m32 mode. */ +# define FFI_SIZEOF_ARG 8 +# ifdef __LP64__ +# define FFI_TRAMPOLINE_SIZE (8 * 5) /* 5 bundles */ +# else +# define FFI_TRAMPOLINE_SIZE (8 * 3) /* 3 bundles */ +# endif +#else +# define FFI_SIZEOF_ARG 4 +# define FFI_TRAMPOLINE_SIZE 8 /* 1 bundle */ +#endif +#define FFI_NATIVE_RAW_API 0 + +#endif diff --git a/Modules/_ctypes/libffi/src/tile/tile.S b/Modules/_ctypes/libffi/src/tile/tile.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/tile/tile.S @@ -0,0 +1,360 @@ +/* ----------------------------------------------------------------------- + tile.S - Copyright (c) 2011 Tilera Corp. + + Tilera TILEPro and TILE-Gx Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + +/* Number of bytes in a register. */ +#define REG_SIZE FFI_SIZEOF_ARG + +/* Number of bytes in stack linkage area for backtracing. + + A note about the ABI: on entry to a procedure, sp points to a stack + slot where it must spill the return address if it's not a leaf. + REG_SIZE bytes beyond that is a slot owned by the caller which + contains the sp value that the caller had when it was originally + entered (i.e. the caller's frame pointer). */ +#define LINKAGE_SIZE (2 * REG_SIZE) + +/* The first 10 registers are used to pass arguments and return values. */ +#define NUM_ARG_REGS 10 + +#ifdef __tilegx__ +#define SW st +#define LW ld +#define BGZT bgtzt +#else +#define SW sw +#define LW lw +#define BGZT bgzt +#endif + + +/* void ffi_call_tile (int_reg_t reg_args[NUM_ARG_REGS], + const int_reg_t *stack_args, + unsigned long stack_args_bytes, + void (*fnaddr)(void)); + + On entry, REG_ARGS contain the outgoing register values, + and STACK_ARGS containts STACK_ARG_BYTES of additional values + to be passed on the stack. If STACK_ARG_BYTES is zero, then + STACK_ARGS is ignored. + + When the invoked function returns, the values of r0-r9 are + blindly stored back into REG_ARGS for the caller to examine. */ + + .section .text.ffi_call_tile, "ax", @progbits + .align 8 + .globl ffi_call_tile + FFI_HIDDEN(ffi_call_tile) +ffi_call_tile: + +/* Incoming arguments. */ +#define REG_ARGS r0 +#define INCOMING_STACK_ARGS r1 +#define STACK_ARG_BYTES r2 +#define ORIG_FNADDR r3 + +/* Temporary values. */ +#define FRAME_SIZE r10 +#define TMP r11 +#define TMP2 r12 +#define OUTGOING_STACK_ARGS r13 +#define REG_ADDR_PTR r14 +#define RETURN_REG_ADDR r15 +#define FNADDR r16 + + .cfi_startproc + { + /* Save return address. */ + SW sp, lr + .cfi_offset lr, 0 + /* Prepare to spill incoming r52. */ + addi TMP, sp, -REG_SIZE + /* Increase frame size to have room to spill r52 and REG_ARGS. + The +7 is to round up mod 8. */ + addi FRAME_SIZE, STACK_ARG_BYTES, \ + REG_SIZE + REG_SIZE + LINKAGE_SIZE + 7 + } + { + /* Round stack frame size to a multiple of 8 to satisfy ABI. */ + andi FRAME_SIZE, FRAME_SIZE, -8 + /* Compute where to spill REG_ARGS value. */ + addi TMP2, sp, -(REG_SIZE * 2) + } + { + /* Spill incoming r52. */ + SW TMP, r52 + .cfi_offset r52, -REG_SIZE + /* Set up our frame pointer. */ + move r52, sp + .cfi_def_cfa_register r52 + /* Push stack frame. */ + sub sp, sp, FRAME_SIZE + } + { + /* Prepare to set up stack linkage. */ + addi TMP, sp, REG_SIZE + /* Prepare to memcpy stack args. */ + addi OUTGOING_STACK_ARGS, sp, LINKAGE_SIZE + /* Save REG_ARGS which we will need after we call the subroutine. */ + SW TMP2, REG_ARGS + } + { + /* Set up linkage info to hold incoming stack pointer. */ + SW TMP, r52 + } + { + /* Skip stack args memcpy if we don't have any stack args (common). */ + blezt STACK_ARG_BYTES, .Ldone_stack_args_memcpy + } + +.Lmemcpy_stack_args: + { + /* Load incoming argument from stack_args. */ + LW TMP, INCOMING_STACK_ARGS + addi INCOMING_STACK_ARGS, INCOMING_STACK_ARGS, REG_SIZE + } + { + /* Store stack argument into outgoing stack argument area. */ + SW OUTGOING_STACK_ARGS, TMP + addi OUTGOING_STACK_ARGS, OUTGOING_STACK_ARGS, REG_SIZE + addi STACK_ARG_BYTES, STACK_ARG_BYTES, -REG_SIZE + } + { + BGZT STACK_ARG_BYTES, .Lmemcpy_stack_args + } +.Ldone_stack_args_memcpy: + + { + /* Copy aside ORIG_FNADDR so we can overwrite its register. */ + move FNADDR, ORIG_FNADDR + /* Prepare to load argument registers. */ + addi REG_ADDR_PTR, r0, REG_SIZE + /* Load outgoing r0. */ + LW r0, r0 + } + + /* Load up argument registers from the REG_ARGS array. */ +#define LOAD_REG(REG, PTR) \ + { \ + LW REG, PTR ; \ + addi PTR, PTR, REG_SIZE \ + } + + LOAD_REG(r1, REG_ADDR_PTR) + LOAD_REG(r2, REG_ADDR_PTR) + LOAD_REG(r3, REG_ADDR_PTR) + LOAD_REG(r4, REG_ADDR_PTR) + LOAD_REG(r5, REG_ADDR_PTR) + LOAD_REG(r6, REG_ADDR_PTR) + LOAD_REG(r7, REG_ADDR_PTR) + LOAD_REG(r8, REG_ADDR_PTR) + LOAD_REG(r9, REG_ADDR_PTR) + + { + /* Call the subroutine. */ + jalr FNADDR + } + + { + /* Restore original lr. */ + LW lr, r52 + /* Prepare to recover ARGS, which we spilled earlier. */ + addi TMP, r52, -(2 * REG_SIZE) + } + { + /* Restore ARGS, so we can fill it in with the return regs r0-r9. */ + LW RETURN_REG_ADDR, TMP + /* Prepare to restore original r52. */ + addi TMP, r52, -REG_SIZE + } + + { + /* Pop stack frame. */ + move sp, r52 + /* Restore original r52. */ + LW r52, TMP + } + +#define STORE_REG(REG, PTR) \ + { \ + SW PTR, REG ; \ + addi PTR, PTR, REG_SIZE \ + } + + /* Return all register values by reference. */ + STORE_REG(r0, RETURN_REG_ADDR) + STORE_REG(r1, RETURN_REG_ADDR) + STORE_REG(r2, RETURN_REG_ADDR) + STORE_REG(r3, RETURN_REG_ADDR) + STORE_REG(r4, RETURN_REG_ADDR) + STORE_REG(r5, RETURN_REG_ADDR) + STORE_REG(r6, RETURN_REG_ADDR) + STORE_REG(r7, RETURN_REG_ADDR) + STORE_REG(r8, RETURN_REG_ADDR) + STORE_REG(r9, RETURN_REG_ADDR) + + { + jrp lr + } + + .cfi_endproc + .size ffi_call_tile, .-ffi_call_tile + +/* ffi_closure_tile(...) + + On entry, lr points to the closure plus 8 bytes, and r10 + contains the actual return address. + + This function simply dumps all register parameters into a stack array + and passes the closure, the registers array, and the stack arguments + to C code that does all of the actual closure processing. */ + + .section .text.ffi_closure_tile, "ax", @progbits + .align 8 + .globl ffi_closure_tile + FFI_HIDDEN(ffi_closure_tile) + + .cfi_startproc +/* Room to spill all NUM_ARG_REGS incoming registers, plus frame linkage. */ +#define CLOSURE_FRAME_SIZE (((NUM_ARG_REGS * REG_SIZE * 2 + LINKAGE_SIZE) + 7) & -8) +ffi_closure_tile: + { +#ifdef __tilegx__ + st sp, lr + .cfi_offset lr, 0 +#else + /* Save return address (in r10 due to closure stub wrapper). */ + SW sp, r10 + .cfi_return_column r10 + .cfi_offset r10, 0 +#endif + /* Compute address for stack frame linkage. */ + addli r10, sp, -(CLOSURE_FRAME_SIZE - REG_SIZE) + } + { + /* Save incoming stack pointer in linkage area. */ + SW r10, sp + .cfi_offset sp, -(CLOSURE_FRAME_SIZE - REG_SIZE) + /* Push a new stack frame. */ + addli sp, sp, -CLOSURE_FRAME_SIZE + .cfi_adjust_cfa_offset CLOSURE_FRAME_SIZE + } + + { + /* Create pointer to where to start spilling registers. */ + addi r10, sp, LINKAGE_SIZE + } + + /* Spill all the incoming registers. */ + STORE_REG(r0, r10) + STORE_REG(r1, r10) + STORE_REG(r2, r10) + STORE_REG(r3, r10) + STORE_REG(r4, r10) + STORE_REG(r5, r10) + STORE_REG(r6, r10) + STORE_REG(r7, r10) + STORE_REG(r8, r10) + { + /* Save r9. */ + SW r10, r9 +#ifdef __tilegx__ + /* Pointer to closure is passed in r11. */ + move r0, r11 +#else + /* Compute pointer to the closure object. Because the closure + starts with a "jal ffi_closure_tile", we can just take the + value of lr (a phony return address pointing into the closure) + and subtract 8. */ + addi r0, lr, -8 +#endif + /* Compute a pointer to the register arguments we just spilled. */ + addi r1, sp, LINKAGE_SIZE + } + { + /* Compute a pointer to the extra stack arguments (if any). */ + addli r2, sp, CLOSURE_FRAME_SIZE + LINKAGE_SIZE + /* Call C code to deal with all of the grotty details. */ + jal ffi_closure_tile_inner + } + { + addli r10, sp, CLOSURE_FRAME_SIZE + } + { + /* Restore the return address. */ + LW lr, r10 + /* Compute pointer to registers array. */ + addli r10, sp, LINKAGE_SIZE + (NUM_ARG_REGS * REG_SIZE) + } + /* Return all the register values, which C code may have set. */ + LOAD_REG(r0, r10) + LOAD_REG(r1, r10) + LOAD_REG(r2, r10) + LOAD_REG(r3, r10) + LOAD_REG(r4, r10) + LOAD_REG(r5, r10) + LOAD_REG(r6, r10) + LOAD_REG(r7, r10) + LOAD_REG(r8, r10) + LOAD_REG(r9, r10) + { + /* Pop the frame. */ + addli sp, sp, CLOSURE_FRAME_SIZE + jrp lr + } + + .cfi_endproc + .size ffi_closure_tile, . - ffi_closure_tile + + +/* What follows are code template instructions that get copied to the + closure trampoline by ffi_prep_closure_loc. The zeroed operands + get replaced by their proper values at runtime. */ + + .section .text.ffi_template_tramp_tile, "ax", @progbits + .align 8 + .globl ffi_template_tramp_tile + FFI_HIDDEN(ffi_template_tramp_tile) +ffi_template_tramp_tile: +#ifdef __tilegx__ + { + moveli r11, 0 /* backpatched to address of containing closure. */ + moveli r10, 0 /* backpatched to ffi_closure_tile. */ + } + /* Note: the following bundle gets generated multiple times + depending on the pointer value (esp. useful for -m32 mode). */ + { shl16insli r11, r11, 0 ; shl16insli r10, r10, 0 } + { info 2+8 /* for backtracer: -> pc in lr, frame size 0 */ ; jr r10 } +#else + /* 'jal .' yields a PC-relative offset of zero so we can OR in the + right offset at runtime. */ + { move r10, lr ; jal . /* ffi_closure_tile */ } +#endif + + .size ffi_template_tramp_tile, . - ffi_template_tramp_tile diff --git a/Modules/_ctypes/libffi/src/x86/ffi.c b/Modules/_ctypes/libffi/src/x86/ffi.c --- a/Modules/_ctypes/libffi/src/x86/ffi.c +++ b/Modules/_ctypes/libffi/src/x86/ffi.c @@ -3,7 +3,7 @@ Copyright (c) 2002 Ranjit Mathew Copyright (c) 2002 Bo Thorsen Copyright (c) 2002 Roger Sayle - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2010 Free Software Foundation, Inc. x86 Foreign Function Interface @@ -48,10 +48,18 @@ register void **p_argv; register char *argp; register ffi_type **p_arg; +#ifdef X86_WIN32 + size_t p_stack_args[2]; + void *p_stack_data[2]; + char *argp2 = stack; + int stack_args_count = 0; + int cabi = ecif->cif->abi; +#endif argp = stack; - if (ecif->cif->flags == FFI_TYPE_STRUCT + if ((ecif->cif->flags == FFI_TYPE_STRUCT + || ecif->cif->flags == FFI_TYPE_MS_STRUCT) #ifdef X86_WIN64 && (ecif->cif->rtype->size != 1 && ecif->cif->rtype->size != 2 && ecif->cif->rtype->size != 4 && ecif->cif->rtype->size != 8) @@ -59,6 +67,16 @@ ) { *(void **) argp = ecif->rvalue; +#ifdef X86_WIN32 + /* For fastcall/thiscall this is first register-passed + argument. */ + if (cabi == FFI_THISCALL || cabi == FFI_FASTCALL) + { + p_stack_args[stack_args_count] = sizeof (void*); + p_stack_data[stack_args_count] = argp; + ++stack_args_count; + } +#endif argp += sizeof(void*); } @@ -134,6 +152,24 @@ { memcpy(argp, *p_argv, z); } + +#ifdef X86_WIN32 + /* For thiscall/fastcall convention register-passed arguments + are the first two none-floating-point arguments with a size + smaller or equal to sizeof (void*). */ + if ((cabi == FFI_THISCALL && stack_args_count < 1) + || (cabi == FFI_FASTCALL && stack_args_count < 2)) + { + if (z <= 4 + && ((*p_arg)->type != FFI_TYPE_FLOAT + && (*p_arg)->type != FFI_TYPE_STRUCT)) + { + p_stack_args[stack_args_count] = z; + p_stack_data[stack_args_count] = argp; + ++stack_args_count; + } + } +#endif p_argv++; #ifdef X86_WIN64 argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); @@ -141,7 +177,45 @@ argp += z; #endif } - + +#ifdef X86_WIN32 + /* We need to move the register-passed arguments for thiscall/fastcall + on top of stack, so that those can be moved to registers ecx/edx by + call-handler. */ + if (stack_args_count > 0) + { + size_t zz = (p_stack_args[0] + 3) & ~3; + char *h; + + /* Move first argument to top-stack position. */ + if (p_stack_data[0] != argp2) + { + h = alloca (zz + 1); + memcpy (h, p_stack_data[0], zz); + memmove (argp2 + zz, argp2, + (size_t) ((char *) p_stack_data[0] - (char*)argp2)); + memcpy (argp2, h, zz); + } + + argp2 += zz; + --stack_args_count; + if (zz > 4) + stack_args_count = 0; + + /* If we have a second argument, then move it on top + after the first one. */ + if (stack_args_count > 0 && p_stack_data[1] != argp2) + { + zz = p_stack_args[1]; + zz = (zz + 3) & ~3; + h = alloca (zz + 1); + h = alloca (zz + 1); + memcpy (h, p_stack_data[1], zz); + memmove (argp2 + zz, argp2, (size_t) ((char*) p_stack_data[1] - (char*)argp2)); + memcpy (argp2, h, zz); + } + } +#endif return; } @@ -155,12 +229,10 @@ switch (cif->rtype->type) { case FFI_TYPE_VOID: -#if defined(X86) || defined (X86_WIN32) || defined(X86_FREEBSD) || defined(X86_DARWIN) || defined(X86_WIN64) case FFI_TYPE_UINT8: case FFI_TYPE_UINT16: case FFI_TYPE_SINT8: case FFI_TYPE_SINT16: -#endif #ifdef X86_WIN64 case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: @@ -208,8 +280,13 @@ else #endif { - cif->flags = FFI_TYPE_STRUCT; - // allocate space for return value pointer +#ifdef X86_WIN32 + if (cif->abi == FFI_MS_CDECL) + cif->flags = FFI_TYPE_MS_STRUCT; + else +#endif + cif->flags = FFI_TYPE_STRUCT; + /* allocate space for return value pointer */ cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG); } break; @@ -234,13 +311,11 @@ } #ifdef X86_WIN64 - // ensure space for storing four registers + /* ensure space for storing four registers */ cif->bytes += 4 * sizeof(ffi_arg); #endif -#ifdef X86_DARWIN cif->bytes = (cif->bytes + 15) & ~0xF; -#endif return FFI_OK; } @@ -252,7 +327,7 @@ #elif defined(X86_WIN32) extern void ffi_call_win32(void (*)(char *, extended_cif *), extended_cif *, - unsigned, unsigned, unsigned *, void (*fn)(void)); + unsigned, unsigned, unsigned, unsigned *, void (*fn)(void)); #else extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); @@ -278,7 +353,8 @@ } #else if (rvalue == NULL - && cif->flags == FFI_TYPE_STRUCT) + && (cif->flags == FFI_TYPE_STRUCT + || cif->flags == FFI_TYPE_MS_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } @@ -291,33 +367,44 @@ { #ifdef X86_WIN64 case FFI_WIN64: - { - // Make copies of all struct arguments - // NOTE: not sure if responsibility should be here or in caller - unsigned int i; - for (i=0; i < cif->nargs;i++) { - size_t size = cif->arg_types[i]->size; - if ((cif->arg_types[i]->type == FFI_TYPE_STRUCT - && (size != 1 && size != 2 && size != 4 && size != 8)) -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - || cif->arg_types[i]->type == FFI_TYPE_LONGDOUBLE -#endif - ) - { - void *local = alloca(size); - memcpy(local, avalue[i], size); - avalue[i] = local; - } - } - ffi_call_win64(ffi_prep_args, &ecif, cif->bytes, - cif->flags, ecif.rvalue, fn); - } + ffi_call_win64(ffi_prep_args, &ecif, cif->bytes, + cif->flags, ecif.rvalue, fn); break; #elif defined(X86_WIN32) case FFI_SYSV: case FFI_STDCALL: - ffi_call_win32(ffi_prep_args, &ecif, cif->bytes, cif->flags, - ecif.rvalue, fn); + case FFI_MS_CDECL: + ffi_call_win32(ffi_prep_args, &ecif, cif->abi, cif->bytes, cif->flags, + ecif.rvalue, fn); + break; + case FFI_THISCALL: + case FFI_FASTCALL: + { + unsigned int abi = cif->abi; + unsigned int i, passed_regs = 0; + + if (cif->flags == FFI_TYPE_STRUCT) + ++passed_regs; + + for (i=0; i < cif->nargs && passed_regs < 2;i++) + { + size_t sz; + + if (cif->arg_types[i]->type == FFI_TYPE_FLOAT + || cif->arg_types[i]->type == FFI_TYPE_STRUCT) + continue; + sz = (cif->arg_types[i]->size + 3) & ~3; + if (sz == 0 || sz > 4) + continue; + ++passed_regs; + } + if (passed_regs < 2 && abi == FFI_FASTCALL) + abi = FFI_THISCALL; + if (passed_regs < 1 && abi == FFI_THISCALL) + abi = FFI_STDCALL; + ffi_call_win32(ffi_prep_args, &ecif, abi, cif->bytes, cif->flags, + ecif.rvalue, fn); + } break; #else case FFI_SYSV: @@ -335,7 +422,7 @@ /** private members **/ /* The following __attribute__((regparm(1))) decorations will have no effect - on MSVC - standard cdecl convention applies. */ + on MSVC or SUNPRO_C -- standard conventions apply. */ static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, void** args, ffi_cif* cif); void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *) @@ -345,8 +432,12 @@ void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *) __attribute__ ((regparm(1))); #ifdef X86_WIN32 +void FFI_HIDDEN ffi_closure_raw_THISCALL (ffi_raw_closure *) + __attribute__ ((regparm(1))); void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *) __attribute__ ((regparm(1))); +void FFI_HIDDEN ffi_closure_THISCALL (ffi_closure *) + __attribute__ ((regparm(1))); #endif #ifdef X86_WIN64 void FFI_HIDDEN ffi_closure_win64 (ffi_closure *); @@ -428,7 +519,8 @@ argp += sizeof(void *); } #else - if ( cif->flags == FFI_TYPE_STRUCT ) { + if ( cif->flags == FFI_TYPE_STRUCT + || cif->flags == FFI_TYPE_MS_STRUCT ) { *rvalue = *(void **) argp; argp += sizeof(void *); } @@ -506,6 +598,33 @@ *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ } +#define FFI_INIT_TRAMPOLINE_THISCALL(TRAMP,FUN,CTX,SIZE) \ +{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + unsigned int __fun = (unsigned int)(FUN); \ + unsigned int __ctx = (unsigned int)(CTX); \ + unsigned int __dis = __fun - (__ctx + 49); \ + unsigned short __size = (unsigned short)(SIZE); \ + *(unsigned int *) &__tramp[0] = 0x8324048b; /* mov (%esp), %eax */ \ + *(unsigned int *) &__tramp[4] = 0x4c890cec; /* sub $12, %esp */ \ + *(unsigned int *) &__tramp[8] = 0x04890424; /* mov %ecx, 4(%esp) */ \ + *(unsigned char*) &__tramp[12] = 0x24; /* mov %eax, (%esp) */ \ + *(unsigned char*) &__tramp[13] = 0xb8; \ + *(unsigned int *) &__tramp[14] = __size; /* mov __size, %eax */ \ + *(unsigned int *) &__tramp[18] = 0x08244c8d; /* lea 8(%esp), %ecx */ \ + *(unsigned int *) &__tramp[22] = 0x4802e8c1; /* shr $2, %eax ; dec %eax */ \ + *(unsigned short*) &__tramp[26] = 0x0b74; /* jz 1f */ \ + *(unsigned int *) &__tramp[28] = 0x8908518b; /* 2b: mov 8(%ecx), %edx */ \ + *(unsigned int *) &__tramp[32] = 0x04c18311; /* mov %edx, (%ecx) ; add $4, %ecx */ \ + *(unsigned char*) &__tramp[36] = 0x48; /* dec %eax */ \ + *(unsigned short*) &__tramp[37] = 0xf575; /* jnz 2b ; 1f: */ \ + *(unsigned char*) &__tramp[39] = 0xb8; \ + *(unsigned int*) &__tramp[40] = __ctx; /* movl __ctx, %eax */ \ + *(unsigned char *) &__tramp[44] = 0xe8; \ + *(unsigned int*) &__tramp[45] = __dis; /* call __fun */ \ + *(unsigned char*) &__tramp[49] = 0xc2; /* ret */ \ + *(unsigned short*) &__tramp[50] = (__size + 8); /* ret (__size + 8) */ \ + } + #define FFI_INIT_TRAMPOLINE_STDCALL(TRAMP,FUN,CTX,SIZE) \ { unsigned char *__tramp = (unsigned char*)(TRAMP); \ unsigned int __fun = (unsigned int)(FUN); \ @@ -548,12 +667,25 @@ (void*)codeloc); } #ifdef X86_WIN32 + else if (cif->abi == FFI_THISCALL) + { + FFI_INIT_TRAMPOLINE_THISCALL (&closure->tramp[0], + &ffi_closure_THISCALL, + (void*)codeloc, + cif->bytes); + } else if (cif->abi == FFI_STDCALL) { FFI_INIT_TRAMPOLINE_STDCALL (&closure->tramp[0], &ffi_closure_STDCALL, (void*)codeloc, cif->bytes); } + else if (cif->abi == FFI_MS_CDECL) + { + FFI_INIT_TRAMPOLINE (&closure->tramp[0], + &ffi_closure_SYSV, + (void*)codeloc); + } #endif /* X86_WIN32 */ #endif /* !X86_WIN64 */ else @@ -582,6 +714,9 @@ int i; if (cif->abi != FFI_SYSV) { +#ifdef X86_WIN32 + if (cif->abi != FFI_THISCALL) +#endif return FFI_BAD_ABI; } @@ -596,10 +731,20 @@ FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE); } - +#ifdef X86_WIN32 + if (cif->abi == FFI_SYSV) + { +#endif FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV, codeloc); - +#ifdef X86_WIN32 + } + else if (cif->abi == FFI_THISCALL) + { + FFI_INIT_TRAMPOLINE_THISCALL (&closure->tramp[0], &ffi_closure_raw_THISCALL, + codeloc, cif->bytes); + } +#endif closure->cif = cif; closure->user_data = user_data; closure->fun = fun; @@ -630,8 +775,9 @@ /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ - if ((rvalue == NULL) && - (cif->rtype->type == FFI_TYPE_STRUCT)) + if (rvalue == NULL + && (cif->flags == FFI_TYPE_STRUCT + || cif->flags == FFI_TYPE_MS_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } @@ -644,8 +790,38 @@ #ifdef X86_WIN32 case FFI_SYSV: case FFI_STDCALL: - ffi_call_win32(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags, - ecif.rvalue, fn); + case FFI_MS_CDECL: + ffi_call_win32(ffi_prep_args_raw, &ecif, cif->abi, cif->bytes, cif->flags, + ecif.rvalue, fn); + break; + case FFI_THISCALL: + case FFI_FASTCALL: + { + unsigned int abi = cif->abi; + unsigned int i, passed_regs = 0; + + if (cif->flags == FFI_TYPE_STRUCT) + ++passed_regs; + + for (i=0; i < cif->nargs && passed_regs < 2;i++) + { + size_t sz; + + if (cif->arg_types[i]->type == FFI_TYPE_FLOAT + || cif->arg_types[i]->type == FFI_TYPE_STRUCT) + continue; + sz = (cif->arg_types[i]->size + 3) & ~3; + if (sz == 0 || sz > 4) + continue; + ++passed_regs; + } + if (passed_regs < 2 && abi == FFI_FASTCALL) + cif->abi = abi = FFI_THISCALL; + if (passed_regs < 1 && abi == FFI_THISCALL) + cif->abi = abi = FFI_STDCALL; + ffi_call_win32(ffi_prep_args_raw, &ecif, abi, cif->bytes, cif->flags, + ecif.rvalue, fn); + } break; #else case FFI_SYSV: diff --git a/Modules/_ctypes/libffi/src/x86/ffi64.c b/Modules/_ctypes/libffi/src/x86/ffi64.c --- a/Modules/_ctypes/libffi/src/x86/ffi64.c +++ b/Modules/_ctypes/libffi/src/x86/ffi64.c @@ -1,7 +1,9 @@ /* ----------------------------------------------------------------------- - ffi64.c - Copyright (c) 2002, 2007 Bo Thorsen - Copyright (c) 2008 Red Hat, Inc. - + ffi64.c - Copyright (c) 2013 The Written Word, Inc. + Copyright (c) 2011 Anthony Green + Copyright (c) 2008, 2010 Red Hat, Inc. + Copyright (c) 2002, 2007 Bo Thorsen + x86-64 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining @@ -36,11 +38,29 @@ #define MAX_GPR_REGS 6 #define MAX_SSE_REGS 8 +#if defined(__INTEL_COMPILER) +#define UINT128 __m128 +#else +#if defined(__SUNPRO_C) +#include +#define UINT128 __m128i +#else +#define UINT128 __int128_t +#endif +#endif + +union big_int_union +{ + UINT32 i32; + UINT64 i64; + UINT128 i128; +}; + struct register_args { /* Registers for argument passing. */ UINT64 gpr[MAX_GPR_REGS]; - __int128_t sse[MAX_SSE_REGS]; + union big_int_union sse[MAX_SSE_REGS]; }; extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, @@ -378,7 +398,7 @@ if (align < 8) align = 8; - bytes = ALIGN(bytes, align); + bytes = ALIGN (bytes, align); bytes += cif->arg_types[i]->size; } else @@ -390,7 +410,7 @@ if (ssecount) flags |= 1 << 11; cif->flags = flags; - cif->bytes = bytes; + cif->bytes = ALIGN (bytes, 8); return FFI_OK; } @@ -426,7 +446,7 @@ /* If the return value is passed in memory, add the pointer as the first integer argument. */ if (ret_in_memory) - reg_args->gpr[gprcount++] = (long) rvalue; + reg_args->gpr[gprcount++] = (unsigned long) rvalue; avn = cif->nargs; arg_types = cif->arg_types; @@ -464,16 +484,33 @@ { case X86_64_INTEGER_CLASS: case X86_64_INTEGERSI_CLASS: - reg_args->gpr[gprcount] = 0; - memcpy (®_args->gpr[gprcount], a, size < 8 ? size : 8); + /* Sign-extend integer arguments passed in general + purpose registers, to cope with the fact that + LLVM incorrectly assumes that this will be done + (the x86-64 PS ABI does not specify this). */ + switch (arg_types[i]->type) + { + case FFI_TYPE_SINT8: + *(SINT64 *)®_args->gpr[gprcount] = (SINT64) *((SINT8 *) a); + break; + case FFI_TYPE_SINT16: + *(SINT64 *)®_args->gpr[gprcount] = (SINT64) *((SINT16 *) a); + break; + case FFI_TYPE_SINT32: + *(SINT64 *)®_args->gpr[gprcount] = (SINT64) *((SINT32 *) a); + break; + default: + reg_args->gpr[gprcount] = 0; + memcpy (®_args->gpr[gprcount], a, size < 8 ? size : 8); + } gprcount++; break; case X86_64_SSE_CLASS: case X86_64_SSEDF_CLASS: - reg_args->sse[ssecount++] = *(UINT64 *) a; + reg_args->sse[ssecount++].i64 = *(UINT64 *) a; break; case X86_64_SSESF_CLASS: - reg_args->sse[ssecount++] = *(UINT32 *) a; + reg_args->sse[ssecount++].i32 = *(UINT32 *) a; break; default: abort(); @@ -498,12 +535,21 @@ { volatile unsigned short *tramp; + /* Sanity check on the cif ABI. */ + { + int abi = cif->abi; + if (UNLIKELY (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI))) + return FFI_BAD_ABI; + } + tramp = (volatile unsigned short *) &closure->tramp[0]; tramp[0] = 0xbb49; /* mov , %r11 */ - *(void * volatile *) &tramp[1] = ffi_closure_unix64; + *((unsigned long long * volatile) &tramp[1]) + = (unsigned long) ffi_closure_unix64; tramp[5] = 0xba49; /* mov , %r10 */ - *(void * volatile *) &tramp[6] = codeloc; + *((unsigned long long * volatile) &tramp[6]) + = (unsigned long) codeloc; /* Set the carry bit iff the function uses any sse registers. This is clc or stc, together with the first byte of the jmp. */ @@ -542,7 +588,7 @@ { /* The return value goes in memory. Arrange for the closure return value to go directly back to the original caller. */ - rvalue = (void *) reg_args->gpr[gprcount++]; + rvalue = (void *) (unsigned long) reg_args->gpr[gprcount++]; /* We don't have to do anything in asm for the return. */ ret = FFI_TYPE_VOID; } diff --git a/Modules/_ctypes/libffi/src/x86/ffitarget.h b/Modules/_ctypes/libffi/src/x86/ffitarget.h --- a/Modules/_ctypes/libffi/src/x86/ffitarget.h +++ b/Modules/_ctypes/libffi/src/x86/ffitarget.h @@ -1,6 +1,7 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003, 2010 Red Hat, Inc. - Copyright (C) 2008 Free Software Foundation, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003, 2010 Red Hat, Inc. + Copyright (C) 2008 Free Software Foundation, Inc. Target configuration macros for x86 and x86-64. @@ -29,8 +30,15 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + /* ---- System specific configurations ----------------------------------- */ +/* For code common to all platforms on x86 and x86_64. */ +#define X86_ANY + #if defined (X86_64) && defined (__i386__) #undef X86_64 #define X86 @@ -38,7 +46,7 @@ #ifdef X86_WIN64 #define FFI_SIZEOF_ARG 8 -#define USE_BUILTIN_FFS 0 // not yet implemented in mingw-64 +#define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */ #endif /* ---- Generic type definitions ----------------------------------------- */ @@ -53,9 +61,16 @@ typedef long long ffi_sarg; #endif #else +#if defined __x86_64__ && defined __ILP32__ +#define FFI_SIZEOF_ARG 8 +#define FFI_SIZEOF_JAVA_RAW 4 +typedef unsigned long long ffi_arg; +typedef long long ffi_sarg; +#else typedef unsigned long ffi_arg; typedef signed long ffi_sarg; #endif +#endif typedef enum ffi_abi { FFI_FIRST_ABI = 0, @@ -64,28 +79,32 @@ #ifdef X86_WIN32 FFI_SYSV, FFI_STDCALL, - /* TODO: Add fastcall support for the sake of completeness */ - FFI_DEFAULT_ABI = FFI_SYSV, + FFI_THISCALL, + FFI_FASTCALL, + FFI_MS_CDECL, + FFI_LAST_ABI, +#ifdef _MSC_VER + FFI_DEFAULT_ABI = FFI_MS_CDECL +#else + FFI_DEFAULT_ABI = FFI_SYSV #endif -#ifdef X86_WIN64 +#elif defined(X86_WIN64) FFI_WIN64, - FFI_DEFAULT_ABI = FFI_WIN64, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_WIN64 + #else - /* ---- Intel x86 and AMD x86-64 - */ -#if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__) || defined(__i386) || defined(__amd64)) FFI_SYSV, FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */ + FFI_LAST_ABI, #if defined(__i386__) || defined(__i386) - FFI_DEFAULT_ABI = FFI_SYSV, + FFI_DEFAULT_ABI = FFI_SYSV #else - FFI_DEFAULT_ABI = FFI_UNIX64, + FFI_DEFAULT_ABI = FFI_UNIX64 #endif #endif -#endif /* X86_WIN64 */ - - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 } ffi_abi; #endif @@ -95,13 +114,14 @@ #define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1) #define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2) #define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3) +#define FFI_TYPE_MS_STRUCT (FFI_TYPE_LAST + 4) #if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) #define FFI_TRAMPOLINE_SIZE 24 #define FFI_NATIVE_RAW_API 0 #else #ifdef X86_WIN32 -#define FFI_TRAMPOLINE_SIZE 13 +#define FFI_TRAMPOLINE_SIZE 52 #else #ifdef X86_WIN64 #define FFI_TRAMPOLINE_SIZE 29 diff --git a/Modules/_ctypes/libffi/src/x86/sysv.S b/Modules/_ctypes/libffi/src/x86/sysv.S --- a/Modules/_ctypes/libffi/src/x86/sysv.S +++ b/Modules/_ctypes/libffi/src/x86/sysv.S @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 1996, 1998, 2001-2003, 2005, 2008 Red Hat, Inc. + sysv.S - Copyright (c) 2013 The Written Word, Inc. + - Copyright (c) 1996,1998,2001-2003,2005,2008,2010 Red Hat, Inc. X86 Foreign Function Interface @@ -48,6 +49,9 @@ movl 16(%ebp),%ecx subl %ecx,%esp + /* Align the stack pointer to 16-bytes */ + andl $0xfffffff0, %esp + movl %esp,%eax /* Place all of the ffi_prep_args in position */ @@ -178,9 +182,19 @@ leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 8(%ebp), %edx +#ifdef __SUNPRO_C + /* The SUNPRO compiler doesn't support GCC's regparm function + attribute, so we have to pass all three arguments to + ffi_closure_SYSV_inner on the stack. */ + movl %edx, 8(%esp) /* args = __builtin_dwarf_cfa () */ + leal -12(%ebp), %edx + movl %edx, 4(%esp) /* &resp */ + movl %eax, (%esp) /* closure */ +#else movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ +#endif #if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__ call ffi_closure_SYSV_inner #else @@ -325,23 +339,55 @@ .size ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV #endif +#if defined __GNUC__ +/* Only emit dwarf unwind info when building with GNU toolchain. */ + +#if defined __PIC__ +# if defined __sun__ && defined __svr4__ +/* 32-bit Solaris 2/x86 uses datarel encoding for PIC. GNU ld before 2.22 + doesn't correctly sort .eh_frame_hdr with mixed encodings, so match this. */ +# define FDE_ENCODING 0x30 /* datarel */ +# define FDE_ENCODE(X) X at GOTOFF +# else +# define FDE_ENCODING 0x1b /* pcrel sdata4 */ +# if defined HAVE_AS_X86_PCREL +# define FDE_ENCODE(X) X-. +# else +# define FDE_ENCODE(X) X at rel +# endif +# endif +#else +# define FDE_ENCODING 0 /* absolute */ +# define FDE_ENCODE(X) X +#endif + .section .eh_frame,EH_FRAME_FLAGS, at progbits .Lframe1: .long .LECIE1-.LSCIE1 /* Length of Common Information Entry */ .LSCIE1: .long 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ +#ifdef HAVE_AS_ASCII_PSEUDO_OP #ifdef __PIC__ .ascii "zR\0" /* CIE Augmentation */ #else .ascii "\0" /* CIE Augmentation */ #endif +#elif defined HAVE_AS_STRING_PSEUDO_OP +#ifdef __PIC__ + .string "zR" /* CIE Augmentation */ +#else + .string "" /* CIE Augmentation */ +#endif +#else +#error missing .ascii/.string +#endif .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ .byte 0x8 /* CIE RA Column */ #ifdef __PIC__ .byte 0x1 /* .uleb128 0x1; Augmentation size */ - .byte 0x1b /* FDE Encoding (pcrel sdata4) */ + .byte FDE_ENCODING #endif .byte 0xc /* DW_CFA_def_cfa */ .byte 0x4 /* .uleb128 0x4 */ @@ -354,14 +400,8 @@ .long .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .long .LASFDE1-.Lframe1 /* FDE CIE offset */ -#if defined __PIC__ && defined HAVE_AS_X86_PCREL - .long .LFB1-. /* FDE initial location */ -#elif defined __PIC__ - .long .LFB1 at rel -#else - .long .LFB1 -#endif - .long .LFE1-.LFB1 /* FDE address range */ + .long FDE_ENCODE(.LFB1) /* FDE initial location */ + .long .LFE1-.LFB1 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif @@ -381,14 +421,8 @@ .long .LEFDE2-.LASFDE2 /* FDE Length */ .LASFDE2: .long .LASFDE2-.Lframe1 /* FDE CIE offset */ -#if defined __PIC__ && defined HAVE_AS_X86_PCREL - .long .LFB2-. /* FDE initial location */ -#elif defined __PIC__ - .long .LFB2 at rel -#else - .long .LFB2 -#endif - .long .LFE2-.LFB2 /* FDE address range */ + .long FDE_ENCODE(.LFB2) /* FDE initial location */ + .long .LFE2-.LFB2 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif @@ -417,14 +451,8 @@ .long .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: .long .LASFDE3-.Lframe1 /* FDE CIE offset */ -#if defined __PIC__ && defined HAVE_AS_X86_PCREL - .long .LFB3-. /* FDE initial location */ -#elif defined __PIC__ - .long .LFB3 at rel -#else - .long .LFB3 -#endif - .long .LFE3-.LFB3 /* FDE address range */ + .long FDE_ENCODE(.LFB3) /* FDE initial location */ + .long .LFE3-.LFB3 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif @@ -446,6 +474,7 @@ .LEFDE3: #endif +#endif #endif /* ifndef __x86_64__ */ diff --git a/Modules/_ctypes/libffi/src/x86/unix64.S b/Modules/_ctypes/libffi/src/x86/unix64.S --- a/Modules/_ctypes/libffi/src/x86/unix64.S +++ b/Modules/_ctypes/libffi/src/x86/unix64.S @@ -1,6 +1,7 @@ /* ----------------------------------------------------------------------- - unix64.S - Copyright (c) 2002 Bo Thorsen - Copyright (c) 2008 Red Hat, Inc + unix64.S - Copyright (c) 2013 The Written Word, Inc. + - Copyright (c) 2008 Red Hat, Inc + - Copyright (c) 2002 Bo Thorsen x86-64 Foreign Function Interface @@ -324,7 +325,14 @@ .LUW9: .size ffi_closure_unix64,.-ffi_closure_unix64 +#ifdef __GNUC__ +/* Only emit DWARF unwind info when building with the GNU toolchain. */ + +#ifdef HAVE_AS_X86_64_UNWIND_SECTION_TYPE + .section .eh_frame,"a", at unwind +#else .section .eh_frame,"a", at progbits +#endif .Lframe1: .long .LECIE1-.LSCIE1 /* CIE Length */ .LSCIE1: @@ -415,6 +423,8 @@ .align 8 .LEFDE3: +#endif /* __GNUC__ */ + #endif /* __x86_64__ */ #if defined __ELF__ && defined __linux__ diff --git a/Modules/_ctypes/libffi/src/x86/win32.S b/Modules/_ctypes/libffi/src/x86/win32.S --- a/Modules/_ctypes/libffi/src/x86/win32.S +++ b/Modules/_ctypes/libffi/src/x86/win32.S @@ -45,6 +45,7 @@ ffi_call_win32 PROC NEAR, ffi_prep_args : NEAR PTR DWORD, ecif : NEAR PTR DWORD, + cif_abi : DWORD, cif_bytes : DWORD, cif_flags : DWORD, rvalue : NEAR PTR DWORD, @@ -64,6 +65,19 @@ ;; Return stack to previous state and call the function add esp, 8 + ;; Handle thiscall and fastcall + cmp cif_abi, 3 ;; FFI_THISCALL + jz do_thiscall + cmp cif_abi, 4 ;; FFI_FASTCALL + jnz do_stdcall + mov ecx, DWORD PTR [esp] + mov edx, DWORD PTR [esp+4] + add esp, 8 + jmp do_stdcall +do_thiscall: + mov ecx, DWORD PTR [esp] + add esp, 4 +do_stdcall: call fn ;; cdecl: we restore esp in the epilogue, so there's no need to @@ -94,31 +108,37 @@ dd offset ca_retfloat ;; FFI_TYPE_FLOAT dd offset ca_retdouble ;; FFI_TYPE_DOUBLE dd offset ca_retlongdouble ;; FFI_TYPE_LONGDOUBLE - dd offset ca_retint8 ;; FFI_TYPE_UINT8 - dd offset ca_retint8 ;; FFI_TYPE_SINT8 - dd offset ca_retint16 ;; FFI_TYPE_UINT16 - dd offset ca_retint16 ;; FFI_TYPE_SINT16 + dd offset ca_retuint8 ;; FFI_TYPE_UINT8 + dd offset ca_retsint8 ;; FFI_TYPE_SINT8 + dd offset ca_retuint16 ;; FFI_TYPE_UINT16 + dd offset ca_retsint16 ;; FFI_TYPE_SINT16 dd offset ca_retint ;; FFI_TYPE_UINT32 dd offset ca_retint ;; FFI_TYPE_SINT32 dd offset ca_retint64 ;; FFI_TYPE_UINT64 dd offset ca_retint64 ;; FFI_TYPE_SINT64 dd offset ca_epilogue ;; FFI_TYPE_STRUCT dd offset ca_retint ;; FFI_TYPE_POINTER - dd offset ca_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B - dd offset ca_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset ca_retstruct1b ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset ca_retstruct2b ;; FFI_TYPE_SMALL_STRUCT_2B dd offset ca_retint ;; FFI_TYPE_SMALL_STRUCT_4B + dd offset ca_epilogue ;; FFI_TYPE_MS_STRUCT -ca_retint8: - ;; Load %ecx with the pointer to storage for the return value - mov ecx, rvalue - mov [ecx + 0], al - jmp ca_epilogue + /* Sign/zero extend as appropriate. */ +ca_retuint8: + movzx eax, al + jmp ca_retint -ca_retint16: - ;; Load %ecx with the pointer to storage for the return value - mov ecx, rvalue - mov [ecx + 0], ax - jmp ca_epilogue +ca_retsint8: + movsx eax, al + jmp ca_retint + +ca_retuint16: + movzx eax, ax + jmp ca_retint + +ca_retsint16: + movsx eax, ax + jmp ca_retint ca_retint: ;; Load %ecx with the pointer to storage for the return value @@ -151,11 +171,31 @@ fstp TBYTE PTR [ecx] jmp ca_epilogue +ca_retstruct1b: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + mov [ecx + 0], al + jmp ca_epilogue + +ca_retstruct2b: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + mov [ecx + 0], ax + jmp ca_epilogue + ca_epilogue: ;; Epilogue code is autogenerated. ret ffi_call_win32 ENDP +ffi_closure_THISCALL PROC NEAR FORCEFRAME + sub esp, 40 + lea edx, [ebp -24] + mov [ebp - 12], edx /* resp */ + lea edx, [ebp + 12] /* account for stub return address on stack */ + jmp stub +ffi_closure_THISCALL ENDP + ffi_closure_SYSV PROC NEAR FORCEFRAME ;; the ffi_closure ctx is passed in eax by the trampoline. @@ -163,6 +203,7 @@ lea edx, [ebp - 24] mov [ebp - 12], edx ;; resp lea edx, [ebp + 8] +stub:: mov [esp + 8], edx ;; args lea edx, [ebp - 12] mov [esp + 4], edx ;; &resp @@ -179,26 +220,35 @@ dd offset cs_retfloat ;; FFI_TYPE_FLOAT dd offset cs_retdouble ;; FFI_TYPE_DOUBLE dd offset cs_retlongdouble ;; FFI_TYPE_LONGDOUBLE - dd offset cs_retint8 ;; FFI_TYPE_UINT8 - dd offset cs_retint8 ;; FFI_TYPE_SINT8 - dd offset cs_retint16 ;; FFI_TYPE_UINT16 - dd offset cs_retint16 ;; FFI_TYPE_SINT16 + dd offset cs_retuint8 ;; FFI_TYPE_UINT8 + dd offset cs_retsint8 ;; FFI_TYPE_SINT8 + dd offset cs_retuint16 ;; FFI_TYPE_UINT16 + dd offset cs_retsint16 ;; FFI_TYPE_SINT16 dd offset cs_retint ;; FFI_TYPE_UINT32 dd offset cs_retint ;; FFI_TYPE_SINT32 dd offset cs_retint64 ;; FFI_TYPE_UINT64 dd offset cs_retint64 ;; FFI_TYPE_SINT64 dd offset cs_retstruct ;; FFI_TYPE_STRUCT dd offset cs_retint ;; FFI_TYPE_POINTER - dd offset cs_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B - dd offset cs_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset cs_retsint8 ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset cs_retsint16 ;; FFI_TYPE_SMALL_STRUCT_2B dd offset cs_retint ;; FFI_TYPE_SMALL_STRUCT_4B + dd offset cs_retmsstruct ;; FFI_TYPE_MS_STRUCT -cs_retint8: - mov al, [ecx] +cs_retuint8: + movzx eax, BYTE PTR [ecx] jmp cs_epilogue -cs_retint16: - mov ax, [ecx] +cs_retsint8: + movsx eax, BYTE PTR [ecx] + jmp cs_epilogue + +cs_retuint16: + movzx eax, WORD PTR [ecx] + jmp cs_epilogue + +cs_retsint16: + movsx eax, WORD PTR [ecx] jmp cs_epilogue cs_retint: @@ -227,6 +277,12 @@ ;; Epilogue code is autogenerated. ret 4 +cs_retmsstruct: + ;; Caller expects us to return a pointer to the real return value. + mov eax, ecx + ;; Caller doesn't expects us to pop struct return value pointer hidden arg. + jmp cs_epilogue + cs_epilogue: ;; Epilogue code is autogenerated. ret @@ -239,7 +295,16 @@ #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define CIF_FLAGS_OFFSET 20 -ffi_closure_raw_SYSV PROC NEAR USES esi +ffi_closure_raw_THISCALL PROC NEAR USES esi FORCEFRAME + sub esp, 36 + mov esi, [eax + RAW_CLOSURE_CIF_OFFSET] ;; closure->cif + mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data + mov [esp + 12], edx + lea edx, [ebp + 12] + jmp stubraw +ffi_closure_raw_THISCALL ENDP + +ffi_closure_raw_SYSV PROC NEAR USES esi FORCEFRAME ;; the ffi_closure ctx is passed in eax by the trampoline. sub esp, 40 @@ -247,6 +312,7 @@ mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data mov [esp + 12], edx ;; user_data lea edx, [ebp + 8] +stubraw:: mov [esp + 8], edx ;; raw_args lea edx, [ebp - 24] mov [esp + 4], edx ;; &res @@ -264,26 +330,35 @@ dd offset cr_retfloat ;; FFI_TYPE_FLOAT dd offset cr_retdouble ;; FFI_TYPE_DOUBLE dd offset cr_retlongdouble ;; FFI_TYPE_LONGDOUBLE - dd offset cr_retint8 ;; FFI_TYPE_UINT8 - dd offset cr_retint8 ;; FFI_TYPE_SINT8 - dd offset cr_retint16 ;; FFI_TYPE_UINT16 - dd offset cr_retint16 ;; FFI_TYPE_SINT16 + dd offset cr_retuint8 ;; FFI_TYPE_UINT8 + dd offset cr_retsint8 ;; FFI_TYPE_SINT8 + dd offset cr_retuint16 ;; FFI_TYPE_UINT16 + dd offset cr_retsint16 ;; FFI_TYPE_SINT16 dd offset cr_retint ;; FFI_TYPE_UINT32 dd offset cr_retint ;; FFI_TYPE_SINT32 dd offset cr_retint64 ;; FFI_TYPE_UINT64 dd offset cr_retint64 ;; FFI_TYPE_SINT64 dd offset cr_epilogue ;; FFI_TYPE_STRUCT dd offset cr_retint ;; FFI_TYPE_POINTER - dd offset cr_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B - dd offset cr_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset cr_retsint8 ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset cr_retsint16 ;; FFI_TYPE_SMALL_STRUCT_2B dd offset cr_retint ;; FFI_TYPE_SMALL_STRUCT_4B + dd offset cr_epilogue ;; FFI_TYPE_MS_STRUCT -cr_retint8: - mov al, [ecx] +cr_retuint8: + movzx eax, BYTE PTR [ecx] jmp cr_epilogue -cr_retint16: - mov ax, [ecx] +cr_retsint8: + movsx eax, BYTE PTR [ecx] + jmp cr_epilogue + +cr_retuint16: + movzx eax, WORD PTR [ecx] + jmp cr_epilogue + +cr_retsint16: + movsx eax, WORD PTR [ecx] jmp cr_epilogue cr_retint: @@ -337,26 +412,34 @@ dd offset cd_retfloat ;; FFI_TYPE_FLOAT dd offset cd_retdouble ;; FFI_TYPE_DOUBLE dd offset cd_retlongdouble ;; FFI_TYPE_LONGDOUBLE - dd offset cd_retint8 ;; FFI_TYPE_UINT8 - dd offset cd_retint8 ;; FFI_TYPE_SINT8 - dd offset cd_retint16 ;; FFI_TYPE_UINT16 - dd offset cd_retint16 ;; FFI_TYPE_SINT16 + dd offset cd_retuint8 ;; FFI_TYPE_UINT8 + dd offset cd_retsint8 ;; FFI_TYPE_SINT8 + dd offset cd_retuint16 ;; FFI_TYPE_UINT16 + dd offset cd_retsint16 ;; FFI_TYPE_SINT16 dd offset cd_retint ;; FFI_TYPE_UINT32 dd offset cd_retint ;; FFI_TYPE_SINT32 dd offset cd_retint64 ;; FFI_TYPE_UINT64 dd offset cd_retint64 ;; FFI_TYPE_SINT64 dd offset cd_epilogue ;; FFI_TYPE_STRUCT dd offset cd_retint ;; FFI_TYPE_POINTER - dd offset cd_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B - dd offset cd_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset cd_retsint8 ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset cd_retsint16 ;; FFI_TYPE_SMALL_STRUCT_2B dd offset cd_retint ;; FFI_TYPE_SMALL_STRUCT_4B -cd_retint8: - mov al, [ecx] +cd_retuint8: + movzx eax, BYTE PTR [ecx] jmp cd_epilogue -cd_retint16: - mov ax, [ecx] +cd_retsint8: + movsx eax, BYTE PTR [ecx] + jmp cd_epilogue + +cd_retuint16: + movzx eax, WORD PTR [ecx] + jmp cd_epilogue + +cd_retsint16: + movsx eax, WORD PTR [ecx] jmp cd_epilogue cd_retint: @@ -395,7 +478,9 @@ # This assumes we are using gas. .balign 16 .globl _ffi_call_win32 +#ifndef __OS2__ .def _ffi_call_win32; .scl 2; .type 32; .endef +#endif _ffi_call_win32: .LFB1: pushl %ebp @@ -403,7 +488,7 @@ movl %esp,%ebp .LCFI1: # Make room for all of the new args. - movl 16(%ebp),%ecx + movl 20(%ebp),%ecx subl %ecx,%esp movl %esp,%eax @@ -415,19 +500,34 @@ # Return stack to previous state and call the function addl $8,%esp - + + # Handle fastcall and thiscall + cmpl $3, 16(%ebp) # FFI_THISCALL + jz .do_thiscall + cmpl $4, 16(%ebp) # FFI_FASTCALL + jnz .do_fncall + movl (%esp), %ecx + movl 4(%esp), %edx + addl $8, %esp + jmp .do_fncall +.do_thiscall: + movl (%esp), %ecx + addl $4, %esp + +.do_fncall: + # FIXME: Align the stack to a 128-bit boundary to avoid # potential performance hits. - call *28(%ebp) + call *32(%ebp) # stdcall functions pop arguments off the stack themselves # Load %ecx with the return type code - movl 20(%ebp),%ecx + movl 24(%ebp),%ecx # If the return value pointer is NULL, assume no return value. - cmpl $0,24(%ebp) + cmpl $0,28(%ebp) jne 0f # Even if there is no space for the return value, we are @@ -460,6 +560,7 @@ .long .Lretstruct1b /* FFI_TYPE_SMALL_STRUCT_1B */ .long .Lretstruct2b /* FFI_TYPE_SMALL_STRUCT_2B */ .long .Lretstruct4b /* FFI_TYPE_SMALL_STRUCT_4B */ + .long .Lretstruct /* FFI_TYPE_MS_STRUCT */ 1: add %ecx, %ecx add %ecx, %ecx @@ -486,50 +587,50 @@ .Lretint: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx movl %eax,0(%ecx) jmp .Lepilogue .Lretfloat: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx fstps (%ecx) jmp .Lepilogue .Lretdouble: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx fstpl (%ecx) jmp .Lepilogue .Lretlongdouble: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx fstpt (%ecx) jmp .Lepilogue .Lretint64: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx movl %eax,0(%ecx) movl %edx,4(%ecx) jmp .Lepilogue .Lretstruct1b: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx movb %al,0(%ecx) jmp .Lepilogue .Lretstruct2b: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx movw %ax,0(%ecx) jmp .Lepilogue .Lretstruct4b: # Load %ecx with the pointer to storage for the return value - movl 24(%ebp),%ecx + movl 28(%ebp),%ecx movl %eax,0(%ecx) jmp .Lepilogue @@ -542,12 +643,27 @@ popl %ebp ret .ffi_call_win32_end: + .balign 16 + .globl _ffi_closure_THISCALL +#ifndef __OS2__ + .def _ffi_closure_THISCALL; .scl 2; .type 32; .endef +#endif +_ffi_closure_THISCALL: + pushl %ebp + movl %esp, %ebp + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 12(%ebp), %edx /* account for stub return address on stack */ + jmp .stub .LFE1: # This assumes we are using gas. .balign 16 .globl _ffi_closure_SYSV +#ifndef __OS2__ .def _ffi_closure_SYSV; .scl 2; .type 32; .endef +#endif _ffi_closure_SYSV: .LFB3: pushl %ebp @@ -558,6 +674,7 @@ leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 8(%ebp), %edx +.stub: movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ @@ -586,6 +703,7 @@ .long .Lcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ .long .Lcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ .long .Lcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ + .long .Lcls_retmsstruct /* FFI_TYPE_MS_STRUCT */ 1: add %eax, %eax @@ -650,6 +768,12 @@ popl %ebp ret $0x4 +.Lcls_retmsstruct: + # Caller expects us to return a pointer to the real return value. + mov %ecx, %eax + # Caller doesn't expects us to pop struct return value pointer hidden arg. + jmp .Lcls_epilogue + .Lcls_noretval: .Lcls_epilogue: movl %ebp, %esp @@ -664,11 +788,27 @@ #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define CIF_FLAGS_OFFSET 20 - + .balign 16 + .globl _ffi_closure_raw_THISCALL +#ifndef __OS2__ + .def _ffi_closure_raw_THISCALL; .scl 2; .type 32; .endef +#endif +_ffi_closure_raw_THISCALL: + pushl %ebp + movl %esp, %ebp + pushl %esi + subl $36, %esp + movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ + movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ + movl %edx, 12(%esp) /* user_data */ + leal 12(%ebp), %edx /* __builtin_dwarf_cfa () */ + jmp .stubraw # This assumes we are using gas. .balign 16 .globl _ffi_closure_raw_SYSV +#ifndef __OS2__ .def _ffi_closure_raw_SYSV; .scl 2; .type 32; .endef +#endif _ffi_closure_raw_SYSV: .LFB4: pushl %ebp @@ -682,6 +822,7 @@ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ movl %edx, 12(%esp) /* user_data */ leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ +.stubraw: movl %edx, 8(%esp) /* raw_args */ leal -24(%ebp), %edx movl %edx, 4(%esp) /* &res */ @@ -710,6 +851,7 @@ .long .Lrcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ .long .Lrcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ .long .Lrcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ + .long .Lrcls_retstruct /* FFI_TYPE_MS_STRUCT */ 1: add %eax, %eax add %eax, %eax @@ -784,7 +926,9 @@ # This assumes we are using gas. .balign 16 .globl _ffi_closure_STDCALL +#ifndef __OS2__ .def _ffi_closure_STDCALL; .scl 2; .type 32; .endef +#endif _ffi_closure_STDCALL: .LFB5: pushl %ebp @@ -890,7 +1034,9 @@ .ffi_closure_STDCALL_end: .LFE5: +#ifndef __OS2__ .section .eh_frame,"w" +#endif .Lframe1: .LSCIE1: .long .LECIE1-.LASCIE1 /* Length of Common Information Entry */ diff --git a/Modules/_ctypes/libffi/src/x86/win64.S b/Modules/_ctypes/libffi/src/x86/win64.S --- a/Modules/_ctypes/libffi/src/x86/win64.S +++ b/Modules/_ctypes/libffi/src/x86/win64.S @@ -232,10 +232,18 @@ ffi_call_win64 ENDP _TEXT ENDS END -#else + +#else + +#ifdef SYMBOL_UNDERSCORE +#define SYMBOL_NAME(name) _##name +#else +#define SYMBOL_NAME(name) name +#endif + .text -.extern _ffi_closure_win64_inner +.extern SYMBOL_NAME(ffi_closure_win64_inner) # ffi_closure_win64 will be called with these registers set: # rax points to 'closure' @@ -246,8 +254,8 @@ # call ffi_closure_win64_inner for the actual work, then return the result. # .balign 16 - .globl _ffi_closure_win64 -_ffi_closure_win64: + .globl SYMBOL_NAME(ffi_closure_win64) +SYMBOL_NAME(ffi_closure_win64): # copy register arguments onto stack test $1,%r11 jne .Lfirst_is_float @@ -287,7 +295,7 @@ mov %rax, %rcx # context is first parameter mov %rsp, %rdx # stack is second parameter add $48, %rdx # point to start of arguments - mov $_ffi_closure_win64_inner, %rax + mov $SYMBOL_NAME(ffi_closure_win64_inner), %rax callq *%rax # call the real closure function add $40, %rsp movq %rax, %xmm0 # If the closure returned a float, @@ -296,8 +304,8 @@ .ffi_closure_win64_end: .balign 16 - .globl _ffi_call_win64 -_ffi_call_win64: + .globl SYMBOL_NAME(ffi_call_win64) +SYMBOL_NAME(ffi_call_win64): # copy registers onto stack mov %r9,32(%rsp) mov %r8,24(%rsp) diff --git a/Modules/_ctypes/libffi/src/xtensa/ffi.c b/Modules/_ctypes/libffi/src/xtensa/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/xtensa/ffi.c @@ -0,0 +1,298 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2013 Tensilica, Inc. + + XTENSA Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +/* + |----------------------------------------| + | | + on entry to ffi_call ----> |----------------------------------------| + | caller stack frame for registers a0-a3 | + |----------------------------------------| + | | + | additional arguments | + entry of the function ---> |----------------------------------------| + | copy of function arguments a2-a7 | + | - - - - - - - - - - - - - | + | | + + The area below the entry line becomes the new stack frame for the function. + +*/ + + +#define FFI_TYPE_STRUCT_REGS FFI_TYPE_LAST + + +extern void ffi_call_SYSV(void *rvalue, unsigned rsize, unsigned flags, + void(*fn)(void), unsigned nbytes, extended_cif*); +extern void ffi_closure_SYSV(void) FFI_HIDDEN; + +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + switch(cif->rtype->type) { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + cif->flags = cif->rtype->type; + break; + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + cif->flags = FFI_TYPE_UINT32; + break; + case FFI_TYPE_DOUBLE: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + cif->flags = FFI_TYPE_UINT64; // cif->rtype->type; + break; + case FFI_TYPE_STRUCT: + cif->flags = FFI_TYPE_STRUCT; //_REGS; + /* Up to 16 bytes are returned in registers */ + if (cif->rtype->size > 4 * 4) { + /* returned structure is referenced by a register; use 8 bytes + (including 4 bytes for potential additional alignment) */ + cif->flags = FFI_TYPE_STRUCT; + cif->bytes += 8; + } + break; + + default: + cif->flags = FFI_TYPE_UINT32; + break; + } + + /* Round the stack up to a full 4 register frame, just in case + (we use this size in movsp). This way, it's also a multiple of + 8 bytes for 64-bit arguments. */ + cif->bytes = ALIGN(cif->bytes, 16); + + return FFI_OK; +} + +void ffi_prep_args(extended_cif *ecif, unsigned char* stack) +{ + unsigned int i; + unsigned long *addr; + ffi_type **ptr; + + union { + void **v; + char **c; + signed char **sc; + unsigned char **uc; + signed short **ss; + unsigned short **us; + unsigned int **i; + long long **ll; + float **f; + double **d; + } p_argv; + + /* Verify that everything is aligned up properly */ + FFI_ASSERT (((unsigned long) stack & 0x7) == 0); + + p_argv.v = ecif->avalue; + addr = (unsigned long*)stack; + + /* structures with a size greater than 16 bytes are passed in memory */ + if (ecif->cif->rtype->type == FFI_TYPE_STRUCT && ecif->cif->rtype->size > 16) + { + *addr++ = (unsigned long)ecif->rvalue; + } + + for (i = ecif->cif->nargs, ptr = ecif->cif->arg_types; + i > 0; + i--, ptr++, p_argv.v++) + { + switch ((*ptr)->type) + { + case FFI_TYPE_SINT8: + *addr++ = **p_argv.sc; + break; + case FFI_TYPE_UINT8: + *addr++ = **p_argv.uc; + break; + case FFI_TYPE_SINT16: + *addr++ = **p_argv.ss; + break; + case FFI_TYPE_UINT16: + *addr++ = **p_argv.us; + break; + case FFI_TYPE_FLOAT: + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + *addr++ = **p_argv.i; + break; + case FFI_TYPE_DOUBLE: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + if (((unsigned long)addr & 4) != 0) + addr++; + *(unsigned long long*)addr = **p_argv.ll; + addr += sizeof(unsigned long long) / sizeof (addr); + break; + + case FFI_TYPE_STRUCT: + { + unsigned long offs; + unsigned long size; + + if (((unsigned long)addr & 4) != 0 && (*ptr)->alignment > 4) + addr++; + + offs = (unsigned long) addr - (unsigned long) stack; + size = (*ptr)->size; + + /* Entire structure must fit the argument registers or referenced */ + if (offs < FFI_REGISTER_NARGS * 4 + && offs + size > FFI_REGISTER_NARGS * 4) + addr = (unsigned long*) (stack + FFI_REGISTER_NARGS * 4); + + memcpy((char*) addr, *p_argv.c, size); + addr += (size + 3) / 4; + break; + } + + default: + FFI_ASSERT(0); + } + } +} + + +void ffi_call(ffi_cif* cif, void(*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + unsigned long rsize = cif->rtype->size; + int flags = cif->flags; + void *alloc = NULL; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* Note that for structures that are returned in registers (size <= 16 bytes) + we allocate a temporary buffer and use memcpy to copy it to the final + destination. The reason is that the target address might be misaligned or + the length not a multiple of 4 bytes. Handling all those cases would be + very complex. */ + + if (flags == FFI_TYPE_STRUCT && (rsize <= 16 || rvalue == NULL)) + { + alloc = alloca(ALIGN(rsize, 4)); + ecif.rvalue = alloc; + } + else + { + ecif.rvalue = rvalue; + } + + if (cif->abi != FFI_SYSV) + FFI_ASSERT(0); + + ffi_call_SYSV (ecif.rvalue, rsize, cif->flags, fn, cif->bytes, &ecif); + + if (alloc != NULL && rvalue != NULL) + memcpy(rvalue, alloc, rsize); +} + +extern void ffi_trampoline(); +extern void ffi_cacheflush(void* start, void* end); + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) +{ + /* copye trampoline to stack and patch 'ffi_closure_SYSV' pointer */ + memcpy(closure->tramp, ffi_trampoline, FFI_TRAMPOLINE_SIZE); + *(unsigned int*)(&closure->tramp[8]) = (unsigned int)ffi_closure_SYSV; + + // Do we have this function? + // __builtin___clear_cache(closer->tramp, closer->tramp + FFI_TRAMPOLINE_SIZE) + ffi_cacheflush(closure->tramp, closure->tramp + FFI_TRAMPOLINE_SIZE); + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + return FFI_OK; +} + + +long FFI_HIDDEN +ffi_closure_SYSV_inner(ffi_closure *closure, void **values, void *rvalue) +{ + ffi_cif *cif; + ffi_type **arg_types; + void **avalue; + int i, areg; + + cif = closure->cif; + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; + + areg = 0; + + int rtype = cif->rtype->type; + if (rtype == FFI_TYPE_STRUCT && cif->rtype->size > 4 * 4) + { + rvalue = *values; + areg++; + } + + cif = closure->cif; + arg_types = cif->arg_types; + avalue = alloca(cif->nargs * sizeof(void *)); + + for (i = 0; i < cif->nargs; i++) + { + if (arg_types[i]->alignment == 8 && (areg & 1) != 0) + areg++; + + // skip the entry 16,a1 framework, add 16 bytes (4 registers) + if (areg == FFI_REGISTER_NARGS) + areg += 4; + + if (arg_types[i]->type == FFI_TYPE_STRUCT) + { + int numregs = ((arg_types[i]->size + 3) & ~3) / 4; + if (areg < FFI_REGISTER_NARGS && areg + numregs > FFI_REGISTER_NARGS) + areg = FFI_REGISTER_NARGS + 4; + } + + avalue[i] = &values[areg]; + areg += (arg_types[i]->size + 3) / 4; + } + + (closure->fun)(cif, rvalue, avalue, closure->user_data); + + return rtype; +} diff --git a/Modules/_ctypes/libffi/src/xtensa/ffitarget.h b/Modules/_ctypes/libffi/src/xtensa/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/xtensa/ffitarget.h @@ -0,0 +1,53 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2013 Tensilica, Inc. + Target configuration macros for XTENSA. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV +} ffi_abi; +#endif + +#define FFI_REGISTER_NARGS 6 + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_NATIVE_RAW_API 0 +#define FFI_TRAMPOLINE_SIZE 24 + +#endif diff --git a/Modules/_ctypes/libffi/src/xtensa/sysv.S b/Modules/_ctypes/libffi/src/xtensa/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/xtensa/sysv.S @@ -0,0 +1,253 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2013 Tensilica, Inc. + + XTENSA Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + +#define ENTRY(name) .text; .globl name; .type name, at function; .align 4; name: +#define END(name) .size name , . - name + +/* Assert that the table below is in sync with ffi.h. */ + +#if FFI_TYPE_UINT8 != 5 \ + || FFI_TYPE_SINT8 != 6 \ + || FFI_TYPE_UINT16 != 7 \ + || FFI_TYPE_SINT16 != 8 \ + || FFI_TYPE_UINT32 != 9 \ + || FFI_TYPE_SINT32 != 10 \ + || FFI_TYPE_UINT64 != 11 +#error "xtensa/sysv.S out of sync with ffi.h" +#endif + + +/* ffi_call_SYSV (rvalue, rbytes, flags, (*fnaddr)(), bytes, ecif) + void *rvalue; a2 + unsigned long rbytes; a3 + unsigned flags; a4 + void (*fnaddr)(); a5 + unsigned long bytes; a6 + extended_cif* ecif) a7 +*/ + +ENTRY(ffi_call_SYSV) + + entry a1, 32 # 32 byte frame for using call8 below + + mov a10, a7 # a10(->arg0): ecif + sub a11, a1, a6 # a11(->arg1): stack pointer + mov a7, a1 # fp + movsp a1, a11 # set new sp = old_sp - bytes + + movi a8, ffi_prep_args + callx8 a8 # ffi_prep_args(ecif, stack) + + # prepare to move stack pointer back up to 6 arguments + # note that 'bytes' is already aligned + + movi a10, 6*4 + sub a11, a6, a10 + movgez a6, a10, a11 + add a6, a1, a6 + + + # we can pass up to 6 arguments in registers + # for simplicity, just load 6 arguments + # (the stack size is at least 32 bytes, so no risk to cross boundaries) + + l32i a10, a1, 0 + l32i a11, a1, 4 + l32i a12, a1, 8 + l32i a13, a1, 12 + l32i a14, a1, 16 + l32i a15, a1, 20 + + # move stack pointer + + movsp a1, a6 + + callx8 a5 # (*fn)(args...) + + # Handle return value(s) + + beqz a2, .Lexit + + movi a5, FFI_TYPE_STRUCT + bne a4, a5, .Lstore + movi a5, 16 + blt a5, a3, .Lexit + + s32i a10, a2, 0 + blti a3, 5, .Lexit + addi a3, a3, -1 + s32i a11, a2, 4 + blti a3, 8, .Lexit + s32i a12, a2, 8 + blti a3, 12, .Lexit + s32i a13, a2, 12 + +.Lexit: retw + +.Lstore: + addi a4, a4, -FFI_TYPE_UINT8 + bgei a4, 7, .Lexit # should never happen + movi a6, store_calls + add a4, a4, a4 + addx4 a6, a4, a6 # store_table + idx * 8 + jx a6 + + .align 8 +store_calls: + # UINT8 + s8i a10, a2, 0 + retw + + # SINT8 + .align 8 + s8i a10, a2, 0 + retw + + # UINT16 + .align 8 + s16i a10, a2, 0 + retw + + # SINT16 + .align 8 + s16i a10, a2, 0 + retw + + # UINT32 + .align 8 + s32i a10, a2, 0 + retw + + # SINT32 + .align 8 + s32i a10, a2, 0 + retw + + # UINT64 + .align 8 + s32i a10, a2, 0 + s32i a11, a2, 4 + retw + +END(ffi_call_SYSV) + + +/* + * void ffi_cacheflush (unsigned long start, unsigned long end) + */ + +#define EXTRA_ARGS_SIZE 24 + +ENTRY(ffi_cacheflush) + + entry a1, 16 + +1: dhwbi a2, 0 + ihi a2, 0 + addi a2, a2, 4 + blt a2, a3, 1b + + retw + +END(ffi_cacheflush) + +/* ffi_trampoline is copied to the stack */ + +ENTRY(ffi_trampoline) + + entry a1, 16 + (FFI_REGISTER_NARGS * 4) + (4 * 4) # [ 0] + j 2f # [ 3] + .align 4 # [ 6] +1: .long 0 # [ 8] +2: l32r a15, 1b # [12] + _mov a14, a0 # [15] + callx0 a15 # [18] + # [21] +END(ffi_trampoline) + +/* + * ffi_closure() + * + * a0: closure + 21 + * a14: return address (a0) + */ + +ENTRY(ffi_closure_SYSV) + + /* intentionally omitting entry here */ + + # restore return address (a0) and move pointer to closure to a10 + addi a10, a0, -21 + mov a0, a14 + + # allow up to 4 arguments as return values + addi a11, a1, 4 * 4 + + # save up to 6 arguments to stack (allocated by entry below) + s32i a2, a11, 0 + s32i a3, a11, 4 + s32i a4, a11, 8 + s32i a5, a11, 12 + s32i a6, a11, 16 + s32i a7, a11, 20 + + movi a8, ffi_closure_SYSV_inner + mov a12, a1 + callx8 a8 # .._inner(*closure, **avalue, *rvalue) + + # load up to four return arguments + l32i a2, a1, 0 + l32i a3, a1, 4 + l32i a4, a1, 8 + l32i a5, a1, 12 + + # (sign-)extend return value + movi a11, FFI_TYPE_UINT8 + bne a10, a11, 1f + extui a2, a2, 0, 8 + retw + +1: movi a11, FFI_TYPE_SINT8 + bne a10, a11, 1f + sext a2, a2, 7 + retw + +1: movi a11, FFI_TYPE_UINT16 + bne a10, a11, 1f + extui a2, a2, 0, 16 + retw + +1: movi a11, FFI_TYPE_SINT16 + bne a10, a11, 1f + sext a2, a2, 15 + +1: retw + +END(ffi_closure_SYSV) diff --git a/Modules/_ctypes/libffi/stamp-h.in b/Modules/_ctypes/libffi/stamp-h.in new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/stamp-h.in @@ -0,0 +1,1 @@ +timestamp diff --git a/Modules/_ctypes/libffi/testsuite/Makefile.am b/Modules/_ctypes/libffi/testsuite/Makefile.am --- a/Modules/_ctypes/libffi/testsuite/Makefile.am +++ b/Modules/_ctypes/libffi/testsuite/Makefile.am @@ -13,68 +13,82 @@ AM_RUNTESTFLAGS = +EXTRA_DEJAGNU_SITE_CONFIG=../local.exp + CLEANFILES = *.exe core* *.log *.sum -EXTRA_DIST = libffi.special/special.exp \ -libffi.special/unwindtest_ffi_call.cc libffi.special/unwindtest.cc \ -libffi.special/ffitestcxx.h config/default.exp lib/target-libpath.exp \ -lib/libffi-dg.exp lib/wrapper.exp libffi.call/float.c \ -libffi.call/cls_multi_schar.c libffi.call/float3.c \ -libffi.call/cls_3_1byte.c libffi.call/stret_large2.c \ -libffi.call/cls_5_1_byte.c libffi.call/stret_medium.c \ -libffi.call/promotion.c libffi.call/cls_dbls_struct.c \ -libffi.call/nested_struct.c libffi.call/closure_fn1.c \ -libffi.call/cls_4_1byte.c libffi.call/cls_float.c \ -libffi.call/cls_2byte.c libffi.call/closure_fn4.c \ -libffi.call/return_fl2.c libffi.call/nested_struct7.c \ -libffi.call/cls_uint.c libffi.call/cls_align_sint64.c \ -libffi.call/float1.c libffi.call/cls_19byte.c \ -libffi.call/nested_struct1.c libffi.call/cls_4byte.c \ -libffi.call/return_fl1.c libffi.call/cls_align_pointer.c \ -libffi.call/nested_struct4.c libffi.call/nested_struct3.c \ -libffi.call/struct7.c libffi.call/nested_struct9.c \ -libffi.call/cls_sshort.c libffi.call/cls_ulonglong.c \ -libffi.call/cls_pointer_stack.c libffi.call/cls_multi_uchar.c \ -libffi.call/testclosure.c libffi.call/cls_3byte1.c \ -libffi.call/struct6.c libffi.call/return_uc.c libffi.call/return_ll1.c \ -libffi.call/cls_ushort.c libffi.call/stret_medium2.c \ -libffi.call/cls_multi_ushortchar.c libffi.call/return_dbl2.c \ -libffi.call/closure_loc_fn0.c libffi.call/return_sc.c \ -libffi.call/nested_struct8.c libffi.call/cls_7_1_byte.c \ -libffi.call/return_ll.c libffi.call/cls_pointer.c \ -libffi.call/err_bad_abi.c libffi.call/return_dbl1.c \ -libffi.call/call.exp libffi.call/ffitest.h libffi.call/strlen.c \ -libffi.call/return_sl.c libffi.call/cls_1_1byte.c \ -libffi.call/struct1.c libffi.call/cls_64byte.c libffi.call/return_ul.c \ -libffi.call/cls_double.c libffi.call/many_win32.c \ -libffi.call/cls_16byte.c libffi.call/cls_align_double.c \ -libffi.call/cls_align_uint16.c libffi.call/cls_9byte1.c \ -libffi.call/cls_multi_sshortchar.c libffi.call/cls_multi_ushort.c \ -libffi.call/closure_stdcall.c libffi.call/return_fl.c \ -libffi.call/strlen_win32.c libffi.call/return_ldl.c \ -libffi.call/cls_align_float.c libffi.call/struct3.c \ -libffi.call/cls_uchar.c libffi.call/cls_sint.c libffi.call/float2.c \ -libffi.call/cls_align_longdouble_split.c \ -libffi.call/cls_longdouble_va.c libffi.call/cls_multi_sshort.c \ -libffi.call/stret_large.c libffi.call/cls_align_sint16.c \ -libffi.call/nested_struct6.c libffi.call/cls_5byte.c \ -libffi.call/return_dbl.c libffi.call/cls_20byte.c \ -libffi.call/cls_8byte.c libffi.call/pyobjc-tc.c \ -libffi.call/cls_24byte.c libffi.call/cls_align_longdouble_split2.c \ -libffi.call/cls_6_1_byte.c libffi.call/cls_schar.c \ -libffi.call/cls_18byte.c libffi.call/closure_fn3.c \ -libffi.call/err_bad_typedef.c libffi.call/closure_fn2.c \ -libffi.call/struct2.c libffi.call/cls_3byte2.c \ -libffi.call/cls_align_longdouble.c libffi.call/cls_20byte1.c \ -libffi.call/return_fl3.c libffi.call/cls_align_uint32.c \ -libffi.call/problem1.c libffi.call/float4.c \ -libffi.call/cls_align_uint64.c libffi.call/struct9.c \ -libffi.call/closure_fn5.c libffi.call/cls_align_sint32.c \ -libffi.call/closure_fn0.c libffi.call/closure_fn6.c \ -libffi.call/struct4.c libffi.call/nested_struct2.c \ -libffi.call/cls_6byte.c libffi.call/cls_7byte.c libffi.call/many.c \ -libffi.call/struct8.c libffi.call/negint.c libffi.call/struct5.c \ -libffi.call/cls_12byte.c libffi.call/cls_double_va.c \ -libffi.call/cls_longdouble.c libffi.call/cls_9byte2.c \ -libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ -libffi.call/huge_struct.c +EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \ +libffi.call/cls_align_longdouble_split.c \ +libffi.call/closure_loc_fn0.c libffi.call/cls_schar.c \ +libffi.call/closure_fn1.c libffi.call/many2_win32.c \ +libffi.call/return_ul.c libffi.call/cls_align_double.c \ +libffi.call/return_fl2.c libffi.call/cls_1_1byte.c \ +libffi.call/cls_64byte.c libffi.call/nested_struct7.c \ +libffi.call/cls_align_sint32.c libffi.call/nested_struct2.c \ +libffi.call/ffitest.h libffi.call/nested_struct4.c \ +libffi.call/cls_multi_ushort.c libffi.call/struct3.c \ +libffi.call/cls_3byte1.c libffi.call/cls_16byte.c \ +libffi.call/struct8.c libffi.call/nested_struct8.c \ +libffi.call/cls_multi_sshort.c libffi.call/cls_3byte2.c \ +libffi.call/fastthis2_win32.c libffi.call/cls_pointer.c \ +libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c \ +libffi.call/cls_9byte2.c libffi.call/cls_multi_schar.c \ +libffi.call/stret_medium2.c libffi.call/cls_5_1_byte.c \ +libffi.call/call.exp libffi.call/cls_double.c \ +libffi.call/cls_align_sint16.c libffi.call/cls_uint.c \ +libffi.call/return_ll1.c libffi.call/nested_struct3.c \ +libffi.call/cls_20byte1.c libffi.call/closure_fn4.c \ +libffi.call/cls_uchar.c libffi.call/struct2.c libffi.call/cls_7byte.c \ +libffi.call/strlen.c libffi.call/many.c libffi.call/testclosure.c \ +libffi.call/return_fl.c libffi.call/struct5.c \ +libffi.call/cls_12byte.c libffi.call/cls_multi_sshortchar.c \ +libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \ +libffi.call/return_fl3.c libffi.call/stret_medium.c \ +libffi.call/nested_struct6.c libffi.call/closure_fn3.c \ +libffi.call/float3.c libffi.call/many2.c \ +libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \ +libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \ +libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \ +libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \ +libffi.call/cls_sshort.c libffi.call/many_win32.c \ +libffi.call/nested_struct.c libffi.call/cls_20byte.c \ +libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \ +libffi.call/return_uc.c libffi.call/closure_thiscall.c \ +libffi.call/cls_18byte.c libffi.call/cls_8byte.c \ +libffi.call/promotion.c libffi.call/struct1_win32.c \ +libffi.call/return_dbl.c libffi.call/cls_24byte.c \ +libffi.call/struct4.c libffi.call/cls_6byte.c \ +libffi.call/cls_align_uint32.c libffi.call/float.c \ +libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \ +libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \ +libffi.call/cls_align_float.c libffi.call/return_fl1.c \ +libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ +libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \ +libffi.call/stret_large2.c libffi.call/return_sl.c \ +libffi.call/closure_fn0.c libffi.call/cls_5byte.c \ +libffi.call/cls_2byte.c libffi.call/float2.c \ +libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \ +libffi.call/stret_large.c libffi.call/cls_ulonglong.c \ +libffi.call/cls_ushort.c libffi.call/nested_struct1.c \ +libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \ +libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \ +libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \ +libffi.call/struct1.c libffi.call/nested_struct9.c \ +libffi.call/huge_struct.c libffi.call/problem1.c \ +libffi.call/float4.c libffi.call/fastthis3_win32.c \ +libffi.call/return_ldl.c libffi.call/strlen2_win32.c \ +libffi.call/closure_fn5.c libffi.call/struct2_win32.c \ +libffi.call/struct6.c libffi.call/return_ll.c libffi.call/struct9.c \ +libffi.call/return_sc.c libffi.call/struct7.c \ +libffi.call/cls_align_uint64.c libffi.call/cls_4byte.c \ +libffi.call/strlen_win32.c libffi.call/cls_6_1_byte.c \ +libffi.call/cls_7_1_byte.c libffi.special/unwindtest.cc \ +libffi.special/special.exp libffi.special/unwindtest_ffi_call.cc \ +libffi.special/ffitestcxx.h lib/wrapper.exp lib/target-libpath.exp \ +lib/libffi.exp libffi.call/cls_struct_va1.c \ +libffi.call/cls_uchar_va.c libffi.call/cls_uint_va.c \ +libffi.call/cls_ulong_va.c libffi.call/cls_ushort_va.c \ +libffi.call/nested_struct11.c libffi.call/uninitialized.c \ +libffi.call/va_1.c libffi.call/va_struct1.c libffi.call/va_struct2.c \ +libffi.call/va_struct3.c + diff --git a/Modules/_ctypes/libffi/testsuite/Makefile.in b/Modules/_ctypes/libffi/testsuite/Makefile.in --- a/Modules/_ctypes/libffi/testsuite/Makefile.in +++ b/Modules/_ctypes/libffi/testsuite/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.12.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,6 +14,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -37,7 +53,19 @@ subdir = testsuite DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_cc_maxopt.m4 \ + $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_configure_args.m4 \ + $(top_srcdir)/m4/ax_enable_builddir.m4 \ + $(top_srcdir)/m4/ax_gcc_archflag.m4 \ + $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -47,12 +75,18 @@ CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac DEJATOOL = $(PACKAGE) RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ +AM_LTLDFLAGS = @AM_LTLDFLAGS@ AM_RUNTESTFLAGS = AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -70,6 +104,7 @@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -77,6 +112,7 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ FGREP = @FGREP@ GREP = @GREP@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ @@ -95,6 +131,7 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -107,8 +144,10 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PRTDIAG = @PRTDIAG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -121,6 +160,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -128,6 +168,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -153,7 +194,6 @@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -164,6 +204,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ @@ -186,70 +227,82 @@ echo $(top_srcdir)/../dejagnu/runtest ; \ else echo runtest; fi` +EXTRA_DEJAGNU_SITE_CONFIG = ../local.exp CLEANFILES = *.exe core* *.log *.sum -EXTRA_DIST = libffi.special/special.exp \ -libffi.special/unwindtest_ffi_call.cc libffi.special/unwindtest.cc \ -libffi.special/ffitestcxx.h config/default.exp lib/target-libpath.exp \ -lib/libffi-dg.exp lib/wrapper.exp libffi.call/float.c \ -libffi.call/cls_multi_schar.c libffi.call/float3.c \ -libffi.call/cls_3_1byte.c libffi.call/stret_large2.c \ -libffi.call/cls_5_1_byte.c libffi.call/stret_medium.c \ -libffi.call/promotion.c libffi.call/cls_dbls_struct.c \ -libffi.call/nested_struct.c libffi.call/closure_fn1.c \ -libffi.call/cls_4_1byte.c libffi.call/cls_float.c \ -libffi.call/cls_2byte.c libffi.call/closure_fn4.c \ -libffi.call/return_fl2.c libffi.call/nested_struct7.c \ -libffi.call/cls_uint.c libffi.call/cls_align_sint64.c \ -libffi.call/float1.c libffi.call/cls_19byte.c \ -libffi.call/nested_struct1.c libffi.call/cls_4byte.c \ -libffi.call/return_fl1.c libffi.call/cls_align_pointer.c \ -libffi.call/nested_struct4.c libffi.call/nested_struct3.c \ -libffi.call/struct7.c libffi.call/nested_struct9.c \ -libffi.call/cls_sshort.c libffi.call/cls_ulonglong.c \ -libffi.call/cls_pointer_stack.c libffi.call/cls_multi_uchar.c \ -libffi.call/testclosure.c libffi.call/cls_3byte1.c \ -libffi.call/struct6.c libffi.call/return_uc.c libffi.call/return_ll1.c \ -libffi.call/cls_ushort.c libffi.call/stret_medium2.c \ -libffi.call/cls_multi_ushortchar.c libffi.call/return_dbl2.c \ -libffi.call/closure_loc_fn0.c libffi.call/return_sc.c \ -libffi.call/nested_struct8.c libffi.call/cls_7_1_byte.c \ -libffi.call/return_ll.c libffi.call/cls_pointer.c \ -libffi.call/err_bad_abi.c libffi.call/return_dbl1.c \ -libffi.call/call.exp libffi.call/ffitest.h libffi.call/strlen.c \ -libffi.call/return_sl.c libffi.call/cls_1_1byte.c \ -libffi.call/struct1.c libffi.call/cls_64byte.c libffi.call/return_ul.c \ -libffi.call/cls_double.c libffi.call/many_win32.c \ -libffi.call/cls_16byte.c libffi.call/cls_align_double.c \ -libffi.call/cls_align_uint16.c libffi.call/cls_9byte1.c \ -libffi.call/cls_multi_sshortchar.c libffi.call/cls_multi_ushort.c \ -libffi.call/closure_stdcall.c libffi.call/return_fl.c \ -libffi.call/strlen_win32.c libffi.call/return_ldl.c \ -libffi.call/cls_align_float.c libffi.call/struct3.c \ -libffi.call/cls_uchar.c libffi.call/cls_sint.c libffi.call/float2.c \ -libffi.call/cls_align_longdouble_split.c \ -libffi.call/cls_longdouble_va.c libffi.call/cls_multi_sshort.c \ -libffi.call/stret_large.c libffi.call/cls_align_sint16.c \ -libffi.call/nested_struct6.c libffi.call/cls_5byte.c \ -libffi.call/return_dbl.c libffi.call/cls_20byte.c \ -libffi.call/cls_8byte.c libffi.call/pyobjc-tc.c \ -libffi.call/cls_24byte.c libffi.call/cls_align_longdouble_split2.c \ -libffi.call/cls_6_1_byte.c libffi.call/cls_schar.c \ -libffi.call/cls_18byte.c libffi.call/closure_fn3.c \ -libffi.call/err_bad_typedef.c libffi.call/closure_fn2.c \ -libffi.call/struct2.c libffi.call/cls_3byte2.c \ -libffi.call/cls_align_longdouble.c libffi.call/cls_20byte1.c \ -libffi.call/return_fl3.c libffi.call/cls_align_uint32.c \ -libffi.call/problem1.c libffi.call/float4.c \ -libffi.call/cls_align_uint64.c libffi.call/struct9.c \ -libffi.call/closure_fn5.c libffi.call/cls_align_sint32.c \ -libffi.call/closure_fn0.c libffi.call/closure_fn6.c \ -libffi.call/struct4.c libffi.call/nested_struct2.c \ -libffi.call/cls_6byte.c libffi.call/cls_7byte.c libffi.call/many.c \ -libffi.call/struct8.c libffi.call/negint.c libffi.call/struct5.c \ -libffi.call/cls_12byte.c libffi.call/cls_double_va.c \ -libffi.call/cls_longdouble.c libffi.call/cls_9byte2.c \ -libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ -libffi.call/huge_struct.c +EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \ +libffi.call/cls_align_longdouble_split.c \ +libffi.call/closure_loc_fn0.c libffi.call/cls_schar.c \ +libffi.call/closure_fn1.c libffi.call/many2_win32.c \ +libffi.call/return_ul.c libffi.call/cls_align_double.c \ +libffi.call/return_fl2.c libffi.call/cls_1_1byte.c \ +libffi.call/cls_64byte.c libffi.call/nested_struct7.c \ +libffi.call/cls_align_sint32.c libffi.call/nested_struct2.c \ +libffi.call/ffitest.h libffi.call/nested_struct4.c \ +libffi.call/cls_multi_ushort.c libffi.call/struct3.c \ +libffi.call/cls_3byte1.c libffi.call/cls_16byte.c \ +libffi.call/struct8.c libffi.call/nested_struct8.c \ +libffi.call/cls_multi_sshort.c libffi.call/cls_3byte2.c \ +libffi.call/fastthis2_win32.c libffi.call/cls_pointer.c \ +libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c \ +libffi.call/cls_9byte2.c libffi.call/cls_multi_schar.c \ +libffi.call/stret_medium2.c libffi.call/cls_5_1_byte.c \ +libffi.call/call.exp libffi.call/cls_double.c \ +libffi.call/cls_align_sint16.c libffi.call/cls_uint.c \ +libffi.call/return_ll1.c libffi.call/nested_struct3.c \ +libffi.call/cls_20byte1.c libffi.call/closure_fn4.c \ +libffi.call/cls_uchar.c libffi.call/struct2.c libffi.call/cls_7byte.c \ +libffi.call/strlen.c libffi.call/many.c libffi.call/testclosure.c \ +libffi.call/return_fl.c libffi.call/struct5.c \ +libffi.call/cls_12byte.c libffi.call/cls_multi_sshortchar.c \ +libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \ +libffi.call/return_fl3.c libffi.call/stret_medium.c \ +libffi.call/nested_struct6.c libffi.call/closure_fn3.c \ +libffi.call/float3.c libffi.call/many2.c \ +libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \ +libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \ +libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \ +libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \ +libffi.call/cls_sshort.c libffi.call/many_win32.c \ +libffi.call/nested_struct.c libffi.call/cls_20byte.c \ +libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \ +libffi.call/return_uc.c libffi.call/closure_thiscall.c \ +libffi.call/cls_18byte.c libffi.call/cls_8byte.c \ +libffi.call/promotion.c libffi.call/struct1_win32.c \ +libffi.call/return_dbl.c libffi.call/cls_24byte.c \ +libffi.call/struct4.c libffi.call/cls_6byte.c \ +libffi.call/cls_align_uint32.c libffi.call/float.c \ +libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \ +libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \ +libffi.call/cls_align_float.c libffi.call/return_fl1.c \ +libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ +libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \ +libffi.call/stret_large2.c libffi.call/return_sl.c \ +libffi.call/closure_fn0.c libffi.call/cls_5byte.c \ +libffi.call/cls_2byte.c libffi.call/float2.c \ +libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \ +libffi.call/stret_large.c libffi.call/cls_ulonglong.c \ +libffi.call/cls_ushort.c libffi.call/nested_struct1.c \ +libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \ +libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \ +libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \ +libffi.call/struct1.c libffi.call/nested_struct9.c \ +libffi.call/huge_struct.c libffi.call/problem1.c \ +libffi.call/float4.c libffi.call/fastthis3_win32.c \ +libffi.call/return_ldl.c libffi.call/strlen2_win32.c \ +libffi.call/closure_fn5.c libffi.call/struct2_win32.c \ +libffi.call/struct6.c libffi.call/return_ll.c libffi.call/struct9.c \ +libffi.call/return_sc.c libffi.call/struct7.c \ +libffi.call/cls_align_uint64.c libffi.call/cls_4byte.c \ +libffi.call/strlen_win32.c libffi.call/cls_6_1_byte.c \ +libffi.call/cls_7_1_byte.c libffi.special/unwindtest.cc \ +libffi.special/special.exp libffi.special/unwindtest_ffi_call.cc \ +libffi.special/ffitestcxx.h lib/wrapper.exp lib/target-libpath.exp \ +lib/libffi.exp libffi.call/cls_struct_va1.c \ +libffi.call/cls_uchar_va.c libffi.call/cls_uint_va.c \ +libffi.call/cls_ulong_va.c libffi.call/cls_ushort_va.c \ +libffi.call/nested_struct11.c libffi.call/uninitialized.c \ +libffi.call/va_1.c libffi.call/va_struct1.c libffi.call/va_struct2.c \ +libffi.call/va_struct3.c all: all-am @@ -296,9 +349,11 @@ ctags: CTAGS CTAGS: +cscope cscopelist: + check-DEJAGNU: site.exp - srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \ + srcdir='$(srcdir)'; export srcdir; \ EXPECT=$(EXPECT); export EXPECT; \ runtest=$(RUNTEST); \ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ @@ -306,15 +361,15 @@ if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \ then :; else exit_status=1; fi; \ done; \ - else echo "WARNING: could not find \`runtest'" 1>&2; :;\ + else echo "WARNING: could not find 'runtest'" 1>&2; :;\ fi; \ exit $$exit_status -site.exp: Makefile - @echo 'Making a new site.exp file...' +site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG) + @echo 'Making a new site.exp file ...' @echo '## these variables are automatically generated by make ##' >site.tmp @echo '# Do not edit here. If you wish to override these values' >>site.tmp @echo '# edit the last section' >>site.tmp - @echo 'set srcdir $(srcdir)' >>site.tmp + @echo 'set srcdir "$(srcdir)"' >>site.tmp @echo "set objdir `pwd`" >>site.tmp @echo 'set build_alias "$(build_alias)"' >>site.tmp @echo 'set build_triplet $(build_triplet)' >>site.tmp @@ -322,9 +377,16 @@ @echo 'set host_triplet $(host_triplet)' >>site.tmp @echo 'set target_alias "$(target_alias)"' >>site.tmp @echo 'set target_triplet $(target_triplet)' >>site.tmp - @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp - @test ! -f site.exp || \ - sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp + @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \ + echo "## Begin content included from file $$f. Do not modify. ##" \ + && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \ + && echo "## End content included from file $$f. ##" \ + || exit 1; \ + done >> site.tmp + @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp + @if test -f site.exp; then \ + sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \ + fi @-rm -f site.bak @test ! -f site.exp || mv site.exp site.bak @mv site.tmp site.exp @@ -380,10 +442,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: diff --git a/Modules/_ctypes/libffi/testsuite/lib/libffi.exp b/Modules/_ctypes/libffi/testsuite/lib/libffi.exp new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/lib/libffi.exp @@ -0,0 +1,369 @@ +# Copyright (C) 2003, 2005, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING3. If not see +# . + +proc load_gcc_lib { filename } { + global srcdir + load_file $srcdir/lib/$filename +} + +load_lib dg.exp +load_lib libgloss.exp +load_gcc_lib target-libpath.exp +load_gcc_lib wrapper.exp + + +# Define libffi callbacks for dg.exp. + +proc libffi-dg-test-1 { target_compile prog do_what extra_tool_flags } { + + # To get all \n in dg-output test strings to match printf output + # in a system that outputs it as \015\012 (i.e. not just \012), we + # need to change all \n into \r?\n. As there is no dejagnu flag + # or hook to do that, we simply change the text being tested. + # Unfortunately, we have to know that the variable is called + # dg-output-text and lives in the caller of libffi-dg-test, which + # is two calls up. Overriding proc dg-output would be longer and + # would necessarily have the same assumption. + upvar 2 dg-output-text output_match + + if { [llength $output_match] > 1 } { + regsub -all "\n" [lindex $output_match 1] "\r?\n" x + set output_match [lreplace $output_match 1 1 $x] + } + + # Set up the compiler flags, based on what we're going to do. + + set options [list] + switch $do_what { + "compile" { + set compile_type "assembly" + set output_file "[file rootname [file tail $prog]].s" + } + "link" { + set compile_type "executable" + set output_file "[file rootname [file tail $prog]].exe" + # The following line is needed for targets like the i960 where + # the default output file is b.out. Sigh. + } + "run" { + set compile_type "executable" + # FIXME: "./" is to cope with "." not being in $PATH. + # Should this be handled elsewhere? + # YES. + set output_file "./[file rootname [file tail $prog]].exe" + # This is the only place where we care if an executable was + # created or not. If it was, dg.exp will try to run it. + remote_file build delete $output_file; + } + default { + perror "$do_what: not a valid dg-do keyword" + return "" + } + } + + if { $extra_tool_flags != "" } { + lappend options "additional_flags=$extra_tool_flags" + } + + set comp_output [libffi_target_compile "$prog" "$output_file" "$compile_type" $options]; + + + return [list $comp_output $output_file] +} + + +proc libffi-dg-test { prog do_what extra_tool_flags } { + return [libffi-dg-test-1 target_compile $prog $do_what $extra_tool_flags] +} + +proc libffi-init { args } { + global gluefile wrap_flags; + global srcdir + global blddirffi + global objdir + global TOOL_OPTIONS + global tool + global libffi_include + global libffi_link_flags + global tool_root_dir + global ld_library_path + + global using_gcc + + set blddirffi [pwd]/.. + verbose "libffi $blddirffi" + + # Are we building with GCC? + set tmp [grep ../config.status "GCC='yes'"] + if { [string match $tmp "GCC='yes'"] } { + + set using_gcc "yes" + + set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] + if {$gccdir != ""} { + set gccdir [file dirname $gccdir] + } + verbose "gccdir $gccdir" + + set ld_library_path "." + append ld_library_path ":${gccdir}" + + set compiler "${gccdir}/xgcc" + if { [is_remote host] == 0 && [which $compiler] != 0 } { + foreach i "[exec $compiler --print-multi-lib]" { + set mldir "" + regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir + set mldir [string trimright $mldir "\;@"] + if { "$mldir" == "." } { + continue + } + if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } { + append ld_library_path ":${gccdir}/${mldir}" + } + } + } + + } else { + + set using_gcc "no" + + } + + # add the library path for libffi. + append ld_library_path ":${blddirffi}/.libs" + + verbose "ld_library_path: $ld_library_path" + + # Point to the Libffi headers in libffi. + set libffi_include "${blddirffi}/include" + verbose "libffi_include $libffi_include" + + set libffi_dir "${blddirffi}/.libs" + verbose "libffi_dir $libffi_dir" + if { $libffi_dir != "" } { + set libffi_dir [file dirname ${libffi_dir}] + set libffi_link_flags "-L${libffi_dir}/.libs" + } + + set_ld_library_path_env_vars + libffi_maybe_build_wrapper "${objdir}/testglue.o" +} + +proc libffi_exit { } { + global gluefile; + + if [info exists gluefile] { + file_on_build delete $gluefile; + unset gluefile; + } +} + +proc libffi_target_compile { source dest type options } { + global gluefile wrap_flags; + global srcdir + global blddirffi + global TOOL_OPTIONS + global libffi_link_flags + global libffi_include + global target_triplet + + + if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } { + lappend options "libs=${gluefile}" + lappend options "ldflags=$wrap_flags" + } + + # TOOL_OPTIONS must come first, so that it doesn't override testcase + # specific options. + if [info exists TOOL_OPTIONS] { + lappend options [concat "additional_flags=$TOOL_OPTIONS" $options]; + } + + # search for ffi_mips.h in srcdir, too + lappend options "additional_flags=-I${libffi_include} -I${srcdir}/../include -I${libffi_include}/.." + lappend options "additional_flags=${libffi_link_flags}" + + # Darwin needs a stack execution allowed flag. + + if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"] + || [istarget "*-*-darwin2*"] } { + lappend options "additional_flags=-Wl,-allow_stack_execute" + } + + # If you're building the compiler with --prefix set to a place + # where it's not yet installed, then the linker won't be able to + # find the libgcc used by libffi.dylib. We could pass the + # -dylib_file option, but that's complicated, and it's much easier + # to just make the linker find libgcc using -L options. + if { [string match "*-*-darwin*" $target_triplet] } { + lappend options "libs= -shared-libgcc" + } + + if { [string match "*-*-openbsd*" $target_triplet] } { + lappend options "libs= -lpthread" + } + + lappend options "libs= -lffi" + + if { [string match "aarch64*-*-linux*" $target_triplet] } { + lappend options "libs= -lpthread" + } + + verbose "options: $options" + return [target_compile $source $dest $type $options] +} + +# Utility routines. + +# +# search_for -- looks for a string match in a file +# +proc search_for { file pattern } { + set fd [open $file r] + while { [gets $fd cur_line]>=0 } { + if [string match "*$pattern*" $cur_line] then { + close $fd + return 1 + } + } + close $fd + return 0 +} + +# Modified dg-runtest that can cycle through a list of optimization options +# as c-torture does. +proc libffi-dg-runtest { testcases default-extra-flags } { + global runtests + + foreach test $testcases { + # If we're only testing specific files and this isn't one of + # them, skip it. + if ![runtest_file_p $runtests $test] { + continue + } + + # Look for a loop within the source code - if we don't find one, + # don't pass -funroll[-all]-loops. + global torture_with_loops torture_without_loops + if [expr [search_for $test "for*("]+[search_for $test "while*("]] { + set option_list $torture_with_loops + } else { + set option_list $torture_without_loops + } + + set nshort [file tail [file dirname $test]]/[file tail $test] + + foreach flags $option_list { + verbose "Testing $nshort, $flags" 1 + dg-test $test $flags ${default-extra-flags} + } + } +} + + +# Like check_conditional_xfail, but callable from a dg test. + +proc dg-xfail-if { args } { + set args [lreplace $args 0 0] + set selector "target [join [lindex $args 1]]" + if { [dg-process-target $selector] == "S" } { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data $args + } +} + +proc check-flags { args } { + + # The args are within another list; pull them out. + set args [lindex $args 0] + + # The next two arguments are optional. If they were not specified, + # use the defaults. + if { [llength $args] == 2 } { + lappend $args [list "*"] + } + if { [llength $args] == 3 } { + lappend $args [list ""] + } + + # If the option strings are the defaults, or the same as the + # defaults, there is no need to call check_conditional_xfail to + # compare them to the actual options. + if { [string compare [lindex $args 2] "*"] == 0 + && [string compare [lindex $args 3] "" ] == 0 } { + set result 1 + } else { + # The target list might be an effective-target keyword, so replace + # the original list with "*-*-*", since we already know it matches. + set result [check_conditional_xfail [lreplace $args 1 1 "*-*-*"]] + } + + return $result +} + +proc dg-skip-if { args } { + # Verify the number of arguments. The last two are optional. + set args [lreplace $args 0 0] + if { [llength $args] < 2 || [llength $args] > 4 } { + error "dg-skip-if 2: need 2, 3, or 4 arguments" + } + + # Don't bother if we're already skipping the test. + upvar dg-do-what dg-do-what + if { [lindex ${dg-do-what} 1] == "N" } { + return + } + + set selector [list target [lindex $args 1]] + if { [dg-process-target $selector] == "S" } { + if [check-flags $args] { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + } + } +} + +# We need to make sure that additional_files and additional_sources +# are both cleared out after every test. It is not enough to clear +# them out *before* the next test run because gcc-target-compile gets +# run directly from some .exp files (outside of any test). (Those +# uses should eventually be eliminated.) + +# Because the DG framework doesn't provide a hook that is run at the +# end of a test, we must replace dg-test with a wrapper. + +if { [info procs saved-dg-test] == [list] } { + rename dg-test saved-dg-test + + proc dg-test { args } { + global additional_files + global additional_sources + global errorInfo + + if { [ catch { eval saved-dg-test $args } errmsg ] } { + set saved_info $errorInfo + set additional_files "" + set additional_sources "" + error $errmsg $saved_info + } + set additional_files "" + set additional_sources "" + } +} + +# Local Variables: +# tcl-indent-level:4 +# End: diff --git a/Modules/_ctypes/libffi/testsuite/lib/target-libpath.exp b/Modules/_ctypes/libffi/testsuite/lib/target-libpath.exp --- a/Modules/_ctypes/libffi/testsuite/lib/target-libpath.exp +++ b/Modules/_ctypes/libffi/testsuite/lib/target-libpath.exp @@ -25,7 +25,7 @@ set orig_ld_library_path_32_saved 0 set orig_ld_library_path_64_saved 0 set orig_dyld_library_path_saved 0 - +set orig_path_saved 0 ####################################### # proc set_ld_library_path_env_vars { } @@ -42,6 +42,7 @@ global orig_ld_library_path_32_saved global orig_ld_library_path_64_saved global orig_dyld_library_path_saved + global orig_path_saved global orig_ld_library_path global orig_ld_run_path global orig_shlib_path @@ -50,6 +51,7 @@ global orig_ld_library_path_32 global orig_ld_library_path_64 global orig_dyld_library_path + global orig_path global GCC_EXEC_PREFIX # Set the relocated compiler prefix, but only if the user hasn't specified one. @@ -100,6 +102,10 @@ set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)" set orig_dyld_library_path_saved 1 } + if [info exists env(PATH)] { + set orig_path "$env(PATH)" + set orig_path_saved 1 + } } # We need to set ld library path in the environment. Currently, @@ -169,6 +175,13 @@ } else { setenv DYLD_LIBRARY_PATH "$ld_library_path" } + if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } { + if { $orig_path_saved } { + setenv PATH "$ld_library_path:$orig_path" + } else { + setenv PATH "$ld_library_path" + } + } verbose -log "set_ld_library_path_env_vars: ld_library_path=$ld_library_path" } @@ -187,6 +200,7 @@ global orig_ld_library_path_32_saved global orig_ld_library_path_64_saved global orig_dyld_library_path_saved + global orig_path_saved global orig_ld_library_path global orig_ld_run_path global orig_shlib_path @@ -195,6 +209,7 @@ global orig_ld_library_path_32 global orig_ld_library_path_64 global orig_dyld_library_path + global orig_path if { $orig_environment_saved == 0 } { return @@ -240,6 +255,11 @@ } elseif [info exists env(DYLD_LIBRARY_PATH)] { unsetenv DYLD_LIBRARY_PATH } + if { $orig_path_saved } { + setenv PATH "$orig_path" + } elseif [info exists env(PATH)] { + unsetenv PATH + } } ####################################### diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/call.exp b/Modules/_ctypes/libffi/testsuite/libffi.call/call.exp --- a/Modules/_ctypes/libffi/testsuite/libffi.call/call.exp +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/call.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2003, 2006, 2009 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006, 2009, 2010 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,20 +14,25 @@ # along with this program; see the file COPYING3. If not see # . -# libffi testsuite that uses the 'dg.exp' driver. - -load_lib libffi-dg.exp - dg-init libffi-init global srcdir subdir -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" "" +if { [string match $using_gcc "yes"] } { + + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" "" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" "" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" "" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" "" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" "" + +} else { + + # Assume we are using the vendor compiler. + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" "" + +} dg-finish diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/closure_stdcall.c b/Modules/_ctypes/libffi/testsuite/libffi.call/closure_stdcall.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/closure_stdcall.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/closure_stdcall.c @@ -49,9 +49,17 @@ CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_stdcall, (void *) 3 /* userdata */, code) == FFI_OK); +#ifdef _MSC_VER + __asm { mov sp_pre, esp } +#else asm volatile (" movl %%esp,%0" : "=g" (sp_pre)); +#endif res = (*(closure_test_type0)code)(0, 1, 2, 3); +#ifdef _MSC_VER + __asm { mov sp_post, esp } +#else asm volatile (" movl %%esp,%0" : "=g" (sp_post)); +#endif /* { dg-output "0 1 2 3: 9" } */ printf("res: %d\n",res); diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/closure_thiscall.c b/Modules/_ctypes/libffi/testsuite/libffi.call/closure_thiscall.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/closure_thiscall.c @@ -0,0 +1,72 @@ +/* Area: closure_call (thiscall convention) + Purpose: Check handling when caller expects thiscall callee + Limitations: none. + PR: none. + Originator: */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ +#include "ffitest.h" + +static void +closure_test_thiscall(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata) +{ + *(ffi_arg*)resp = + (int)*(int *)args[0] + (int)(*(int *)args[1]) + + (int)(*(int *)args[2]) + (int)(*(int *)args[3]) + + (int)(intptr_t)userdata; + + printf("%d %d %d %d: %d\n", + (int)*(int *)args[0], (int)(*(int *)args[1]), + (int)(*(int *)args[2]), (int)(*(int *)args[3]), + (int)*(ffi_arg *)resp); + +} + +typedef int (__thiscall *closure_test_type0)(int, int, int, int); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[17]; + int res; + void* sp_pre; + void* sp_post; + char buf[1024]; + + cl_arg_types[0] = &ffi_type_uint; + cl_arg_types[1] = &ffi_type_uint; + cl_arg_types[2] = &ffi_type_uint; + cl_arg_types[3] = &ffi_type_uint; + cl_arg_types[4] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_THISCALL, 4, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_thiscall, + (void *) 3 /* userdata */, code) == FFI_OK); + +#ifdef _MSC_VER + __asm { mov sp_pre, esp } +#else + asm volatile (" movl %%esp,%0" : "=g" (sp_pre)); +#endif + res = (*(closure_test_type0)code)(0, 1, 2, 3); +#ifdef _MSC_VER + __asm { mov sp_post, esp } +#else + asm volatile (" movl %%esp,%0" : "=g" (sp_post)); +#endif + /* { dg-output "0 1 2 3: 9" } */ + + printf("res: %d\n",res); + /* { dg-output "\nres: 9" } */ + + sprintf(buf, "mismatch: pre=%p vs post=%p", sp_pre, sp_post); + printf("stack pointer %s\n", (sp_pre == sp_post ? "match" : buf)); + /* { dg-output "\nstack pointer match" } */ + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_12byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_12byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_12byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_12byte.c @@ -49,15 +49,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_12byte h_dbl = { 7, 4, 9 }; + struct cls_struct_12byte j_dbl = { 1, 5, 3 }; + struct cls_struct_12byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_12byte h_dbl = { 7, 4, 9 }; - struct cls_struct_12byte j_dbl = { 1, 5, 3 }; - struct cls_struct_12byte res_dbl; - cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_sint; cls_struct_fields[2] = &ffi_type_sint; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_16byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_16byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_16byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_16byte.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_16byte h_dbl = { 7, 8.0, 9 }; + struct cls_struct_16byte j_dbl = { 1, 9.0, 3 }; + struct cls_struct_16byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_16byte h_dbl = { 7, 8.0, 9 }; - struct cls_struct_16byte j_dbl = { 1, 9.0, 3 }; - struct cls_struct_16byte res_dbl; - cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_sint; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_18byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_18byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_18byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_18byte.c @@ -54,15 +54,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; + struct cls_struct_18byte g_dbl = { 1.0, 127, 126, 3.0 }; + struct cls_struct_18byte f_dbl = { 4.0, 125, 124, 5.0 }; + struct cls_struct_18byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_18byte g_dbl = { 1.0, 127, 126, 3.0 }; - struct cls_struct_18byte f_dbl = { 4.0, 125, 124, 5.0 }; - struct cls_struct_18byte res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_19byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_19byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_19byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_19byte.c @@ -57,15 +57,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; + struct cls_struct_19byte g_dbl = { 1.0, 127, 126, 3.0, 120 }; + struct cls_struct_19byte f_dbl = { 4.0, 125, 124, 5.0, 119 }; + struct cls_struct_19byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_19byte g_dbl = { 1.0, 127, 126, 3.0, 120 }; - struct cls_struct_19byte f_dbl = { 4.0, 125, 124, 5.0, 119 }; - struct cls_struct_19byte res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_1_1byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_1_1byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_1_1byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_1_1byte.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_1_1byte g_dbl = { 12 }; + struct cls_struct_1_1byte f_dbl = { 178 }; + struct cls_struct_1_1byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_1_1byte g_dbl = { 12 }; - struct cls_struct_1_1byte f_dbl = { 178 }; - struct cls_struct_1_1byte res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_20byte g_dbl = { 1.0, 2.0, 3 }; + struct cls_struct_20byte f_dbl = { 4.0, 5.0, 7 }; + struct cls_struct_20byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_20byte g_dbl = { 1.0, 2.0, 3 }; - struct cls_struct_20byte f_dbl = { 4.0, 5.0, 7 }; - struct cls_struct_20byte res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_sint; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte1.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte1.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_20byte1.c @@ -52,15 +52,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; + struct cls_struct_20byte g_dbl = { 1, 2.0, 3.0 }; + struct cls_struct_20byte f_dbl = { 4, 5.0, 7.0 }; + struct cls_struct_20byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_20byte g_dbl = { 1, 2.0, 3.0 }; - struct cls_struct_20byte f_dbl = { 4, 5.0, 7.0 }; - struct cls_struct_20byte res_dbl; - cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_24byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_24byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_24byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_24byte.c @@ -61,17 +61,17 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - struct cls_struct_24byte e_dbl = { 9.0, 2.0, 6, 5.0 }; struct cls_struct_24byte f_dbl = { 1.0, 2.0, 3, 7.0 }; struct cls_struct_24byte g_dbl = { 4.0, 5.0, 7, 9.0 }; struct cls_struct_24byte h_dbl = { 8.0, 6.0, 1, 4.0 }; struct cls_struct_24byte res_dbl; + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_sint; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_2byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_2byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_2byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_2byte.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_2byte g_dbl = { 12, 127 }; + struct cls_struct_2byte f_dbl = { 1, 13 }; + struct cls_struct_2byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_2byte g_dbl = { 12, 127 }; - struct cls_struct_2byte f_dbl = { 1, 13 }; - struct cls_struct_2byte res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3_1byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3_1byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3_1byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3_1byte.c @@ -54,15 +54,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_3_1byte g_dbl = { 12, 13, 14 }; + struct cls_struct_3_1byte f_dbl = { 178, 179, 180 }; + struct cls_struct_3_1byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_3_1byte g_dbl = { 12, 13, 14 }; - struct cls_struct_3_1byte f_dbl = { 178, 179, 180 }; - struct cls_struct_3_1byte res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte1.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte1.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte1.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_3byte g_dbl = { 12, 119 }; + struct cls_struct_3byte f_dbl = { 1, 15 }; + struct cls_struct_3byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_3byte g_dbl = { 12, 119 }; - struct cls_struct_3byte f_dbl = { 1, 15 }; - struct cls_struct_3byte res_dbl; - cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_3byte2.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_3byte_1 g_dbl = { 15, 125 }; + struct cls_struct_3byte_1 f_dbl = { 9, 19 }; + struct cls_struct_3byte_1 res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_3byte_1 g_dbl = { 15, 125 }; - struct cls_struct_3byte_1 f_dbl = { 9, 19 }; - struct cls_struct_3byte_1 res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4_1byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4_1byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4_1byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4_1byte.c @@ -56,15 +56,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_4_1byte g_dbl = { 12, 13, 14, 15 }; + struct cls_struct_4_1byte f_dbl = { 178, 179, 180, 181 }; + struct cls_struct_4_1byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_4_1byte g_dbl = { 12, 13, 14, 15 }; - struct cls_struct_4_1byte f_dbl = { 178, 179, 180, 181 }; - struct cls_struct_4_1byte res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_4byte.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_4byte g_dbl = { 127, 120 }; + struct cls_struct_4byte f_dbl = { 12, 128 }; + struct cls_struct_4byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_4byte g_dbl = { 127, 120 }; - struct cls_struct_4byte f_dbl = { 12, 128 }; - struct cls_struct_4byte res_dbl; - cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5_1_byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5_1_byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5_1_byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5_1_byte.c @@ -58,15 +58,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_5byte g_dbl = { 127, 120, 1, 3, 4 }; + struct cls_struct_5byte f_dbl = { 12, 128, 9, 3, 4 }; + struct cls_struct_5byte res_dbl = { 0, 0, 0, 0, 0 }; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_5byte g_dbl = { 127, 120, 1, 3, 4 }; - struct cls_struct_5byte f_dbl = { 12, 128, 9, 3, 4 }; - struct cls_struct_5byte res_dbl = { 0, 0, 0, 0, 0 }; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_5byte.c @@ -53,15 +53,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_5byte g_dbl = { 127, 120, 1 }; + struct cls_struct_5byte f_dbl = { 12, 128, 9 }; + struct cls_struct_5byte res_dbl = { 0, 0, 0 }; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_5byte g_dbl = { 127, 120, 1 }; - struct cls_struct_5byte f_dbl = { 12, 128, 9 }; - struct cls_struct_5byte res_dbl = { 0, 0, 0 }; - cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_64byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_64byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_64byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_64byte.c @@ -66,17 +66,17 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - struct cls_struct_64byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0 }; struct cls_struct_64byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0 }; struct cls_struct_64byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0 }; struct cls_struct_64byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0 }; struct cls_struct_64byte res_dbl; + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6_1_byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6_1_byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6_1_byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6_1_byte.c @@ -60,15 +60,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_6byte g_dbl = { 127, 120, 1, 3, 4, 5 }; + struct cls_struct_6byte f_dbl = { 12, 128, 9, 3, 4, 5 }; + struct cls_struct_6byte res_dbl = { 0, 0, 0, 0, 0, 0 }; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_6byte g_dbl = { 127, 120, 1, 3, 4, 5 }; - struct cls_struct_6byte f_dbl = { 12, 128, 9, 3, 4, 5 }; - struct cls_struct_6byte res_dbl = { 0, 0, 0, 0, 0, 0 }; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_6byte.c @@ -56,15 +56,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_6byte g_dbl = { 127, 120, 1, 128 }; + struct cls_struct_6byte f_dbl = { 12, 128, 9, 127 }; + struct cls_struct_6byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_6byte g_dbl = { 127, 120, 1, 128 }; - struct cls_struct_6byte f_dbl = { 12, 128, 9, 127 }; - struct cls_struct_6byte res_dbl; - cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7_1_byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7_1_byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7_1_byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7_1_byte.c @@ -62,15 +62,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_7byte g_dbl = { 127, 120, 1, 3, 4, 5, 6 }; + struct cls_struct_7byte f_dbl = { 12, 128, 9, 3, 4, 5, 6 }; + struct cls_struct_7byte res_dbl = { 0, 0, 0, 0, 0, 0, 0 }; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_7byte g_dbl = { 127, 120, 1, 3, 4, 5, 6 }; - struct cls_struct_7byte f_dbl = { 12, 128, 9, 3, 4, 5, 6 }; - struct cls_struct_7byte res_dbl = { 0, 0, 0, 0, 0, 0, 0 }; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7byte.c @@ -55,15 +55,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_7byte g_dbl = { 127, 120, 1, 254 }; + struct cls_struct_7byte f_dbl = { 12, 128, 9, 255 }; + struct cls_struct_7byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_7byte g_dbl = { 127, 120, 1, 254 }; - struct cls_struct_7byte f_dbl = { 12, 128, 9, 255 }; - struct cls_struct_7byte res_dbl; - cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_8byte.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_8byte.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_8byte.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_8byte.c @@ -49,15 +49,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_8byte g_dbl = { 1, 2.0 }; + struct cls_struct_8byte f_dbl = { 4, 5.0 }; + struct cls_struct_8byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_8byte g_dbl = { 1, 2.0 }; - struct cls_struct_8byte f_dbl = { 4, 5.0 }; - struct cls_struct_8byte res_dbl; - cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte1.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte1.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte1.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; + struct cls_struct_9byte h_dbl = { 7, 8.0}; + struct cls_struct_9byte j_dbl = { 1, 9.0}; + struct cls_struct_9byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_9byte h_dbl = { 7, 8.0}; - struct cls_struct_9byte j_dbl = { 1, 9.0}; - struct cls_struct_9byte res_dbl; - cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_9byte2.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; + struct cls_struct_9byte h_dbl = { 7.0, 8}; + struct cls_struct_9byte j_dbl = { 1.0, 9}; + struct cls_struct_9byte res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_9byte h_dbl = { 7.0, 8}; - struct cls_struct_9byte j_dbl = { 1.0, 9}; - struct cls_struct_9byte res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_sint; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_double.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_double.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_double.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_double.c @@ -52,15 +52,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_float.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_float.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_float.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_float.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble.c @@ -51,15 +51,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_longdouble; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split.c @@ -6,7 +6,7 @@ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ -/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" @@ -87,15 +87,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; + struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; + struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; - struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_longdouble; cls_struct_fields[1] = &ffi_type_longdouble; cls_struct_fields[2] = &ffi_type_longdouble; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c @@ -7,7 +7,7 @@ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail strongarm*-*-* } } */ -/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" @@ -67,15 +67,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; + struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; + struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; - struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_longdouble; cls_struct_fields[1] = &ffi_type_longdouble; cls_struct_fields[2] = &ffi_type_longdouble; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_pointer.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_pointer.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_pointer.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_pointer.c @@ -54,15 +54,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, (void *)4951, 127 }; + struct cls_struct_align f_dbl = { 1, (void *)9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, (void *)4951, 127 }; - struct cls_struct_align f_dbl = { 1, (void *)9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_pointer; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint16.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint16.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint16.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint16.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_sshort; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint32.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint32.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint32.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_sint; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint64.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint64.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint64.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_sint64.c @@ -51,15 +51,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_sint64; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint16.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint16.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint16.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint16.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint32.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint32.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint32.c @@ -50,15 +50,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uint; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint64.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint64.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint64.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_align_uint64.c @@ -52,15 +52,15 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uint64; cls_struct_fields[2] = &ffi_type_uchar; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_dbls_struct.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_dbls_struct.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_dbls_struct.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_dbls_struct.c @@ -37,6 +37,8 @@ ffi_type ts1_type; ffi_type* ts1_type_elements[4]; + Dbls arg = { 1.0, 2.0 }; + ts1_type.size = 0; ts1_type.alignment = 0; ts1_type.type = FFI_TYPE_STRUCT; @@ -48,8 +50,6 @@ cl_arg_types[0] = &ts1_type; - Dbls arg = { 1.0, 2.0 }; - /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_void, cl_arg_types) == FFI_OK); diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c @@ -6,6 +6,8 @@ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-output "" { xfail avr32*-*-* } } */ +/* { dg-output "" { xfail mips-sgi-irix6* } } PR libffi/46660 */ + #include "ffitest.h" static void @@ -34,7 +36,8 @@ arg_types[1] = &ffi_type_double; arg_types[2] = NULL; - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, + /* This printf call is variadic */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint, arg_types) == FFI_OK); args[0] = &format; @@ -42,16 +45,19 @@ args[2] = NULL; ffi_call(&cif, FFI_FN(printf), &res, args); - // { dg-output "7.0" } + /* { dg-output "7.0" } */ printf("res: %d\n", (int) res); - // { dg-output "\nres: 4" } + /* { dg-output "\nres: 4" } */ + + /* The call to cls_double_va_fn is static, so have to use a normal prep_cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK); res = ((int(*)(char*, double))(code))(format, doubleArg); - // { dg-output "\n7.0" } + /* { dg-output "\n7.0" } */ printf("res: %d\n", (int) res); - // { dg-output "\nres: 4" } + /* { dg-output "\nres: 4" } */ exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c @@ -5,8 +5,10 @@ Originator: Blake Chaffin */ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ -/* { dg-do run { xfail arm*-*-* strongarm*-*-* xscale*-*-* } } */ -/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ +/* This test is known to PASS on armv7l-unknown-linux-gnueabihf, so I have + remove the xfail for arm*-*-* below, until we know more. */ +/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c @@ -6,6 +6,8 @@ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-output "" { xfail avr32*-*-* x86_64-*-mingw* } } */ +/* { dg-output "" { xfail mips-sgi-irix6* } } PR libffi/46660 */ + #include "ffitest.h" static void @@ -34,7 +36,8 @@ arg_types[1] = &ffi_type_longdouble; arg_types[2] = NULL; - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, + /* This printf call is variadic */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint, arg_types) == FFI_OK); args[0] = &format; @@ -42,16 +45,20 @@ args[2] = NULL; ffi_call(&cif, FFI_FN(printf), &res, args); - // { dg-output "7.0" } + /* { dg-output "7.0" } */ printf("res: %d\n", (int) res); - // { dg-output "\nres: 4" } + /* { dg-output "\nres: 4" } */ + + /* The call to cls_longdouble_va_fn is static, so have to use a normal prep_cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, + arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK); res = ((int(*)(char*, long double))(code))(format, ldArg); - // { dg-output "\n7.0" } + /* { dg-output "\n7.0" } */ printf("res: %d\n", (int) res); - // { dg-output "\nres: 4" } + /* { dg-output "\nres: 4" } */ exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c @@ -35,7 +35,7 @@ void *code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; -// ffi_type cls_pointer_type; + /* ffi_type cls_pointer_type; */ ffi_type* arg_types[3]; /* cls_pointer_type.size = sizeof(void*); @@ -65,7 +65,7 @@ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); - res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2); + res = (ffi_arg)(uintptr_t)((void*(*)(void*, void*))(code))(arg1, arg2); /* { dg-output "\n0x12345678 0x89abcdef: 0x9be02467" } */ printf("res: 0x%08x\n", (unsigned int) res); /* { dg-output "\nres: 0x9be02467" } */ diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c @@ -28,11 +28,12 @@ char trample6 = trample4 + ((char*)&a2)[1]; long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; char trample8 = trample6 + trample2; + void* result; dummyVar = dummy_func(trample1, trample2, trample3, trample4, trample5, trample6, trample7, trample8); - void* result = (void*)((intptr_t)a1 + (intptr_t)a2); + result = (void*)((intptr_t)a1 + (intptr_t)a2); printf("0x%08x 0x%08x: 0x%08x\n", (unsigned int)(uintptr_t) a1, @@ -52,11 +53,12 @@ char trample6 = trample4 + ((char*)&a2)[1]; long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; char trample8 = trample6 + trample2; + void* result; dummyVar = dummy_func(trample1, trample2, trample3, trample4, trample5, trample6, trample7, trample8); - void* result = (void*)((intptr_t)a1 + (intptr_t)a2); + result = (void*)((intptr_t)a1 + (intptr_t)a2); printf("0x%08x 0x%08x: 0x%08x\n", (unsigned int)(intptr_t) a1, @@ -96,7 +98,7 @@ void *code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; -// ffi_type cls_pointer_type; + /* ffi_type cls_pointer_type; */ ffi_type* arg_types[3]; /* cls_pointer_type.size = sizeof(void*); @@ -123,18 +125,18 @@ ffi_call(&cif, FFI_FN(cls_pointer_fn1), &res, args); printf("res: 0x%08x\n", (unsigned int) res); - // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } - // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } - // { dg-output "\nres: 0x8bf258bd" } + /* { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } */ + /* { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } */ + /* { dg-output "\nres: 0x8bf258bd" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); - res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2); + res = (ffi_arg)(uintptr_t)((void*(*)(void*, void*))(code))(arg1, arg2); printf("res: 0x%08x\n", (unsigned int) res); - // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } - // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } - // { dg-output "\nres: 0x8bf258bd" } + /* { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } */ + /* { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } */ + /* { dg-output "\nres: 0x8bf258bd" } */ exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_struct_va1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_struct_va1.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_struct_va1.c @@ -0,0 +1,114 @@ +/* Area: ffi_call, closure_call + Purpose: Test doubles passed in variable argument lists. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run } */ +/* { dg-output "" { xfail avr32*-*-* } } */ +#include "ffitest.h" + +struct small_tag +{ + unsigned char a; + unsigned char b; +}; + +struct large_tag +{ + unsigned a; + unsigned b; + unsigned c; + unsigned d; + unsigned e; +}; + +static void +test_fn (ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + int n = *(int*)args[0]; + struct small_tag s1 = * (struct small_tag *) args[1]; + struct large_tag l1 = * (struct large_tag *) args[2]; + struct small_tag s2 = * (struct small_tag *) args[3]; + + printf ("%d %d %d %d %d %d %d %d %d %d\n", n, s1.a, s1.b, + l1.a, l1.b, l1.c, l1.d, l1.e, + s2.a, s2.b); + * (int*) resp = 42; +} + +int +main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc (sizeof (ffi_closure), &code); + ffi_type* arg_types[5]; + + ffi_arg res = 0; + + ffi_type s_type; + ffi_type *s_type_elements[3]; + + ffi_type l_type; + ffi_type *l_type_elements[6]; + + struct small_tag s1; + struct small_tag s2; + struct large_tag l1; + + int si; + + s_type.size = 0; + s_type.alignment = 0; + s_type.type = FFI_TYPE_STRUCT; + s_type.elements = s_type_elements; + + s_type_elements[0] = &ffi_type_uchar; + s_type_elements[1] = &ffi_type_uchar; + s_type_elements[2] = NULL; + + l_type.size = 0; + l_type.alignment = 0; + l_type.type = FFI_TYPE_STRUCT; + l_type.elements = l_type_elements; + + l_type_elements[0] = &ffi_type_uint; + l_type_elements[1] = &ffi_type_uint; + l_type_elements[2] = &ffi_type_uint; + l_type_elements[3] = &ffi_type_uint; + l_type_elements[4] = &ffi_type_uint; + l_type_elements[5] = NULL; + + arg_types[0] = &ffi_type_sint; + arg_types[1] = &s_type; + arg_types[2] = &l_type; + arg_types[3] = &s_type; + arg_types[4] = NULL; + + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint, + arg_types) == FFI_OK); + + si = 4; + s1.a = 5; + s1.b = 6; + + s2.a = 20; + s2.b = 21; + + l1.a = 10; + l1.b = 11; + l1.c = 12; + l1.d = 13; + l1.e = 14; + + CHECK(ffi_prep_closure_loc(pcl, &cif, test_fn, NULL, code) == FFI_OK); + + res = ((int (*)(int, ...))(code))(si, s1, l1, s2); + /* { dg-output "4 5 6 10 11 12 13 14 20 21" } */ + printf("res: %d\n", (int) res); + /* { dg-output "\nres: 42" } */ + + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uchar_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uchar_va.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uchar_va.c @@ -0,0 +1,44 @@ +/* Area: closure_call + Purpose: Test anonymous unsigned char argument. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef unsigned char T; + +static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) + { + *(ffi_arg *)resp = *(T *)args[0]; + + printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]); + } + +typedef T (*cls_ret_T)(T, ...); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[3]; + T res; + + cl_arg_types[0] = &ffi_type_uchar; + cl_arg_types[1] = &ffi_type_uchar; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, + &ffi_type_uchar, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); + res = ((((cls_ret_T)code)(67, 4))); + /* { dg-output "67: 67 4" } */ + printf("res: %d\n", res); + /* { dg-output "\nres: 67" } */ + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uint_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uint_va.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uint_va.c @@ -0,0 +1,45 @@ +/* Area: closure_call + Purpose: Test anonymous unsigned int argument. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ + +#include "ffitest.h" + +typedef unsigned int T; + +static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) + { + *(T *)resp = *(T *)args[0]; + + printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]); + } + +typedef T (*cls_ret_T)(T, ...); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[3]; + T res; + + cl_arg_types[0] = &ffi_type_uint; + cl_arg_types[1] = &ffi_type_uint; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, + &ffi_type_uint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); + res = ((((cls_ret_T)code)(67, 4))); + /* { dg-output "67: 67 4" } */ + printf("res: %d\n", res); + /* { dg-output "\nres: 67" } */ + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulong_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulong_va.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulong_va.c @@ -0,0 +1,45 @@ +/* Area: closure_call + Purpose: Test anonymous unsigned long argument. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ + +#include "ffitest.h" + +typedef unsigned long T; + +static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) + { + *(T *)resp = *(T *)args[0]; + + printf("%ld: %ld %ld\n", *(T *)resp, *(T *)args[0], *(T *)args[1]); + } + +typedef T (*cls_ret_T)(T, ...); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[3]; + T res; + + cl_arg_types[0] = &ffi_type_ulong; + cl_arg_types[1] = &ffi_type_ulong; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, + &ffi_type_ulong, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); + res = ((((cls_ret_T)code)(67, 4))); + /* { dg-output "67: 67 4" } */ + printf("res: %ld\n", res); + /* { dg-output "\nres: 67" } */ + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c @@ -11,7 +11,7 @@ static void cls_ret_ulonglong_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { - *(unsigned long long *)resp= *(unsigned long long *)args[0]; + *(unsigned long long *)resp= 0xfffffffffffffffLL ^ *(unsigned long long *)args[0]; printf("%" PRIuLL ": %" PRIuLL "\n",*(unsigned long long *)args[0], *(unsigned long long *)(resp)); @@ -34,14 +34,14 @@ &ffi_type_uint64, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code) == FFI_OK); res = (*((cls_ret_ulonglong)code))(214LL); - /* { dg-output "214: 214" } */ + /* { dg-output "214: 1152921504606846761" } */ printf("res: %" PRIdLL "\n", res); - /* { dg-output "\nres: 214" } */ + /* { dg-output "\nres: 1152921504606846761" } */ res = (*((cls_ret_ulonglong)code))(9223372035854775808LL); - /* { dg-output "\n9223372035854775808: 9223372035854775808" } */ + /* { dg-output "\n9223372035854775808: 8070450533247928831" } */ printf("res: %" PRIdLL "\n", res); - /* { dg-output "\nres: 9223372035854775808" } */ + /* { dg-output "\nres: 8070450533247928831" } */ exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ushort_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ushort_va.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ushort_va.c @@ -0,0 +1,44 @@ +/* Area: closure_call + Purpose: Test anonymous unsigned short argument. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef unsigned short T; + +static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) + { + *(ffi_arg *)resp = *(T *)args[0]; + + printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]); + } + +typedef T (*cls_ret_T)(T, ...); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[3]; + T res; + + cl_arg_types[0] = &ffi_type_ushort; + cl_arg_types[1] = &ffi_type_ushort; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, + &ffi_type_ushort, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); + res = ((((cls_ret_T)code)(67, 4))); + /* { dg-output "67: 67 4" } */ + printf("res: %d\n", res); + /* { dg-output "\nres: 67" } */ + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_abi.c b/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_abi.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_abi.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_abi.c @@ -4,7 +4,8 @@ PR: none. Originator: Blake Chaffin 6/6/2007 */ -/* { dg-do run { xfail *-*-* } } */ +/* { dg-do run } */ + #include "ffitest.h" static void @@ -17,11 +18,9 @@ ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args[1]; ffi_type* arg_types[1]; arg_types[0] = NULL; - args[0] = NULL; CHECK(ffi_prep_cif(&cif, 255, 0, &ffi_type_void, arg_types) == FFI_BAD_ABI); diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_typedef.c b/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_typedef.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_typedef.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/err_bad_typedef.c @@ -4,7 +4,8 @@ PR: none. Originator: Blake Chaffin 6/6/2007 */ -/* { dg-do run { xfail *-*-* } } */ +/* { dg-do run } */ + #include "ffitest.h" int main (void) @@ -12,10 +13,10 @@ ffi_cif cif; ffi_type* arg_types[1]; + ffi_type badType = ffi_type_void; + arg_types[0] = NULL; - ffi_type badType = ffi_type_void; - badType.size = 0; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &badType, diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis1_win32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis1_win32.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis1_win32.c @@ -0,0 +1,50 @@ +/* Area: ffi_call + Purpose: Check fastcall fct call on X86_WIN32 systems. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ + +#include "ffitest.h" + +static size_t __FASTCALL__ my_fastcall_f(char *s, float a) +{ + return (size_t) ((int) strlen(s) + (int) a); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + char *s; + float v2; + args[0] = &ffi_type_pointer; + args[1] = &ffi_type_float; + values[0] = (void*) &s; + values[1] = (void*) &v2; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 2, + &ffi_type_sint, args) == FFI_OK); + + s = "a"; + v2 = 0.0; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 1); + + s = "1234567"; + v2 = -1.0; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 6); + + s = "1234567890123456789012345"; + v2 = 1.0; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 26); + + printf("fastcall fct1 tests passed\n"); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis2_win32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis2_win32.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis2_win32.c @@ -0,0 +1,50 @@ +/* Area: ffi_call + Purpose: Check fastcall fct call on X86_WIN32 systems. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ + +#include "ffitest.h" + +static size_t __FASTCALL__ my_fastcall_f(float a, char *s) +{ + return (size_t) ((int) strlen(s) + (int) a); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + char *s; + float v2; + args[1] = &ffi_type_pointer; + args[0] = &ffi_type_float; + values[1] = (void*) &s; + values[0] = (void*) &v2; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 2, + &ffi_type_sint, args) == FFI_OK); + + s = "a"; + v2 = 0.0; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 1); + + s = "1234567"; + v2 = -1.0; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 6); + + s = "1234567890123456789012345"; + v2 = 1.0; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 26); + + printf("fastcall fct2 tests passed\n"); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis3_win32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis3_win32.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/fastthis3_win32.c @@ -0,0 +1,56 @@ +/* Area: ffi_call + Purpose: Check fastcall f call on X86_WIN32 systems. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ + +#include "ffitest.h" + +static size_t __FASTCALL__ my_fastcall_f(float a, char *s, int i) +{ + return (size_t) ((int) strlen(s) + (int) a + i); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + char *s; + int v1; + float v2; + args[2] = &ffi_type_sint; + args[1] = &ffi_type_pointer; + args[0] = &ffi_type_float; + values[2] = (void*) &v1; + values[1] = (void*) &s; + values[0] = (void*) &v2; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 3, + &ffi_type_sint, args) == FFI_OK); + + s = "a"; + v1 = 1; + v2 = 0.0; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 2); + + s = "1234567"; + v2 = -1.0; + v1 = -2; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 4); + + s = "1234567890123456789012345"; + v2 = 1.0; + v1 = 2; + ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + CHECK(rint == 28); + + printf("fastcall fct3 tests passed\n"); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h b/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h --- a/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h @@ -15,7 +15,7 @@ #define MAX_ARGS 256 -#define CHECK(x) !(x) ? abort() : 0 +#define CHECK(x) !(x) ? (abort(), 1) : 0 /* Define __UNUSED__ that also other compilers than gcc can run the tests. */ #undef __UNUSED__ @@ -25,6 +25,14 @@ #define __UNUSED__ #endif +/* Define __FASTCALL__ so that other compilers than gcc can run the tests. */ +#undef __FASTCALL__ +#if defined _MSC_VER +#define __FASTCALL__ __fastcall +#else +#define __FASTCALL__ __attribute__((fastcall)) +#endif + /* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a file open. */ #ifdef HAVE_MMAP_ANON @@ -67,6 +75,8 @@ #define PRIdLL "ld" #undef PRIuLL #define PRIuLL "lu" +#define PRId8 "hd" +#define PRIu8 "hu" #define PRId64 "ld" #define PRIu64 "lu" #define PRIuPTR "lu" @@ -77,6 +87,28 @@ #define PRIuPTR "lu" #endif +/* IRIX kludge. */ +#if defined(__sgi) +/* IRIX 6.5 provides all definitions, but only for C99 + compilations. */ +#define PRId8 "hhd" +#define PRIu8 "hhu" +#if (_MIPS_SZLONG == 32) +#define PRId64 "lld" +#define PRIu64 "llu" +#endif +/* This doesn't match , which always has "lld" here, but the + arguments are uint64_t, int64_t, which are unsigned long, long for + 64-bit in . */ +#if (_MIPS_SZLONG == 64) +#define PRId64 "ld" +#define PRIu64 "lu" +#endif +/* This doesn't match , which has "u" here, but the arguments + are uintptr_t, which is always unsigned long. */ +#define PRIuPTR "lu" +#endif + /* Solaris < 10 kludge. */ #if defined(__sun__) && defined(__svr4__) && !defined(PRIuPTR) #if defined(__arch64__) || defined (__x86_64__) @@ -86,44 +118,15 @@ #endif #endif -#ifdef USING_MMAP -static inline void * -allocate_mmap (size_t size) -{ - void *page; -#if defined (HAVE_MMAP_DEV_ZERO) - static int dev_zero_fd = -1; +/* MSVC kludge. */ +#if defined _MSC_VER +#define PRIuPTR "lu" +#define PRIu8 "u" +#define PRId8 "d" +#define PRIu64 "I64u" +#define PRId64 "I64d" #endif -#ifdef HAVE_MMAP_DEV_ZERO - if (dev_zero_fd == -1) - { - dev_zero_fd = open ("/dev/zero", O_RDONLY); - if (dev_zero_fd == -1) - { - perror ("open /dev/zero: %m"); - exit (1); - } - } +#ifndef PRIuPTR +#define PRIuPTR "u" #endif - - -#ifdef HAVE_MMAP_ANON - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); -#endif -#ifdef HAVE_MMAP_DEV_ZERO - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE, dev_zero_fd, 0); -#endif - - if (page == (void *) MAP_FAILED) - { - perror ("virtual memory exhausted"); - exit (1); - } - - return page; -} - -#endif diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c @@ -0,0 +1,107 @@ +/* Area: fp and variadics + Purpose: check fp inputs and returns work on variadics, even the fixed params + Limitations: None + PR: none + Originator: 2011-01-25 + + Intended to stress the difference in ABI on ARM vfp +*/ + +/* { dg-do run } */ + +#include + +#include "ffitest.h" + +/* prints out all the parameters, and returns the sum of them all. + * 'x' is the number of variadic parameters all of which are double in this test + */ +double float_va_fn(unsigned int x, double y,...) +{ + double total=0.0; + va_list ap; + unsigned int i; + + total+=(double)x; + total+=y; + + printf("%u: %.1f :", x, y); + + va_start(ap, y); + for(i=0;i 20100916 */ + +/* { dg-do run } */ + +#include "ffitest.h" + +#define NARGS 7 + +typedef unsigned char u8; + +#ifdef __GNUC__ +__attribute__((noinline)) +#endif +uint8_t +foo (uint8_t a, uint8_t b, uint8_t c, uint8_t d, + uint8_t e, uint8_t f, uint8_t g) +{ + return a + b + c + d + e + f + g; +} + +uint8_t +bar (uint8_t a, uint8_t b, uint8_t c, uint8_t d, + uint8_t e, uint8_t f, uint8_t g) +{ + return foo (a, b, c, d, e, f, g); +} + +int +main (void) +{ + ffi_type *ffitypes[NARGS]; + int i; + ffi_cif cif; + ffi_arg result = 0; + uint8_t args[NARGS]; + void *argptrs[NARGS]; + + for (i = 0; i < NARGS; ++i) + ffitypes[i] = &ffi_type_uint8; + + CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, NARGS, + &ffi_type_uint8, ffitypes) == FFI_OK); + + for (i = 0; i < NARGS; ++i) + { + args[i] = i; + argptrs[i] = &args[i]; + } + ffi_call (&cif, FFI_FN (bar), &result, argptrs); + + CHECK (result == 21); + return 0; +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/many2_win32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/many2_win32.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/many2_win32.c @@ -0,0 +1,63 @@ +/* Area: ffi_call + Purpose: Check stdcall many call on X86_WIN32 systems. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ + +#include "ffitest.h" +#include + +static float __attribute__((fastcall)) fastcall_many(float f1, + float f2, + float f3, + float f4, + float f5, + float f6, + float f7, + float f8, + float f9, + float f10, + float f11, + float f12, + float f13) +{ + return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[13]; + void *values[13]; + float fa[13]; + float f, ff; + unsigned long ul; + + for (ul = 0; ul < 13; ul++) + { + args[ul] = &ffi_type_float; + values[ul] = &fa[ul]; + fa[ul] = (float) ul; + } + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 13, + &ffi_type_float, args) == FFI_OK); + + ff = fastcall_many(fa[0], fa[1], + fa[2], fa[3], + fa[4], fa[5], + fa[6], fa[7], + fa[8], fa[9], + fa[10], fa[11], fa[12]); + + ffi_call(&cif, FFI_FN(fastcall_many), &f, values); + + if (f - ff < FLT_EPSILON) + printf("fastcall many arg tests ok!\n"); + else + CHECK(0); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/negint.c b/Modules/_ctypes/libffi/testsuite/libffi.call/negint.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/negint.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/negint.c @@ -5,7 +5,6 @@ Originator: From the original ffitest.c */ /* { dg-do run } */ -/* { dg-options -O2 } */ #include "ffitest.h" diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct.c @@ -77,6 +77,12 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[5]; + struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; + struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; + struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, + {3, 1.0, 8.0}}; + struct cls_struct_combined res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -92,12 +98,6 @@ cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; - struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; - struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; - struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, - {3, 1.0, 8.0}}; - struct cls_struct_combined res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = &ffi_type_sint; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct1.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct1.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct1.c @@ -81,6 +81,13 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[5]; + struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; + struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; + struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, + {3, 1.0, 8.0}}; + struct cls_struct_16byte1 h_dbl = { 3.0, 2.0, 4}; + struct cls_struct_combined res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -96,13 +103,6 @@ cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; - struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; - struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; - struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, - {3, 1.0, 8.0}}; - struct cls_struct_16byte1 h_dbl = { 3.0, 2.0, 4}; - struct cls_struct_combined res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = &ffi_type_sint; @@ -156,6 +156,6 @@ CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); - // CHECK( 1 == 0); + /* CHECK( 1 == 0); */ exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct10.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct10.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct10.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct10.c @@ -67,6 +67,12 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; + struct A e_dbl = { 1LL, 7}; + struct B f_dbl = { 99, {12LL , 127}, 255}; + struct C g_dbl = { 2LL, 9}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -82,12 +88,6 @@ cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; - struct A e_dbl = { 1LL, 7}; - struct B f_dbl = { 99, {12LL , 127}, 255}; - struct C g_dbl = { 2LL, 9}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct11.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct11.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct11.c @@ -0,0 +1,121 @@ +/* Area: ffi_call, closure_call + Purpose: Check parameter passing with nested structs + of a single type. This tests the special cases + for homogenous floating-point aggregates in the + AArch64 PCS. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct A { + float a_x; + float a_y; +} A; + +typedef struct B { + float b_x; + float b_y; +} B; + +typedef struct C { + A a; + B b; +} C; + +static C C_fn (int x, int y, int z, C source, int i, int j, int k) +{ + C result; + result.a.a_x = source.a.a_x; + result.a.a_y = source.a.a_y; + result.b.b_x = source.b.b_x; + result.b.b_y = source.b.b_y; + + printf ("%d, %d, %d, %d, %d, %d\n", x, y, z, i, j, k); + + printf ("%.1f, %.1f, %.1f, %.1f, " + "%.1f, %.1f, %.1f, %.1f\n", + source.a.a_x, source.a.a_y, + source.b.b_x, source.b.b_y, + result.a.a_x, result.a.a_y, + result.b.b_x, result.b.b_y); + + return result; +} + +int main (void) +{ + ffi_cif cif; + + ffi_type* struct_fields_source_a[3]; + ffi_type* struct_fields_source_b[3]; + ffi_type* struct_fields_source_c[3]; + ffi_type* arg_types[8]; + + ffi_type struct_type_a, struct_type_b, struct_type_c; + + struct A source_fld_a = {1.0, 2.0}; + struct B source_fld_b = {4.0, 8.0}; + int k = 1; + + struct C result; + struct C source = {source_fld_a, source_fld_b}; + + struct_type_a.size = 0; + struct_type_a.alignment = 0; + struct_type_a.type = FFI_TYPE_STRUCT; + struct_type_a.elements = struct_fields_source_a; + + struct_type_b.size = 0; + struct_type_b.alignment = 0; + struct_type_b.type = FFI_TYPE_STRUCT; + struct_type_b.elements = struct_fields_source_b; + + struct_type_c.size = 0; + struct_type_c.alignment = 0; + struct_type_c.type = FFI_TYPE_STRUCT; + struct_type_c.elements = struct_fields_source_c; + + struct_fields_source_a[0] = &ffi_type_float; + struct_fields_source_a[1] = &ffi_type_float; + struct_fields_source_a[2] = NULL; + + struct_fields_source_b[0] = &ffi_type_float; + struct_fields_source_b[1] = &ffi_type_float; + struct_fields_source_b[2] = NULL; + + struct_fields_source_c[0] = &struct_type_a; + struct_fields_source_c[1] = &struct_type_b; + struct_fields_source_c[2] = NULL; + + arg_types[0] = &ffi_type_sint32; + arg_types[1] = &ffi_type_sint32; + arg_types[2] = &ffi_type_sint32; + arg_types[3] = &struct_type_c; + arg_types[4] = &ffi_type_sint32; + arg_types[5] = &ffi_type_sint32; + arg_types[6] = &ffi_type_sint32; + arg_types[7] = NULL; + + void *args[7]; + args[0] = &k; + args[1] = &k; + args[2] = &k; + args[3] = &source; + args[4] = &k; + args[5] = &k; + args[6] = &k; + CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 7, &struct_type_c, + arg_types) == FFI_OK); + + ffi_call (&cif, FFI_FN (C_fn), &result, args); + /* { dg-output "1, 1, 1, 1, 1, 1\n" } */ + /* { dg-output "1.0, 2.0, 4.0, 8.0, 1.0, 2.0, 4.0, 8.0" } */ + CHECK (result.a.a_x == source.a.a_x); + CHECK (result.a.a_y == source.a.a_y); + CHECK (result.b.b_x == source.b.b_x); + CHECK (result.b.b_y == source.b.b_y); + exit (0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct2.c @@ -57,6 +57,11 @@ ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; + struct A e_dbl = { 1, 7}; + struct B f_dbl = {{12 , 127}, 99}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -67,11 +72,6 @@ cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; - struct A e_dbl = { 1, 7}; - struct B f_dbl = {{12 , 127}, 99}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_ulong; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct3.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct3.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct3.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct3.c @@ -58,6 +58,11 @@ ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; + struct A e_dbl = { 1LL, 7}; + struct B f_dbl = {{12LL , 127}, 99}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -68,11 +73,6 @@ cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; - struct A e_dbl = { 1LL, 7}; - struct B f_dbl = {{12LL , 127}, 99}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct4.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct4.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct4.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct4.c @@ -58,6 +58,11 @@ ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; + struct A e_dbl = { 1.0, 7}; + struct B f_dbl = {{12.0 , 127}, 99}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -68,11 +73,6 @@ cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; - struct A e_dbl = { 1.0, 7}; - struct B f_dbl = {{12.0 , 127}, 99}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct5.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct5.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct5.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct5.c @@ -58,6 +58,11 @@ ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; + struct A e_dbl = { 1.0, 7}; + struct B f_dbl = {{12.0 , 127}, 99}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -68,11 +73,6 @@ cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; - struct A e_dbl = { 1.0, 7}; - struct B f_dbl = {{12.0 , 127}, 99}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_longdouble; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct6.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct6.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct6.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct6.c @@ -66,6 +66,12 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; + struct A e_dbl = { 1.0, 7}; + struct B f_dbl = {{12.0 , 127}, 99}; + struct C g_dbl = { 2, 9}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -81,12 +87,6 @@ cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; - struct A e_dbl = { 1.0, 7}; - struct B f_dbl = {{12.0 , 127}, 99}; - struct C g_dbl = { 2, 9}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct7.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct7.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct7.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct7.c @@ -58,6 +58,11 @@ ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; + struct A e_dbl = { 1LL, 7}; + struct B f_dbl = {{12.0 , 127}, 99}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -68,11 +73,6 @@ cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; - struct A e_dbl = { 1LL, 7}; - struct B f_dbl = {{12.0 , 127}, 99}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct8.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct8.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct8.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct8.c @@ -66,6 +66,12 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; + struct A e_dbl = { 1LL, 7}; + struct B f_dbl = {{12LL , 127}, 99}; + struct C g_dbl = { 2LL, 9}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -81,12 +87,6 @@ cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; - struct A e_dbl = { 1LL, 7}; - struct B f_dbl = {{12LL , 127}, 99}; - struct C g_dbl = { 2LL, 9}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct9.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct9.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct9.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct9.c @@ -66,6 +66,12 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; + struct A e_dbl = { 1, 7LL}; + struct B f_dbl = {{12.0 , 127}, 99}; + struct C g_dbl = { 2, 9}; + + struct B res_dbl; + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -81,12 +87,6 @@ cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; - struct A e_dbl = { 1, 7LL}; - struct B f_dbl = {{12.0 , 127}, 99}; - struct C g_dbl = { 2, 9}; - - struct B res_dbl; - cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uint64; cls_struct_fields[2] = NULL; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/return_dbl.c b/Modules/_ctypes/libffi/testsuite/libffi.call/return_dbl.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/return_dbl.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/return_dbl.c @@ -9,6 +9,7 @@ static double return_dbl(double dbl) { + printf ("%f\n", dbl); return 2 * dbl; } int main (void) diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/return_sc.c b/Modules/_ctypes/libffi/testsuite/libffi.call/return_sc.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/return_sc.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/return_sc.c @@ -30,7 +30,7 @@ sc < (signed char) 127; sc++) { ffi_call(&cif, FFI_FN(return_sc), &rint, values); - CHECK(rint == (ffi_arg) sc); + CHECK((signed char)rint == sc); } exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/return_uc.c b/Modules/_ctypes/libffi/testsuite/libffi.call/return_uc.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/return_uc.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/return_uc.c @@ -32,7 +32,7 @@ uc < (unsigned char) '\xff'; uc++) { ffi_call(&cif, FFI_FN(return_uc), &rint, values); - CHECK(rint == (signed int) uc); + CHECK((unsigned char)rint == uc); } exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large.c b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large.c @@ -9,8 +9,8 @@ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" -// 13 FPRs: 104 bytes -// 14 FPRs: 112 bytes +/* 13 FPRs: 104 bytes */ +/* 14 FPRs: 112 bytes */ typedef struct struct_108byte { double a; @@ -82,17 +82,17 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - struct_108byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 7 }; struct_108byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 4 }; struct_108byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 3 }; struct_108byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 2 }; struct_108byte res_dbl; + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large2.c @@ -9,8 +9,8 @@ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" -// 13 FPRs: 104 bytes -// 14 FPRs: 112 bytes +/* 13 FPRs: 104 bytes */ +/* 14 FPRs: 112 bytes */ typedef struct struct_116byte { double a; @@ -84,17 +84,17 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - struct_116byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 7 }; struct_116byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 6.0, 4 }; struct_116byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 7.0, 3 }; struct_116byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 8.0, 2 }; struct_116byte res_dbl; + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium.c b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium.c @@ -68,17 +68,17 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7.0 }; struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0 }; struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3.0 }; struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2.0 }; struct_72byte res_dbl; + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_medium2.c @@ -69,17 +69,17 @@ ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7 }; struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4 }; struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3 }; struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2 }; struct_72byte res_dbl; + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/strlen2_win32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/strlen2_win32.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/strlen2_win32.c @@ -0,0 +1,44 @@ +/* Area: ffi_call + Purpose: Check fastcall strlen call on X86_WIN32 systems. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ + +#include "ffitest.h" + +static size_t __FASTCALL__ my_fastcall_strlen(char *s) +{ + return (strlen(s)); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + char *s; + args[0] = &ffi_type_pointer; + values[0] = (void*) &s; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1, + &ffi_type_sint, args) == FFI_OK); + + s = "a"; + ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values); + CHECK(rint == 1); + + s = "1234567"; + ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values); + CHECK(rint == 7); + + s = "1234567890123456789012345"; + ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values); + CHECK(rint == 25); + + printf("fastcall strlen tests passed\n"); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct1.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct1.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct1.c @@ -30,6 +30,13 @@ void *values[MAX_ARGS]; ffi_type ts1_type; ffi_type *ts1_type_elements[4]; + + test_structure_1 ts1_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_1 *ts1_result = + (test_structure_1 *) malloc (sizeof(test_structure_1)); + ts1_type.size = 0; ts1_type.alignment = 0; ts1_type.type = FFI_TYPE_STRUCT; @@ -39,11 +46,6 @@ ts1_type_elements[2] = &ffi_type_uint; ts1_type_elements[3] = NULL; - test_structure_1 ts1_arg; - /* This is a hack to get a properly aligned result buffer */ - test_structure_1 *ts1_result = - (test_structure_1 *) malloc (sizeof(test_structure_1)); - args[0] = &ts1_type; values[0] = &ts1_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct1_win32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct1_win32.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct1_win32.c @@ -0,0 +1,67 @@ +/* Area: ffi_call + Purpose: Check structures with fastcall/thiscall convention. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ +#include "ffitest.h" + +typedef struct +{ + unsigned char uc; + double d; + unsigned int ui; +} test_structure_1; + +static test_structure_1 __FASTCALL__ struct1(test_structure_1 ts) +{ + ts.uc++; + ts.d--; + ts.ui++; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts1_type; + ffi_type *ts1_type_elements[4]; + + test_structure_1 ts1_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_1 *ts1_result = + (test_structure_1 *) malloc (sizeof(test_structure_1)); + + ts1_type.size = 0; + ts1_type.alignment = 0; + ts1_type.type = FFI_TYPE_STRUCT; + ts1_type.elements = ts1_type_elements; + ts1_type_elements[0] = &ffi_type_uchar; + ts1_type_elements[1] = &ffi_type_double; + ts1_type_elements[2] = &ffi_type_uint; + ts1_type_elements[3] = NULL; + + args[0] = &ts1_type; + values[0] = &ts1_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1, + &ts1_type, args) == FFI_OK); + + ts1_arg.uc = '\x01'; + ts1_arg.d = 3.14159; + ts1_arg.ui = 555; + + ffi_call(&cif, FFI_FN(struct1), ts1_result, values); + + CHECK(ts1_result->ui == 556); + CHECK(ts1_result->d == 3.14159 - 1); + + free (ts1_result); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct2.c @@ -29,6 +29,11 @@ test_structure_2 ts2_arg; ffi_type ts2_type; ffi_type *ts2_type_elements[3]; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_2 *ts2_result = + (test_structure_2 *) malloc (sizeof(test_structure_2)); + ts2_type.size = 0; ts2_type.alignment = 0; ts2_type.type = FFI_TYPE_STRUCT; @@ -37,11 +42,6 @@ ts2_type_elements[1] = &ffi_type_double; ts2_type_elements[2] = NULL; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_2 *ts2_result = - (test_structure_2 *) malloc (sizeof(test_structure_2)); - args[0] = &ts2_type; values[0] = &ts2_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct2_win32.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct2_win32.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct2_win32.c @@ -0,0 +1,67 @@ +/* Area: ffi_call + Purpose: Check structures in fastcall/stdcall function + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ +#include "ffitest.h" + +typedef struct +{ + double d1; + double d2; +} test_structure_2; + +static test_structure_2 __FASTCALL__ struct2(test_structure_2 ts) +{ + ts.d1--; + ts.d2--; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + test_structure_2 ts2_arg; + ffi_type ts2_type; + ffi_type *ts2_type_elements[3]; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_2 *ts2_result = + (test_structure_2 *) malloc (sizeof(test_structure_2)); + + ts2_type.size = 0; + ts2_type.alignment = 0; + ts2_type.type = FFI_TYPE_STRUCT; + ts2_type.elements = ts2_type_elements; + ts2_type_elements[0] = &ffi_type_double; + ts2_type_elements[1] = &ffi_type_double; + ts2_type_elements[2] = NULL; + + args[0] = &ts2_type; + values[0] = &ts2_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1, &ts2_type, args) == FFI_OK); + + ts2_arg.d1 = 5.55; + ts2_arg.d2 = 6.66; + + printf ("%g\n", ts2_arg.d1); + printf ("%g\n", ts2_arg.d2); + + ffi_call(&cif, FFI_FN(struct2), ts2_result, values); + + printf ("%g\n", ts2_result->d1); + printf ("%g\n", ts2_result->d2); + + CHECK(ts2_result->d1 == 5.55 - 1); + CHECK(ts2_result->d2 == 6.66 - 1); + + free (ts2_result); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct3.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct3.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct3.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct3.c @@ -27,6 +27,11 @@ int compare_value; ffi_type ts3_type; ffi_type *ts3_type_elements[2]; + + test_structure_3 ts3_arg; + test_structure_3 *ts3_result = + (test_structure_3 *) malloc (sizeof(test_structure_3)); + ts3_type.size = 0; ts3_type.alignment = 0; ts3_type.type = FFI_TYPE_STRUCT; @@ -34,10 +39,6 @@ ts3_type_elements[0] = &ffi_type_sint; ts3_type_elements[1] = NULL; - test_structure_3 ts3_arg; - test_structure_3 *ts3_result = - (test_structure_3 *) malloc (sizeof(test_structure_3)); - args[0] = &ts3_type; values[0] = &ts3_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct4.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct4.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct4.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct4.c @@ -28,21 +28,22 @@ void *values[MAX_ARGS]; ffi_type ts4_type; ffi_type *ts4_type_elements[4]; + + test_structure_4 ts4_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_4 *ts4_result = + (test_structure_4 *) malloc (sizeof(test_structure_4)); + ts4_type.size = 0; ts4_type.alignment = 0; ts4_type.type = FFI_TYPE_STRUCT; - test_structure_4 ts4_arg; ts4_type.elements = ts4_type_elements; ts4_type_elements[0] = &ffi_type_uint; ts4_type_elements[1] = &ffi_type_uint; ts4_type_elements[2] = &ffi_type_uint; ts4_type_elements[3] = NULL; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_4 *ts4_result = - (test_structure_4 *) malloc (sizeof(test_structure_4)); - args[0] = &ts4_type; values[0] = &ts4_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct5.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct5.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct5.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct5.c @@ -27,6 +27,13 @@ void *values[MAX_ARGS]; ffi_type ts5_type; ffi_type *ts5_type_elements[3]; + + test_structure_5 ts5_arg1, ts5_arg2; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_5 *ts5_result = + (test_structure_5 *) malloc (sizeof(test_structure_5)); + ts5_type.size = 0; ts5_type.alignment = 0; ts5_type.type = FFI_TYPE_STRUCT; @@ -35,12 +42,6 @@ ts5_type_elements[1] = &ffi_type_schar; ts5_type_elements[2] = NULL; - test_structure_5 ts5_arg1, ts5_arg2; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_5 *ts5_result = - (test_structure_5 *) malloc (sizeof(test_structure_5)); - args[0] = &ts5_type; args[1] = &ts5_type; values[0] = &ts5_arg1; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct6.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct6.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct6.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct6.c @@ -27,6 +27,13 @@ void *values[MAX_ARGS]; ffi_type ts6_type; ffi_type *ts6_type_elements[3]; + + test_structure_6 ts6_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_6 *ts6_result = + (test_structure_6 *) malloc (sizeof(test_structure_6)); + ts6_type.size = 0; ts6_type.alignment = 0; ts6_type.type = FFI_TYPE_STRUCT; @@ -35,13 +42,6 @@ ts6_type_elements[1] = &ffi_type_double; ts6_type_elements[2] = NULL; - - test_structure_6 ts6_arg; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_6 *ts6_result = - (test_structure_6 *) malloc (sizeof(test_structure_6)); - args[0] = &ts6_type; values[0] = &ts6_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct7.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct7.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct7.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct7.c @@ -29,6 +29,13 @@ void *values[MAX_ARGS]; ffi_type ts7_type; ffi_type *ts7_type_elements[4]; + + test_structure_7 ts7_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_7 *ts7_result = + (test_structure_7 *) malloc (sizeof(test_structure_7)); + ts7_type.size = 0; ts7_type.alignment = 0; ts7_type.type = FFI_TYPE_STRUCT; @@ -38,13 +45,6 @@ ts7_type_elements[2] = &ffi_type_double; ts7_type_elements[3] = NULL; - - test_structure_7 ts7_arg; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_7 *ts7_result = - (test_structure_7 *) malloc (sizeof(test_structure_7)); - args[0] = &ts7_type; values[0] = &ts7_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct8.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct8.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct8.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct8.c @@ -31,6 +31,13 @@ void *values[MAX_ARGS]; ffi_type ts8_type; ffi_type *ts8_type_elements[5]; + + test_structure_8 ts8_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_8 *ts8_result = + (test_structure_8 *) malloc (sizeof(test_structure_8)); + ts8_type.size = 0; ts8_type.alignment = 0; ts8_type.type = FFI_TYPE_STRUCT; @@ -41,12 +48,6 @@ ts8_type_elements[3] = &ffi_type_float; ts8_type_elements[4] = NULL; - test_structure_8 ts8_arg; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_8 *ts8_result = - (test_structure_8 *) malloc (sizeof(test_structure_8)); - args[0] = &ts8_type; values[0] = &ts8_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/struct9.c b/Modules/_ctypes/libffi/testsuite/libffi.call/struct9.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/struct9.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/struct9.c @@ -28,6 +28,13 @@ void *values[MAX_ARGS]; ffi_type ts9_type; ffi_type *ts9_type_elements[3]; + + test_structure_9 ts9_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_9 *ts9_result = + (test_structure_9 *) malloc (sizeof(test_structure_9)); + ts9_type.size = 0; ts9_type.alignment = 0; ts9_type.type = FFI_TYPE_STRUCT; @@ -36,12 +43,6 @@ ts9_type_elements[1] = &ffi_type_sint; ts9_type_elements[2] = NULL; - test_structure_9 ts9_arg; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_9 *ts9_result = - (test_structure_9 *) malloc (sizeof(test_structure_9)); - args[0] = &ts9_type; values[0] = &ts9_arg; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/testclosure.c b/Modules/_ctypes/libffi/testsuite/libffi.call/testclosure.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/testclosure.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/testclosure.c @@ -43,13 +43,13 @@ ffi_type cls_struct_type0; ffi_type* dbl_arg_types[5]; + struct cls_struct_combined g_dbl = {4.0, 5.0, 1.0, 8.0}; + cls_struct_type0.size = 0; cls_struct_type0.alignment = 0; cls_struct_type0.type = FFI_TYPE_STRUCT; cls_struct_type0.elements = cls_struct_fields0; - struct cls_struct_combined g_dbl = {4.0, 5.0, 1.0, 8.0}; - cls_struct_fields0[0] = &ffi_type_float; cls_struct_fields0[1] = &ffi_type_float; cls_struct_fields0[2] = &ffi_type_float; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/uninitialized.c b/Modules/_ctypes/libffi/testsuite/libffi.call/uninitialized.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/uninitialized.c @@ -0,0 +1,61 @@ +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct +{ + unsigned char uc; + double d; + unsigned int ui; +} test_structure_1; + +static test_structure_1 struct1(test_structure_1 ts) +{ + ts.uc++; + ts.d--; + ts.ui++; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts1_type; + ffi_type *ts1_type_elements[4]; + + memset(&cif, 1, sizeof(cif)); + ts1_type.size = 0; + ts1_type.alignment = 0; + ts1_type.type = FFI_TYPE_STRUCT; + ts1_type.elements = ts1_type_elements; + ts1_type_elements[0] = &ffi_type_uchar; + ts1_type_elements[1] = &ffi_type_double; + ts1_type_elements[2] = &ffi_type_uint; + ts1_type_elements[3] = NULL; + + test_structure_1 ts1_arg; + /* This is a hack to get a properly aligned result buffer */ + test_structure_1 *ts1_result = + (test_structure_1 *) malloc (sizeof(test_structure_1)); + + args[0] = &ts1_type; + values[0] = &ts1_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ts1_type, args) == FFI_OK); + + ts1_arg.uc = '\x01'; + ts1_arg.d = 3.14159; + ts1_arg.ui = 555; + + ffi_call(&cif, FFI_FN(struct1), ts1_result, values); + + CHECK(ts1_result->ui == 556); + CHECK(ts1_result->d == 3.14159 - 1); + + free (ts1_result); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/va_1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/va_1.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/va_1.c @@ -0,0 +1,196 @@ +/* Area: ffi_call + Purpose: Test passing struct in variable argument lists. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +/* { dg-output "" { xfail avr32*-*-* } } */ + +#include "ffitest.h" +#include + +struct small_tag +{ + unsigned char a; + unsigned char b; +}; + +struct large_tag +{ + unsigned a; + unsigned b; + unsigned c; + unsigned d; + unsigned e; +}; + +static int +test_fn (int n, ...) +{ + va_list ap; + struct small_tag s1; + struct small_tag s2; + struct large_tag l; + unsigned char uc; + signed char sc; + unsigned short us; + signed short ss; + unsigned int ui; + signed int si; + unsigned long ul; + signed long sl; + float f; + double d; + + va_start (ap, n); + s1 = va_arg (ap, struct small_tag); + l = va_arg (ap, struct large_tag); + s2 = va_arg (ap, struct small_tag); + + uc = va_arg (ap, unsigned); + sc = va_arg (ap, signed); + + us = va_arg (ap, unsigned); + ss = va_arg (ap, signed); + + ui = va_arg (ap, unsigned int); + si = va_arg (ap, signed int); + + ul = va_arg (ap, unsigned long); + sl = va_arg (ap, signed long); + + f = va_arg (ap, double); /* C standard promotes float->double + when anonymous */ + d = va_arg (ap, double); + + printf ("%u %u %u %u %u %u %u %u %u uc=%u sc=%d %u %d %u %d %lu %ld %f %f\n", + s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, + s2.a, s2.b, + uc, sc, + us, ss, + ui, si, + ul, sl, + f, d); + va_end (ap); + return n + 1; +} + +int +main (void) +{ + ffi_cif cif; + void* args[15]; + ffi_type* arg_types[15]; + + ffi_type s_type; + ffi_type *s_type_elements[3]; + + ffi_type l_type; + ffi_type *l_type_elements[6]; + + struct small_tag s1; + struct small_tag s2; + struct large_tag l1; + + int n; + int res; + + unsigned char uc; + signed char sc; + unsigned short us; + signed short ss; + unsigned int ui; + signed int si; + unsigned long ul; + signed long sl; + double d1; + double f1; + + s_type.size = 0; + s_type.alignment = 0; + s_type.type = FFI_TYPE_STRUCT; + s_type.elements = s_type_elements; + + s_type_elements[0] = &ffi_type_uchar; + s_type_elements[1] = &ffi_type_uchar; + s_type_elements[2] = NULL; + + l_type.size = 0; + l_type.alignment = 0; + l_type.type = FFI_TYPE_STRUCT; + l_type.elements = l_type_elements; + + l_type_elements[0] = &ffi_type_uint; + l_type_elements[1] = &ffi_type_uint; + l_type_elements[2] = &ffi_type_uint; + l_type_elements[3] = &ffi_type_uint; + l_type_elements[4] = &ffi_type_uint; + l_type_elements[5] = NULL; + + arg_types[0] = &ffi_type_sint; + arg_types[1] = &s_type; + arg_types[2] = &l_type; + arg_types[3] = &s_type; + arg_types[4] = &ffi_type_uchar; + arg_types[5] = &ffi_type_schar; + arg_types[6] = &ffi_type_ushort; + arg_types[7] = &ffi_type_sshort; + arg_types[8] = &ffi_type_uint; + arg_types[9] = &ffi_type_sint; + arg_types[10] = &ffi_type_ulong; + arg_types[11] = &ffi_type_slong; + arg_types[12] = &ffi_type_double; + arg_types[13] = &ffi_type_double; + arg_types[14] = NULL; + + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 14, &ffi_type_sint, arg_types) == FFI_OK); + + s1.a = 5; + s1.b = 6; + + l1.a = 10; + l1.b = 11; + l1.c = 12; + l1.d = 13; + l1.e = 14; + + s2.a = 7; + s2.b = 8; + + n = 41; + + uc = 9; + sc = 10; + us = 11; + ss = 12; + ui = 13; + si = 14; + ul = 15; + sl = 16; + f1 = 2.12; + d1 = 3.13; + + args[0] = &n; + args[1] = &s1; + args[2] = &l1; + args[3] = &s2; + args[4] = &uc; + args[5] = ≻ + args[6] = &us; + args[7] = &ss; + args[8] = &ui; + args[9] = &si; + args[10] = &ul; + args[11] = &sl; + args[12] = &f1; + args[13] = &d1; + args[14] = NULL; + + ffi_call(&cif, FFI_FN(test_fn), &res, args); + /* { dg-output "5 6 10 11 12 13 14 7 8 uc=9 sc=10 11 12 13 14 15 16 2.120000 3.130000" } */ + printf("res: %d\n", (int) res); + /* { dg-output "\nres: 42" } */ + + return 0; +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct1.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct1.c @@ -0,0 +1,121 @@ +/* Area: ffi_call + Purpose: Test passing struct in variable argument lists. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +/* { dg-output "" { xfail avr32*-*-* } } */ + +#include "ffitest.h" +#include + +struct small_tag +{ + unsigned char a; + unsigned char b; +}; + +struct large_tag +{ + unsigned a; + unsigned b; + unsigned c; + unsigned d; + unsigned e; +}; + +static int +test_fn (int n, ...) +{ + va_list ap; + struct small_tag s1; + struct small_tag s2; + struct large_tag l; + + va_start (ap, n); + s1 = va_arg (ap, struct small_tag); + l = va_arg (ap, struct large_tag); + s2 = va_arg (ap, struct small_tag); + printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, + s2.a, s2.b); + va_end (ap); + return n + 1; +} + +int +main (void) +{ + ffi_cif cif; + void* args[5]; + ffi_type* arg_types[5]; + + ffi_type s_type; + ffi_type *s_type_elements[3]; + + ffi_type l_type; + ffi_type *l_type_elements[6]; + + struct small_tag s1; + struct small_tag s2; + struct large_tag l1; + + int n; + int res; + + s_type.size = 0; + s_type.alignment = 0; + s_type.type = FFI_TYPE_STRUCT; + s_type.elements = s_type_elements; + + s_type_elements[0] = &ffi_type_uchar; + s_type_elements[1] = &ffi_type_uchar; + s_type_elements[2] = NULL; + + l_type.size = 0; + l_type.alignment = 0; + l_type.type = FFI_TYPE_STRUCT; + l_type.elements = l_type_elements; + + l_type_elements[0] = &ffi_type_uint; + l_type_elements[1] = &ffi_type_uint; + l_type_elements[2] = &ffi_type_uint; + l_type_elements[3] = &ffi_type_uint; + l_type_elements[4] = &ffi_type_uint; + l_type_elements[5] = NULL; + + arg_types[0] = &ffi_type_sint; + arg_types[1] = &s_type; + arg_types[2] = &l_type; + arg_types[3] = &s_type; + arg_types[4] = NULL; + + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint, arg_types) == FFI_OK); + + s1.a = 5; + s1.b = 6; + + l1.a = 10; + l1.b = 11; + l1.c = 12; + l1.d = 13; + l1.e = 14; + + s2.a = 7; + s2.b = 8; + + n = 41; + + args[0] = &n; + args[1] = &s1; + args[2] = &l1; + args[3] = &s2; + args[4] = NULL; + + ffi_call(&cif, FFI_FN(test_fn), &res, args); + /* { dg-output "5 6 10 11 12 13 14 7 8" } */ + printf("res: %d\n", (int) res); + /* { dg-output "\nres: 42" } */ + + return 0; +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct2.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct2.c @@ -0,0 +1,123 @@ +/* Area: ffi_call + Purpose: Test passing struct in variable argument lists. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +/* { dg-output "" { xfail avr32*-*-* } } */ + +#include "ffitest.h" +#include + +struct small_tag +{ + unsigned char a; + unsigned char b; +}; + +struct large_tag +{ + unsigned a; + unsigned b; + unsigned c; + unsigned d; + unsigned e; +}; + +static struct small_tag +test_fn (int n, ...) +{ + va_list ap; + struct small_tag s1; + struct small_tag s2; + struct large_tag l; + + va_start (ap, n); + s1 = va_arg (ap, struct small_tag); + l = va_arg (ap, struct large_tag); + s2 = va_arg (ap, struct small_tag); + printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, + s2.a, s2.b); + va_end (ap); + s1.a += s2.a; + s1.b += s2.b; + return s1; +} + +int +main (void) +{ + ffi_cif cif; + void* args[5]; + ffi_type* arg_types[5]; + + ffi_type s_type; + ffi_type *s_type_elements[3]; + + ffi_type l_type; + ffi_type *l_type_elements[6]; + + struct small_tag s1; + struct small_tag s2; + struct large_tag l1; + + int n; + struct small_tag res; + + s_type.size = 0; + s_type.alignment = 0; + s_type.type = FFI_TYPE_STRUCT; + s_type.elements = s_type_elements; + + s_type_elements[0] = &ffi_type_uchar; + s_type_elements[1] = &ffi_type_uchar; + s_type_elements[2] = NULL; + + l_type.size = 0; + l_type.alignment = 0; + l_type.type = FFI_TYPE_STRUCT; + l_type.elements = l_type_elements; + + l_type_elements[0] = &ffi_type_uint; + l_type_elements[1] = &ffi_type_uint; + l_type_elements[2] = &ffi_type_uint; + l_type_elements[3] = &ffi_type_uint; + l_type_elements[4] = &ffi_type_uint; + l_type_elements[5] = NULL; + + arg_types[0] = &ffi_type_sint; + arg_types[1] = &s_type; + arg_types[2] = &l_type; + arg_types[3] = &s_type; + arg_types[4] = NULL; + + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &s_type, arg_types) == FFI_OK); + + s1.a = 5; + s1.b = 6; + + l1.a = 10; + l1.b = 11; + l1.c = 12; + l1.d = 13; + l1.e = 14; + + s2.a = 7; + s2.b = 8; + + n = 41; + + args[0] = &n; + args[1] = &s1; + args[2] = &l1; + args[3] = &s2; + args[4] = NULL; + + ffi_call(&cif, FFI_FN(test_fn), &res, args); + /* { dg-output "5 6 10 11 12 13 14 7 8" } */ + printf("res: %d %d\n", res.a, res.b); + /* { dg-output "\nres: 12 14" } */ + + return 0; +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct3.c b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct3.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct3.c @@ -0,0 +1,125 @@ +/* Area: ffi_call + Purpose: Test passing struct in variable argument lists. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +/* { dg-output "" { xfail avr32*-*-* } } */ + +#include "ffitest.h" +#include + +struct small_tag +{ + unsigned char a; + unsigned char b; +}; + +struct large_tag +{ + unsigned a; + unsigned b; + unsigned c; + unsigned d; + unsigned e; +}; + +static struct large_tag +test_fn (int n, ...) +{ + va_list ap; + struct small_tag s1; + struct small_tag s2; + struct large_tag l; + + va_start (ap, n); + s1 = va_arg (ap, struct small_tag); + l = va_arg (ap, struct large_tag); + s2 = va_arg (ap, struct small_tag); + printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, + s2.a, s2.b); + va_end (ap); + l.a += s1.a; + l.b += s1.b; + l.c += s2.a; + l.d += s2.b; + return l; +} + +int +main (void) +{ + ffi_cif cif; + void* args[5]; + ffi_type* arg_types[5]; + + ffi_type s_type; + ffi_type *s_type_elements[3]; + + ffi_type l_type; + ffi_type *l_type_elements[6]; + + struct small_tag s1; + struct small_tag s2; + struct large_tag l1; + + int n; + struct large_tag res; + + s_type.size = 0; + s_type.alignment = 0; + s_type.type = FFI_TYPE_STRUCT; + s_type.elements = s_type_elements; + + s_type_elements[0] = &ffi_type_uchar; + s_type_elements[1] = &ffi_type_uchar; + s_type_elements[2] = NULL; + + l_type.size = 0; + l_type.alignment = 0; + l_type.type = FFI_TYPE_STRUCT; + l_type.elements = l_type_elements; + + l_type_elements[0] = &ffi_type_uint; + l_type_elements[1] = &ffi_type_uint; + l_type_elements[2] = &ffi_type_uint; + l_type_elements[3] = &ffi_type_uint; + l_type_elements[4] = &ffi_type_uint; + l_type_elements[5] = NULL; + + arg_types[0] = &ffi_type_sint; + arg_types[1] = &s_type; + arg_types[2] = &l_type; + arg_types[3] = &s_type; + arg_types[4] = NULL; + + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &l_type, arg_types) == FFI_OK); + + s1.a = 5; + s1.b = 6; + + l1.a = 10; + l1.b = 11; + l1.c = 12; + l1.d = 13; + l1.e = 14; + + s2.a = 7; + s2.b = 8; + + n = 41; + + args[0] = &n; + args[1] = &s1; + args[2] = &l1; + args[3] = &s2; + args[4] = NULL; + + ffi_call(&cif, FFI_FN(test_fn), &res, args); + /* { dg-output "5 6 10 11 12 13 14 7 8" } */ + printf("res: %d %d %d %d %d\n", res.a, res.b, res.c, res.d, res.e); + /* { dg-output "\nres: 15 17 19 21 14" } */ + + return 0; +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.special/ffitestcxx.h b/Modules/_ctypes/libffi/testsuite/libffi.special/ffitestcxx.h --- a/Modules/_ctypes/libffi/testsuite/libffi.special/ffitestcxx.h +++ b/Modules/_ctypes/libffi/testsuite/libffi.special/ffitestcxx.h @@ -53,44 +53,3 @@ #define PRIuLL "llu" #endif -#ifdef USING_MMAP -static inline void * -allocate_mmap (size_t size) -{ - void *page; -#if defined (HAVE_MMAP_DEV_ZERO) - static int dev_zero_fd = -1; -#endif - -#ifdef HAVE_MMAP_DEV_ZERO - if (dev_zero_fd == -1) - { - dev_zero_fd = open ("/dev/zero", O_RDONLY); - if (dev_zero_fd == -1) - { - perror ("open /dev/zero: %m"); - exit (1); - } - } -#endif - - -#ifdef HAVE_MMAP_ANON - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); -#endif -#ifdef HAVE_MMAP_DEV_ZERO - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE, dev_zero_fd, 0); -#endif - - if (page == (char *) MAP_FAILED) - { - perror ("virtual memory exhausted"); - exit (1); - } - - return page; -} - -#endif diff --git a/Modules/_ctypes/libffi/testsuite/libffi.special/special.exp b/Modules/_ctypes/libffi/testsuite/libffi.special/special.exp --- a/Modules/_ctypes/libffi/testsuite/libffi.special/special.exp +++ b/Modules/_ctypes/libffi/testsuite/libffi.special/special.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2003, 2006, 2009 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006, 2009, 2010 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,8 +14,6 @@ # along with this program; see the file COPYING3. If not see # . -load_lib libffi-dg.exp - dg-init libffi-init @@ -25,10 +23,14 @@ set cxx_options " -shared-libgcc -lstdc++" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O0 -W -Wall" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O2" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O3" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-Os" +if { [string match $using_gcc "yes"] } { + + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O0 -W -Wall" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O2" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O3" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-Os" + +} dg-finish diff --git a/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc b/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc --- a/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc +++ b/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc @@ -5,6 +5,7 @@ Originator: Jeff Sturm */ /* { dg-do run } */ + #include "ffitestcxx.h" #if defined HAVE_STDINT_H diff --git a/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc b/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc --- a/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc +++ b/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc @@ -5,6 +5,7 @@ Originator: Andreas Tobler 20061213 */ /* { dg-do run } */ + #include "ffitestcxx.h" static int checking(int a __UNUSED__, short b __UNUSED__, diff --git a/Modules/_ctypes/libffi/texinfo.tex b/Modules/_ctypes/libffi/texinfo.tex --- a/Modules/_ctypes/libffi/texinfo.tex +++ b/Modules/_ctypes/libffi/texinfo.tex @@ -1,18 +1,18 @@ % texinfo.tex -- TeX macros to handle Texinfo files. -% +% % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2005-07-05.19} -% -% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, -% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software -% Foundation, Inc. -% -% This texinfo.tex file is free software; you can redistribute it and/or +\def\texinfoversion{2012-06-05.14} +% +% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +% 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. +% +% This texinfo.tex file is free software: you can redistribute it and/or % modify it under the terms of the GNU General Public License as -% published by the Free Software Foundation; either version 2, or (at -% your option) any later version. +% published by the Free Software Foundation, either version 3 of the +% License, or (at your option) any later version. % % This texinfo.tex file is distributed in the hope that it will be % useful, but WITHOUT ANY WARRANTY; without even the implied warranty @@ -20,9 +20,7 @@ % General Public License for more details. % % You should have received a copy of the GNU General Public License -% along with this texinfo.tex file; see the file COPYING. If not, write -% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -% Boston, MA 02110-1301, USA. +% along with this program. If not, see . % % As a special exception, when this file is read by TeX when processing % a Texinfo source document, you may use the result without @@ -30,9 +28,9 @@ % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: -% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or -% ftp://tug.org/tex/texinfo.tex -% (and all CTAN mirrors, see http://www.ctan.org). +% http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or +% http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or +% http://www.gnu.org/software/texinfo/ (the Texinfo home page) % The texinfo.tex in any given distribution could well be out % of date, so if that's what you're using, please check. % @@ -67,7 +65,6 @@ \everyjob{\message{[Texinfo version \texinfoversion]}% \catcode`+=\active \catcode`\_=\active} -\message{Basics,} \chardef\other=12 % We never want plain's \outer definition of \+ in Texinfo. @@ -95,10 +92,13 @@ \let\ptexnewwrite\newwrite \let\ptexnoindent=\noindent \let\ptexplus=+ +\let\ptexraggedright=\raggedright \let\ptexrbrace=\} \let\ptexslash=\/ \let\ptexstar=\* \let\ptext=\t +\let\ptextop=\top +{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode % If this character appears in an error message or help string, it % starts a new line in the output. @@ -116,10 +116,11 @@ % Set up fixed words for English if not already set. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putworderror\undefined \gdef\putworderror{error}\fi \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi \ifx\putwordin\undefined \gdef\putwordin{in}\fi -\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi -\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi @@ -153,28 +154,25 @@ \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi -% In some macros, we cannot use the `\? notation---the left quote is -% in some cases the escape char. -\chardef\backChar = `\\ +% Since the category of space is not known, we have to be careful. +\chardef\spacecat = 10 +\def\spaceisspace{\catcode`\ =\spacecat} + +% sometimes characters are active, so we need control sequences. +\chardef\ampChar = `\& \chardef\colonChar = `\: \chardef\commaChar = `\, +\chardef\dashChar = `\- \chardef\dotChar = `\. \chardef\exclamChar= `\! -\chardef\plusChar = `\+ +\chardef\hashChar = `\# +\chardef\lquoteChar= `\` \chardef\questChar = `\? +\chardef\rquoteChar= `\' \chardef\semiChar = `\; +\chardef\slashChar = `\/ \chardef\underChar = `\_ -\chardef\spaceChar = `\ % -\chardef\spacecat = 10 -\def\spaceisspace{\catcode\spaceChar=\spacecat} - -{% for help with debugging. - % example usage: \expandafter\show\activebackslash - \catcode`\! = 0 \catcode`\\ = \active - !global!def!activebackslash{\} -} - % Ignore a token. % \def\gobble#1{} @@ -203,36 +201,7 @@ % that mark overfull boxes (in case you have decided % that the text looks ok even though it passes the margin). % -\def\finalout{\overfullrule=0pt} - -% @| inserts a changebar to the left of the current line. It should -% surround any changed text. This approach does *not* work if the -% change spans more than two lines of output. To handle that, we would -% have adopt a much more difficult approach (putting marks into the main -% vertical list for the beginning and end of each change). -% -\def\|{% - % \vadjust can only be used in horizontal mode. - \leavevmode - % - % Append this vertical mode material after the current line in the output. - \vadjust{% - % We want to insert a rule with the height and depth of the current - % leading; that is exactly what \strutbox is supposed to record. - \vskip-\baselineskip - % - % \vadjust-items are inserted at the left edge of the type. So - % the \llap here moves out into the left-hand margin. - \llap{% - % - % For a thicker or thinner bar, change the `1pt'. - \vrule height\baselineskip width1pt - % - % This is the space between the bar and the text. - \hskip 12pt - }% - }% -} +\def\finalout{\overfullrule=0pt } % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, @@ -250,7 +219,7 @@ \tracingmacros2 \tracingrestores1 \showboxbreadth\maxdimen \showboxdepth\maxdimen - \ifx\eTeXversion\undefined\else % etex gives us more logging + \ifx\eTeXversion\thisisundefined\else % etex gives us more logging \tracingscantokens1 \tracingifs1 \tracinggroups1 @@ -261,6 +230,13 @@ \errorcontextlines16 }% +% @errormsg{MSG}. Do the index-like expansions on MSG, but if things +% aren't perfect, it's not the end of the world, being an error message, +% after all. +% +\def\errormsg{\begingroup \indexnofonts \doerrormsg} +\def\doerrormsg#1{\errmessage{#1}} + % add check for \lastpenalty to plain's definitions. If the last thing % we did was a \nobreak, we don't want to insert more space. % @@ -271,7 +247,6 @@ \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount \removelastskip\penalty-200\bigskip\fi\fi} -% For @cropmarks command. % Do @cropmarks to get crop marks. % \newif\ifcropmarks @@ -285,6 +260,50 @@ \newdimen\cornerthick \cornerthick=.3pt \newdimen\topandbottommargin \topandbottommargin=.75in +% Output a mark which sets \thischapter, \thissection and \thiscolor. +% We dump everything together because we only have one kind of mark. +% This works because we only use \botmark / \topmark, not \firstmark. +% +% A mark contains a subexpression of the \ifcase ... \fi construct. +% \get*marks macros below extract the needed part using \ifcase. +% +% Another complication is to let the user choose whether \thischapter +% (\thissection) refers to the chapter (section) in effect at the top +% of a page, or that at the bottom of a page. The solution is +% described on page 260 of The TeXbook. It involves outputting two +% marks for the sectioning macros, one before the section break, and +% one after. I won't pretend I can describe this better than DEK... +\def\domark{% + \toks0=\expandafter{\lastchapterdefs}% + \toks2=\expandafter{\lastsectiondefs}% + \toks4=\expandafter{\prevchapterdefs}% + \toks6=\expandafter{\prevsectiondefs}% + \toks8=\expandafter{\lastcolordefs}% + \mark{% + \the\toks0 \the\toks2 + \noexpand\or \the\toks4 \the\toks6 + \noexpand\else \the\toks8 + }% +} +% \topmark doesn't work for the very first chapter (after the title +% page or the contents), so we use \firstmark there -- this gets us +% the mark with the chapter defs, unless the user sneaks in, e.g., +% @setcolor (or @url, or @link, etc.) between @contents and the very +% first @chapter. +\def\gettopheadingmarks{% + \ifcase0\topmark\fi + \ifx\thischapter\empty \ifcase0\firstmark\fi \fi +} +\def\getbottomheadingmarks{\ifcase1\botmark\fi} +\def\getcolormarks{\ifcase2\topmark\fi} + +% Avoid "undefined control sequence" errors. +\def\lastchapterdefs{} +\def\lastsectiondefs{} +\def\prevchapterdefs{} +\def\prevsectiondefs{} +\def\lastcolordefs{} + % Main output routine. \chardef\PAGE = 255 \output = {\onepageout{\pagecontents\PAGE}} @@ -302,7 +321,9 @@ % % Do this outside of the \shipout so @code etc. will be expanded in % the headline as they should be, not taken literally (outputting ''code). + \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% % {% @@ -311,6 +332,13 @@ % before the \shipout runs. % \indexdummies % don't expand commands in the output. + \normalturnoffactive % \ in index entries must not stay \, e.g., if + % the page break happens to be in the middle of an example. + % We don't want .vr (or whatever) entries like this: + % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} + % "\acronym" won't work when it's read back in; + % it needs to be + % {\code {{\tt \backslashcurfont }acronym} \shipout\vbox{% % Do this early so pdf references go to the beginning of the page. \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi @@ -338,9 +366,9 @@ \pagebody{#1}% \ifdim\ht\footlinebox > 0pt % Only leave this space if the footline is nonempty. - % (We lessened \vsize for it in \oddfootingxxx.) + % (We lessened \vsize for it in \oddfootingyyy.) % The \baselineskip=24pt in plain's \makefootline has no effect. - \vskip 2\baselineskip + \vskip 24pt \unvbox\footlinebox \fi % @@ -374,7 +402,7 @@ % marginal hacks, juha at viisa.uucp (Juha Takala) \ifvoid\margin\else % marginal info is present \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi -\dimen@=\dp#1 \unvbox#1 +\dimen@=\dp#1\relax \unvbox#1\relax \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi \ifr at ggedbottom \kern-\dimen@ \vfil \fi} } @@ -396,7 +424,7 @@ % \def\parsearg{\parseargusing{}} \def\parseargusing#1#2{% - \def\next{#2}% + \def\argtorun{#2}% \begingroup \obeylines \spaceisspace @@ -415,7 +443,7 @@ \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} -% Each occurence of `\^^M' or `\^^M' is replaced by a single space. +% Each occurrence of `\^^M' or `\^^M' is replaced by a single space. % % \argremovec might leave us with trailing space, e.g., % @end itemize @c foo @@ -427,8 +455,7 @@ \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% \def\temp{#3}% \ifx\temp\empty - % We cannot use \next here, as it holds the macro to run; - % thus we reuse \temp. + % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: \let\temp\finishparsearg \else \let\temp\argcheckspaces @@ -440,14 +467,14 @@ % If a _delimited_ argument is enclosed in braces, they get stripped; so % to get _exactly_ the rest of the line, we had to prevent such situation. % We prepended an \empty token at the very beginning and we expand it now, -% just before passing the control to \next. -% (Similarily, we have to think about #3 of \argcheckspacesY above: it is +% just before passing the control to \argtorun. +% (Similarly, we have to think about #3 of \argcheckspacesY above: it is % either the null string, or it ends with \^^M---thus there is no danger % that a pair of braces would be stripped. % % But first, we have to remove the trailing space token. % -\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} +\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} % \parseargdef\foo{...} % is roughly equivalent to @@ -498,12 +525,12 @@ % used to check whether the current environment is the one expected. % % Non-false conditionals (@iftex, @ifset) don't fit into this, so they -% are not treated as enviroments; they don't open a group. (The +% are not treated as environments; they don't open a group. (The % implementation of @end takes care not to call \endgroup in this % special case.) -% At runtime, environments start with this: +% At run-time, environments start with this: \def\startenvironment#1{\begingroup\def\thisenv{#1}} % initialize \let\thisenv\empty @@ -521,7 +548,7 @@ \fi } -% Evironment mismatch, #1 expected: +% Environment mismatch, #1 expected: \def\badenverr{% \errhelp = \EMsimple \errmessage{This command can appear only \inenvironment\temp, @@ -529,7 +556,7 @@ } \def\inenvironment#1{% \ifx#1\empty - out of any environment% + outside of any environment% \else in environment \expandafter\string#1% \fi @@ -541,7 +568,7 @@ \parseargdef\end{% \if 1\csname iscond.#1\endcsname \else - % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 + % The general wording of \badenverr may not be ideal. \expandafter\checkenv\csname#1\endcsname \csname E#1\endcsname \endgroup @@ -551,85 +578,6 @@ \newhelp\EMsimple{Press RETURN to continue.} -%% Simple single-character @ commands - -% @@ prints an @ -% Kludge this until the fonts are right (grr). -\def\@{{\tt\char64}} - -% This is turned off because it was never documented -% and you can use @w{...} around a quote to suppress ligatures. -%% Define @` and @' to be the same as ` and ' -%% but suppressing ligatures. -%\def\`{{`}} -%\def\'{{'}} - -% Used to generate quoted braces. -\def\mylbrace {{\tt\char123}} -\def\myrbrace {{\tt\char125}} -\let\{=\mylbrace -\let\}=\myrbrace -\begingroup - % Definitions to produce \{ and \} commands for indices, - % and @{ and @} for the aux/toc files. - \catcode`\{ = \other \catcode`\} = \other - \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\! = 0 \catcode`\\ = \other - !gdef!lbracecmd[\{]% - !gdef!rbracecmd[\}]% - !gdef!lbraceatcmd[@{]% - !gdef!rbraceatcmd[@}]% -!endgroup - -% @comma{} to avoid , parsing problems. -\let\comma = , - -% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent -% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. -\let\, = \c -\let\dotaccent = \. -\def\ringaccent#1{{\accent23 #1}} -\let\tieaccent = \t -\let\ubaraccent = \b -\let\udotaccent = \d - -% Other special characters: @questiondown @exclamdown @ordf @ordm -% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. -\def\questiondown{?`} -\def\exclamdown{!`} -\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} -\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} - -% Dotless i and dotless j, used for accents. -\def\imacro{i} -\def\jmacro{j} -\def\dotless#1{% - \def\temp{#1}% - \ifx\temp\imacro \ptexi - \else\ifx\temp\jmacro \j - \else \errmessage{@dotless can be used only with i or j}% - \fi\fi -} - -% The \TeX{} logo, as in plain, but resetting the spacing so that a -% period following counts as ending a sentence. (Idea found in latex.) -% -\edef\TeX{\TeX \spacefactor=1000 } - -% @LaTeX{} logo. Not quite the same results as the definition in -% latex.ltx, since we use a different font for the raised A; it's most -% convenient for us to use an explicitly smaller font, rather than using -% the \scriptstyle font (since we don't reset \scriptstyle and -% \scriptscriptstyle). -% -\def\LaTeX{% - L\kern-.36em - {\setbox0=\hbox{T}% - \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% - \kern-.15em - \TeX -} - % Be sure we're in horizontal mode when doing a tie, since we make space % equivalent to this in @example-like environments. Otherwise, a space % at the beginning of a line will start with \penalty -- and @@ -661,7 +609,7 @@ \def\?{?\spacefactor=\endofsentencespacefactor\space} % @frenchspacing on|off says whether to put extra space after punctuation. -% +% \def\onword{on} \def\offword{off} % @@ -671,7 +619,7 @@ \else\ifx\temp\offword \plainnonfrenchspacing \else \errhelp = \EMsimple - \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% + \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% \fi\fi } @@ -753,15 +701,6 @@ \newdimen\mil \mil=0.001in -% Old definition--didn't work. -%\parseargdef\need{\par % -%% This method tries to make TeX break the page naturally -%% if the depth of the box does not fit. -%{\baselineskip=0pt% -%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak -%\prevdepth=-1000pt -%}} - \parseargdef\need{% % Ensure vertical mode, so we don't make a big box in the middle of a % paragraph. @@ -825,7 +764,7 @@ % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current % paragraph. For more general purposes, use the \margin insertion -% class. WHICH is `l' or `r'. +% class. WHICH is `l' or `r'. Not documented, written for gawk manual. % \newskip\inmarginspacing \inmarginspacing=1cm \def\strutdepth{\dp\strutbox} @@ -872,15 +811,51 @@ \temp } -% @include file insert text of that file as input. +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). This command +% is not documented, not supported, and doesn't work. +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + +% @include FILE -- \input text of FILE. % \def\include{\parseargusing\filenamecatcodes\includezzz} \def\includezzz#1{% \pushthisfilestack \def\thisfile{#1}% {% - \makevalueexpandable - \def\temp{\input #1 }% + \makevalueexpandable % we want to expand any @value in FILE. + \turnoffactive % and allow special characters in the expansion + \indexnofonts % Allow `@@' and other weird things in file names. + \wlog{texinfo.tex: doing @include of #1^^J}% + \edef\temp{\noexpand\input #1 }% + % + % This trickery is to read FILE outside of a group, in case it makes + % definitions, etc. \expandafter }\temp \popthisfilestack @@ -895,6 +870,8 @@ \catcode`>=\other \catcode`+=\other \catcode`-=\other + \catcode`\`=\other + \catcode`\'=\other } \def\pushthisfilestack{% @@ -910,7 +887,7 @@ \def\popthisfilestack{\errthisfilestackempty} \def\errthisfilestackempty{\errmessage{Internal error: the stack of filenames is empty.}} - +% \def\thisfile{} % @center line @@ -918,36 +895,46 @@ % \parseargdef\center{% \ifhmode - \let\next\centerH + \let\centersub\centerH \else - \let\next\centerV + \let\centersub\centerV \fi - \next{\hfil \ignorespaces#1\unskip \hfil}% -} -\def\centerH#1{% - {% - \hfil\break - \advance\hsize by -\leftskip - \advance\hsize by -\rightskip - \line{#1}% - \break - }% -} -\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} + \centersub{\hfil \ignorespaces#1\unskip \hfil}% + \let\centersub\relax % don't let the definition persist, just in case +} +\def\centerH#1{{% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break +}} +% +\newcount\centerpenalty +\def\centerV#1{% + % The idea here is the same as in \startdefun, \cartouche, etc.: if + % @center is the first thing after a section heading, we need to wipe + % out the negative parskip inserted by \sectionheading, but still + % prevent a page break here. + \centerpenalty = \lastpenalty + \ifnum\centerpenalty>10000 \vskip\parskip \fi + \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi + \line{\kern\leftskip #1\kern\rightskip}% +} % @sp n outputs n lines of vertical space - +% \parseargdef\sp{\vskip #1\baselineskip} % @comment ...line which is ignored... % @c is the same as @comment % @ignore ... @end ignore is another way to write a comment - +% \def\comment{\begingroup \catcode`\^^M=\other% \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% \commentxxx} {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} - +% \let\c=\comment % @paragraphindent NCHARS @@ -1040,86 +1027,6 @@ } -% @asis just yields its argument. Used with @table, for example. -% -\def\asis#1{#1} - -% @math outputs its argument in math mode. -% -% One complication: _ usually means subscripts, but it could also mean -% an actual _ character, as in @math{@var{some_variable} + 1}. So make -% _ active, and distinguish by seeing if the current family is \slfam, -% which is what @var uses. -{ - \catcode\underChar = \active - \gdef\mathunderscore{% - \catcode\underChar=\active - \def_{\ifnum\fam=\slfam \_\else\sb\fi}% - } -} -% Another complication: we want \\ (and @\) to output a \ character. -% FYI, plain.tex uses \\ as a temporary control sequence (why?), but -% this is not advertised and we don't care. Texinfo does not -% otherwise define @\. -% -% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. -\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} -% -\def\math{% - \tex - \mathunderscore - \let\\ = \mathbackslash - \mathactive - $\finishmath -} -\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. - -% Some active characters (such as <) are spaced differently in math. -% We have to reset their definitions in case the @math was an argument -% to a command which sets the catcodes (such as @item or @section). -% -{ - \catcode`^ = \active - \catcode`< = \active - \catcode`> = \active - \catcode`+ = \active - \gdef\mathactive{% - \let^ = \ptexhat - \let< = \ptexless - \let> = \ptexgtr - \let+ = \ptexplus - } -} - -% @bullet and @minus need the same treatment as @math, just above. -\def\bullet{$\ptexbullet$} -\def\minus{$-$} - -% @dots{} outputs an ellipsis using the current font. -% We do .5em per period so that it has the same spacing in a typewriter -% font as three actual period characters. -% -\def\dots{% - \leavevmode - \hbox to 1.5em{% - \hskip 0pt plus 0.25fil - .\hfil.\hfil.% - \hskip 0pt plus 0.5fil - }% -} - -% @enddots{} is an end-of-sentence ellipsis. -% -\def\enddots{% - \dots - \spacefactor=\endofsentencespacefactor -} - -% @comma{} is so commas can be inserted into text without messing up -% Texinfo's parsing. -% -\let\comma = , - % @refill is a no-op. \let\refill=\relax @@ -1184,9 +1091,8 @@ \newif\ifpdfmakepagedest % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 -% can be set). So we test for \relax and 0 as well as \undefined, -% borrowed from ifpdf.sty. -\ifx\pdfoutput\undefined +% can be set). So we test for \relax and 0 as well as being undefined. +\ifx\pdfoutput\thisisundefined \else \ifx\pdfoutput\relax \else @@ -1197,99 +1103,156 @@ \fi \fi -% PDF uses PostScript string constants for the names of xref targets, to +% PDF uses PostScript string constants for the names of xref targets, % for display in the outlines, and in other places. Thus, we have to % double any backslashes. Otherwise, a name like "\node" will be % interpreted as a newline (\n), followed by o, d, e. Not good. -% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html -% (and related messages, the final outcome is that it is up to the TeX -% user to double the backslashes and otherwise make the string valid, so -% that's we do). - -% double active backslashes. % -{\catcode`\@=0 \catcode`\\=\active - @gdef at activebackslash{@catcode`@\=@active @otherbackslash} - @gdef at activebackslashdouble{% - @catcode at backChar=@active - @let\=@doublebackslash} -} - -% To handle parens, we must adopt a different approach, since parens are -% not active characters. hyperref.dtx (which has the same problem as -% us) handles it with this amazing macro to replace tokens. I've -% tinkered with it a little for texinfo, but it's definitely from there. -% -% #1 is the tokens to replace. -% #2 is the replacement. -% #3 is the control sequence with the string. -% -\def\HyPsdSubst#1#2#3{% - \def\HyPsdReplace##1#1##2\END{% - ##1% - \ifx\\##2\\% - \else - #2% - \HyReturnAfterFi{% - \HyPsdReplace##2\END +% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and +% related messages. The final outcome is that it is up to the TeX user +% to double the backslashes and otherwise make the string valid, so +% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to +% do this reliably, so we use it. + +% #1 is a control sequence in which to do the replacements, +% which we \xdef. +\def\txiescapepdf#1{% + \ifx\pdfescapestring\thisisundefined + % No primitive available; should we give a warning or log? + % Many times it won't matter. + \else + % The expandable \pdfescapestring primitive escapes parentheses, + % backslashes, and other special chars. + \xdef#1{\pdfescapestring{#1}}% + \fi +} + +\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images +with PDF output, and none of those formats could be found. (.eps cannot +be supported due to the design of the PDF format; use regular TeX (DVI +output) for that.)} + +\ifpdf + % + % Color manipulation macros based on pdfcolor.tex, + % except using rgb instead of cmyk; the latter is said to render as a + % very dark gray on-screen and a very dark halftone in print, instead + % of actual black. + \def\rgbDarkRed{0.50 0.09 0.12} + \def\rgbBlack{0 0 0} + % + % k sets the color for filling (usual text, etc.); + % K sets the color for stroking (thin rules, e.g., normal _'s). + \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} + % + % Set color, and create a mark which defines \thiscolor accordingly, + % so that \makeheadline knows which color to restore. + \def\setcolor#1{% + \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% + \domark + \pdfsetcolor{#1}% + } + % + \def\maincolor{\rgbBlack} + \pdfsetcolor{\maincolor} + \edef\thiscolor{\maincolor} + \def\lastcolordefs{} + % + \def\makefootline{% + \baselineskip24pt + \line{\pdfsetcolor{\maincolor}\the\footline}% + } + % + \def\makeheadline{% + \vbox to 0pt{% + \vskip-22.5pt + \line{% + \vbox to8.5pt{}% + % Extract \thiscolor definition from the marks. + \getcolormarks + % Typeset the headline with \maincolor, then restore the color. + \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% }% - \fi - }% - \xdef#3{\expandafter\HyPsdReplace#3#1\END}% -} -\long\def\HyReturnAfterFi#1\fi{\fi#1} - -% #1 is a control sequence in which to do the replacements. -\def\backslashparens#1{% - \xdef#1{#1}% redefine it as its expansion; the definition is simply - % \lastnode when called from \setref -> \pdfmkdest. - \HyPsdSubst{(}{\backslashlparen}{#1}% - \HyPsdSubst{)}{\backslashrparen}{#1}% -} - -{\catcode\exclamChar = 0 \catcode\backChar = \other - !gdef!backslashlparen{\(}% - !gdef!backslashrparen{\)}% -} - -\ifpdf - \input pdfcolor - \pdfcatalog{/PageMode /UseOutlines}% + \vss + }% + \nointerlineskip + } + % + % + \pdfcatalog{/PageMode /UseOutlines} + % + % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). \def\dopdfimage#1#2#3{% - \def\imagewidth{#2}% - \def\imageheight{#3}% - % without \immediate, pdftex seg faults when the same image is + \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% + \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% + % + % pdftex (and the PDF format) support .pdf, .png, .jpg (among + % others). Let's try in that order, PDF first since if + % someone has a scalable image, presumably better to use that than a + % bitmap. + \let\pdfimgext=\empty + \begingroup + \openin 1 #1.pdf \ifeof 1 + \openin 1 #1.PDF \ifeof 1 + \openin 1 #1.png \ifeof 1 + \openin 1 #1.jpg \ifeof 1 + \openin 1 #1.jpeg \ifeof 1 + \openin 1 #1.JPG \ifeof 1 + \errhelp = \nopdfimagehelp + \errmessage{Could not find image file #1 for pdf}% + \else \gdef\pdfimgext{JPG}% + \fi + \else \gdef\pdfimgext{jpeg}% + \fi + \else \gdef\pdfimgext{jpg}% + \fi + \else \gdef\pdfimgext{png}% + \fi + \else \gdef\pdfimgext{PDF}% + \fi + \else \gdef\pdfimgext{pdf}% + \fi + \closein 1 + \endgroup + % + % without \immediate, ancient pdftex seg faults when the same image is % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) \ifnum\pdftexversion < 14 \immediate\pdfimage \else \immediate\pdfximage \fi - \ifx\empty\imagewidth\else width \imagewidth \fi - \ifx\empty\imageheight\else height \imageheight \fi + \ifdim \wd0 >0pt width \pdfimagewidth \fi + \ifdim \wd2 >0pt height \pdfimageheight \fi \ifnum\pdftexversion<13 - #1.pdf% + #1.\pdfimgext \else - {#1.pdf}% + {#1.\pdfimgext}% \fi \ifnum\pdftexversion < 14 \else \pdfrefximage \pdflastximage \fi} + % \def\pdfmkdest#1{{% % We have to set dummies so commands such as @code, and characters % such as \, aren't expanded when present in a section title. - \atdummies - \activebackslashdouble + \indexnofonts + \turnoffactive + \makevalueexpandable \def\pdfdestname{#1}% - \backslashparens\pdfdestname - \pdfdest name{\pdfdestname} xyz% - }}% + \txiescapepdf\pdfdestname + \safewhatsit{\pdfdest name{\pdfdestname} xyz}% + }} % % used to mark target names; must be expandable. - \def\pdfmkpgn#1{#1}% - % - \let\linkcolor = \Blue % was Cyan, but that seems light? - \def\endlink{\Black\pdfendlink} + \def\pdfmkpgn#1{#1} + % + % by default, use a color that is dark enough to print on paper as + % nearly black, but still distinguishable for online viewing. + \def\urlcolor{\rgbDarkRed} + \def\linkcolor{\rgbDarkRed} + \def\endlink{\setcolor{\maincolor}\pdfendlink} + % % Adding outlines to PDF; macros for calculating structure of outlines % come from Petr Olsak \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% @@ -1309,29 +1272,24 @@ % page number. We could generate a destination for the section % text in the case where a section has no node, but it doesn't % seem worth the trouble, since most documents are normally structured. - \def\pdfoutlinedest{#3}% + \edef\pdfoutlinedest{#3}% \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}% \else - % Doubled backslashes in the name. - {\activebackslashdouble \xdef\pdfoutlinedest{#3}% - \backslashparens\pdfoutlinedest}% + \txiescapepdf\pdfoutlinedest \fi % - % Also double the backslashes in the display string. - {\activebackslashdouble \xdef\pdfoutlinetext{#1}% - \backslashparens\pdfoutlinetext}% + % Also escape PDF chars in the display string. + \edef\pdfoutlinetext{#1}% + \txiescapepdf\pdfoutlinetext % \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% } % \def\pdfmakeoutlines{% \begingroup - % Thanh's hack / proper braces in bookmarks - \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace - \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace - % % Read toc silently, to get counts of subentries for \pdfoutline. + \def\partentry##1##2##3##4{}% ignore parts in the outlines \def\numchapentry##1##2##3##4{% \def\thischapnum{##2}% \def\thissecnum{0}% @@ -1385,35 +1343,63 @@ % Latin 2 (0xea) gets translated to a | character. Info from % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. % - % xx to do this right, we have to translate 8-bit characters to - % their "best" equivalent, based on the @documentencoding. Right - % now, I guess we'll just let the pdf reader have its way. + % TODO this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Too + % much work for too little return. Just use the ASCII equivalents + % we use for the index sort strings. + % \indexnofonts \setupdatafile - \activebackslash - \input \jobname.toc + % We can have normal brace characters in the PDF outlines, unlike + % Texinfo index files. So set that up. + \def\{{\lbracecharliteral}% + \def\}{\rbracecharliteral}% + \catcode`\\=\active \otherbackslash + \input \tocreadfilename \endgroup } + {\catcode`[=1 \catcode`]=2 + \catcode`{=\other \catcode`}=\other + \gdef\lbracecharliteral[{]% + \gdef\rbracecharliteral[}]% + ] % \def\skipspaces#1{\def\PP{#1}\def\D{|}% \ifx\PP\D\let\nextsp\relax \else\let\nextsp\skipspaces - \ifx\p\space\else\addtokens{\filename}{\PP}% - \advance\filenamelength by 1 - \fi + \addtokens{\filename}{\PP}% + \advance\filenamelength by 1 \fi \nextsp} - \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + \def\getfilename#1{% + \filenamelength=0 + % If we don't expand the argument now, \skipspaces will get + % snagged on things like "@value{foo}". + \edef\temp{#1}% + \expandafter\skipspaces\temp|\relax + } \ifnum\pdftexversion < 14 \let \startlink \pdfannotlink \else \let \startlink \pdfstartlink \fi + % make a live url in pdf output. \def\pdfurl#1{% \begingroup - \normalturnoffactive\def\@{@}% + % it seems we really need yet another set of dummies; have not + % tried to figure out what each command should do in the context + % of @url. for now, just make @/ a no-op, that's the only one + % people have actually reported a problem with. + % + \normalturnoffactive + \def\@{@}% + \let\/=\empty \makevalueexpandable - \leavevmode\Red + % do we want to go so far as to use \indexnofonts instead of just + % special-casing \var here? + \def\var##1{##1}% + % + \leavevmode\setcolor{\urlcolor}% \startlink attr{/Border [0 0 0]}% user{/Subtype /Link /A << /S /URI /URI (#1) >>}% \endgroup} @@ -1440,13 +1426,15 @@ {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} \def\pdflink#1{% \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} - \linkcolor #1\endlink} + \setcolor{\linkcolor}#1\endlink} \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} \else + % non-pdf mode \let\pdfmkdest = \gobble \let\pdfurl = \gobble \let\endlink = \relax - \let\linkcolor = \relax + \let\setcolor = \gobble + \let\pdfsetcolor = \gobble \let\pdfmakeoutlines = \relax \fi % \ifx\pdfoutput @@ -1472,6 +1460,10 @@ \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} \def\tt{\fam=\ttfam \setfontstyle{tt}} +% Unfortunately, we have to override this for titles and the like, since +% in those cases "rm" is bold. Sigh. +\def\rmisbold{\rm\def\curfontstyle{bf}} + % Texinfo sort of supports the sans serif font style, which plain TeX does not. % So we set up a \sf. \newfam\sffam @@ -1481,8 +1473,6 @@ % We don't need math for this font style. \def\ttsl{\setfontstyle{ttsl}} -% Default leading. -\newdimen\textleading \textleading = 13.2pt % Set the baselineskip to #1, and the lineskip and strut size % correspondingly. There is no deep meaning behind these magic numbers @@ -1492,8 +1482,13 @@ \def\strutheightpercent{.70833} \def\strutdepthpercent {.29167} % +% can get a sort of poor man's double spacing by redefining this. +\def\baselinefactor{1} +% +\newdimen\textleading \def\setleading#1{% - \normalbaselineskip = #1\relax + \dimen0 = #1\relax + \normalbaselineskip = \baselinefactor\dimen0 \normallineskip = \lineskipfactor\normalbaselineskip \normalbaselines \setbox\strutbox =\hbox{% @@ -1502,20 +1497,295 @@ }% } -% Set the font macro #1 to the font named #2, adding on the -% specified font prefix (normally `cm'). -% #3 is the font's design size, #4 is a scale factor -\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} +% PDF CMaps. See also LaTeX's t1.cmap. +% +% do nothing with this by default. +\expandafter\let\csname cmapOT1\endcsname\gobble +\expandafter\let\csname cmapOT1IT\endcsname\gobble +\expandafter\let\csname cmapOT1TT\endcsname\gobble + +% if we are producing pdf, and we have \pdffontattr, then define cmaps. +% (\pdffontattr was introduced many years ago, but people still run +% older pdftex's; it's easy to conditionalize, so we do.) +\ifpdf \ifx\pdffontattr\thisisundefined \else + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1-0) +%%Title: (TeX-OT1-0 TeX OT1 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1) +/Supplement 0 +>> def +/CMapName /TeX-OT1-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<23> <26> <0023> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +40 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1IT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1IT-0) +%%Title: (TeX-OT1IT-0 TeX OT1IT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1IT) +/Supplement 0 +>> def +/CMapName /TeX-OT1IT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<25> <26> <0025> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +42 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<23> <0023> +<24> <00A3> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1IT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1TT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1TT-0) +%%Title: (TeX-OT1TT-0 TeX OT1TT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1TT) +/Supplement 0 +>> def +/CMapName /TeX-OT1TT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +5 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<21> <26> <0021> +<28> <5F> <0028> +<61> <7E> <0061> +endbfrange +32 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <2191> +<0C> <2193> +<0D> <0027> +<0E> <00A1> +<0F> <00BF> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<20> <2423> +<27> <2019> +<60> <2018> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1TT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +\fi\fi + + +% Set the font macro #1 to the font named \fontprefix#2. +% #3 is the font's design size, #4 is a scale factor, #5 is the CMap +% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit). +% Example: +% #1 = \textrm +% #2 = \rmshape +% #3 = 10 +% #4 = \mainmagstep +% #5 = OT1 +% +\def\setfont#1#2#3#4#5{% + \font#1=\fontprefix#2#3 scaled #4 + \csname cmap#5\endcsname#1% +} +% This is what gets called when #5 of \setfont is empty. +\let\cmap\gobble +% +% (end of cmaps) % Use cm as the default font prefix. % To specify the font prefix, you must define \fontprefix % before you read in texinfo.tex. -\ifx\fontprefix\undefined +\ifx\fontprefix\thisisundefined \def\fontprefix{cm} \fi % Support font families that don't use the same naming scheme as CM. \def\rmshape{r} -\def\rmbshape{bx} %where the normal face is bold +\def\rmbshape{bx} % where the normal face is bold \def\bfshape{b} \def\bxshape{bx} \def\ttshape{tt} @@ -1530,118 +1800,291 @@ \def\scshape{csc} \def\scbshape{csc} +% Definitions for a main text size of 11pt. (The default in Texinfo.) +% +\def\definetextfontsizexi{% % Text fonts (11.2pt, magstep1). \def\textnominalsize{11pt} \edef\mainmagstep{\magstephalf} -\setfont\textrm\rmshape{10}{\mainmagstep} -\setfont\texttt\ttshape{10}{\mainmagstep} -\setfont\textbf\bfshape{10}{\mainmagstep} -\setfont\textit\itshape{10}{\mainmagstep} -\setfont\textsl\slshape{10}{\mainmagstep} -\setfont\textsf\sfshape{10}{\mainmagstep} -\setfont\textsc\scshape{10}{\mainmagstep} -\setfont\textttsl\ttslshape{10}{\mainmagstep} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1095} % A few fonts for @defun names and args. -\setfont\defbf\bfshape{10}{\magstep1} -\setfont\deftt\ttshape{10}{\magstep1} -\setfont\defttsl\ttslshape{10}{\magstep1} +\setfont\defbf\bfshape{10}{\magstep1}{OT1} +\setfont\deftt\ttshape{10}{\magstep1}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} -\setfont\smallrm\rmshape{9}{1000} -\setfont\smalltt\ttshape{9}{1000} -\setfont\smallbf\bfshape{10}{900} -\setfont\smallit\itshape{9}{1000} -\setfont\smallsl\slshape{9}{1000} -\setfont\smallsf\sfshape{9}{1000} -\setfont\smallsc\scshape{10}{900} -\setfont\smallttsl\ttslshape{10}{900} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 +\def\smallecsize{0900} % Fonts for small examples (8pt). \def\smallernominalsize{8pt} -\setfont\smallerrm\rmshape{8}{1000} -\setfont\smallertt\ttshape{8}{1000} -\setfont\smallerbf\bfshape{10}{800} -\setfont\smallerit\itshape{8}{1000} -\setfont\smallersl\slshape{8}{1000} -\setfont\smallersf\sfshape{8}{1000} -\setfont\smallersc\scshape{10}{800} -\setfont\smallerttsl\ttslshape{10}{800} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 +\def\smallerecsize{0800} % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} -\setfont\titlerm\rmbshape{12}{\magstep3} -\setfont\titleit\itbshape{10}{\magstep4} -\setfont\titlesl\slbshape{10}{\magstep4} -\setfont\titlett\ttbshape{12}{\magstep3} -\setfont\titlettsl\ttslshape{10}{\magstep4} -\setfont\titlesf\sfbshape{17}{\magstep1} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm -\setfont\titlesc\scbshape{10}{\magstep4} +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 -\def\authorrm{\secrm} -\def\authortt{\sectt} +\def\titleecsize{2074} % Chapter (and unnumbered) fonts (17.28pt). \def\chapnominalsize{17pt} -\setfont\chaprm\rmbshape{12}{\magstep2} -\setfont\chapit\itbshape{10}{\magstep3} -\setfont\chapsl\slbshape{10}{\magstep3} -\setfont\chaptt\ttbshape{12}{\magstep2} -\setfont\chapttsl\ttslshape{10}{\magstep3} -\setfont\chapsf\sfbshape{17}{1000} +\setfont\chaprm\rmbshape{12}{\magstep2}{OT1} +\setfont\chapit\itbshape{10}{\magstep3}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep3}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} +\setfont\chapsf\sfbshape{17}{1000}{OT1} \let\chapbf=\chaprm -\setfont\chapsc\scbshape{10}{\magstep3} +\setfont\chapsc\scbshape{10}{\magstep3}{OT1} \font\chapi=cmmi12 scaled \magstep2 \font\chapsy=cmsy10 scaled \magstep3 +\def\chapecsize{1728} % Section fonts (14.4pt). \def\secnominalsize{14pt} -\setfont\secrm\rmbshape{12}{\magstep1} -\setfont\secit\itbshape{10}{\magstep2} -\setfont\secsl\slbshape{10}{\magstep2} -\setfont\sectt\ttbshape{12}{\magstep1} -\setfont\secttsl\ttslshape{10}{\magstep2} -\setfont\secsf\sfbshape{12}{\magstep1} +\setfont\secrm\rmbshape{12}{\magstep1}{OT1} +\setfont\secit\itbshape{10}{\magstep2}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep2}{OT1} +\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\secsf\sfbshape{12}{\magstep1}{OT1} \let\secbf\secrm -\setfont\secsc\scbshape{10}{\magstep2} +\setfont\secsc\scbshape{10}{\magstep2}{OT1} \font\seci=cmmi12 scaled \magstep1 \font\secsy=cmsy10 scaled \magstep2 +\def\sececsize{1440} % Subsection fonts (13.15pt). \def\ssecnominalsize{13pt} -\setfont\ssecrm\rmbshape{12}{\magstephalf} -\setfont\ssecit\itbshape{10}{1315} -\setfont\ssecsl\slbshape{10}{1315} -\setfont\ssectt\ttbshape{12}{\magstephalf} -\setfont\ssecttsl\ttslshape{10}{1315} -\setfont\ssecsf\sfbshape{12}{\magstephalf} +\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} +\setfont\ssecit\itbshape{10}{1315}{OT1IT} +\setfont\ssecsl\slbshape{10}{1315}{OT1} +\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} +\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} \let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{1315} +\setfont\ssecsc\scbshape{10}{1315}{OT1} \font\sseci=cmmi12 scaled \magstephalf \font\ssecsy=cmsy10 scaled 1315 +\def\ssececsize{1200} % Reduced fonts for @acro in text (10pt). \def\reducednominalsize{10pt} -\setfont\reducedrm\rmshape{10}{1000} -\setfont\reducedtt\ttshape{10}{1000} -\setfont\reducedbf\bfshape{10}{1000} -\setfont\reducedit\itshape{10}{1000} -\setfont\reducedsl\slshape{10}{1000} -\setfont\reducedsf\sfshape{10}{1000} -\setfont\reducedsc\scshape{10}{1000} -\setfont\reducedttsl\ttslshape{10}{1000} +\setfont\reducedrm\rmshape{10}{1000}{OT1} +\setfont\reducedtt\ttshape{10}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{1000}{OT1} +\setfont\reducedit\itshape{10}{1000}{OT1IT} +\setfont\reducedsl\slshape{10}{1000}{OT1} +\setfont\reducedsf\sfshape{10}{1000}{OT1} +\setfont\reducedsc\scshape{10}{1000}{OT1} +\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} \font\reducedi=cmmi10 \font\reducedsy=cmsy10 +\def\reducedecsize{1000} + +\textleading = 13.2pt % line spacing for 11pt CM +\textfonts % reset the current fonts +\rm +} % end of 11pt text font size definitions, \definetextfontsizexi + + +% Definitions to make the main text be 10pt Computer Modern, with +% section, chapter, etc., sizes following suit. This is for the GNU +% Press printing of the Emacs 22 manual. Maybe other manuals in the +% future. Used with @smallbook, which sets the leading to 12pt. +% +\def\definetextfontsizex{% +% Text fonts (10pt). +\def\textnominalsize{10pt} +\edef\mainmagstep{1000} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1000} + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstephalf}{OT1} +\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 +\def\smallecsize{0900} + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 +\def\smallerecsize{0800} + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\titleecsize{2074} + +% Chapter fonts (14.4pt). +\def\chapnominalsize{14pt} +\setfont\chaprm\rmbshape{12}{\magstep1}{OT1} +\setfont\chapit\itbshape{10}{\magstep2}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep2}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\chapsf\sfbshape{12}{\magstep1}{OT1} +\let\chapbf\chaprm +\setfont\chapsc\scbshape{10}{\magstep2}{OT1} +\font\chapi=cmmi12 scaled \magstep1 +\font\chapsy=cmsy10 scaled \magstep2 +\def\chapecsize{1440} + +% Section fonts (12pt). +\def\secnominalsize{12pt} +\setfont\secrm\rmbshape{12}{1000}{OT1} +\setfont\secit\itbshape{10}{\magstep1}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep1}{OT1} +\setfont\sectt\ttbshape{12}{1000}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} +\setfont\secsf\sfbshape{12}{1000}{OT1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep1}{OT1} +\font\seci=cmmi12 +\font\secsy=cmsy10 scaled \magstep1 +\def\sececsize{1200} + +% Subsection fonts (10pt). +\def\ssecnominalsize{10pt} +\setfont\ssecrm\rmbshape{10}{1000}{OT1} +\setfont\ssecit\itbshape{10}{1000}{OT1IT} +\setfont\ssecsl\slbshape{10}{1000}{OT1} +\setfont\ssectt\ttbshape{10}{1000}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} +\setfont\ssecsf\sfbshape{10}{1000}{OT1} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1000}{OT1} +\font\sseci=cmmi10 +\font\ssecsy=cmsy10 +\def\ssececsize{1000} + +% Reduced fonts for @acro in text (9pt). +\def\reducednominalsize{9pt} +\setfont\reducedrm\rmshape{9}{1000}{OT1} +\setfont\reducedtt\ttshape{9}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{900}{OT1} +\setfont\reducedit\itshape{9}{1000}{OT1IT} +\setfont\reducedsl\slshape{9}{1000}{OT1} +\setfont\reducedsf\sfshape{9}{1000}{OT1} +\setfont\reducedsc\scshape{10}{900}{OT1} +\setfont\reducedttsl\ttslshape{10}{900}{OT1TT} +\font\reducedi=cmmi9 +\font\reducedsy=cmsy9 +\def\reducedecsize{0900} + +\divide\parskip by 2 % reduce space between paragraphs +\textleading = 12pt % line spacing for 10pt CM +\textfonts % reset the current fonts +\rm +} % end of 10pt text font size definitions, \definetextfontsizex + + +% We provide the user-level command +% @fonttextsize 10 +% (or 11) to redefine the text font size. pt is assumed. +% +\def\xiword{11} +\def\xword{10} +\def\xwordpt{10pt} +% +\parseargdef\fonttextsize{% + \def\textsizearg{#1}% + %\wlog{doing @fonttextsize \textsizearg}% + % + % Set \globaldefs so that documents can use this inside @tex, since + % makeinfo 4.8 does not support it, but we need it nonetheless. + % + \begingroup \globaldefs=1 + \ifx\textsizearg\xword \definetextfontsizex + \else \ifx\textsizearg\xiword \definetextfontsizexi + \else + \errhelp=\EMsimple + \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} + \fi\fi + \endgroup +} + % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. Since @@ -1681,8 +2124,8 @@ \let\tenttsl=\titlettsl \def\curfontsize{title}% \def\lsize{chap}\def\lllsize{subsec}% - \resetmathfonts \setleading{25pt}} -\def\titlefont#1{{\titlefonts\rm #1}} + \resetmathfonts \setleading{27pt}} +\def\titlefont#1{{\titlefonts\rmisbold #1}} \def\chapfonts{% \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc @@ -1733,6 +2176,16 @@ \def\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{9.5pt}} +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000}{OT1} +\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000}{OT1} +\setfont\shortconttt\ttshape{12}{1000}{OT1TT} + +% Define these just so they can be easily changed for other fonts. +\def\angleleft{$\langle$} +\def\angleright{$\rangle$} + % Set the fonts to use with the @small... environments. \let\smallexamplefonts = \smallfonts @@ -1746,53 +2199,215 @@ % % By the way, for comparison, here's what fits with @example (10pt): % 8.5x11=71 smallbook=60 a4=75 a5=58 -% -% I wish the USA used A4 paper. % --karl, 24jan03. - % Set up the default fonts, so we can use them for creating boxes. % -\textfonts \rm - -% Define these so they can be easily changed for other fonts. -\def\angleleft{$\langle$} -\def\angleright{$\rangle$} +\definetextfontsizexi + + +\message{markup,} + +% Check if we are currently using a typewriter font. Since all the +% Computer Modern typewriter fonts have zero interword stretch (and +% shrink), and it is reasonable to expect all typewriter fonts to have +% this property, we can check that font parameter. +% +\def\ifmonospace{\ifdim\fontdimen3\font=0pt } + +% Markup style infrastructure. \defmarkupstylesetup\INITMACRO will +% define and register \INITMACRO to be called on markup style changes. +% \INITMACRO can check \currentmarkupstyle for the innermost +% style and the set of \ifmarkupSTYLE switches for all styles +% currently in effect. +\newif\ifmarkupvar +\newif\ifmarkupsamp +\newif\ifmarkupkey +%\newif\ifmarkupfile % @file == @samp. +%\newif\ifmarkupoption % @option == @samp. +\newif\ifmarkupcode +\newif\ifmarkupkbd +%\newif\ifmarkupenv % @env == @code. +%\newif\ifmarkupcommand % @command == @code. +\newif\ifmarkuptex % @tex (and part of @math, for now). +\newif\ifmarkupexample +\newif\ifmarkupverb +\newif\ifmarkupverbatim + +\let\currentmarkupstyle\empty + +\def\setupmarkupstyle#1{% + \csname markup#1true\endcsname + \def\currentmarkupstyle{#1}% + \markupstylesetup +} + +\let\markupstylesetup\empty + +\def\defmarkupstylesetup#1{% + \expandafter\def\expandafter\markupstylesetup + \expandafter{\markupstylesetup #1}% + \def#1% +} + +% Markup style setup for left and right quotes. +\defmarkupstylesetup\markupsetuplq{% + \expandafter\let\expandafter \temp + \csname markupsetuplq\currentmarkupstyle\endcsname + \ifx\temp\relax \markupsetuplqdefault \else \temp \fi +} + +\defmarkupstylesetup\markupsetuprq{% + \expandafter\let\expandafter \temp + \csname markupsetuprq\currentmarkupstyle\endcsname + \ifx\temp\relax \markupsetuprqdefault \else \temp \fi +} + +{ +\catcode`\'=\active +\catcode`\`=\active + +\gdef\markupsetuplqdefault{\let`\lq} +\gdef\markupsetuprqdefault{\let'\rq} + +\gdef\markupsetcodequoteleft{\let`\codequoteleft} +\gdef\markupsetcodequoteright{\let'\codequoteright} + +\gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft} +} + +\let\markupsetuplqcode \markupsetcodequoteleft +\let\markupsetuprqcode \markupsetcodequoteright +% +\let\markupsetuplqexample \markupsetcodequoteleft +\let\markupsetuprqexample \markupsetcodequoteright +% +\let\markupsetuplqsamp \markupsetcodequoteleft +\let\markupsetuprqsamp \markupsetcodequoteright +% +\let\markupsetuplqverb \markupsetcodequoteleft +\let\markupsetuprqverb \markupsetcodequoteright +% +\let\markupsetuplqverbatim \markupsetcodequoteleft +\let\markupsetuprqverbatim \markupsetcodequoteright + +\let\markupsetuplqkbd \markupsetnoligaturesquoteleft + +% Allow an option to not use regular directed right quote/apostrophe +% (char 0x27), but instead the undirected quote from cmtt (char 0x0d). +% The undirected quote is ugly, so don't make it the default, but it +% works for pasting with more pdf viewers (at least evince), the +% lilypond developers report. xpdf does work with the regular 0x27. +% +\def\codequoteright{% + \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax + \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax + '% + \else \char'15 \fi + \else \char'15 \fi +} +% +% and a similar option for the left quote char vs. a grave accent. +% Modern fonts display ASCII 0x60 as a grave accent, so some people like +% the code environments to do likewise. +% +\def\codequoteleft{% + \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax + \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax + % [Knuth] pp. 380,381,391 + % \relax disables Spanish ligatures ?` and !` of \tt font. + \relax`% + \else \char'22 \fi + \else \char'22 \fi +} + +% Commands to set the quote options. +% +\parseargdef\codequoteundirected{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxicodequoteundirected\endcsname + = t% + \else\ifx\temp\offword + \expandafter\let\csname SETtxicodequoteundirected\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% + \fi\fi +} +% +\parseargdef\codequotebacktick{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxicodequotebacktick\endcsname + = t% + \else\ifx\temp\offword + \expandafter\let\csname SETtxicodequotebacktick\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% + \fi\fi +} + +% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. +\def\noligaturesquoteleft{\relax\lq} % Count depth in font-changes, for error checks \newcount\fontdepth \fontdepth=0 -% Fonts for short table of contents. -\setfont\shortcontrm\rmshape{12}{1000} -\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 -\setfont\shortcontsl\slshape{12}{1000} -\setfont\shortconttt\ttshape{12}{1000} - -%% Add scribe-like font environments, plus @l for inline lisp (usually sans -%% serif) and @ii for TeX italic - -% \smartitalic{ARG} outputs arg in italics, followed by an italic correction -% unless the following character is such as not to need one. -\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else - \ptexslash\fi\fi\fi} -\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} -\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} - -% like \smartslanted except unconditionally uses \ttsl. +% Font commands. + +% #1 is the font command (\sl or \it), #2 is the text to slant. +% If we are in a monospaced environment, however, 1) always use \ttsl, +% and 2) do not add an italic correction. +\def\dosmartslant#1#2{% + \ifusingtt + {{\ttsl #2}\let\next=\relax}% + {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}% + \next +} +\def\smartslanted{\dosmartslant\sl} +\def\smartitalic{\dosmartslant\it} + +% Output an italic correction unless \next (presumed to be the following +% character) is such as not to need one. +\def\smartitaliccorrection{% + \ifx\next,% + \else\ifx\next-% + \else\ifx\next.% + \else\ptexslash + \fi\fi\fi + \aftersmartic +} + +% like \smartslanted except unconditionally uses \ttsl, and no ic. % @var is set to this for defun arguments. -\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} - -% like \smartslanted except unconditionally use \sl. We never want +\def\ttslanted#1{{\ttsl #1}} + +% @cite is like \smartslanted except unconditionally use \sl. We never want % ttsl for book titles, do we? -\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} +\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection} + +\def\aftersmartic{} +\def\var#1{% + \let\saveaftersmartic = \aftersmartic + \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% + \smartslanted{#1}% +} \let\i=\smartitalic \let\slanted=\smartslanted -\let\var=\smartslanted \let\dfn=\smartslanted \let\emph=\smartitalic -% @b, explicit bold. +% Explicit font changes: @r, @sc, undocumented @ii. +\def\r#1{{\rm #1}} % roman font +\def\sc#1{{\smallcaps#1}} % smallcaps font +\def\ii#1{{\it #1}} % italic font + +% @b, explicit bold. Also @strong. \def\b#1{{\bf #1}} \let\strong=\b @@ -1824,21 +2439,35 @@ \catcode`@=\other \def\endofsentencespacefactor{3000}% default +% @t, explicit typewriter. \def\t#1{% {\tt \rawbackslash \plainfrenchspacing #1}% \null } -\def\samp#1{`\tclose{#1}'\null} -\setfont\keyrm\rmshape{8}{1000} -\font\keysy=cmsy9 -\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% - \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% - \vbox{\hrule\kern-0.4pt - \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% - \kern-0.4pt\hrule}% - \kern-.06em\raise0.4pt\hbox{\angleright}}}} -% The old definition, with no lozenge: -%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} + +% @samp. +\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} + +% definition of @key that produces a lozenge. Doesn't adjust to text size. +%\setfont\keyrm\rmshape{8}{1000}{OT1} +%\font\keysy=cmsy9 +%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% +% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% +% \vbox{\hrule\kern-0.4pt +% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% +% \kern-0.4pt\hrule}% +% \kern-.06em\raise0.4pt\hbox{\angleright}}}} + +% definition of @key with no lozenge. If the current font is already +% monospace, don't change it; that way, we respect @kbdinputstyle. But +% if it isn't monospace, then use \tt. +% +\def\key#1{{\setupmarkupstyle{key}% + \nohyphenation + \ifmonospace\else\tt\fi + #1}\null} + +% ctrl is no longer a Texinfo command. \def\ctrl #1{{\tt \rawbackslash \hat}#1} % @file, @option are the same as @samp. @@ -1865,7 +2494,7 @@ \plainfrenchspacing #1% }% - \null + \null % reset spacefactor to 1000 } % We *must* turn on hyphenation at `-' and `_' in @code. @@ -1878,11 +2507,14 @@ % and arrange explicitly to hyphenate at a dash. % -- rms. { - \catcode`\-=\active - \catcode`\_=\active + \catcode`\-=\active \catcode`\_=\active + \catcode`\'=\active \catcode`\`=\active + \global\let'=\rq \global\let`=\lq % default definitions % \global\def\code{\begingroup - \catcode`\-=\active \catcode`\_=\active + \setupmarkupstyle{code}% + % The following should really be moved into \setupmarkupstyle handlers. + \catcode\dashChar=\active \catcode\underChar=\active \ifallowcodebreaks \let-\codedash \let_\codeunder @@ -1894,6 +2526,8 @@ } } +\def\codex #1{\tclose{#1}\endgroup} + \def\realdash{-} \def\codedash{-\discretionary{}{}{}} \def\codeunder{% @@ -1907,13 +2541,12 @@ \discretionary{}{}{}}% {\_}% } -\def\codex #1{\tclose{#1}\endgroup} % An additional complication: the above will allow breaks after, e.g., % each of the four underscores in __typeof__. This is undesirable in % some manuals, especially if they don't have long identifiers in % general. @allowcodebreaks provides a way to control this. -% +% \newif\ifallowcodebreaks \allowcodebreakstrue \def\keywordtrue{true} @@ -1927,55 +2560,18 @@ \allowcodebreaksfalse \else \errhelp = \EMsimple - \errmessage{Unknown @allowcodebreaks option `\txiarg'}% + \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% \fi\fi } -% @kbd is like @code, except that if the argument is just one @key command, -% then @kbd has no effect. - -% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), -% `example' (@kbd uses ttsl only inside of @example and friends), -% or `code' (@kbd uses normal tty font always). -\parseargdef\kbdinputstyle{% - \def\txiarg{#1}% - \ifx\txiarg\worddistinct - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% - \else\ifx\txiarg\wordexample - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% - \else\ifx\txiarg\wordcode - \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% - \else - \errhelp = \EMsimple - \errmessage{Unknown @kbdinputstyle option `\txiarg'}% - \fi\fi\fi -} -\def\worddistinct{distinct} -\def\wordexample{example} -\def\wordcode{code} - -% Default is `distinct.' -\kbdinputstyle distinct - -\def\xkey{\key} -\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% -\ifx\one\xkey\ifx\threex\three \key{#2}% -\else{\tclose{\kbdfont\look}}\fi -\else{\tclose{\kbdfont\look}}\fi} - -% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. -\let\indicateurl=\code -\let\env=\code -\let\command=\code - % @uref (abbreviation for `urlref') takes an optional (comma-separated) % second argument specifying the text to display and an optional third % arg as text to display instead of (rather than in addition to) the url -% itself. First (mandatory) arg is the url. Perhaps eventually put in -% a hypertex \special here. -% -\def\uref#1{\douref #1,,,\finish} -\def\douref#1,#2,#3,#4\finish{\begingroup +% itself. First (mandatory) arg is the url. +% (This \urefnobreak definition isn't used now, leaving it for a while +% for comparison.) +\def\urefnobreak#1{\dourefnobreak #1,,,\finish} +\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup \unsepspaces \pdfurl{#1}% \setbox0 = \hbox{\ignorespaces #3}% @@ -1996,6 +2592,103 @@ \endlink \endgroup} +% This \urefbreak definition is the active one. +\def\urefbreak{\begingroup \urefcatcodes \dourefbreak} +\let\uref=\urefbreak +\def\dourefbreak#1{\urefbreakfinish #1,,,\finish} +\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \urefcode{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% Allow line breaks around only a few characters (only). +\def\urefcatcodes{% + \catcode\ampChar=\active \catcode\dotChar=\active + \catcode\hashChar=\active \catcode\questChar=\active + \catcode\slashChar=\active +} +{ + \urefcatcodes + % + \global\def\urefcode{\begingroup + \setupmarkupstyle{code}% + \urefcatcodes + \let&\urefcodeamp + \let.\urefcodedot + \let#\urefcodehash + \let?\urefcodequest + \let/\urefcodeslash + \codex + } + % + % By default, they are just regular characters. + \global\def&{\normalamp} + \global\def.{\normaldot} + \global\def#{\normalhash} + \global\def?{\normalquest} + \global\def/{\normalslash} +} + +% we put a little stretch before and after the breakable chars, to help +% line breaking of long url's. The unequal skips make look better in +% cmtt at least, especially for dots. +\def\urefprestretch{\urefprebreak \hskip0pt plus.13em } +\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em } +% +\def\urefcodeamp{\urefprestretch \&\urefpoststretch} +\def\urefcodedot{\urefprestretch .\urefpoststretch} +\def\urefcodehash{\urefprestretch \#\urefpoststretch} +\def\urefcodequest{\urefprestretch ?\urefpoststretch} +\def\urefcodeslash{\futurelet\next\urefcodeslashfinish} +{ + \catcode`\/=\active + \global\def\urefcodeslashfinish{% + \urefprestretch \slashChar + % Allow line break only after the final / in a sequence of + % slashes, to avoid line break between the slashes in http://. + \ifx\next/\else \urefpoststretch \fi + } +} + +% One more complication: by default we'll break after the special +% characters, but some people like to break before the special chars, so +% allow that. Also allow no breaking at all, for manual control. +% +\parseargdef\urefbreakstyle{% + \def\txiarg{#1}% + \ifx\txiarg\wordnone + \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} + \else\ifx\txiarg\wordbefore + \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak} + \else\ifx\txiarg\wordafter + \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak} + \else + \errhelp = \EMsimple + \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% + \fi\fi\fi +} +\def\wordafter{after} +\def\wordbefore{before} +\def\wordnone{none} + +\urefbreakstyle after + % @url synonym for @uref, since that's how everyone uses it. % \let\url=\uref @@ -2017,34 +2710,65 @@ \let\email=\uref \fi -% Check if we are currently using a typewriter font. Since all the -% Computer Modern typewriter fonts have zero interword stretch (and -% shrink), and it is reasonable to expect all typewriter fonts to have -% this property, we can check that font parameter. -% -\def\ifmonospace{\ifdim\fontdimen3\font=0pt } +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. +\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}} + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\parseargdef\kbdinputstyle{% + \def\txiarg{#1}% + \ifx\txiarg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\txiarg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\txiarg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is `distinct'. +\kbdinputstyle distinct + +\def\xkey{\key} +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% +\ifx\one\xkey\ifx\threex\three \key{#2}% +\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi +\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi} + +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code +\let\env=\code +\let\command=\code + +% @clicksequence{File @click{} Open ...} +\def\clicksequence#1{\begingroup #1\endgroup} + +% @clickstyle @arrow (by default) +\parseargdef\clickstyle{\def\click{#1}} +\def\click{\arrow} % Typeset a dimension, e.g., `in' or `pt'. The only reason for the % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. % \def\dmn#1{\thinspace #1} -\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} - % @l was never documented to mean ``switch to the Lisp font'', % and it is not used as such in any manual I can find. We need it for % Polish suppressed-l. --karl, 22sep96. %\def\l#1{{\li #1}\null} -% Explicit font changes: @r, @sc, undocumented @ii. -\def\r#1{{\rm #1}} % roman font -\def\sc#1{{\smallcaps#1}} % smallcaps font -\def\ii#1{{\it #1}} % italic font - % @acronym for "FBI", "NATO", and the like. % We print this one point size smaller, since it's intended for % all-uppercase. -% +% \def\acronym#1{\doacronym #1,,\finish} \def\doacronym#1,#2,#3\finish{% {\selectfonts\lsize #1}% @@ -2052,11 +2776,12 @@ \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi + \null % reset \spacefactor=1000 } % @abbr for "Comput. J." and the like. % No font change, but don't do end-of-sentence spacing. -% +% \def\abbr#1{\doabbr #1,,\finish} \def\doabbr#1,#2,#3\finish{% {\plainfrenchspacing #1}% @@ -2064,7 +2789,254 @@ \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi -} + \null % reset \spacefactor=1000 +} + +% @asis just yields its argument. Used with @table, for example. +% +\def\asis#1{#1} + +% @math outputs its argument in math mode. +% +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode`\_ = \active + \gdef\mathunderscore{% + \catcode`\_=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} +% Another complication: we want \\ (and @\) to output a math (or tt) \. +% FYI, plain.tex uses \\ as a temporary control sequence (for no +% particular reason), but this is not advertised and we don't care. +% +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + % make the texinfo accent commands work in math mode + \let\"=\ddot + \let\'=\acute + \let\==\bar + \let\^=\hat + \let\`=\grave + \let\u=\breve + \let\v=\check + \let\~=\tilde + \let\dotaccent=\dot + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \catcode`' = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + \let' = \ptexquoteright + } +} + +% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. +% Ignore unless FMTNAME == tex; then it is like @iftex and @tex, +% except specified as a normal braced arg, so no newlines to worry about. +% +\def\outfmtnametex{tex} +% +\long\def\inlinefmt#1{\doinlinefmt #1,\finish} +\long\def\doinlinefmt#1,#2,\finish{% + \def\inlinefmtname{#1}% + \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi +} +% For raw, must switch into @tex before parsing the argument, to avoid +% setting catcodes prematurely. Doing it this way means that, for +% example, @inlineraw{html, foo{bar} gets a parse error instead of being +% ignored. But this isn't important because if people want a literal +% *right* brace they would have to use a command anyway, so they may as +% well use a command to get a left brace too. We could re-use the +% delimiter character idea from \verb, but it seems like overkill. +% +\long\def\inlineraw{\tex \doinlineraw} +\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish} +\def\doinlinerawtwo#1,#2,\finish{% + \def\inlinerawname{#1}% + \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi + \endgroup % close group opened by \tex. +} + + +\message{glyphs,} +% and logos. + +% @@ prints an @, as does @atchar{}. +\def\@{\char64 } +\let\atchar=\@ + +% @{ @} @lbracechar{} @rbracechar{} all generate brace characters. +% Unless we're in typewriter, use \ecfont because the CM text fonts do +% not have braces, and we don't want to switch into math. +\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}} +\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}} +\let\{=\mylbrace \let\lbracechar=\{ +\let\}=\myrbrace \let\rbracechar=\} +\begingroup + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux/toc files. + \catcode`\{ = \other \catcode`\} = \other + \catcode`\[ = 1 \catcode`\] = 2 + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup + +% @comma{} to avoid , parsing problems. +\let\comma = , + +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. +\let\, = \ptexc +\let\dotaccent = \ptexdot +\def\ringaccent#1{{\accent23 #1}} +\let\tieaccent = \ptext +\let\ubaraccent = \ptexb +\let\udotaccent = \d + +% Other special characters: @questiondown @exclamdown @ordf @ordm +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. +\def\questiondown{?`} +\def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} + +% Dotless i and dotless j, used for accents. +\def\imacro{i} +\def\jmacro{j} +\def\dotless#1{% + \def\temp{#1}% + \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi + \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi + \else \errmessage{@dotless can be used only with i or j}% + \fi\fi +} + +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=1000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{% + \ifx\textnominalsize\xwordpt + % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX. + % Revert to plain's \scriptsize, which is 7pt. + \count255=\the\fam $\fam\count255 \scriptstyle A$% + \else + % For 11pt, we can use our lllsize. + \selectfonts\lllsize A% + \fi + }% + \vss + }}% + \kern-.15em + \TeX +} + +% Some math mode symbols. +\def\bullet{$\ptexbullet$} +\def\geq{\ifmmode \ge\else $\ge$\fi} +\def\leq{\ifmmode \le\else $\le$\fi} +\def\minus{\ifmmode -\else $-$\fi} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in the cm +% typewriter fonts as three actual period characters; on the other hand, +% in other typewriter fonts three periods are wider than 1.5em. So do +% whichever is larger. +% +\def\dots{% + \leavevmode + \setbox0=\hbox{...}% get width of three periods + \ifdim\wd0 > 1.5em + \dimen0 = \wd0 + \else + \dimen0 = 1.5em + \fi + \hbox to \dimen0{% + \hskip 0pt plus.25fil + .\hskip 0pt plus1fil + .\hskip 0pt plus1fil + .\hskip 0pt plus.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=\endofsentencespacefactor +} + +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% +% Since these characters are used in examples, they should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% +\def\point{$\star$} +\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} +\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} +\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} +\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} + +% The @error{} command. +% Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% +{\tentt \global\dimen0 = 3em}% Width of the box. +\dimen2 = .55pt % Thickness of rules +% The text. (`r' is open on the right, `e' somewhat less so on the left.) +\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} +% +\setbox\errorbox=\hbox to \dimen0{\hfil + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. + \advance\hsize by -2\dimen2 % Rules. + \vbox{% + \hrule height\dimen2 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. + \kern3pt\vrule width\dimen2}% Space to right. + \hrule height\dimen2} + \hfil} +% +\def\error{\leavevmode\lower.7ex\copy\errorbox} % @pounds{} is a sterling sign, which Knuth put in the CM italic font. % @@ -2075,49 +3047,113 @@ % Theiling, which support regular, slanted, bold and bold slanted (and % "outlined" (blackboard board, sort of) versions, which we don't need). % It is available from http://www.ctan.org/tex-archive/fonts/eurosym. -% +% % Although only regular is the truly official Euro symbol, we ignore % that. The Euro is designed to be slightly taller than the regular % font height. -% +% % feymr - regular % feymo - slanted % feybr - bold % feybo - bold slanted -% +% % There is no good (free) typewriter version, to my knowledge. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. % Hmm. -% +% % Also doesn't work in math. Do we need to do math with euro symbols? % Hope not. -% -% +% +% \def\euro{{\eurofont e}} \def\eurofont{% % We set the font at each command, rather than predefining it in % \textfonts and the other font-switching commands, so that % installations which never need the symbol don't have to have the % font installed. - % + % % There is only one designed size (nominal 10pt), so we always scale % that to the current nominal size. - % + % % By the way, simply using "at 1em" works for cmr10 and the like, but % does not work for cmbx10 and other extended/shrunken fonts. - % + % \def\eurosize{\csname\curfontsize nominalsize\endcsname}% % - \ifx\curfontstyle\bfstylename + \ifx\curfontstyle\bfstylename % bold: \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize - \else + \else % regular: \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize \fi \thiseurofont } +% Glyphs from the EC fonts. We don't use \let for the aliases, because +% sometimes we redefine the original macro, and the alias should reflect +% the redefinition. +% +% Use LaTeX names for the Icelandic letters. +\def\DH{{\ecfont \char"D0}} % Eth +\def\dh{{\ecfont \char"F0}} % eth +\def\TH{{\ecfont \char"DE}} % Thorn +\def\th{{\ecfont \char"FE}} % thorn +% +\def\guillemetleft{{\ecfont \char"13}} +\def\guillemotleft{\guillemetleft} +\def\guillemetright{{\ecfont \char"14}} +\def\guillemotright{\guillemetright} +\def\guilsinglleft{{\ecfont \char"0E}} +\def\guilsinglright{{\ecfont \char"0F}} +\def\quotedblbase{{\ecfont \char"12}} +\def\quotesinglbase{{\ecfont \char"0D}} +% +% This positioning is not perfect (see the ogonek LaTeX package), but +% we have the precomposed glyphs for the most common cases. We put the +% tests to use those glyphs in the single \ogonek macro so we have fewer +% dummy definitions to worry about for index entries, etc. +% +% ogonek is also used with other letters in Lithuanian (IOU), but using +% the precomposed glyphs for those is not so easy since they aren't in +% the same EC font. +\def\ogonek#1{{% + \def\temp{#1}% + \ifx\temp\macrocharA\Aogonek + \else\ifx\temp\macrochara\aogonek + \else\ifx\temp\macrocharE\Eogonek + \else\ifx\temp\macrochare\eogonek + \else + \ecfont \setbox0=\hbox{#1}% + \ifdim\ht0=1ex\accent"0C #1% + \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% + \fi + \fi\fi\fi\fi + }% +} +\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} +\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} +\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} +\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} +% +% Use the ec* fonts (cm-super in outline format) for non-CM glyphs. +\def\ecfont{% + % We can't distinguish serif/sans and italic/slanted, but this + % is used for crude hacks anyway (like adding French and German + % quotes to documents typeset with CM, where we lose kerning), so + % hopefully nobody will notice/care. + \edef\ecsize{\csname\curfontsize ecsize\endcsname}% + \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% + \ifx\curfontstyle\bfstylename + % bold: + \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize + \else + % regular: + \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize + \fi + \thisecfont +} + % @registeredsymbol - R in a circle. The font for the R should really % be smaller yet, but lllsize is the best we can do for now. % Adapted from the plain.tex definition of \copyright. @@ -2128,14 +3164,24 @@ }$% } +% @textdegree - the normal degrees sign. +% +\def\textdegree{$^\circ$} + % Laurent Siebenmann reports \Orb undefined with: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 % so we'll define it if necessary. -% -\ifx\Orb\undefined +% +\ifx\Orb\thisisundefined \def\Orb{\mathhexbox20D} \fi +% Quotes. +\chardef\quotedblleft="5C +\chardef\quotedblright=`\" +\chardef\quoteleft=`\` +\chardef\quoteright=`\' + \message{page headings,} @@ -2154,8 +3200,9 @@ \newif\ifsetshortcontentsaftertitlepage \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue -\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% - \endgroup\page\hbox{}\page} +\parseargdef\shorttitlepage{% + \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} \envdef\titlepage{% % Open one extra group, as we want to close it in the middle of \Etitlepage. @@ -2215,17 +3262,14 @@ \finishedtitlepagetrue } -%%% Macros to be used within @titlepage: +% Macros to be used within @titlepage: \let\subtitlerm=\tenrm \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} -\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines - \let\tt=\authortt} - \parseargdef\title{% \checkenv\titlepage - \leftline{\titlefonts\rm #1} + \leftline{\titlefonts\rmisbold #1} % print a rule at the page bottom also. \finishedtitlepagefalse \vskip4pt \hrule height 4pt width \hsize \vskip4pt @@ -2246,12 +3290,12 @@ \else \checkenv\titlepage \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi - {\authorfont \leftline{#1}}% + {\secfonts\rmisbold \leftline{#1}}% \fi } -%%% Set up page headings and footings. +% Set up page headings and footings. \let\thispage=\folio @@ -2299,12 +3343,39 @@ % % Leave some space for the footline. Hopefully ok to assume % @evenfooting will not be used by itself. - \global\advance\pageheight by -\baselineskip - \global\advance\vsize by -\baselineskip + \global\advance\pageheight by -12pt + \global\advance\vsize by -12pt } \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} +% @evenheadingmarks top \thischapter <- chapter at the top of a page +% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page +% +% The same set of arguments for: +% +% @oddheadingmarks +% @evenfootingmarks +% @oddfootingmarks +% @everyheadingmarks +% @everyfootingmarks + +\def\evenheadingmarks{\headingmarks{even}{heading}} +\def\oddheadingmarks{\headingmarks{odd}{heading}} +\def\evenfootingmarks{\headingmarks{even}{footing}} +\def\oddfootingmarks{\headingmarks{odd}{footing}} +\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} + \headingmarks{odd}{heading}{#1} } +\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} + \headingmarks{odd}{footing}{#1} } +% #1 = even/odd, #2 = heading/footing, #3 = top/bottom. +\def\headingmarks#1#2#3 {% + \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname + \global\expandafter\let\csname get#1#2marks\endcsname \temp +} + +\everyheadingmarks bottom +\everyfootingmarks bottom % @headings double turns headings on for double-sided printing. % @headings single turns headings on for single-sided printing. @@ -2318,10 +3389,14 @@ \def\headings #1 {\csname HEADINGS#1\endcsname} -\def\HEADINGSoff{% -\global\evenheadline={\hfil} \global\evenfootline={\hfil} -\global\oddheadline={\hfil} \global\oddfootline={\hfil}} -\HEADINGSoff +\def\headingsoff{% non-global headings elimination + \evenheadline={\hfil}\evenfootline={\hfil}% + \oddheadline={\hfil}\oddfootline={\hfil}% +} + +\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting +\HEADINGSoff % it's the default + % When we turn headings on, set the page number to 1. % For double-sided printing, put current file name in lower left corner, % chapter name on inside top of right hand pages, document @@ -2372,7 +3447,7 @@ % This produces Day Month Year style of output. % Only define if not already defined, in case a txi-??.tex file has set % up a different format (e.g., txi-cs.tex does this). -\ifx\today\undefined +\ifx\today\thisisundefined \def\today{% \number\day\space \ifcase\month @@ -2433,7 +3508,7 @@ \begingroup \advance\leftskip by-\tableindent \advance\hsize by\tableindent - \advance\rightskip by0pt plus1fil + \advance\rightskip by0pt plus1fil\relax \leavevmode\unhbox0\par \endgroup % @@ -2447,7 +3522,7 @@ % cause the example and the item to crash together. So we use this % bizarre value of 10001 as a signal to \aboveenvbreak to insert % \parskip glue after all. Section titles are handled this way also. - % + % \penalty 10001 \endgroup \itemxneedsnegativevskipfalse @@ -2541,9 +3616,18 @@ \parindent=0pt \parskip=\smallskipamount \ifdim\parskip=0pt \parskip=2pt \fi + % + % Try typesetting the item mark that if the document erroneously says + % something like @itemize @samp (intending @table), there's an error + % right away at the @itemize. It's not the best error message in the + % world, but it's better than leaving it to the @item. This means if + % the user wants an empty mark, they have to say @w{} not just @w. \def\itemcontents{#1}% + \setbox0 = \hbox{\itemcontents}% + % % @itemize with no arg is equivalent to @itemize @bullet. \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + % \let\item=\itemizeitem } @@ -2564,6 +3648,7 @@ \ifnum\lastpenalty<10000 \parskip=0in \fi \noindent \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + % \vadjust{\penalty 1200}}% not good to break after first line of item. \flushcr } @@ -2785,12 +3870,19 @@ % % @headitem starts a heading row, which we typeset in bold. % Assignments have to be global since we are inside the implicit group -% of an alignment entry. Note that \everycr resets \everytab. -\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% +% of an alignment entry. \everycr resets \everytab so we don't have to +% undo it ourselves. +\def\headitemfont{\b}% for people to use in the template row; not changeable +\def\headitem{% + \checkenv\multitable + \crcr + \global\everytab={\bf}% can't use \headitemfont since the parsing differs + \the\everytab % for the first item +}% % % A \tab used to include \hskip1sp. But then the space in a template % line is not enough. That is bad. So let's go back to just `&' until -% we encounter the problem it was intended to solve again. +% we again encounter the problem the 1sp was intended to solve. % --karl, nathan at acm.org, 20apr99. \def\tab{\checkenv\multitable &\the\everytab}% @@ -2902,18 +3994,18 @@ \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip \global\advance\multitablelinespace by-\ht0 \fi -%% Test to see if parskip is larger than space between lines of -%% table. If not, do nothing. -%% If so, set to same dimension as multitablelinespace. +% Test to see if parskip is larger than space between lines of +% table. If not, do nothing. +% If so, set to same dimension as multitablelinespace. \ifdim\multitableparskip>\multitablelinespace \global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. +\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller + % than skip between lines in the table. \fi% \ifdim\multitableparskip=0pt \global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. +\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller + % than skip between lines in the table. \fi} @@ -2959,6 +4051,7 @@ \def\doignore#1{\begingroup % Scan in ``verbatim'' mode: + \obeylines \catcode`\@ = \other \catcode`\{ = \other \catcode`\} = \other @@ -2979,16 +4072,16 @@ \gdef\dodoignore#1{% % #1 contains the command name as a string, e.g., `ifinfo'. % - % Define a command to find the next `@end #1', which must be on a line - % by itself. - \long\def\doignoretext##1^^M at end #1{\doignoretextyyy##1^^M@#1\_STOP_}% + % Define a command to find the next `@end #1'. + \long\def\doignoretext##1^^M at end #1{% + \doignoretextyyy##1^^M@#1\_STOP_}% + % % And this command to find another #1 command, at the beginning of a % line. (Otherwise, we would consider a line `@c @ifset', for % example, to count as an @ifset for nesting.) \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% % % And now expand that command. - \obeylines % \doignoretext ^^M% }% } @@ -3018,7 +4111,12 @@ } % Finish off ignored text. -\def\enddoignore{\endgroup\ignorespaces} +{ \obeylines% + % Ignore anything after the last `@end #1'; this matters in verbatim + % environments, where otherwise the newline after an ignored conditional + % would result in a blank line in the output. + \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% +} % @set VAR sets the variable VAR to an empty value. @@ -3183,11 +4281,11 @@ \def\dosynindex#1#2#3{% % Only do \closeout if we haven't already done it, else we'll end up % closing the target index. - \expandafter \ifx\csname donesynindex#2\endcsname \undefined + \expandafter \ifx\csname donesynindex#2\endcsname \relax % The \closeout helps reduce unnecessary open files; the limit on the % Acorn RISC OS is a mere 16 files. \expandafter\closeout\csname#2indfile\endcsname - \expandafter\let\csname\donesynindex#2\endcsname = 1 + \expandafter\let\csname donesynindex#2\endcsname = 1 \fi % redefine \fooindfile: \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname @@ -3221,11 +4319,41 @@ \escapechar = `\\ % use backslash in output files. \def\@{@}% change to @@ when we switch to @ as escape char in index files. \def\ {\realbackslash\space }% - % Need these in case \tex is in effect and \{ is a \delimiter again. - % But can't use \lbracecmd and \rbracecmd because texindex assumes - % braces and backslashes are used only as delimiters. - \let\{ = \mylbrace - \let\} = \myrbrace + % + % Need these unexpandable (because we define \tt as a dummy) + % definitions when @{ or @} appear in index entry text. Also, more + % complicated, when \tex is in effect and \{ is a \delimiter again. + % We can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. Perhaps we + % should define @lbrace and @rbrace commands a la @comma. + \def\{{{\tt\char123}}% + \def\}{{\tt\char125}}% + % + % I don't entirely understand this, but when an index entry is + % generated from a macro call, the \endinput which \scanmacro inserts + % causes processing to be prematurely terminated. This is, + % apparently, because \indexsorttmp is fully expanded, and \endinput + % is an expandable command. The redefinition below makes \endinput + % disappear altogether for that purpose -- although logging shows that + % processing continues to some further point. On the other hand, it + % seems \endinput does not hurt in the printed index arg, since that + % is still getting written without apparent harm. + % + % Sample source (mac-idx3.tex, reported by Graham Percival to + % help-texinfo, 22may06): + % @macro funindex {WORD} + % @findex xyz + % @end macro + % ... + % @funindex commtest + % + % The above is not enough to reproduce the bug, but it gives the flavor. + % + % Sample whatsit resulting: + % . at write3{\entry{xyz}{@folio }{@code {xyz at endinput }}} + % + % So: + \let\endinput = \empty % % Do the redefinitions. \commondummies @@ -3244,6 +4372,7 @@ % % Do the redefinitions. \commondummies + \otherbackslash } % Called from \indexdummies and \atdummies. @@ -3251,7 +4380,7 @@ \def\commondummies{% % % \definedummyword defines \#1 as \string\#1\space, thus effectively - % preventing its expansion. This is used only for control% words, + % preventing its expansion. This is used only for control words, % not control letters, because the \space would be incorrect for % control characters, but is needed to separate the control word % from whatever follows. @@ -3270,23 +4399,28 @@ \commondummiesnofonts % \definedummyletter\_% + \definedummyletter\-% % % Non-English letters. \definedummyword\AA \definedummyword\AE + \definedummyword\DH \definedummyword\L + \definedummyword\O \definedummyword\OE - \definedummyword\O + \definedummyword\TH \definedummyword\aa \definedummyword\ae + \definedummyword\dh + \definedummyword\exclamdown \definedummyword\l + \definedummyword\o \definedummyword\oe - \definedummyword\o - \definedummyword\ss - \definedummyword\exclamdown - \definedummyword\questiondown \definedummyword\ordf \definedummyword\ordm + \definedummyword\questiondown + \definedummyword\ss + \definedummyword\th % % Although these internal commands shouldn't show up, sometimes they do. \definedummyword\bf @@ -3302,21 +4436,39 @@ \definedummyword\TeX % % Assorted special characters. + \definedummyword\arrow \definedummyword\bullet \definedummyword\comma \definedummyword\copyright \definedummyword\registeredsymbol \definedummyword\dots \definedummyword\enddots + \definedummyword\entrybreak \definedummyword\equiv \definedummyword\error \definedummyword\euro \definedummyword\expansion + \definedummyword\geq + \definedummyword\guillemetleft + \definedummyword\guillemetright + \definedummyword\guilsinglleft + \definedummyword\guilsinglright + \definedummyword\lbracechar + \definedummyword\leq \definedummyword\minus + \definedummyword\ogonek \definedummyword\pounds \definedummyword\point \definedummyword\print + \definedummyword\quotedblbase + \definedummyword\quotedblleft + \definedummyword\quotedblright + \definedummyword\quoteleft + \definedummyword\quoteright + \definedummyword\quotesinglbase + \definedummyword\rbracechar \definedummyword\result + \definedummyword\textdegree % % We want to disable all macros so that they are not expanded by \write. \macrolist @@ -3330,63 +4482,72 @@ % \commondummiesnofonts: common to \commondummies and \indexnofonts. % -% Better have this without active chars. -{ - \catcode`\~=\other - \gdef\commondummiesnofonts{% - % Control letters and accents. - \definedummyletter\!% - \definedummyaccent\"% - \definedummyaccent\'% - \definedummyletter\*% - \definedummyaccent\,% - \definedummyletter\.% - \definedummyletter\/% - \definedummyletter\:% - \definedummyaccent\=% - \definedummyletter\?% - \definedummyaccent\^% - \definedummyaccent\`% - \definedummyaccent\~% - \definedummyword\u - \definedummyword\v - \definedummyword\H - \definedummyword\dotaccent - \definedummyword\ringaccent - \definedummyword\tieaccent - \definedummyword\ubaraccent - \definedummyword\udotaccent - \definedummyword\dotless - % - % Texinfo font commands. - \definedummyword\b - \definedummyword\i - \definedummyword\r - \definedummyword\sc - \definedummyword\t - % - % Commands that take arguments. - \definedummyword\acronym - \definedummyword\cite - \definedummyword\code - \definedummyword\command - \definedummyword\dfn - \definedummyword\emph - \definedummyword\env - \definedummyword\file - \definedummyword\kbd - \definedummyword\key - \definedummyword\math - \definedummyword\option - \definedummyword\samp - \definedummyword\strong - \definedummyword\tie - \definedummyword\uref - \definedummyword\url - \definedummyword\var - \definedummyword\verb - \definedummyword\w - } +\def\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter\!% + \definedummyaccent\"% + \definedummyaccent\'% + \definedummyletter\*% + \definedummyaccent\,% + \definedummyletter\.% + \definedummyletter\/% + \definedummyletter\:% + \definedummyaccent\=% + \definedummyletter\?% + \definedummyaccent\^% + \definedummyaccent\`% + \definedummyaccent\~% + \definedummyword\u + \definedummyword\v + \definedummyword\H + \definedummyword\dotaccent + \definedummyword\ogonek + \definedummyword\ringaccent + \definedummyword\tieaccent + \definedummyword\ubaraccent + \definedummyword\udotaccent + \definedummyword\dotless + % + % Texinfo font commands. + \definedummyword\b + \definedummyword\i + \definedummyword\r + \definedummyword\sansserif + \definedummyword\sc + \definedummyword\slanted + \definedummyword\t + % + % Commands that take arguments. + \definedummyword\abbr + \definedummyword\acronym + \definedummyword\anchor + \definedummyword\cite + \definedummyword\code + \definedummyword\command + \definedummyword\dfn + \definedummyword\dmn + \definedummyword\email + \definedummyword\emph + \definedummyword\env + \definedummyword\file + \definedummyword\image + \definedummyword\indicateurl + \definedummyword\inforef + \definedummyword\kbd + \definedummyword\key + \definedummyword\math + \definedummyword\option + \definedummyword\pxref + \definedummyword\ref + \definedummyword\samp + \definedummyword\strong + \definedummyword\tie + \definedummyword\uref + \definedummyword\url + \definedummyword\var + \definedummyword\verb + \definedummyword\w + \definedummyword\xref } % \indexnofonts is used when outputting the strings to sort the index @@ -3399,7 +4560,7 @@ \def\definedummyaccent##1{\let##1\asis}% % We can just ignore other control letters. \def\definedummyletter##1{\let##1\empty}% - % Hopefully, all control words can become @asis. + % All control words become @asis by default; overrides below. \let\definedummyword\definedummyaccent % \commondummiesnofonts @@ -3411,60 +4572,95 @@ % \def\ { }% \def\@{@}% - % how to handle braces? \def\_{\normalunderscore}% + \def\-{}% @- shouldn't affect sorting + % + % Unfortunately, texindex is not prepared to handle braces in the + % content at all. So for index sorting, we map @{ and @} to strings + % starting with |, since that ASCII character is between ASCII { and }. + \def\{{|a}% + \def\lbracechar{|a}% + % + \def\}{|b}% + \def\rbracechar{|b}% % % Non-English letters. \def\AA{AA}% \def\AE{AE}% + \def\DH{DZZ}% \def\L{L}% \def\OE{OE}% \def\O{O}% + \def\TH{ZZZ}% \def\aa{aa}% \def\ae{ae}% + \def\dh{dzz}% + \def\exclamdown{!}% \def\l{l}% \def\oe{oe}% - \def\o{o}% - \def\ss{ss}% - \def\exclamdown{!}% - \def\questiondown{?}% \def\ordf{a}% \def\ordm{o}% + \def\o{o}% + \def\questiondown{?}% + \def\ss{ss}% + \def\th{zzz}% % \def\LaTeX{LaTeX}% \def\TeX{TeX}% % % Assorted special characters. % (The following {} will end up in the sort string, but that's ok.) + \def\arrow{->}% \def\bullet{bullet}% \def\comma{,}% \def\copyright{copyright}% - \def\registeredsymbol{R}% \def\dots{...}% \def\enddots{...}% \def\equiv{==}% \def\error{error}% \def\euro{euro}% \def\expansion{==>}% + \def\geq{>=}% + \def\guillemetleft{<<}% + \def\guillemetright{>>}% + \def\guilsinglleft{<}% + \def\guilsinglright{>}% + \def\leq{<=}% \def\minus{-}% + \def\point{.}% \def\pounds{pounds}% - \def\point{.}% \def\print{-|}% + \def\quotedblbase{"}% + \def\quotedblleft{"}% + \def\quotedblright{"}% + \def\quoteleft{`}% + \def\quoteright{'}% + \def\quotesinglbase{,}% + \def\registeredsymbol{R}% \def\result{=>}% + \def\textdegree{o}% + % + \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax + \else \indexlquoteignore \fi % % We need to get rid of all macros, leaving only the arguments (if present). % Of course this is not nearly correct, but it is the best we can do for now. % makeinfo does not expand macros in the argument to @deffn, which ends up % writing an index entry, and texindex isn't prepared for an index sort entry % that starts with \. - % + % % Since macro invocations are followed by braces, we can just redefine them % to take a single TeX argument. The case of a macro invocation that % goes to end-of-line is not handled. - % + % \macrolist } +% Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us +% ignore left quotes in the sort term. +{\catcode`\`=\active + \gdef\indexlquoteignore{\let`=\empty}} + \let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? @@ -3490,11 +4686,7 @@ % \edef\writeto{\csname#1indfile\endcsname}% % - \ifvmode - \dosubindsanitize - \else - \dosubindwrite - \fi + \safewhatsit\dosubindwrite }% \fi } @@ -3531,13 +4723,13 @@ \temp } -% Take care of unwanted page breaks: +% Take care of unwanted page breaks/skips around a whatsit: % % If a skip is the last thing on the list now, preserve it % by backing up by \lastskip, doing the \write, then inserting % the skip again. Otherwise, the whatsit generated by the -% \write will make \lastskip zero. The result is that sequences -% like this: +% \write or \pdfdest will make \lastskip zero. The result is that +% sequences like this: % @end defun % @tindex whatever % @defun ... @@ -3561,25 +4753,30 @@ % \edef\zeroskipmacro{\expandafter\the\csname z at skip\endcsname} % +\newskip\whatsitskip +\newcount\whatsitpenalty +% % ..., ready, GO: % -\def\dosubindsanitize{% +\def\safewhatsit#1{\ifhmode + #1% + \else % \lastskip and \lastpenalty cannot both be nonzero simultaneously. - \skip0 = \lastskip + \whatsitskip = \lastskip \edef\lastskipmacro{\the\lastskip}% - \count255 = \lastpenalty + \whatsitpenalty = \lastpenalty % % If \lastskip is nonzero, that means the last item was a % skip. And since a skip is discardable, that means this - % -\skip0 glue we're inserting is preceded by a + % -\whatsitskip glue we're inserting is preceded by a % non-discardable item, therefore it is not a potential % breakpoint, therefore no \nobreak needed. \ifx\lastskipmacro\zeroskipmacro \else - \vskip-\skip0 + \vskip-\whatsitskip \fi % - \dosubindwrite + #1% % \ifx\lastskipmacro\zeroskipmacro % If \lastskip was zero, perhaps the last item was a penalty, and @@ -3587,20 +4784,19 @@ % to re-insert the same penalty (values >10000 are used for various % signals); since we just inserted a non-discardable item, any % following glue (such as a \parskip) would be a breakpoint. For example: - % % @deffn deffn-whatever % @vindex index-whatever % Description. % would allow a break between the index-whatever whatsit % and the "Description." paragraph. - \ifnum\count255>9999 \penalty\count255 \fi + \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi \else % On the other hand, if we had a nonzero \lastskip, % this make-up glue would be preceded by a non-discardable item % (the whatsit from the \write), so we must insert a \nobreak. - \nobreak\vskip\skip0 + \nobreak\vskip\whatsitskip \fi -} +\fi} % The index entry written in the file actually looks like % \entry {sortstring}{page}{topic} @@ -3642,6 +4838,7 @@ % \smallfonts \rm \tolerance = 9500 + \plainfrenchspacing \everypar = {}% don't want the \kern\-parindent from indentation suppression. % % See if the index file exists and is nonempty. @@ -3715,10 +4912,9 @@ % % A straightforward implementation would start like this: % \def\entry#1#2{... -% But this frozes the catcodes in the argument, and can cause problems to +% But this freezes the catcodes in the argument, and can cause problems to % @code, which sets - active. This problem was fixed by a kludge--- % ``-'' was active throughout whole index, but this isn't really right. -% % The right solution is to prevent \entry from swallowing the whole text. % --kasal, 21nov03 \def\entry{% @@ -3755,10 +4951,17 @@ % columns. \vskip 0pt plus1pt % + % When reading the text of entry, convert explicit line breaks + % from @* into spaces. The user might give these in long section + % titles, for instance. + \def\*{\unskip\space\ignorespaces}% + \def\entrybreak{\hfil\break}% + % % Swallow the left brace of the text (first parameter): \afterassignment\doentry \let\temp = } +\def\entrybreak{\unskip\space\ignorespaces}% \def\doentry{% \bgroup % Instead of the swallowed brace. \noindent @@ -3771,11 +4974,8 @@ % The following is kludged to not output a line of dots in the index if % there are no page numbers. The next person who breaks this will be % cursed by a Unix daemon. - \def\tempa{{\rm }}% - \def\tempb{#1}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd + \setbox\boxA = \hbox{#1}% + \ifdim\wd\boxA = 0pt \ % \else % @@ -3799,9 +4999,9 @@ \endgroup } -% Like \dotfill except takes at least 1 em. +% Like plain.tex's \dotfill, except uses up at least 1 em. \def\indexdotfill{\cleaders - \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} + \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} \def\primary #1{\line{#1\hfil}} @@ -3911,6 +5111,34 @@ % % All done with double columns. \def\enddoublecolumns{% + % The following penalty ensures that the page builder is exercised + % _before_ we change the output routine. This is necessary in the + % following situation: + % + % The last section of the index consists only of a single entry. + % Before this section, \pagetotal is less than \pagegoal, so no + % break occurs before the last section starts. However, the last + % section, consisting of \initial and the single \entry, does not + % fit on the page and has to be broken off. Without the following + % penalty the page builder will not be exercised until \eject + % below, and by that time we'll already have changed the output + % routine to the \balancecolumns version, so the next-to-last + % double-column page will be processed with \balancecolumns, which + % is wrong: The two columns will go to the main vertical list, with + % the broken-off section in the recent contributions. As soon as + % the output routine finishes, TeX starts reconsidering the page + % break. The two columns and the broken-off section both fit on the + % page, because the two columns now take up only half of the page + % goal. When TeX sees \eject from below which follows the final + % section, it invokes the new output routine that we've set after + % \balancecolumns below; \onepageout will try to fit the two columns + % and the final section into the vbox of \pageheight (see + % \pagebody), causing an overfull box. + % + % Note that glue won't work here, because glue does not exercise the + % page builder, unlike penalties (see The TeXbook, pp. 280-281). + \penalty0 + % \output = {% % Split the last of the double-column material. Leave it on the % current page, no automatic page break. @@ -3966,7 +5194,22 @@ \message{sectioning,} % Chapters, sections, etc. -% \unnumberedno is an oxymoron, of course. But we count the unnumbered +% Let's start with @part. +\outer\parseargdef\part{\partzzz{#1}} +\def\partzzz#1{% + \chapoddpage + \null + \vskip.3\vsize % move it down on the page a bit + \begingroup + \noindent \titlefonts\rmisbold #1\par % the text + \let\lastnode=\empty % no node to associate with + \writetocentry{part}{#1}{}% but put it in the toc + \headingsoff % no headline or footline on the part page + \chapoddpage + \endgroup +} + +% \unnumberedno is an oxymoron. But we count the unnumbered % sections so that we can refer to them unambiguously in the pdf % outlines by their "section number". We avoid collisions with chapter % numbers by starting them at 10000. (If a document ever has 10000 @@ -4020,11 +5263,15 @@ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} -% Each @chapter defines this as the name of the chapter. -% page headings and footings can use it. @section does likewise. -% However, they are not reliable, because we don't use marks. +% Each @chapter defines these (using marks) as the number+name, number +% and name of the chapter. Page headings and footings can use +% these. @section does likewise. \def\thischapter{} +\def\thischapternum{} +\def\thischaptername{} \def\thissection{} +\def\thissectionnum{} +\def\thissectionname{} \newcount\absseclevel % used to calculate proper heading level \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count @@ -4041,8 +5288,8 @@ \chardef\maxseclevel = 3 % % A numbered section within an unnumbered changes to unnumbered too. -% To achive this, remember the "biggest" unnum. sec. we are currently in: -\chardef\unmlevel = \maxseclevel +% To achieve this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unnlevel = \maxseclevel % % Trace whether the current chapter is an appendix or not: % \chapheadtype is "N" or "A", unnumbered chapters are ignored. @@ -4067,8 +5314,8 @@ % The heading type: \def\headtype{#1}% \if \headtype U% - \ifnum \absseclevel < \unmlevel - \chardef\unmlevel = \absseclevel + \ifnum \absseclevel < \unnlevel + \chardef\unnlevel = \absseclevel \fi \else % Check for appendix sections: @@ -4080,10 +5327,10 @@ \fi\fi \fi % Check for numbered within unnumbered: - \ifnum \absseclevel > \unmlevel + \ifnum \absseclevel > \unnlevel \def\headtype{U}% \else - \chardef\unmlevel = 3 + \chardef\unnlevel = 3 \fi \fi % Now print the heading: @@ -4137,7 +5384,9 @@ \gdef\chaplevelprefix{\the\chapno.}% \resetallfloatnos % - \message{\putwordChapter\space \the\chapno}% + % \putwordChapter can contain complex things in translations. + \toks0=\expandafter{\putwordChapter}% + \message{\the\toks0 \space \the\chapno}% % % Write the actual heading. \chapmacro{#1}{Ynumbered}{\the\chapno}% @@ -4148,15 +5397,17 @@ \global\let\subsubsection = \numberedsubsubsec } -\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz +\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz +% \def\appendixzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\appendixno by 1 \gdef\chaplevelprefix{\appendixletter.}% \resetallfloatnos % - \def\appendixnum{\putwordAppendix\space \appendixletter}% - \message{\appendixnum}% + % \putwordAppendix can contain complex things in translations. + \toks0=\expandafter{\putwordAppendix}% + \message{\the\toks0 \space \appendixletter}% % \chapmacro{#1}{Yappendix}{\appendixletter}% % @@ -4165,7 +5416,8 @@ \global\let\subsubsection = \appendixsubsubsec } -\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz +% normally unnmhead0 calls unnumberedzzz: +\outer\parseargdef\unnumbered{\unnmhead0{#1}} \def\unnumberedzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\unnumberedno by 1 @@ -4209,40 +5461,47 @@ \let\top\unnumbered % Sections. +% \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz \def\seczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% } -\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz +% normally calls appendixsectionzzz: +\outer\parseargdef\appendixsection{\apphead1{#1}} \def\appendixsectionzzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% } \let\appendixsec\appendixsection -\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz +% normally calls unnumberedseczzz: +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} \def\unnumberedseczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% } % Subsections. -\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz +% +% normally calls numberedsubseczzz: +\outer\parseargdef\numberedsubsec{\numhead2{#1}} \def\numberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% } -\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz +% normally calls appendixsubseczzz: +\outer\parseargdef\appendixsubsec{\apphead2{#1}} \def\appendixsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno}% } -\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz +% normally calls unnumberedsubseczzz: +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} \def\unnumberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynothing}% @@ -4250,21 +5509,25 @@ } % Subsubsections. -\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz +% +% normally numberedsubsubseczzz: +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} \def\numberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynumbered}% {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% } -\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz +% normally appendixsubsubseczzz: +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} \def\appendixsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% } -\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz +% normally unnumberedsubsubseczzz: +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} \def\unnumberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynothing}% @@ -4288,7 +5551,6 @@ % 3) Likewise, headings look best if no \parindent is used, and % if justification is not attempted. Hence \raggedright. - \def\majorheading{% {\advance\chapheadingskip by 10pt \chapbreak }% \parsearg\chapheadingzzz @@ -4297,8 +5559,8 @@ \def\chapheading{\chapbreak \parsearg\chapheadingzzz} \def\chapheadingzzz#1{% {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}% + \parindent=0pt\ptexraggedright + \rmisbold #1\hfill}}% \bigskip \par\penalty 200\relax \suppressfirstparagraphindent } @@ -4315,17 +5577,28 @@ % (including whitespace, linebreaking, etc. around it), % given all the information in convenient, parsed form. -%%% Args are the skip and penalty (usually negative) +% Args are the skip and penalty (usually negative) \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} -%%% Define plain chapter starts, and page on/off switching for it % Parameter controlling skip before chapter headings (if needed) - \newskip\chapheadingskip +% Define plain chapter starts, and page on/off switching for it. \def\chapbreak{\dobreak \chapheadingskip {-4000}} \def\chappager{\par\vfill\supereject} -\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} +% Because \domark is called before \chapoddpage, the filler page will +% get the headings for the next chapter, which is wrong. But we don't +% care -- we just disable all headings on the filler page. +\def\chapoddpage{% + \chappager + \ifodd\pageno \else + \begingroup + \headingsoff + \null + \chappager + \endgroup + \fi +} \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} @@ -4359,41 +5632,78 @@ \def\Yappendixkeyword{Yappendix} % \def\chapmacro#1#2#3{% + % Insert the first mark before the heading break (see notes for \domark). + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% + \gdef\thissection{}}% + % + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{\thischaptername}}% + \else\ifx\temptype\Yomitfromtockeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{}}% + \else\ifx\temptype\Yappendixkeyword + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\appendixletter}% + % \noexpand\putwordAppendix avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thischapter{\noexpand\putwordAppendix{} + \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \else + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\the\chapno}% + % \noexpand\putwordChapter avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thischapter{\noexpand\putwordChapter{} + \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \fi\fi\fi + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark + % + % Insert the chapter heading break. \pchapsepmacro + % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \domark + % {% - \chapfonts \rm + \chapfonts \rmisbold % - % Have to define \thissection before calling \donoderef, because the + % Have to define \lastsection before calling \donoderef, because the % xref code eventually uses it. On the other hand, it has to be called % after \pchapsepmacro, or the headline will change too soon. - \gdef\thissection{#1}% - \gdef\thischaptername{#1}% + \gdef\lastsection{#1}% % % Only insert the separating space if we have a chapter/appendix % number, and don't print the unnumbered ``number''. - \def\temptype{#2}% \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unnchap}% - \gdef\thischapter{#1}% \else\ifx\temptype\Yomitfromtockeyword \setbox0 = \hbox{}% contents like unnumbered, but no toc entry \def\toctype{omit}% - \gdef\thischapter{}% \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% \def\toctype{app}% - % We don't substitute the actual chapter name into \thischapter - % because we don't want its macros evaluated now. And we don't - % use \thissection because that changes with each section. - % - \xdef\thischapter{\putwordAppendix{} \appendixletter: - \noexpand\thischaptername}% \else \setbox0 = \hbox{#3\enspace}% \def\toctype{numchap}% - \xdef\thischapter{\putwordChapter{} \the\chapno: - \noexpand\thischaptername}% \fi\fi\fi % % Write the toc entry for this chapter. Must come before the @@ -4409,7 +5719,8 @@ \donoderef{#2}% % % Typeset the actual heading. - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \nobreak % Avoid page breaks at the interline glue. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright \hangindent=\wd0 \centerparametersmaybe \unhbox0 #1\par}% }% @@ -4433,8 +5744,8 @@ % \def\unnchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\nobreak + \parindent=0pt\ptexraggedright + \rmisbold #1\hfill}}\bigskip \par\nobreak } \def\chfopen #1#2{\chapoddpage {\chapfonts \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% @@ -4443,7 +5754,7 @@ \def\centerchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt - \hfill {\rm #1}\hfill}}\bigskip \par\nobreak + \hfill {\rmisbold #1}\hfill}}\bigskip \par\nobreak } \def\CHAPFopen{% \global\let\chapmacro=\chfopen @@ -4471,47 +5782,110 @@ % the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the % section number. % +\def\seckeyword{sec} +% \def\sectionheading#1#2#3#4{% {% + \checkenv{}% should not be in an environment. + % % Switch to the right set of fonts. - \csname #2fonts\endcsname \rm + \csname #2fonts\endcsname \rmisbold + % + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + % Insert first mark before the heading break (see notes for \domark). + \let\prevsectiondefs=\lastsectiondefs + \ifx\temptype\Ynothingkeyword + \ifx\sectionlevel\seckeyword + \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% + \gdef\thissection{\thissectionname}}% + \fi + \else\ifx\temptype\Yomitfromtockeyword + % Don't redefine \thissection. + \else\ifx\temptype\Yappendixkeyword + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + % \noexpand\putwordSection avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thissection{\noexpand\putwordSection{} + \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \else + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + % \noexpand\putwordSection avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thissection{\noexpand\putwordSection{} + \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \fi\fi\fi + % + % Go into vertical mode. Usually we'll already be there, but we + % don't want the following whatsit to end up in a preceding paragraph + % if the document didn't happen to have a blank line. + \par + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark % % Insert space above the heading. \csname #2headingbreak\endcsname % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevsectiondefs=\lastsectiondefs + \domark + % % Only insert the space after the number if we have a section number. - \def\sectionlevel{#2}% - \def\temptype{#3}% - % \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unn}% - \gdef\thissection{#1}% + \gdef\lastsection{#1}% \else\ifx\temptype\Yomitfromtockeyword % for @headings -- no section number, don't include in toc, - % and don't redefine \thissection. + % and don't redefine \lastsection. \setbox0 = \hbox{}% \def\toctype{omit}% \let\sectionlevel=\empty \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{#4\enspace}% \def\toctype{app}% - \gdef\thissection{#1}% + \gdef\lastsection{#1}% \else \setbox0 = \hbox{#4\enspace}% \def\toctype{num}% - \gdef\thissection{#1}% + \gdef\lastsection{#1}% \fi\fi\fi % - % Write the toc entry (before \donoderef). See comments in \chfplain. + % Write the toc entry (before \donoderef). See comments in \chapmacro. \writetocentry{\toctype\sectionlevel}{#1}{#4}% % % Write the node reference (= pdf destination for pdftex). - % Again, see comments in \chfplain. + % Again, see comments in \chapmacro. \donoderef{#3}% % + % Interline glue will be inserted when the vbox is completed. + % That glue will be a valid breakpoint for the page, since it'll be + % preceded by a whatsit (usually from the \donoderef, or from the + % \writetocentry if there was no node). We don't want to allow that + % break, since then the whatsits could end up on page n while the + % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. + \nobreak + % % Output the actual section heading. - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright \hangindent=\wd0 % zero if no section number \unhbox0 #1}% }% @@ -4525,15 +5899,15 @@ % % We'll almost certainly start a paragraph next, so don't let that % glue accumulate. (Not a breakpoint because it's preceded by a - % discardable item.) + % discardable item.) However, when a paragraph is not started next + % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out + % or the negative glue will cause weirdly wrong output, typically + % obscuring the section heading with something else. \vskip-\parskip - % - % This is purely so the last item on the list is a known \penalty > - % 10000. This is so \startdefun can avoid allowing breakpoints after - % section headings. Otherwise, it would insert a valid breakpoint between: - % - % @section sec-whatever - % @deffn def-whatever + % + % This is so the last item on the main vertical list is a known + % \penalty > 10000, so \startdefun, etc., can recognize the situation + % and do the needful. \penalty 10001 } @@ -4572,7 +5946,7 @@ \edef\temp{% \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% \temp - } + }% \fi \fi % @@ -4589,7 +5963,7 @@ % These characters do not print properly in the Computer Modern roman % fonts, so we must take special care. This is more or less redundant % with the Texinfo input format setup at the end of this file. -% +% \def\activecatcodes{% \catcode`\"=\active \catcode`\$=\active @@ -4607,7 +5981,7 @@ \def\readtocfile{% \setupdatafile \activecatcodes - \input \jobname.toc + \input \tocreadfilename } \newskip\contentsrightmargin \contentsrightmargin=1in @@ -4626,7 +6000,6 @@ % % Don't need to put `Contents' or `Short Contents' in the headline. % It is abundantly clear what they are. - \def\thischapter{}% \chapmacro{#1}{Yomitfromtoc}{}% % \savepageno = \pageno @@ -4638,11 +6011,16 @@ \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi } +% redefined for the two-volume lispref. We always output on +% \jobname.toc even if this is redefined. +% +\def\tocreadfilename{\jobname.toc} % Normal (long) toc. +% \def\contents{% \startcontents{\putwordTOC}% - \openin 1 \jobname.toc + \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi @@ -4661,6 +6039,7 @@ \def\summarycontents{% \startcontents{\putwordShortTOC}% % + \let\partentry = \shortpartentry \let\numchapentry = \shortchapentry \let\appentry = \shortchapentry \let\unnchapentry = \shortunnchapentry @@ -4680,7 +6059,7 @@ \let\numsubsubsecentry = \numsecentry \let\appsubsubsecentry = \numsecentry \let\unnsubsubsecentry = \numsecentry - \openin 1 \jobname.toc + \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi @@ -4716,6 +6095,19 @@ % The last argument is the page number. % The arguments in between are the chapter number, section number, ... +% Parts, in the main contents. Replace the part number, which doesn't +% exist, with an empty box. Let's hope all the numbers have the same width. +% Also ignore the page number, which is conventionally not printed. +\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} +\def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}} +% +% Parts, in the short toc. +\def\shortpartentry#1#2#3#4{% + \penalty-300 + \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip + \shortchapentry{{\bf #1}}{\numeralbox}{}{}% +} + % Chapters, in the main contents. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} % @@ -4805,45 +6197,12 @@ \message{environments,} % @foo ... @end foo. -% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. -% -% Since these characters are used in examples, it should be an even number of -% \tt widths. Each \tt character is 1en, so two makes it 1em. -% -\def\point{$\star$} -\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} -\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} -\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} -\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} - -% The @error{} command. -% Adapted from the TeXbook's \boxit. -% -\newbox\errorbox -% -{\tentt \global\dimen0 = 3em}% Width of the box. -\dimen2 = .55pt % Thickness of rules -% The text. (`r' is open on the right, `e' somewhat less so on the left.) -\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} -% -\setbox\errorbox=\hbox to \dimen0{\hfil - \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. - \advance\hsize by -2\dimen2 % Rules. - \vbox{% - \hrule height\dimen2 - \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. - \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. - \kern3pt\vrule width\dimen2}% Space to right. - \hrule height\dimen2} - \hfil} -% -\def\error{\leavevmode\lower.7ex\copy\errorbox} - -% @tex ... @end tex escapes into raw Tex temporarily. +% @tex ... @end tex escapes into raw TeX temporarily. % One exception: @ is still an escape character, so that @end tex works. -% But \@ or @@ will get a plain tex @ character. +% But \@ or @@ will get a plain @ character. \envdef\tex{% + \setupmarkupstyle{tex}% \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie @@ -4853,8 +6212,14 @@ \catcode `\|=\other \catcode `\<=\other \catcode `\>=\other + \catcode`\`=\other + \catcode`\'=\other \escapechar=`\\ % + % ' is active in math mode (mathcode"8000). So reset it, and all our + % other math active characters (just in case), to plain's definitions. + \mathactive + % \let\b=\ptexb \let\bullet=\ptexbullet \let\c=\ptexc @@ -4872,6 +6237,7 @@ \let\/=\ptexslash \let\*=\ptexstar \let\t=\ptext + \expandafter \let\csname top\endcsname=\ptextop % outer \let\frenchspacing=\plainfrenchspacing % \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% @@ -4957,6 +6323,12 @@ \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip % Flag to tell @lisp, etc., not to narrow margin. \let\nonarrowing = t% + % + % If this cartouche directly follows a sectioning command, we need the + % \parskip glue (backspaced over by default) or the cartouche can + % collide with the section heading. + \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi + % \vbox\bgroup \baselineskip=0pt\parskip=0pt\lineskip=0pt \carttop @@ -4970,7 +6342,7 @@ \lineskip=\normlskip \parskip=\normpskip \vskip -\parskip - \comment % For explanation, see the end of \def\group. + \comment % For explanation, see the end of def\group. } \def\Ecartouche{% \ifhmode\par\fi @@ -4987,6 +6359,7 @@ % This macro is called at the beginning of all the @example variants, % inside a group. +\newdimen\nonfillparindent \def\nonfillstart{% \aboveenvbreak \hfuzz = 12pt % Don't be fussy @@ -4994,7 +6367,12 @@ \let\par = \lisppar % don't ignore blank lines \obeylines % each line of input is a line of output \parskip = 0pt + % Turn off paragraph indentation but redefine \indent to emulate + % the normal \indent. + \nonfillparindent=\parindent \parindent = 0pt + \let\indent\nonfillindent + % \emergencystretch = 0pt % don't try to avoid overfull boxes \ifx\nonarrowing\relax \advance \leftskip by \lispnarrowing @@ -5005,6 +6383,24 @@ \let\exdent=\nofillexdent } +\begingroup +\obeyspaces +% We want to swallow spaces (but not other tokens) after the fake +% @indent in our nonfill-environments, where spaces are normally +% active and set to @tie, resulting in them not being ignored after +% @indent. +\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}% +\gdef\nonfillindentcheck{% +\ifx\temp % +\expandafter\nonfillindentgobble% +\else% +\leavevmode\nonfillindentbox% +\fi% +}% +\endgroup +\def\nonfillindentgobble#1{\nonfillindent} +\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}} + % If you want all examples etc. small: @set dispenvsize small. % If you want even small examples the full size: @set dispenvsize nosmall. % This affects the following displayed environments: @@ -5015,53 +6411,59 @@ \let\SETdispenvsize\relax \def\setnormaldispenv{% \ifx\SETdispenvsize\smallword + % end paragraph for sake of leading, in case document has no blank + % line. This is redundant with what happens in \aboveenvbreak, but + % we need to do it before changing the fonts, and it's inconvenient + % to change the fonts afterward. + \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } \def\setsmalldispenv{% \ifx\SETdispenvsize\nosmallword \else + \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } % We often define two environments, @foo and @smallfoo. -% Let's do it by one command: -\def\makedispenv #1#2{ - \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} - \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} +% Let's do it in one command. #1 is the env name, #2 the definition. +\def\makedispenvdef#1#2{% + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}% + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}% \expandafter\let\csname E#1\endcsname \afterenvbreak \expandafter\let\csname Esmall#1\endcsname \afterenvbreak } -% Define two synonyms: -\def\maketwodispenvs #1#2#3{ - \makedispenv{#1}{#3} - \makedispenv{#2}{#3} -} - -% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. +% Define two environment synonyms (#1 and #2) for an environment. +\def\maketwodispenvdef#1#2#3{% + \makedispenvdef{#1}{#3}% + \makedispenvdef{#2}{#3}% +} +% +% @lisp: indented, narrowed, typewriter font; +% @example: same as @lisp. % % @smallexample and @smalllisp: use smaller fonts. % Originally contributed by Pavel at xerox. % -\maketwodispenvs {lisp}{example}{% +\maketwodispenvdef{lisp}{example}{% \nonfillstart - \tt + \tt\setupmarkupstyle{example}% \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. - \gobble % eat return -} - + \gobble % eat return +} % @display/@smalldisplay: same as @lisp except keep current font. % -\makedispenv {display}{% +\makedispenvdef{display}{% \nonfillstart \gobble } % @format/@smallformat: same as @display except don't narrow margins. % -\makedispenv{format}{% +\makedispenvdef{format}{% \let\nonarrowing = t% \nonfillstart \gobble @@ -5080,18 +6482,44 @@ \envdef\flushright{% \let\nonarrowing = t% \nonfillstart - \advance\leftskip by 0pt plus 1fill + \advance\leftskip by 0pt plus 1fill\relax \gobble } \let\Eflushright = \afterenvbreak +% @raggedright does more-or-less normal line breaking but no right +% justification. From plain.tex. +\envdef\raggedright{% + \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax +} +\let\Eraggedright\par + +\envdef\raggedleft{% + \parindent=0pt \leftskip0pt plus2em + \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt + \hbadness=10000 % Last line will usually be underfull, so turn off + % badness reporting. +} +\let\Eraggedleft\par + +\envdef\raggedcenter{% + \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em + \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt + \hbadness=10000 % Last line will usually be underfull, so turn off + % badness reporting. +} +\let\Eraggedcenter\par + + % @quotation does normal linebreaking (hence we can't use \nonfillstart) % and narrows the margins. We keep \parskip nonzero in general, since % we're doing normal filling. So, when using \aboveenvbreak and % \afterenvbreak, temporarily make \parskip 0. % -\envdef\quotation{% +\makedispenvdef{quotation}{\quotationstart} +% +\def\quotationstart{% {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip \parindent=0pt % @@ -5111,12 +6539,13 @@ % \def\Equotation{% \par - \ifx\quotationauthor\undefined\else + \ifx\quotationauthor\thisisundefined\else % indent a bit. \leftline{\kern 2\leftskip \sl ---\quotationauthor}% \fi {\parskip=0pt \afterenvbreak}% } +\def\Esmallquotation{\Equotation} % If we're given an argument, typeset it in bold with a colon after. \def\quotationlabel#1{% @@ -5141,18 +6570,16 @@ \do\ \do\\\do\{\do\}\do\$\do\&% \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% \do\<\do\>\do\|\do\@\do+\do\"% + % Don't do the quotes -- if we do, @set txicodequoteundirected and + % @set txicodequotebacktick will not have effect on @verb and + % @verbatim, and ?` and !` ligatures won't get disabled. + %\do\`\do\'% } % % [Knuth] p. 380 \def\uncatcodespecials{% \def\do##1{\catcode`##1=\other}\dospecials} % -% [Knuth] pp. 380,381,391 -% Disable Spanish ligatures ?` and !` of \tt font -\begingroup - \catcode`\`=\active\gdef`{\relax\lq} -\endgroup -% % Setup for the @verb command. % % Eight spaces for a tab @@ -5164,7 +6591,7 @@ \def\setupverb{% \tt % easiest (and conventionally used) font for verbatim \def\par{\leavevmode\endgraf}% - \catcode`\`=\active + \setupmarkupstyle{verb}% \tabeightspaces % Respect line breaks, % print special symbols as themselves, and @@ -5175,35 +6602,46 @@ % Setup for the @verbatim environment % -% Real tab expansion +% Real tab expansion. \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount % -\def\starttabbox{\setbox0=\hbox\bgroup} +% We typeset each line of the verbatim in an \hbox, so we can handle +% tabs. The \global is in case the verbatim line starts with an accent, +% or some other command that starts with a begin-group. Otherwise, the +% entire \verbbox would disappear at the corresponding end-group, before +% it is typeset. Meanwhile, we can't have nested verbatim commands +% (can we?), so the \global won't be overwriting itself. +\newbox\verbbox +\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup} +% \begingroup \catcode`\^^I=\active \gdef\tabexpand{% \catcode`\^^I=\active \def^^I{\leavevmode\egroup - \dimen0=\wd0 % the width so far, or since the previous tab - \divide\dimen0 by\tabw - \multiply\dimen0 by\tabw % compute previous multiple of \tabw - \advance\dimen0 by\tabw % advance to next multiple of \tabw - \wd0=\dimen0 \box0 \starttabbox + \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab + \divide\dimen\verbbox by\tabw + \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw + \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw + \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox }% } \endgroup + +% start the verbatim environment. \def\setupverbatim{% \let\nonarrowing = t% \nonfillstart - % Easiest (and conventionally used) font for verbatim - \tt - \def\par{\leavevmode\egroup\box0\endgraf}% - \catcode`\`=\active + \tt % easiest (and conventionally used) font for verbatim + % The \leavevmode here is for blank lines. Otherwise, we would + % never \starttabox and the \egroup would end verbatim mode. + \def\par{\leavevmode\egroup\box\verbbox\endgraf}% \tabexpand + \setupmarkupstyle{verbatim}% % Respect line breaks, % print special symbols as themselves, and - % make each space count - % must do in this order: + % make each space count. + % Must do in this order: \obeylines \uncatcodespecials \sepspaces \everypar{\starttabbox}% } @@ -5259,6 +6697,8 @@ {% \makevalueexpandable \setupverbatim + \indexnofonts % Allow `@@' and other weird things in file names. + \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% \input #1 \afterenvbreak }% @@ -5284,27 +6724,35 @@ \endgroup } + \message{defuns,} % @defun etc. \newskip\defbodyindent \defbodyindent=.4in \newskip\defargsindent \defargsindent=50pt \newskip\deflastargmargin \deflastargmargin=18pt +\newcount\defunpenalty % Start the processing of @deffn: \def\startdefun{% \ifnum\lastpenalty<10000 \medbreak + \defunpenalty=10003 % Will keep this @deffn together with the + % following @def command, see below. \else % If there are two @def commands in a row, we'll have a \nobreak, % which is there to keep the function description together with its % header. But if there's nothing but headers, we need to allow a % break somewhere. Check specifically for penalty 10002, inserted - % by \defargscommonending, instead of 10000, since the sectioning + % by \printdefunline, instead of 10000, since the sectioning % commands also insert a nobreak penalty, and we don't want to allow % a break between a section heading and a defun. - % - \ifnum\lastpenalty=10002 \penalty2000 \fi + % + % As a further refinement, we avoid "club" headers by signalling + % with penalty of 10003 after the very first @deffn in the + % sequence (see above), and penalty of 10002 after any following + % @def command. + \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi % % Similarly, after a section heading, do not allow a break. % But do insert the glue. @@ -5322,7 +6770,7 @@ % % As above, allow line break if we have multiple x headers in a row. % It's not a great place, though. - \ifnum\lastpenalty=10002 \penalty3000 \fi + \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi % % And now, it's time to reuse the body of the original defun: \expandafter\gobbledefun#1% @@ -5337,10 +6785,10 @@ #1#2 \endheader % common ending: \interlinepenalty = 10000 - \advance\rightskip by 0pt plus 1fil + \advance\rightskip by 0pt plus 1fil\relax \endgraf \nobreak\vskip -\parskip - \penalty 10002 % signal to \startdefun and \dodefunx + \penalty\defunpenalty % signal to \startdefun and \dodefunx % Some of the @defun-type tags do not enable magic parentheses, % rendering the following check redundant. But we don't optimize. \checkparencounts @@ -5350,7 +6798,7 @@ \def\Edefun{\endgraf\medbreak} % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; -% the only thing remainnig is to define \deffnheader. +% the only thing remaining is to define \deffnheader. % \def\makedefun#1{% \expandafter\let\csname E#1\endcsname = \Edefun @@ -5367,13 +6815,36 @@ \def\domakedefun#1#2#3{% \envdef#1{% \startdefun + \doingtypefnfalse % distinguish typed functions from all else \parseargusing\activeparens{\printdefunline#3}% }% \def#2{\dodefunx#1}% \def#3% } -%%% Untyped functions: +\newif\ifdoingtypefn % doing typed function? +\newif\ifrettypeownline % typeset return type on its own line? + +% @deftypefnnewline on|off says whether the return type of typed functions +% are printed on their own line. This affects @deftypefn, @deftypefun, +% @deftypeop, and @deftypemethod. +% +\parseargdef\deftypefnnewline{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxideftypefnnl\endcsname + = \empty + \else\ifx\temp\offword + \expandafter\let\csname SETtxideftypefnnl\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @txideftypefnnl value `\temp', + must be on|off}% + \fi\fi +} + +% Untyped functions: % @deffn category name args \makedefun{deffn}{\deffngeneral{}} @@ -5392,7 +6863,7 @@ \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% } -%%% Typed functions: +% Typed functions: % @deftypefn category type name args \makedefun{deftypefn}{\deftypefngeneral{}} @@ -5407,10 +6878,11 @@ % \def\deftypefngeneral#1#2 #3 #4 #5\endheader{% \dosubind{fn}{\code{#4}}{#1}% + \doingtypefntrue \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } -%%% Typed variables: +% Typed variables: % @deftypevr category type var args \makedefun{deftypevr}{\deftypecvgeneral{}} @@ -5428,7 +6900,7 @@ \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } -%%% Untyped variables: +% Untyped variables: % @defvr category var args \makedefun{defvr}#1 {\deftypevrheader{#1} {} } @@ -5439,7 +6911,8 @@ % \defcvof {category of}class var args \def\defcvof#1#2 {\deftypecvof{#1}#2 {} } -%%% Type: +% Types: + % @deftp category name args \makedefun{deftp}#1 #2 #3\endheader{% \doind{tp}{\code{#2}}% @@ -5467,25 +6940,49 @@ % We are followed by (but not passed) the arguments, if any. % \def\defname#1#2#3{% + \par % Get the values of \leftskip and \rightskip as they were outside the @def... \advance\leftskip by -\defbodyindent % - % How we'll format the type name. Putting it in brackets helps + % Determine if we are typesetting the return type of a typed function + % on a line by itself. + \rettypeownlinefalse + \ifdoingtypefn % doing a typed function specifically? + % then check user option for putting return type on its own line: + \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else + \rettypeownlinetrue + \fi + \fi + % + % How we'll format the category name. Putting it in brackets helps % distinguish it from the body text that may end up on the next line % just below it. \def\temp{#1}% \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} % - % Figure out line sizes for the paragraph shape. + % Figure out line sizes for the paragraph shape. We'll always have at + % least two. + \tempnum = 2 + % % The first line needs space for \box0; but if \rightskip is nonzero, % we need only space for the part of \box0 which exceeds it: \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % + % If doing a return type on its own line, we'll have another line. + \ifrettypeownline + \advance\tempnum by 1 + \def\maybeshapeline{0in \hsize}% + \else + \def\maybeshapeline{}% + \fi + % % The continuations: \dimen2=\hsize \advance\dimen2 by -\defargsindent - % (plain.tex says that \dimen1 should be used only as global.) - \parshape 2 0in \dimen0 \defargsindent \dimen2 - % - % Put the type name to the right margin. + % + % The final paragraph shape: + \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 + % + % Put the category name at the right margin. \noindent \hbox to 0pt{% \hfil\box0 \kern-\hsize @@ -5507,8 +7004,16 @@ % . this still does not fix the ?` and !` ligatures, but so far no % one has made identifiers using them :). \df \tt - \def\temp{#2}% return value type - \ifx\temp\empty\else \tclose{\temp} \fi + \def\temp{#2}% text of the return type + \ifx\temp\empty\else + \tclose{\temp}% typeset the return type + \ifrettypeownline + % put return type on its own line; prohibit line break following: + \hfil\vadjust{\nobreak}\break + \else + \space % type on same line, so just followed by a space + \fi + \fi % no return type #3% output function name }% {\rm\enskip}% hskip 0.5 em of \tenrm @@ -5529,7 +7034,7 @@ % % On the other hand, if an argument has two dashes (for instance), we % want a way to get ttsl. Let's try @var for that. - \let\var=\ttslanted + \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}% #1% \sl\hyphenchar\font=45 } @@ -5609,12 +7114,14 @@ \ifnum\parencount=0 \else \badparencount \fi \ifnum\brackcount=0 \else \badbrackcount \fi } +% these should not use \errmessage; the glibc manual, at least, actually +% has such constructs (when documenting function pointers). \def\badparencount{% - \errmessage{Unbalanced parentheses in @def}% + \message{Warning: unbalanced parentheses in @def...}% \global\parencount=0 } \def\badbrackcount{% - \errmessage{Unbalanced square braces in @def}% + \message{Warning: unbalanced square brackets in @def...}% \global\brackcount=0 } @@ -5624,7 +7131,7 @@ % To do this right we need a feature of e-TeX, \scantokens, % which we arrange to emulate with a temporary file in ordinary TeX. -\ifx\eTeXversion\undefined +\ifx\eTeXversion\thisisundefined \newwrite\macscribble \def\scantokens#1{% \toks0={#1}% @@ -5635,26 +7142,30 @@ } \fi -\def\scanmacro#1{% - \begingroup - \newlinechar`\^^M - \let\xeatspaces\eatspaces - % Undo catcode changes of \startcontents and \doprintindex - % When called from @insertcopying or (short)caption, we need active - % backslash to get it printed correctly. Previously, we had - % \catcode`\\=\other instead. We'll see whether a problem appears - % with macro expansion. --kasal, 19aug04 - \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ - % ... and \example - \spaceisspace - % - % Append \endinput to make sure that TeX does not see the ending newline. - % - % I've verified that it is necessary both for e-TeX and for ordinary TeX - % --kasal, 29nov03 - \scantokens{#1\endinput}% - \endgroup -} +\def\scanmacro#1{\begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % + % ... and for \example: + \spaceisspace + % + % The \empty here causes a following catcode 5 newline to be eaten as + % part of reading whitespace after a control sequence. It does not + % eat a catcode 13 newline. There's no good way to handle the two + % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX + % would then have different behavior). See the Macro Details node in + % the manual for the workaround we recommend for macros and + % line-oriented commands. + % + \scantokens{#1\empty}% +\endgroup} \def\scanexp#1{% \edef\temp{\noexpand\scanmacro{#1}}% @@ -5682,7 +7193,7 @@ % This does \let #1 = #2, with \csnames; that is, % \let \csname#1\endcsname = \csname#2\endcsname % (except of course we have to play expansion games). -% +% \def\cslet#1#2{% \expandafter\let \csname#1\expandafter\endcsname @@ -5708,13 +7219,18 @@ % Macro bodies are absorbed as an argument in a context where % all characters are catcode 10, 11 or 12, except \ which is active -% (as in normal texinfo). It is necessary to change the definition of \. - +% (as in normal texinfo). It is necessary to change the definition of \ +% to recognize macro arguments; this is the job of \mbodybackslash. +% +% Non-ASCII encodings make 8-bit characters active, so un-activate +% them to avoid their expansion. Must do this non-globally, to +% confine the change to the current group. +% % It's necessary to have hard CRs when the macro is executed. This is -% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% done by making ^^M (\endlinechar) catcode 12 when reading the macro % body, and then making it the \newlinechar in \scanmacro. - -\def\scanctxt{% +% +\def\scanctxt{% used as subroutine \catcode`\"=\other \catcode`\+=\other \catcode`\<=\other @@ -5724,15 +7240,16 @@ \catcode`\_=\other \catcode`\|=\other \catcode`\~=\other -} - -\def\scanargctxt{% + \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi +} + +\def\scanargctxt{% used for copying and captions, not macros. \scanctxt \catcode`\\=\other \catcode`\^^M=\other } -\def\macrobodyctxt{% +\def\macrobodyctxt{% used for @macro definitions \scanctxt \catcode`\{=\other \catcode`\}=\other @@ -5740,32 +7257,56 @@ \usembodybackslash } -\def\macroargctxt{% +\def\macroargctxt{% used when scanning invocations \scanctxt - \catcode`\\=\other -} + \catcode`\\=0 +} +% why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes" +% for the single characters \ { }. Thus, we end up with the "commands" +% that would be written @\ @{ @} in a Texinfo document. +% +% We already have @{ and @}. For @\, we define it here, and only for +% this purpose, to produce a typewriter backslash (so, the @\ that we +% define for @math can't be used with @macro calls): +% +\def\\{\normalbackslash}% +% +% We would like to do this for \, too, since that is what makeinfo does. +% But it is not possible, because Texinfo already has a command @, for a +% cedilla accent. Documents must use @comma{} instead. +% +% \anythingelse will almost certainly be an error of some kind. + % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N % where N is the macro parameter number. % We define \csname macarg.\endcsname to be \realbackslash, so % \\ in macro replacement text gets you a backslash. - +% {\catcode`@=0 @catcode`@\=@active @gdef at usembodybackslash{@let\=@mbodybackslash} @gdef at mbodybackslash#1\{@csname macarg.#1 at endcsname} } \expandafter\def\csname macarg.\endcsname{\realbackslash} +\def\margbackslash#1{\char`\#1 } + \def\macro{\recursivefalse\parsearg\macroxxx} \def\rmacro{\recursivetrue\parsearg\macroxxx} \def\macroxxx#1{% - \getargs{#1}% now \macname is the macname and \argl the arglist + \getargs{#1}% now \macname is the macname and \argl the arglist \ifx\argl\empty % no arguments - \paramno=0% + \paramno=0\relax \else \expandafter\parsemargdef \argl;% + \if\paramno>256\relax + \ifx\eTeXversion\thisisundefined + \errhelp = \EMsimple + \errmessage{You need eTeX to compile a file with macros with more than 256 arguments} + \fi + \fi \fi \if1\csname ismacro.\the\macname\endcsname \message{Warning: redefining \the\macname}% @@ -5812,46 +7353,269 @@ % an opening brace, and that opening brace is not consumed. \def\getargs#1{\getargsxxx#1{}} \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} -\def\getmacname #1 #2\relax{\macname={#1}} +\def\getmacname#1 #2\relax{\macname={#1}} \def\getmacargs#1{\def\argl{#1}} +% For macro processing make @ a letter so that we can make Texinfo private macro names. +\edef\texiatcatcode{\the\catcode`\@} +\catcode `@=11\relax + % Parse the optional {params} list. Set up \paramno and \paramlist -% so \defmacro knows what to do. Define \macarg.blah for each blah -% in the params list, to be ##N where N is the position in that list. +% so \defmacro knows what to do. Define \macarg.BLAH for each BLAH +% in the params list to some hook where the argument si to be expanded. If +% there are less than 10 arguments that hook is to be replaced by ##N where N +% is the position in that list, that is to say the macro arguments are to be +% defined `a la TeX in the macro body. +% % That gets used by \mbodybackslash (above). - +% % We need to get `macro parameter char #' into several definitions. -% The technique used is stolen from LaTeX: let \hash be something +% The technique used is stolen from LaTeX: let \hash be something % unexpandable, insert that wherever you need a #, and then redefine % it to # just before using the token list produced. % % The same technique is used to protect \eatspaces till just before % the macro is used. - -\def\parsemargdef#1;{\paramno=0\def\paramlist{}% - \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} +% +% If there are 10 or more arguments, a different technique is used, where the +% hook remains in the body, and when macro is to be expanded the body is +% processed again to replace the arguments. +% +% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the +% argument N value and then \edef the body (nothing else will expand because of +% the catcode regime underwhich the body was input). +% +% If you compile with TeX (not eTeX), and you have macros with 10 or more +% arguments, you need that no macro has more than 256 arguments, otherwise an +% error is produced. +\def\parsemargdef#1;{% + \paramno=0\def\paramlist{}% + \let\hash\relax + \let\xeatspaces\relax + \parsemargdefxxx#1,;,% + % In case that there are 10 or more arguments we parse again the arguments + % list to set new definitions for the \macarg.BLAH macros corresponding to + % each BLAH argument. It was anyhow needed to parse already once this list + % in order to count the arguments, and as macros with at most 9 arguments + % are by far more frequent than macro with 10 or more arguments, defining + % twice the \macarg.BLAH macros does not cost too much processing power. + \ifnum\paramno<10\relax\else + \paramno0\relax + \parsemmanyargdef@@#1,;,% 10 or more arguments + \fi +} \def\parsemargdefxxx#1,{% \if#1;\let\next=\relax \else \let\next=\parsemargdefxxx - \advance\paramno by 1% + \advance\paramno by 1 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname {\xeatspaces{\hash\the\paramno}}% \edef\paramlist{\paramlist\hash\the\paramno,}% \fi\next} +\def\parsemmanyargdef@@#1,{% + \if#1;\let\next=\relax + \else + \let\next=\parsemmanyargdef@@ + \edef\tempb{\eatspaces{#1}}% + \expandafter\def\expandafter\tempa + \expandafter{\csname macarg.\tempb\endcsname}% + % Note that we need some extra \noexpand\noexpand, this is because we + % don't want \the to be expanded in the \parsermacbody as it uses an + % \xdef . + \expandafter\edef\tempa + {\noexpand\noexpand\noexpand\the\toks\the\paramno}% + \advance\paramno by 1\relax + \fi\next} + % These two commands read recursive and nonrecursive macro bodies. % (They're different since rec and nonrec macros end differently.) - +% + +\catcode `\@\texiatcatcode \long\def\parsemacbody#1 at end macro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% \long\def\parsermacbody#1 at end rmacro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% - -% This defines the macro itself. There are six cases: recursive and -% nonrecursive macros of zero, one, and many arguments. +\catcode `\@=11\relax + +\let\endargs@\relax +\let\nil@\relax +\def\nilm@{\nil@}% +\long\def\nillm@{\nil@}% + +% This macro is expanded during the Texinfo macro expansion, not during its +% definition. It gets all the arguments values and assigns them to macros +% macarg.ARGNAME +% +% #1 is the macro name +% #2 is the list of argument names +% #3 is the list of argument values +\def\getargvals@#1#2#3{% + \def\macargdeflist@{}% + \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion. + \def\paramlist{#2,\nil@}% + \def\macroname{#1}% + \begingroup + \macroargctxt + \def\argvaluelist{#3,\nil@}% + \def\@tempa{#3}% + \ifx\@tempa\empty + \setemptyargvalues@ + \else + \getargvals@@ + \fi +} + +% +\def\getargvals@@{% + \ifx\paramlist\nilm@ + % Some sanity check needed here that \argvaluelist is also empty. + \ifx\argvaluelist\nillm@ + \else + \errhelp = \EMsimple + \errmessage{Too many arguments in macro `\macroname'!}% + \fi + \let\next\macargexpandinbody@ + \else + \ifx\argvaluelist\nillm@ + % No more arguments values passed to macro. Set remaining named-arg + % macros to empty. + \let\next\setemptyargvalues@ + \else + % pop current arg name into \@tempb + \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}% + \expandafter\@tempa\expandafter{\paramlist}% + % pop current argument value into \@tempc + \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}% + \expandafter\@tempa\expandafter{\argvaluelist}% + % Here \@tempb is the current arg name and \@tempc is the current arg value. + % First place the new argument macro definition into \@tempd + \expandafter\macname\expandafter{\@tempc}% + \expandafter\let\csname macarg.\@tempb\endcsname\relax + \expandafter\def\expandafter\@tempe\expandafter{% + \csname macarg.\@tempb\endcsname}% + \edef\@tempd{\long\def\@tempe{\the\macname}}% + \push@\@tempd\macargdeflist@ + \let\next\getargvals@@ + \fi + \fi + \next +} + +\def\push@#1#2{% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter#2% + \expandafter\expandafter\expandafter{% + \expandafter#1#2}% +} + +% Replace arguments by their values in the macro body, and place the result +% in macro \@tempa +\def\macvalstoargs@{% + % To do this we use the property that token registers that are \the'ed + % within an \edef expand only once. So we are going to place all argument + % values into respective token registers. + % + % First we save the token context, and initialize argument numbering. + \begingroup + \paramno0\relax + % Then, for each argument number #N, we place the corresponding argument + % value into a new token list register \toks#N + \expandafter\putargsintokens@\saveparamlist@,;,% + % Then, we expand the body so that argument are replaced by their + % values. The trick for values not to be expanded themselves is that they + % are within tokens and that tokens expand only once in an \edef . + \edef\@tempc{\csname mac.\macroname .body\endcsname}% + % Now we restore the token stack pointer to free the token list registers + % which we have used, but we make sure that expanded body is saved after + % group. + \expandafter + \endgroup + \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% + } + +\def\macargexpandinbody@{% + %% Define the named-macro outside of this group and then close this group. + \expandafter + \endgroup + \macargdeflist@ + % First the replace in body the macro arguments by their values, the result + % is in \@tempa . + \macvalstoargs@ + % Then we point at the \norecurse or \gobble (for recursive) macro value + % with \@tempb . + \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname + % Depending on whether it is recursive or not, we need some tailing + % \egroup . + \ifx\@tempb\gobble + \let\@tempc\relax + \else + \let\@tempc\egroup + \fi + % And now we do the real job: + \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}% + \@tempd +} + +\def\putargsintokens@#1,{% + \if#1;\let\next\relax + \else + \let\next\putargsintokens@ + % First we allocate the new token list register, and give it a temporary + % alias \@tempb . + \toksdef\@tempb\the\paramno + % Then we place the argument value into that token list register. + \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname + \expandafter\@tempb\expandafter{\@tempa}% + \advance\paramno by 1\relax + \fi + \next +} + +% Save the token stack pointer into macro #1 +\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}} +% Restore the token stack pointer from number in macro #1 +\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax} +% newtoks that can be used non \outer . +\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi} + +% Tailing missing arguments are set to empty +\def\setemptyargvalues@{% + \ifx\paramlist\nilm@ + \let\next\macargexpandinbody@ + \else + \expandafter\setemptyargvaluesparser@\paramlist\endargs@ + \let\next\setemptyargvalues@ + \fi + \next +} + +\def\setemptyargvaluesparser@#1,#2\endargs@{% + \expandafter\def\expandafter\@tempa\expandafter{% + \expandafter\def\csname macarg.#1\endcsname{}}% + \push@\@tempa\macargdeflist@ + \def\paramlist{#2}% +} + +% #1 is the element target macro +% #2 is the list macro +% #3,#4\endargs@ is the list value +\def\pop@#1#2#3,#4\endargs@{% + \def#1{#3}% + \def#2{#4}% +} +\long\def\longpop@#1#2#3,#4\endargs@{% + \long\def#1{#3}% + \long\def#2{#4}% +} + +% This defines a Texinfo @macro. There are eight cases: recursive and +% nonrecursive macros of zero, one, up to nine, and many arguments. % Much magic with \expandafter here. % \xdef is used so that macro definitions will survive the file % they're defined in; @include reads the file inside a group. +% \def\defmacro{% \let\hash=##% convert placeholders to macro parameter chars \ifrecursive @@ -5866,17 +7630,25 @@ \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup\noexpand\scanmacro{\temp}}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \else + \ifnum\paramno<10\relax % at most 9 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \else % 10 or more + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\getargvals@{\the\macname}{\argl}% + }% + \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp + \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble + \fi \fi \else \ifcase\paramno @@ -5893,39 +7665,51 @@ \egroup \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \expandafter\noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% + \else % at most 9 + \ifnum\paramno<10\relax + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % 10 or more: + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\getargvals@{\the\macname}{\argl}% + }% + \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp + \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse + \fi \fi \fi} +\catcode `\@\texiatcatcode\relax + \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} % \braceorline decides whether the next nonwhitespace character is a % {. If so it reads up to the closing }, if not, it reads the whole % line. Whatever was read is then fed to the next control sequence -% as an argument (by \parsebrace or \parsearg) -\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} +% as an argument (by \parsebrace or \parsearg). +% +\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} \def\braceorlinexxx{% \ifx\nchar\bgroup\else \expandafter\parsearg - \fi \next} + \fi \macnamexxx} % @alias. % We need some trickery to remove the optional spaces around the equal -% sign. Just make them active and then expand them all to nothing. +% sign. Make them active and then expand them all to nothing. +% \def\alias{\parseargusing\obeyspaces\aliasxxx} \def\aliasxxx #1{\aliasyyy#1\relax} \def\aliasyyy #1=#2\relax{% @@ -5941,13 +7725,13 @@ \message{cross references,} \newwrite\auxfile - \newif\ifhavexrefs % True if xref values are known. \newif\ifwarnedxrefs % True if we warned once that they aren't known. % @inforef is relatively simple. \def\inforef #1{\inforefzzz #1,,,,**} -\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, +\def\inforefzzz #1,#2,#3,#4**{% + \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, node \samp{\ignorespaces#1{}}} % @node's only job in TeX is to define \lastnode, which is used in @@ -5986,7 +7770,7 @@ % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an % anchor), which consists of three parts: -% 1) NAME-title - the current sectioning name taken from \thissection, +% 1) NAME-title - the current sectioning name taken from \lastsection, % or the anchor name. % 2) NAME-snt - section number and type, passed as the SNT arg, or % empty for anchors. @@ -6005,14 +7789,35 @@ \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef ##1}{##2}}% these are parameters of \writexrdef }% - \toks0 = \expandafter{\thissection}% + \toks0 = \expandafter{\lastsection}% \immediate \writexrdef{title}{\the\toks0 }% \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. - \writexrdef{pg}{\folio}% will be written later, during \shipout + \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout }% \fi } +% @xrefautosectiontitle on|off says whether @section(ing) names are used +% automatically in xrefs, if the third arg is not explicitly specified. +% This was provided as a "secret" @set xref-automatic-section-title +% variable, now it's official. +% +\parseargdef\xrefautomaticsectiontitle{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETxref-automatic-section-title\endcsname + = \empty + \else\ifx\temp\offword + \expandafter\let\csname SETxref-automatic-section-title\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', + must be on|off}% + \fi\fi +} + +% % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is % the node name, #2 the name of the Info cross-reference, #3 the printed % node name, #4 the name of the Info file, #5 the name of the printed @@ -6021,26 +7826,41 @@ \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} \def\ref#1{\xrefX[#1,,,,,,,]} +% +\newbox\toprefbox +\newbox\printedrefnamebox +\newbox\infofilenamebox +\newbox\printedmanualbox +% \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup \unsepspaces + % + % Get args without leading/trailing spaces. + \def\printedrefname{\ignorespaces #3}% + \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}% + % + \def\infofilename{\ignorespaces #4}% + \setbox\infofilenamebox = \hbox{\infofilename\unskip}% + % \def\printedmanual{\ignorespaces #5}% - \def\printedrefname{\ignorespaces #3}% - \setbox1=\hbox{\printedmanual\unskip}% - \setbox0=\hbox{\printedrefname\unskip}% - \ifdim \wd0 = 0pt + \setbox\printedmanualbox = \hbox{\printedmanual\unskip}% + % + % If the printed reference name (arg #3) was not explicitly given in + % the @xref, figure out what we want to use. + \ifdim \wd\printedrefnamebox = 0pt % No printed node name was explicitly given. - \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax - % Use the node name inside the square brackets. + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax + % Not auto section-title: use node name inside the square brackets. \def\printedrefname{\ignorespaces #1}% \else - % Use the actual chapter/section title appear inside - % the square brackets. Use the real section title if we have it. - \ifdim \wd1 > 0pt - % It is in another manual, so we don't have it. + % Auto section-title: use chapter/section title inside + % the square brackets if we have it. + \ifdim \wd\printedmanualbox > 0pt + % It is in another manual, so we don't have it; use node name. \def\printedrefname{\ignorespaces #1}% \else \ifhavexrefs - % We know the real title if we have the xref values. + % We (should) know the real title if we have the xref values. \def\printedrefname{\refx{#1-title}{}}% \else % Otherwise just copy the Info node name. @@ -6052,22 +7872,32 @@ % % Make link in pdf output. \ifpdf - \leavevmode - \getfilename{#4}% - {\turnoffactive - % See comments at \activebackslashdouble. - {\activebackslashdouble \xdef\pdfxrefdest{#1}% - \backslashparens\pdfxrefdest}% + {\indexnofonts + \turnoffactive + \makevalueexpandable + % This expands tokens, so do it after making catcode changes, so _ + % etc. don't get their TeX definitions. This ignores all spaces in + % #4, including (wrongly) those in the middle of the filename. + \getfilename{#4}% % + % This (wrongly) does not take account of leading or trailing + % spaces in #1, which should be ignored. + \edef\pdfxrefdest{#1}% + \ifx\pdfxrefdest\empty + \def\pdfxrefdest{Top}% no empty targets + \else + \txiescapepdf\pdfxrefdest % escape PDF special chars + \fi + % + \leavevmode + \startlink attr{/Border [0 0 0]}% \ifnum\filenamelength>0 - \startlink attr{/Border [0 0 0]}% - goto file{\the\filename.pdf} name{\pdfxrefdest}% + goto file{\the\filename.pdf} name{\pdfxrefdest}% \else - \startlink attr{/Border [0 0 0]}% - goto name{\pdfmkpgn{\pdfxrefdest}}% + goto name{\pdfmkpgn{\pdfxrefdest}}% \fi }% - \linkcolor + \setcolor{\linkcolor}% \fi % % Float references are printed completely differently: "Figure 1.2" @@ -6084,29 +7914,42 @@ \iffloat\Xthisreftitle % If the user specified the print name (third arg) to the ref, % print it instead of our usual "Figure 1.2". - \ifdim\wd0 = 0pt - \refx{#1-snt}% + \ifdim\wd\printedrefnamebox = 0pt + \refx{#1-snt}{}% \else \printedrefname \fi % - % if the user also gave the printed manual name (fifth arg), append + % If the user also gave the printed manual name (fifth arg), append % "in MANUALNAME". - \ifdim \wd1 > 0pt + \ifdim \wd\printedmanualbox > 0pt \space \putwordin{} \cite{\printedmanual}% \fi \else % node/anchor (non-float) references. + % + % If we use \unhbox to print the node names, TeX does not insert + % empty discretionaries after hyphens, which means that it will not + % find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, + % this is a loss. Therefore, we give the text of the node name + % again, so it is as if TeX is seeing it for the first time. + % + \ifdim \wd\printedmanualbox > 0pt + % Cross-manual reference with a printed manual name. + % + \crossmanualxref{\cite{\printedmanual\unskip}}% % - % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not - % insert empty discretionaries after hyphens, which means that it will - % not find a line break at a hyphen in a node names. Since some manuals - % are best written with fairly long node names, containing hyphens, this - % is a loss. Therefore, we give the text of the node name again, so it - % is as if TeX is seeing it for the first time. - \ifdim \wd1 > 0pt - \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + \else\ifdim \wd\infofilenamebox > 0pt + % Cross-manual reference with only an info filename (arg 4), no + % printed manual name (arg 5). This is essentially the same as + % the case above; we output the filename, since we have nothing else. + % + \crossmanualxref{\code{\infofilename\unskip}}% + % \else + % Reference within this manual. + % % _ (for example) has to be the character _ for the purposes of the % control sequence corresponding to the node, but it has to expand % into the usual \leavevmode...\vrule stuff for purposes of @@ -6118,7 +7961,7 @@ \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi }% - % output the `[mynode]' via a macro so it can be overridden. + % output the `[mynode]' via the macro below so it can be overridden. \xrefprintnodename\printedrefname % % But we always want a comma and a space: @@ -6126,11 +7969,37 @@ % % output the `page 3'. \turnoffactive \putwordpage\tie\refx{#1-pg}{}% - \fi + \fi\fi \fi \endlink \endgroup} +% Output a cross-manual xref to #1. Used just above (twice). +% +% Only include the text "Section ``foo'' in" if the foo is neither +% missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply +% "see The Foo Manual", the idea being to refer to the whole manual. +% +% But, this being TeX, we can't easily compare our node name against the +% string "Top" while ignoring the possible spaces before and after in +% the input. By adding the arbitrary 7sp below, we make it much less +% likely that a real node name would have the same width as "Top" (e.g., +% in a monospaced font). Hopefully it will never happen in practice. +% +% For the same basic reason, we retypeset the "Top" at every +% reference, since the current font is indeterminate. +% +\def\crossmanualxref#1{% + \setbox\toprefbox = \hbox{Top\kern7sp}% + \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}% + \ifdim \wd2 > 7sp % nonempty? + \ifdim \wd2 = \wd\toprefbox \else % same as Top? + \putwordSection{} ``\printedrefname'' \putwordin{}\space + \fi + \fi + #1% +} + % This macro is called from \xrefX for the `[nodename]' part of xref % output. It's a separate macro only so it can be changed more easily, % since square brackets don't work well in some documents. Particularly @@ -6181,7 +8050,8 @@ \angleleft un\-de\-fined\angleright \iflinks \ifhavexrefs - \message{\linenumber Undefined cross reference `#1'.}% + {\toks0 = {#1}% avoid expansion of possibly-complex value + \message{\linenumber Undefined cross reference `\the\toks0'.}}% \else \ifwarnedxrefs\else \global\warnedxrefstrue @@ -6201,10 +8071,18 @@ % collisions). But if this is a float type, we have more work to do. % \def\xrdef#1#2{% - \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. + {% The node name might contain 8-bit characters, which in our current + % implementation are changed to commands like @'e. Don't let these + % mess up the control sequence name. + \indexnofonts + \turnoffactive + \xdef\safexrefname{#1}% + }% + % + \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref % % Was that xref control sequence that we just defined for a float? - \expandafter\iffloat\csname XR#1\endcsname + \expandafter\iffloat\csname XR\safexrefname\endcsname % it was a float, and we have the (safe) float type in \iffloattype. \expandafter\let\expandafter\floatlist \csname floatlist\iffloattype\endcsname @@ -6219,7 +8097,8 @@ % % Remember this xref in the control sequence \floatlistFLOATTYPE, % for later use in \listoffloats. - \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 + {\safexrefname}}% \fi } @@ -6323,6 +8202,7 @@ \input\jobname.#1 \endgroup} + \message{insertions,} % including footnotes. @@ -6335,7 +8215,7 @@ % space to prevent strange expansion errors.) \def\supereject{\par\penalty -20000\footnoteno =0 } -% @footnotestyle is meaningful for info output only. +% @footnotestyle is meaningful for Info output only. \let\footnotestyle=\comment {\catcode `\@=11 @@ -6398,6 +8278,8 @@ % expands into a box, it must come within the paragraph, lest it % provide a place where TeX can split the footnote. \footstrut + % + % Invoke rest of plain TeX footnote routine. \futurelet\next\fo at t } }%end \catcode `\@=11 @@ -6405,7 +8287,7 @@ % In case a @footnote appears in a vbox, save the footnote text and create % the real \insert just after the vbox finished. Otherwise, the insertion % would be lost. -% Similarily, if a @footnote appears inside an alignment, save the footnote +% Similarly, if a @footnote appears inside an alignment, save the footnote % text to a box and make the \insert when a row of the table is finished. % And the same can be done for other insert classes. --kasal, 16nov03. @@ -6485,7 +8367,7 @@ it from ftp://tug.org/tex/epsf.tex.} % \def\image#1{% - \ifx\epsfbox\undefined + \ifx\epsfbox\thisisundefined \ifwarnednoepsf \else \errhelp = \noepsfhelp \errmessage{epsf.tex not found, images will be ignored}% @@ -6501,7 +8383,7 @@ % #2 is (optional) width, #3 is (optional) height. % #4 is (ignored optional) html alt text. % #5 is (ignored optional) extension. -% #6 is just the usual extra ignored arg for parsing this stuff. +% #6 is just the usual extra ignored arg for parsing stuff. \newif\ifimagevmode \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup \catcode`\^^M = 5 % in case we're inside an example @@ -6509,15 +8391,30 @@ % If the image is by itself, center it. \ifvmode \imagevmodetrue - \nobreak\bigskip + \else \ifx\centersub\centerV + % for @center @image, we need a vbox so we can have our vertical space + \imagevmodetrue + \vbox\bgroup % vbox has better behavior than vtop herev + \fi\fi + % + \ifimagevmode + \nobreak\medskip % Usually we'll have text after the image which will insert % \parskip glue, so insert it here too to equalize the space % above and below. \nobreak\vskip\parskip \nobreak - \line\bgroup\hss \fi % + % Leave vertical mode so that indentation from an enclosing + % environment such as @quotation is respected. + % However, if we're at the top level, we don't want the + % normal paragraph indentation. + % On the other hand, if we are in the case of @center @image, we don't + % want to start a paragraph, which will create a hsize-width box and + % eradicate the centering. + \ifx\centersub\centerV\else \noindent \fi + % % Output the image. \ifpdf \dopdfimage{#1}{#2}{#3}% @@ -6528,7 +8425,10 @@ \epsfbox{#1.eps}% \fi % - \ifimagevmode \hss \egroup \bigbreak \fi % space after the image + \ifimagevmode + \medskip % space after a standalone image + \fi + \ifx\centersub\centerV \egroup \fi \endgroup} @@ -6595,13 +8495,13 @@ \global\advance\floatno by 1 % {% - % This magic value for \thissection is output by \setref as the + % This magic value for \lastsection is output by \setref as the % XREFLABEL-title value. \xrefX uses it to distinguish float % labels (which have a completely different output format) from % node and anchor labels. And \xrdef uses it to construct the % lists of floats. % - \edef\thissection{\floatmagic=\safefloattype}% + \edef\lastsection{\floatmagic=\safefloattype}% \setref{\floatlabel}{Yfloat}% }% \fi @@ -6669,6 +8569,7 @@ % caption if specified, else the full caption if specified, else nothing. {% \atdummies + % % since we read the caption text in the macro world, where ^^M % is turned into a normal character, we have to scan it back, so % we don't write the literal three characters "^^M" into the aux file. @@ -6689,8 +8590,9 @@ % % place the captured inserts % - % BEWARE: when the floats start float, we have to issue warning whenever an - % insert appears inside a float which could possibly float. --kasal, 26may04 + % BEWARE: when the floats start floating, we have to issue warning + % whenever an insert appears inside a float which could possibly + % float. --kasal, 26may04 % \checkinserts } @@ -6734,7 +8636,7 @@ % #1 is the control sequence we are passed; we expand into a conditional % which is true if #1 represents a float ref. That is, the magic -% \thissection value which we \setref above. +% \lastsection value which we \setref above. % \def\iffloat#1{\expandafter\doiffloat#1==\finish} % @@ -6795,39 +8697,909 @@ \writeentry }} + \message{localization,} -% and i18n. - -% @documentlanguage is usually given very early, just after -% @setfilename. If done too late, it may not override everything -% properly. Single argument is the language abbreviation. -% It would be nice if we could set up a hyphenation file here. -% -\parseargdef\documentlanguage{% + +% For single-language documents, @documentlanguage is usually given very +% early, just after @documentencoding. Single argument is the language +% (de) or locale (de_DE) abbreviation. +% +{ + \catcode`\_ = \active + \globaldefs=1 +\parseargdef\documentlanguage{\begingroup + \let_=\normalunderscore % normal _ character for filenames \tex % read txi-??.tex file in plain TeX. - % Read the file if it exists. + % Read the file by the name they passed if it exists. \openin 1 txi-#1.tex \ifeof 1 - \errhelp = \nolanghelp - \errmessage{Cannot read language file txi-#1.tex}% + \documentlanguagetrywithoutunderscore{#1_\finish}% \else + \globaldefs = 1 % everything in the txi-LL files needs to persist \input txi-#1.tex \fi \closein 1 - \endgroup -} + \endgroup % end raw TeX +\endgroup} +% +% If they passed de_DE, and txi-de_DE.tex doesn't exist, +% try txi-de.tex. +% +\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{% + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \globaldefs = 1 % everything in the txi-LL files needs to persist + \input txi-#1.tex + \fi + \closein 1 +} +}% end of special _ catcode +% \newhelp\nolanghelp{The given language definition file cannot be found or -is empty. Maybe you need to install it? In the current directory -should work if nowhere else does.} - - -% @documentencoding should change something in TeX eventually, most -% likely, but for now just recognize it. -\let\documentencoding = \comment - - -% Page size parameters. -% +is empty. Maybe you need to install it? Putting it in the current +directory should work if nowhere else does.} + +% This macro is called from txi-??.tex files; the first argument is the +% \language name to set (without the "\lang@" prefix), the second and +% third args are \{left,right}hyphenmin. +% +% The language names to pass are determined when the format is built. +% See the etex.log file created at that time, e.g., +% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. +% +% With TeX Live 2008, etex now includes hyphenation patterns for all +% available languages. This means we can support hyphenation in +% Texinfo, at least to some extent. (This still doesn't solve the +% accented characters problem.) +% +\catcode`@=11 +\def\txisetlanguage#1#2#3{% + % do not set the language if the name is undefined in the current TeX. + \expandafter\ifx\csname lang@#1\endcsname \relax + \message{no patterns for #1}% + \else + \global\language = \csname lang@#1\endcsname + \fi + % but there is no harm in adjusting the hyphenmin values regardless. + \global\lefthyphenmin = #2\relax + \global\righthyphenmin = #3\relax +} + +% Helpers for encodings. +% Set the catcode of characters 128 through 255 to the specified number. +% +\def\setnonasciicharscatcode#1{% + \count255=128 + \loop\ifnum\count255<256 + \global\catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} + +\def\setnonasciicharscatcodenonglobal#1{% + \count255=128 + \loop\ifnum\count255<256 + \catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} + +% @documentencoding sets the definition of non-ASCII characters +% according to the specified encoding. +% +\parseargdef\documentencoding{% + % Encoding being declared for the document. + \def\declaredencoding{\csname #1.enc\endcsname}% + % + % Supported encodings: names converted to tokens in order to be able + % to compare them with \ifx. + \def\ascii{\csname US-ASCII.enc\endcsname}% + \def\latnine{\csname ISO-8859-15.enc\endcsname}% + \def\latone{\csname ISO-8859-1.enc\endcsname}% + \def\lattwo{\csname ISO-8859-2.enc\endcsname}% + \def\utfeight{\csname UTF-8.enc\endcsname}% + % + \ifx \declaredencoding \ascii + \asciichardefs + % + \else \ifx \declaredencoding \lattwo + \setnonasciicharscatcode\active + \lattwochardefs + % + \else \ifx \declaredencoding \latone + \setnonasciicharscatcode\active + \latonechardefs + % + \else \ifx \declaredencoding \latnine + \setnonasciicharscatcode\active + \latninechardefs + % + \else \ifx \declaredencoding \utfeight + \setnonasciicharscatcode\active + \utfeightchardefs + % + \else + \message{Unknown document encoding #1, ignoring.}% + % + \fi % utfeight + \fi % latnine + \fi % latone + \fi % lattwo + \fi % ascii +} + +% A message to be logged when using a character that isn't available +% the default font encoding (OT1). +% +\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} + +% Take account of \c (plain) vs. \, (Texinfo) difference. +\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} + +% First, make active non-ASCII characters in order for them to be +% correctly categorized when TeX reads the replacement text of +% macros containing the character definitions. +\setnonasciicharscatcode\active +% +% Latin1 (ISO-8859-1) character definitions. +\def\latonechardefs{% + \gdef^^a0{\tie} + \gdef^^a1{\exclamdown} + \gdef^^a2{\missingcharmsg{CENT SIGN}} + \gdef^^a3{{\pounds}} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\missingcharmsg{YEN SIGN}} + \gdef^^a6{\missingcharmsg{BROKEN BAR}} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\copyright} + \gdef^^aa{\ordf} + \gdef^^ab{\guillemetleft} + \gdef^^ac{$\lnot$} + \gdef^^ad{\-} + \gdef^^ae{\registeredsymbol} + \gdef^^af{\={}} + % + \gdef^^b0{\textdegree} + \gdef^^b1{$\pm$} + \gdef^^b2{$^2$} + \gdef^^b3{$^3$} + \gdef^^b4{\'{}} + \gdef^^b5{$\mu$} + \gdef^^b6{\P} + % + \gdef^^b7{$^.$} + \gdef^^b8{\cedilla\ } + \gdef^^b9{$^1$} + \gdef^^ba{\ordm} + % + \gdef^^bb{\guillemetright} + \gdef^^bc{$1\over4$} + \gdef^^bd{$1\over2$} + \gdef^^be{$3\over4$} + \gdef^^bf{\questiondown} + % + \gdef^^c0{\`A} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\~A} + \gdef^^c4{\"A} + \gdef^^c5{\ringaccent A} + \gdef^^c6{\AE} + \gdef^^c7{\cedilla C} + \gdef^^c8{\`E} + \gdef^^c9{\'E} + \gdef^^ca{\^E} + \gdef^^cb{\"E} + \gdef^^cc{\`I} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\"I} + % + \gdef^^d0{\DH} + \gdef^^d1{\~N} + \gdef^^d2{\`O} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\~O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\O} + \gdef^^d9{\`U} + \gdef^^da{\'U} + \gdef^^db{\^U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\TH} + \gdef^^df{\ss} + % + \gdef^^e0{\`a} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\~a} + \gdef^^e4{\"a} + \gdef^^e5{\ringaccent a} + \gdef^^e6{\ae} + \gdef^^e7{\cedilla c} + \gdef^^e8{\`e} + \gdef^^e9{\'e} + \gdef^^ea{\^e} + \gdef^^eb{\"e} + \gdef^^ec{\`{\dotless i}} + \gdef^^ed{\'{\dotless i}} + \gdef^^ee{\^{\dotless i}} + \gdef^^ef{\"{\dotless i}} + % + \gdef^^f0{\dh} + \gdef^^f1{\~n} + \gdef^^f2{\`o} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\~o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\o} + \gdef^^f9{\`u} + \gdef^^fa{\'u} + \gdef^^fb{\^u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\th} + \gdef^^ff{\"y} +} + +% Latin9 (ISO-8859-15) encoding character definitions. +\def\latninechardefs{% + % Encoding is almost identical to Latin1. + \latonechardefs + % + \gdef^^a4{\euro} + \gdef^^a6{\v S} + \gdef^^a8{\v s} + \gdef^^b4{\v Z} + \gdef^^b8{\v z} + \gdef^^bc{\OE} + \gdef^^bd{\oe} + \gdef^^be{\"Y} +} + +% Latin2 (ISO-8859-2) character definitions. +\def\lattwochardefs{% + \gdef^^a0{\tie} + \gdef^^a1{\ogonek{A}} + \gdef^^a2{\u{}} + \gdef^^a3{\L} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\v L} + \gdef^^a6{\'S} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\v S} + \gdef^^aa{\cedilla S} + \gdef^^ab{\v T} + \gdef^^ac{\'Z} + \gdef^^ad{\-} + \gdef^^ae{\v Z} + \gdef^^af{\dotaccent Z} + % + \gdef^^b0{\textdegree} + \gdef^^b1{\ogonek{a}} + \gdef^^b2{\ogonek{ }} + \gdef^^b3{\l} + \gdef^^b4{\'{}} + \gdef^^b5{\v l} + \gdef^^b6{\'s} + \gdef^^b7{\v{}} + \gdef^^b8{\cedilla\ } + \gdef^^b9{\v s} + \gdef^^ba{\cedilla s} + \gdef^^bb{\v t} + \gdef^^bc{\'z} + \gdef^^bd{\H{}} + \gdef^^be{\v z} + \gdef^^bf{\dotaccent z} + % + \gdef^^c0{\'R} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\u A} + \gdef^^c4{\"A} + \gdef^^c5{\'L} + \gdef^^c6{\'C} + \gdef^^c7{\cedilla C} + \gdef^^c8{\v C} + \gdef^^c9{\'E} + \gdef^^ca{\ogonek{E}} + \gdef^^cb{\"E} + \gdef^^cc{\v E} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\v D} + % + \gdef^^d0{\DH} + \gdef^^d1{\'N} + \gdef^^d2{\v N} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\H O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\v R} + \gdef^^d9{\ringaccent U} + \gdef^^da{\'U} + \gdef^^db{\H U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\cedilla T} + \gdef^^df{\ss} + % + \gdef^^e0{\'r} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\u a} + \gdef^^e4{\"a} + \gdef^^e5{\'l} + \gdef^^e6{\'c} + \gdef^^e7{\cedilla c} + \gdef^^e8{\v c} + \gdef^^e9{\'e} + \gdef^^ea{\ogonek{e}} + \gdef^^eb{\"e} + \gdef^^ec{\v e} + \gdef^^ed{\'{\dotless{i}}} + \gdef^^ee{\^{\dotless{i}}} + \gdef^^ef{\v d} + % + \gdef^^f0{\dh} + \gdef^^f1{\'n} + \gdef^^f2{\v n} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\H o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\v r} + \gdef^^f9{\ringaccent u} + \gdef^^fa{\'u} + \gdef^^fb{\H u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\cedilla t} + \gdef^^ff{\dotaccent{}} +} + +% UTF-8 character definitions. +% +% This code to support UTF-8 is based on LaTeX's utf8.def, with some +% changes for Texinfo conventions. It is included here under the GPL by +% permission from Frank Mittelbach and the LaTeX team. +% +\newcount\countUTFx +\newcount\countUTFy +\newcount\countUTFz + +\gdef\UTFviiiTwoOctets#1#2{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\endcsname} +% +\gdef\UTFviiiThreeOctets#1#2#3{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} +% +\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} + +\gdef\UTFviiiDefined#1{% + \ifx #1\relax + \message{\linenumber Unicode char \string #1 not defined for Texinfo}% + \else + \expandafter #1% + \fi +} + +\begingroup + \catcode`\~13 + \catcode`\"12 + + \def\UTFviiiLoop{% + \global\catcode\countUTFx\active + \uccode`\~\countUTFx + \uppercase\expandafter{\UTFviiiTmp}% + \advance\countUTFx by 1 + \ifnum\countUTFx < \countUTFy + \expandafter\UTFviiiLoop + \fi} + + \countUTFx = "C2 + \countUTFy = "E0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiTwoOctets\string~}} + \UTFviiiLoop + + \countUTFx = "E0 + \countUTFy = "F0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiThreeOctets\string~}} + \UTFviiiLoop + + \countUTFx = "F0 + \countUTFy = "F4 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiFourOctets\string~}} + \UTFviiiLoop +\endgroup + +\begingroup + \catcode`\"=12 + \catcode`\<=12 + \catcode`\.=12 + \catcode`\,=12 + \catcode`\;=12 + \catcode`\!=12 + \catcode`\~=13 + + \gdef\DeclareUnicodeCharacter#1#2{% + \countUTFz = "#1\relax + %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% + \begingroup + \parseXMLCharref + \def\UTFviiiTwoOctets##1##2{% + \csname u8:##1\string ##2\endcsname}% + \def\UTFviiiThreeOctets##1##2##3{% + \csname u8:##1\string ##2\string ##3\endcsname}% + \def\UTFviiiFourOctets##1##2##3##4{% + \csname u8:##1\string ##2\string ##3\string ##4\endcsname}% + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter + \gdef\UTFviiiTmp{#2}% + \endgroup} + + \gdef\parseXMLCharref{% + \ifnum\countUTFz < "A0\relax + \errhelp = \EMsimple + \errmessage{Cannot define Unicode char value < 00A0}% + \else\ifnum\countUTFz < "800\relax + \parseUTFviiiA,% + \parseUTFviiiB C\UTFviiiTwoOctets.,% + \else\ifnum\countUTFz < "10000\relax + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiB E\UTFviiiThreeOctets.{,;}% + \else + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiA!% + \parseUTFviiiB F\UTFviiiFourOctets.{!,;}% + \fi\fi\fi + } + + \gdef\parseUTFviiiA#1{% + \countUTFx = \countUTFz + \divide\countUTFz by 64 + \countUTFy = \countUTFz + \multiply\countUTFz by 64 + \advance\countUTFx by -\countUTFz + \advance\countUTFx by 128 + \uccode `#1\countUTFx + \countUTFz = \countUTFy} + + \gdef\parseUTFviiiB#1#2#3#4{% + \advance\countUTFz by "#10\relax + \uccode `#3\countUTFz + \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} +\endgroup + +\def\utfeightchardefs{% + \DeclareUnicodeCharacter{00A0}{\tie} + \DeclareUnicodeCharacter{00A1}{\exclamdown} + \DeclareUnicodeCharacter{00A3}{\pounds} + \DeclareUnicodeCharacter{00A8}{\"{ }} + \DeclareUnicodeCharacter{00A9}{\copyright} + \DeclareUnicodeCharacter{00AA}{\ordf} + \DeclareUnicodeCharacter{00AB}{\guillemetleft} + \DeclareUnicodeCharacter{00AD}{\-} + \DeclareUnicodeCharacter{00AE}{\registeredsymbol} + \DeclareUnicodeCharacter{00AF}{\={ }} + + \DeclareUnicodeCharacter{00B0}{\ringaccent{ }} + \DeclareUnicodeCharacter{00B4}{\'{ }} + \DeclareUnicodeCharacter{00B8}{\cedilla{ }} + \DeclareUnicodeCharacter{00BA}{\ordm} + \DeclareUnicodeCharacter{00BB}{\guillemetright} + \DeclareUnicodeCharacter{00BF}{\questiondown} + + \DeclareUnicodeCharacter{00C0}{\`A} + \DeclareUnicodeCharacter{00C1}{\'A} + \DeclareUnicodeCharacter{00C2}{\^A} + \DeclareUnicodeCharacter{00C3}{\~A} + \DeclareUnicodeCharacter{00C4}{\"A} + \DeclareUnicodeCharacter{00C5}{\AA} + \DeclareUnicodeCharacter{00C6}{\AE} + \DeclareUnicodeCharacter{00C7}{\cedilla{C}} + \DeclareUnicodeCharacter{00C8}{\`E} + \DeclareUnicodeCharacter{00C9}{\'E} + \DeclareUnicodeCharacter{00CA}{\^E} + \DeclareUnicodeCharacter{00CB}{\"E} + \DeclareUnicodeCharacter{00CC}{\`I} + \DeclareUnicodeCharacter{00CD}{\'I} + \DeclareUnicodeCharacter{00CE}{\^I} + \DeclareUnicodeCharacter{00CF}{\"I} + + \DeclareUnicodeCharacter{00D0}{\DH} + \DeclareUnicodeCharacter{00D1}{\~N} + \DeclareUnicodeCharacter{00D2}{\`O} + \DeclareUnicodeCharacter{00D3}{\'O} + \DeclareUnicodeCharacter{00D4}{\^O} + \DeclareUnicodeCharacter{00D5}{\~O} + \DeclareUnicodeCharacter{00D6}{\"O} + \DeclareUnicodeCharacter{00D8}{\O} + \DeclareUnicodeCharacter{00D9}{\`U} + \DeclareUnicodeCharacter{00DA}{\'U} + \DeclareUnicodeCharacter{00DB}{\^U} + \DeclareUnicodeCharacter{00DC}{\"U} + \DeclareUnicodeCharacter{00DD}{\'Y} + \DeclareUnicodeCharacter{00DE}{\TH} + \DeclareUnicodeCharacter{00DF}{\ss} + + \DeclareUnicodeCharacter{00E0}{\`a} + \DeclareUnicodeCharacter{00E1}{\'a} + \DeclareUnicodeCharacter{00E2}{\^a} + \DeclareUnicodeCharacter{00E3}{\~a} + \DeclareUnicodeCharacter{00E4}{\"a} + \DeclareUnicodeCharacter{00E5}{\aa} + \DeclareUnicodeCharacter{00E6}{\ae} + \DeclareUnicodeCharacter{00E7}{\cedilla{c}} + \DeclareUnicodeCharacter{00E8}{\`e} + \DeclareUnicodeCharacter{00E9}{\'e} + \DeclareUnicodeCharacter{00EA}{\^e} + \DeclareUnicodeCharacter{00EB}{\"e} + \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}} + \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}} + \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}} + \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}} + + \DeclareUnicodeCharacter{00F0}{\dh} + \DeclareUnicodeCharacter{00F1}{\~n} + \DeclareUnicodeCharacter{00F2}{\`o} + \DeclareUnicodeCharacter{00F3}{\'o} + \DeclareUnicodeCharacter{00F4}{\^o} + \DeclareUnicodeCharacter{00F5}{\~o} + \DeclareUnicodeCharacter{00F6}{\"o} + \DeclareUnicodeCharacter{00F8}{\o} + \DeclareUnicodeCharacter{00F9}{\`u} + \DeclareUnicodeCharacter{00FA}{\'u} + \DeclareUnicodeCharacter{00FB}{\^u} + \DeclareUnicodeCharacter{00FC}{\"u} + \DeclareUnicodeCharacter{00FD}{\'y} + \DeclareUnicodeCharacter{00FE}{\th} + \DeclareUnicodeCharacter{00FF}{\"y} + + \DeclareUnicodeCharacter{0100}{\=A} + \DeclareUnicodeCharacter{0101}{\=a} + \DeclareUnicodeCharacter{0102}{\u{A}} + \DeclareUnicodeCharacter{0103}{\u{a}} + \DeclareUnicodeCharacter{0104}{\ogonek{A}} + \DeclareUnicodeCharacter{0105}{\ogonek{a}} + \DeclareUnicodeCharacter{0106}{\'C} + \DeclareUnicodeCharacter{0107}{\'c} + \DeclareUnicodeCharacter{0108}{\^C} + \DeclareUnicodeCharacter{0109}{\^c} + \DeclareUnicodeCharacter{0118}{\ogonek{E}} + \DeclareUnicodeCharacter{0119}{\ogonek{e}} + \DeclareUnicodeCharacter{010A}{\dotaccent{C}} + \DeclareUnicodeCharacter{010B}{\dotaccent{c}} + \DeclareUnicodeCharacter{010C}{\v{C}} + \DeclareUnicodeCharacter{010D}{\v{c}} + \DeclareUnicodeCharacter{010E}{\v{D}} + + \DeclareUnicodeCharacter{0112}{\=E} + \DeclareUnicodeCharacter{0113}{\=e} + \DeclareUnicodeCharacter{0114}{\u{E}} + \DeclareUnicodeCharacter{0115}{\u{e}} + \DeclareUnicodeCharacter{0116}{\dotaccent{E}} + \DeclareUnicodeCharacter{0117}{\dotaccent{e}} + \DeclareUnicodeCharacter{011A}{\v{E}} + \DeclareUnicodeCharacter{011B}{\v{e}} + \DeclareUnicodeCharacter{011C}{\^G} + \DeclareUnicodeCharacter{011D}{\^g} + \DeclareUnicodeCharacter{011E}{\u{G}} + \DeclareUnicodeCharacter{011F}{\u{g}} + + \DeclareUnicodeCharacter{0120}{\dotaccent{G}} + \DeclareUnicodeCharacter{0121}{\dotaccent{g}} + \DeclareUnicodeCharacter{0124}{\^H} + \DeclareUnicodeCharacter{0125}{\^h} + \DeclareUnicodeCharacter{0128}{\~I} + \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}} + \DeclareUnicodeCharacter{012A}{\=I} + \DeclareUnicodeCharacter{012B}{\={\dotless{i}}} + \DeclareUnicodeCharacter{012C}{\u{I}} + \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}} + + \DeclareUnicodeCharacter{0130}{\dotaccent{I}} + \DeclareUnicodeCharacter{0131}{\dotless{i}} + \DeclareUnicodeCharacter{0132}{IJ} + \DeclareUnicodeCharacter{0133}{ij} + \DeclareUnicodeCharacter{0134}{\^J} + \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}} + \DeclareUnicodeCharacter{0139}{\'L} + \DeclareUnicodeCharacter{013A}{\'l} + + \DeclareUnicodeCharacter{0141}{\L} + \DeclareUnicodeCharacter{0142}{\l} + \DeclareUnicodeCharacter{0143}{\'N} + \DeclareUnicodeCharacter{0144}{\'n} + \DeclareUnicodeCharacter{0147}{\v{N}} + \DeclareUnicodeCharacter{0148}{\v{n}} + \DeclareUnicodeCharacter{014C}{\=O} + \DeclareUnicodeCharacter{014D}{\=o} + \DeclareUnicodeCharacter{014E}{\u{O}} + \DeclareUnicodeCharacter{014F}{\u{o}} + + \DeclareUnicodeCharacter{0150}{\H{O}} + \DeclareUnicodeCharacter{0151}{\H{o}} + \DeclareUnicodeCharacter{0152}{\OE} + \DeclareUnicodeCharacter{0153}{\oe} + \DeclareUnicodeCharacter{0154}{\'R} + \DeclareUnicodeCharacter{0155}{\'r} + \DeclareUnicodeCharacter{0158}{\v{R}} + \DeclareUnicodeCharacter{0159}{\v{r}} + \DeclareUnicodeCharacter{015A}{\'S} + \DeclareUnicodeCharacter{015B}{\'s} + \DeclareUnicodeCharacter{015C}{\^S} + \DeclareUnicodeCharacter{015D}{\^s} + \DeclareUnicodeCharacter{015E}{\cedilla{S}} + \DeclareUnicodeCharacter{015F}{\cedilla{s}} + + \DeclareUnicodeCharacter{0160}{\v{S}} + \DeclareUnicodeCharacter{0161}{\v{s}} + \DeclareUnicodeCharacter{0162}{\cedilla{t}} + \DeclareUnicodeCharacter{0163}{\cedilla{T}} + \DeclareUnicodeCharacter{0164}{\v{T}} + + \DeclareUnicodeCharacter{0168}{\~U} + \DeclareUnicodeCharacter{0169}{\~u} + \DeclareUnicodeCharacter{016A}{\=U} + \DeclareUnicodeCharacter{016B}{\=u} + \DeclareUnicodeCharacter{016C}{\u{U}} + \DeclareUnicodeCharacter{016D}{\u{u}} + \DeclareUnicodeCharacter{016E}{\ringaccent{U}} + \DeclareUnicodeCharacter{016F}{\ringaccent{u}} + + \DeclareUnicodeCharacter{0170}{\H{U}} + \DeclareUnicodeCharacter{0171}{\H{u}} + \DeclareUnicodeCharacter{0174}{\^W} + \DeclareUnicodeCharacter{0175}{\^w} + \DeclareUnicodeCharacter{0176}{\^Y} + \DeclareUnicodeCharacter{0177}{\^y} + \DeclareUnicodeCharacter{0178}{\"Y} + \DeclareUnicodeCharacter{0179}{\'Z} + \DeclareUnicodeCharacter{017A}{\'z} + \DeclareUnicodeCharacter{017B}{\dotaccent{Z}} + \DeclareUnicodeCharacter{017C}{\dotaccent{z}} + \DeclareUnicodeCharacter{017D}{\v{Z}} + \DeclareUnicodeCharacter{017E}{\v{z}} + + \DeclareUnicodeCharacter{01C4}{D\v{Z}} + \DeclareUnicodeCharacter{01C5}{D\v{z}} + \DeclareUnicodeCharacter{01C6}{d\v{z}} + \DeclareUnicodeCharacter{01C7}{LJ} + \DeclareUnicodeCharacter{01C8}{Lj} + \DeclareUnicodeCharacter{01C9}{lj} + \DeclareUnicodeCharacter{01CA}{NJ} + \DeclareUnicodeCharacter{01CB}{Nj} + \DeclareUnicodeCharacter{01CC}{nj} + \DeclareUnicodeCharacter{01CD}{\v{A}} + \DeclareUnicodeCharacter{01CE}{\v{a}} + \DeclareUnicodeCharacter{01CF}{\v{I}} + + \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}} + \DeclareUnicodeCharacter{01D1}{\v{O}} + \DeclareUnicodeCharacter{01D2}{\v{o}} + \DeclareUnicodeCharacter{01D3}{\v{U}} + \DeclareUnicodeCharacter{01D4}{\v{u}} + + \DeclareUnicodeCharacter{01E2}{\={\AE}} + \DeclareUnicodeCharacter{01E3}{\={\ae}} + \DeclareUnicodeCharacter{01E6}{\v{G}} + \DeclareUnicodeCharacter{01E7}{\v{g}} + \DeclareUnicodeCharacter{01E8}{\v{K}} + \DeclareUnicodeCharacter{01E9}{\v{k}} + + \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}} + \DeclareUnicodeCharacter{01F1}{DZ} + \DeclareUnicodeCharacter{01F2}{Dz} + \DeclareUnicodeCharacter{01F3}{dz} + \DeclareUnicodeCharacter{01F4}{\'G} + \DeclareUnicodeCharacter{01F5}{\'g} + \DeclareUnicodeCharacter{01F8}{\`N} + \DeclareUnicodeCharacter{01F9}{\`n} + \DeclareUnicodeCharacter{01FC}{\'{\AE}} + \DeclareUnicodeCharacter{01FD}{\'{\ae}} + \DeclareUnicodeCharacter{01FE}{\'{\O}} + \DeclareUnicodeCharacter{01FF}{\'{\o}} + + \DeclareUnicodeCharacter{021E}{\v{H}} + \DeclareUnicodeCharacter{021F}{\v{h}} + + \DeclareUnicodeCharacter{0226}{\dotaccent{A}} + \DeclareUnicodeCharacter{0227}{\dotaccent{a}} + \DeclareUnicodeCharacter{0228}{\cedilla{E}} + \DeclareUnicodeCharacter{0229}{\cedilla{e}} + \DeclareUnicodeCharacter{022E}{\dotaccent{O}} + \DeclareUnicodeCharacter{022F}{\dotaccent{o}} + + \DeclareUnicodeCharacter{0232}{\=Y} + \DeclareUnicodeCharacter{0233}{\=y} + \DeclareUnicodeCharacter{0237}{\dotless{j}} + + \DeclareUnicodeCharacter{02DB}{\ogonek{ }} + + \DeclareUnicodeCharacter{1E02}{\dotaccent{B}} + \DeclareUnicodeCharacter{1E03}{\dotaccent{b}} + \DeclareUnicodeCharacter{1E04}{\udotaccent{B}} + \DeclareUnicodeCharacter{1E05}{\udotaccent{b}} + \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}} + \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}} + \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}} + \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}} + \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}} + \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}} + \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}} + \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}} + + \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}} + \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}} + + \DeclareUnicodeCharacter{1E20}{\=G} + \DeclareUnicodeCharacter{1E21}{\=g} + \DeclareUnicodeCharacter{1E22}{\dotaccent{H}} + \DeclareUnicodeCharacter{1E23}{\dotaccent{h}} + \DeclareUnicodeCharacter{1E24}{\udotaccent{H}} + \DeclareUnicodeCharacter{1E25}{\udotaccent{h}} + \DeclareUnicodeCharacter{1E26}{\"H} + \DeclareUnicodeCharacter{1E27}{\"h} + + \DeclareUnicodeCharacter{1E30}{\'K} + \DeclareUnicodeCharacter{1E31}{\'k} + \DeclareUnicodeCharacter{1E32}{\udotaccent{K}} + \DeclareUnicodeCharacter{1E33}{\udotaccent{k}} + \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}} + \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}} + \DeclareUnicodeCharacter{1E36}{\udotaccent{L}} + \DeclareUnicodeCharacter{1E37}{\udotaccent{l}} + \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}} + \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}} + \DeclareUnicodeCharacter{1E3E}{\'M} + \DeclareUnicodeCharacter{1E3F}{\'m} + + \DeclareUnicodeCharacter{1E40}{\dotaccent{M}} + \DeclareUnicodeCharacter{1E41}{\dotaccent{m}} + \DeclareUnicodeCharacter{1E42}{\udotaccent{M}} + \DeclareUnicodeCharacter{1E43}{\udotaccent{m}} + \DeclareUnicodeCharacter{1E44}{\dotaccent{N}} + \DeclareUnicodeCharacter{1E45}{\dotaccent{n}} + \DeclareUnicodeCharacter{1E46}{\udotaccent{N}} + \DeclareUnicodeCharacter{1E47}{\udotaccent{n}} + \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}} + \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}} + + \DeclareUnicodeCharacter{1E54}{\'P} + \DeclareUnicodeCharacter{1E55}{\'p} + \DeclareUnicodeCharacter{1E56}{\dotaccent{P}} + \DeclareUnicodeCharacter{1E57}{\dotaccent{p}} + \DeclareUnicodeCharacter{1E58}{\dotaccent{R}} + \DeclareUnicodeCharacter{1E59}{\dotaccent{r}} + \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}} + \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}} + \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}} + \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}} + + \DeclareUnicodeCharacter{1E60}{\dotaccent{S}} + \DeclareUnicodeCharacter{1E61}{\dotaccent{s}} + \DeclareUnicodeCharacter{1E62}{\udotaccent{S}} + \DeclareUnicodeCharacter{1E63}{\udotaccent{s}} + \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}} + \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}} + \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}} + \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}} + \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}} + \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}} + + \DeclareUnicodeCharacter{1E7C}{\~V} + \DeclareUnicodeCharacter{1E7D}{\~v} + \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}} + \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}} + + \DeclareUnicodeCharacter{1E80}{\`W} + \DeclareUnicodeCharacter{1E81}{\`w} + \DeclareUnicodeCharacter{1E82}{\'W} + \DeclareUnicodeCharacter{1E83}{\'w} + \DeclareUnicodeCharacter{1E84}{\"W} + \DeclareUnicodeCharacter{1E85}{\"w} + \DeclareUnicodeCharacter{1E86}{\dotaccent{W}} + \DeclareUnicodeCharacter{1E87}{\dotaccent{w}} + \DeclareUnicodeCharacter{1E88}{\udotaccent{W}} + \DeclareUnicodeCharacter{1E89}{\udotaccent{w}} + \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}} + \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}} + \DeclareUnicodeCharacter{1E8C}{\"X} + \DeclareUnicodeCharacter{1E8D}{\"x} + \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}} + \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}} + + \DeclareUnicodeCharacter{1E90}{\^Z} + \DeclareUnicodeCharacter{1E91}{\^z} + \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}} + \DeclareUnicodeCharacter{1E93}{\udotaccent{z}} + \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}} + \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}} + \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}} + \DeclareUnicodeCharacter{1E97}{\"t} + \DeclareUnicodeCharacter{1E98}{\ringaccent{w}} + \DeclareUnicodeCharacter{1E99}{\ringaccent{y}} + + \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}} + \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}} + + \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}} + \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}} + \DeclareUnicodeCharacter{1EBC}{\~E} + \DeclareUnicodeCharacter{1EBD}{\~e} + + \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}} + \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}} + \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}} + \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}} + + \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}} + \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}} + + \DeclareUnicodeCharacter{1EF2}{\`Y} + \DeclareUnicodeCharacter{1EF3}{\`y} + \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}} + + \DeclareUnicodeCharacter{1EF8}{\~Y} + \DeclareUnicodeCharacter{1EF9}{\~y} + + \DeclareUnicodeCharacter{2013}{--} + \DeclareUnicodeCharacter{2014}{---} + \DeclareUnicodeCharacter{2018}{\quoteleft} + \DeclareUnicodeCharacter{2019}{\quoteright} + \DeclareUnicodeCharacter{201A}{\quotesinglbase} + \DeclareUnicodeCharacter{201C}{\quotedblleft} + \DeclareUnicodeCharacter{201D}{\quotedblright} + \DeclareUnicodeCharacter{201E}{\quotedblbase} + \DeclareUnicodeCharacter{2022}{\bullet} + \DeclareUnicodeCharacter{2026}{\dots} + \DeclareUnicodeCharacter{2039}{\guilsinglleft} + \DeclareUnicodeCharacter{203A}{\guilsinglright} + \DeclareUnicodeCharacter{20AC}{\euro} + + \DeclareUnicodeCharacter{2192}{\expansion} + \DeclareUnicodeCharacter{21D2}{\result} + + \DeclareUnicodeCharacter{2212}{\minus} + \DeclareUnicodeCharacter{2217}{\point} + \DeclareUnicodeCharacter{2261}{\equiv} +}% end of \utfeightchardefs + + +% US-ASCII character definitions. +\def\asciichardefs{% nothing need be done + \relax +} + +% Make non-ASCII characters printable again for compatibility with +% existing Texinfo documents that may use them, even without declaring a +% document encoding. +% +\setnonasciicharscatcode \other + + +\message{formatting,} + \newdimen\defaultparindent \defaultparindent = 15pt \chapheadingskip = 15pt plus 4pt minus 2pt @@ -6837,10 +9609,10 @@ % Prevent underfull vbox error messages. \vbadness = 10000 -% Don't be so finicky about underfull hboxes, either. -\hbadness = 2000 - -% Following George Bush, just get rid of widows and orphans. +% Don't be very finicky about underfull hboxes, either. +\hbadness = 6666 + +% Following George Bush, get rid of widows and orphans. \widowpenalty=10000 \clubpenalty=10000 @@ -6887,6 +9659,10 @@ \ifpdf \pdfpageheight #7\relax \pdfpagewidth #8\relax + % if we don't reset these, they will remain at "1 true in" of + % whatever layout pdftex was dumped with. + \pdfhorigin = 1 true in + \pdfvorigin = 1 true in \fi % \setleading{\textleading} @@ -6901,7 +9677,7 @@ \textleading = 13.2pt % % If page is nothing but text, make it come out even. - \internalpagesizes{46\baselineskip}{6in}% + \internalpagesizes{607.2pt}{6in}% that's 46 lines {\voffset}{.25in}% {\bindingoffset}{36pt}% {11in}{8.5in}% @@ -6913,7 +9689,7 @@ \textleading = 12pt % \internalpagesizes{7.5in}{5in}% - {\voffset}{.25in}% + {-.2in}{0in}% {\bindingoffset}{16pt}% {9.25in}{7in}% % @@ -6957,7 +9733,7 @@ % \global\normaloffset = -6mm % \global\bindingoffset = 10mm % @end tex - \internalpagesizes{51\baselineskip}{160mm} + \internalpagesizes{673.2pt}{160mm}% that's 51 lines {\voffset}{\hoffset}% {\bindingoffset}{44pt}% {297mm}{210mm}% @@ -7022,7 +9798,7 @@ \parskip = 3pt plus 2pt minus 1pt \setleading{\textleading}% % - \dimen0 = #1 + \dimen0 = #1\relax \advance\dimen0 by \voffset % \dimen2 = \hsize @@ -7041,25 +9817,21 @@ \message{and turning on texinfo input format.} +\def^^L{\par} % remove \outer, so ^L can appear in an @comment + +% DEL is a comment character, in case @c does not suffice. +\catcode`\^^? = 14 + % Define macros to output various characters with catcode for normal text. -\catcode`\"=\other -\catcode`\~=\other -\catcode`\^=\other -\catcode`\_=\other -\catcode`\|=\other -\catcode`\<=\other -\catcode`\>=\other -\catcode`\+=\other -\catcode`\$=\other -\def\normaldoublequote{"} -\def\normaltilde{~} -\def\normalcaret{^} -\def\normalunderscore{_} -\def\normalverticalbar{|} -\def\normalless{<} -\def\normalgreater{>} -\def\normalplus{+} -\def\normaldollar{$}%$ font-lock fix +\catcode`\"=\other \def\normaldoublequote{"} +\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix +\catcode`\+=\other \def\normalplus{+} +\catcode`\<=\other \def\normalless{<} +\catcode`\>=\other \def\normalgreater{>} +\catcode`\^=\other \def\normalcaret{^} +\catcode`\_=\other \def\normalunderscore{_} +\catcode`\|=\other \def\normalverticalbar{|} +\catcode`\~=\other \def\normaltilde{~} % This macro is used to make a character print one way in \tt % (where it can probably be output as-is), and another way in other fonts, @@ -7117,6 +9889,13 @@ % \otherifyactive is called near the end of this file. \def\otherifyactive{\catcode`+=\other \catcode`\_=\other} +% Used sometimes to turn off (effectively) the active characters even after +% parsing them. +\def\turnoffactive{% + \normalturnoffactive + \otherbackslash +} + \catcode`\@=0 % \backslashcurfont outputs one backslash character in current font, @@ -7124,45 +9903,52 @@ \global\chardef\backslashcurfont=`\\ \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work -% \rawbackslash defines an active \ to do \backslashcurfont. -% \otherbackslash defines an active \ to be a literal `\' character with -% catcode other. -{\catcode`\\=\active - @gdef at rawbackslash{@let\=@backslashcurfont} - @gdef at otherbackslash{@let\=@realbackslash} -} - % \realbackslash is an actual character `\' with catcode other, and % \doublebackslash is two of them (for the pdf outlines). {\catcode`\\=\other @gdef at realbackslash{\} @gdef at doublebackslash{\\}} -% \normalbackslash outputs one backslash in fixed width font. -\def\normalbackslash{{\tt\backslashcurfont}} - -\catcode`\\=\active - -% Used sometimes to turn off (effectively) the active characters -% even after parsing them. - at def@turnoffactive{% +% In texinfo, backslash is an active character; it prints the backslash +% in fixed width font. +\catcode`\\=\active % @ for escape char from now on. + +% The story here is that in math mode, the \char of \backslashcurfont +% ends up printing the roman \ from the math symbol font (because \char +% in math mode uses the \mathcode, and plain.tex sets +% \mathcode`\\="026E). It seems better for @backslashchar{} to always +% print a typewriter backslash, hence we use an explicit \mathchar, +% which is the decimal equivalent of "715c (class 7, e.g., use \fam; +% ignored family value; char position "5C). We can't use " for the +% usual hex value because it has already been made active. + at def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} + at let@backslashchar = @normalbackslash % @backslashchar{} is for user documents. + +% On startup, @fixbackslash assigns: +% @let \ = @normalbackslash +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. We switch back and forth between these. + at gdef@rawbackslash{@let\=@backslashcurfont} + at gdef@otherbackslash{@let\=@realbackslash} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. +% + at def@normalturnoffactive{% @let"=@normaldoublequote - @let\=@realbackslash - @let~=@normaltilde + @let$=@normaldollar %$ font-lock fix + @let+=@normalplus + @let<=@normalless + @let>=@normalgreater + @let\=@normalbackslash @let^=@normalcaret @let_=@normalunderscore @let|=@normalverticalbar - @let<=@normalless - @let>=@normalgreater - @let+=@normalplus - @let$=@normaldollar %$ font-lock fix + @let~=@normaltilde + @markupsetuplqdefault + @markupsetuprqdefault @unsepspaces } -% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of -% the literal character `\'. (Thus, \ is not expandable when this is in -% effect.) -% - at def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} - % Make _ and + \other characters, temporarily. % This is canceled by @fixbackslash. @otherifyactive @@ -7175,7 +9961,7 @@ @global at let\ = @eatinput % On the other hand, perhaps the file did not have a `\input texinfo'. Then -% the first `\{ in the file would cause an error. This macro tries to fix +% the first `\' in the file would cause an error. This macro tries to fix % that, assuming it is called before the first `\' could plausibly occur. % Also turn back on active characters that might appear in the input % file name, in case not using a pre-dumped format. @@ -7189,11 +9975,28 @@ % Say @foo, not \foo, in error messages. @escapechar = `@@ +% These (along with & and #) are made active for url-breaking, so need +% active definitions as the normal characters. + at def@normaldot{.} + at def@normalquest{?} + at def@normalslash{/} + % These look ok in all fonts, so just make them not special. - at catcode`@& = @other - at catcode`@# = @other - at catcode`@% = @other - +% @hashchar{} gets its own user-level command, because of #line. + at catcode`@& = @other @def at normalamp{&} + at catcode`@# = @other @def at normalhash{#} + at catcode`@% = @other @def at normalpercent{%} + + at let @hashchar = @normalhash + + at c Finally, make ` and ' active, so that txicodequoteundirected and + at c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we + at c don't make ` and ' active, @code will not get them as active chars. + at c Do this last of all since we use ` in the previous @catcode assignments. + at catcode`@'=@active + at catcode`@`=@active + at markupsetuplqdefault + at markupsetuprqdefault @c Local variables: @c eval: (add-hook 'write-file-hooks 'time-stamp) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:34:02 2013 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 19 Mar 2013 23:34:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Fixes_Issue_=2317192=3A_Update_the_ctypes_module=27s_libffi_to?= =?utf-8?b?IHYzLjAuMTMuICBUaGlz?= Message-ID: <3ZVpvt064TzS93@mail.python.org> http://hg.python.org/cpython/rev/f23274357fc8 changeset: 82787:f23274357fc8 branch: 3.3 parent: 82741:ea76cfff5851 parent: 82786:43e8da639462 user: Gregory P. Smith date: Tue Mar 19 14:59:02 2013 -0700 summary: Fixes Issue #17192: Update the ctypes module's libffi to v3.0.13. This specifically addresses a stack misalignment issue on x86 and issues on some more recent platforms. files: Misc/NEWS | 6 +- Modules/_ctypes/libffi.diff | 119 +- Modules/_ctypes/libffi/.gitignore | 21 + Modules/_ctypes/libffi/.travis.yml | 8 + Modules/_ctypes/libffi/ChangeLog | 521 +- Modules/_ctypes/libffi/ChangeLog.libffi | 4 +- Modules/_ctypes/libffi/Makefile.am | 122 +- Modules/_ctypes/libffi/Makefile.in | 841 +- Modules/_ctypes/libffi/README | 148 +- Modules/_ctypes/libffi/aclocal.m4 | 365 +- Modules/_ctypes/libffi/build-ios.sh | 67 + Modules/_ctypes/libffi/config.guess | 82 +- Modules/_ctypes/libffi/config.sub | 103 +- Modules/_ctypes/libffi/configure | 1386 +- Modules/_ctypes/libffi/configure.ac | 171 +- Modules/_ctypes/libffi/doc/libffi.info | Bin Modules/_ctypes/libffi/doc/libffi.texi | 2 +- Modules/_ctypes/libffi/doc/stamp-vti | 8 +- Modules/_ctypes/libffi/doc/version.texi | 8 +- Modules/_ctypes/libffi/fficonfig.h.in | 3 + Modules/_ctypes/libffi/include/Makefile.in | 71 +- Modules/_ctypes/libffi/include/ffi_common.h | 2 +- Modules/_ctypes/libffi/libffi.xcodeproj/project.pbxproj | 16 - Modules/_ctypes/libffi/libtool-ldflags | 106 + Modules/_ctypes/libffi/libtool-version | 2 +- Modules/_ctypes/libffi/ltmain.sh | 32 +- Modules/_ctypes/libffi/m4/ax_cc_maxopt.m4 | 7 +- Modules/_ctypes/libffi/m4/ax_cflags_warn_all.m4 | 3 +- Modules/_ctypes/libffi/m4/ax_gcc_archflag.m4 | 44 +- Modules/_ctypes/libffi/m4/libtool.m4 | 45 +- Modules/_ctypes/libffi/man/Makefile.in | 69 +- Modules/_ctypes/libffi/man/ffi_prep_cif.3 | 4 +- Modules/_ctypes/libffi/msvcc.sh | 0 Modules/_ctypes/libffi/src/aarch64/ffi.c | 1076 ++ Modules/_ctypes/libffi/src/aarch64/ffitarget.h | 59 + Modules/_ctypes/libffi/src/aarch64/sysv.S | 307 + Modules/_ctypes/libffi/src/bfin/ffi.c | 195 + Modules/_ctypes/libffi/src/bfin/ffitarget.h | 43 + Modules/_ctypes/libffi/src/bfin/sysv.S | 177 + Modules/_ctypes/libffi/src/closures.c | 29 + Modules/_ctypes/libffi/src/dlmalloc.c | 12 +- Modules/_ctypes/libffi/src/ia64/ffi.c | 4 +- Modules/_ctypes/libffi/src/m68k/ffi.c | 10 + Modules/_ctypes/libffi/src/metag/ffi.c | 330 + Modules/_ctypes/libffi/src/metag/ffitarget.h | 53 + Modules/_ctypes/libffi/src/metag/sysv.S | 311 + Modules/_ctypes/libffi/src/microblaze/ffi.c | 321 + Modules/_ctypes/libffi/src/microblaze/ffitarget.h | 53 + Modules/_ctypes/libffi/src/microblaze/sysv.S | 302 + Modules/_ctypes/libffi/src/moxie/eabi.S | 137 +- Modules/_ctypes/libffi/src/moxie/ffi.c | 82 +- Modules/_ctypes/libffi/src/moxie/ffitarget.h | 52 + Modules/_ctypes/libffi/src/powerpc/aix.S | 12 +- Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c | 8 +- Modules/_ctypes/libffi/src/powerpc/linux64.S | 21 +- Modules/_ctypes/libffi/src/powerpc/linux64_closure.S | 20 +- Modules/_ctypes/libffi/src/powerpc/sysv.S | 21 +- Modules/_ctypes/libffi/src/prep_cif.c | 21 + Modules/_ctypes/libffi/src/s390/ffi.c | 3 +- Modules/_ctypes/libffi/src/sparc/v8.S | 35 +- Modules/_ctypes/libffi/src/tile/ffi.c | 355 + Modules/_ctypes/libffi/src/tile/ffitarget.h | 65 + Modules/_ctypes/libffi/src/tile/tile.S | 360 + Modules/_ctypes/libffi/src/x86/ffi.c | 4 +- Modules/_ctypes/libffi/src/xtensa/ffi.c | 298 + Modules/_ctypes/libffi/src/xtensa/ffitarget.h | 53 + Modules/_ctypes/libffi/src/xtensa/sysv.S | 253 + Modules/_ctypes/libffi/stamp-h.in | 1 + Modules/_ctypes/libffi/testsuite/libffi.call/a.out | Bin Modules/_ctypes/libffi/testsuite/libffi.call/call.exp | 19 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c | 8 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c | 2 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c | 14 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_struct_va1.c | 114 + Modules/_ctypes/libffi/testsuite/libffi.call/cls_uchar_va.c | 44 + Modules/_ctypes/libffi/testsuite/libffi.call/cls_uint_va.c | 45 + Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulong_va.c | 45 + Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c | 10 +- Modules/_ctypes/libffi/testsuite/libffi.call/cls_ushort_va.c | 44 + Modules/_ctypes/libffi/testsuite/libffi.call/negint.c | 1 - Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct1.c | 2 +- Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct11.c | 121 + Modules/_ctypes/libffi/testsuite/libffi.call/return_dbl.c | 1 + Modules/_ctypes/libffi/testsuite/libffi.call/return_uc.c | 2 +- Modules/_ctypes/libffi/testsuite/libffi.call/stret_large.c | 4 +- Modules/_ctypes/libffi/testsuite/libffi.call/stret_large2.c | 4 +- Modules/_ctypes/libffi/testsuite/libffi.call/uninitialized.c | 61 + Modules/_ctypes/libffi/testsuite/libffi.call/va_1.c | 196 + Modules/_ctypes/libffi/testsuite/libffi.call/va_struct1.c | 121 + Modules/_ctypes/libffi/testsuite/libffi.call/va_struct2.c | 123 + Modules/_ctypes/libffi/testsuite/libffi.call/va_struct3.c | 125 + Modules/_ctypes/libffi/testsuite/libffi.special/ffitestcxx.h | 41 - Modules/_ctypes/libffi/testsuite/libffi.special/special.exp | 12 +- Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc | 1 + Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc | 1 + Modules/_ctypes/libffi/texinfo.tex | 4999 +++++++-- 97 files changed, 12743 insertions(+), 2894 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -193,7 +193,11 @@ Library ------- -Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. +- Issue #17192: Update the ctypes module's libffi to v3.0.13. This + specifically addresses a stack misalignment issue on x86 and issues on + some more recent platforms. + +- Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. - Issue #16389: Fixed a performance regression relative to Python 3.1 in the caching of compiled regular expressions. diff --git a/Modules/_ctypes/libffi.diff b/Modules/_ctypes/libffi.diff --- a/Modules/_ctypes/libffi.diff +++ b/Modules/_ctypes/libffi.diff @@ -1,24 +1,19 @@ ---- libffi.orig/configure.ac 2012-04-12 05:10:51.000000000 +0200 -+++ libffi/configure.ac 2012-06-26 15:42:42.477498938 +0200 -@@ -1,4 +1,7 @@ - dnl Process this with autoconf to create configure -+# -+# file from libffi - slightly patched for ctypes -+# +diff -r -N -u libffi.orig/autom4te.cache/output.0 libffi/autom4te.cache/output.0 +diff -r -N -u libffi.orig/configure libffi/configure +--- libffi.orig/configure 2013-03-17 15:37:50.000000000 -0700 ++++ libffi/configure 2013-03-18 15:11:39.611575163 -0700 +@@ -13368,6 +13368,10 @@ + fi + ;; - AC_PREREQ(2.68) - -@@ -114,6 +117,9 @@ - i?86-*-solaris2.1[[0-9]]*) - TARGET=X86_64; TARGETDIR=x86 - ;; -+ i*86-*-nto-qnx*) ++ i*86-*-nto-qnx*) + TARGET=X86; TARGETDIR=x86 + ;; - i?86-*-*) - TARGET=X86_64; TARGETDIR=x86 ++ + x86_64-*-darwin*) + TARGET=X86_DARWIN; TARGETDIR=x86 ;; -@@ -131,12 +137,12 @@ +@@ -13426,12 +13430,12 @@ ;; mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) @@ -32,17 +27,85 @@ + TARGET=MIPS_IRIX; TARGETDIR=mips ;; - moxie-*-*) -@@ -212,7 +218,7 @@ + powerpc*-*-linux* | powerpc-*-sysv*) +@@ -13491,7 +13495,7 @@ + as_fn_error $? "\"libffi has not been ported to $host.\"" "$LINENO" 5 + fi + +- if test x$TARGET = xMIPS; then ++ if expr x$TARGET : 'xMIPS' > /dev/null; then + MIPS_TRUE= + MIPS_FALSE='#' + else +@@ -14862,6 +14866,12 @@ + ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc" + + ++ac_config_links="$ac_config_links include/ffi_common.h:include/ffi_common.h" ++ ++ ++ac_config_files="$ac_config_files fficonfig.py" ++ ++ + cat >confcache <<\_ACEOF + # This file is a shell script that caches the results of configure + # tests run on this system so they can be shared between configure +@@ -16047,6 +16057,8 @@ + "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;; + "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; + "libffi.pc") CONFIG_FILES="$CONFIG_FILES libffi.pc" ;; ++ "include/ffi_common.h") CONFIG_LINKS="$CONFIG_LINKS include/ffi_common.h:include/ffi_common.h" ;; ++ "fficonfig.py") CONFIG_FILES="$CONFIG_FILES fficonfig.py" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +diff -r -N -u libffi.orig/configure.ac libffi/configure.ac +--- libffi.orig/configure.ac 2013-03-17 15:37:50.000000000 -0700 ++++ libffi/configure.ac 2013-03-18 15:11:11.392989136 -0700 +@@ -1,4 +1,7 @@ + dnl Process this with autoconf to create configure ++# ++# file from libffi - slightly patched for Python's ctypes ++# + + AC_PREREQ(2.68) + +@@ -146,6 +149,10 @@ + fi + ;; + ++ i*86-*-nto-qnx*) ++ TARGET=X86; TARGETDIR=x86 ++ ;; ++ + x86_64-*-darwin*) + TARGET=X86_DARWIN; TARGETDIR=x86 + ;; +@@ -204,12 +211,12 @@ + ;; + + mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) +- TARGET=MIPS; TARGETDIR=mips ++ TARGET=MIPS_IRIX; TARGETDIR=mips + ;; + mips*-*-linux* | mips*-*-openbsd*) + # Support 128-bit long double for NewABI. + HAVE_LONG_DOUBLE='defined(__mips64)' +- TARGET=MIPS; TARGETDIR=mips ++ TARGET=MIPS_IRIX; TARGETDIR=mips + ;; + + powerpc*-*-linux* | powerpc-*-sysv*) +@@ -269,7 +276,7 @@ AC_MSG_ERROR(["libffi has not been ported to $host."]) fi -AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS) +AM_CONDITIONAL(MIPS,[expr x$TARGET : 'xMIPS' > /dev/null]) + AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN) AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) AM_CONDITIONAL(X86, test x$TARGET = xX86) - AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD) -@@ -499,4 +505,8 @@ +@@ -567,4 +574,8 @@ AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc) @@ -104,17 +167,3 @@ #endif /* WIN32 */ #ifdef __OS2__ -diff -urN libffi-3.0.11/src/sparc/v8.S libffi/src/sparc/v8.S ---- libffi-3.0.11/src/sparc/v8.S 2012-04-12 04:46:06.000000000 +0200 -+++ libffi/src/sparc/v8.S 2011-03-13 05:15:04.000000000 +0100 -@@ -213,6 +213,10 @@ - be,a done1 - ldd [%fp-8], %i0 - -+ cmp %o0, FFI_TYPE_UINT64 -+ be,a done1 -+ ldd [%fp-8], %i0 -+ - ld [%fp-8], %i0 - done1: - jmp %i7+8 diff --git a/Modules/_ctypes/libffi/.gitignore b/Modules/_ctypes/libffi/.gitignore new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/.gitignore @@ -0,0 +1,21 @@ +.libs +.deps +*.o +*.lo +.dirstamp +*.la +Makefile +config.log +config.status +*~ +fficonfig.h +include/ffi.h +include/ffitarget.h +libffi.pc +libtool +stamp-h1 +libffi*gz +autom4te.cache +libffi.xcodeproj/xcuserdata +libffi.xcodeproj/project.xcworkspace +ios/ diff --git a/Modules/_ctypes/libffi/.travis.yml b/Modules/_ctypes/libffi/.travis.yml new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/.travis.yml @@ -0,0 +1,8 @@ +language: c +compiler: + - gcc + - clang + +before_script: sudo apt-get install dejagnu + +script: ./configure && make && make check diff --git a/Modules/_ctypes/libffi/ChangeLog b/Modules/_ctypes/libffi/ChangeLog --- a/Modules/_ctypes/libffi/ChangeLog +++ b/Modules/_ctypes/libffi/ChangeLog @@ -1,3 +1,439 @@ +2013-03-17 Anthony Green + + * README: Update for 3.0.13. + * configure.ac: Ditto. + * configure: Rebuilt. + * doc/*: Update version. + +2013-03-17 Dave Korn + + * src/closures.c (is_emutramp_enabled + [!FFI_MMAP_EXEC_EMUTRAMP_PAX]): Move default definition outside + enclosing #if scope. + +2013-03-17 Anthony Green + + * configure.ac: Only modify toolexecdir in certain cases. + * configure: Rebuilt. + +2013-03-16 Gilles Talis + + * src/powerpc/ffi.c (ffi_prep_args_SYSV): Don't use + fparg_count,etc on __NO_FPRS__ targets. + +2013-03-16 Alan Hourihane + + * src/m68k/sysv.S (epilogue): Don't use extb instruction on + m680000 machines. + +2013-03-16 Alex Gaynor + + * src/x86/ffi.c (ffi_prep_cif_machdep): Always align stack. + +2013-03-13 Markos Chandras + + * configure.ac: Add support for Imagination Technologies Meta. + * Makefile.am: Likewise. + * README: Add Imagination Technologies Meta details. + * src/metag/ffi.c: New. + * src/metag/ffitarget.h: Likewise. + * src/metag/sysv.S: Likewise. + +2013-02-24 Andreas Schwab + + * doc/libffi.texi (Structures): Fix missing category argument of + @deftp. + +2013-02-11 Anthony Green + + * configure.ac: Update release number to 3.0.12. + * configure: Rebuilt. + * README: Update release info. + +2013-02-10 Anthony Green + + * README: Add Moxie. + * src/moxie/ffi.c: Created. + * src/moxie/eabi.S: Created. + * src/moxie/ffitarget.h: Created. + * Makefile.am (nodist_libffi_la_SOURCES): Add Moxie. + * Makefile.in: Rebuilt. + * configure.ac: Add Moxie. + * configure: Rebuilt. + * testsuite/libffi.call/huge_struct.c: Disable format string + warnings for moxie*-*-elf tests. + +2013-02-10 Anthony Green + + * Makefile.am (LTLDFLAGS): Fix reference. + * Makefile.in: Rebuilt. + +2013-02-10 Anthony Green + + * README: Update supported platforms. Update test results link. + +2013-02-09 Anthony Green + + * testsuite/libffi.call/negint.c: Remove forced -O2. + * testsuite/libffi.call/many2.c (foo): Remove GCCism. + * testsuite/libffi.call/ffitest.h: Add default PRIuPTR definition. + + * src/sparc/v8.S (ffi_closure_v8): Import ancient ulonglong + closure return type fix developed by Martin v. L?wis for cpython + fork. + +2013-02-08 Andreas Tobler + + * src/powerpc/ffi.c (ffi_prep_cif_machdep): Fix small struct + support. + * src/powerpc/sysv.S: Ditto. + +2013-02-08 Anthony Green + + * testsuite/libffi.call/cls_longdouble.c: Remove xfail for + arm*-*-*. + +2013-02-08 Anthony Green + + * src/sparc/ffi.c (ffi_prep_closure_loc): Fix cache flushing for GCC. + +2013-02-08 Matthias Klose + + * man/ffi_prep_cif.3: Clean up for debian linter. + +2013-02-08 Peter Bergner + + * src/powerpc/ffi.c (ffi_prep_args_SYSV): Account for FP args pushed + on the stack. + +2013-02-08 Anthony Green + + * Makefile.am (EXTRA_DIST): Add missing files. + * testsuite/Makefile.am (EXTRA_DIST): Ditto. + * Makefile.in: Rebuilt. + +2013-02-08 Anthony Green + + * configure.ac: Move sparc asm config checks to within functions + for compatibility with sun tools. + * configure: Rebuilt. + * src/sparc/ffi.c (ffi_prep_closure_loc): Flush cache on v9 + systems. + * src/sparc/v8.S (ffi_flush_icache): Implement a sparc v9 cache + flusher. + +2013-02-08 Nathan Rossi + + * src/microblaze/ffi.c (ffi_closure_call_SYSV): Fix handling of + small big-endian structures. + (ffi_prep_args): Ditto. + +2013-02-07 Anthony Green + + * src/sparc/v8.S (ffi_call_v8): Fix typo from last patch + (effectively hiding ffi_call_v8). + +2013-02-07 Anthony Green + + * configure.ac: Update bug reporting address. + * configure.in: Rebuild. + + * src/sparc/v8.S (ffi_flush_icache): Out-of-line cache flusher for + Sun compiler. + * src/sparc/ffi.c (ffi_call): Remove warning. + Call ffi_flush_icache for non-GCC builds. + (ffi_prep_closure_loc): Use ffi_flush_icache. + + * Makefile.am (EXTRA_DIST): Add libtool-ldflags. + * Makefile.in: Rebuilt. + * libtool-ldflags: New file. + +2013-02-07 Daniel Schepler + + * configure.ac: Correctly identify x32 systems as 64-bit. + * m4/libtool.m4: Remove libtool expr error. + * aclocal.m4, configure: Rebuilt. + +2013-02-07 Anthony Green + + * configure.ac: Fix GCC usage test. + * configure: Rebuilt. + * README: Mention LLVM/GCC x86_64 issue. + * testsuite/Makefile.in: Rebuilt. + +2013-02-07 Anthony Green + + * testsuite/libffi.call/cls_double_va.c (main): Replace // style + comments with /* */ for xlc compiler. + * testsuite/libffi.call/stret_large.c (main): Ditto. + * testsuite/libffi.call/stret_large2.c (main): Ditto. + * testsuite/libffi.call/nested_struct1.c (main): Ditto. + * testsuite/libffi.call/huge_struct.c (main): Ditto. + * testsuite/libffi.call/float_va.c (main): Ditto. + * testsuite/libffi.call/cls_struct_va1.c (main): Ditto. + * testsuite/libffi.call/cls_pointer_stack.c (main): Ditto. + * testsuite/libffi.call/cls_pointer.c (main): Ditto. + * testsuite/libffi.call/cls_longdouble_va.c (main): Ditto. + +2013-02-06 Anthony Green + + * man/ffi_prep_cif.3: Clean up for debian lintian checker. + +2013-02-06 Anthony Green + + * Makefile.am (pkgconfigdir): Add missing pkgconfig install bits. + * Makefile.in: Rebuild. + +2013-02-02 Mark H Weaver + + * src/x86/ffi64.c (ffi_call): Sign-extend integer arguments passed + via general purpose registers. + +2013-01-21 Nathan Rossi + + * README: Add MicroBlaze details. + * Makefile.am: Add MicroBlaze support. + * configure.ac: Likewise. + * src/microblaze/ffi.c: New. + * src/microblaze/ffitarget.h: Likewise. + * src/microblaze/sysv.S: Likewise. + +2013-01-21 Nathan Rossi + * testsuite/libffi.call/return_uc.c: Fixed issue. + +2013-01-21 Chris Zankel + + * README: Add Xtensa support. + * Makefile.am: Likewise. + * configure.ac: Likewise. + * Makefile.in Regenerate. + * configure: Likewise. + * src/prep_cif.c: Handle Xtensa. + * src/xtensa: New directory. + * src/xtensa/ffi.c: New file. + * src/xtensa/ffitarget.h: Ditto. + * src/xtensa/sysv.S: Ditto. + +2013-01-11 Anthony Green + + * src/powerpc/ffi_darwin.c (ffi_prep_args): Replace // style + comments with /* */ for xlc compiler. + * src/powerpc/aix.S (ffi_call_AIX): Ditto. + * testsuite/libffi.call/ffitest.h (allocate_mmap): Delete + deprecated inline function. + * testsuite/libffi.special/ffitestcxx.h: Ditto. + * README: Add update for AIX support. + +2013-01-11 Anthony Green + + * configure.ac: Robustify pc relative reloc check. + * m4/ax_cc_maxopt.m4: Don't -malign-double. This is an ABI + changing option for 32-bit x86. + * aclocal.m4, configure: Rebuilt. + * README: Update supported target list. + +2013-01-10 Anthony Green + + * README (tested): Add Compiler column to table. + +2013-01-10 Anthony Green + + * src/x86/ffi64.c (struct register_args): Make sse array and array + of unions for sunpro compiler compatibility. + +2013-01-10 Anthony Green + + * configure.ac: Test target platform size_t size. Handle both 32 + and 64-bit builds for x86_64-* and i?86-* targets (allowing for + CFLAG option to change default settings). + * configure, aclocal.m4: Rebuilt. + +2013-01-10 Anthony Green + + * testsuite/libffi.special/special.exp: Only run exception + handling tests when using GNU compiler. + + * m4/ax_compiler_vendor.m4: New file. + * configure.ac: Test for compiler vendor and don't use + AX_CFLAGS_WARN_ALL with the sun compiler. + * aclocal.m4, configure: Rebuilt. + +2013-01-10 Anthony Green + + * include/ffi_common.h: Don't use GCCisms to define types when + building with the SUNPRO compiler. + +2013-01-10 Anthony Green + + * configure.ac: Put local.exp in the right place. + * configure: Rebuilt. + + * src/x86/ffi.c: Update comment about regparm function attributes. + * src/x86/sysv.S (ffi_closure_SYSV): The SUNPRO compiler requires + that all function arguments be passed on the stack (no regparm + support). + +2013-01-08 Anthony Green + + * configure.ac: Generate local.exp. This sets CC_FOR_TARGET + when we are using the vendor compiler. + * testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): Point to + ../local.exp. + * configure, testsuite/Makefile.in: Rebuilt. + + * testsuite/libffi.call/call.exp: Run tests with different + options, depending on whether or not we are using gcc or the + vendor compiler. + * testsuite/lib/libffi.exp (libffi-init): Set using_gcc based on + whether or not we are building/testing with gcc. + +2013-01-08 Anthony Green + + * configure.ac: Switch x86 solaris target to X86 by default. + * configure: Rebuilt. + +2013-01-08 Anthony Green + + * configure.ac: Fix test for read-only eh_frame. + * configure: Rebuilt. + +2013-01-08 Anthony Green + + * src/x86/sysv.S, src/x86/unix64.S: Only emit DWARF unwind info + when building with the GNU toolchain. + * testsuite/libffi.call/ffitest.h (CHECK): Fix for Solaris vendor + compiler. + +2013-01-07 Thorsten Glaser + + * testsuite/libffi.call/cls_uchar_va.c, + testsuite/libffi.call/cls_ushort_va.c, + testsuite/libffi.call/va_1.c: Testsuite fixes. + +2013-01-07 Thorsten Glaser + + * src/m68k/ffi.c (CIF_FLAGS_SINT8, CIF_FLAGS_SINT16): Define. + (ffi_prep_cif_machdep): Fix 8-bit and 16-bit signed calls. + * src/m68k/sysv.S (ffi_call_SYSV, ffi_closure_SYSV): Ditto. + +2013-01-04 Anthony Green + + * Makefile.am (AM_CFLAGS): Don't automatically add -fexceptions + and -Wall. This is set in the configure script after testing for + GCC. + * Makefile.in: Rebuilt. + +2013-01-02 rofl0r + + * src/powerpc/ffi.c (ffi_prep_cif_machdep): Fix build error on ppc + when long double == double. + +2013-01-02 Reini Urban + + * Makefile.am (libffi_la_LDFLAGS): Add -no-undefined to LDFLAGS + (required for shared libs on cygwin/mingw). + * Makefile.in: Rebuilt. + +2012-10-31 Alan Modra + + * src/powerpc/linux64_closure.S: Add new ABI support. + * src/powerpc/linux64.S: Likewise. + +2012-10-30 Magnus Granberg + Pavel Labushev + + * configure.ac: New options pax_emutramp + * configure, fficonfig.h.in: Regenerated + * src/closures.c: New function emutramp_enabled_check() and + checks. + +2012-10-30 Frederick Cheung + + * configure.ac: Enable FFI_MAP_EXEC_WRIT for Darwin 12 (mountain + lion) and future version. + * configure: Rebuild. + +2012-10-30 James Greenhalgh + Marcus Shawcroft + + * README: Add details of aarch64 port. + * src/aarch64/ffi.c: New. + * src/aarch64/ffitarget.h: Likewise. + * src/aarch64/sysv.S: Likewise. + * Makefile.am: Support aarch64. + * configure.ac: Support aarch64. + * Makefile.in, configure: Rebuilt. + +2012-10-30 James Greenhalgh + Marcus Shawcroft + + * testsuite/lib/libffi.exp: Add support for aarch64. + * testsuite/libffi.call/cls_struct_va1.c: New. + * testsuite/libffi.call/cls_uchar_va.c: Likewise. + * testsuite/libffi.call/cls_uint_va.c: Likewise. + * testsuite/libffi.call/cls_ulong_va.c: Likewise. + * testsuite/libffi.call/cls_ushort_va.c: Likewise. + * testsuite/libffi.call/nested_struct11.c: Likewise. + * testsuite/libffi.call/uninitialized.c: Likewise. + * testsuite/libffi.call/va_1.c: Likewise. + * testsuite/libffi.call/va_struct1.c: Likewise. + * testsuite/libffi.call/va_struct2.c: Likewise. + * testsuite/libffi.call/va_struct3.c: Likewise. + +2012-10-12 Walter Lee + + * Makefile.am: Add TILE-Gx/TILEPro support. + * configure.ac: Likewise. + * Makefile.in: Regenerate. + * configure: Likewise. + * src/prep_cif.c (ffi_prep_cif_core): Handle TILE-Gx/TILEPro. + * src/tile: New directory. + * src/tile/ffi.c: New file. + * src/tile/ffitarget.h: Ditto. + * src/tile/tile.S: Ditto. + +2012-10-12 Matthias Klose + + * generate-osx-source-and-headers.py: Normalize whitespace. + +2012-09-14 David Edelsohn + + * configure: Regenerated. + +2012-08-26 Andrew Pinski + + PR libffi/53014 + * src/mips/ffi.c (ffi_prep_closure_loc): Allow n32 with soft-float and n64 with + soft-float. + +2012-08-08 Uros Bizjak + + * src/s390/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, + just return FFI_BAD_ABI when things are wrong. + +2012-07-18 H.J. Lu + + PR libffi/53982 + PR libffi/53973 + * src/x86/ffitarget.h: Check __ILP32__ instead of __LP64__ for x32. + (FFI_SIZEOF_JAVA_RAW): Defined to 4 for x32. + +2012-05-16 H.J. Lu + + * configure: Regenerated. + +2012-05-05 Nicolas Lelong + + * libffi.xcodeproj/project.pbxproj: Fixes. + * README: Update for iOS builds. + +2012-04-23 Alexandre Keunecke I. de Mendonca + + * configure.ac: Add Blackfin/sysv support + * Makefile.am: Add Blackfin/sysv support + * src/bfin/ffi.c: Add Blackfin/sysv support + * src/bfin/ffitarget.h: Add Blackfin/sysv support + 2012-04-11 Anthony Green * Makefile.am (EXTRA_DIST): Add new script. @@ -27,15 +463,15 @@ * README: Update instructions on building iOS binary. * build-ios.sh: Delete. -2012-04-06 H.J. Lu - - * m4/libtool.m4 (_LT_ENABLE_LOCK): Support x32. - 2012-04-06 Anthony Green * src/x86/ffi64.c (UINT128): Define differently for Intel and GNU compilers, then use it. +2012-04-06 H.J. Lu + + * m4/libtool.m4 (_LT_ENABLE_LOCK): Support x32. + 2012-04-06 Anthony Green * testsuite/Makefile.am (EXTRA_DIST): Add missing test cases. @@ -48,6 +484,14 @@ in CNAME. * src/x86/ffi.c: Wrap Windows specific code in ifdefs. +2012-04-02 Peter Bergner + + * src/powerpc/ffi.c (ffi_prep_args_SYSV): Declare double_tmp. + Silence casting pointer to integer of different size warning. + Delete goto to previously deleted label. + (ffi_call): Silence possibly undefined warning. + (ffi_closure_helper_SYSV): Declare variable type. + 2012-04-02 Peter Rosin * src/x86/win32.S (ffi_call_win32): Sign/zero extend the return @@ -193,6 +637,43 @@ * testsuite/libffi.call/struct9.c: Likewise. * testsuite/libffi.call/testclosure.c: Likewise. +2012-03-21 Peter Rosin + + * testsuite/libffi.call/float_va.c (float_va_fn): Use %f when + printing doubles (%lf is for long doubles). + (main): Likewise. + +2012-03-21 Peter Rosin + + * testsuite/lib/target-libpath.exp [*-*-cygwin*, *-*-mingw*] + (set_ld_library_path_env_vars): Add the library search dir to PATH + (and save PATH for later). + (restore_ld_library_path_env_vars): Restore PATH. + +2012-03-21 Peter Rosin + + * testsuite/lib/target-libpath.exp [*-*-cygwin*, *-*-mingw*] + (set_ld_library_path_env_vars): Add the library search dir to PATH + (and save PATH for later). + (restore_ld_library_path_env_vars): Restore PATH. + +2012-03-20 Peter Rosin + + * testsuite/libffi.call/strlen2_win32.c (main): Remove bug. + * src/x86/win32.S [MSVC] (ffi_closure_SYSV): Make the 'stub' label + visible outside the PROC, so that ffi_closure_THISCALL can see it. + +2012-03-20 Peter Rosin + + * testsuite/libffi.call/strlen2_win32.c (main): Remove bug. + * src/x86/win32.S [MSVC] (ffi_closure_SYSV): Make the 'stub' label + visible outside the PROC, so that ffi_closure_THISCALL can see it. + +2012-03-19 Alan Hourihane + + * src/m68k/ffi.c: Add MINT support. + * src/m68k/sysv.S: Ditto. + 2012-03-06 Chung-Lin Tang * src/arm/ffi.c (ffi_call): Add __ARM_EABI__ guard around call to @@ -201,43 +682,11 @@ ffi_closure_VFP. * src/arm/sysv.S: Add __ARM_EABI__ guard around VFP code. -2012-03-21 Peter Rosin - - * testsuite/libffi.call/float_va.c (float_va_fn): Use %f when - printing doubles (%lf is for long doubles). - (main): Likewise. - -2012-03-21 Peter Rosin - - * testsuite/lib/target-libpath.exp [*-*-cygwin*, *-*-mingw*] - (set_ld_library_path_env_vars): Add the library search dir to PATH - (and save PATH for later). - (restore_ld_library_path_env_vars): Restore PATH. - -2012-03-20 Peter Rosin - - * testsuite/libffi.call/strlen2_win32.c (main): Remove bug. - * src/x86/win32.S [MSVC] (ffi_closure_SYSV): Make the 'stub' label - visible outside the PROC, so that ffi_closure_THISCALL can see it. - -2012-03-19 Alan Hourihane - - * src/m68k/ffi.c: Add MINT support. - * src/m68k/sysv.S: Ditto. - 2012-03-19 chennam * src/powerpc/ffi_darwin.c (ffi_prep_closure_loc): Fix AIX closure support. -2012-04-02 Peter Bergner - - * src/powerpc/ffi.c (ffi_prep_args_SYSV): Declare double_tmp. - Silence casting pointer to integer of different size warning. - Delete goto to previously deleted label. - (ffi_call): Silence possibly undefined warning. - (ffi_closure_helper_SYSV): Declare variable type. - 2012-03-13 Kaz Kojima * src/sh/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, diff --git a/Modules/_ctypes/libffi/ChangeLog.libffi b/Modules/_ctypes/libffi/ChangeLog.libffi --- a/Modules/_ctypes/libffi/ChangeLog.libffi +++ b/Modules/_ctypes/libffi/ChangeLog.libffi @@ -574,8 +574,8 @@ * Makefile.am, include/Makefile.am: Move headers to libffi_la_SOURCES for new automake. * Makefile.in, include/Makefile.in: Rebuilt. - - * testsuite/lib/wrapper.exp: Copied from gcc tree to allow for + + * testsuite/lib/wrapper.exp: Copied from gcc tree to allow for execution outside of gcc tree. * testsuite/lib/target-libpath.exp: Ditto. diff --git a/Modules/_ctypes/libffi/Makefile.am b/Modules/_ctypes/libffi/Makefile.am --- a/Modules/_ctypes/libffi/Makefile.am +++ b/Modules/_ctypes/libffi/Makefile.am @@ -2,40 +2,50 @@ AUTOMAKE_OPTIONS = foreign subdir-objects +ACLOCAL_AMFLAGS = -I m4 + SUBDIRS = include testsuite man -EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ - src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \ - src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \ - src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \ - src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \ - src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \ - src/ia64/unix.S src/mips/ffi.c src/mips/n32.S src/mips/o32.S \ - src/mips/ffitarget.h src/m32r/ffi.c src/m32r/sysv.S \ - src/m32r/ffitarget.h src/m68k/ffi.c src/m68k/sysv.S \ - src/m68k/ffitarget.h src/powerpc/ffi.c src/powerpc/sysv.S \ - src/powerpc/linux64.S src/powerpc/linux64_closure.S \ - src/powerpc/ppc_closure.S src/powerpc/asm.h src/powerpc/aix.S \ - src/powerpc/darwin.S src/powerpc/aix_closure.S \ - src/powerpc/darwin_closure.S src/powerpc/ffi_darwin.c \ - src/powerpc/ffitarget.h src/s390/ffi.c src/s390/sysv.S \ - src/s390/ffitarget.h src/sh/ffi.c src/sh/sysv.S \ - src/sh/ffitarget.h src/sh64/ffi.c src/sh64/sysv.S \ - src/sh64/ffitarget.h src/sparc/v8.S src/sparc/v9.S \ - src/sparc/ffitarget.h src/sparc/ffi.c src/x86/darwin64.S \ - src/x86/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/darwin.S \ - src/x86/win64.S src/x86/freebsd.S src/x86/ffi64.c \ - src/x86/unix64.S src/x86/ffitarget.h src/pa/ffitarget.h \ - src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c \ - src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c \ - src/moxie/ffi.c src/moxie/eabi.S libtool-version \ - ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4 \ - m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \ - m4/ltversion.m4 src/arm/gentramp.sh src/debug.c \ - msvcc.sh generate-ios-source-and-headers.py \ - generate-osx-source-and-headers.py \ - libffi.xcodeproj/project.pbxproj \ - src/arm/trampoline.S +EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ + src/aarch64/ffi.c src/aarch64/ffitarget.h src/aarch64/sysv.S \ + build-ios.sh src/alpha/ffi.c src/alpha/osf.S \ + src/alpha/ffitarget.h src/arm/ffi.c src/arm/sysv.S \ + src/arm/ffitarget.h src/avr32/ffi.c src/avr32/sysv.S \ + src/avr32/ffitarget.h src/cris/ffi.c src/cris/sysv.S \ + src/cris/ffitarget.h src/ia64/ffi.c src/ia64/ffitarget.h \ + src/ia64/ia64_flags.h src/ia64/unix.S src/mips/ffi.c \ + src/mips/n32.S src/mips/o32.S src/metag/ffi.c \ + src/metag/ffitarget.h src/metag/sysv.S src/moxie/ffi.c \ + src/moxie/ffitarget.h src/moxie/eabi.S src/mips/ffitarget.h \ + src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ + src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ + src/microblaze/ffi.c src/microblaze/sysv.S \ + src/microblaze/ffitarget.h src/powerpc/ffi.c \ + src/powerpc/sysv.S src/powerpc/linux64.S \ + src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \ + src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S \ + src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ + src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ + src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ + src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c \ + src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S \ + src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c \ + src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S \ + src/x86/win32.S src/x86/darwin.S src/x86/win64.S \ + src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S \ + src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c \ + src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c \ + src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S \ + src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c \ + src/tile/ffitarget.h src/tile/tile.S libtool-version \ + src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S \ + ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4 \ + m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \ + m4/ltversion.m4 src/arm/gentramp.sh src/debug.c msvcc.sh \ + generate-ios-source-and-headers.py \ + generate-osx-source-and-headers.py \ + libffi.xcodeproj/project.pbxproj src/arm/trampoline.S \ + libtool-ldflags info_TEXINFOS = doc/libffi.texi @@ -83,11 +93,12 @@ "RANLIB=$(RANLIB)" \ "DESTDIR=$(DESTDIR)" +# Subdir rules rely on $(FLAGS_TO_PASS) +FLAGS_TO_PASS = $(AM_MAKEFLAGS) + MAKEOVERRIDES= -ACLOCAL_AMFLAGS=$(ACLOCAL_AMFLAGS) -I m4 - -lib_LTLIBRARIES = libffi.la +toolexeclib_LTLIBRARIES = libffi.la noinst_LTLIBRARIES = libffi_convenience.la libffi_la_SOURCES = src/prep_cif.c src/types.c \ @@ -105,6 +116,9 @@ if MIPS nodist_libffi_la_SOURCES += src/mips/ffi.c src/mips/o32.S src/mips/n32.S endif +if BFIN +nodist_libffi_la_SOURCES += src/bfin/ffi.c src/bfin/sysv.S +endif if X86 nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/sysv.S endif @@ -135,6 +149,12 @@ if M68K nodist_libffi_la_SOURCES += src/m68k/ffi.c src/m68k/sysv.S endif +if MOXIE +nodist_libffi_la_SOURCES += src/moxie/ffi.c src/moxie/eabi.S +endif +if MICROBLAZE +nodist_libffi_la_SOURCES += src/microblaze/ffi.c src/microblaze/sysv.S +endif if POWERPC nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S endif @@ -147,6 +167,9 @@ if POWERPC_FREEBSD nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S endif +if AARCH64 +nodist_libffi_la_SOURCES += src/aarch64/sysv.S src/aarch64/ffi.c +endif if ARM nodist_libffi_la_SOURCES += src/arm/sysv.S src/arm/ffi.c if FFI_EXEC_TRAMPOLINE_TABLE @@ -162,9 +185,6 @@ if FRV nodist_libffi_la_SOURCES += src/frv/eabi.S src/frv/ffi.c endif -if MOXIE -nodist_libffi_la_SOURCES += src/moxie/eabi.S src/moxie/ffi.c -endif if S390 nodist_libffi_la_SOURCES += src/s390/sysv.S src/s390/ffi.c endif @@ -183,23 +203,23 @@ if PA_HPUX nodist_libffi_la_SOURCES += src/pa/hpux32.S src/pa/ffi.c endif +if TILE +nodist_libffi_la_SOURCES += src/tile/tile.S src/tile/ffi.c +endif +if XTENSA +nodist_libffi_la_SOURCES += src/xtensa/sysv.S src/xtensa/ffi.c +endif +if METAG +nodist_libffi_la_SOURCES += src/metag/sysv.S src/metag/ffi.c +endif libffi_convenience_la_SOURCES = $(libffi_la_SOURCES) nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) -AM_CFLAGS = -g -if FFI_DEBUG -# Build debug. Define FFI_DEBUG on the commandline so that, when building with -# MSVC, it can link against the debug CRT. -AM_CFLAGS += -DFFI_DEBUG -endif +LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/libtool-ldflags $(LDFLAGS)) -libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) +libffi_la_LDFLAGS = -no-undefined -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) -AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src -DFFI_BUILDING -AM_CCASFLAGS = $(AM_CPPFLAGS) -g +AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src +AM_CCASFLAGS = $(AM_CPPFLAGS) -# No install-html or install-pdf support in automake yet -.PHONY: install-html install-pdf -install-html: -install-pdf: diff --git a/Modules/_ctypes/libffi/Makefile.in b/Modules/_ctypes/libffi/Makefile.in --- a/Modules/_ctypes/libffi/Makefile.in +++ b/Modules/_ctypes/libffi/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. +# Makefile.in generated by automake 1.12.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -17,6 +16,23 @@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -38,45 +54,59 @@ target_triplet = @target@ @FFI_DEBUG_TRUE at am__append_1 = src/debug.c @MIPS_TRUE at am__append_2 = src/mips/ffi.c src/mips/o32.S src/mips/n32.S - at X86_TRUE@am__append_3 = src/x86/ffi.c src/x86/sysv.S - at X86_FREEBSD_TRUE@am__append_4 = src/x86/ffi.c src/x86/freebsd.S - at X86_WIN32_TRUE@am__append_5 = src/x86/ffi.c src/x86/win32.S - at X86_WIN64_TRUE@am__append_6 = src/x86/ffi.c src/x86/win64.S - at X86_DARWIN_TRUE@am__append_7 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S - at SPARC_TRUE@am__append_8 = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S - at ALPHA_TRUE@am__append_9 = src/alpha/ffi.c src/alpha/osf.S - at IA64_TRUE@am__append_10 = src/ia64/ffi.c src/ia64/unix.S - at M32R_TRUE@am__append_11 = src/m32r/sysv.S src/m32r/ffi.c - at M68K_TRUE@am__append_12 = src/m68k/ffi.c src/m68k/sysv.S - at POWERPC_TRUE@am__append_13 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S - at POWERPC_AIX_TRUE@am__append_14 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S - at POWERPC_DARWIN_TRUE@am__append_15 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S - at POWERPC_FREEBSD_TRUE@am__append_16 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S - at ARM_TRUE@am__append_17 = src/arm/sysv.S src/arm/ffi.c - at ARM_TRUE@@FFI_EXEC_TRAMPOLINE_TABLE_TRUE at am__append_18 = src/arm/trampoline.S - at AVR32_TRUE@am__append_19 = src/avr32/sysv.S src/avr32/ffi.c - at LIBFFI_CRIS_TRUE@am__append_20 = src/cris/sysv.S src/cris/ffi.c - at FRV_TRUE@am__append_21 = src/frv/eabi.S src/frv/ffi.c - at MOXIE_TRUE@am__append_22 = src/moxie/eabi.S src/moxie/ffi.c - at S390_TRUE@am__append_23 = src/s390/sysv.S src/s390/ffi.c - at X86_64_TRUE@am__append_24 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S - at SH_TRUE@am__append_25 = src/sh/sysv.S src/sh/ffi.c - at SH64_TRUE@am__append_26 = src/sh64/sysv.S src/sh64/ffi.c - at PA_LINUX_TRUE@am__append_27 = src/pa/linux.S src/pa/ffi.c - at PA_HPUX_TRUE@am__append_28 = src/pa/hpux32.S src/pa/ffi.c -# Build debug. Define FFI_DEBUG on the commandline so that, when building with -# MSVC, it can link against the debug CRT. - at FFI_DEBUG_TRUE@am__append_29 = -DFFI_DEBUG + at BFIN_TRUE@am__append_3 = src/bfin/ffi.c src/bfin/sysv.S + at X86_TRUE@am__append_4 = src/x86/ffi.c src/x86/sysv.S + at X86_FREEBSD_TRUE@am__append_5 = src/x86/ffi.c src/x86/freebsd.S + at X86_WIN32_TRUE@am__append_6 = src/x86/ffi.c src/x86/win32.S + at X86_WIN64_TRUE@am__append_7 = src/x86/ffi.c src/x86/win64.S + at X86_DARWIN_TRUE@am__append_8 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S + at SPARC_TRUE@am__append_9 = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S + at ALPHA_TRUE@am__append_10 = src/alpha/ffi.c src/alpha/osf.S + at IA64_TRUE@am__append_11 = src/ia64/ffi.c src/ia64/unix.S + at M32R_TRUE@am__append_12 = src/m32r/sysv.S src/m32r/ffi.c + at M68K_TRUE@am__append_13 = src/m68k/ffi.c src/m68k/sysv.S + at MOXIE_TRUE@am__append_14 = src/moxie/ffi.c src/moxie/eabi.S + at MICROBLAZE_TRUE@am__append_15 = src/microblaze/ffi.c src/microblaze/sysv.S + at POWERPC_TRUE@am__append_16 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S + at POWERPC_AIX_TRUE@am__append_17 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S + at POWERPC_DARWIN_TRUE@am__append_18 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S + at POWERPC_FREEBSD_TRUE@am__append_19 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S + at AARCH64_TRUE@am__append_20 = src/aarch64/sysv.S src/aarch64/ffi.c + at ARM_TRUE@am__append_21 = src/arm/sysv.S src/arm/ffi.c + at ARM_TRUE@@FFI_EXEC_TRAMPOLINE_TABLE_TRUE at am__append_22 = src/arm/trampoline.S + at AVR32_TRUE@am__append_23 = src/avr32/sysv.S src/avr32/ffi.c + at LIBFFI_CRIS_TRUE@am__append_24 = src/cris/sysv.S src/cris/ffi.c + at FRV_TRUE@am__append_25 = src/frv/eabi.S src/frv/ffi.c + at S390_TRUE@am__append_26 = src/s390/sysv.S src/s390/ffi.c + at X86_64_TRUE@am__append_27 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S + at SH_TRUE@am__append_28 = src/sh/sysv.S src/sh/ffi.c + at SH64_TRUE@am__append_29 = src/sh64/sysv.S src/sh64/ffi.c + at PA_LINUX_TRUE@am__append_30 = src/pa/linux.S src/pa/ffi.c + at PA_HPUX_TRUE@am__append_31 = src/pa/hpux32.S src/pa/ffi.c + at TILE_TRUE@am__append_32 = src/tile/tile.S src/tile/ffi.c + at XTENSA_TRUE@am__append_33 = src/xtensa/sysv.S src/xtensa/ffi.c + at METAG_TRUE@am__append_34 = src/metag/sysv.S src/metag/ffi.c subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/doc/stamp-vti \ $(srcdir)/doc/version.texi $(srcdir)/fficonfig.h.in \ - $(srcdir)/fficonfig.py.in $(srcdir)/libffi.pc.in \ - $(top_srcdir)/configure ChangeLog compile config.guess \ - config.sub depcomp install-sh ltmain.sh mdate-sh missing \ - texinfo.tex + $(srcdir)/libffi.pc.in $(top_srcdir)/configure ChangeLog \ + compile config.guess config.sub depcomp install-sh ltmain.sh \ + mdate-sh missing texinfo.tex ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_cc_maxopt.m4 \ + $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_configure_args.m4 \ + $(top_srcdir)/m4/ax_enable_builddir.m4 \ + $(top_srcdir)/m4/ax_gcc_archflag.m4 \ + $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -84,7 +114,7 @@ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = fficonfig.h -CONFIG_CLEAN_FILES = libffi.pc fficonfig.py +CONFIG_CLEAN_FILES = libffi.pc CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ @@ -113,9 +143,9 @@ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(infodir)" \ +am__installdirs = "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)" \ "$(DESTDIR)$(pkgconfigdir)" -LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) +LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES) libffi_la_LIBADD = am__dirstamp = $(am__leading_dot)dirstamp am_libffi_la_OBJECTS = src/prep_cif.lo src/types.lo src/raw_api.lo \ @@ -123,44 +153,51 @@ @FFI_DEBUG_TRUE at am__objects_1 = src/debug.lo @MIPS_TRUE at am__objects_2 = src/mips/ffi.lo src/mips/o32.lo \ @MIPS_TRUE@ src/mips/n32.lo - at X86_TRUE@am__objects_3 = src/x86/ffi.lo src/x86/sysv.lo - at X86_FREEBSD_TRUE@am__objects_4 = src/x86/ffi.lo src/x86/freebsd.lo - at X86_WIN32_TRUE@am__objects_5 = src/x86/ffi.lo src/x86/win32.lo - at X86_WIN64_TRUE@am__objects_6 = src/x86/ffi.lo src/x86/win64.lo - at X86_DARWIN_TRUE@am__objects_7 = src/x86/ffi.lo src/x86/darwin.lo \ + at BFIN_TRUE@am__objects_3 = src/bfin/ffi.lo src/bfin/sysv.lo + at X86_TRUE@am__objects_4 = src/x86/ffi.lo src/x86/sysv.lo + at X86_FREEBSD_TRUE@am__objects_5 = src/x86/ffi.lo src/x86/freebsd.lo + at X86_WIN32_TRUE@am__objects_6 = src/x86/ffi.lo src/x86/win32.lo + at X86_WIN64_TRUE@am__objects_7 = src/x86/ffi.lo src/x86/win64.lo + at X86_DARWIN_TRUE@am__objects_8 = src/x86/ffi.lo src/x86/darwin.lo \ @X86_DARWIN_TRUE@ src/x86/ffi64.lo src/x86/darwin64.lo - at SPARC_TRUE@am__objects_8 = src/sparc/ffi.lo src/sparc/v8.lo \ + at SPARC_TRUE@am__objects_9 = src/sparc/ffi.lo src/sparc/v8.lo \ @SPARC_TRUE@ src/sparc/v9.lo - at ALPHA_TRUE@am__objects_9 = src/alpha/ffi.lo src/alpha/osf.lo - at IA64_TRUE@am__objects_10 = src/ia64/ffi.lo src/ia64/unix.lo - at M32R_TRUE@am__objects_11 = src/m32r/sysv.lo src/m32r/ffi.lo - at M68K_TRUE@am__objects_12 = src/m68k/ffi.lo src/m68k/sysv.lo - at POWERPC_TRUE@am__objects_13 = src/powerpc/ffi.lo src/powerpc/sysv.lo \ + at ALPHA_TRUE@am__objects_10 = src/alpha/ffi.lo src/alpha/osf.lo + at IA64_TRUE@am__objects_11 = src/ia64/ffi.lo src/ia64/unix.lo + at M32R_TRUE@am__objects_12 = src/m32r/sysv.lo src/m32r/ffi.lo + at M68K_TRUE@am__objects_13 = src/m68k/ffi.lo src/m68k/sysv.lo + at MOXIE_TRUE@am__objects_14 = src/moxie/ffi.lo src/moxie/eabi.lo + at MICROBLAZE_TRUE@am__objects_15 = src/microblaze/ffi.lo \ + at MICROBLAZE_TRUE@ src/microblaze/sysv.lo + at POWERPC_TRUE@am__objects_16 = src/powerpc/ffi.lo src/powerpc/sysv.lo \ @POWERPC_TRUE@ src/powerpc/ppc_closure.lo \ @POWERPC_TRUE@ src/powerpc/linux64.lo \ @POWERPC_TRUE@ src/powerpc/linux64_closure.lo - at POWERPC_AIX_TRUE@am__objects_14 = src/powerpc/ffi_darwin.lo \ + at POWERPC_AIX_TRUE@am__objects_17 = src/powerpc/ffi_darwin.lo \ @POWERPC_AIX_TRUE@ src/powerpc/aix.lo \ @POWERPC_AIX_TRUE@ src/powerpc/aix_closure.lo - at POWERPC_DARWIN_TRUE@am__objects_15 = src/powerpc/ffi_darwin.lo \ + at POWERPC_DARWIN_TRUE@am__objects_18 = src/powerpc/ffi_darwin.lo \ @POWERPC_DARWIN_TRUE@ src/powerpc/darwin.lo \ @POWERPC_DARWIN_TRUE@ src/powerpc/darwin_closure.lo - at POWERPC_FREEBSD_TRUE@am__objects_16 = src/powerpc/ffi.lo \ + at POWERPC_FREEBSD_TRUE@am__objects_19 = src/powerpc/ffi.lo \ @POWERPC_FREEBSD_TRUE@ src/powerpc/sysv.lo \ @POWERPC_FREEBSD_TRUE@ src/powerpc/ppc_closure.lo - at ARM_TRUE@am__objects_17 = src/arm/sysv.lo src/arm/ffi.lo - at ARM_TRUE@@FFI_EXEC_TRAMPOLINE_TABLE_TRUE at am__objects_18 = src/arm/trampoline.lo - at AVR32_TRUE@am__objects_19 = src/avr32/sysv.lo src/avr32/ffi.lo - at LIBFFI_CRIS_TRUE@am__objects_20 = src/cris/sysv.lo src/cris/ffi.lo - at FRV_TRUE@am__objects_21 = src/frv/eabi.lo src/frv/ffi.lo - at MOXIE_TRUE@am__objects_22 = src/moxie/eabi.lo src/moxie/ffi.lo - at S390_TRUE@am__objects_23 = src/s390/sysv.lo src/s390/ffi.lo - at X86_64_TRUE@am__objects_24 = src/x86/ffi64.lo src/x86/unix64.lo \ + at AARCH64_TRUE@am__objects_20 = src/aarch64/sysv.lo src/aarch64/ffi.lo + at ARM_TRUE@am__objects_21 = src/arm/sysv.lo src/arm/ffi.lo + at ARM_TRUE@@FFI_EXEC_TRAMPOLINE_TABLE_TRUE at am__objects_22 = src/arm/trampoline.lo + at AVR32_TRUE@am__objects_23 = src/avr32/sysv.lo src/avr32/ffi.lo + at LIBFFI_CRIS_TRUE@am__objects_24 = src/cris/sysv.lo src/cris/ffi.lo + at FRV_TRUE@am__objects_25 = src/frv/eabi.lo src/frv/ffi.lo + at S390_TRUE@am__objects_26 = src/s390/sysv.lo src/s390/ffi.lo + at X86_64_TRUE@am__objects_27 = src/x86/ffi64.lo src/x86/unix64.lo \ @X86_64_TRUE@ src/x86/ffi.lo src/x86/sysv.lo - at SH_TRUE@am__objects_25 = src/sh/sysv.lo src/sh/ffi.lo - at SH64_TRUE@am__objects_26 = src/sh64/sysv.lo src/sh64/ffi.lo - at PA_LINUX_TRUE@am__objects_27 = src/pa/linux.lo src/pa/ffi.lo - at PA_HPUX_TRUE@am__objects_28 = src/pa/hpux32.lo src/pa/ffi.lo + at SH_TRUE@am__objects_28 = src/sh/sysv.lo src/sh/ffi.lo + at SH64_TRUE@am__objects_29 = src/sh64/sysv.lo src/sh64/ffi.lo + at PA_LINUX_TRUE@am__objects_30 = src/pa/linux.lo src/pa/ffi.lo + at PA_HPUX_TRUE@am__objects_31 = src/pa/hpux32.lo src/pa/ffi.lo + at TILE_TRUE@am__objects_32 = src/tile/tile.lo src/tile/ffi.lo + at XTENSA_TRUE@am__objects_33 = src/xtensa/sysv.lo src/xtensa/ffi.lo + at METAG_TRUE@am__objects_34 = src/metag/sysv.lo src/metag/ffi.lo nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ $(am__objects_3) $(am__objects_4) $(am__objects_5) \ $(am__objects_6) $(am__objects_7) $(am__objects_8) \ @@ -170,17 +207,19 @@ $(am__objects_18) $(am__objects_19) $(am__objects_20) \ $(am__objects_21) $(am__objects_22) $(am__objects_23) \ $(am__objects_24) $(am__objects_25) $(am__objects_26) \ - $(am__objects_27) $(am__objects_28) + $(am__objects_27) $(am__objects_28) $(am__objects_29) \ + $(am__objects_30) $(am__objects_31) $(am__objects_32) \ + $(am__objects_33) $(am__objects_34) libffi_la_OBJECTS = $(am_libffi_la_OBJECTS) \ $(nodist_libffi_la_OBJECTS) libffi_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libffi_la_LDFLAGS) $(LDFLAGS) -o $@ libffi_convenience_la_LIBADD = -am__objects_29 = src/prep_cif.lo src/types.lo src/raw_api.lo \ +am__objects_35 = src/prep_cif.lo src/types.lo src/raw_api.lo \ src/java_raw_api.lo src/closures.lo -am_libffi_convenience_la_OBJECTS = $(am__objects_29) -am__objects_30 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \ +am_libffi_convenience_la_OBJECTS = $(am__objects_35) +am__objects_36 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \ $(am__objects_4) $(am__objects_5) $(am__objects_6) \ $(am__objects_7) $(am__objects_8) $(am__objects_9) \ $(am__objects_10) $(am__objects_11) $(am__objects_12) \ @@ -189,8 +228,10 @@ $(am__objects_19) $(am__objects_20) $(am__objects_21) \ $(am__objects_22) $(am__objects_23) $(am__objects_24) \ $(am__objects_25) $(am__objects_26) $(am__objects_27) \ - $(am__objects_28) -nodist_libffi_convenience_la_OBJECTS = $(am__objects_30) + $(am__objects_28) $(am__objects_29) $(am__objects_30) \ + $(am__objects_31) $(am__objects_32) $(am__objects_33) \ + $(am__objects_34) +nodist_libffi_convenience_la_OBJECTS = $(am__objects_36) libffi_convenience_la_OBJECTS = $(am_libffi_convenience_la_OBJECTS) \ $(nodist_libffi_convenience_la_OBJECTS) DEFAULT_INCLUDES = -I. at am__isrc@ @@ -234,14 +275,20 @@ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac DATA = $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ - distdir dist dist-all distcheck + cscope distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags +CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) @@ -252,6 +299,7 @@ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi +am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ @@ -279,6 +327,7 @@ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best +DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -347,6 +396,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PRTDIAG = @PRTDIAG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -367,6 +417,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -402,6 +453,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ @@ -414,39 +466,48 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign subdir-objects +ACLOCAL_AMFLAGS = -I m4 SUBDIRS = include testsuite man -EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ - src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \ - src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \ - src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \ - src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \ - src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \ - src/ia64/unix.S src/mips/ffi.c src/mips/n32.S src/mips/o32.S \ - src/mips/ffitarget.h src/m32r/ffi.c src/m32r/sysv.S \ - src/m32r/ffitarget.h src/m68k/ffi.c src/m68k/sysv.S \ - src/m68k/ffitarget.h src/powerpc/ffi.c src/powerpc/sysv.S \ - src/powerpc/linux64.S src/powerpc/linux64_closure.S \ - src/powerpc/ppc_closure.S src/powerpc/asm.h src/powerpc/aix.S \ - src/powerpc/darwin.S src/powerpc/aix_closure.S \ - src/powerpc/darwin_closure.S src/powerpc/ffi_darwin.c \ - src/powerpc/ffitarget.h src/s390/ffi.c src/s390/sysv.S \ - src/s390/ffitarget.h src/sh/ffi.c src/sh/sysv.S \ - src/sh/ffitarget.h src/sh64/ffi.c src/sh64/sysv.S \ - src/sh64/ffitarget.h src/sparc/v8.S src/sparc/v9.S \ - src/sparc/ffitarget.h src/sparc/ffi.c src/x86/darwin64.S \ - src/x86/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/darwin.S \ - src/x86/win64.S src/x86/freebsd.S src/x86/ffi64.c \ - src/x86/unix64.S src/x86/ffitarget.h src/pa/ffitarget.h \ - src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c \ - src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c \ - src/moxie/ffi.c src/moxie/eabi.S libtool-version \ - ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4 \ - m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \ - m4/ltversion.m4 src/arm/gentramp.sh src/debug.c \ - msvcc.sh generate-ios-source-and-headers.py \ - generate-osx-source-and-headers.py \ - libffi.xcodeproj/project.pbxproj \ - src/arm/trampoline.S +EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ + src/aarch64/ffi.c src/aarch64/ffitarget.h src/aarch64/sysv.S \ + build-ios.sh src/alpha/ffi.c src/alpha/osf.S \ + src/alpha/ffitarget.h src/arm/ffi.c src/arm/sysv.S \ + src/arm/ffitarget.h src/avr32/ffi.c src/avr32/sysv.S \ + src/avr32/ffitarget.h src/cris/ffi.c src/cris/sysv.S \ + src/cris/ffitarget.h src/ia64/ffi.c src/ia64/ffitarget.h \ + src/ia64/ia64_flags.h src/ia64/unix.S src/mips/ffi.c \ + src/mips/n32.S src/mips/o32.S src/metag/ffi.c \ + src/metag/ffitarget.h src/metag/sysv.S src/moxie/ffi.c \ + src/moxie/ffitarget.h src/moxie/eabi.S src/mips/ffitarget.h \ + src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ + src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ + src/microblaze/ffi.c src/microblaze/sysv.S \ + src/microblaze/ffitarget.h src/powerpc/ffi.c \ + src/powerpc/sysv.S src/powerpc/linux64.S \ + src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \ + src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S \ + src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ + src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ + src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ + src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c \ + src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S \ + src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c \ + src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S \ + src/x86/win32.S src/x86/darwin.S src/x86/win64.S \ + src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S \ + src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c \ + src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c \ + src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S \ + src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c \ + src/tile/ffitarget.h src/tile/tile.S libtool-version \ + src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S \ + ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4 \ + m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \ + m4/ltversion.m4 src/arm/gentramp.sh src/debug.c msvcc.sh \ + generate-ios-source-and-headers.py \ + generate-osx-source-and-headers.py \ + libffi.xcodeproj/project.pbxproj src/arm/trampoline.S \ + libtool-ldflags info_TEXINFOS = doc/libffi.texi @@ -488,9 +549,11 @@ "RANLIB=$(RANLIB)" \ "DESTDIR=$(DESTDIR)" + +# Subdir rules rely on $(FLAGS_TO_PASS) +FLAGS_TO_PASS = $(AM_MAKEFLAGS) MAKEOVERRIDES = -ACLOCAL_AMFLAGS = $(ACLOCAL_AMFLAGS) -I m4 -lib_LTLIBRARIES = libffi.la +toolexeclib_LTLIBRARIES = libffi.la noinst_LTLIBRARIES = libffi_convenience.la libffi_la_SOURCES = src/prep_cif.c src/types.c \ src/raw_api.c src/java_raw_api.c src/closures.c @@ -506,13 +569,15 @@ $(am__append_18) $(am__append_19) $(am__append_20) \ $(am__append_21) $(am__append_22) $(am__append_23) \ $(am__append_24) $(am__append_25) $(am__append_26) \ - $(am__append_27) $(am__append_28) + $(am__append_27) $(am__append_28) $(am__append_29) \ + $(am__append_30) $(am__append_31) $(am__append_32) \ + $(am__append_33) $(am__append_34) libffi_convenience_la_SOURCES = $(libffi_la_SOURCES) nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) -AM_CFLAGS = -g $(am__append_29) -libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) -AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src -DFFI_BUILDING -AM_CCASFLAGS = $(AM_CPPFLAGS) -g +LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/libtool-ldflags $(LDFLAGS)) +libffi_la_LDFLAGS = -no-undefined -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) +AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src +AM_CCASFLAGS = $(AM_CPPFLAGS) all: fficonfig.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -569,48 +634,51 @@ -rm -f fficonfig.h stamp-h1 libffi.pc: $(top_builddir)/config.status $(srcdir)/libffi.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ -fficonfig.py: $(top_builddir)/config.status $(srcdir)/fficonfig.py.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -install-libLTLIBRARIES: $(lib_LTLIBRARIES) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(toolexeclibdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \ } -uninstall-libLTLIBRARIES: +uninstall-toolexeclibLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$f"; \ done -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done +clean-toolexeclibLTLIBRARIES: + -test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES) + @list='$(toolexeclib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } src/$(am__dirstamp): @$(MKDIR_P) src @: > src/$(am__dirstamp) @@ -635,6 +703,16 @@ src/mips/$(DEPDIR)/$(am__dirstamp) src/mips/n32.lo: src/mips/$(am__dirstamp) \ src/mips/$(DEPDIR)/$(am__dirstamp) +src/bfin/$(am__dirstamp): + @$(MKDIR_P) src/bfin + @: > src/bfin/$(am__dirstamp) +src/bfin/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/bfin/$(DEPDIR) + @: > src/bfin/$(DEPDIR)/$(am__dirstamp) +src/bfin/ffi.lo: src/bfin/$(am__dirstamp) \ + src/bfin/$(DEPDIR)/$(am__dirstamp) +src/bfin/sysv.lo: src/bfin/$(am__dirstamp) \ + src/bfin/$(DEPDIR)/$(am__dirstamp) src/x86/$(am__dirstamp): @$(MKDIR_P) src/x86 @: > src/x86/$(am__dirstamp) @@ -709,6 +787,26 @@ src/m68k/$(DEPDIR)/$(am__dirstamp) src/m68k/sysv.lo: src/m68k/$(am__dirstamp) \ src/m68k/$(DEPDIR)/$(am__dirstamp) +src/moxie/$(am__dirstamp): + @$(MKDIR_P) src/moxie + @: > src/moxie/$(am__dirstamp) +src/moxie/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/moxie/$(DEPDIR) + @: > src/moxie/$(DEPDIR)/$(am__dirstamp) +src/moxie/ffi.lo: src/moxie/$(am__dirstamp) \ + src/moxie/$(DEPDIR)/$(am__dirstamp) +src/moxie/eabi.lo: src/moxie/$(am__dirstamp) \ + src/moxie/$(DEPDIR)/$(am__dirstamp) +src/microblaze/$(am__dirstamp): + @$(MKDIR_P) src/microblaze + @: > src/microblaze/$(am__dirstamp) +src/microblaze/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/microblaze/$(DEPDIR) + @: > src/microblaze/$(DEPDIR)/$(am__dirstamp) +src/microblaze/ffi.lo: src/microblaze/$(am__dirstamp) \ + src/microblaze/$(DEPDIR)/$(am__dirstamp) +src/microblaze/sysv.lo: src/microblaze/$(am__dirstamp) \ + src/microblaze/$(DEPDIR)/$(am__dirstamp) src/powerpc/$(am__dirstamp): @$(MKDIR_P) src/powerpc @: > src/powerpc/$(am__dirstamp) @@ -735,6 +833,16 @@ src/powerpc/$(DEPDIR)/$(am__dirstamp) src/powerpc/darwin_closure.lo: src/powerpc/$(am__dirstamp) \ src/powerpc/$(DEPDIR)/$(am__dirstamp) +src/aarch64/$(am__dirstamp): + @$(MKDIR_P) src/aarch64 + @: > src/aarch64/$(am__dirstamp) +src/aarch64/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/aarch64/$(DEPDIR) + @: > src/aarch64/$(DEPDIR)/$(am__dirstamp) +src/aarch64/sysv.lo: src/aarch64/$(am__dirstamp) \ + src/aarch64/$(DEPDIR)/$(am__dirstamp) +src/aarch64/ffi.lo: src/aarch64/$(am__dirstamp) \ + src/aarch64/$(DEPDIR)/$(am__dirstamp) src/arm/$(am__dirstamp): @$(MKDIR_P) src/arm @: > src/arm/$(am__dirstamp) @@ -777,16 +885,6 @@ src/frv/$(DEPDIR)/$(am__dirstamp) src/frv/ffi.lo: src/frv/$(am__dirstamp) \ src/frv/$(DEPDIR)/$(am__dirstamp) -src/moxie/$(am__dirstamp): - @$(MKDIR_P) src/moxie - @: > src/moxie/$(am__dirstamp) -src/moxie/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/moxie/$(DEPDIR) - @: > src/moxie/$(DEPDIR)/$(am__dirstamp) -src/moxie/eabi.lo: src/moxie/$(am__dirstamp) \ - src/moxie/$(DEPDIR)/$(am__dirstamp) -src/moxie/ffi.lo: src/moxie/$(am__dirstamp) \ - src/moxie/$(DEPDIR)/$(am__dirstamp) src/s390/$(am__dirstamp): @$(MKDIR_P) src/s390 @: > src/s390/$(am__dirstamp) @@ -829,131 +927,91 @@ src/pa/ffi.lo: src/pa/$(am__dirstamp) src/pa/$(DEPDIR)/$(am__dirstamp) src/pa/hpux32.lo: src/pa/$(am__dirstamp) \ src/pa/$(DEPDIR)/$(am__dirstamp) +src/tile/$(am__dirstamp): + @$(MKDIR_P) src/tile + @: > src/tile/$(am__dirstamp) +src/tile/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/tile/$(DEPDIR) + @: > src/tile/$(DEPDIR)/$(am__dirstamp) +src/tile/tile.lo: src/tile/$(am__dirstamp) \ + src/tile/$(DEPDIR)/$(am__dirstamp) +src/tile/ffi.lo: src/tile/$(am__dirstamp) \ + src/tile/$(DEPDIR)/$(am__dirstamp) +src/xtensa/$(am__dirstamp): + @$(MKDIR_P) src/xtensa + @: > src/xtensa/$(am__dirstamp) +src/xtensa/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/xtensa/$(DEPDIR) + @: > src/xtensa/$(DEPDIR)/$(am__dirstamp) +src/xtensa/sysv.lo: src/xtensa/$(am__dirstamp) \ + src/xtensa/$(DEPDIR)/$(am__dirstamp) +src/xtensa/ffi.lo: src/xtensa/$(am__dirstamp) \ + src/xtensa/$(DEPDIR)/$(am__dirstamp) +src/metag/$(am__dirstamp): + @$(MKDIR_P) src/metag + @: > src/metag/$(am__dirstamp) +src/metag/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/metag/$(DEPDIR) + @: > src/metag/$(DEPDIR)/$(am__dirstamp) +src/metag/sysv.lo: src/metag/$(am__dirstamp) \ + src/metag/$(DEPDIR)/$(am__dirstamp) +src/metag/ffi.lo: src/metag/$(am__dirstamp) \ + src/metag/$(DEPDIR)/$(am__dirstamp) libffi.la: $(libffi_la_OBJECTS) $(libffi_la_DEPENDENCIES) $(EXTRA_libffi_la_DEPENDENCIES) - $(libffi_la_LINK) -rpath $(libdir) $(libffi_la_OBJECTS) $(libffi_la_LIBADD) $(LIBS) + $(libffi_la_LINK) -rpath $(toolexeclibdir) $(libffi_la_OBJECTS) $(libffi_la_LIBADD) $(LIBS) libffi_convenience.la: $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_DEPENDENCIES) $(EXTRA_libffi_convenience_la_DEPENDENCIES) $(LINK) $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) - -rm -f src/alpha/ffi.$(OBJEXT) - -rm -f src/alpha/ffi.lo - -rm -f src/alpha/osf.$(OBJEXT) - -rm -f src/alpha/osf.lo - -rm -f src/arm/ffi.$(OBJEXT) - -rm -f src/arm/ffi.lo - -rm -f src/arm/sysv.$(OBJEXT) - -rm -f src/arm/sysv.lo - -rm -f src/arm/trampoline.$(OBJEXT) - -rm -f src/arm/trampoline.lo - -rm -f src/avr32/ffi.$(OBJEXT) - -rm -f src/avr32/ffi.lo - -rm -f src/avr32/sysv.$(OBJEXT) - -rm -f src/avr32/sysv.lo - -rm -f src/closures.$(OBJEXT) - -rm -f src/closures.lo - -rm -f src/cris/ffi.$(OBJEXT) - -rm -f src/cris/ffi.lo - -rm -f src/cris/sysv.$(OBJEXT) - -rm -f src/cris/sysv.lo - -rm -f src/debug.$(OBJEXT) - -rm -f src/debug.lo - -rm -f src/frv/eabi.$(OBJEXT) - -rm -f src/frv/eabi.lo - -rm -f src/frv/ffi.$(OBJEXT) - -rm -f src/frv/ffi.lo - -rm -f src/ia64/ffi.$(OBJEXT) - -rm -f src/ia64/ffi.lo - -rm -f src/ia64/unix.$(OBJEXT) - -rm -f src/ia64/unix.lo - -rm -f src/java_raw_api.$(OBJEXT) - -rm -f src/java_raw_api.lo - -rm -f src/m32r/ffi.$(OBJEXT) - -rm -f src/m32r/ffi.lo - -rm -f src/m32r/sysv.$(OBJEXT) - -rm -f src/m32r/sysv.lo - -rm -f src/m68k/ffi.$(OBJEXT) - -rm -f src/m68k/ffi.lo - -rm -f src/m68k/sysv.$(OBJEXT) - -rm -f src/m68k/sysv.lo - -rm -f src/mips/ffi.$(OBJEXT) - -rm -f src/mips/ffi.lo - -rm -f src/mips/n32.$(OBJEXT) - -rm -f src/mips/n32.lo - -rm -f src/mips/o32.$(OBJEXT) - -rm -f src/mips/o32.lo - -rm -f src/moxie/eabi.$(OBJEXT) - -rm -f src/moxie/eabi.lo - -rm -f src/moxie/ffi.$(OBJEXT) - -rm -f src/moxie/ffi.lo - -rm -f src/pa/ffi.$(OBJEXT) - -rm -f src/pa/ffi.lo - -rm -f src/pa/hpux32.$(OBJEXT) - -rm -f src/pa/hpux32.lo - -rm -f src/pa/linux.$(OBJEXT) - -rm -f src/pa/linux.lo - -rm -f src/powerpc/aix.$(OBJEXT) - -rm -f src/powerpc/aix.lo - -rm -f src/powerpc/aix_closure.$(OBJEXT) - -rm -f src/powerpc/aix_closure.lo - -rm -f src/powerpc/darwin.$(OBJEXT) - -rm -f src/powerpc/darwin.lo - -rm -f src/powerpc/darwin_closure.$(OBJEXT) - -rm -f src/powerpc/darwin_closure.lo - -rm -f src/powerpc/ffi.$(OBJEXT) - -rm -f src/powerpc/ffi.lo - -rm -f src/powerpc/ffi_darwin.$(OBJEXT) - -rm -f src/powerpc/ffi_darwin.lo - -rm -f src/powerpc/linux64.$(OBJEXT) - -rm -f src/powerpc/linux64.lo - -rm -f src/powerpc/linux64_closure.$(OBJEXT) - -rm -f src/powerpc/linux64_closure.lo - -rm -f src/powerpc/ppc_closure.$(OBJEXT) - -rm -f src/powerpc/ppc_closure.lo - -rm -f src/powerpc/sysv.$(OBJEXT) - -rm -f src/powerpc/sysv.lo - -rm -f src/prep_cif.$(OBJEXT) - -rm -f src/prep_cif.lo - -rm -f src/raw_api.$(OBJEXT) - -rm -f src/raw_api.lo - -rm -f src/s390/ffi.$(OBJEXT) - -rm -f src/s390/ffi.lo - -rm -f src/s390/sysv.$(OBJEXT) - -rm -f src/s390/sysv.lo - -rm -f src/sh/ffi.$(OBJEXT) - -rm -f src/sh/ffi.lo - -rm -f src/sh/sysv.$(OBJEXT) - -rm -f src/sh/sysv.lo - -rm -f src/sh64/ffi.$(OBJEXT) - -rm -f src/sh64/ffi.lo - -rm -f src/sh64/sysv.$(OBJEXT) - -rm -f src/sh64/sysv.lo - -rm -f src/sparc/ffi.$(OBJEXT) - -rm -f src/sparc/ffi.lo - -rm -f src/sparc/v8.$(OBJEXT) - -rm -f src/sparc/v8.lo - -rm -f src/sparc/v9.$(OBJEXT) - -rm -f src/sparc/v9.lo - -rm -f src/types.$(OBJEXT) - -rm -f src/types.lo - -rm -f src/x86/darwin.$(OBJEXT) - -rm -f src/x86/darwin.lo - -rm -f src/x86/darwin64.$(OBJEXT) - -rm -f src/x86/darwin64.lo - -rm -f src/x86/ffi.$(OBJEXT) - -rm -f src/x86/ffi.lo - -rm -f src/x86/ffi64.$(OBJEXT) - -rm -f src/x86/ffi64.lo - -rm -f src/x86/freebsd.$(OBJEXT) - -rm -f src/x86/freebsd.lo - -rm -f src/x86/sysv.$(OBJEXT) - -rm -f src/x86/sysv.lo - -rm -f src/x86/unix64.$(OBJEXT) - -rm -f src/x86/unix64.lo - -rm -f src/x86/win32.$(OBJEXT) - -rm -f src/x86/win32.lo - -rm -f src/x86/win64.$(OBJEXT) - -rm -f src/x86/win64.lo + -rm -f src/*.$(OBJEXT) + -rm -f src/*.lo + -rm -f src/aarch64/*.$(OBJEXT) + -rm -f src/aarch64/*.lo + -rm -f src/alpha/*.$(OBJEXT) + -rm -f src/alpha/*.lo + -rm -f src/arm/*.$(OBJEXT) + -rm -f src/arm/*.lo + -rm -f src/avr32/*.$(OBJEXT) + -rm -f src/avr32/*.lo + -rm -f src/bfin/*.$(OBJEXT) + -rm -f src/bfin/*.lo + -rm -f src/cris/*.$(OBJEXT) + -rm -f src/cris/*.lo + -rm -f src/frv/*.$(OBJEXT) + -rm -f src/frv/*.lo + -rm -f src/ia64/*.$(OBJEXT) + -rm -f src/ia64/*.lo + -rm -f src/m32r/*.$(OBJEXT) + -rm -f src/m32r/*.lo + -rm -f src/m68k/*.$(OBJEXT) + -rm -f src/m68k/*.lo + -rm -f src/metag/*.$(OBJEXT) + -rm -f src/metag/*.lo + -rm -f src/microblaze/*.$(OBJEXT) + -rm -f src/microblaze/*.lo + -rm -f src/mips/*.$(OBJEXT) + -rm -f src/mips/*.lo + -rm -f src/moxie/*.$(OBJEXT) + -rm -f src/moxie/*.lo + -rm -f src/pa/*.$(OBJEXT) + -rm -f src/pa/*.lo + -rm -f src/powerpc/*.$(OBJEXT) + -rm -f src/powerpc/*.lo + -rm -f src/s390/*.$(OBJEXT) + -rm -f src/s390/*.lo + -rm -f src/sh/*.$(OBJEXT) + -rm -f src/sh/*.lo + -rm -f src/sh64/*.$(OBJEXT) + -rm -f src/sh64/*.lo + -rm -f src/sparc/*.$(OBJEXT) + -rm -f src/sparc/*.lo + -rm -f src/tile/*.$(OBJEXT) + -rm -f src/tile/*.lo + -rm -f src/x86/*.$(OBJEXT) + -rm -f src/x86/*.lo + -rm -f src/xtensa/*.$(OBJEXT) + -rm -f src/xtensa/*.lo distclean-compile: -rm -f *.tab.c @@ -964,6 +1022,8 @@ @AMDEP_TRUE@@am__include@ @am__quote at src/$(DEPDIR)/prep_cif.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/$(DEPDIR)/raw_api.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/$(DEPDIR)/types.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/aarch64/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/aarch64/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/alpha/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/alpha/$(DEPDIR)/osf.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/arm/$(DEPDIR)/ffi.Plo at am__quote@ @@ -971,6 +1031,8 @@ @AMDEP_TRUE@@am__include@ @am__quote at src/arm/$(DEPDIR)/trampoline.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/avr32/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/avr32/$(DEPDIR)/sysv.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/bfin/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/bfin/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/cris/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/cris/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/frv/$(DEPDIR)/eabi.Plo at am__quote@ @@ -981,6 +1043,10 @@ @AMDEP_TRUE@@am__include@ @am__quote at src/m32r/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/m68k/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/m68k/$(DEPDIR)/sysv.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/metag/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/metag/$(DEPDIR)/sysv.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/microblaze/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/microblaze/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/mips/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/mips/$(DEPDIR)/n32.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/mips/$(DEPDIR)/o32.Plo at am__quote@ @@ -1008,6 +1074,8 @@ @AMDEP_TRUE@@am__include@ @am__quote at src/sparc/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/sparc/$(DEPDIR)/v8.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/sparc/$(DEPDIR)/v9.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/tile/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/tile/$(DEPDIR)/tile.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/darwin.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/darwin64.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/ffi.Plo at am__quote@ @@ -1017,6 +1085,8 @@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/unix64.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/win32.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/x86/$(DEPDIR)/win64.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/xtensa/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/xtensa/$(DEPDIR)/sysv.Plo at am__quote@ .S.o: @am__fastdepCCAS_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @@ -1072,14 +1142,18 @@ clean-libtool: -rm -rf .libs _libs -rm -rf src/.libs src/_libs + -rm -rf src/aarch64/.libs src/aarch64/_libs -rm -rf src/alpha/.libs src/alpha/_libs -rm -rf src/arm/.libs src/arm/_libs -rm -rf src/avr32/.libs src/avr32/_libs + -rm -rf src/bfin/.libs src/bfin/_libs -rm -rf src/cris/.libs src/cris/_libs -rm -rf src/frv/.libs src/frv/_libs -rm -rf src/ia64/.libs src/ia64/_libs -rm -rf src/m32r/.libs src/m32r/_libs -rm -rf src/m68k/.libs src/m68k/_libs + -rm -rf src/metag/.libs src/metag/_libs + -rm -rf src/microblaze/.libs src/microblaze/_libs -rm -rf src/mips/.libs src/mips/_libs -rm -rf src/moxie/.libs src/moxie/_libs -rm -rf src/pa/.libs src/pa/_libs @@ -1088,7 +1162,9 @@ -rm -rf src/sh/.libs src/sh/_libs -rm -rf src/sh64/.libs src/sh64/_libs -rm -rf src/sparc/.libs src/sparc/_libs + -rm -rf src/tile/.libs src/tile/_libs -rm -rf src/x86/.libs src/x86/_libs + -rm -rf src/xtensa/.libs src/xtensa/_libs distclean-libtool: -rm -f libtool config.lt @@ -1121,12 +1197,12 @@ doc/libffi.dvi: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ - $(TEXI2DVI) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi + $(TEXI2DVI) --clean -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi doc/libffi.pdf: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ - $(TEXI2PDF) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi + $(TEXI2PDF) --clean -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi doc/libffi.html: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) rm -rf $(@:.html=.htp) @@ -1163,7 +1239,7 @@ @MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/doc/stamp-vti $(srcdir)/doc/version.texi .dvi.ps: TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ - $(DVIPS) -o $@ $< + $(DVIPS) -o $@ $< uninstall-dvi-am: @$(NORMAL_UNINSTALL) @@ -1185,9 +1261,7 @@ uninstall-info-am: @$(PRE_UNINSTALL) - @if test -d '$(DESTDIR)$(infodir)' && \ - (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ @@ -1259,8 +1333,11 @@ done install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) - test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -1277,12 +1354,12 @@ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ @@ -1292,7 +1369,11 @@ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -1306,37 +1387,6 @@ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ @@ -1345,6 +1395,10 @@ list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done +cscopelist-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \ + done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -1408,8 +1462,32 @@ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) + +clean-cscope: + -rm -f cscope.files + +cscope.files: clean-cscope cscopelist-recursive cscopelist + +cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) @@ -1445,13 +1523,10 @@ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ @@ -1483,40 +1558,36 @@ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__remove_distdir) + $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__remove_distdir) - -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) + $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) + $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) + $(am__post_remove_distdir) -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another @@ -1527,8 +1598,6 @@ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ @@ -1540,7 +1609,7 @@ *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod a+w $(distdir) + chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) @@ -1574,7 +1643,7 @@ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 - $(am__remove_distdir) + $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' @@ -1609,7 +1678,7 @@ all-am: Makefile $(INFO_DEPS) $(LTLIBRARIES) $(DATA) fficonfig.h installdirs: installdirs-recursive installdirs-am: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(pkgconfigdir)"; do \ + for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive @@ -1641,12 +1710,16 @@ -rm -f doc/$(am__dirstamp) -rm -f src/$(DEPDIR)/$(am__dirstamp) -rm -f src/$(am__dirstamp) + -rm -f src/aarch64/$(DEPDIR)/$(am__dirstamp) + -rm -f src/aarch64/$(am__dirstamp) -rm -f src/alpha/$(DEPDIR)/$(am__dirstamp) -rm -f src/alpha/$(am__dirstamp) -rm -f src/arm/$(DEPDIR)/$(am__dirstamp) -rm -f src/arm/$(am__dirstamp) -rm -f src/avr32/$(DEPDIR)/$(am__dirstamp) -rm -f src/avr32/$(am__dirstamp) + -rm -f src/bfin/$(DEPDIR)/$(am__dirstamp) + -rm -f src/bfin/$(am__dirstamp) -rm -f src/cris/$(DEPDIR)/$(am__dirstamp) -rm -f src/cris/$(am__dirstamp) -rm -f src/frv/$(DEPDIR)/$(am__dirstamp) @@ -1657,6 +1730,10 @@ -rm -f src/m32r/$(am__dirstamp) -rm -f src/m68k/$(DEPDIR)/$(am__dirstamp) -rm -f src/m68k/$(am__dirstamp) + -rm -f src/metag/$(DEPDIR)/$(am__dirstamp) + -rm -f src/metag/$(am__dirstamp) + -rm -f src/microblaze/$(DEPDIR)/$(am__dirstamp) + -rm -f src/microblaze/$(am__dirstamp) -rm -f src/mips/$(DEPDIR)/$(am__dirstamp) -rm -f src/mips/$(am__dirstamp) -rm -f src/moxie/$(DEPDIR)/$(am__dirstamp) @@ -1673,20 +1750,25 @@ -rm -f src/sh64/$(am__dirstamp) -rm -f src/sparc/$(DEPDIR)/$(am__dirstamp) -rm -f src/sparc/$(am__dirstamp) + -rm -f src/tile/$(DEPDIR)/$(am__dirstamp) + -rm -f src/tile/$(am__dirstamp) -rm -f src/x86/$(DEPDIR)/$(am__dirstamp) -rm -f src/x86/$(am__dirstamp) + -rm -f src/xtensa/$(DEPDIR)/$(am__dirstamp) + -rm -f src/xtensa/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive -clean-am: clean-aminfo clean-generic clean-libLTLIBRARIES \ - clean-libtool clean-noinstLTLIBRARIES mostlyclean-am +clean-am: clean-aminfo clean-generic clean-libtool \ + clean-noinstLTLIBRARIES clean-toolexeclibLTLIBRARIES \ + mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR) + -rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/metag/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags @@ -1709,8 +1791,11 @@ install-dvi-am: $(DVIS) @$(NORMAL_INSTALL) - test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)" @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -1719,12 +1804,17 @@ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ done -install-exec-am: install-libLTLIBRARIES +install-exec-am: install-toolexeclibLTLIBRARIES + +install-html: install-html-recursive install-html-am: $(HTMLS) @$(NORMAL_INSTALL) - test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)" @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ $(am__strip_dir) \ @@ -1747,9 +1837,12 @@ install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) - test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)" @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \ + fi; \ for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ @@ -1767,13 +1860,7 @@ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done @$(POST_INSTALL) - @am__run_installinfo=yes; \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) am__run_installinfo=no;; \ - *) (install-info --version) >/dev/null 2>&1 \ - || am__run_installinfo=no;; \ - esac; \ - if test $$am__run_installinfo = yes; then \ + @if $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ @@ -1783,10 +1870,15 @@ else : ; fi install-man: +install-pdf: install-pdf-recursive + install-pdf-am: $(PDFS) @$(NORMAL_INSTALL) - test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)" @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -1798,8 +1890,11 @@ install-ps-am: $(PSS) @$(NORMAL_INSTALL) - test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)" @list='$(PSS)'; test -n "$(psdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -1812,7 +1907,7 @@ maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR) + -rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/metag/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-aminfo \ maintainer-clean-generic maintainer-clean-vti @@ -1831,41 +1926,39 @@ ps-am: $(PSS) uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ - uninstall-libLTLIBRARIES uninstall-pdf-am \ - uninstall-pkgconfigDATA uninstall-ps-am + uninstall-pdf-am uninstall-pkgconfigDATA uninstall-ps-am \ + uninstall-toolexeclibLTLIBRARIES .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ - ctags-recursive install-am install-strip tags-recursive + cscopelist-recursive ctags-recursive install-am install-strip \ + tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-aminfo \ - clean-generic clean-libLTLIBRARIES clean-libtool \ - clean-noinstLTLIBRARIES ctags ctags-recursive dist dist-all \ - dist-bzip2 dist-gzip dist-info dist-lzip dist-lzma dist-shar \ + clean-cscope clean-generic clean-libtool \ + clean-noinstLTLIBRARIES clean-toolexeclibLTLIBRARIES cscope \ + cscopelist cscopelist-recursive ctags ctags-recursive dist \ + dist-all dist-bzip2 dist-gzip dist-info dist-lzip dist-shar \ dist-tarZ dist-xz dist-zip distcheck distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am \ - install-libLTLIBRARIES install-man install-pdf install-pdf-am \ - install-pkgconfigDATA install-ps install-ps-am install-strip \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pkgconfigDATA install-ps \ + install-ps-am install-strip install-toolexeclibLTLIBRARIES \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-aminfo \ maintainer-clean-generic maintainer-clean-vti mostlyclean \ mostlyclean-aminfo mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-vti pdf pdf-am ps ps-am tags \ tags-recursive uninstall uninstall-am uninstall-dvi-am \ - uninstall-html-am uninstall-info-am uninstall-libLTLIBRARIES \ - uninstall-pdf-am uninstall-pkgconfigDATA uninstall-ps-am + uninstall-html-am uninstall-info-am uninstall-pdf-am \ + uninstall-pkgconfigDATA uninstall-ps-am \ + uninstall-toolexeclibLTLIBRARIES -# No install-html or install-pdf support in automake yet -.PHONY: install-html install-pdf -install-html: -install-pdf: - # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/Modules/_ctypes/libffi/README b/Modules/_ctypes/libffi/README --- a/Modules/_ctypes/libffi/README +++ b/Modules/_ctypes/libffi/README @@ -1,7 +1,7 @@ Status ====== -libffi-3.0.11 was released on April 11, 2012. Check the libffi web +libffi-3.0.13 was released on March 17, 2013. Check the libffi web page for updates: . @@ -43,54 +43,70 @@ For specific configuration details and testing status, please refer to the wiki page here: - http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.11 + http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.13 At the time of release, the following basic configurations have been tested: -|--------------+------------------| -| Architecture | Operating System | -|--------------+------------------| -| Alpha | Linux | -| Alpha | Tru64 | -| ARM | Linux | -| ARM | iOS | -| AVR32 | Linux | -| HPPA | HPUX | -| IA-64 | Linux | -| M68K | FreeMiNT | -| M68K | RTEMS | -| MIPS | IRIX | -| MIPS | Linux | -| MIPS | RTEMS | -| MIPS64 | Linux | -| PowerPC | AMIGA | -| PowerPC | Linux | -| PowerPC | Mac OSX | -| PowerPC | FreeBSD | -| PowerPC64 | Linux | -| S390 | Linux | -| S390X | Linux | -| SPARC | Linux | -| SPARC | Solaris | -| SPARC64 | Linux | -| SPARC64 | FreeBSD | -| X86 | FreeBSD | -| X86 | Interix | -| X86 | kFreeBSD | -| X86 | Linux | -| X86 | Mac OSX | -| X86 | OpenBSD | -| X86 | OS/2 | -| X86 | Solaris | -| X86 | Windows/Cygwin | -| X86 | Windows/MingW | -| X86-64 | FreeBSD | -| X86-64 | Linux | -| X86-64 | Linux/x32 | -| X86-64 | OpenBSD | -| X86-64 | Windows/MingW | -|--------------+------------------| +|-----------------+------------------+-------------------------| +| Architecture | Operating System | Compiler | +|-----------------+------------------+-------------------------| +| AArch64 | Linux | GCC | +| Alpha | Linux | GCC | +| Alpha | Tru64 | GCC | +| ARM | Linux | GCC | +| ARM | iOS | GCC | +| AVR32 | Linux | GCC | +| Blackfin | uClinux | GCC | +| HPPA | HPUX | GCC | +| IA-64 | Linux | GCC | +| M68K | FreeMiNT | GCC | +| M68K | Linux | GCC | +| M68K | RTEMS | GCC | +| Meta | Linux | GCC | +| MicroBlaze | Linux | GCC | +| MIPS | IRIX | GCC | +| MIPS | Linux | GCC | +| MIPS | RTEMS | GCC | +| MIPS64 | Linux | GCC | +| Moxie | Bare metal | GCC +| PowerPC 32-bit | AIX | IBM XL C | +| PowerPC 64-bit | AIX | IBM XL C | +| PowerPC | AMIGA | GCC | +| PowerPC | Linux | GCC | +| PowerPC | Mac OSX | GCC | +| PowerPC | FreeBSD | GCC | +| PowerPC 64-bit | FreeBSD | GCC | +| PowerPC 64-bit | Linux | GCC | +| S390 | Linux | GCC | +| S390X | Linux | GCC | +| SPARC | Linux | GCC | +| SPARC | Solaris | GCC | +| SPARC | Solaris | Oracle Solaris Studio C | +| SPARC64 | Linux | GCC | +| SPARC64 | FreeBSD | GCC | +| SPARC64 | Solaris | Oracle Solaris Studio C | +| TILE-Gx/TILEPro | Linux | GCC | +| X86 | FreeBSD | GCC | +| X86 | GNU HURD | GCC | +| X86 | Interix | GCC | +| X86 | kFreeBSD | GCC | +| X86 | Linux | GCC | +| X86 | Mac OSX | GCC | +| X86 | OpenBSD | GCC | +| X86 | OS/2 | GCC | +| X86 | Solaris | GCC | +| X86 | Solaris | Oracle Solaris Studio C | +| X86 | Windows/Cygwin | GCC | +| X86 | Windows/MingW | GCC | +| X86-64 | FreeBSD | GCC | +| X86-64 | Linux | GCC | +| X86-64 | Linux/x32 | GCC | +| X86-64 | OpenBSD | GCC | +| X86-64 | Solaris | Oracle Solaris Studio C | +| X86-64 | Windows/MingW | GCC | +| Xtensa | Linux | GCC | +|-----------------+------------------+-------------------------| Please send additional platform test results to libffi-discuss at sourceware.org and feel free to update the wiki page @@ -129,13 +145,12 @@ that sets 'fix_srcfile_path' to a 'cygpath' command. ('cygpath' is not present in MingW, and is not required when using MingW-style paths.) -For iOS builds, run generate-ios-source-and-headers.py and then -libffi.xcodeproj should work. +For iOS builds, the 'libffi.xcodeproj' Xcode project is available. Configure has many other options. Use "configure --help" to see them all. Once configure has finished, type "make". Note that you must be using -GNU make. You can ftp GNU make from prep.ai.mit.edu:/pub/gnu. +GNU make. You can ftp GNU make from ftp.gnu.org:/pub/gnu/make . To ensure that libffi is working as advertised, type "make check". This will require that you have DejaGNU installed. @@ -148,16 +163,39 @@ See the ChangeLog files for details. +3.0.13 Mar-17-13 + Add Meta support. + Add missing Moxie bits. + Fix stack alignment bug on 32-bit x86. + Build fix for m68000 targets. + Build fix for soft-float Power targets. + Fix the install dir location for some platforms when building + with GCC (OS X, Solaris). + Fix Cygwin regression. + +3.0.12 Feb-11-13 + Add Moxie support. + Add AArch64 support. + Add Blackfin support. + Add TILE-Gx/TILEPro support. + Add MicroBlaze support. + Add Xtensa support. + Add support for PaX enabled kernels with MPROTECT. + Add support for native vendor compilers on + Solaris and AIX. + Work around LLVM/GCC interoperability issue on x86_64. + 3.0.11 Apr-11-12 - Add support for variadic functions (ffi_prep_cif_var). + Lots of build fixes. + Add Amiga newer MacOS support. + Add support for variadic functions (ffi_prep_cif_var). Add Linux/x32 support. Add thiscall, fastcall and MSVC cdecl support on Windows. - Add Amiga and newer MacOS support. + Add Amiga and newer MacOS support. Add m68k FreeMiNT support. Integration with iOS' xcode build tools. Fix Octeon and MC68881 support. Fix code pessimizations. - Lots of build fixes. 3.0.10 Aug-23-11 Add support for Apple's iOS. @@ -301,7 +339,7 @@ Authors & Credits ================= -libffi was originally written by Anthony Green . +libffi was originally written by Anthony Green . The developers of the GNU Compiler Collection project have made innumerable valuable contributions. See the ChangeLog file for @@ -316,15 +354,19 @@ Major processor architecture ports were contributed by the following developers: +aarch64 Marcus Shawcroft, James Greenhalgh alpha Richard Henderson arm Raffaele Sena +blackfin Alexandre Keunecke I. de Mendonca cris Simon Posnjak, Hans-Peter Nilsson frv Anthony Green ia64 Hans Boehm m32r Kazuhiro Inaoka m68k Andreas Schwab +microblaze Nathan Rossi mips Anthony Green, Casey Marshall mips64 David Daney +moxie Anthony Green pa Randolph Chung, Dave Anglin, Andreas Tobler powerpc Geoffrey Keating, Andreas Tobler, David Edelsohn, John Hornkvist @@ -333,8 +375,10 @@ sh Kaz Kojima sh64 Kaz Kojima sparc Anthony Green, Gordon Irlam +tile-gx/tilepro Walter Lee x86 Anthony Green, Jon Beniston x86-64 Bo Thorsen +xtensa Chris Zankel Jesper Skov and Andrew Haley both did more than their fair share of stepping through the code and tracking down bugs. diff --git a/Modules/_ctypes/libffi/aclocal.m4 b/Modules/_ctypes/libffi/aclocal.m4 --- a/Modules/_ctypes/libffi/aclocal.m4 +++ b/Modules/_ctypes/libffi/aclocal.m4 @@ -1,8 +1,7 @@ -# generated automatically by aclocal 1.11.3 -*- Autoconf -*- +# generated automatically by aclocal 1.12.2 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, -# Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. + # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,11 +13,11 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, -[m4_warning([this file was generated for autoconf 2.68. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically `autoreconf'.])]) +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- # @@ -515,7 +514,7 @@ # at 6.2 and later dlopen does load deplibs. lt_cv_sys_dlopen_deplibs=yes ;; - netbsd* | netbsdelf*-gnu) + netbsd*) lt_cv_sys_dlopen_deplibs=yes ;; openbsd*) @@ -838,14 +837,13 @@ dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], []) -# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 2002-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 +# serial 8 # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- @@ -853,10 +851,10 @@ # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.11' +[am__api_version='1.12' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.3], [], +m4_if([$1], [1.12.2], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -872,14 +870,14 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.3])dnl +[AM_AUTOMAKE_VERSION([1.12.2])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # Figure out how to run the assembler. -*- Autoconf -*- -# Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -901,17 +899,17 @@ # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 +# serial 2 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and @@ -930,7 +928,7 @@ # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you +# harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, @@ -956,22 +954,21 @@ # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1997-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 9 +# serial 10 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl @@ -990,16 +987,15 @@ Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, -# 2010, 2011 Free Software Foundation, Inc. +# Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 12 +# serial 17 -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing @@ -1009,7 +1005,7 @@ # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was @@ -1022,12 +1018,13 @@ AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], UPC, [depcc="$UPC" am_compiler_list=], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], @@ -1035,8 +1032,8 @@ # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're @@ -1076,16 +1073,16 @@ : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -1094,8 +1091,8 @@ test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else @@ -1103,7 +1100,7 @@ fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -1151,7 +1148,7 @@ # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl @@ -1161,9 +1158,13 @@ # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors]) +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' @@ -1178,14 +1179,13 @@ # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -#serial 5 +# serial 6 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ @@ -1204,7 +1204,7 @@ # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but + # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. @@ -1216,21 +1216,19 @@ continue fi # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` @@ -1248,7 +1246,7 @@ # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will +# is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], @@ -1258,14 +1256,13 @@ # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 16 +# serial 19 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. @@ -1311,31 +1308,41 @@ # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl +[AC_DIAGNOSE([obsolete], +[$0: two- and three-arguments forms are deprecated. For more info, see: +http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AM_PROG_MKDIR_P])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl @@ -1346,28 +1353,35 @@ [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES(OBJC)], - [define([AC_PROG_OBJC], - defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +dnl Support for Objective C++ was only introduced in Autoconf 2.65, +dnl but we still cater to Autoconf 2.62. +m4_ifdef([AC_PROG_OBJCXX], +[AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl -dnl The `parallel-tests' driver may need to know about EXEEXT, so add the -dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) -dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], @@ -1395,14 +1409,13 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, -# Inc. +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 +# serial 8 # AM_PROG_INSTALL_SH # ------------------ @@ -1417,9 +1430,9 @@ install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi -AC_SUBST(install_sh)]) +AC_SUBST([install_sh])]) -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2003-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1443,20 +1456,19 @@ # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, -# 2011 Free Software Foundation, Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 5 +# serial 7 # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. -# Default is to disable them, unless `enable' is passed literally. -# For symmetry, `disable' may be passed as well. Anyway, the user +# Default is to disable them, unless 'enable' is passed literally. +# For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), @@ -1467,10 +1479,11 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], -[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - [USE_MAINTAINER_MODE=$enableval], - [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], + am_maintainer_other[ make rules and dependencies not useful + (and sometimes confusing) to the casual installer])], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE @@ -1482,13 +1495,13 @@ # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 4 +# serial 5 # AM_MAKE_INCLUDE() # ----------------- @@ -1507,7 +1520,7 @@ _am_result=none # First try GNU make style include. echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. +# Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include @@ -1532,8 +1545,7 @@ rm -f confinc confmf ]) -# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1569,14 +1581,13 @@ # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1997-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 6 +# serial 7 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -1606,49 +1617,19 @@ am_missing_run="$MISSING --run " else am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) + AC_MSG_WARN(['missing' script is too old or missing]) fi ]) -# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, -# Inc. +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 - -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software -# Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 5 +# serial 6 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -1659,7 +1640,7 @@ # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ @@ -1675,22 +1656,18 @@ # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 5 +# serial 9 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -1701,32 +1678,40 @@ esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac -# Do `set' in a subshell so we don't clobber the current shell's +# Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done test "$[2]" = conftest.file ) then @@ -1736,39 +1721,55 @@ AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi -AC_MSG_RESULT(yes)]) +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) -# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 +# serial 2 # AM_PROG_INSTALL_STRIP # --------------------- -# One issue with vendor `install' (even GNU) is that you can't +# One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize +# always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. +# Copyright (C) 2006-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1789,18 +1790,18 @@ # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. +# Copyright (C) 2004-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 2 +# serial 3 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory @@ -1823,7 +1824,7 @@ _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. +# Solaris sh will not grok spaces in the rhs of '-'. for _am_tool in $_am_tools do case $_am_tool in diff --git a/Modules/_ctypes/libffi/build-ios.sh b/Modules/_ctypes/libffi/build-ios.sh new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/build-ios.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +PLATFORM_IOS=/Developer/Platforms/iPhoneOS.platform/ +PLATFORM_IOS_SIM=/Developer/Platforms/iPhoneSimulator.platform/ +SDK_IOS_VERSION="4.2" +MIN_IOS_VERSION="3.0" +OUTPUT_DIR="universal-ios" + +build_target () { + local platform=$1 + local sdk=$2 + local arch=$3 + local triple=$4 + local builddir=$5 + + mkdir -p "${builddir}" + pushd "${builddir}" + export CC="${platform}"/Developer/usr/bin/gcc-4.2 + export CFLAGS="-arch ${arch} -isysroot ${sdk} -miphoneos-version-min=${MIN_IOS_VERSION}" + ../configure --host=${triple} && make + popd +} + +# Build all targets +build_target "${PLATFORM_IOS}" "${PLATFORM_IOS}/Developer/SDKs/iPhoneOS${SDK_IOS_VERSION}.sdk/" armv6 arm-apple-darwin10 armv6-ios +build_target "${PLATFORM_IOS}" "${PLATFORM_IOS}/Developer/SDKs/iPhoneOS${SDK_IOS_VERSION}.sdk/" armv7 arm-apple-darwin10 armv7-ios +build_target "${PLATFORM_IOS_SIM}" "${PLATFORM_IOS_SIM}/Developer/SDKs/iPhoneSimulator${SDK_IOS_VERSION}.sdk/" i386 i386-apple-darwin10 i386-ios-sim + +# Create universal output directories +mkdir -p "${OUTPUT_DIR}" +mkdir -p "${OUTPUT_DIR}/include" +mkdir -p "${OUTPUT_DIR}/include/armv6" +mkdir -p "${OUTPUT_DIR}/include/armv7" +mkdir -p "${OUTPUT_DIR}/include/i386" + +# Create the universal binary +lipo -create armv6-ios/.libs/libffi.a armv7-ios/.libs/libffi.a i386-ios-sim/.libs/libffi.a -output "${OUTPUT_DIR}/libffi.a" + +# Copy in the headers +copy_headers () { + local src=$1 + local dest=$2 + + # Fix non-relative header reference + sed 's//"ffitarget.h"/' < "${src}/include/ffi.h" > "${dest}/ffi.h" + cp "${src}/include/ffitarget.h" "${dest}" +} + +copy_headers armv6-ios "${OUTPUT_DIR}/include/armv6" +copy_headers armv7-ios "${OUTPUT_DIR}/include/armv7" +copy_headers i386-ios-sim "${OUTPUT_DIR}/include/i386" + +# Create top-level header +( +cat << EOF +#ifdef __arm__ + #include + #ifdef _ARM_ARCH_6 + #include "include/armv6/ffi.h" + #elif _ARM_ARCH_7 + #include "include/armv7/ffi.h" + #endif +#elif defined(__i386__) + #include "include/i386/ffi.h" +#endif +EOF +) > "${OUTPUT_DIR}/ffi.h" diff --git a/Modules/_ctypes/libffi/config.guess b/Modules/_ctypes/libffi/config.guess --- a/Modules/_ctypes/libffi/config.guess +++ b/Modules/_ctypes/libffi/config.guess @@ -2,13 +2,13 @@ # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. +# 2011, 2012, 2013 Free Software Foundation, Inc. -timestamp='2011-06-03' +timestamp='2012-12-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -17,26 +17,22 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches at gnu.org. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -57,8 +53,8 @@ Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -145,7 +141,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -202,6 +198,10 @@ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} @@ -304,7 +304,7 @@ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -792,21 +792,26 @@ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 @@ -861,6 +866,13 @@ i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -895,13 +907,16 @@ echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu @@ -943,7 +958,7 @@ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) - echo or32-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu @@ -984,7 +999,7 @@ echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu @@ -1191,6 +1206,9 @@ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1246,7 +1264,7 @@ NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1315,11 +1333,11 @@ i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - eval $set_cc_for_build cat >$dummy.c <. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches with a ChangeLog entry to config-patches at gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -76,8 +71,8 @@ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -125,13 +120,17 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] @@ -154,7 +153,7 @@ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; @@ -223,6 +222,12 @@ -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -247,11 +252,14 @@ # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ + | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | be32 | be64 \ + | arc \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ @@ -264,7 +272,7 @@ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -319,8 +327,7 @@ c6x) basic_machine=tic6x-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) - # Motorola 68HC11/12. + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -333,7 +340,10 @@ strongarm | thumb | xscale) basic_machine=arm-unknown ;; - + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; xscaleeb) basic_machine=armeb-unknown ;; @@ -356,6 +366,7 @@ # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ + | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ @@ -377,7 +388,8 @@ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -719,7 +731,6 @@ i370-ibm* | ibm*) basic_machine=i370-ibm ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 @@ -777,9 +788,13 @@ basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze*) basic_machine=microblaze-xilinx ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) basic_machine=i386-pc os=-mingw32 @@ -816,6 +831,10 @@ ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; + msys) + basic_machine=i386-pc + os=-msys + ;; mvs) basic_machine=i370-ibm os=-mvs @@ -1004,7 +1023,11 @@ basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1337,15 +1360,15 @@ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ @@ -1528,6 +1551,9 @@ c4x-* | tic4x-*) os=-coff ;; + hexagon-*) + os=-elf + ;; tic54x-*) os=-coff ;; @@ -1555,9 +1581,6 @@ ;; m68000-sun) os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 ;; m68*-cisco) os=-aout diff --git a/Modules/_ctypes/libffi/configure b/Modules/_ctypes/libffi/configure --- a/Modules/_ctypes/libffi/configure +++ b/Modules/_ctypes/libffi/configure @@ -1,13 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for libffi 3.0.11. +# Generated by GNU Autoconf 2.69 for libffi 3.0.13. # # Report bugs to . # # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -136,6 +134,31 @@ # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -169,7 +192,8 @@ else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -222,21 +246,25 @@ if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -339,6 +367,14 @@ } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -460,6 +496,10 @@ chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -494,16 +534,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -515,28 +555,8 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -570,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='libffi' PACKAGE_TARNAME='libffi' -PACKAGE_VERSION='3.0.11' -PACKAGE_STRING='libffi 3.0.11' +PACKAGE_VERSION='3.0.13' +PACKAGE_STRING='libffi 3.0.13' PACKAGE_BUGREPORT='http://github.com/atgreen/libffi/issues' PACKAGE_URL='' @@ -627,6 +647,10 @@ sys_symbol_underscore HAVE_LONG_DOUBLE ALLOCA +XTENSA_FALSE +XTENSA_TRUE +TILE_FALSE +TILE_TRUE PA64_HPUX_FALSE PA64_HPUX_TRUE PA_HPUX_FALSE @@ -649,6 +673,8 @@ AVR32_TRUE ARM_FALSE ARM_TRUE +AARCH64_FALSE +AARCH64_TRUE POWERPC_FREEBSD_FALSE POWERPC_FREEBSD_TRUE POWERPC_DARWIN_FALSE @@ -659,6 +685,10 @@ POWERPC_TRUE MOXIE_FALSE MOXIE_TRUE +METAG_FALSE +METAG_TRUE +MICROBLAZE_FALSE +MICROBLAZE_TRUE M68K_FALSE M68K_TRUE M32R_FALSE @@ -679,6 +709,8 @@ X86_TRUE SPARC_FALSE SPARC_TRUE +BFIN_FALSE +BFIN_TRUE MIPS_FALSE MIPS_TRUE AM_LTLDFLAGS @@ -822,6 +854,7 @@ enable_portable_binary with_gcc_arch enable_maintainer_mode +enable_pax_emutramp enable_debug enable_structs enable_raw_api @@ -1289,8 +1322,6 @@ if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1376,7 +1407,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libffi 3.0.11 to adapt to many kinds of systems. +\`configure' configures libffi 3.0.13 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1447,7 +1478,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libffi 3.0.11:";; + short | recursive ) echo "Configuration of libffi 3.0.13:";; esac cat <<\_ACEOF @@ -1457,8 +1488,10 @@ --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-builddir disable automatic build in subdir of sources - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] @@ -1467,8 +1500,10 @@ --enable-portable-binary disable compiler optimizations that would produce unportable binaries - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer + --enable-maintainer-mode + enable make rules and dependencies not useful (and + sometimes confusing) to the casual installer + --enable-pax_emutramp enable pax emulated trampolines, for we can't use PROT_EXEC --enable-debug debugging mode --disable-structs omit code for struct support --disable-raw-api make the raw api unavailable @@ -1563,10 +1598,10 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libffi configure 3.0.11 -generated by GNU Autoconf 2.68 - -Copyright (C) 2010 Free Software Foundation, Inc. +libffi configure 3.0.13 +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1642,7 +1677,7 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -1838,6 +1873,189 @@ } # ac_fn_c_check_func +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid; break +else + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=$ac_mid; break +else + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid +else + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + echo >>conftest.val; read $3 conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=0 ac_mid=0 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid; break -else - as_fn_arith $ac_mid + 1 && ac_lo=$as_val - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=-1 ac_mid=-1 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=$ac_mid; break -else - as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - ac_lo= ac_hi= -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid -else - as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in #(( -?*) eval "$3=\$ac_lo"; ac_retval=0 ;; -'') ac_retval=1 ;; -esac - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (($2) < 0) - { - long int i = longval (); - if (i != ($2)) - return 1; - fprintf (f, "%ld", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ($2)) - return 1; - fprintf (f, "%lu", i); - } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - echo >>conftest.val; read $3 config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libffi $as_me 3.0.11, which was -generated by GNU Autoconf 2.68. Invocation command line was +It was created by libffi $as_me 3.0.13, which was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2736,7 +2776,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ax_enable_builddir_sed="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2763,7 +2803,7 @@ ac_config_commands="$ac_config_commands buildir" -am__api_version='1.11' +am__api_version='1.12' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -2802,7 +2842,7 @@ # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2860,9 +2900,6 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -2873,32 +2910,40 @@ esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; -esac - -# Do `set' in a subshell so we don't clobber the current shell's + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken -alias in your environment" "$LINENO" 5 - fi - + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done test "$2" = conftest.file ) then @@ -2910,6 +2955,16 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. @@ -2933,8 +2988,8 @@ am_missing_run="$MISSING --run " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then @@ -2946,10 +3001,10 @@ esac fi -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. +# will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. @@ -2968,7 +3023,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3008,7 +3063,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3059,7 +3114,7 @@ test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ @@ -3088,12 +3143,6 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } -mkdir_p="$MKDIR_P" -case $mkdir_p in - [\\/$]* | ?:[\\/]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac - for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -3112,7 +3161,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3198,7 +3247,7 @@ # Define the identity of the package. PACKAGE='libffi' - VERSION='3.0.11' + VERSION='3.0.13' cat >>confdefs.h <<_ACEOF @@ -3226,6 +3275,12 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used @@ -3271,7 +3326,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3311,7 +3366,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3364,7 +3419,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3405,7 +3460,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -3463,7 +3518,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3507,7 +3562,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3953,8 +4008,7 @@ /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -4057,7 +4111,7 @@ _am_result=none # First try GNU make style include. echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. +# Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include @@ -4113,8 +4167,8 @@ # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're @@ -4149,16 +4203,16 @@ : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -4167,8 +4221,8 @@ test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else @@ -4176,7 +4230,7 @@ fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -4254,8 +4308,8 @@ # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're @@ -4288,16 +4342,16 @@ : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -4306,8 +4360,8 @@ test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else @@ -4315,7 +4369,7 @@ fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -4611,7 +4665,7 @@ for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue + as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in @@ -4687,7 +4741,7 @@ for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -4753,7 +4807,7 @@ for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -4820,7 +4874,7 @@ for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue + as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in @@ -5076,7 +5130,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5120,7 +5174,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5309,7 +5363,8 @@ ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -5544,7 +5599,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5584,7 +5639,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5756,7 +5811,7 @@ lt_cv_deplibs_check_method=pass_all ;; -netbsd* | netbsdelf*-gnu) +netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else @@ -5890,7 +5945,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5930,7 +5985,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6034,7 +6089,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6078,7 +6133,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6203,7 +6258,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6243,7 +6298,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6302,7 +6357,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6342,7 +6397,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6850,7 +6905,14 @@ LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -6991,7 +7053,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7031,7 +7093,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7111,7 +7173,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7151,7 +7213,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7203,7 +7265,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7243,7 +7305,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7295,7 +7357,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7335,7 +7397,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7387,7 +7449,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7427,7 +7489,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7479,7 +7541,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7519,7 +7581,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -9157,9 +9219,6 @@ openbsd*) with_gnu_ld=no ;; - linux* | k*bsd*-gnu | gnu*) - link_all_deplibs=no - ;; esac ld_shlibs=yes @@ -9381,7 +9440,7 @@ fi ;; - netbsd* | netbsdelf*-gnu) + netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= @@ -9558,7 +9617,6 @@ if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi - link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then @@ -10012,7 +10070,7 @@ link_all_deplibs=yes ;; - netbsd* | netbsdelf*-gnu) + netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else @@ -11025,10 +11083,14 @@ # before this can be enabled. hardcode_into_libs=yes + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -11040,18 +11102,6 @@ dynamic_linker='GNU/Linux ld.so' ;; -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no @@ -12024,6 +12074,41 @@ +# Test for 64-bit build. +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 +$as_echo_n "checking size of size_t... " >&6; } +if ${ac_cv_sizeof_size_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_size_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (size_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_size_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5 +$as_echo "$ac_cv_sizeof_size_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t +_ACEOF + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler vendor" >&5 $as_echo_n "checking for C compiler vendor... " >&6; } if ${ax_cv_c_compiler_vendor+:} false; then : @@ -12087,7 +12172,7 @@ # Check whether --enable-portable-binary was given. if test "${enable_portable_binary+set}" = set; then : - enableval=$enable_portable_binary; acx_maxopt_portable=$withval + enableval=$enable_portable_binary; acx_maxopt_portable=$enableval else acx_maxopt_portable=no fi @@ -12348,41 +12433,8 @@ CFLAGS="-O3 -fomit-frame-pointer" # -malign-double for x86 systems - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -malign-double" >&5 -$as_echo_n "checking whether C compiler accepts -malign-double... " >&6; } -if ${ax_cv_check_cflags___malign_double+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS -malign-double" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv_check_cflags___malign_double=yes -else - ax_cv_check_cflags___malign_double=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS=$ax_check_save_flags -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___malign_double" >&5 -$as_echo "$ax_cv_check_cflags___malign_double" >&6; } -if test x"$ax_cv_check_cflags___malign_double" = xyes; then : - CFLAGS="$CFLAGS -malign-double" -else - : -fi - + # LIBFFI -- DON'T DO THIS - CHANGES ABI + # AX_CHECK_COMPILE_FLAG(-malign-double, CFLAGS="$CFLAGS -malign-double") # -fstrict-aliasing for gcc-2.95+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstrict-aliasing" >&5 @@ -12486,7 +12538,7 @@ ax_gcc_arch="" if test "$cross_compiling" = no; then case $host_cpu in - i[3456]86*|x86_64*) # use cpuid codes, in part from x86info-1.7 by D. Jones + i[3456]86*|x86_64*) # use cpuid codes ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -12602,18 +12654,24 @@ case $ax_cv_gcc_x86_cpuid_1 in *5[48]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;; *5??:*:*:*) ax_gcc_arch=pentium ;; - *6[3456]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; - *6a?:*[01]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; - *6a?:*[234]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; - *6[9d]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; - *6[78b]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; - *6??:*:*:*) ax_gcc_arch=pentiumpro ;; - *f3[347]:*:*:*|*f41347:*:*:*) + *0?6[3456]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *0?6a?:*[01]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *0?6a?:*[234]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *0?6[9de]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; + *0?6[78b]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *0?6f?:*:*:*|*1?66?:*:*:*) ax_gcc_arch="core2 pentium-m pentium3 pentiumpro" ;; + *1?6[7d]?:*:*:*) ax_gcc_arch="penryn core2 pentium-m pentium3 pentiumpro" ;; + *1?6[aef]?:*:*:*|*2?6[5cef]?:*:*:*) ax_gcc_arch="corei7 core2 pentium-m pentium3 pentiumpro" ;; + *1?6c?:*:*:*|*[23]?66?:*:*:*) ax_gcc_arch="atom core2 pentium-m pentium3 pentiumpro" ;; + *2?6[ad]?:*:*:*) ax_gcc_arch="corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;; + *0?6??:*:*:*) ax_gcc_arch=pentiumpro ;; + *6??:*:*:*) ax_gcc_arch="core2 pentiumpro" ;; + ?000?f3[347]:*:*:*|?000?f41347:*:*:*|?000?f6?:*:*:*) case $host_cpu in - x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; - *) ax_gcc_arch="prescott pentium4 pentiumpro" ;; - esac ;; - *f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; + x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; + *) ax_gcc_arch="prescott pentium4 pentiumpro" ;; + esac ;; + ?000?f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; esac ;; *:68747541:*:*) # AMD case $ax_cv_gcc_x86_cpuid_1 in @@ -12685,10 +12743,13 @@ ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;; *) ax_gcc_arch="athlon-4 athlon k7" ;; esac ;; - *f[4cef8b]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; - *f5?:*:*:*) ax_gcc_arch="opteron k8" ;; - *f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; - *f??:*:*:*) ax_gcc_arch="k8" ;; + ?00??f[4cef8b]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; + ?00??f5?:*:*:*) ax_gcc_arch="opteron k8" ;; + ?00??f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; + ?00??f??:*:*:*) ax_gcc_arch="k8" ;; + ?05??f??:*:*:*) ax_gcc_arch="btver1 amdfam10 k8" ;; + ?06??f??:*:*:*) ax_gcc_arch="bdver1 amdfam10 k8" ;; + *f??:*:*:*) ax_gcc_arch="amdfam10 k8" ;; esac ;; *:746e6543:*:*) # IDT case $ax_cv_gcc_x86_cpuid_1 in @@ -12726,7 +12787,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PRTDIAG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -12921,6 +12982,31 @@ fi +# The AX_CFLAGS_WARN_ALL macro doesn't currently work for sunpro +# compiler. +if test "$ax_cv_c_compiler_vendor" != "sun"; then + if ${CFLAGS+:} false; then : + case " $CFLAGS " in + *" "*) + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains "; } >&5 + (: CFLAGS already contains ) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + ;; + *) + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \""; } >&5 + (: CFLAGS="$CFLAGS ") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + CFLAGS="$CFLAGS " + ;; + esac +else + CFLAGS="" +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -12957,6 +13043,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags_warn_all" >&5 $as_echo "$ac_cv_cflags_warn_all" >&6; } + case ".$ac_cv_cflags_warn_all" in .ok|.ok,*) ;; .|.no|.no,*) ;; @@ -12991,8 +13078,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +fi + if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -fexceptions" + touch local.exp +else + cat > local.exp <&5 $as_echo_n "checking for ANSI C header files... " >&6; } @@ -13859,23 +14045,20 @@ /* end confdefs.h. */ $ac_includes_default int -find_stack_direction () -{ - static char *addr = 0; - auto char dummy; - if (addr == 0) - { - addr = &dummy; - return find_stack_direction (); - } - else - return (&dummy > addr) ? 1 : -1; -} - -int -main () -{ - return find_stack_direction () < 0; +find_stack_direction (int *addr, int depth) +{ + int dir, dummy = 0; + if (! addr) + addr = &dummy; + *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; + dir = depth ? find_stack_direction (addr, depth - 1) : 0; + return dir + dummy; +} + +int +main (int argc, char **argv) +{ + return find_stack_direction (0, argc + !argv + 20) < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : @@ -14289,11 +14472,11 @@ # Check if we have .register cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + +int +main () +{ asm (".register %g2, #scratch"); -int -main () -{ - ; return 0; } @@ -14322,10 +14505,10 @@ $as_echo_n "(cached) " >&6 else - libffi_cv_as_x86_pcrel=no + libffi_cv_as_x86_pcrel=yes echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s - if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then - libffi_cv_as_x86_pcrel=yes + if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then + libffi_cv_as_x86_pcrel=no fi fi @@ -14347,11 +14530,11 @@ # Check if we have .ascii cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + +int +main () +{ asm (".ascii \\"string\\""); -int -main () -{ - ; return 0; } @@ -14382,11 +14565,11 @@ # Check if we have .string cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + +int +main () +{ asm (".string \\"string\\""); -int -main () -{ - ; return 0; } @@ -14408,6 +14591,17 @@ fi fi +# On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. +# Check whether --enable-pax_emutramp was given. +if test "${enable_pax_emutramp+set}" = set; then : + enableval=$enable_pax_emutramp; if test "$enable_pax_emutramp" = "yes"; then + +$as_echo "#define FFI_MMAP_EXEC_EMUTRAMP_PAX 1" >>confdefs.h + + fi +fi + + if test x$TARGET = xX86_WIN64; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _ prefix in compiled symbols" >&5 $as_echo_n "checking for _ prefix in compiled symbols... " >&6; } @@ -14463,7 +14657,6 @@ fi fi - FFI_EXEC_TRAMPOLINE_TABLE=0 case "$target" in *arm*-apple-darwin*) @@ -14472,7 +14665,7 @@ $as_echo "#define FFI_EXEC_TRAMPOLINE_TABLE 1" >>confdefs.h ;; - *-apple-darwin1[10]* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) + *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) $as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h @@ -14520,11 +14713,12 @@ libffi_cv_ro_eh_frame=no echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c - if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then - if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then - libffi_cv_ro_eh_frame=yes - elif grep '.section.*eh_frame.*#alloc' conftest.c \ - | grep -v '#write' > /dev/null; then + if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then + objdump -h conftest.o > conftest.dump 2>&1 + libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1` + libffi_test_line=`expr $libffi_eh_frame_line + 1`p + sed -n $libffi_test_line conftest.dump > conftest.line + if grep READONLY conftest.line > /dev/null; then libffi_cv_ro_eh_frame=yes fi fi @@ -14610,6 +14804,14 @@ fi fi + if test "$enable_debug" = "yes"; then + FFI_DEBUG_TRUE= + FFI_DEBUG_FALSE='#' +else + FFI_DEBUG_TRUE='#' + FFI_DEBUG_FALSE= +fi + # Check whether --enable-raw-api was given. if test "${enable_raw_api+set}" = set; then : @@ -14633,7 +14835,7 @@ # These variables are only ever used when we cross-build to X86_WIN32. # And we only support this with GCC, so... -if test x"$GCC" != x"no"; then +if test "x$GCC" = "xyes"; then if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then toolexecdir='$(exec_prefix)/$(target_alias)' @@ -14645,17 +14847,13 @@ multi_os_directory=`$CC -print-multi-os-directory` case $multi_os_directory in .) ;; # Avoid trailing /. - *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; - esac - - -fi - -if test "${multilib}" = "yes"; then - multilib_arg="--enable-multilib" -else - multilib_arg= -fi + ../*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; + esac + +else + toolexeclibdir='$(libdir)' +fi + ac_config_commands="$ac_config_commands include" @@ -14783,6 +14981,14 @@ LTLIBOBJS=$ac_ltlibobjs +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -14815,6 +15021,10 @@ as_fn_error $? "conditional \"MIPS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${BFIN_TRUE}" && test -z "${BFIN_FALSE}"; then + as_fn_error $? "conditional \"BFIN\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${SPARC_TRUE}" && test -z "${SPARC_FALSE}"; then as_fn_error $? "conditional \"SPARC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -14855,6 +15065,14 @@ as_fn_error $? "conditional \"M68K\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${MICROBLAZE_TRUE}" && test -z "${MICROBLAZE_FALSE}"; then + as_fn_error $? "conditional \"MICROBLAZE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${METAG_TRUE}" && test -z "${METAG_FALSE}"; then + as_fn_error $? "conditional \"METAG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${MOXIE_TRUE}" && test -z "${MOXIE_FALSE}"; then as_fn_error $? "conditional \"MOXIE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -14875,6 +15093,10 @@ as_fn_error $? "conditional \"POWERPC_FREEBSD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${AARCH64_TRUE}" && test -z "${AARCH64_FALSE}"; then + as_fn_error $? "conditional \"AARCH64\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${ARM_TRUE}" && test -z "${ARM_FALSE}"; then as_fn_error $? "conditional \"ARM\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -14919,6 +15141,14 @@ as_fn_error $? "conditional \"PA64_HPUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${TILE_TRUE}" && test -z "${TILE_FALSE}"; then + as_fn_error $? "conditional \"TILE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${XTENSA_TRUE}" && test -z "${XTENSA_FALSE}"; then + as_fn_error $? "conditional \"XTENSA\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${FFI_EXEC_TRAMPOLINE_TABLE_TRUE}" && test -z "${FFI_EXEC_TRAMPOLINE_TABLE_FALSE}"; then as_fn_error $? "conditional \"FFI_EXEC_TRAMPOLINE_TABLE\" was never defined. @@ -14928,6 +15158,10 @@ as_fn_error $? "conditional \"FFI_DEBUG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${FFI_DEBUG_TRUE}" && test -z "${FFI_DEBUG_FALSE}"; then + as_fn_error $? "conditional \"FFI_DEBUG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 @@ -15226,16 +15460,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -15295,28 +15529,16 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -15337,8 +15559,8 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libffi $as_me 3.0.11, which was -generated by GNU Autoconf 2.68. Invocation command line was +This file was extended by libffi $as_me 3.0.13, which was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -15407,11 +15629,11 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libffi config.status 3.0.11 -configured by $0, generated by GNU Autoconf 2.68, +libffi config.status 3.0.13 +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -15502,7 +15724,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' @@ -16622,7 +16844,7 @@ # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but + # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. @@ -16656,21 +16878,19 @@ continue fi # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || diff --git a/Modules/_ctypes/libffi/configure.ac b/Modules/_ctypes/libffi/configure.ac --- a/Modules/_ctypes/libffi/configure.ac +++ b/Modules/_ctypes/libffi/configure.ac @@ -1,11 +1,11 @@ dnl Process this with autoconf to create configure # -# file from libffi - slightly patched for ctypes +# file from libffi - slightly patched for Python's ctypes # AC_PREREQ(2.68) -AC_INIT([libffi], [3.0.11], [http://github.com/atgreen/libffi/issues]) +AC_INIT([libffi], [3.0.13], [http://github.com/atgreen/libffi/issues]) AC_CONFIG_HEADERS([fficonfig.h]) AC_CANONICAL_SYSTEM @@ -30,7 +30,7 @@ AC_PROG_CC CFLAGS=$save_CFLAGS m4_undefine([_AC_ARG_VAR_PRECIOUS]) -m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) +m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) AC_SUBST(CFLAGS) @@ -39,10 +39,24 @@ AC_PROG_LIBTOOL AC_CONFIG_MACRO_DIR([m4]) +# Test for 64-bit build. +AC_CHECK_SIZEOF([size_t]) + +AX_COMPILER_VENDOR AX_CC_MAXOPT -AX_CFLAGS_WARN_ALL +# The AX_CFLAGS_WARN_ALL macro doesn't currently work for sunpro +# compiler. +if test "$ax_cv_c_compiler_vendor" != "sun"; then + AX_CFLAGS_WARN_ALL +fi + if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -fexceptions" + touch local.exp +else + cat > local.exp < /dev/null]) +AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN) AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) AM_CONDITIONAL(X86, test x$TARGET = xX86) AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD) @@ -229,11 +288,14 @@ AM_CONDITIONAL(IA64, test x$TARGET = xIA64) AM_CONDITIONAL(M32R, test x$TARGET = xM32R) AM_CONDITIONAL(M68K, test x$TARGET = xM68K) +AM_CONDITIONAL(MICROBLAZE, test x$TARGET = xMICROBLAZE) +AM_CONDITIONAL(METAG, test x$TARGET = xMETAG) AM_CONDITIONAL(MOXIE, test x$TARGET = xMOXIE) AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC) AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX) AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN) AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD) +AM_CONDITIONAL(AARCH64, test x$TARGET = xAARCH64) AM_CONDITIONAL(ARM, test x$TARGET = xARM) AM_CONDITIONAL(AVR32, test x$TARGET = xAVR32) AM_CONDITIONAL(LIBFFI_CRIS, test x$TARGET = xLIBFFI_CRIS) @@ -245,6 +307,8 @@ AM_CONDITIONAL(PA_LINUX, test x$TARGET = xPA_LINUX) AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX) AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX) +AM_CONDITIONAL(TILE, test x$TARGET = xTILE) +AM_CONDITIONAL(XTENSA, test x$TARGET = xXTENSA) AC_HEADER_STDC AC_CHECK_FUNCS(memcpy) @@ -290,7 +354,7 @@ libffi_cv_as_register_pseudo_op, [ libffi_cv_as_register_pseudo_op=unknown # Check if we have .register - AC_TRY_COMPILE([asm (".register %g2, #scratch");],, + AC_TRY_COMPILE(,[asm (".register %g2, #scratch");], [libffi_cv_as_register_pseudo_op=yes], [libffi_cv_as_register_pseudo_op=no]) ]) @@ -303,10 +367,10 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then AC_CACHE_CHECK([assembler supports pc related relocs], libffi_cv_as_x86_pcrel, [ - libffi_cv_as_x86_pcrel=no + libffi_cv_as_x86_pcrel=yes echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s - if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then - libffi_cv_as_x86_pcrel=yes + if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then + libffi_cv_as_x86_pcrel=no fi ]) if test "x$libffi_cv_as_x86_pcrel" = xyes; then @@ -318,7 +382,7 @@ libffi_cv_as_ascii_pseudo_op, [ libffi_cv_as_ascii_pseudo_op=unknown # Check if we have .ascii - AC_TRY_COMPILE([asm (".ascii \\"string\\"");],, + AC_TRY_COMPILE(,[asm (".ascii \\"string\\"");], [libffi_cv_as_ascii_pseudo_op=yes], [libffi_cv_as_ascii_pseudo_op=no]) ]) @@ -331,7 +395,7 @@ libffi_cv_as_string_pseudo_op, [ libffi_cv_as_string_pseudo_op=unknown # Check if we have .string - AC_TRY_COMPILE([asm (".string \\"string\\"");],, + AC_TRY_COMPILE(,[asm (".string \\"string\\"");], [libffi_cv_as_string_pseudo_op=yes], [libffi_cv_as_string_pseudo_op=no]) ]) @@ -341,6 +405,14 @@ fi fi +# On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. +AC_ARG_ENABLE(pax_emutramp, + [ --enable-pax_emutramp enable pax emulated trampolines, for we can't use PROT_EXEC], + if test "$enable_pax_emutramp" = "yes"; then + AC_DEFINE(FFI_MMAP_EXEC_EMUTRAMP_PAX, 1, + [Define this if you want to enable pax emulated trampolines]) + fi) + if test x$TARGET = xX86_WIN64; then LT_SYS_SYMBOL_USCORE if test "x$sys_symbol_underscore" = xyes; then @@ -348,7 +420,6 @@ fi fi - FFI_EXEC_TRAMPOLINE_TABLE=0 case "$target" in *arm*-apple-darwin*) @@ -357,7 +428,7 @@ [Cannot use PROT_EXEC on this target, so, we revert to alternative means]) ;; - *-apple-darwin1[[10]]* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) + *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1, [Cannot use malloc on this target, so, we revert to alternative means]) @@ -386,11 +457,12 @@ libffi_cv_ro_eh_frame, [ libffi_cv_ro_eh_frame=no echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c - if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then - if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then - libffi_cv_ro_eh_frame=yes - elif grep '.section.*eh_frame.*#alloc' conftest.c \ - | grep -v '#write' > /dev/null; then + if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then + objdump -h conftest.o > conftest.dump 2>&1 + libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1` + libffi_test_line=`expr $libffi_eh_frame_line + 1`p + sed -n $libffi_test_line conftest.dump > conftest.line + if grep READONLY conftest.line > /dev/null; then libffi_cv_ro_eh_frame=yes fi fi @@ -456,6 +528,7 @@ if test "$enable_structs" = "no"; then AC_DEFINE(FFI_NO_STRUCTS, 1, [Define this is you do not want support for aggregate types.]) fi) +AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes") AC_ARG_ENABLE(raw-api, [ --disable-raw-api make the raw api unavailable], @@ -471,7 +544,7 @@ # These variables are only ever used when we cross-build to X86_WIN32. # And we only support this with GCC, so... -if test x"$GCC" != x"no"; then +if test "x$GCC" = "xyes"; then if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then toolexecdir='$(exec_prefix)/$(target_alias)' @@ -483,17 +556,13 @@ multi_os_directory=`$CC -print-multi-os-directory` case $multi_os_directory in .) ;; # Avoid trailing /. - *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; + ../*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; esac AC_SUBST(toolexecdir) - AC_SUBST(toolexeclibdir) +else + toolexeclibdir='$(libdir)' fi - -if test "${multilib}" = "yes"; then - multilib_arg="--enable-multilib" -else - multilib_arg= -fi +AC_SUBST(toolexeclibdir) AC_CONFIG_COMMANDS(include, [test -d include || mkdir include]) AC_CONFIG_COMMANDS(src, [ diff --git a/Modules/_ctypes/libffi/doc/libffi.info b/Modules/_ctypes/libffi/doc/libffi.info index 402f760804132933839c909e930855203b6b5264..896a5ec0f1efe6231df04e22e25ec1e280b5e077 GIT binary patch [stripped] diff --git a/Modules/_ctypes/libffi/doc/libffi.texi b/Modules/_ctypes/libffi/doc/libffi.texi --- a/Modules/_ctypes/libffi/doc/libffi.texi +++ b/Modules/_ctypes/libffi/doc/libffi.texi @@ -360,7 +360,7 @@ new @code{ffi_type} object for it. @tindex ffi_type - at deftp ffi_type + at deftp {Data type} ffi_type The @code{ffi_type} has the following members: @table @code @item size_t size diff --git a/Modules/_ctypes/libffi/doc/stamp-vti b/Modules/_ctypes/libffi/doc/stamp-vti --- a/Modules/_ctypes/libffi/doc/stamp-vti +++ b/Modules/_ctypes/libffi/doc/stamp-vti @@ -1,4 +1,4 @@ - at set UPDATED 11 April 2012 - at set UPDATED-MONTH April 2012 - at set EDITION 3.0.11 - at set VERSION 3.0.11 + at set UPDATED 16 March 2013 + at set UPDATED-MONTH March 2013 + at set EDITION 3.0.13 + at set VERSION 3.0.13 diff --git a/Modules/_ctypes/libffi/doc/version.texi b/Modules/_ctypes/libffi/doc/version.texi --- a/Modules/_ctypes/libffi/doc/version.texi +++ b/Modules/_ctypes/libffi/doc/version.texi @@ -1,4 +1,4 @@ - at set UPDATED 11 April 2012 - at set UPDATED-MONTH April 2012 - at set EDITION 3.0.11 - at set VERSION 3.0.11 + at set UPDATED 16 March 2013 + at set UPDATED-MONTH March 2013 + at set EDITION 3.0.13 + at set VERSION 3.0.13 diff --git a/Modules/_ctypes/libffi/fficonfig.h.in b/Modules/_ctypes/libffi/fficonfig.h.in --- a/Modules/_ctypes/libffi/fficonfig.h.in +++ b/Modules/_ctypes/libffi/fficonfig.h.in @@ -20,6 +20,9 @@ /* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ #undef FFI_EXEC_TRAMPOLINE_TABLE +/* Define this if you want to enable pax emulated trampolines */ +#undef FFI_MMAP_EXEC_EMUTRAMP_PAX + /* Cannot use malloc on this target, so, we revert to alternative means */ #undef FFI_MMAP_EXEC_WRIT diff --git a/Modules/_ctypes/libffi/include/Makefile.in b/Modules/_ctypes/libffi/include/Makefile.in --- a/Modules/_ctypes/libffi/include/Makefile.in +++ b/Modules/_ctypes/libffi/include/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. +# Makefile.in generated by automake 1.12.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,6 +15,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -37,18 +53,35 @@ target_triplet = @target@ subdir = include DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/ffi.h.in $(srcdir)/ffi_common.h + $(srcdir)/ffi.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_cc_maxopt.m4 \ + $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_configure_args.m4 \ + $(top_srcdir)/m4/ax_enable_builddir.m4 \ + $(top_srcdir)/m4/ax_gcc_archflag.m4 \ + $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/fficonfig.h CONFIG_CLEAN_FILES = ffi.h ffitarget.h -CONFIG_CLEAN_VPATH_FILES = ffi_common.h +CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -145,6 +178,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PRTDIAG = @PRTDIAG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -165,6 +199,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -200,6 +235,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ @@ -259,8 +295,11 @@ -rm -rf .libs _libs install-nodist_includesHEADERS: $(nodist_includes_HEADERS) @$(NORMAL_INSTALL) - test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includesdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includesdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -325,6 +364,20 @@ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -465,7 +518,7 @@ .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool ctags distclean distclean-generic \ + clean-libtool cscopelist ctags distclean distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ diff --git a/Modules/_ctypes/libffi/include/ffi_common.h b/Modules/_ctypes/libffi/include/ffi_common.h --- a/Modules/_ctypes/libffi/include/ffi_common.h +++ b/Modules/_ctypes/libffi/include/ffi_common.h @@ -87,7 +87,7 @@ } extended_cif; /* Terse sized type definitions. */ -#if defined(_MSC_VER) || defined(__sgi) +#if defined(_MSC_VER) || defined(__sgi) || defined(__SUNPRO_C) typedef unsigned char UINT8; typedef signed char SINT8; typedef unsigned short UINT16; diff --git a/Modules/_ctypes/libffi/libffi.xcodeproj/project.pbxproj b/Modules/_ctypes/libffi/libffi.xcodeproj/project.pbxproj --- a/Modules/_ctypes/libffi/libffi.xcodeproj/project.pbxproj +++ b/Modules/_ctypes/libffi/libffi.xcodeproj/project.pbxproj @@ -12,17 +12,12 @@ 6C43CBDE1534F76F00162364 /* trampoline.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBC01534F76F00162364 /* trampoline.S */; }; 6C43CBE61534F76F00162364 /* darwin.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBC91534F76F00162364 /* darwin.S */; }; 6C43CBE81534F76F00162364 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBCB1534F76F00162364 /* ffi.c */; }; - 6C43CBE91534F76F00162364 /* ffi64.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBCC1534F76F00162364 /* ffi64.c */; }; 6C43CC1F1534F77800162364 /* darwin.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC051534F77800162364 /* darwin.S */; }; 6C43CC201534F77800162364 /* darwin64.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC061534F77800162364 /* darwin64.S */; }; 6C43CC211534F77800162364 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC071534F77800162364 /* ffi.c */; }; 6C43CC221534F77800162364 /* ffi64.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC081534F77800162364 /* ffi64.c */; }; 6C43CC2F1534F7BE00162364 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC281534F7BE00162364 /* closures.c */; }; 6C43CC301534F7BE00162364 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC281534F7BE00162364 /* closures.c */; }; - 6C43CC311534F7BE00162364 /* debug.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC291534F7BE00162364 /* debug.c */; }; - 6C43CC321534F7BE00162364 /* debug.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC291534F7BE00162364 /* debug.c */; }; - 6C43CC331534F7BE00162364 /* dlmalloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2A1534F7BE00162364 /* dlmalloc.c */; }; - 6C43CC341534F7BE00162364 /* dlmalloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2A1534F7BE00162364 /* dlmalloc.c */; }; 6C43CC351534F7BE00162364 /* java_raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2B1534F7BE00162364 /* java_raw_api.c */; }; 6C43CC361534F7BE00162364 /* java_raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2B1534F7BE00162364 /* java_raw_api.c */; }; 6C43CC371534F7BE00162364 /* prep_cif.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2C1534F7BE00162364 /* prep_cif.c */; }; @@ -61,14 +56,11 @@ 6C43CBC01534F76F00162364 /* trampoline.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = trampoline.S; sourceTree = ""; }; 6C43CBC91534F76F00162364 /* darwin.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin.S; sourceTree = ""; }; 6C43CBCB1534F76F00162364 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = ""; }; - 6C43CBCC1534F76F00162364 /* ffi64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi64.c; sourceTree = ""; }; 6C43CC051534F77800162364 /* darwin.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin.S; sourceTree = ""; }; 6C43CC061534F77800162364 /* darwin64.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin64.S; sourceTree = ""; }; 6C43CC071534F77800162364 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = ""; }; 6C43CC081534F77800162364 /* ffi64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi64.c; sourceTree = ""; }; 6C43CC281534F7BE00162364 /* closures.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = closures.c; path = src/closures.c; sourceTree = SOURCE_ROOT; }; - 6C43CC291534F7BE00162364 /* debug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = debug.c; path = src/debug.c; sourceTree = SOURCE_ROOT; }; - 6C43CC2A1534F7BE00162364 /* dlmalloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dlmalloc.c; path = src/dlmalloc.c; sourceTree = SOURCE_ROOT; }; 6C43CC2B1534F7BE00162364 /* java_raw_api.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = java_raw_api.c; path = src/java_raw_api.c; sourceTree = SOURCE_ROOT; }; 6C43CC2C1534F7BE00162364 /* prep_cif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = prep_cif.c; path = src/prep_cif.c; sourceTree = SOURCE_ROOT; }; 6C43CC2D1534F7BE00162364 /* raw_api.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = raw_api.c; path = src/raw_api.c; sourceTree = SOURCE_ROOT; }; @@ -149,7 +141,6 @@ children = ( 6C43CBC91534F76F00162364 /* darwin.S */, 6C43CBCB1534F76F00162364 /* ffi.c */, - 6C43CBCC1534F76F00162364 /* ffi64.c */, ); path = x86; sourceTree = ""; @@ -187,8 +178,6 @@ isa = PBXGroup; children = ( 6C43CC281534F7BE00162364 /* closures.c */, - 6C43CC291534F7BE00162364 /* debug.c */, - 6C43CC2A1534F7BE00162364 /* dlmalloc.c */, 6C43CC2B1534F7BE00162364 /* java_raw_api.c */, 6C43CC2C1534F7BE00162364 /* prep_cif.c */, 6C43CC2D1534F7BE00162364 /* raw_api.c */, @@ -412,8 +401,6 @@ 6C43CC211534F77800162364 /* ffi.c in Sources */, 6C43CC221534F77800162364 /* ffi64.c in Sources */, 6C43CC301534F7BE00162364 /* closures.c in Sources */, - 6C43CC321534F7BE00162364 /* debug.c in Sources */, - 6C43CC341534F7BE00162364 /* dlmalloc.c in Sources */, 6C43CC361534F7BE00162364 /* java_raw_api.c in Sources */, 6C43CC381534F7BE00162364 /* prep_cif.c in Sources */, 6C43CC3A1534F7BE00162364 /* raw_api.c in Sources */, @@ -430,10 +417,7 @@ 6C43CBDE1534F76F00162364 /* trampoline.S in Sources */, 6C43CBE61534F76F00162364 /* darwin.S in Sources */, 6C43CBE81534F76F00162364 /* ffi.c in Sources */, - 6C43CBE91534F76F00162364 /* ffi64.c in Sources */, 6C43CC2F1534F7BE00162364 /* closures.c in Sources */, - 6C43CC311534F7BE00162364 /* debug.c in Sources */, - 6C43CC331534F7BE00162364 /* dlmalloc.c in Sources */, 6C43CC351534F7BE00162364 /* java_raw_api.c in Sources */, 6C43CC371534F7BE00162364 /* prep_cif.c in Sources */, 6C43CC391534F7BE00162364 /* raw_api.c in Sources */, diff --git a/Modules/_ctypes/libffi/libtool-ldflags b/Modules/_ctypes/libffi/libtool-ldflags new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/libtool-ldflags @@ -0,0 +1,106 @@ +#! /bin/sh + +# Script to translate LDFLAGS into a form suitable for use with libtool. + +# Copyright (C) 2005 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. + +# Contributed by CodeSourcery, LLC. + +# This script is designed to be used from a Makefile that uses libtool +# to build libraries as follows: +# +# LTLDFLAGS = $(shell libtool-ldflags $(LDFLAGS)) +# +# Then, use (LTLDFLAGS) in place of $(LDFLAGS) in your link line. + +# The output of the script. This string is built up as we process the +# arguments. +result= +prev_arg= + +for arg +do + case $arg in + -f*|--*) + # Libtool does not ascribe any special meaning options + # that begin with -f or with a double-dash. So, it will + # think these options are linker options, and prefix them + # with "-Wl,". Then, the compiler driver will ignore the + # options. So, we prefix these options with -Xcompiler to + # make clear to libtool that they are in fact compiler + # options. + case $prev_arg in + -Xpreprocessor|-Xcompiler|-Xlinker) + # This option is already prefixed; don't prefix it again. + ;; + *) + result="$result -Xcompiler" + ;; + esac + ;; + *) + # We do not want to add -Xcompiler to other options because + # that would prevent libtool itself from recognizing them. + ;; + esac + prev_arg=$arg + + # If $(LDFLAGS) is (say): + # a "b'c d" e + # then the user expects that: + # $(LD) $(LDFLAGS) + # will pass three arguments to $(LD): + # 1) a + # 2) b'c d + # 3) e + # We must ensure, therefore, that the arguments are appropriately + # quoted so that using: + # libtool --mode=link ... $(LTLDFLAGS) + # will result in the same number of arguments being passed to + # libtool. In other words, when this script was invoked, the shell + # removed one level of quoting, present in $(LDFLAGS); we have to put + # it back. + + # Quote any embedded single quotes. + case $arg in + *"'"*) + # The following command creates the script: + # 1s,^X,,;s|'|'"'"'|g + # which removes a leading X, and then quotes and embedded single + # quotes. + sed_script="1s,^X,,;s|'|'\"'\"'|g" + # Add a leading "X" so that if $arg starts with a dash, + # the echo command will not try to interpret the argument + # as a command-line option. + arg="X$arg" + # Generate the quoted string. + quoted_arg=`echo "$arg" | sed -e "$sed_script"` + ;; + *) + quoted_arg=$arg + ;; + esac + # Surround the entire argument with single quotes. + quoted_arg="'"$quoted_arg"'" + + # Add it to the string. + result="$result $quoted_arg" +done + +# Output the string we have built up. +echo "$result" diff --git a/Modules/_ctypes/libffi/libtool-version b/Modules/_ctypes/libffi/libtool-version --- a/Modules/_ctypes/libffi/libtool-version +++ b/Modules/_ctypes/libffi/libtool-version @@ -26,4 +26,4 @@ # release, then set age to 0. # # CURRENT:REVISION:AGE -6:0:0 +6:1:0 diff --git a/Modules/_ctypes/libffi/ltmain.sh b/Modules/_ctypes/libffi/ltmain.sh old mode 100644 new mode 100755 --- a/Modules/_ctypes/libffi/ltmain.sh +++ b/Modules/_ctypes/libffi/ltmain.sh @@ -70,7 +70,7 @@ # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 +# $progname: (GNU libtool) 2.4.2 # automake: $automake_version # autoconf: $autoconf_version # @@ -80,7 +80,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.2 Debian-2.4.2-1ubuntu1" +VERSION=2.4.2 TIMESTAMP="" package_revision=1.3337 @@ -6124,10 +6124,7 @@ case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; - link) - libs="$deplibs %DEPLIBS%" - test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" - ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then @@ -6447,19 +6444,19 @@ # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append tmp_libs " $deplib" - done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done continue fi # $pass = conv @@ -7352,9 +7349,6 @@ revision="$number_minor" lt_irix_increment=no ;; - *) - func_fatal_configuration "$modename: unknown library version type \`$version_type'" - ;; esac ;; no) diff --git a/Modules/_ctypes/libffi/m4/ax_cc_maxopt.m4 b/Modules/_ctypes/libffi/m4/ax_cc_maxopt.m4 --- a/Modules/_ctypes/libffi/m4/ax_cc_maxopt.m4 +++ b/Modules/_ctypes/libffi/m4/ax_cc_maxopt.m4 @@ -55,7 +55,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 12 +#serial 13 AC_DEFUN([AX_CC_MAXOPT], [ @@ -64,7 +64,7 @@ AC_REQUIRE([AC_CANONICAL_HOST]) AC_ARG_ENABLE(portable-binary, [AS_HELP_STRING([--enable-portable-binary], [disable compiler optimizations that would produce unportable binaries])], - acx_maxopt_portable=$withval, acx_maxopt_portable=no) + acx_maxopt_portable=$enableval, acx_maxopt_portable=no) # Try to determine "good" native compiler flags if none specified via CFLAGS if test "$ac_test_CFLAGS" != "set"; then @@ -141,7 +141,8 @@ CFLAGS="-O3 -fomit-frame-pointer" # -malign-double for x86 systems - AX_CHECK_COMPILE_FLAG(-malign-double, CFLAGS="$CFLAGS -malign-double") + # LIBFFI -- DON'T DO THIS - CHANGES ABI + # AX_CHECK_COMPILE_FLAG(-malign-double, CFLAGS="$CFLAGS -malign-double") # -fstrict-aliasing for gcc-2.95+ AX_CHECK_COMPILE_FLAG(-fstrict-aliasing, diff --git a/Modules/_ctypes/libffi/m4/ax_cflags_warn_all.m4 b/Modules/_ctypes/libffi/m4/ax_cflags_warn_all.m4 --- a/Modules/_ctypes/libffi/m4/ax_cflags_warn_all.m4 +++ b/Modules/_ctypes/libffi/m4/ax_cflags_warn_all.m4 @@ -58,7 +58,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 13 +#serial 14 AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl @@ -84,6 +84,7 @@ FLAGS="$ac_save_[]FLAGS" ]) AS_VAR_POPDEF([FLAGS])dnl +AC_REQUIRE([AX_APPEND_FLAG]) case ".$VAR" in .ok|.ok,*) m4_ifvaln($3,$3) ;; .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;; diff --git a/Modules/_ctypes/libffi/m4/ax_gcc_archflag.m4 b/Modules/_ctypes/libffi/m4/ax_gcc_archflag.m4 --- a/Modules/_ctypes/libffi/m4/ax_gcc_archflag.m4 +++ b/Modules/_ctypes/libffi/m4/ax_gcc_archflag.m4 @@ -36,6 +36,7 @@ # # Copyright (c) 2008 Steven G. Johnson # Copyright (c) 2008 Matteo Frigo +# Copyright (c) 2012 Tsukasa Oi # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the @@ -63,7 +64,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 10 +#serial 11 AC_DEFUN([AX_GCC_ARCHFLAG], [AC_REQUIRE([AC_PROG_CC]) @@ -84,7 +85,7 @@ ax_gcc_arch="" if test "$cross_compiling" = no; then case $host_cpu in - i[[3456]]86*|x86_64*) # use cpuid codes, in part from x86info-1.7 by D. Jones + i[[3456]]86*|x86_64*) # use cpuid codes AX_GCC_X86_CPUID(0) AX_GCC_X86_CPUID(1) case $ax_cv_gcc_x86_cpuid_0 in @@ -92,18 +93,24 @@ case $ax_cv_gcc_x86_cpuid_1 in *5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;; *5??:*:*:*) ax_gcc_arch=pentium ;; - *6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; - *6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; - *6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; - *6[[9d]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; - *6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; - *6??:*:*:*) ax_gcc_arch=pentiumpro ;; - *f3[[347]]:*:*:*|*f4[1347]:*:*:*) + *0?6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *0?6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *0?6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *0?6[[9de]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; + *0?6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *0?6f?:*:*:*|*1?66?:*:*:*) ax_gcc_arch="core2 pentium-m pentium3 pentiumpro" ;; + *1?6[[7d]]?:*:*:*) ax_gcc_arch="penryn core2 pentium-m pentium3 pentiumpro" ;; + *1?6[[aef]]?:*:*:*|*2?6[[5cef]]?:*:*:*) ax_gcc_arch="corei7 core2 pentium-m pentium3 pentiumpro" ;; + *1?6c?:*:*:*|*[[23]]?66?:*:*:*) ax_gcc_arch="atom core2 pentium-m pentium3 pentiumpro" ;; + *2?6[[ad]]?:*:*:*) ax_gcc_arch="corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;; + *0?6??:*:*:*) ax_gcc_arch=pentiumpro ;; + *6??:*:*:*) ax_gcc_arch="core2 pentiumpro" ;; + ?000?f3[[347]]:*:*:*|?000?f4[1347]:*:*:*|?000?f6?:*:*:*) case $host_cpu in - x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; - *) ax_gcc_arch="prescott pentium4 pentiumpro" ;; - esac ;; - *f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; + x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; + *) ax_gcc_arch="prescott pentium4 pentiumpro" ;; + esac ;; + ?000?f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; esac ;; *:68747541:*:*) # AMD case $ax_cv_gcc_x86_cpuid_1 in @@ -121,10 +128,13 @@ ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;; *) ax_gcc_arch="athlon-4 athlon k7" ;; esac ;; - *f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; - *f5?:*:*:*) ax_gcc_arch="opteron k8" ;; - *f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; - *f??:*:*:*) ax_gcc_arch="k8" ;; + ?00??f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; + ?00??f5?:*:*:*) ax_gcc_arch="opteron k8" ;; + ?00??f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; + ?00??f??:*:*:*) ax_gcc_arch="k8" ;; + ?05??f??:*:*:*) ax_gcc_arch="btver1 amdfam10 k8" ;; + ?06??f??:*:*:*) ax_gcc_arch="bdver1 amdfam10 k8" ;; + *f??:*:*:*) ax_gcc_arch="amdfam10 k8" ;; esac ;; *:746e6543:*:*) # IDT case $ax_cv_gcc_x86_cpuid_1 in diff --git a/Modules/_ctypes/libffi/m4/libtool.m4 b/Modules/_ctypes/libffi/m4/libtool.m4 --- a/Modules/_ctypes/libffi/m4/libtool.m4 +++ b/Modules/_ctypes/libffi/m4/libtool.m4 @@ -1324,7 +1324,14 @@ LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -1688,7 +1695,8 @@ ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -2669,10 +2677,14 @@ # before this can be enabled. hardcode_into_libs=yes + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -2684,18 +2696,6 @@ dynamic_linker='GNU/Linux ld.so' ;; -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no @@ -3301,7 +3301,7 @@ lt_cv_deplibs_check_method=pass_all ;; -netbsd* | netbsdelf*-gnu) +netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else @@ -4113,7 +4113,7 @@ ;; esac ;; - netbsd* | netbsdelf*-gnu) + netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise @@ -4590,9 +4590,6 @@ ;; esac ;; - linux* | k*bsd*-gnu | gnu*) - _LT_TAGVAR(link_all_deplibs, $1)=no - ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; @@ -4655,9 +4652,6 @@ openbsd*) with_gnu_ld=no ;; - linux* | k*bsd*-gnu | gnu*) - _LT_TAGVAR(link_all_deplibs, $1)=no - ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes @@ -4879,7 +4873,7 @@ fi ;; - netbsd* | netbsdelf*-gnu) + netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= @@ -5056,7 +5050,6 @@ if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi - _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then @@ -5361,7 +5354,7 @@ _LT_TAGVAR(link_all_deplibs, $1)=yes ;; - netbsd* | netbsdelf*-gnu) + netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else diff --git a/Modules/_ctypes/libffi/man/Makefile.in b/Modules/_ctypes/libffi/man/Makefile.in --- a/Modules/_ctypes/libffi/man/Makefile.in +++ b/Modules/_ctypes/libffi/man/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. +# Makefile.in generated by automake 1.12.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,6 +14,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -37,7 +53,19 @@ subdir = man DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_cc_maxopt.m4 \ + $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_configure_args.m4 \ + $(top_srcdir)/m4/ax_enable_builddir.m4 \ + $(top_srcdir)/m4/ax_gcc_archflag.m4 \ + $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -47,6 +75,11 @@ CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -143,6 +176,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PRTDIAG = @PRTDIAG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -163,6 +197,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -198,6 +233,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ @@ -253,11 +289,18 @@ -rm -rf .libs _libs install-man3: $(man_MANS) @$(NORMAL_INSTALL) - test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" - @list=''; test -n "$(man3dir)" || exit 0; \ - { for i in $$list; do echo "$$i"; done; \ - l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.3[a-z]*$$/p'; \ + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man3dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.3[a-z]*$$/p'; \ + fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ @@ -293,6 +336,8 @@ ctags: CTAGS CTAGS: +cscope cscopelist: + distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ @@ -301,10 +346,10 @@ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ - echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ + echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ - echo " typically \`make maintainer-clean' will remove them" >&2; \ + echo " typically 'make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi diff --git a/Modules/_ctypes/libffi/man/ffi_prep_cif.3 b/Modules/_ctypes/libffi/man/ffi_prep_cif.3 --- a/Modules/_ctypes/libffi/man/ffi_prep_cif.3 +++ b/Modules/_ctypes/libffi/man/ffi_prep_cif.3 @@ -61,10 +61,8 @@ .Nm FFI_BAD_ABI will be returned. Available ABIs are defined in -.Nm -. +.Nm . .Sh SEE ALSO .Xr ffi 3 , .Xr ffi_call 3 , .Xr ffi_prep_cif_var 3 - diff --git a/Modules/_ctypes/libffi/msvcc.sh b/Modules/_ctypes/libffi/msvcc.sh old mode 100755 new mode 100644 diff --git a/Modules/_ctypes/libffi/src/aarch64/ffi.c b/Modules/_ctypes/libffi/src/aarch64/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/aarch64/ffi.c @@ -0,0 +1,1076 @@ +/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include +#include + +#include + +/* Stack alignment requirement in bytes */ +#define AARCH64_STACK_ALIGN 16 + +#define N_X_ARG_REG 8 +#define N_V_ARG_REG 8 + +#define AARCH64_FFI_WITH_V (1 << AARCH64_FFI_WITH_V_BIT) + +union _d +{ + UINT64 d; + UINT32 s[2]; +}; + +struct call_context +{ + UINT64 x [AARCH64_N_XREG]; + struct + { + union _d d[2]; + } v [AARCH64_N_VREG]; +}; + +static void * +get_x_addr (struct call_context *context, unsigned n) +{ + return &context->x[n]; +} + +static void * +get_s_addr (struct call_context *context, unsigned n) +{ +#if defined __AARCH64EB__ + return &context->v[n].d[1].s[1]; +#else + return &context->v[n].d[0].s[0]; +#endif +} + +static void * +get_d_addr (struct call_context *context, unsigned n) +{ +#if defined __AARCH64EB__ + return &context->v[n].d[1]; +#else + return &context->v[n].d[0]; +#endif +} + +static void * +get_v_addr (struct call_context *context, unsigned n) +{ + return &context->v[n]; +} + +/* Return the memory location at which a basic type would reside + were it to have been stored in register n. */ + +static void * +get_basic_type_addr (unsigned short type, struct call_context *context, + unsigned n) +{ + switch (type) + { + case FFI_TYPE_FLOAT: + return get_s_addr (context, n); + case FFI_TYPE_DOUBLE: + return get_d_addr (context, n); + case FFI_TYPE_LONGDOUBLE: + return get_v_addr (context, n); + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_INT: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + return get_x_addr (context, n); + default: + FFI_ASSERT (0); + return NULL; + } +} + +/* Return the alignment width for each of the basic types. */ + +static size_t +get_basic_type_alignment (unsigned short type) +{ + switch (type) + { + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + return sizeof (UINT64); + case FFI_TYPE_LONGDOUBLE: + return sizeof (long double); + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + return sizeof (UINT64); + + default: + FFI_ASSERT (0); + return 0; + } +} + +/* Return the size in bytes for each of the basic types. */ + +static size_t +get_basic_type_size (unsigned short type) +{ + switch (type) + { + case FFI_TYPE_FLOAT: + return sizeof (UINT32); + case FFI_TYPE_DOUBLE: + return sizeof (UINT64); + case FFI_TYPE_LONGDOUBLE: + return sizeof (long double); + case FFI_TYPE_UINT8: + return sizeof (UINT8); + case FFI_TYPE_SINT8: + return sizeof (SINT8); + case FFI_TYPE_UINT16: + return sizeof (UINT16); + case FFI_TYPE_SINT16: + return sizeof (SINT16); + case FFI_TYPE_UINT32: + return sizeof (UINT32); + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + return sizeof (SINT32); + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + return sizeof (UINT64); + case FFI_TYPE_SINT64: + return sizeof (SINT64); + + default: + FFI_ASSERT (0); + return 0; + } +} + +extern void +ffi_call_SYSV (unsigned (*)(struct call_context *context, unsigned char *, + extended_cif *), + struct call_context *context, + extended_cif *, + unsigned, + void (*fn)(void)); + +extern void +ffi_closure_SYSV (ffi_closure *); + +/* Test for an FFI floating point representation. */ + +static unsigned +is_floating_type (unsigned short type) +{ + return (type == FFI_TYPE_FLOAT || type == FFI_TYPE_DOUBLE + || type == FFI_TYPE_LONGDOUBLE); +} + +/* Test for a homogeneous structure. */ + +static unsigned short +get_homogeneous_type (ffi_type *ty) +{ + if (ty->type == FFI_TYPE_STRUCT && ty->elements) + { + unsigned i; + unsigned short candidate_type + = get_homogeneous_type (ty->elements[0]); + for (i =1; ty->elements[i]; i++) + { + unsigned short iteration_type = 0; + /* If we have a nested struct, we must find its homogeneous type. + If that fits with our candidate type, we are still + homogeneous. */ + if (ty->elements[i]->type == FFI_TYPE_STRUCT + && ty->elements[i]->elements) + { + iteration_type = get_homogeneous_type (ty->elements[i]); + } + else + { + iteration_type = ty->elements[i]->type; + } + + /* If we are not homogeneous, return FFI_TYPE_STRUCT. */ + if (candidate_type != iteration_type) + return FFI_TYPE_STRUCT; + } + return candidate_type; + } + + /* Base case, we have no more levels of nesting, so we + are a basic type, and so, trivially homogeneous in that type. */ + return ty->type; +} + +/* Determine the number of elements within a STRUCT. + + Note, we must handle nested structs. + + If ty is not a STRUCT this function will return 0. */ + +static unsigned +element_count (ffi_type *ty) +{ + if (ty->type == FFI_TYPE_STRUCT && ty->elements) + { + unsigned n; + unsigned elems = 0; + for (n = 0; ty->elements[n]; n++) + { + if (ty->elements[n]->type == FFI_TYPE_STRUCT + && ty->elements[n]->elements) + elems += element_count (ty->elements[n]); + else + elems++; + } + return elems; + } + return 0; +} + +/* Test for a homogeneous floating point aggregate. + + A homogeneous floating point aggregate is a homogeneous aggregate of + a half- single- or double- precision floating point type with one + to four elements. Note that this includes nested structs of the + basic type. */ + +static int +is_hfa (ffi_type *ty) +{ + if (ty->type == FFI_TYPE_STRUCT + && ty->elements[0] + && is_floating_type (get_homogeneous_type (ty))) + { + unsigned n = element_count (ty); + return n >= 1 && n <= 4; + } + return 0; +} + +/* Test if an ffi_type is a candidate for passing in a register. + + This test does not check that sufficient registers of the + appropriate class are actually available, merely that IFF + sufficient registers are available then the argument will be passed + in register(s). + + Note that an ffi_type that is deemed to be a register candidate + will always be returned in registers. + + Returns 1 if a register candidate else 0. */ + +static int +is_register_candidate (ffi_type *ty) +{ + switch (ty->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + case FFI_TYPE_UINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_UINT64: + case FFI_TYPE_POINTER: + case FFI_TYPE_SINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_SINT32: + case FFI_TYPE_INT: + case FFI_TYPE_SINT64: + return 1; + + case FFI_TYPE_STRUCT: + if (is_hfa (ty)) + { + return 1; + } + else if (ty->size > 16) + { + /* Too large. Will be replaced with a pointer to memory. The + pointer MAY be passed in a register, but the value will + not. This test specifically fails since the argument will + never be passed by value in registers. */ + return 0; + } + else + { + /* Might be passed in registers depending on the number of + registers required. */ + return (ty->size + 7) / 8 < N_X_ARG_REG; + } + break; + + default: + FFI_ASSERT (0); + break; + } + + return 0; +} + +/* Test if an ffi_type argument or result is a candidate for a vector + register. */ + +static int +is_v_register_candidate (ffi_type *ty) +{ + return is_floating_type (ty->type) + || (ty->type == FFI_TYPE_STRUCT && is_hfa (ty)); +} + +/* Representation of the procedure call argument marshalling + state. + + The terse state variable names match the names used in the AARCH64 + PCS. */ + +struct arg_state +{ + unsigned ngrn; /* Next general-purpose register number. */ + unsigned nsrn; /* Next vector register number. */ + unsigned nsaa; /* Next stack offset. */ +}; + +/* Initialize a procedure call argument marshalling state. */ +static void +arg_init (struct arg_state *state, unsigned call_frame_size) +{ + state->ngrn = 0; + state->nsrn = 0; + state->nsaa = 0; +} + +/* Return the number of available consecutive core argument + registers. */ + +static unsigned +available_x (struct arg_state *state) +{ + return N_X_ARG_REG - state->ngrn; +} + +/* Return the number of available consecutive vector argument + registers. */ + +static unsigned +available_v (struct arg_state *state) +{ + return N_V_ARG_REG - state->nsrn; +} + +static void * +allocate_to_x (struct call_context *context, struct arg_state *state) +{ + FFI_ASSERT (state->ngrn < N_X_ARG_REG) + return get_x_addr (context, (state->ngrn)++); +} + +static void * +allocate_to_s (struct call_context *context, struct arg_state *state) +{ + FFI_ASSERT (state->nsrn < N_V_ARG_REG) + return get_s_addr (context, (state->nsrn)++); +} + +static void * +allocate_to_d (struct call_context *context, struct arg_state *state) +{ + FFI_ASSERT (state->nsrn < N_V_ARG_REG) + return get_d_addr (context, (state->nsrn)++); +} + +static void * +allocate_to_v (struct call_context *context, struct arg_state *state) +{ + FFI_ASSERT (state->nsrn < N_V_ARG_REG) + return get_v_addr (context, (state->nsrn)++); +} + +/* Allocate an aligned slot on the stack and return a pointer to it. */ +static void * +allocate_to_stack (struct arg_state *state, void *stack, unsigned alignment, + unsigned size) +{ + void *allocation; + + /* Round up the NSAA to the larger of 8 or the natural + alignment of the argument's type. */ + state->nsaa = ALIGN (state->nsaa, alignment); + state->nsaa = ALIGN (state->nsaa, alignment); + state->nsaa = ALIGN (state->nsaa, 8); + + allocation = stack + state->nsaa; + + state->nsaa += size; + return allocation; +} + +static void +copy_basic_type (void *dest, void *source, unsigned short type) +{ + /* This is neccessary to ensure that basic types are copied + sign extended to 64-bits as libffi expects. */ + switch (type) + { + case FFI_TYPE_FLOAT: + *(float *) dest = *(float *) source; + break; + case FFI_TYPE_DOUBLE: + *(double *) dest = *(double *) source; + break; + case FFI_TYPE_LONGDOUBLE: + *(long double *) dest = *(long double *) source; + break; + case FFI_TYPE_UINT8: + *(ffi_arg *) dest = *(UINT8 *) source; + break; + case FFI_TYPE_SINT8: + *(ffi_sarg *) dest = *(SINT8 *) source; + break; + case FFI_TYPE_UINT16: + *(ffi_arg *) dest = *(UINT16 *) source; + break; + case FFI_TYPE_SINT16: + *(ffi_sarg *) dest = *(SINT16 *) source; + break; + case FFI_TYPE_UINT32: + *(ffi_arg *) dest = *(UINT32 *) source; + break; + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + *(ffi_sarg *) dest = *(SINT32 *) source; + break; + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + *(ffi_arg *) dest = *(UINT64 *) source; + break; + case FFI_TYPE_SINT64: + *(ffi_sarg *) dest = *(SINT64 *) source; + break; + + default: + FFI_ASSERT (0); + } +} + +static void +copy_hfa_to_reg_or_stack (void *memory, + ffi_type *ty, + struct call_context *context, + unsigned char *stack, + struct arg_state *state) +{ + unsigned elems = element_count (ty); + if (available_v (state) < elems) + { + /* There are insufficient V registers. Further V register allocations + are prevented, the NSAA is adjusted (by allocate_to_stack ()) + and the argument is copied to memory at the adjusted NSAA. */ + state->nsrn = N_V_ARG_REG; + memcpy (allocate_to_stack (state, stack, ty->alignment, ty->size), + memory, + ty->size); + } + else + { + int i; + unsigned short type = get_homogeneous_type (ty); + unsigned elems = element_count (ty); + for (i = 0; i < elems; i++) + { + void *reg = allocate_to_v (context, state); + copy_basic_type (reg, memory, type); + memory += get_basic_type_size (type); + } + } +} + +/* Either allocate an appropriate register for the argument type, or if + none are available, allocate a stack slot and return a pointer + to the allocated space. */ + +static void * +allocate_to_register_or_stack (struct call_context *context, + unsigned char *stack, + struct arg_state *state, + unsigned short type) +{ + size_t alignment = get_basic_type_alignment (type); + size_t size = alignment; + switch (type) + { + case FFI_TYPE_FLOAT: + /* This is the only case for which the allocated stack size + should not match the alignment of the type. */ + size = sizeof (UINT32); + /* Fall through. */ + case FFI_TYPE_DOUBLE: + if (state->nsrn < N_V_ARG_REG) + return allocate_to_d (context, state); + state->nsrn = N_V_ARG_REG; + break; + case FFI_TYPE_LONGDOUBLE: + if (state->nsrn < N_V_ARG_REG) + return allocate_to_v (context, state); + state->nsrn = N_V_ARG_REG; + break; + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_INT: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + if (state->ngrn < N_X_ARG_REG) + return allocate_to_x (context, state); + state->ngrn = N_X_ARG_REG; + break; + default: + FFI_ASSERT (0); + } + + return allocate_to_stack (state, stack, alignment, size); +} + +/* Copy a value to an appropriate register, or if none are + available, to the stack. */ + +static void +copy_to_register_or_stack (struct call_context *context, + unsigned char *stack, + struct arg_state *state, + void *value, + unsigned short type) +{ + copy_basic_type ( + allocate_to_register_or_stack (context, stack, state, type), + value, + type); +} + +/* Marshall the arguments from FFI representation to procedure call + context and stack. */ + +static unsigned +aarch64_prep_args (struct call_context *context, unsigned char *stack, + extended_cif *ecif) +{ + int i; + struct arg_state state; + + arg_init (&state, ALIGN(ecif->cif->bytes, 16)); + + for (i = 0; i < ecif->cif->nargs; i++) + { + ffi_type *ty = ecif->cif->arg_types[i]; + switch (ty->type) + { + case FFI_TYPE_VOID: + FFI_ASSERT (0); + break; + + /* If the argument is a basic type the argument is allocated to an + appropriate register, or if none are available, to the stack. */ + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + copy_to_register_or_stack (context, stack, &state, + ecif->avalue[i], ty->type); + break; + + case FFI_TYPE_STRUCT: + if (is_hfa (ty)) + { + copy_hfa_to_reg_or_stack (ecif->avalue[i], ty, context, + stack, &state); + } + else if (ty->size > 16) + { + /* If the argument is a composite type that is larger than 16 + bytes, then the argument has been copied to memory, and + the argument is replaced by a pointer to the copy. */ + + copy_to_register_or_stack (context, stack, &state, + &(ecif->avalue[i]), FFI_TYPE_POINTER); + } + else if (available_x (&state) >= (ty->size + 7) / 8) + { + /* If the argument is a composite type and the size in + double-words is not more than the number of available + X registers, then the argument is copied into consecutive + X registers. */ + int j; + for (j = 0; j < (ty->size + 7) / 8; j++) + { + memcpy (allocate_to_x (context, &state), + &(((UINT64 *) ecif->avalue[i])[j]), + sizeof (UINT64)); + } + } + else + { + /* Otherwise, there are insufficient X registers. Further X + register allocations are prevented, the NSAA is adjusted + (by allocate_to_stack ()) and the argument is copied to + memory at the adjusted NSAA. */ + state.ngrn = N_X_ARG_REG; + + memcpy (allocate_to_stack (&state, stack, ty->alignment, + ty->size), ecif->avalue + i, ty->size); + } + break; + + default: + FFI_ASSERT (0); + break; + } + } + + return ecif->cif->aarch64_flags; +} + +ffi_status +ffi_prep_cif_machdep (ffi_cif *cif) +{ + /* Round the stack up to a multiple of the stack alignment requirement. */ + cif->bytes = + (cif->bytes + (AARCH64_STACK_ALIGN - 1)) & ~ (AARCH64_STACK_ALIGN - 1); + + /* Initialize our flags. We are interested if this CIF will touch a + vector register, if so we will enable context save and load to + those registers, otherwise not. This is intended to be friendly + to lazy float context switching in the kernel. */ + cif->aarch64_flags = 0; + + if (is_v_register_candidate (cif->rtype)) + { + cif->aarch64_flags |= AARCH64_FFI_WITH_V; + } + else + { + int i; + for (i = 0; i < cif->nargs; i++) + if (is_v_register_candidate (cif->arg_types[i])) + { + cif->aarch64_flags |= AARCH64_FFI_WITH_V; + break; + } + } + + return FFI_OK; +} + +/* Call a function with the provided arguments and capture the return + value. */ +void +ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + ecif.rvalue = rvalue; + + switch (cif->abi) + { + case FFI_SYSV: + { + struct call_context context; + unsigned stack_bytes; + + /* Figure out the total amount of stack space we need, the + above call frame space needs to be 16 bytes aligned to + ensure correct alignment of the first object inserted in + that space hence the ALIGN applied to cif->bytes.*/ + stack_bytes = ALIGN(cif->bytes, 16); + + memset (&context, 0, sizeof (context)); + if (is_register_candidate (cif->rtype)) + { + ffi_call_SYSV (aarch64_prep_args, &context, &ecif, stack_bytes, fn); + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_INT: + case FFI_TYPE_SINT64: + { + void *addr = get_basic_type_addr (cif->rtype->type, + &context, 0); + copy_basic_type (rvalue, addr, cif->rtype->type); + break; + } + + case FFI_TYPE_STRUCT: + if (is_hfa (cif->rtype)) + { + int j; + unsigned short type = get_homogeneous_type (cif->rtype); + unsigned elems = element_count (cif->rtype); + for (j = 0; j < elems; j++) + { + void *reg = get_basic_type_addr (type, &context, j); + copy_basic_type (rvalue, reg, type); + rvalue += get_basic_type_size (type); + } + } + else if ((cif->rtype->size + 7) / 8 < N_X_ARG_REG) + { + unsigned size = ALIGN (cif->rtype->size, sizeof (UINT64)); + memcpy (rvalue, get_x_addr (&context, 0), size); + } + else + { + FFI_ASSERT (0); + } + break; + + default: + FFI_ASSERT (0); + break; + } + } + else + { + memcpy (get_x_addr (&context, 8), &rvalue, sizeof (UINT64)); + ffi_call_SYSV (aarch64_prep_args, &context, &ecif, + stack_bytes, fn); + } + break; + } + + default: + FFI_ASSERT (0); + break; + } +} + +static unsigned char trampoline [] = +{ 0x70, 0x00, 0x00, 0x58, /* ldr x16, 1f */ + 0x91, 0x00, 0x00, 0x10, /* adr x17, 2f */ + 0x00, 0x02, 0x1f, 0xd6 /* br x16 */ +}; + +/* Build a trampoline. */ + +#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX,FLAGS) \ + ({unsigned char *__tramp = (unsigned char*)(TRAMP); \ + UINT64 __fun = (UINT64)(FUN); \ + UINT64 __ctx = (UINT64)(CTX); \ + UINT64 __flags = (UINT64)(FLAGS); \ + memcpy (__tramp, trampoline, sizeof (trampoline)); \ + memcpy (__tramp + 12, &__fun, sizeof (__fun)); \ + memcpy (__tramp + 20, &__ctx, sizeof (__ctx)); \ + memcpy (__tramp + 28, &__flags, sizeof (__flags)); \ + __clear_cache(__tramp, __tramp + FFI_TRAMPOLINE_SIZE); \ + }) + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; + + FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_SYSV, codeloc, + cif->aarch64_flags); + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + +/* Primary handler to setup and invoke a function within a closure. + + A closure when invoked enters via the assembler wrapper + ffi_closure_SYSV(). The wrapper allocates a call context on the + stack, saves the interesting registers (from the perspective of + the calling convention) into the context then passes control to + ffi_closure_SYSV_inner() passing the saved context and a pointer to + the stack at the point ffi_closure_SYSV() was invoked. + + On the return path the assembler wrapper will reload call context + regsiters. + + ffi_closure_SYSV_inner() marshalls the call context into ffi value + desriptors, invokes the wrapped function, then marshalls the return + value back into the call context. */ + +void +ffi_closure_SYSV_inner (ffi_closure *closure, struct call_context *context, + void *stack) +{ + ffi_cif *cif = closure->cif; + void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); + void *rvalue = NULL; + int i; + struct arg_state state; + + arg_init (&state, ALIGN(cif->bytes, 16)); + + for (i = 0; i < cif->nargs; i++) + { + ffi_type *ty = cif->arg_types[i]; + + switch (ty->type) + { + case FFI_TYPE_VOID: + FFI_ASSERT (0); + break; + + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_INT: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + avalue[i] = allocate_to_register_or_stack (context, stack, + &state, ty->type); + break; + + case FFI_TYPE_STRUCT: + if (is_hfa (ty)) + { + unsigned n = element_count (ty); + if (available_v (&state) < n) + { + state.nsrn = N_V_ARG_REG; + avalue[i] = allocate_to_stack (&state, stack, ty->alignment, + ty->size); + } + else + { + switch (get_homogeneous_type (ty)) + { + case FFI_TYPE_FLOAT: + { + /* Eeek! We need a pointer to the structure, + however the homogeneous float elements are + being passed in individual S registers, + therefore the structure is not represented as + a contiguous sequence of bytes in our saved + register context. We need to fake up a copy + of the structure layed out in memory + correctly. The fake can be tossed once the + closure function has returned hence alloca() + is sufficient. */ + int j; + UINT32 *p = avalue[i] = alloca (ty->size); + for (j = 0; j < element_count (ty); j++) + memcpy (&p[j], + allocate_to_s (context, &state), + sizeof (*p)); + break; + } + + case FFI_TYPE_DOUBLE: + { + /* Eeek! We need a pointer to the structure, + however the homogeneous float elements are + being passed in individual S registers, + therefore the structure is not represented as + a contiguous sequence of bytes in our saved + register context. We need to fake up a copy + of the structure layed out in memory + correctly. The fake can be tossed once the + closure function has returned hence alloca() + is sufficient. */ + int j; + UINT64 *p = avalue[i] = alloca (ty->size); + for (j = 0; j < element_count (ty); j++) + memcpy (&p[j], + allocate_to_d (context, &state), + sizeof (*p)); + break; + } + + case FFI_TYPE_LONGDOUBLE: + memcpy (&avalue[i], + allocate_to_v (context, &state), + sizeof (*avalue)); + break; + + default: + FFI_ASSERT (0); + break; + } + } + } + else if (ty->size > 16) + { + /* Replace Composite type of size greater than 16 with a + pointer. */ + memcpy (&avalue[i], + allocate_to_register_or_stack (context, stack, + &state, FFI_TYPE_POINTER), + sizeof (avalue[i])); + } + else if (available_x (&state) >= (ty->size + 7) / 8) + { + avalue[i] = get_x_addr (context, state.ngrn); + state.ngrn += (ty->size + 7) / 8; + } + else + { + state.ngrn = N_X_ARG_REG; + + avalue[i] = allocate_to_stack (&state, stack, ty->alignment, + ty->size); + } + break; + + default: + FFI_ASSERT (0); + break; + } + } + + /* Figure out where the return value will be passed, either in + registers or in a memory block allocated by the caller and passed + in x8. */ + + if (is_register_candidate (cif->rtype)) + { + /* Register candidates are *always* returned in registers. */ + + /* Allocate a scratchpad for the return value, we will let the + callee scrible the result into the scratch pad then move the + contents into the appropriate return value location for the + call convention. */ + rvalue = alloca (cif->rtype->size); + (closure->fun) (cif, rvalue, avalue, closure->user_data); + + /* Copy the return value into the call context so that it is returned + as expected to our caller. */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + break; + + case FFI_TYPE_UINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + case FFI_TYPE_SINT64: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + { + void *addr = get_basic_type_addr (cif->rtype->type, context, 0); + copy_basic_type (addr, rvalue, cif->rtype->type); + break; + } + case FFI_TYPE_STRUCT: + if (is_hfa (cif->rtype)) + { + int i; + unsigned short type = get_homogeneous_type (cif->rtype); + unsigned elems = element_count (cif->rtype); + for (i = 0; i < elems; i++) + { + void *reg = get_basic_type_addr (type, context, i); + copy_basic_type (reg, rvalue, type); + rvalue += get_basic_type_size (type); + } + } + else if ((cif->rtype->size + 7) / 8 < N_X_ARG_REG) + { + unsigned size = ALIGN (cif->rtype->size, sizeof (UINT64)) ; + memcpy (get_x_addr (context, 0), rvalue, size); + } + else + { + FFI_ASSERT (0); + } + break; + default: + FFI_ASSERT (0); + break; + } + } + else + { + memcpy (&rvalue, get_x_addr (context, 8), sizeof (UINT64)); + (closure->fun) (cif, rvalue, avalue, closure->user_data); + } +} + diff --git a/Modules/_ctypes/libffi/src/aarch64/ffitarget.h b/Modules/_ctypes/libffi/src/aarch64/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/aarch64/ffitarget.h @@ -0,0 +1,59 @@ +/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi + { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV + } ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 36 +#define FFI_NATIVE_RAW_API 0 + +/* ---- Internal ---- */ + + +#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_flags + +#define AARCH64_FFI_WITH_V_BIT 0 + +#define AARCH64_N_XREG 32 +#define AARCH64_N_VREG 32 +#define AARCH64_CALL_CONTEXT_SIZE (AARCH64_N_XREG * 8 + AARCH64_N_VREG * 16) + +#endif diff --git a/Modules/_ctypes/libffi/src/aarch64/sysv.S b/Modules/_ctypes/libffi/src/aarch64/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/aarch64/sysv.S @@ -0,0 +1,307 @@ +/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#define LIBFFI_ASM +#include +#include + +#define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off +#define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off +#define cfi_restore(reg) .cfi_restore reg +#define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg + + .text + .globl ffi_call_SYSV + .type ffi_call_SYSV, #function + +/* ffi_call_SYSV() + + Create a stack frame, setup an argument context, call the callee + and extract the result. + + The maximum required argument stack size is provided, + ffi_call_SYSV() allocates that stack space then calls the + prepare_fn to populate register context and stack. The + argument passing registers are loaded from the register + context and the callee called, on return the register passing + register are saved back to the context. Our caller will + extract the return value from the final state of the saved + register context. + + Prototype: + + extern unsigned + ffi_call_SYSV (void (*)(struct call_context *context, unsigned char *, + extended_cif *), + struct call_context *context, + extended_cif *, + unsigned required_stack_size, + void (*fn)(void)); + + Therefore on entry we have: + + x0 prepare_fn + x1 &context + x2 &ecif + x3 bytes + x4 fn + + This function uses the following stack frame layout: + + == + saved x30(lr) + x29(fp)-> saved x29(fp) + saved x24 + saved x23 + saved x22 + sp' -> saved x21 + ... + sp -> (constructed callee stack arguments) + == + + Voila! */ + +#define ffi_call_SYSV_FS (8 * 4) + + .cfi_startproc +ffi_call_SYSV: + stp x29, x30, [sp, #-16]! + cfi_adjust_cfa_offset (16) + cfi_rel_offset (x29, 0) + cfi_rel_offset (x30, 8) + + mov x29, sp + cfi_def_cfa_register (x29) + sub sp, sp, #ffi_call_SYSV_FS + + stp x21, x22, [sp, 0] + cfi_rel_offset (x21, 0 - ffi_call_SYSV_FS) + cfi_rel_offset (x22, 8 - ffi_call_SYSV_FS) + + stp x23, x24, [sp, 16] + cfi_rel_offset (x23, 16 - ffi_call_SYSV_FS) + cfi_rel_offset (x24, 24 - ffi_call_SYSV_FS) + + mov x21, x1 + mov x22, x2 + mov x24, x4 + + /* Allocate the stack space for the actual arguments, many + arguments will be passed in registers, but we assume + worst case and allocate sufficient stack for ALL of + the arguments. */ + sub sp, sp, x3 + + /* unsigned (*prepare_fn) (struct call_context *context, + unsigned char *stack, extended_cif *ecif); + */ + mov x23, x0 + mov x0, x1 + mov x1, sp + /* x2 already in place */ + blr x23 + + /* Preserve the flags returned. */ + mov x23, x0 + + /* Figure out if we should touch the vector registers. */ + tbz x23, #AARCH64_FFI_WITH_V_BIT, 1f + + /* Load the vector argument passing registers. */ + ldp q0, q1, [x21, #8*32 + 0] + ldp q2, q3, [x21, #8*32 + 32] + ldp q4, q5, [x21, #8*32 + 64] + ldp q6, q7, [x21, #8*32 + 96] +1: + /* Load the core argument passing registers. */ + ldp x0, x1, [x21, #0] + ldp x2, x3, [x21, #16] + ldp x4, x5, [x21, #32] + ldp x6, x7, [x21, #48] + + /* Don't forget x8 which may be holding the address of a return buffer. + */ + ldr x8, [x21, #8*8] + + blr x24 + + /* Save the core argument passing registers. */ + stp x0, x1, [x21, #0] + stp x2, x3, [x21, #16] + stp x4, x5, [x21, #32] + stp x6, x7, [x21, #48] + + /* Note nothing useful ever comes back in x8! */ + + /* Figure out if we should touch the vector registers. */ + tbz x23, #AARCH64_FFI_WITH_V_BIT, 1f + + /* Save the vector argument passing registers. */ + stp q0, q1, [x21, #8*32 + 0] + stp q2, q3, [x21, #8*32 + 32] + stp q4, q5, [x21, #8*32 + 64] + stp q6, q7, [x21, #8*32 + 96] +1: + /* All done, unwind our stack frame. */ + ldp x21, x22, [x29, # - ffi_call_SYSV_FS] + cfi_restore (x21) + cfi_restore (x22) + + ldp x23, x24, [x29, # - ffi_call_SYSV_FS + 16] + cfi_restore (x23) + cfi_restore (x24) + + mov sp, x29 + cfi_def_cfa_register (sp) + + ldp x29, x30, [sp], #16 + cfi_adjust_cfa_offset (-16) + cfi_restore (x29) + cfi_restore (x30) + + ret + + .cfi_endproc + .size ffi_call_SYSV, .-ffi_call_SYSV + +#define ffi_closure_SYSV_FS (8 * 2 + AARCH64_CALL_CONTEXT_SIZE) + +/* ffi_closure_SYSV + + Closure invocation glue. This is the low level code invoked directly by + the closure trampoline to setup and call a closure. + + On entry x17 points to a struct trampoline_data, x16 has been clobbered + all other registers are preserved. + + We allocate a call context and save the argument passing registers, + then invoked the generic C ffi_closure_SYSV_inner() function to do all + the real work, on return we load the result passing registers back from + the call context. + + On entry + + extern void + ffi_closure_SYSV (struct trampoline_data *); + + struct trampoline_data + { + UINT64 *ffi_closure; + UINT64 flags; + }; + + This function uses the following stack frame layout: + + == + saved x30(lr) + x29(fp)-> saved x29(fp) + saved x22 + saved x21 + ... + sp -> call_context + == + + Voila! */ + + .text + .globl ffi_closure_SYSV + .cfi_startproc +ffi_closure_SYSV: + stp x29, x30, [sp, #-16]! + cfi_adjust_cfa_offset (16) + cfi_rel_offset (x29, 0) + cfi_rel_offset (x30, 8) + + mov x29, sp + + sub sp, sp, #ffi_closure_SYSV_FS + cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) + + stp x21, x22, [x29, #-16] + cfi_rel_offset (x21, 0) + cfi_rel_offset (x22, 8) + + /* Load x21 with &call_context. */ + mov x21, sp + /* Preserve our struct trampoline_data * */ + mov x22, x17 + + /* Save the rest of the argument passing registers. */ + stp x0, x1, [x21, #0] + stp x2, x3, [x21, #16] + stp x4, x5, [x21, #32] + stp x6, x7, [x21, #48] + /* Don't forget we may have been given a result scratch pad address. + */ + str x8, [x21, #64] + + /* Figure out if we should touch the vector registers. */ + ldr x0, [x22, #8] + tbz x0, #AARCH64_FFI_WITH_V_BIT, 1f + + /* Save the argument passing vector registers. */ + stp q0, q1, [x21, #8*32 + 0] + stp q2, q3, [x21, #8*32 + 32] + stp q4, q5, [x21, #8*32 + 64] + stp q6, q7, [x21, #8*32 + 96] +1: + /* Load &ffi_closure.. */ + ldr x0, [x22, #0] + mov x1, x21 + /* Compute the location of the stack at the point that the + trampoline was called. */ + add x2, x29, #16 + + bl ffi_closure_SYSV_inner + + /* Figure out if we should touch the vector registers. */ + ldr x0, [x22, #8] + tbz x0, #AARCH64_FFI_WITH_V_BIT, 1f + + /* Load the result passing vector registers. */ + ldp q0, q1, [x21, #8*32 + 0] + ldp q2, q3, [x21, #8*32 + 32] + ldp q4, q5, [x21, #8*32 + 64] + ldp q6, q7, [x21, #8*32 + 96] +1: + /* Load the result passing core registers. */ + ldp x0, x1, [x21, #0] + ldp x2, x3, [x21, #16] + ldp x4, x5, [x21, #32] + ldp x6, x7, [x21, #48] + /* Note nothing usefull is returned in x8. */ + + /* We are done, unwind our frame. */ + ldp x21, x22, [x29, #-16] + cfi_restore (x21) + cfi_restore (x22) + + mov sp, x29 + cfi_adjust_cfa_offset (-ffi_closure_SYSV_FS) + + ldp x29, x30, [sp], #16 + cfi_adjust_cfa_offset (-16) + cfi_restore (x29) + cfi_restore (x30) + + ret + .cfi_endproc + .size ffi_closure_SYSV, .-ffi_closure_SYSV diff --git a/Modules/_ctypes/libffi/src/bfin/ffi.c b/Modules/_ctypes/libffi/src/bfin/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/bfin/ffi.c @@ -0,0 +1,195 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2012 Alexandre K. I. de Mendonca + + Blackfin Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ +#include +#include + +#include +#include + +/* Maximum number of GPRs available for argument passing. */ +#define MAX_GPRARGS 3 + +/* + * Return types + */ +#define FFIBFIN_RET_VOID 0 +#define FFIBFIN_RET_BYTE 1 +#define FFIBFIN_RET_HALFWORD 2 +#define FFIBFIN_RET_INT64 3 +#define FFIBFIN_RET_INT32 4 + +/*====================================================================*/ +/* PROTOTYPE * + /*====================================================================*/ +void ffi_prep_args(unsigned char *, extended_cif *); + +/*====================================================================*/ +/* Externals */ +/* (Assembly) */ +/*====================================================================*/ + +extern void ffi_call_SYSV(unsigned, extended_cif *, void(*)(unsigned char *, extended_cif *), unsigned, void *, void(*fn)(void)); + +/*====================================================================*/ +/* Implementation */ +/* */ +/*====================================================================*/ + + +/* + * This function calculates the return type (size) based on type. + */ + +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + /* --------------------------------------* + * Return handling * + * --------------------------------------*/ + switch (cif->rtype->type) { + case FFI_TYPE_VOID: + cif->flags = FFIBFIN_RET_VOID; + break; + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + cif->flags = FFIBFIN_RET_HALFWORD; + break; + case FFI_TYPE_UINT8: + cif->flags = FFIBFIN_RET_BYTE; + break; + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_FLOAT: + case FFI_TYPE_POINTER: + case FFI_TYPE_SINT8: + cif->flags = FFIBFIN_RET_INT32; + break; + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_DOUBLE: + cif->flags = FFIBFIN_RET_INT64; + break; + case FFI_TYPE_STRUCT: + if (cif->rtype->size <= 4){ + cif->flags = FFIBFIN_RET_INT32; + }else if (cif->rtype->size == 8){ + cif->flags = FFIBFIN_RET_INT64; + }else{ + //it will return via a hidden pointer in P0 + cif->flags = FFIBFIN_RET_VOID; + } + break; + default: + FFI_ASSERT(0); + break; + } + return FFI_OK; +} + +/* + * This will prepare the arguments and will call the assembly routine + * cif = the call interface + * fn = the function to be called + * rvalue = the return value + * avalue = the arguments + */ +void ffi_call(ffi_cif *cif, void(*fn)(void), void *rvalue, void **avalue) +{ + int ret_type = cif->flags; + extended_cif ecif; + ecif.cif = cif; + ecif.avalue = avalue; + ecif.rvalue = rvalue; + + switch (cif->abi) { + case FFI_SYSV: + ffi_call_SYSV(cif->bytes, &ecif, ffi_prep_args, ret_type, ecif.rvalue, fn); + break; + default: + FFI_ASSERT(0); + break; + } +} + + +/* +* This function prepares the parameters (copies them from the ecif to the stack) +* to call the function (ffi_prep_args is called by the assembly routine in file +* sysv.S, which also calls the actual function) +*/ +void ffi_prep_args(unsigned char *stack, extended_cif *ecif) +{ + register unsigned int i = 0; + void **p_argv; + unsigned char *argp; + ffi_type **p_arg; + argp = stack; + p_argv = ecif->avalue; + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; + (i != 0); + i--, p_arg++) { + size_t z; + z = (*p_arg)->size; + if (z < sizeof(int)) { + z = sizeof(int); + switch ((*p_arg)->type) { + case FFI_TYPE_SINT8: { + signed char v = *(SINT8 *)(* p_argv); + signed int t = v; + *(signed int *) argp = t; + } + break; + case FFI_TYPE_UINT8: { + unsigned char v = *(UINT8 *)(* p_argv); + unsigned int t = v; + *(unsigned int *) argp = t; + } + break; + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int) * (SINT16 *)(* p_argv); + break; + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int) * (UINT16 *)(* p_argv); + break; + case FFI_TYPE_STRUCT: + memcpy(argp, *p_argv, (*p_arg)->size); + break; + default: + FFI_ASSERT(0); + break; + } + } else if (z == sizeof(int)) { + *(unsigned int *) argp = (unsigned int) * (UINT32 *)(* p_argv); + } else { + memcpy(argp, *p_argv, z); + } + p_argv++; + argp += z; + } +} + + + diff --git a/Modules/_ctypes/libffi/src/bfin/ffitarget.h b/Modules/_ctypes/libffi/src/bfin/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/bfin/ffitarget.h @@ -0,0 +1,43 @@ +/* ----------------------------------------------------------------------- + ffitarget.h - Copyright (c) 2012 Alexandre K. I. de Mendonca + + Blackfin Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV +} ffi_abi; +#endif + +#endif + diff --git a/Modules/_ctypes/libffi/src/bfin/sysv.S b/Modules/_ctypes/libffi/src/bfin/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/bfin/sysv.S @@ -0,0 +1,177 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2012 Alexandre K. I. de Mendonca + + Blackfin Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + +.text +.align 4 + + /* + There is a "feature" in the bfin toolchain that it puts a _ before funcion names + that's why the function here it's called _ffi_call_SYSV and not ffi_call_SYSV + */ + .global _ffi_call_SYSV; + .type _ffi_call_SYSV, STT_FUNC; + .func ffi_call_SYSV + + /* + cif->bytes = R0 (fp+8) + &ecif = R1 (fp+12) + ffi_prep_args = R2 (fp+16) + ret_type = stack (fp+20) + ecif.rvalue = stack (fp+24) + fn = stack (fp+28) + got (fp+32) + There is room for improvement here (we can use temporary registers + instead of saving the values in the memory) + REGS: + P5 => Stack pointer (function arguments) + R5 => cif->bytes + R4 => ret->type + + FP-20 = P3 + FP-16 = SP (parameters area) + FP-12 = SP (temp) + FP-08 = function return part 1 [R0] + FP-04 = function return part 2 [R1] + */ + +_ffi_call_SYSV: +.prologue: + LINK 20; + [FP-20] = P3; + [FP+8] = R0; + [FP+12] = R1; + [FP+16] = R2; + +.allocate_stack: + //alocate cif->bytes into the stack + R1 = [FP+8]; + R0 = SP; + R0 = R0 - R1; + R1 = 4; + R0 = R0 - R1; + [FP-12] = SP; + SP = R0; + [FP-16] = SP; + +.call_prep_args: + //get the addr of prep_args + P0 = [P3 + _ffi_prep_args at FUNCDESC_GOT17M4]; + P1 = [P0]; + P3 = [P0+4]; + R0 = [FP-16];//SP (parameter area) + R1 = [FP+12];//ecif + call (P1); + +.call_user_function: + //ajust SP so as to allow the user function access the parameters on the stack + SP = [FP-16]; //point to function parameters + R0 = [SP]; + R1 = [SP+4]; + R2 = [SP+8]; + //load user function address + P0 = FP; + P0 +=28; + P1 = [P0]; + P1 = [P1]; + P3 = [P0+4]; + /* + For functions returning aggregate values (struct) occupying more than 8 bytes, + the caller allocates the return value object on the stack and the address + of this object is passed to the callee as a hidden argument in register P0. + */ + P0 = [FP+24]; + + call (P1); + SP = [FP-12]; +.compute_return: + P2 = [FP-20]; + [FP-8] = R0; + [FP-4] = R1; + + R0 = [FP+20]; + R1 = R0 << 2; + + R0 = [P2+.rettable at GOT17M4]; + R0 = R1 + R0; + P2 = R0; + R1 = [P2]; + + P2 = [FP+-20]; + R0 = [P2+.rettable at GOT17M4]; + R0 = R1 + R0; + P2 = R0; + R0 = [FP-8]; + R1 = [FP-4]; + jump (P2); + +/* +#define FFIBFIN_RET_VOID 0 +#define FFIBFIN_RET_BYTE 1 +#define FFIBFIN_RET_HALFWORD 2 +#define FFIBFIN_RET_INT64 3 +#define FFIBFIN_RET_INT32 4 +*/ +.align 4 +.align 4 +.rettable: + .dd .epilogue - .rettable + .dd .rbyte - .rettable; + .dd .rhalfword - .rettable; + .dd .rint64 - .rettable; + .dd .rint32 - .rettable; + +.rbyte: + P0 = [FP+24]; + R0 = R0.B (Z); + [P0] = R0; + JUMP .epilogue +.rhalfword: + P0 = [FP+24]; + R0 = R0.L; + [P0] = R0; + JUMP .epilogue +.rint64: + P0 = [FP+24];// &rvalue + [P0] = R0; + [P0+4] = R1; + JUMP .epilogue +.rint32: + P0 = [FP+24]; + [P0] = R0; +.epilogue: + R0 = [FP+8]; + R1 = [FP+12]; + R2 = [FP+16]; + P3 = [FP-20]; + UNLINK; + RTS; + +.size _ffi_call_SYSV,.-_ffi_call_SYSV; +.endfunc diff --git a/Modules/_ctypes/libffi/src/closures.c b/Modules/_ctypes/libffi/src/closures.c --- a/Modules/_ctypes/libffi/src/closures.c +++ b/Modules/_ctypes/libffi/src/closures.c @@ -172,6 +172,25 @@ #endif /* !FFI_MMAP_EXEC_SELINUX */ +/* On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. */ +#ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX +#include + +static int emutramp_enabled = -1; + +static int +emutramp_enabled_check (void) +{ + if (getenv ("FFI_DISABLE_EMUTRAMP") == NULL) + return 1; + else + return 0; +} + +#define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \ + : (emutramp_enabled = emutramp_enabled_check ())) +#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */ + #elif defined (__CYGWIN__) || defined(__INTERIX) #include @@ -181,6 +200,10 @@ #endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */ +#ifndef FFI_MMAP_EXEC_EMUTRAMP_PAX +#define is_emutramp_enabled() 0 +#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */ + /* Declare all functions defined in dlmalloc.c as static. */ static void *dlmalloc(size_t); static void dlfree(void*); @@ -458,6 +481,12 @@ printf ("mapping in %zi\n", length); #endif + if (execfd == -1 && is_emutramp_enabled ()) + { + ptr = mmap (start, length, prot & ~PROT_EXEC, flags, fd, offset); + return ptr; + } + if (execfd == -1 && !is_selinux_enabled ()) { ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset); diff --git a/Modules/_ctypes/libffi/src/dlmalloc.c b/Modules/_ctypes/libffi/src/dlmalloc.c --- a/Modules/_ctypes/libffi/src/dlmalloc.c +++ b/Modules/_ctypes/libffi/src/dlmalloc.c @@ -100,7 +100,7 @@ If you don't like either of these options, you can define CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything - else. And if you are sure that your program using malloc has + else. And if if you are sure that your program using malloc has no errors or vulnerabilities, you can define INSECURE to 1, which might (or might not) provide a small performance improvement. @@ -607,7 +607,7 @@ declaration needed is the mallinfo struct that is returned (by-copy) by mallinfo(). The malloinfo struct contains a bunch of fields that are not even meaningful in this version of malloc. These fields are - instead filled by mallinfo() with other numbers that might be of + are instead filled by mallinfo() with other numbers that might be of interest. HAVE_USR_INCLUDE_MALLOC_H should be set if you have a @@ -1621,7 +1621,7 @@ Each freshly allocated chunk must have both cinuse and pinuse set. That is, each allocated chunk borders either a previously allocated and still in-use chunk, or the base of its memory arena. This is - ensured by making all allocations from the `lowest' part of any + ensured by making all allocations from the the `lowest' part of any found chunk. Further, no free chunk physically borders another one, so each free chunk is known to be preceded and followed by either inuse chunks or the ends of memory. @@ -1827,12 +1827,12 @@ of the same size are arranged in a circularly-linked list, with only the oldest chunk (the next to be used, in our FIFO ordering) actually in the tree. (Tree members are distinguished by a non-null - parent pointer.) If a chunk with the same size as an existing node + parent pointer.) If a chunk with the same size an an existing node is inserted, it is linked off the existing node using pointers that work in the same way as fd/bk pointers of small chunks. Each tree contains a power of 2 sized range of chunk sizes (the - smallest is 0x100 <= x < 0x180), which is divided in half at each + smallest is 0x100 <= x < 0x180), which is is divided in half at each tree level, with the chunks in the smaller half of the range (0x100 <= x < 0x140 for the top nose) in the left subtree and the larger half (0x140 <= x < 0x180) in the right subtree. This is, of course, @@ -3442,7 +3442,7 @@ least-preferred order): 1. A call to MORECORE that can normally contiguously extend memory. (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or - main space is mmapped or a previous contiguous call failed) + or main space is mmapped or a previous contiguous call failed) 2. A call to MMAP new space (disabled if not HAVE_MMAP). Note that under the default settings, if MORECORE is unable to fulfill a request, and HAVE_MMAP is true, then mmap is diff --git a/Modules/_ctypes/libffi/src/ia64/ffi.c b/Modules/_ctypes/libffi/src/ia64/ffi.c --- a/Modules/_ctypes/libffi/src/ia64/ffi.c +++ b/Modules/_ctypes/libffi/src/ia64/ffi.c @@ -85,7 +85,7 @@ #define ldf_fill(result, addr) \ asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr)); -/* Return the size of the C type associated with TYPE, which will +/* Return the size of the C type associated with with TYPE. Which will be one of the FFI_IA64_TYPE_HFA_* values. */ static size_t @@ -185,7 +185,7 @@ break; case FFI_TYPE_LONGDOUBLE: - /* Similarly, except that HFA is true for double extended, + /* Similarly, except that that HFA is true for double extended, but not quad precision. Both have sizeof == 16, so tell the difference based on the precision. */ if (LDBL_MANT_DIG == 64 && nested) diff --git a/Modules/_ctypes/libffi/src/m68k/ffi.c b/Modules/_ctypes/libffi/src/m68k/ffi.c --- a/Modules/_ctypes/libffi/src/m68k/ffi.c +++ b/Modules/_ctypes/libffi/src/m68k/ffi.c @@ -123,6 +123,8 @@ #define CIF_FLAGS_POINTER 32 #define CIF_FLAGS_STRUCT1 64 #define CIF_FLAGS_STRUCT2 128 +#define CIF_FLAGS_SINT8 256 +#define CIF_FLAGS_SINT16 512 /* Perform machine dependent cif processing */ ffi_status @@ -200,6 +202,14 @@ cif->flags = CIF_FLAGS_DINT; break; + case FFI_TYPE_SINT16: + cif->flags = CIF_FLAGS_SINT16; + break; + + case FFI_TYPE_SINT8: + cif->flags = CIF_FLAGS_SINT8; + break; + default: cif->flags = CIF_FLAGS_INT; break; diff --git a/Modules/_ctypes/libffi/src/metag/ffi.c b/Modules/_ctypes/libffi/src/metag/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/metag/ffi.c @@ -0,0 +1,330 @@ +/* ---------------------------------------------------------------------- + ffi.c - Copyright (c) 2013 Imagination Technologies + + Meta Foreign Function Interface + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + `Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED `AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +----------------------------------------------------------------------- */ + +#include +#include + +#include + +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) + +/* + * ffi_prep_args is called by the assembly routine once stack space has been + * allocated for the function's arguments + */ + +unsigned int ffi_prep_args(char *stack, extended_cif *ecif) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + + /* Store return value */ + if ( ecif->cif->flags == FFI_TYPE_STRUCT ) { + argp -= 4; + *(void **) argp = ecif->rvalue; + } + + p_argv = ecif->avalue; + + /* point to next location */ + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++, p_argv++) + { + size_t z; + + /* Move argp to address of argument */ + z = (*p_arg)->size; + argp -= z; + + /* Align if necessary */ + argp = (char *) ALIGN_DOWN(ALIGN_DOWN(argp, (*p_arg)->alignment), 4); + + if (z < sizeof(int)) { + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); + break; + case FFI_TYPE_UINT8: + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); + break; + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); + break; + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); + case FFI_TYPE_STRUCT: + memcpy(argp, *p_argv, (*p_arg)->size); + break; + default: + FFI_ASSERT(0); + } + } else if ( z == sizeof(int)) { + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + } else { + memcpy(argp, *p_argv, z); + } + } + + /* return the size of the arguments to be passed in registers, + padded to an 8 byte boundary to preserve stack alignment */ + return ALIGN(MIN(stack - argp, 6*4), 8); +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + ffi_type **ptr; + unsigned i, bytes = 0; + + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { + if ((*ptr)->size == 0) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the argument type, do this + check after the initialization. */ + FFI_ASSERT_VALID_TYPE(*ptr); + + /* Add any padding if necessary */ + if (((*ptr)->alignment - 1) & bytes) + bytes = ALIGN(bytes, (*ptr)->alignment); + + bytes += ALIGN((*ptr)->size, 4); + } + + /* Ensure arg space is aligned to an 8-byte boundary */ + bytes = ALIGN(bytes, 8); + + /* Make space for the return structure pointer */ + if (cif->rtype->type == FFI_TYPE_STRUCT) { + bytes += sizeof(void*); + + /* Ensure stack is aligned to an 8-byte boundary */ + bytes = ALIGN(bytes, 8); + } + + cif->bytes = bytes; + + /* Set the return type flag */ + switch (cif->rtype->type) { + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + cif->flags = (unsigned) cif->rtype->type; + break; + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + cif->flags = (unsigned) FFI_TYPE_SINT64; + break; + case FFI_TYPE_STRUCT: + /* Meta can store return values which are <= 64 bits */ + if (cif->rtype->size <= 4) + /* Returned to D0Re0 as 32-bit value */ + cif->flags = (unsigned)FFI_TYPE_INT; + else if ((cif->rtype->size > 4) && (cif->rtype->size <= 8)) + /* Returned valued is stored to D1Re0|R0Re0 */ + cif->flags = (unsigned)FFI_TYPE_DOUBLE; + else + /* value stored in memory */ + cif->flags = (unsigned)FFI_TYPE_STRUCT; + break; + default: + cif->flags = (unsigned)FFI_TYPE_INT; + break; + } + return FFI_OK; +} + +extern void ffi_call_SYSV(void (*fn)(void), extended_cif *, unsigned, unsigned, double *); + +/* + * Exported in API. Entry point + * cif -> ffi_cif object + * fn -> function pointer + * rvalue -> pointer to return value + * avalue -> vector of void * pointers pointing to memory locations holding the + * arguments + */ +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + int small_struct = (((cif->flags == FFI_TYPE_INT) || (cif->flags == FFI_TYPE_DOUBLE)) && (cif->rtype->type == FFI_TYPE_STRUCT)); + ecif.cif = cif; + ecif.avalue = avalue; + + double temp; + + /* + * If the return value is a struct and we don't have a return value address + * then we need to make one + */ + + if ((rvalue == NULL ) && (cif->flags == FFI_TYPE_STRUCT)) + ecif.rvalue = alloca(cif->rtype->size); + else if (small_struct) + ecif.rvalue = &temp; + else + ecif.rvalue = rvalue; + + switch (cif->abi) { + case FFI_SYSV: + ffi_call_SYSV(fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); + break; + default: + FFI_ASSERT(0); + break; + } + + if (small_struct) + memcpy (rvalue, &temp, cif->rtype->size); +} + +/* private members */ + +static void ffi_prep_incoming_args_SYSV (char *, void **, void **, + ffi_cif*, float *); + +void ffi_closure_SYSV (ffi_closure *); + +/* Do NOT change that without changing the FFI_TRAMPOLINE_SIZE */ +extern unsigned int ffi_metag_trampoline[10]; /* 10 instructions */ + +/* end of private members */ + +/* + * __tramp: trampoline memory location + * __fun: assembly routine + * __ctx: memory location for wrapper + * + * At this point, tramp[0] == __ctx ! + */ +void ffi_init_trampoline(unsigned char *__tramp, unsigned int __fun, unsigned int __ctx) { + memcpy (__tramp, ffi_metag_trampoline, sizeof(ffi_metag_trampoline)); + *(unsigned int*) &__tramp[40] = __ctx; + *(unsigned int*) &__tramp[44] = __fun; + /* This will flush the instruction cache */ + __builtin_meta2_cachewd(&__tramp[0], 1); + __builtin_meta2_cachewd(&__tramp[47], 1); +} + + + +/* the cif must already be prepared */ + +ffi_status +ffi_prep_closure_loc (ffi_closure *closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + void (*closure_func)(ffi_closure*) = NULL; + + if (cif->abi == FFI_SYSV) + closure_func = &ffi_closure_SYSV; + else + return FFI_BAD_ABI; + + ffi_init_trampoline( + (unsigned char*)&closure->tramp[0], + (unsigned int)closure_func, + (unsigned int)codeloc); + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + + +/* This function is jumped to by the trampoline */ +unsigned int ffi_closure_SYSV_inner (closure, respp, args, vfp_args) + ffi_closure *closure; + void **respp; + void *args; + void *vfp_args; +{ + ffi_cif *cif; + void **arg_area; + + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + + /* + * This call will initialize ARG_AREA, such that each + * element in that array points to the corresponding + * value on the stack; and if the function returns + * a structure, it will re-set RESP to point to the + * structure return address. + */ + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif, vfp_args); + + (closure->fun) ( cif, *respp, arg_area, closure->user_data); + + return cif->flags; +} + +static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, + void **avalue, ffi_cif *cif, + float *vfp_stack) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + /* stack points to original arguments */ + argp = stack; + + /* Store return value */ + if ( cif->flags == FFI_TYPE_STRUCT ) { + argp -= 4; + *rvalue = *(void **) argp; + } + + p_argv = avalue; + + for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { + size_t z; + size_t alignment; + + alignment = (*p_arg)->alignment; + if (alignment < 4) + alignment = 4; + if ((alignment - 1) & (unsigned)argp) + argp = (char *) ALIGN(argp, alignment); + + z = (*p_arg)->size; + *p_argv = (void*) argp; + p_argv++; + argp -= z; + } + return; +} diff --git a/Modules/_ctypes/libffi/src/metag/ffitarget.h b/Modules/_ctypes/libffi/src/metag/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/metag/ffitarget.h @@ -0,0 +1,53 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2013 Imagination Technologies Ltd. + Target configuration macros for Meta + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_DEFAULT_ABI = FFI_SYSV, + FFI_LAST_ABI = FFI_DEFAULT_ABI + 1, +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 48 +#define FFI_NATIVE_RAW_API 0 + +#endif + diff --git a/Modules/_ctypes/libffi/src/metag/sysv.S b/Modules/_ctypes/libffi/src/metag/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/metag/sysv.S @@ -0,0 +1,311 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2013 Imagination Technologies Ltd. + + Meta Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include +#ifdef HAVE_MACHINE_ASM_H +#include +#else +#ifdef __USER_LABEL_PREFIX__ +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b + +/* Use the right prefix for global labels. */ +#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x) +#else +#define CNAME(x) x +#endif +#define ENTRY(x) .globl CNAME(x); .type CNAME(x), %function; CNAME(x): +#endif + +#ifdef __ELF__ +#define LSYM(x) .x +#else +#define LSYM(x) x +#endif + +.macro call_reg x= + .text + .balign 4 + mov D1RtP, \x + swap D1RtP, PC +.endm + +! Save register arguments +.macro SAVE_ARGS + .text + .balign 4 + setl [A0StP++], D0Ar6, D1Ar5 + setl [A0StP++], D0Ar4, D1Ar3 + setl [A0StP++], D0Ar2, D1Ar1 +.endm + +! Save retrun, frame pointer and other regs +.macro SAVE_REGS regs= + .text + .balign 4 + setl [A0StP++], D0FrT, D1RtP + ! Needs to be a pair of regs + .ifnc "\regs","" + setl [A0StP++], \regs + .endif +.endm + +! Declare a global function +.macro METAG_FUNC_START name + .text + .balign 4 + ENTRY(\name) +.endm + +! Return registers from the stack. Reverse SAVE_REGS operation +.macro RET_REGS regs=, cond= + .ifnc "\regs", "" + getl \regs, [--A0StP] + .endif + getl D0FrT, D1RtP, [--A0StP] +.endm + +! Return arguments +.macro RET_ARGS + getl D0Ar2, D1Ar1, [--A0StP] + getl D0Ar4, D1Ar3, [--A0StP] + getl D0Ar6, D1Ar5, [--A0StP] +.endm + + + ! D1Ar1: fn + ! D0Ar2: &ecif + ! D1Ar3: cif->bytes + ! D0Ar4: fig->flags + ! D1Ar5: ecif.rvalue + + ! This assumes we are using GNU as +METAG_FUNC_START ffi_call_SYSV + ! Save argument registers + + SAVE_ARGS + + ! new frame + mov D0FrT, A0FrP + add A0FrP, A0StP, #0 + + ! Preserve the old frame pointer + SAVE_REGS "D1.5, D0.5" + + ! Make room for new args. cifs->bytes is the total space for input + ! and return arguments + + add A0StP, A0StP, D1Ar3 + + ! Preserve cifs->bytes & fn + mov D0.5, D1Ar3 + mov D1.5, D1Ar1 + + ! Place all of the ffi_prep_args in position + mov D1Ar1, A0StP + + ! Call ffi_prep_args(stack, &ecif) +#ifdef __PIC__ + callr D1RtP, CNAME(ffi_prep_args at PLT) +#else + callr D1RtP, CNAME(ffi_prep_args) +#endif + + ! Restore fn pointer + + ! The foreign stack should look like this + ! XXXXX XXXXXX <--- stack pointer + ! FnArgN rvalue + ! FnArgN+2 FnArgN+1 + ! FnArgN+4 FnArgN+3 + ! .... + ! + + ! A0StP now points to the first (or return) argument + 4 + + ! Preserve cif->bytes + getl D0Ar2, D1Ar1, [--A0StP] + getl D0Ar4, D1Ar3, [--A0StP] + getl D0Ar6, D1Ar5, [--A0StP] + + ! Place A0StP to the first argument again + add A0StP, A0StP, #24 ! That's because we loaded 6 regs x 4 byte each + + ! A0FrP points to the initial stack without the reserved space for the + ! cifs->bytes, whilst A0StP points to the stack after the space allocation + + ! fn was the first argument of ffi_call_SYSV. + ! The stack at this point looks like this: + ! + ! A0StP(on entry to _SYSV) -> Arg6 Arg5 | low + ! Arg4 Arg3 | + ! Arg2 Arg1 | + ! A0FrP ----> D0FrtP D1RtP | + ! D1.5 D0.5 | + ! A0StP(bf prep_args) -> FnArgn FnArgn-1 | + ! FnArgn-2FnArgn-3 | + ! ................ | <= cifs->bytes + ! FnArg4 FnArg3 | + ! A0StP (prv_A0StP+cifs->bytes) FnArg2 FnArg1 | high + ! + ! fn was in Arg1 so it's located in in A0FrP+#-0xC + ! + + ! D0Re0 contains the size of arguments stored in registers + sub A0StP, A0StP, D0Re0 + + ! Arg1 is the function pointer for the foreign call. This has been + ! preserved in D1.5 + + ! Time to call (fn). Arguments should be like this: + ! Arg1-Arg6 are loaded to regs + ! The rest of the arguments are stored in stack pointed by A0StP + + call_reg D1.5 + + ! Reset stack. + + mov A0StP, A0FrP + + ! Load Arg1 with the pointer to storage for the return type + ! This was stored in Arg5 + + getd D1Ar1, [A0FrP+#-20] + + ! Load D0Ar2 with the return type code. This was stored in Arg4 (flags) + + getd D0Ar2, [A0FrP+#-16] + + ! We are ready to start processing the return value + ! D0Re0 (and D1Re0) hold the return value + + ! If the return value is NULL, assume no return value + cmp D1Ar1, #0 + beq LSYM(Lepilogue) + + ! return INT + cmp D0Ar2, #FFI_TYPE_INT + ! Sadly, there is no setd{cc} instruction so we need to workaround that + bne .INT64 + setd [D1Ar1], D0Re0 + b LSYM(Lepilogue) + + ! return INT64 +.INT64: + cmp D0Ar2, #FFI_TYPE_SINT64 + setleq [D1Ar1], D0Re0, D1Re0 + + ! return DOUBLE + cmp D0Ar2, #FFI_TYPE_DOUBLE + setl [D1AR1++], D0Re0, D1Re0 + +LSYM(Lepilogue): + ! At this point, the stack pointer points right after the argument + ! saved area. We need to restore 4 regs, therefore we need to move + ! 16 bytes ahead. + add A0StP, A0StP, #16 + RET_REGS "D1.5, D0.5" + RET_ARGS + getd D0Re0, [A0StP] + mov A0FrP, D0FrT + swap D1RtP, PC + +.ffi_call_SYSV_end: + .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) + + +/* + (called by ffi_metag_trampoline) + void ffi_closure_SYSV (ffi_closure*) + + (called by ffi_closure_SYSV) + unsigned int FFI_HIDDEN + ffi_closure_SYSV_inner (closure,respp, args) + ffi_closure *closure; + void **respp; + void *args; +*/ + +METAG_FUNC_START ffi_closure_SYSV + ! We assume that D1Ar1 holds the address of the + ! ffi_closure struct. We will use that to fetch the + ! arguments. The stack pointer points to an empty space + ! and it is ready to store more data. + + ! D1Ar1 is ready + ! Allocate stack space for return value + add A0StP, A0StP, #8 + ! Store it to D0Ar2 + sub D0Ar2, A0StP, #8 + + sub D1Ar3, A0FrP, #4 + + ! D1Ar3 contains the address of the original D1Ar1 argument + ! We need to subtract #4 later on + + ! Preverve D0Ar2 + mov D0.5, D0Ar2 + +#ifdef __PIC__ + callr D1RtP, CNAME(ffi_closure_SYSV_inner at PLT) +#else + callr D1RtP, CNAME(ffi_closure_SYSV_inner) +#endif + + ! Check the return value and store it to D0.5 + cmp D0Re0, #FFI_TYPE_INT + beq .Lretint + cmp D0Re0, #FFI_TYPE_DOUBLE + beq .Lretdouble +.Lclosure_epilogue: + sub A0StP, A0StP, #8 + RET_REGS "D1.5, D0.5" + RET_ARGS + swap D1RtP, PC + +.Lretint: + setd [D0.5], D0Re0 + b .Lclosure_epilogue +.Lretdouble: + setl [D0.5++], D0Re0, D1Re0 + b .Lclosure_epilogue +.ffi_closure_SYSV_end: +.size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) + + +ENTRY(ffi_metag_trampoline) + SAVE_ARGS + ! New frame + mov A0FrP, A0StP + SAVE_REGS "D1.5, D0.5" + mov D0.5, PC + ! Load D1Ar1 the value of ffi_metag_trampoline + getd D1Ar1, [D0.5 + #8] + ! Jump to ffi_closure_SYSV + getd PC, [D0.5 + #12] diff --git a/Modules/_ctypes/libffi/src/microblaze/ffi.c b/Modules/_ctypes/libffi/src/microblaze/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/microblaze/ffi.c @@ -0,0 +1,321 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2012, 2013 Xilinx, Inc + + MicroBlaze Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +extern void ffi_call_SYSV(void (*)(void*, extended_cif*), extended_cif*, + unsigned int, unsigned int, unsigned int*, void (*fn)(void), + unsigned int, unsigned int); + +extern void ffi_closure_SYSV(void); + +#define WORD_SIZE sizeof(unsigned int) +#define ARGS_REGISTER_SIZE (WORD_SIZE * 6) +#define WORD_ALIGN(x) ALIGN(x, WORD_SIZE) + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ +void ffi_prep_args(void* stack, extended_cif* ecif) +{ + unsigned int i; + ffi_type** p_arg; + void** p_argv; + void* stack_args_p = stack; + + p_argv = ecif->avalue; + + if (ecif == NULL || ecif->cif == NULL) { + return; /* no description to prepare */ + } + + if ((ecif->cif->rtype != NULL) && + (ecif->cif->rtype->type == FFI_TYPE_STRUCT)) + { + /* if return type is a struct which is referenced on the stack/reg5, + * by a pointer. Stored the return value pointer in r5. + */ + char* addr = stack_args_p; + memcpy(addr, &(ecif->rvalue), WORD_SIZE); + stack_args_p += WORD_SIZE; + } + + if (ecif->avalue == NULL) { + return; /* no arguments to prepare */ + } + + for (i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; + i++, p_arg++) + { + size_t size = (*p_arg)->size; + int type = (*p_arg)->type; + void* value = p_argv[i]; + char* addr = stack_args_p; + int aligned_size = WORD_ALIGN(size); + + /* force word alignment on the stack */ + stack_args_p += aligned_size; + + switch (type) + { + case FFI_TYPE_UINT8: + *(unsigned int *)addr = (unsigned int)*(UINT8*)(value); + break; + case FFI_TYPE_SINT8: + *(signed int *)addr = (signed int)*(SINT8*)(value); + break; + case FFI_TYPE_UINT16: + *(unsigned int *)addr = (unsigned int)*(UINT16*)(value); + break; + case FFI_TYPE_SINT16: + *(signed int *)addr = (signed int)*(SINT16*)(value); + break; + case FFI_TYPE_STRUCT: +#if __BIG_ENDIAN__ + /* + * MicroBlaze toolchain appears to emit: + * bsrli r5, r5, 8 (caller) + * ... + * + * ... + * bslli r5, r5, 8 (callee) + * + * For structs like "struct a { uint8_t a[3]; };", when passed + * by value. + * + * Structs like "struct b { uint16_t a; };" are also expected + * to be packed strangely in registers. + * + * This appears to be because the microblaze toolchain expects + * "struct b == uint16_t", which is only any issue for big + * endian. + * + * The following is a work around for big-endian only, for the + * above mentioned case, it will re-align the contents of a + * <= 3-byte struct value. + */ + if (size < WORD_SIZE) + { + memcpy (addr + (WORD_SIZE - size), value, size); + break; + } +#endif + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + case FFI_TYPE_FLOAT: + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_DOUBLE: + default: + memcpy(addr, value, aligned_size); + } + } +} + +ffi_status ffi_prep_cif_machdep(ffi_cif* cif) +{ + /* check ABI */ + switch (cif->abi) + { + case FFI_SYSV: + break; + default: + return FFI_BAD_ABI; + } + return FFI_OK; +} + +void ffi_call(ffi_cif* cif, void (*fn)(void), void* rvalue, void** avalue) +{ + extended_cif ecif; + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { + ecif.rvalue = alloca(cif->rtype->size); + } else { + ecif.rvalue = rvalue; + } + + switch (cif->abi) + { + case FFI_SYSV: + ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, + ecif.rvalue, fn, cif->rtype->type, cif->rtype->size); + break; + default: + FFI_ASSERT(0); + break; + } +} + +void ffi_closure_call_SYSV(void* register_args, void* stack_args, + ffi_closure* closure, void* rvalue, + unsigned int* rtype, unsigned int* rsize) +{ + /* prepare arguments for closure call */ + ffi_cif* cif = closure->cif; + ffi_type** arg_types = cif->arg_types; + + /* re-allocate data for the args. This needs to be done in order to keep + * multi-word objects (e.g. structs) in contigious memory. Callers are not + * required to store the value of args in the lower 6 words in the stack + * (although they are allocated in the stack). + */ + char* stackclone = alloca(cif->bytes); + void** avalue = alloca(cif->nargs * sizeof(void*)); + void* struct_rvalue = NULL; + char* ptr = stackclone; + int i; + + /* copy registers into stack clone */ + int registers_used = cif->bytes; + if (registers_used > ARGS_REGISTER_SIZE) { + registers_used = ARGS_REGISTER_SIZE; + } + memcpy(stackclone, register_args, registers_used); + + /* copy stack allocated args into stack clone */ + if (cif->bytes > ARGS_REGISTER_SIZE) { + int stack_used = cif->bytes - ARGS_REGISTER_SIZE; + memcpy(stackclone + ARGS_REGISTER_SIZE, stack_args, stack_used); + } + + /* preserve struct type return pointer passing */ + if ((cif->rtype != NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { + struct_rvalue = *((void**)ptr); + ptr += WORD_SIZE; + } + + /* populate arg pointer list */ + for (i = 0; i < cif->nargs; i++) + { + switch (arg_types[i]->type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: +#ifdef __BIG_ENDIAN__ + avalue[i] = ptr + 3; +#else + avalue[i] = ptr; +#endif + break; + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: +#ifdef __BIG_ENDIAN__ + avalue[i] = ptr + 2; +#else + avalue[i] = ptr; +#endif + break; + case FFI_TYPE_STRUCT: +#if __BIG_ENDIAN__ + /* + * Work around strange ABI behaviour. + * (see info in ffi_prep_args) + */ + if (arg_types[i]->size < WORD_SIZE) + { + memcpy (ptr, ptr + (WORD_SIZE - arg_types[i]->size), arg_types[i]->size); + } +#endif + avalue[i] = (void*)ptr; + break; + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_DOUBLE: + avalue[i] = ptr; + break; + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + case FFI_TYPE_FLOAT: + default: + /* default 4-byte argument */ + avalue[i] = ptr; + break; + } + ptr += WORD_ALIGN(arg_types[i]->size); + } + + /* set the return type info passed back to the wrapper */ + *rsize = cif->rtype->size; + *rtype = cif->rtype->type; + if (struct_rvalue != NULL) { + closure->fun(cif, struct_rvalue, avalue, closure->user_data); + /* copy struct return pointer value into function return value */ + *((void**)rvalue) = struct_rvalue; + } else { + closure->fun(cif, rvalue, avalue, closure->user_data); + } +} + +ffi_status ffi_prep_closure_loc( + ffi_closure* closure, ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void* user_data, void* codeloc) +{ + unsigned long* tramp = (unsigned long*)&(closure->tramp[0]); + unsigned long cls = (unsigned long)codeloc; + unsigned long fn = 0; + unsigned long fn_closure_call_sysv = (unsigned long)ffi_closure_call_SYSV; + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + switch (cif->abi) + { + case FFI_SYSV: + fn = (unsigned long)ffi_closure_SYSV; + + /* load r11 (temp) with fn */ + /* imm fn(upper) */ + tramp[0] = 0xb0000000 | ((fn >> 16) & 0xffff); + /* addik r11, r0, fn(lower) */ + tramp[1] = 0x31600000 | (fn & 0xffff); + + /* load r12 (temp) with cls */ + /* imm cls(upper) */ + tramp[2] = 0xb0000000 | ((cls >> 16) & 0xffff); + /* addik r12, r0, cls(lower) */ + tramp[3] = 0x31800000 | (cls & 0xffff); + + /* load r3 (temp) with ffi_closure_call_SYSV */ + /* imm fn_closure_call_sysv(upper) */ + tramp[4] = 0xb0000000 | ((fn_closure_call_sysv >> 16) & 0xffff); + /* addik r3, r0, fn_closure_call_sysv(lower) */ + tramp[5] = 0x30600000 | (fn_closure_call_sysv & 0xffff); + /* branch/jump to address stored in r11 (fn) */ + tramp[6] = 0x98085800; /* bra r11 */ + + break; + default: + return FFI_BAD_ABI; + } + return FFI_OK; +} diff --git a/Modules/_ctypes/libffi/src/microblaze/ffitarget.h b/Modules/_ctypes/libffi/src/microblaze/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/microblaze/ffitarget.h @@ -0,0 +1,53 @@ +/* ----------------------------------------------------------------------- + ffitarget.h - Copyright (c) 2012, 2013 Xilinx, Inc + + Target configuration macros for MicroBlaze. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV +} ffi_abi; +#endif + +/* Definitions for closures */ + +#define FFI_CLOSURES 1 +#define FFI_NATIVE_RAW_API 0 + +#define FFI_TRAMPOLINE_SIZE (4*8) + +#endif diff --git a/Modules/_ctypes/libffi/src/microblaze/sysv.S b/Modules/_ctypes/libffi/src/microblaze/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/microblaze/sysv.S @@ -0,0 +1,302 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2012, 2013 Xilinx, Inc + + MicroBlaze Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + + /* + * arg[0] (r5) = ffi_prep_args, + * arg[1] (r6) = &ecif, + * arg[2] (r7) = cif->bytes, + * arg[3] (r8) = cif->flags, + * arg[4] (r9) = ecif.rvalue, + * arg[5] (r10) = fn + * arg[6] (sp[0]) = cif->rtype->type + * arg[7] (sp[4]) = cif->rtype->size + */ + .text + .globl ffi_call_SYSV + .type ffi_call_SYSV, @function +ffi_call_SYSV: + /* push callee saves */ + addik r1, r1, -20 + swi r19, r1, 0 /* Frame Pointer */ + swi r20, r1, 4 /* PIC register */ + swi r21, r1, 8 /* PIC register */ + swi r22, r1, 12 /* save for locals */ + swi r23, r1, 16 /* save for locals */ + + /* save the r5-r10 registers in the stack */ + addik r1, r1, -24 /* increment sp to store 6x 32-bit words */ + swi r5, r1, 0 + swi r6, r1, 4 + swi r7, r1, 8 + swi r8, r1, 12 + swi r9, r1, 16 + swi r10, r1, 20 + + /* save function pointer */ + addik r3, r5, 0 /* copy ffi_prep_args into r3 */ + addik r22, r1, 0 /* save sp for unallocated args into r22 (callee-saved) */ + addik r23, r10, 0 /* save function address into r23 (callee-saved) */ + + /* prepare stack with allocation for n (bytes = r7) args */ + rsub r1, r7, r1 /* subtract bytes from sp */ + + /* prep args for ffi_prep_args call */ + addik r5, r1, 0 /* store stack pointer into arg[0] */ + /* r6 still holds ecif for arg[1] */ + + /* Call ffi_prep_args(stack, &ecif). */ + addik r1, r1, -4 + swi r15, r1, 0 /* store the link register in the frame */ + brald r15, r3 + nop /* branch has delay slot */ + lwi r15, r1, 0 + addik r1, r1, 4 /* restore the link register from the frame */ + /* returns calling stack pointer location */ + + /* prepare args for fn call, prep_args populates them onto the stack */ + lwi r5, r1, 0 /* arg[0] */ + lwi r6, r1, 4 /* arg[1] */ + lwi r7, r1, 8 /* arg[2] */ + lwi r8, r1, 12 /* arg[3] */ + lwi r9, r1, 16 /* arg[4] */ + lwi r10, r1, 20 /* arg[5] */ + + /* call (fn) (...). */ + addik r1, r1, -4 + swi r15, r1, 0 /* store the link register in the frame */ + brald r15, r23 + nop /* branch has delay slot */ + lwi r15, r1, 0 + addik r1, r1, 4 /* restore the link register from the frame */ + + /* Remove the space we pushed for the args. */ + addik r1, r22, 0 /* restore old SP */ + + /* restore this functions parameters */ + lwi r5, r1, 0 /* arg[0] */ + lwi r6, r1, 4 /* arg[1] */ + lwi r7, r1, 8 /* arg[2] */ + lwi r8, r1, 12 /* arg[3] */ + lwi r9, r1, 16 /* arg[4] */ + lwi r10, r1, 20 /* arg[5] */ + addik r1, r1, 24 /* decrement sp to de-allocate 6x 32-bit words */ + + /* If the return value pointer is NULL, assume no return value. */ + beqi r9, ffi_call_SYSV_end + + lwi r22, r1, 48 /* get return type (20 for locals + 28 for arg[6]) */ + lwi r23, r1, 52 /* get return size (20 for locals + 32 for arg[7]) */ + + /* Check if return type is actually a struct, do nothing */ + rsubi r11, r22, FFI_TYPE_STRUCT + beqi r11, ffi_call_SYSV_end + + /* Return 8bit */ + rsubi r11, r23, 1 + beqi r11, ffi_call_SYSV_store8 + + /* Return 16bit */ + rsubi r11, r23, 2 + beqi r11, ffi_call_SYSV_store16 + + /* Return 32bit */ + rsubi r11, r23, 4 + beqi r11, ffi_call_SYSV_store32 + + /* Return 64bit */ + rsubi r11, r23, 8 + beqi r11, ffi_call_SYSV_store64 + + /* Didnt match anything */ + bri ffi_call_SYSV_end + +ffi_call_SYSV_store64: + swi r3, r9, 0 /* store word r3 into return value */ + swi r4, r9, 4 /* store word r4 into return value */ + bri ffi_call_SYSV_end + +ffi_call_SYSV_store32: + swi r3, r9, 0 /* store word r3 into return value */ + bri ffi_call_SYSV_end + +ffi_call_SYSV_store16: +#ifdef __BIG_ENDIAN__ + shi r3, r9, 2 /* store half-word r3 into return value */ +#else + shi r3, r9, 0 /* store half-word r3 into return value */ +#endif + bri ffi_call_SYSV_end + +ffi_call_SYSV_store8: +#ifdef __BIG_ENDIAN__ + sbi r3, r9, 3 /* store byte r3 into return value */ +#else + sbi r3, r9, 0 /* store byte r3 into return value */ +#endif + bri ffi_call_SYSV_end + +ffi_call_SYSV_end: + /* callee restores */ + lwi r19, r1, 0 /* frame pointer */ + lwi r20, r1, 4 /* PIC register */ + lwi r21, r1, 8 /* PIC register */ + lwi r22, r1, 12 + lwi r23, r1, 16 + addik r1, r1, 20 + + /* return from sub-routine (with delay slot) */ + rtsd r15, 8 + nop + + .size ffi_call_SYSV, . - ffi_call_SYSV + +/* ------------------------------------------------------------------------- */ + + /* + * args passed into this function, are passed down to the callee. + * this function is the target of the closure trampoline, as such r12 is + * a pointer to the closure object. + */ + .text + .globl ffi_closure_SYSV + .type ffi_closure_SYSV, @function +ffi_closure_SYSV: + /* push callee saves */ + addik r11, r1, 28 /* save stack args start location (excluding regs/link) */ + addik r1, r1, -12 + swi r19, r1, 0 /* Frame Pointer */ + swi r20, r1, 4 /* PIC register */ + swi r21, r1, 8 /* PIC register */ + + /* store register args on stack */ + addik r1, r1, -24 + swi r5, r1, 0 + swi r6, r1, 4 + swi r7, r1, 8 + swi r8, r1, 12 + swi r9, r1, 16 + swi r10, r1, 20 + + /* setup args */ + addik r5, r1, 0 /* register_args */ + addik r6, r11, 0 /* stack_args */ + addik r7, r12, 0 /* closure object */ + addik r1, r1, -8 /* allocate return value */ + addik r8, r1, 0 /* void* rvalue */ + addik r1, r1, -8 /* allocate for reutrn type/size values */ + addik r9, r1, 0 /* void* rtype */ + addik r10, r1, 4 /* void* rsize */ + + /* call the wrap_call function */ + addik r1, r1, -28 /* allocate args + link reg */ + swi r15, r1, 0 /* store the link register in the frame */ + brald r15, r3 + nop /* branch has delay slot */ + lwi r15, r1, 0 + addik r1, r1, 28 /* restore the link register from the frame */ + +ffi_closure_SYSV_prepare_return: + lwi r9, r1, 0 /* rtype */ + lwi r10, r1, 4 /* rsize */ + addik r1, r1, 8 /* de-allocate return info values */ + + /* Check if return type is actually a struct, store 4 bytes */ + rsubi r11, r9, FFI_TYPE_STRUCT + beqi r11, ffi_closure_SYSV_store32 + + /* Return 8bit */ + rsubi r11, r10, 1 + beqi r11, ffi_closure_SYSV_store8 + + /* Return 16bit */ + rsubi r11, r10, 2 + beqi r11, ffi_closure_SYSV_store16 + + /* Return 32bit */ + rsubi r11, r10, 4 + beqi r11, ffi_closure_SYSV_store32 + + /* Return 64bit */ + rsubi r11, r10, 8 + beqi r11, ffi_closure_SYSV_store64 + + /* Didnt match anything */ + bri ffi_closure_SYSV_end + +ffi_closure_SYSV_store64: + lwi r3, r1, 0 /* store word r3 into return value */ + lwi r4, r1, 4 /* store word r4 into return value */ + /* 64 bits == 2 words, no sign extend occurs */ + bri ffi_closure_SYSV_end + +ffi_closure_SYSV_store32: + lwi r3, r1, 0 /* store word r3 into return value */ + /* 32 bits == 1 word, no sign extend occurs */ + bri ffi_closure_SYSV_end + +ffi_closure_SYSV_store16: +#ifdef __BIG_ENDIAN__ + lhui r3, r1, 2 /* store half-word r3 into return value */ +#else + lhui r3, r1, 0 /* store half-word r3 into return value */ +#endif + rsubi r11, r9, FFI_TYPE_SINT16 + bnei r11, ffi_closure_SYSV_end + sext16 r3, r3 /* fix sign extend of sint8 */ + bri ffi_closure_SYSV_end + +ffi_closure_SYSV_store8: +#ifdef __BIG_ENDIAN__ + lbui r3, r1, 3 /* store byte r3 into return value */ +#else + lbui r3, r1, 0 /* store byte r3 into return value */ +#endif + rsubi r11, r9, FFI_TYPE_SINT8 + bnei r11, ffi_closure_SYSV_end + sext8 r3, r3 /* fix sign extend of sint8 */ + bri ffi_closure_SYSV_end + +ffi_closure_SYSV_end: + addik r1, r1, 8 /* de-allocate return value */ + + /* de-allocate stored args */ + addik r1, r1, 24 + + /* callee restores */ + lwi r19, r1, 0 /* frame pointer */ + lwi r20, r1, 4 /* PIC register */ + lwi r21, r1, 8 /* PIC register */ + addik r1, r1, 12 + + /* return from sub-routine (with delay slot) */ + rtsd r15, 8 + nop + + .size ffi_closure_SYSV, . - ffi_closure_SYSV diff --git a/Modules/_ctypes/libffi/src/moxie/eabi.S b/Modules/_ctypes/libffi/src/moxie/eabi.S --- a/Modules/_ctypes/libffi/src/moxie/eabi.S +++ b/Modules/_ctypes/libffi/src/moxie/eabi.S @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- - eabi.S - Copyright (c) 2004 Anthony Green + eabi.S - Copyright (c) 2012, 2013 Anthony Green - FR-V Assembly glue. + Moxie Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -34,95 +34,68 @@ .globl ffi_call_EABI .type ffi_call_EABI, @function - # gr8 : ffi_prep_args - # gr9 : &ecif - # gr10: cif->bytes - # gr11: fig->flags - # gr12: ecif.rvalue - # gr13: fn + # $r0 : ffi_prep_args + # $r1 : &ecif + # $r2 : cif->bytes + # $r3 : fig->flags + # $r4 : ecif.rvalue + # $r5 : fn -ffi_call_EABI: - addi sp, #-80, sp - sti fp, @(sp, #24) - addi sp, #24, fp - movsg lr, gr5 +ffi_call_EABI: + push $sp, $r6 + push $sp, $r7 + push $sp, $r8 + dec $sp, 24 - /* Make room for the new arguments. */ - /* subi sp, fp, gr10 */ - - /* Store return address and incoming args on stack. */ - sti gr5, @(fp, #8) - sti gr8, @(fp, #-4) - sti gr9, @(fp, #-8) - sti gr10, @(fp, #-12) - sti gr11, @(fp, #-16) - sti gr12, @(fp, #-20) - sti gr13, @(fp, #-24) - - sub sp, gr10, sp + /* Store incoming args on stack. */ + sto.l 0($sp), $r0 /* ffi_prep_args */ + sto.l 4($sp), $r1 /* ecif */ + sto.l 8($sp), $r2 /* bytes */ + sto.l 12($sp), $r3 /* flags */ + sto.l 16($sp), $r4 /* &rvalue */ + sto.l 20($sp), $r5 /* fn */ /* Call ffi_prep_args. */ - ldi @(fp, #-4), gr4 - addi sp, #0, gr8 - ldi @(fp, #-8), gr9 -#ifdef __FRV_FDPIC__ - ldd @(gr4, gr0), gr14 - calll @(gr14, gr0) -#else - calll @(gr4, gr0) -#endif + mov $r6, $r4 /* Save result buffer */ + mov $r7, $r5 /* Save the target fn */ + mov $r8, $r3 /* Save the flags */ + sub.l $sp, $r2 /* Allocate stack space */ + mov $r0, $sp /* We can stomp over $r0 */ + /* $r1 is already set up */ + jsra ffi_prep_args - /* ffi_prep_args returns the new stack pointer. */ - mov gr8, gr4 - - ldi @(sp, #0), gr8 - ldi @(sp, #4), gr9 - ldi @(sp, #8), gr10 - ldi @(sp, #12), gr11 - ldi @(sp, #16), gr12 - ldi @(sp, #20), gr13 - - /* Always copy the return value pointer into the hidden - parameter register. This is only strictly necessary - when we're returning an aggregate type, but it doesn't - hurt to do this all the time, and it saves a branch. */ - ldi @(fp, #-20), gr3 - - /* Use the ffi_prep_args return value for the new sp. */ - mov gr4, sp + /* Load register arguments. */ + ldo.l $r0, 0($sp) + ldo.l $r1, 4($sp) + ldo.l $r2, 8($sp) + ldo.l $r3, 12($sp) + ldo.l $r4, 16($sp) + ldo.l $r5, 20($sp) /* Call the target function. */ - ldi @(fp, -24), gr4 -#ifdef __FRV_FDPIC__ - ldd @(gr4, gr0), gr14 - calll @(gr14, gr0) -#else - calll @(gr4, gr0) -#endif + jsr $r7 - /* Store the result. */ - ldi @(fp, #-16), gr10 /* fig->flags */ - ldi @(fp, #-20), gr4 /* ecif.rvalue */ + ldi.l $r7, 0xffffffff + cmp $r8, $r7 + beq retstruct - /* Is the return value stored in two registers? */ - cmpi gr10, #8, icc0 - bne icc0, 0, .L2 - /* Yes, save them. */ - sti gr8, @(gr4, #0) - sti gr9, @(gr4, #4) - bra .L3 -.L2: - /* Is the return value a structure? */ - cmpi gr10, #-1, icc0 - beq icc0, 0, .L3 - /* No, save a 4 byte return value. */ - sti gr8, @(gr4, #0) -.L3: + ldi.l $r7, 4 + cmp $r8, $r7 + bgt ret2reg - /* Restore the stack, and return. */ - ldi @(fp, 8), gr5 - ld @(fp, gr0), fp - addi sp,#80,sp - jmpl @(gr5,gr0) + st.l ($r6), $r0 + jmpa retdone + +ret2reg: + st.l ($r6), $r0 + sto.l 4($r6), $r1 + +retstruct: +retdone: + /* Return. */ + ldo.l $r6, -4($fp) + ldo.l $r7, -8($fp) + ldo.l $r8, -12($fp) + ret .size ffi_call_EABI, .-ffi_call_EABI diff --git a/Modules/_ctypes/libffi/src/moxie/ffi.c b/Modules/_ctypes/libffi/src/moxie/ffi.c --- a/Modules/_ctypes/libffi/src/moxie/ffi.c +++ b/Modules/_ctypes/libffi/src/moxie/ffi.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (C) 2009 Anthony Green + ffi.c - Copyright (C) 2012, 2013 Anthony Green Moxie Foreign Function Interface @@ -43,6 +43,12 @@ p_argv = ecif->avalue; argp = stack; + if (ecif->cif->rtype->type == FFI_TYPE_STRUCT) + { + *(void **) argp = ecif->rvalue; + argp += 4; + } + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++) @@ -56,17 +62,6 @@ z = sizeof(void*); *(void **) argp = *p_argv; } - /* if ((*p_arg)->type == FFI_TYPE_FLOAT) - { - if (count > 24) - { - // This is going on the stack. Turn it into a double. - *(double *) argp = (double) *(float*)(* p_argv); - z = sizeof(double); - } - else - *(void **) argp = *(void **)(* p_argv); - } */ else if (z < sizeof(int)) { z = sizeof(int); @@ -147,8 +142,7 @@ } else ecif.rvalue = rvalue; - - + switch (cif->abi) { case FFI_EABI: @@ -165,19 +159,25 @@ unsigned arg4, unsigned arg5, unsigned arg6) { /* This function is called by a trampoline. The trampoline stows a - pointer to the ffi_closure object in gr7. We must save this + pointer to the ffi_closure object in $r7. We must save this pointer in a place that will persist while we do our work. */ - register ffi_closure *creg __asm__ ("gr7"); + register ffi_closure *creg __asm__ ("$r12"); ffi_closure *closure = creg; /* Arguments that don't fit in registers are found on the stack at a fixed offset above the current frame pointer. */ - register char *frame_pointer __asm__ ("fp"); - char *stack_args = frame_pointer + 16; + register char *frame_pointer __asm__ ("$fp"); + + /* Pointer to a struct return value. */ + void *struct_rvalue = (void *) arg1; + + /* 6 words reserved for register args + 3 words from jsr */ + char *stack_args = frame_pointer + 9*4; /* Lay the register arguments down in a continuous chunk of memory. */ unsigned register_args[6] = { arg1, arg2, arg3, arg4, arg5, arg6 }; + char *register_args_ptr = (char *) register_args; ffi_cif *cif = closure->cif; ffi_type **arg_types = cif->arg_types; @@ -185,6 +185,12 @@ char *ptr = (char *) register_args; int i; + /* preserve struct type return pointer passing */ + if ((cif->rtype != NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { + ptr += 4; + register_args_ptr = (char *)®ister_args[1]; + } + /* Find the address of each argument. */ for (i = 0; i < cif->nargs; i++) { @@ -201,6 +207,7 @@ case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_FLOAT: + case FFI_TYPE_POINTER: avalue[i] = ptr; break; case FFI_TYPE_STRUCT: @@ -216,30 +223,21 @@ /* If we've handled more arguments than fit in registers, start looking at the those passed on the stack. */ - if (ptr == ((char *)register_args + (6*4))) + if (ptr == ®ister_args[6]) ptr = stack_args; } /* Invoke the closure. */ - if (cif->rtype->type == FFI_TYPE_STRUCT) + if (cif->rtype && (cif->rtype->type == FFI_TYPE_STRUCT)) { - /* The caller allocates space for the return structure, and - passes a pointer to this space in gr3. Use this value directly - as the return value. */ - register void *return_struct_ptr __asm__("gr3"); - (closure->fun) (cif, return_struct_ptr, avalue, closure->user_data); + (closure->fun) (cif, struct_rvalue, avalue, closure->user_data); } else { /* Allocate space for the return value and call the function. */ long long rvalue; (closure->fun) (cif, &rvalue, avalue, closure->user_data); - - /* Functions return 4-byte or smaller results in gr8. 8-byte - values also use gr9. We fill the both, even for small return - values, just to avoid a branch. */ - asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue)); - asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1])); + asm ("mov $r12, %0\n ld.l $r0, ($r12)\n ldo.l $r1, 4($r12)" : : "r" (&rvalue)); } } @@ -250,27 +248,25 @@ void *user_data, void *codeloc) { - unsigned int *tramp = (unsigned int *) &closure->tramp[0]; + unsigned short *tramp = (unsigned short *) &closure->tramp[0]; unsigned long fn = (long) ffi_closure_eabi; unsigned long cls = (long) codeloc; - int i; + + if (cif->abi != FFI_EABI) + return FFI_BAD_ABI; fn = (unsigned long) ffi_closure_eabi; - tramp[0] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ - tramp[1] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ - tramp[2] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ - tramp[3] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ - tramp[4] = 0x80300006; /* jmpl @(gr0, gr6) */ + tramp[0] = 0x01e0; /* ldi.l $r7, .... */ + tramp[1] = cls >> 16; + tramp[2] = cls & 0xffff; + tramp[3] = 0x1a00; /* jmpa .... */ + tramp[4] = fn >> 16; + tramp[5] = fn & 0xffff; closure->cif = cif; closure->fun = fun; closure->user_data = user_data; - /* Cache flushing. */ - for (i = 0; i < FFI_TRAMPOLINE_SIZE; i++) - __asm__ volatile ("dcf @(%0,%1)\n\tici @(%2,%1)" :: "r" (tramp), "r" (i), - "r" (codeloc)); - return FFI_OK; } diff --git a/Modules/_ctypes/libffi/src/moxie/ffitarget.h b/Modules/_ctypes/libffi/src/moxie/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/moxie/ffitarget.h @@ -0,0 +1,52 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2012, 2013 Anthony Green + Target configuration macros for Moxie + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +/* ---- System specific configurations ----------------------------------- */ + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_EABI, + FFI_DEFAULT_ABI = FFI_EABI, + FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_NATIVE_RAW_API 0 + +/* Trampolines are 12-bytes long. See ffi_prep_closure_loc. */ +#define FFI_TRAMPOLINE_SIZE (12) + +#endif diff --git a/Modules/_ctypes/libffi/src/powerpc/aix.S b/Modules/_ctypes/libffi/src/powerpc/aix.S --- a/Modules/_ctypes/libffi/src/powerpc/aix.S +++ b/Modules/_ctypes/libffi/src/powerpc/aix.S @@ -137,7 +137,7 @@ mtcrf 0x40, r31 mtctr r0 /* Load all those argument registers. */ - // We have set up a nice stack frame, just load it into registers. + /* We have set up a nice stack frame, just load it into registers. */ ld r3, 40+(1*8)(r1) ld r4, 40+(2*8)(r1) ld r5, 40+(3*8)(r1) @@ -150,7 +150,7 @@ L1: /* Load all the FP registers. */ - bf 6,L2 // 2f + 0x18 + bf 6,L2 /* 2f + 0x18 */ lfd f1,-32-(13*8)(r28) lfd f2,-32-(12*8)(r28) lfd f3,-32-(11*8)(r28) @@ -239,7 +239,7 @@ mtcrf 0x40, r31 mtctr r0 /* Load all those argument registers. */ - // We have set up a nice stack frame, just load it into registers. + /* We have set up a nice stack frame, just load it into registers. */ lwz r3, 20+(1*4)(r1) lwz r4, 20+(2*4)(r1) lwz r5, 20+(3*4)(r1) @@ -252,7 +252,7 @@ L1: /* Load all the FP registers. */ - bf 6,L2 // 2f + 0x18 + bf 6,L2 /* 2f + 0x18 */ lfd f1,-16-(13*8)(r28) lfd f2,-16-(12*8)(r28) lfd f3,-16-(11*8)(r28) @@ -307,7 +307,7 @@ #endif .long 0 .byte 0,0,0,1,128,4,0,0 -//END(ffi_call_AIX) +/* END(ffi_call_AIX) */ .csect .text[PR] .align 2 @@ -325,4 +325,4 @@ blr .long 0 .byte 0,0,0,0,0,0,0,0 -//END(ffi_call_DARWIN) +/* END(ffi_call_DARWIN) */ diff --git a/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c b/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c --- a/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c +++ b/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c @@ -302,10 +302,10 @@ } /* Check that we didn't overrun the stack... */ - //FFI_ASSERT(gpr_base <= stacktop - ASM_NEEDS_REGISTERS); - //FFI_ASSERT((unsigned *)fpr_base - // <= stacktop - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); - //FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); + /* FFI_ASSERT(gpr_base <= stacktop - ASM_NEEDS_REGISTERS); + FFI_ASSERT((unsigned *)fpr_base + <= stacktop - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); + FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); */ } #if defined(POWERPC_DARWIN64) diff --git a/Modules/_ctypes/libffi/src/powerpc/linux64.S b/Modules/_ctypes/libffi/src/powerpc/linux64.S --- a/Modules/_ctypes/libffi/src/powerpc/linux64.S +++ b/Modules/_ctypes/libffi/src/powerpc/linux64.S @@ -30,16 +30,25 @@ #include #ifdef __powerpc64__ - .hidden ffi_call_LINUX64, .ffi_call_LINUX64 - .globl ffi_call_LINUX64, .ffi_call_LINUX64 + .hidden ffi_call_LINUX64 + .globl ffi_call_LINUX64 .section ".opd","aw" .align 3 ffi_call_LINUX64: +#ifdef _CALL_LINUX + .quad .L.ffi_call_LINUX64,.TOC. at tocbase,0 + .type ffi_call_LINUX64, at function + .text +.L.ffi_call_LINUX64: +#else + .hidden .ffi_call_LINUX64 + .globl .ffi_call_LINUX64 .quad .ffi_call_LINUX64,.TOC. at tocbase,0 .size ffi_call_LINUX64,24 .type .ffi_call_LINUX64, at function .text .ffi_call_LINUX64: +#endif .LFB1: mflr %r0 std %r28, -32(%r1) @@ -58,7 +67,11 @@ /* Call ffi_prep_args64. */ mr %r4, %r1 +#ifdef _CALL_LINUX + bl ffi_prep_args64 +#else bl .ffi_prep_args64 +#endif ld %r0, 0(%r29) ld %r2, 8(%r29) @@ -137,7 +150,11 @@ .LFE1: .long 0 .byte 0,12,0,1,128,4,0,0 +#ifdef _CALL_LINUX + .size ffi_call_LINUX64,.-.L.ffi_call_LINUX64 +#else .size .ffi_call_LINUX64,.-.ffi_call_LINUX64 +#endif .section .eh_frame,EH_FRAME_FLAGS, at progbits .Lframe1: diff --git a/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S b/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S --- a/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S +++ b/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S @@ -32,16 +32,24 @@ #ifdef __powerpc64__ FFI_HIDDEN (ffi_closure_LINUX64) - FFI_HIDDEN (.ffi_closure_LINUX64) - .globl ffi_closure_LINUX64, .ffi_closure_LINUX64 + .globl ffi_closure_LINUX64 .section ".opd","aw" .align 3 ffi_closure_LINUX64: +#ifdef _CALL_LINUX + .quad .L.ffi_closure_LINUX64,.TOC. at tocbase,0 + .type ffi_closure_LINUX64, at function + .text +.L.ffi_closure_LINUX64: +#else + FFI_HIDDEN (.ffi_closure_LINUX64) + .globl .ffi_closure_LINUX64 .quad .ffi_closure_LINUX64,.TOC. at tocbase,0 .size ffi_closure_LINUX64,24 .type .ffi_closure_LINUX64, at function .text .ffi_closure_LINUX64: +#endif .LFB1: # save general regs into parm save area std %r3, 48(%r1) @@ -91,7 +99,11 @@ addi %r6, %r1, 128 # make the call +#ifdef _CALL_LINUX + bl ffi_closure_helper_LINUX64 +#else bl .ffi_closure_helper_LINUX64 +#endif .Lret: # now r3 contains the return type @@ -194,7 +206,11 @@ .LFE1: .long 0 .byte 0,12,0,1,128,0,0,0 +#ifdef _CALL_LINUX + .size ffi_closure_LINUX64,.-.L.ffi_closure_LINUX64 +#else .size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64 +#endif .section .eh_frame,EH_FRAME_FLAGS, at progbits .Lframe1: diff --git a/Modules/_ctypes/libffi/src/powerpc/sysv.S b/Modules/_ctypes/libffi/src/powerpc/sysv.S --- a/Modules/_ctypes/libffi/src/powerpc/sysv.S +++ b/Modules/_ctypes/libffi/src/powerpc/sysv.S @@ -142,14 +142,19 @@ #endif L(small_struct_return_value): - /* - * The C code always allocates a properly-aligned 8-byte bounce - * buffer to make this assembly code very simple. Just write out - * r3 and r4 to the buffer to allow the C code to handle the rest. - */ - stw %r3, 0(%r30) - stw %r4, 4(%r30) - b L(done_return_value) + extrwi %r6,%r31,2,19 /* number of bytes padding = shift/8 */ + mtcrf 0x02,%r31 /* copy flags to cr[24:27] (cr6) */ + extrwi %r5,%r31,5,19 /* r5 <- number of bits of padding */ + subfic %r6,%r6,4 /* r6 <- number of useful bytes in r3 */ + bf- 25,L(done_return_value) /* struct in r3 ? if not, done. */ +/* smst_one_register: */ + slw %r3,%r3,%r5 /* Left-justify value in r3 */ + mtxer %r6 /* move byte count to XER ... */ + stswx %r3,0,%r30 /* ... and store that many bytes */ + bf+ 26,L(done_return_value) /* struct in r3:r4 ? */ + add %r6,%r6,%r30 /* adjust pointer */ + stswi %r4,%r6,4 /* store last four bytes */ + b L(done_return_value) .LFE1: END(ffi_call_SYSV) diff --git a/Modules/_ctypes/libffi/src/prep_cif.c b/Modules/_ctypes/libffi/src/prep_cif.c --- a/Modules/_ctypes/libffi/src/prep_cif.c +++ b/Modules/_ctypes/libffi/src/prep_cif.c @@ -140,6 +140,13 @@ #ifdef SPARC && (cif->abi != FFI_V9 || cif->rtype->size > 32) #endif +#ifdef TILE + && (cif->rtype->size > 10 * FFI_SIZEOF_ARG) +#endif +#ifdef XTENSA + && (cif->rtype->size > 16) +#endif + ) bytes = STACK_ARG_SIZE(sizeof(void*)); #endif @@ -169,6 +176,20 @@ if (((*ptr)->alignment - 1) & bytes) bytes = ALIGN(bytes, (*ptr)->alignment); +#ifdef TILE + if (bytes < 10 * FFI_SIZEOF_ARG && + bytes + STACK_ARG_SIZE((*ptr)->size) > 10 * FFI_SIZEOF_ARG) + { + /* An argument is never split between the 10 parameter + registers and the stack. */ + bytes = 10 * FFI_SIZEOF_ARG; + } +#endif +#ifdef XTENSA + if (bytes <= 6*4 && bytes + STACK_ARG_SIZE((*ptr)->size) > 6*4) + bytes = 6*4; +#endif + bytes += STACK_ARG_SIZE((*ptr)->size); } #endif diff --git a/Modules/_ctypes/libffi/src/s390/ffi.c b/Modules/_ctypes/libffi/src/s390/ffi.c --- a/Modules/_ctypes/libffi/src/s390/ffi.c +++ b/Modules/_ctypes/libffi/src/s390/ffi.c @@ -750,7 +750,8 @@ void *user_data, void *codeloc) { - FFI_ASSERT (cif->abi == FFI_SYSV); + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; #ifndef __s390x__ *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */ diff --git a/Modules/_ctypes/libffi/src/sparc/v8.S b/Modules/_ctypes/libffi/src/sparc/v8.S --- a/Modules/_ctypes/libffi/src/sparc/v8.S +++ b/Modules/_ctypes/libffi/src/sparc/v8.S @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - v8.S - Copyright (c) 1996, 1997, 2003, 2004, 2008 Red Hat, Inc. + v8.S - Copyright (c) 2013 The Written Word, Inc. + Copyright (c) 1996, 1997, 2003, 2004, 2008 Red Hat, Inc. SPARC Foreign Function Interface @@ -31,11 +32,39 @@ #define STACKFRAME 96 /* Minimum stack framesize for SPARC */ #define ARGS (64+4) /* Offset of register area in frame */ -.text +#ifndef __GNUC__ + .text + .align 8 +.globl ffi_flush_icache +.globl _ffi_flush_icache + +ffi_flush_icache: +_ffi_flush_icache: + add %o0, %o1, %o2 +#ifdef SPARC64 +1: flush %o0 +#else +1: iflush %o0 +#endif + add %o0, 8, %o0 + cmp %o0, %o2 + blt 1b + nop + nop + nop + nop + nop + retl + nop +.ffi_flush_icache_end: + .size ffi_flush_icache,.ffi_flush_icache_end-ffi_flush_icache +#endif + + .text .align 8 .globl ffi_call_v8 .globl _ffi_call_v8 - + ffi_call_v8: _ffi_call_v8: .LLFB1: diff --git a/Modules/_ctypes/libffi/src/tile/ffi.c b/Modules/_ctypes/libffi/src/tile/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/tile/ffi.c @@ -0,0 +1,355 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2012 Tilera Corp. + + TILE Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include +#include +#include +#include +#include +#include +#include + + +/* The first 10 registers are used to pass arguments and return values. */ +#define NUM_ARG_REGS 10 + +/* Performs a raw function call with the given NUM_ARG_REGS register arguments + and the specified additional stack arguments (if any). */ +extern void ffi_call_tile(ffi_sarg reg_args[NUM_ARG_REGS], + const ffi_sarg *stack_args, + size_t stack_args_bytes, + void (*fnaddr)(void)) + FFI_HIDDEN; + +/* This handles the raw call from the closure stub, cleaning up the + parameters and delegating to ffi_closure_tile_inner. */ +extern void ffi_closure_tile(void) FFI_HIDDEN; + + +ffi_status +ffi_prep_cif_machdep(ffi_cif *cif) +{ + /* We always allocate room for all registers. Even if we don't + use them as parameters, they get returned in the same array + as struct return values so we need to make room. */ + if (cif->bytes < NUM_ARG_REGS * FFI_SIZEOF_ARG) + cif->bytes = NUM_ARG_REGS * FFI_SIZEOF_ARG; + + if (cif->rtype->size > NUM_ARG_REGS * FFI_SIZEOF_ARG) + cif->flags = FFI_TYPE_STRUCT; + else + cif->flags = FFI_TYPE_INT; + + /* Nothing to do. */ + return FFI_OK; +} + + +static long +assign_to_ffi_arg(ffi_sarg *out, void *in, const ffi_type *type, + int write_to_reg) +{ + switch (type->type) + { + case FFI_TYPE_SINT8: + *out = *(SINT8 *)in; + return 1; + + case FFI_TYPE_UINT8: + *out = *(UINT8 *)in; + return 1; + + case FFI_TYPE_SINT16: + *out = *(SINT16 *)in; + return 1; + + case FFI_TYPE_UINT16: + *out = *(UINT16 *)in; + return 1; + + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: +#ifndef __LP64__ + case FFI_TYPE_POINTER: +#endif + /* Note that even unsigned 32-bit quantities are sign extended + on tilegx when stored in a register. */ + *out = *(SINT32 *)in; + return 1; + + case FFI_TYPE_FLOAT: +#ifdef __tilegx__ + if (write_to_reg) + { + /* Properly sign extend the value. */ + union { float f; SINT32 s32; } val; + val.f = *(float *)in; + *out = val.s32; + } + else +#endif + { + *(float *)out = *(float *)in; + } + return 1; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_DOUBLE: +#ifdef __LP64__ + case FFI_TYPE_POINTER: +#endif + *(UINT64 *)out = *(UINT64 *)in; + return sizeof(UINT64) / FFI_SIZEOF_ARG; + + case FFI_TYPE_STRUCT: + memcpy(out, in, type->size); + return (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG; + + case FFI_TYPE_VOID: + /* Must be a return type. Nothing to do. */ + return 0; + + default: + FFI_ASSERT(0); + return -1; + } +} + + +void +ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + ffi_sarg * const arg_mem = alloca(cif->bytes); + ffi_sarg * const reg_args = arg_mem; + ffi_sarg * const stack_args = ®_args[NUM_ARG_REGS]; + ffi_sarg *argp = arg_mem; + ffi_type ** const arg_types = cif->arg_types; + const long num_args = cif->nargs; + long i; + + if (cif->flags == FFI_TYPE_STRUCT) + { + /* Pass a hidden pointer to the return value. We make sure there + is scratch space for the callee to store the return value even if + our caller doesn't care about it. */ + *argp++ = (intptr_t)(rvalue ? rvalue : alloca(cif->rtype->size)); + + /* No more work needed to return anything. */ + rvalue = NULL; + } + + for (i = 0; i < num_args; i++) + { + ffi_type *type = arg_types[i]; + void * const arg_in = avalue[i]; + ptrdiff_t arg_word = argp - arg_mem; + +#ifndef __tilegx__ + /* Doubleword-aligned values are always in an even-number register + pair, or doubleword-aligned stack slot if out of registers. */ + long align = arg_word & (type->alignment > FFI_SIZEOF_ARG); + argp += align; + arg_word += align; +#endif + + if (type->type == FFI_TYPE_STRUCT) + { + const size_t arg_size_in_words = + (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG; + + if (arg_word < NUM_ARG_REGS && + arg_word + arg_size_in_words > NUM_ARG_REGS) + { + /* Args are not allowed to span registers and the stack. */ + argp = stack_args; + } + + memcpy(argp, arg_in, type->size); + argp += arg_size_in_words; + } + else + { + argp += assign_to_ffi_arg(argp, arg_in, arg_types[i], 1); + } + } + + /* Actually do the call. */ + ffi_call_tile(reg_args, stack_args, + cif->bytes - (NUM_ARG_REGS * FFI_SIZEOF_ARG), fn); + + if (rvalue != NULL) + assign_to_ffi_arg(rvalue, reg_args, cif->rtype, 0); +} + + +/* Template code for closure. */ +extern const UINT64 ffi_template_tramp_tile[] FFI_HIDDEN; + + +ffi_status +ffi_prep_closure_loc (ffi_closure *closure, + ffi_cif *cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) +{ +#ifdef __tilegx__ + /* TILE-Gx */ + SINT64 c; + SINT64 h; + int s; + UINT64 *out; + + if (cif->abi != FFI_UNIX) + return FFI_BAD_ABI; + + out = (UINT64 *)closure->tramp; + + c = (intptr_t)closure; + h = (intptr_t)ffi_closure_tile; + s = 0; + + /* Find the smallest shift count that doesn't lose information + (i.e. no need to explicitly insert high bits of the address that + are just the sign extension of the low bits). */ + while ((c >> s) != (SINT16)(c >> s) || (h >> s) != (SINT16)(h >> s)) + s += 16; + +#define OPS(a, b, shift) \ + (create_Imm16_X0((a) >> (shift)) | create_Imm16_X1((b) >> (shift))) + + /* Emit the moveli. */ + *out++ = ffi_template_tramp_tile[0] | OPS(c, h, s); + for (s -= 16; s >= 0; s -= 16) + *out++ = ffi_template_tramp_tile[1] | OPS(c, h, s); + +#undef OPS + + *out++ = ffi_template_tramp_tile[2]; + +#else + /* TILEPro */ + UINT64 *out; + intptr_t delta; + + if (cif->abi != FFI_UNIX) + return FFI_BAD_ABI; + + out = (UINT64 *)closure->tramp; + delta = (intptr_t)ffi_closure_tile - (intptr_t)codeloc; + + *out++ = ffi_template_tramp_tile[0] | create_JOffLong_X1(delta >> 3); +#endif + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + invalidate_icache(closure->tramp, (char *)out - closure->tramp, + getpagesize()); + + return FFI_OK; +} + + +/* This is called by the assembly wrapper for closures. This does + all of the work. On entry reg_args[0] holds the values the registers + had when the closure was invoked. On return reg_args[1] holds the register + values to be returned to the caller (many of which may be garbage). */ +void FFI_HIDDEN +ffi_closure_tile_inner(ffi_closure *closure, + ffi_sarg reg_args[2][NUM_ARG_REGS], + ffi_sarg *stack_args) +{ + ffi_cif * const cif = closure->cif; + void ** const avalue = alloca(cif->nargs * sizeof(void *)); + void *rvalue; + ffi_type ** const arg_types = cif->arg_types; + ffi_sarg * const reg_args_in = reg_args[0]; + ffi_sarg * const reg_args_out = reg_args[1]; + ffi_sarg * argp; + long i, arg_word, nargs = cif->nargs; + /* Use a union to guarantee proper alignment for double. */ + union { ffi_sarg arg[NUM_ARG_REGS]; double d; UINT64 u64; } closure_ret; + + /* Start out reading register arguments. */ + argp = reg_args_in; + + /* Copy the caller's structure return address to that the closure + returns the data directly to the caller. */ + if (cif->flags == FFI_TYPE_STRUCT) + { + /* Return by reference via hidden pointer. */ + rvalue = (void *)(intptr_t)*argp++; + arg_word = 1; + } + else + { + /* Return the value in registers. */ + rvalue = &closure_ret; + arg_word = 0; + } + + /* Grab the addresses of the arguments. */ + for (i = 0; i < nargs; i++) + { + ffi_type * const type = arg_types[i]; + const size_t arg_size_in_words = + (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG; + +#ifndef __tilegx__ + /* Doubleword-aligned values are always in an even-number register + pair, or doubleword-aligned stack slot if out of registers. */ + long align = arg_word & (type->alignment > FFI_SIZEOF_ARG); + argp += align; + arg_word += align; +#endif + + if (arg_word == NUM_ARG_REGS || + (arg_word < NUM_ARG_REGS && + arg_word + arg_size_in_words > NUM_ARG_REGS)) + { + /* Switch to reading arguments from the stack. */ + argp = stack_args; + arg_word = NUM_ARG_REGS; + } + + avalue[i] = argp; + argp += arg_size_in_words; + arg_word += arg_size_in_words; + } + + /* Invoke the closure. */ + closure->fun(cif, rvalue, avalue, closure->user_data); + + if (cif->flags != FFI_TYPE_STRUCT) + { + /* Canonicalize for register representation. */ + assign_to_ffi_arg(reg_args_out, &closure_ret, cif->rtype, 1); + } +} diff --git a/Modules/_ctypes/libffi/src/tile/ffitarget.h b/Modules/_ctypes/libffi/src/tile/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/tile/ffitarget.h @@ -0,0 +1,65 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2012 Tilera Corp. + Target configuration macros for TILE. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM + +#include + +typedef uint_reg_t ffi_arg; +typedef int_reg_t ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_UNIX, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_UNIX +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ +#define FFI_CLOSURES 1 + +#ifdef __tilegx__ +/* We always pass 8-byte values, even in -m32 mode. */ +# define FFI_SIZEOF_ARG 8 +# ifdef __LP64__ +# define FFI_TRAMPOLINE_SIZE (8 * 5) /* 5 bundles */ +# else +# define FFI_TRAMPOLINE_SIZE (8 * 3) /* 3 bundles */ +# endif +#else +# define FFI_SIZEOF_ARG 4 +# define FFI_TRAMPOLINE_SIZE 8 /* 1 bundle */ +#endif +#define FFI_NATIVE_RAW_API 0 + +#endif diff --git a/Modules/_ctypes/libffi/src/tile/tile.S b/Modules/_ctypes/libffi/src/tile/tile.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/tile/tile.S @@ -0,0 +1,360 @@ +/* ----------------------------------------------------------------------- + tile.S - Copyright (c) 2011 Tilera Corp. + + Tilera TILEPro and TILE-Gx Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + +/* Number of bytes in a register. */ +#define REG_SIZE FFI_SIZEOF_ARG + +/* Number of bytes in stack linkage area for backtracing. + + A note about the ABI: on entry to a procedure, sp points to a stack + slot where it must spill the return address if it's not a leaf. + REG_SIZE bytes beyond that is a slot owned by the caller which + contains the sp value that the caller had when it was originally + entered (i.e. the caller's frame pointer). */ +#define LINKAGE_SIZE (2 * REG_SIZE) + +/* The first 10 registers are used to pass arguments and return values. */ +#define NUM_ARG_REGS 10 + +#ifdef __tilegx__ +#define SW st +#define LW ld +#define BGZT bgtzt +#else +#define SW sw +#define LW lw +#define BGZT bgzt +#endif + + +/* void ffi_call_tile (int_reg_t reg_args[NUM_ARG_REGS], + const int_reg_t *stack_args, + unsigned long stack_args_bytes, + void (*fnaddr)(void)); + + On entry, REG_ARGS contain the outgoing register values, + and STACK_ARGS containts STACK_ARG_BYTES of additional values + to be passed on the stack. If STACK_ARG_BYTES is zero, then + STACK_ARGS is ignored. + + When the invoked function returns, the values of r0-r9 are + blindly stored back into REG_ARGS for the caller to examine. */ + + .section .text.ffi_call_tile, "ax", @progbits + .align 8 + .globl ffi_call_tile + FFI_HIDDEN(ffi_call_tile) +ffi_call_tile: + +/* Incoming arguments. */ +#define REG_ARGS r0 +#define INCOMING_STACK_ARGS r1 +#define STACK_ARG_BYTES r2 +#define ORIG_FNADDR r3 + +/* Temporary values. */ +#define FRAME_SIZE r10 +#define TMP r11 +#define TMP2 r12 +#define OUTGOING_STACK_ARGS r13 +#define REG_ADDR_PTR r14 +#define RETURN_REG_ADDR r15 +#define FNADDR r16 + + .cfi_startproc + { + /* Save return address. */ + SW sp, lr + .cfi_offset lr, 0 + /* Prepare to spill incoming r52. */ + addi TMP, sp, -REG_SIZE + /* Increase frame size to have room to spill r52 and REG_ARGS. + The +7 is to round up mod 8. */ + addi FRAME_SIZE, STACK_ARG_BYTES, \ + REG_SIZE + REG_SIZE + LINKAGE_SIZE + 7 + } + { + /* Round stack frame size to a multiple of 8 to satisfy ABI. */ + andi FRAME_SIZE, FRAME_SIZE, -8 + /* Compute where to spill REG_ARGS value. */ + addi TMP2, sp, -(REG_SIZE * 2) + } + { + /* Spill incoming r52. */ + SW TMP, r52 + .cfi_offset r52, -REG_SIZE + /* Set up our frame pointer. */ + move r52, sp + .cfi_def_cfa_register r52 + /* Push stack frame. */ + sub sp, sp, FRAME_SIZE + } + { + /* Prepare to set up stack linkage. */ + addi TMP, sp, REG_SIZE + /* Prepare to memcpy stack args. */ + addi OUTGOING_STACK_ARGS, sp, LINKAGE_SIZE + /* Save REG_ARGS which we will need after we call the subroutine. */ + SW TMP2, REG_ARGS + } + { + /* Set up linkage info to hold incoming stack pointer. */ + SW TMP, r52 + } + { + /* Skip stack args memcpy if we don't have any stack args (common). */ + blezt STACK_ARG_BYTES, .Ldone_stack_args_memcpy + } + +.Lmemcpy_stack_args: + { + /* Load incoming argument from stack_args. */ + LW TMP, INCOMING_STACK_ARGS + addi INCOMING_STACK_ARGS, INCOMING_STACK_ARGS, REG_SIZE + } + { + /* Store stack argument into outgoing stack argument area. */ + SW OUTGOING_STACK_ARGS, TMP + addi OUTGOING_STACK_ARGS, OUTGOING_STACK_ARGS, REG_SIZE + addi STACK_ARG_BYTES, STACK_ARG_BYTES, -REG_SIZE + } + { + BGZT STACK_ARG_BYTES, .Lmemcpy_stack_args + } +.Ldone_stack_args_memcpy: + + { + /* Copy aside ORIG_FNADDR so we can overwrite its register. */ + move FNADDR, ORIG_FNADDR + /* Prepare to load argument registers. */ + addi REG_ADDR_PTR, r0, REG_SIZE + /* Load outgoing r0. */ + LW r0, r0 + } + + /* Load up argument registers from the REG_ARGS array. */ +#define LOAD_REG(REG, PTR) \ + { \ + LW REG, PTR ; \ + addi PTR, PTR, REG_SIZE \ + } + + LOAD_REG(r1, REG_ADDR_PTR) + LOAD_REG(r2, REG_ADDR_PTR) + LOAD_REG(r3, REG_ADDR_PTR) + LOAD_REG(r4, REG_ADDR_PTR) + LOAD_REG(r5, REG_ADDR_PTR) + LOAD_REG(r6, REG_ADDR_PTR) + LOAD_REG(r7, REG_ADDR_PTR) + LOAD_REG(r8, REG_ADDR_PTR) + LOAD_REG(r9, REG_ADDR_PTR) + + { + /* Call the subroutine. */ + jalr FNADDR + } + + { + /* Restore original lr. */ + LW lr, r52 + /* Prepare to recover ARGS, which we spilled earlier. */ + addi TMP, r52, -(2 * REG_SIZE) + } + { + /* Restore ARGS, so we can fill it in with the return regs r0-r9. */ + LW RETURN_REG_ADDR, TMP + /* Prepare to restore original r52. */ + addi TMP, r52, -REG_SIZE + } + + { + /* Pop stack frame. */ + move sp, r52 + /* Restore original r52. */ + LW r52, TMP + } + +#define STORE_REG(REG, PTR) \ + { \ + SW PTR, REG ; \ + addi PTR, PTR, REG_SIZE \ + } + + /* Return all register values by reference. */ + STORE_REG(r0, RETURN_REG_ADDR) + STORE_REG(r1, RETURN_REG_ADDR) + STORE_REG(r2, RETURN_REG_ADDR) + STORE_REG(r3, RETURN_REG_ADDR) + STORE_REG(r4, RETURN_REG_ADDR) + STORE_REG(r5, RETURN_REG_ADDR) + STORE_REG(r6, RETURN_REG_ADDR) + STORE_REG(r7, RETURN_REG_ADDR) + STORE_REG(r8, RETURN_REG_ADDR) + STORE_REG(r9, RETURN_REG_ADDR) + + { + jrp lr + } + + .cfi_endproc + .size ffi_call_tile, .-ffi_call_tile + +/* ffi_closure_tile(...) + + On entry, lr points to the closure plus 8 bytes, and r10 + contains the actual return address. + + This function simply dumps all register parameters into a stack array + and passes the closure, the registers array, and the stack arguments + to C code that does all of the actual closure processing. */ + + .section .text.ffi_closure_tile, "ax", @progbits + .align 8 + .globl ffi_closure_tile + FFI_HIDDEN(ffi_closure_tile) + + .cfi_startproc +/* Room to spill all NUM_ARG_REGS incoming registers, plus frame linkage. */ +#define CLOSURE_FRAME_SIZE (((NUM_ARG_REGS * REG_SIZE * 2 + LINKAGE_SIZE) + 7) & -8) +ffi_closure_tile: + { +#ifdef __tilegx__ + st sp, lr + .cfi_offset lr, 0 +#else + /* Save return address (in r10 due to closure stub wrapper). */ + SW sp, r10 + .cfi_return_column r10 + .cfi_offset r10, 0 +#endif + /* Compute address for stack frame linkage. */ + addli r10, sp, -(CLOSURE_FRAME_SIZE - REG_SIZE) + } + { + /* Save incoming stack pointer in linkage area. */ + SW r10, sp + .cfi_offset sp, -(CLOSURE_FRAME_SIZE - REG_SIZE) + /* Push a new stack frame. */ + addli sp, sp, -CLOSURE_FRAME_SIZE + .cfi_adjust_cfa_offset CLOSURE_FRAME_SIZE + } + + { + /* Create pointer to where to start spilling registers. */ + addi r10, sp, LINKAGE_SIZE + } + + /* Spill all the incoming registers. */ + STORE_REG(r0, r10) + STORE_REG(r1, r10) + STORE_REG(r2, r10) + STORE_REG(r3, r10) + STORE_REG(r4, r10) + STORE_REG(r5, r10) + STORE_REG(r6, r10) + STORE_REG(r7, r10) + STORE_REG(r8, r10) + { + /* Save r9. */ + SW r10, r9 +#ifdef __tilegx__ + /* Pointer to closure is passed in r11. */ + move r0, r11 +#else + /* Compute pointer to the closure object. Because the closure + starts with a "jal ffi_closure_tile", we can just take the + value of lr (a phony return address pointing into the closure) + and subtract 8. */ + addi r0, lr, -8 +#endif + /* Compute a pointer to the register arguments we just spilled. */ + addi r1, sp, LINKAGE_SIZE + } + { + /* Compute a pointer to the extra stack arguments (if any). */ + addli r2, sp, CLOSURE_FRAME_SIZE + LINKAGE_SIZE + /* Call C code to deal with all of the grotty details. */ + jal ffi_closure_tile_inner + } + { + addli r10, sp, CLOSURE_FRAME_SIZE + } + { + /* Restore the return address. */ + LW lr, r10 + /* Compute pointer to registers array. */ + addli r10, sp, LINKAGE_SIZE + (NUM_ARG_REGS * REG_SIZE) + } + /* Return all the register values, which C code may have set. */ + LOAD_REG(r0, r10) + LOAD_REG(r1, r10) + LOAD_REG(r2, r10) + LOAD_REG(r3, r10) + LOAD_REG(r4, r10) + LOAD_REG(r5, r10) + LOAD_REG(r6, r10) + LOAD_REG(r7, r10) + LOAD_REG(r8, r10) + LOAD_REG(r9, r10) + { + /* Pop the frame. */ + addli sp, sp, CLOSURE_FRAME_SIZE + jrp lr + } + + .cfi_endproc + .size ffi_closure_tile, . - ffi_closure_tile + + +/* What follows are code template instructions that get copied to the + closure trampoline by ffi_prep_closure_loc. The zeroed operands + get replaced by their proper values at runtime. */ + + .section .text.ffi_template_tramp_tile, "ax", @progbits + .align 8 + .globl ffi_template_tramp_tile + FFI_HIDDEN(ffi_template_tramp_tile) +ffi_template_tramp_tile: +#ifdef __tilegx__ + { + moveli r11, 0 /* backpatched to address of containing closure. */ + moveli r10, 0 /* backpatched to ffi_closure_tile. */ + } + /* Note: the following bundle gets generated multiple times + depending on the pointer value (esp. useful for -m32 mode). */ + { shl16insli r11, r11, 0 ; shl16insli r10, r10, 0 } + { info 2+8 /* for backtracer: -> pc in lr, frame size 0 */ ; jr r10 } +#else + /* 'jal .' yields a PC-relative offset of zero so we can OR in the + right offset at runtime. */ + { move r10, lr ; jal . /* ffi_closure_tile */ } +#endif + + .size ffi_template_tramp_tile, . - ffi_template_tramp_tile diff --git a/Modules/_ctypes/libffi/src/x86/ffi.c b/Modules/_ctypes/libffi/src/x86/ffi.c --- a/Modules/_ctypes/libffi/src/x86/ffi.c +++ b/Modules/_ctypes/libffi/src/x86/ffi.c @@ -315,9 +315,7 @@ cif->bytes += 4 * sizeof(ffi_arg); #endif -#ifdef X86_DARWIN cif->bytes = (cif->bytes + 15) & ~0xF; -#endif return FFI_OK; } @@ -424,7 +422,7 @@ /** private members **/ /* The following __attribute__((regparm(1))) decorations will have no effect - on MSVC - standard cdecl convention applies. */ + on MSVC or SUNPRO_C -- standard conventions apply. */ static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, void** args, ffi_cif* cif); void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *) diff --git a/Modules/_ctypes/libffi/src/xtensa/ffi.c b/Modules/_ctypes/libffi/src/xtensa/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/xtensa/ffi.c @@ -0,0 +1,298 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2013 Tensilica, Inc. + + XTENSA Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +/* + |----------------------------------------| + | | + on entry to ffi_call ----> |----------------------------------------| + | caller stack frame for registers a0-a3 | + |----------------------------------------| + | | + | additional arguments | + entry of the function ---> |----------------------------------------| + | copy of function arguments a2-a7 | + | - - - - - - - - - - - - - | + | | + + The area below the entry line becomes the new stack frame for the function. + +*/ + + +#define FFI_TYPE_STRUCT_REGS FFI_TYPE_LAST + + +extern void ffi_call_SYSV(void *rvalue, unsigned rsize, unsigned flags, + void(*fn)(void), unsigned nbytes, extended_cif*); +extern void ffi_closure_SYSV(void) FFI_HIDDEN; + +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + switch(cif->rtype->type) { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + cif->flags = cif->rtype->type; + break; + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + cif->flags = FFI_TYPE_UINT32; + break; + case FFI_TYPE_DOUBLE: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + cif->flags = FFI_TYPE_UINT64; // cif->rtype->type; + break; + case FFI_TYPE_STRUCT: + cif->flags = FFI_TYPE_STRUCT; //_REGS; + /* Up to 16 bytes are returned in registers */ + if (cif->rtype->size > 4 * 4) { + /* returned structure is referenced by a register; use 8 bytes + (including 4 bytes for potential additional alignment) */ + cif->flags = FFI_TYPE_STRUCT; + cif->bytes += 8; + } + break; + + default: + cif->flags = FFI_TYPE_UINT32; + break; + } + + /* Round the stack up to a full 4 register frame, just in case + (we use this size in movsp). This way, it's also a multiple of + 8 bytes for 64-bit arguments. */ + cif->bytes = ALIGN(cif->bytes, 16); + + return FFI_OK; +} + +void ffi_prep_args(extended_cif *ecif, unsigned char* stack) +{ + unsigned int i; + unsigned long *addr; + ffi_type **ptr; + + union { + void **v; + char **c; + signed char **sc; + unsigned char **uc; + signed short **ss; + unsigned short **us; + unsigned int **i; + long long **ll; + float **f; + double **d; + } p_argv; + + /* Verify that everything is aligned up properly */ + FFI_ASSERT (((unsigned long) stack & 0x7) == 0); + + p_argv.v = ecif->avalue; + addr = (unsigned long*)stack; + + /* structures with a size greater than 16 bytes are passed in memory */ + if (ecif->cif->rtype->type == FFI_TYPE_STRUCT && ecif->cif->rtype->size > 16) + { + *addr++ = (unsigned long)ecif->rvalue; + } + + for (i = ecif->cif->nargs, ptr = ecif->cif->arg_types; + i > 0; + i--, ptr++, p_argv.v++) + { + switch ((*ptr)->type) + { + case FFI_TYPE_SINT8: + *addr++ = **p_argv.sc; + break; + case FFI_TYPE_UINT8: + *addr++ = **p_argv.uc; + break; + case FFI_TYPE_SINT16: + *addr++ = **p_argv.ss; + break; + case FFI_TYPE_UINT16: + *addr++ = **p_argv.us; + break; + case FFI_TYPE_FLOAT: + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + *addr++ = **p_argv.i; + break; + case FFI_TYPE_DOUBLE: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + if (((unsigned long)addr & 4) != 0) + addr++; + *(unsigned long long*)addr = **p_argv.ll; + addr += sizeof(unsigned long long) / sizeof (addr); + break; + + case FFI_TYPE_STRUCT: + { + unsigned long offs; + unsigned long size; + + if (((unsigned long)addr & 4) != 0 && (*ptr)->alignment > 4) + addr++; + + offs = (unsigned long) addr - (unsigned long) stack; + size = (*ptr)->size; + + /* Entire structure must fit the argument registers or referenced */ + if (offs < FFI_REGISTER_NARGS * 4 + && offs + size > FFI_REGISTER_NARGS * 4) + addr = (unsigned long*) (stack + FFI_REGISTER_NARGS * 4); + + memcpy((char*) addr, *p_argv.c, size); + addr += (size + 3) / 4; + break; + } + + default: + FFI_ASSERT(0); + } + } +} + + +void ffi_call(ffi_cif* cif, void(*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + unsigned long rsize = cif->rtype->size; + int flags = cif->flags; + void *alloc = NULL; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* Note that for structures that are returned in registers (size <= 16 bytes) + we allocate a temporary buffer and use memcpy to copy it to the final + destination. The reason is that the target address might be misaligned or + the length not a multiple of 4 bytes. Handling all those cases would be + very complex. */ + + if (flags == FFI_TYPE_STRUCT && (rsize <= 16 || rvalue == NULL)) + { + alloc = alloca(ALIGN(rsize, 4)); + ecif.rvalue = alloc; + } + else + { + ecif.rvalue = rvalue; + } + + if (cif->abi != FFI_SYSV) + FFI_ASSERT(0); + + ffi_call_SYSV (ecif.rvalue, rsize, cif->flags, fn, cif->bytes, &ecif); + + if (alloc != NULL && rvalue != NULL) + memcpy(rvalue, alloc, rsize); +} + +extern void ffi_trampoline(); +extern void ffi_cacheflush(void* start, void* end); + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) +{ + /* copye trampoline to stack and patch 'ffi_closure_SYSV' pointer */ + memcpy(closure->tramp, ffi_trampoline, FFI_TRAMPOLINE_SIZE); + *(unsigned int*)(&closure->tramp[8]) = (unsigned int)ffi_closure_SYSV; + + // Do we have this function? + // __builtin___clear_cache(closer->tramp, closer->tramp + FFI_TRAMPOLINE_SIZE) + ffi_cacheflush(closure->tramp, closure->tramp + FFI_TRAMPOLINE_SIZE); + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + return FFI_OK; +} + + +long FFI_HIDDEN +ffi_closure_SYSV_inner(ffi_closure *closure, void **values, void *rvalue) +{ + ffi_cif *cif; + ffi_type **arg_types; + void **avalue; + int i, areg; + + cif = closure->cif; + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; + + areg = 0; + + int rtype = cif->rtype->type; + if (rtype == FFI_TYPE_STRUCT && cif->rtype->size > 4 * 4) + { + rvalue = *values; + areg++; + } + + cif = closure->cif; + arg_types = cif->arg_types; + avalue = alloca(cif->nargs * sizeof(void *)); + + for (i = 0; i < cif->nargs; i++) + { + if (arg_types[i]->alignment == 8 && (areg & 1) != 0) + areg++; + + // skip the entry 16,a1 framework, add 16 bytes (4 registers) + if (areg == FFI_REGISTER_NARGS) + areg += 4; + + if (arg_types[i]->type == FFI_TYPE_STRUCT) + { + int numregs = ((arg_types[i]->size + 3) & ~3) / 4; + if (areg < FFI_REGISTER_NARGS && areg + numregs > FFI_REGISTER_NARGS) + areg = FFI_REGISTER_NARGS + 4; + } + + avalue[i] = &values[areg]; + areg += (arg_types[i]->size + 3) / 4; + } + + (closure->fun)(cif, rvalue, avalue, closure->user_data); + + return rtype; +} diff --git a/Modules/_ctypes/libffi/src/xtensa/ffitarget.h b/Modules/_ctypes/libffi/src/xtensa/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/xtensa/ffitarget.h @@ -0,0 +1,53 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2013 Tensilica, Inc. + Target configuration macros for XTENSA. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV +} ffi_abi; +#endif + +#define FFI_REGISTER_NARGS 6 + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_NATIVE_RAW_API 0 +#define FFI_TRAMPOLINE_SIZE 24 + +#endif diff --git a/Modules/_ctypes/libffi/src/xtensa/sysv.S b/Modules/_ctypes/libffi/src/xtensa/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/xtensa/sysv.S @@ -0,0 +1,253 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2013 Tensilica, Inc. + + XTENSA Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + +#define ENTRY(name) .text; .globl name; .type name, at function; .align 4; name: +#define END(name) .size name , . - name + +/* Assert that the table below is in sync with ffi.h. */ + +#if FFI_TYPE_UINT8 != 5 \ + || FFI_TYPE_SINT8 != 6 \ + || FFI_TYPE_UINT16 != 7 \ + || FFI_TYPE_SINT16 != 8 \ + || FFI_TYPE_UINT32 != 9 \ + || FFI_TYPE_SINT32 != 10 \ + || FFI_TYPE_UINT64 != 11 +#error "xtensa/sysv.S out of sync with ffi.h" +#endif + + +/* ffi_call_SYSV (rvalue, rbytes, flags, (*fnaddr)(), bytes, ecif) + void *rvalue; a2 + unsigned long rbytes; a3 + unsigned flags; a4 + void (*fnaddr)(); a5 + unsigned long bytes; a6 + extended_cif* ecif) a7 +*/ + +ENTRY(ffi_call_SYSV) + + entry a1, 32 # 32 byte frame for using call8 below + + mov a10, a7 # a10(->arg0): ecif + sub a11, a1, a6 # a11(->arg1): stack pointer + mov a7, a1 # fp + movsp a1, a11 # set new sp = old_sp - bytes + + movi a8, ffi_prep_args + callx8 a8 # ffi_prep_args(ecif, stack) + + # prepare to move stack pointer back up to 6 arguments + # note that 'bytes' is already aligned + + movi a10, 6*4 + sub a11, a6, a10 + movgez a6, a10, a11 + add a6, a1, a6 + + + # we can pass up to 6 arguments in registers + # for simplicity, just load 6 arguments + # (the stack size is at least 32 bytes, so no risk to cross boundaries) + + l32i a10, a1, 0 + l32i a11, a1, 4 + l32i a12, a1, 8 + l32i a13, a1, 12 + l32i a14, a1, 16 + l32i a15, a1, 20 + + # move stack pointer + + movsp a1, a6 + + callx8 a5 # (*fn)(args...) + + # Handle return value(s) + + beqz a2, .Lexit + + movi a5, FFI_TYPE_STRUCT + bne a4, a5, .Lstore + movi a5, 16 + blt a5, a3, .Lexit + + s32i a10, a2, 0 + blti a3, 5, .Lexit + addi a3, a3, -1 + s32i a11, a2, 4 + blti a3, 8, .Lexit + s32i a12, a2, 8 + blti a3, 12, .Lexit + s32i a13, a2, 12 + +.Lexit: retw + +.Lstore: + addi a4, a4, -FFI_TYPE_UINT8 + bgei a4, 7, .Lexit # should never happen + movi a6, store_calls + add a4, a4, a4 + addx4 a6, a4, a6 # store_table + idx * 8 + jx a6 + + .align 8 +store_calls: + # UINT8 + s8i a10, a2, 0 + retw + + # SINT8 + .align 8 + s8i a10, a2, 0 + retw + + # UINT16 + .align 8 + s16i a10, a2, 0 + retw + + # SINT16 + .align 8 + s16i a10, a2, 0 + retw + + # UINT32 + .align 8 + s32i a10, a2, 0 + retw + + # SINT32 + .align 8 + s32i a10, a2, 0 + retw + + # UINT64 + .align 8 + s32i a10, a2, 0 + s32i a11, a2, 4 + retw + +END(ffi_call_SYSV) + + +/* + * void ffi_cacheflush (unsigned long start, unsigned long end) + */ + +#define EXTRA_ARGS_SIZE 24 + +ENTRY(ffi_cacheflush) + + entry a1, 16 + +1: dhwbi a2, 0 + ihi a2, 0 + addi a2, a2, 4 + blt a2, a3, 1b + + retw + +END(ffi_cacheflush) + +/* ffi_trampoline is copied to the stack */ + +ENTRY(ffi_trampoline) + + entry a1, 16 + (FFI_REGISTER_NARGS * 4) + (4 * 4) # [ 0] + j 2f # [ 3] + .align 4 # [ 6] +1: .long 0 # [ 8] +2: l32r a15, 1b # [12] + _mov a14, a0 # [15] + callx0 a15 # [18] + # [21] +END(ffi_trampoline) + +/* + * ffi_closure() + * + * a0: closure + 21 + * a14: return address (a0) + */ + +ENTRY(ffi_closure_SYSV) + + /* intentionally omitting entry here */ + + # restore return address (a0) and move pointer to closure to a10 + addi a10, a0, -21 + mov a0, a14 + + # allow up to 4 arguments as return values + addi a11, a1, 4 * 4 + + # save up to 6 arguments to stack (allocated by entry below) + s32i a2, a11, 0 + s32i a3, a11, 4 + s32i a4, a11, 8 + s32i a5, a11, 12 + s32i a6, a11, 16 + s32i a7, a11, 20 + + movi a8, ffi_closure_SYSV_inner + mov a12, a1 + callx8 a8 # .._inner(*closure, **avalue, *rvalue) + + # load up to four return arguments + l32i a2, a1, 0 + l32i a3, a1, 4 + l32i a4, a1, 8 + l32i a5, a1, 12 + + # (sign-)extend return value + movi a11, FFI_TYPE_UINT8 + bne a10, a11, 1f + extui a2, a2, 0, 8 + retw + +1: movi a11, FFI_TYPE_SINT8 + bne a10, a11, 1f + sext a2, a2, 7 + retw + +1: movi a11, FFI_TYPE_UINT16 + bne a10, a11, 1f + extui a2, a2, 0, 16 + retw + +1: movi a11, FFI_TYPE_SINT16 + bne a10, a11, 1f + sext a2, a2, 15 + +1: retw + +END(ffi_closure_SYSV) diff --git a/Modules/_ctypes/libffi/stamp-h.in b/Modules/_ctypes/libffi/stamp-h.in new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/stamp-h.in @@ -0,0 +1,1 @@ +timestamp diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/a.out b/Modules/_ctypes/libffi/testsuite/libffi.call/a.out old mode 100755 new mode 100644 index 93ee85b0daaf8d1ed5c6013ec615214f4120662a..0000000000000000000000000000000000000000 GIT binary patch [stripped] diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/call.exp b/Modules/_ctypes/libffi/testsuite/libffi.call/call.exp --- a/Modules/_ctypes/libffi/testsuite/libffi.call/call.exp +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/call.exp @@ -19,11 +19,20 @@ global srcdir subdir -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" "" +if { [string match $using_gcc "yes"] } { + + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" "" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" "" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" "" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" "" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" "" + +} else { + + # Assume we are using the vendor compiler. + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" "" + +} dg-finish diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_double_va.c @@ -45,9 +45,9 @@ args[2] = NULL; ffi_call(&cif, FFI_FN(printf), &res, args); - // { dg-output "7.0" } + /* { dg-output "7.0" } */ printf("res: %d\n", (int) res); - // { dg-output "\nres: 4" } + /* { dg-output "\nres: 4" } */ /* The call to cls_double_va_fn is static, so have to use a normal prep_cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, arg_types) == FFI_OK); @@ -55,9 +55,9 @@ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK); res = ((int(*)(char*, double))(code))(format, doubleArg); - // { dg-output "\n7.0" } + /* { dg-output "\n7.0" } */ printf("res: %d\n", (int) res); - // { dg-output "\nres: 4" } + /* { dg-output "\nres: 4" } */ exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c @@ -45,9 +45,9 @@ args[2] = NULL; ffi_call(&cif, FFI_FN(printf), &res, args); - // { dg-output "7.0" } + /* { dg-output "7.0" } */ printf("res: %d\n", (int) res); - // { dg-output "\nres: 4" } + /* { dg-output "\nres: 4" } */ /* The call to cls_longdouble_va_fn is static, so have to use a normal prep_cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, @@ -56,9 +56,9 @@ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK); res = ((int(*)(char*, long double))(code))(format, ldArg); - // { dg-output "\n7.0" } + /* { dg-output "\n7.0" } */ printf("res: %d\n", (int) res); - // { dg-output "\nres: 4" } + /* { dg-output "\nres: 4" } */ exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer.c @@ -35,7 +35,7 @@ void *code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; -// ffi_type cls_pointer_type; + /* ffi_type cls_pointer_type; */ ffi_type* arg_types[3]; /* cls_pointer_type.size = sizeof(void*); diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c @@ -98,7 +98,7 @@ void *code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; -// ffi_type cls_pointer_type; + /* ffi_type cls_pointer_type; */ ffi_type* arg_types[3]; /* cls_pointer_type.size = sizeof(void*); @@ -125,18 +125,18 @@ ffi_call(&cif, FFI_FN(cls_pointer_fn1), &res, args); printf("res: 0x%08x\n", (unsigned int) res); - // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } - // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } - // { dg-output "\nres: 0x8bf258bd" } + /* { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } */ + /* { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } */ + /* { dg-output "\nres: 0x8bf258bd" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); res = (ffi_arg)(uintptr_t)((void*(*)(void*, void*))(code))(arg1, arg2); printf("res: 0x%08x\n", (unsigned int) res); - // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } - // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } - // { dg-output "\nres: 0x8bf258bd" } + /* { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } */ + /* { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } */ + /* { dg-output "\nres: 0x8bf258bd" } */ exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_struct_va1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_struct_va1.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_struct_va1.c @@ -0,0 +1,114 @@ +/* Area: ffi_call, closure_call + Purpose: Test doubles passed in variable argument lists. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run } */ +/* { dg-output "" { xfail avr32*-*-* } } */ +#include "ffitest.h" + +struct small_tag +{ + unsigned char a; + unsigned char b; +}; + +struct large_tag +{ + unsigned a; + unsigned b; + unsigned c; + unsigned d; + unsigned e; +}; + +static void +test_fn (ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + int n = *(int*)args[0]; + struct small_tag s1 = * (struct small_tag *) args[1]; + struct large_tag l1 = * (struct large_tag *) args[2]; + struct small_tag s2 = * (struct small_tag *) args[3]; + + printf ("%d %d %d %d %d %d %d %d %d %d\n", n, s1.a, s1.b, + l1.a, l1.b, l1.c, l1.d, l1.e, + s2.a, s2.b); + * (int*) resp = 42; +} + +int +main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc (sizeof (ffi_closure), &code); + ffi_type* arg_types[5]; + + ffi_arg res = 0; + + ffi_type s_type; + ffi_type *s_type_elements[3]; + + ffi_type l_type; + ffi_type *l_type_elements[6]; + + struct small_tag s1; + struct small_tag s2; + struct large_tag l1; + + int si; + + s_type.size = 0; + s_type.alignment = 0; + s_type.type = FFI_TYPE_STRUCT; + s_type.elements = s_type_elements; + + s_type_elements[0] = &ffi_type_uchar; + s_type_elements[1] = &ffi_type_uchar; + s_type_elements[2] = NULL; + + l_type.size = 0; + l_type.alignment = 0; + l_type.type = FFI_TYPE_STRUCT; + l_type.elements = l_type_elements; + + l_type_elements[0] = &ffi_type_uint; + l_type_elements[1] = &ffi_type_uint; + l_type_elements[2] = &ffi_type_uint; + l_type_elements[3] = &ffi_type_uint; + l_type_elements[4] = &ffi_type_uint; + l_type_elements[5] = NULL; + + arg_types[0] = &ffi_type_sint; + arg_types[1] = &s_type; + arg_types[2] = &l_type; + arg_types[3] = &s_type; + arg_types[4] = NULL; + + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint, + arg_types) == FFI_OK); + + si = 4; + s1.a = 5; + s1.b = 6; + + s2.a = 20; + s2.b = 21; + + l1.a = 10; + l1.b = 11; + l1.c = 12; + l1.d = 13; + l1.e = 14; + + CHECK(ffi_prep_closure_loc(pcl, &cif, test_fn, NULL, code) == FFI_OK); + + res = ((int (*)(int, ...))(code))(si, s1, l1, s2); + /* { dg-output "4 5 6 10 11 12 13 14 20 21" } */ + printf("res: %d\n", (int) res); + /* { dg-output "\nres: 42" } */ + + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uchar_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uchar_va.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uchar_va.c @@ -0,0 +1,44 @@ +/* Area: closure_call + Purpose: Test anonymous unsigned char argument. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef unsigned char T; + +static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) + { + *(ffi_arg *)resp = *(T *)args[0]; + + printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]); + } + +typedef T (*cls_ret_T)(T, ...); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[3]; + T res; + + cl_arg_types[0] = &ffi_type_uchar; + cl_arg_types[1] = &ffi_type_uchar; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, + &ffi_type_uchar, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); + res = ((((cls_ret_T)code)(67, 4))); + /* { dg-output "67: 67 4" } */ + printf("res: %d\n", res); + /* { dg-output "\nres: 67" } */ + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uint_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uint_va.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_uint_va.c @@ -0,0 +1,45 @@ +/* Area: closure_call + Purpose: Test anonymous unsigned int argument. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ + +#include "ffitest.h" + +typedef unsigned int T; + +static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) + { + *(T *)resp = *(T *)args[0]; + + printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]); + } + +typedef T (*cls_ret_T)(T, ...); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[3]; + T res; + + cl_arg_types[0] = &ffi_type_uint; + cl_arg_types[1] = &ffi_type_uint; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, + &ffi_type_uint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); + res = ((((cls_ret_T)code)(67, 4))); + /* { dg-output "67: 67 4" } */ + printf("res: %d\n", res); + /* { dg-output "\nres: 67" } */ + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulong_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulong_va.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulong_va.c @@ -0,0 +1,45 @@ +/* Area: closure_call + Purpose: Test anonymous unsigned long argument. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ + +#include "ffitest.h" + +typedef unsigned long T; + +static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) + { + *(T *)resp = *(T *)args[0]; + + printf("%ld: %ld %ld\n", *(T *)resp, *(T *)args[0], *(T *)args[1]); + } + +typedef T (*cls_ret_T)(T, ...); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[3]; + T res; + + cl_arg_types[0] = &ffi_type_ulong; + cl_arg_types[1] = &ffi_type_ulong; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, + &ffi_type_ulong, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); + res = ((((cls_ret_T)code)(67, 4))); + /* { dg-output "67: 67 4" } */ + printf("res: %ld\n", res); + /* { dg-output "\nres: 67" } */ + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c @@ -11,7 +11,7 @@ static void cls_ret_ulonglong_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { - *(unsigned long long *)resp= *(unsigned long long *)args[0]; + *(unsigned long long *)resp= 0xfffffffffffffffLL ^ *(unsigned long long *)args[0]; printf("%" PRIuLL ": %" PRIuLL "\n",*(unsigned long long *)args[0], *(unsigned long long *)(resp)); @@ -34,14 +34,14 @@ &ffi_type_uint64, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code) == FFI_OK); res = (*((cls_ret_ulonglong)code))(214LL); - /* { dg-output "214: 214" } */ + /* { dg-output "214: 1152921504606846761" } */ printf("res: %" PRIdLL "\n", res); - /* { dg-output "\nres: 214" } */ + /* { dg-output "\nres: 1152921504606846761" } */ res = (*((cls_ret_ulonglong)code))(9223372035854775808LL); - /* { dg-output "\n9223372035854775808: 9223372035854775808" } */ + /* { dg-output "\n9223372035854775808: 8070450533247928831" } */ printf("res: %" PRIdLL "\n", res); - /* { dg-output "\nres: 9223372035854775808" } */ + /* { dg-output "\nres: 8070450533247928831" } */ exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ushort_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ushort_va.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_ushort_va.c @@ -0,0 +1,44 @@ +/* Area: closure_call + Purpose: Test anonymous unsigned short argument. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef unsigned short T; + +static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) + { + *(ffi_arg *)resp = *(T *)args[0]; + + printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]); + } + +typedef T (*cls_ret_T)(T, ...); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[3]; + T res; + + cl_arg_types[0] = &ffi_type_ushort; + cl_arg_types[1] = &ffi_type_ushort; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, + &ffi_type_ushort, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); + res = ((((cls_ret_T)code)(67, 4))); + /* { dg-output "67: 67 4" } */ + printf("res: %d\n", res); + /* { dg-output "\nres: 67" } */ + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/negint.c b/Modules/_ctypes/libffi/testsuite/libffi.call/negint.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/negint.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/negint.c @@ -5,7 +5,6 @@ Originator: From the original ffitest.c */ /* { dg-do run } */ -/* { dg-options -O2 } */ #include "ffitest.h" diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct1.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct1.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct1.c @@ -156,6 +156,6 @@ CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); - // CHECK( 1 == 0); + /* CHECK( 1 == 0); */ exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct11.c b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct11.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/nested_struct11.c @@ -0,0 +1,121 @@ +/* Area: ffi_call, closure_call + Purpose: Check parameter passing with nested structs + of a single type. This tests the special cases + for homogenous floating-point aggregates in the + AArch64 PCS. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct A { + float a_x; + float a_y; +} A; + +typedef struct B { + float b_x; + float b_y; +} B; + +typedef struct C { + A a; + B b; +} C; + +static C C_fn (int x, int y, int z, C source, int i, int j, int k) +{ + C result; + result.a.a_x = source.a.a_x; + result.a.a_y = source.a.a_y; + result.b.b_x = source.b.b_x; + result.b.b_y = source.b.b_y; + + printf ("%d, %d, %d, %d, %d, %d\n", x, y, z, i, j, k); + + printf ("%.1f, %.1f, %.1f, %.1f, " + "%.1f, %.1f, %.1f, %.1f\n", + source.a.a_x, source.a.a_y, + source.b.b_x, source.b.b_y, + result.a.a_x, result.a.a_y, + result.b.b_x, result.b.b_y); + + return result; +} + +int main (void) +{ + ffi_cif cif; + + ffi_type* struct_fields_source_a[3]; + ffi_type* struct_fields_source_b[3]; + ffi_type* struct_fields_source_c[3]; + ffi_type* arg_types[8]; + + ffi_type struct_type_a, struct_type_b, struct_type_c; + + struct A source_fld_a = {1.0, 2.0}; + struct B source_fld_b = {4.0, 8.0}; + int k = 1; + + struct C result; + struct C source = {source_fld_a, source_fld_b}; + + struct_type_a.size = 0; + struct_type_a.alignment = 0; + struct_type_a.type = FFI_TYPE_STRUCT; + struct_type_a.elements = struct_fields_source_a; + + struct_type_b.size = 0; + struct_type_b.alignment = 0; + struct_type_b.type = FFI_TYPE_STRUCT; + struct_type_b.elements = struct_fields_source_b; + + struct_type_c.size = 0; + struct_type_c.alignment = 0; + struct_type_c.type = FFI_TYPE_STRUCT; + struct_type_c.elements = struct_fields_source_c; + + struct_fields_source_a[0] = &ffi_type_float; + struct_fields_source_a[1] = &ffi_type_float; + struct_fields_source_a[2] = NULL; + + struct_fields_source_b[0] = &ffi_type_float; + struct_fields_source_b[1] = &ffi_type_float; + struct_fields_source_b[2] = NULL; + + struct_fields_source_c[0] = &struct_type_a; + struct_fields_source_c[1] = &struct_type_b; + struct_fields_source_c[2] = NULL; + + arg_types[0] = &ffi_type_sint32; + arg_types[1] = &ffi_type_sint32; + arg_types[2] = &ffi_type_sint32; + arg_types[3] = &struct_type_c; + arg_types[4] = &ffi_type_sint32; + arg_types[5] = &ffi_type_sint32; + arg_types[6] = &ffi_type_sint32; + arg_types[7] = NULL; + + void *args[7]; + args[0] = &k; + args[1] = &k; + args[2] = &k; + args[3] = &source; + args[4] = &k; + args[5] = &k; + args[6] = &k; + CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 7, &struct_type_c, + arg_types) == FFI_OK); + + ffi_call (&cif, FFI_FN (C_fn), &result, args); + /* { dg-output "1, 1, 1, 1, 1, 1\n" } */ + /* { dg-output "1.0, 2.0, 4.0, 8.0, 1.0, 2.0, 4.0, 8.0" } */ + CHECK (result.a.a_x == source.a.a_x); + CHECK (result.a.a_y == source.a.a_y); + CHECK (result.b.b_x == source.b.b_x); + CHECK (result.b.b_y == source.b.b_y); + exit (0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/return_dbl.c b/Modules/_ctypes/libffi/testsuite/libffi.call/return_dbl.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/return_dbl.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/return_dbl.c @@ -9,6 +9,7 @@ static double return_dbl(double dbl) { + printf ("%f\n", dbl); return 2 * dbl; } int main (void) diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/return_uc.c b/Modules/_ctypes/libffi/testsuite/libffi.call/return_uc.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/return_uc.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/return_uc.c @@ -32,7 +32,7 @@ uc < (unsigned char) '\xff'; uc++) { ffi_call(&cif, FFI_FN(return_uc), &rint, values); - CHECK(rint == (signed int) uc); + CHECK((unsigned char)rint == uc); } exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large.c b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large.c @@ -9,8 +9,8 @@ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" -// 13 FPRs: 104 bytes -// 14 FPRs: 112 bytes +/* 13 FPRs: 104 bytes */ +/* 14 FPRs: 112 bytes */ typedef struct struct_108byte { double a; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/stret_large2.c @@ -9,8 +9,8 @@ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" -// 13 FPRs: 104 bytes -// 14 FPRs: 112 bytes +/* 13 FPRs: 104 bytes */ +/* 14 FPRs: 112 bytes */ typedef struct struct_116byte { double a; diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/uninitialized.c b/Modules/_ctypes/libffi/testsuite/libffi.call/uninitialized.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/uninitialized.c @@ -0,0 +1,61 @@ +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct +{ + unsigned char uc; + double d; + unsigned int ui; +} test_structure_1; + +static test_structure_1 struct1(test_structure_1 ts) +{ + ts.uc++; + ts.d--; + ts.ui++; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts1_type; + ffi_type *ts1_type_elements[4]; + + memset(&cif, 1, sizeof(cif)); + ts1_type.size = 0; + ts1_type.alignment = 0; + ts1_type.type = FFI_TYPE_STRUCT; + ts1_type.elements = ts1_type_elements; + ts1_type_elements[0] = &ffi_type_uchar; + ts1_type_elements[1] = &ffi_type_double; + ts1_type_elements[2] = &ffi_type_uint; + ts1_type_elements[3] = NULL; + + test_structure_1 ts1_arg; + /* This is a hack to get a properly aligned result buffer */ + test_structure_1 *ts1_result = + (test_structure_1 *) malloc (sizeof(test_structure_1)); + + args[0] = &ts1_type; + values[0] = &ts1_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ts1_type, args) == FFI_OK); + + ts1_arg.uc = '\x01'; + ts1_arg.d = 3.14159; + ts1_arg.ui = 555; + + ffi_call(&cif, FFI_FN(struct1), ts1_result, values); + + CHECK(ts1_result->ui == 556); + CHECK(ts1_result->d == 3.14159 - 1); + + free (ts1_result); + exit(0); +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/va_1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/va_1.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/va_1.c @@ -0,0 +1,196 @@ +/* Area: ffi_call + Purpose: Test passing struct in variable argument lists. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +/* { dg-output "" { xfail avr32*-*-* } } */ + +#include "ffitest.h" +#include + +struct small_tag +{ + unsigned char a; + unsigned char b; +}; + +struct large_tag +{ + unsigned a; + unsigned b; + unsigned c; + unsigned d; + unsigned e; +}; + +static int +test_fn (int n, ...) +{ + va_list ap; + struct small_tag s1; + struct small_tag s2; + struct large_tag l; + unsigned char uc; + signed char sc; + unsigned short us; + signed short ss; + unsigned int ui; + signed int si; + unsigned long ul; + signed long sl; + float f; + double d; + + va_start (ap, n); + s1 = va_arg (ap, struct small_tag); + l = va_arg (ap, struct large_tag); + s2 = va_arg (ap, struct small_tag); + + uc = va_arg (ap, unsigned); + sc = va_arg (ap, signed); + + us = va_arg (ap, unsigned); + ss = va_arg (ap, signed); + + ui = va_arg (ap, unsigned int); + si = va_arg (ap, signed int); + + ul = va_arg (ap, unsigned long); + sl = va_arg (ap, signed long); + + f = va_arg (ap, double); /* C standard promotes float->double + when anonymous */ + d = va_arg (ap, double); + + printf ("%u %u %u %u %u %u %u %u %u uc=%u sc=%d %u %d %u %d %lu %ld %f %f\n", + s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, + s2.a, s2.b, + uc, sc, + us, ss, + ui, si, + ul, sl, + f, d); + va_end (ap); + return n + 1; +} + +int +main (void) +{ + ffi_cif cif; + void* args[15]; + ffi_type* arg_types[15]; + + ffi_type s_type; + ffi_type *s_type_elements[3]; + + ffi_type l_type; + ffi_type *l_type_elements[6]; + + struct small_tag s1; + struct small_tag s2; + struct large_tag l1; + + int n; + int res; + + unsigned char uc; + signed char sc; + unsigned short us; + signed short ss; + unsigned int ui; + signed int si; + unsigned long ul; + signed long sl; + double d1; + double f1; + + s_type.size = 0; + s_type.alignment = 0; + s_type.type = FFI_TYPE_STRUCT; + s_type.elements = s_type_elements; + + s_type_elements[0] = &ffi_type_uchar; + s_type_elements[1] = &ffi_type_uchar; + s_type_elements[2] = NULL; + + l_type.size = 0; + l_type.alignment = 0; + l_type.type = FFI_TYPE_STRUCT; + l_type.elements = l_type_elements; + + l_type_elements[0] = &ffi_type_uint; + l_type_elements[1] = &ffi_type_uint; + l_type_elements[2] = &ffi_type_uint; + l_type_elements[3] = &ffi_type_uint; + l_type_elements[4] = &ffi_type_uint; + l_type_elements[5] = NULL; + + arg_types[0] = &ffi_type_sint; + arg_types[1] = &s_type; + arg_types[2] = &l_type; + arg_types[3] = &s_type; + arg_types[4] = &ffi_type_uchar; + arg_types[5] = &ffi_type_schar; + arg_types[6] = &ffi_type_ushort; + arg_types[7] = &ffi_type_sshort; + arg_types[8] = &ffi_type_uint; + arg_types[9] = &ffi_type_sint; + arg_types[10] = &ffi_type_ulong; + arg_types[11] = &ffi_type_slong; + arg_types[12] = &ffi_type_double; + arg_types[13] = &ffi_type_double; + arg_types[14] = NULL; + + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 14, &ffi_type_sint, arg_types) == FFI_OK); + + s1.a = 5; + s1.b = 6; + + l1.a = 10; + l1.b = 11; + l1.c = 12; + l1.d = 13; + l1.e = 14; + + s2.a = 7; + s2.b = 8; + + n = 41; + + uc = 9; + sc = 10; + us = 11; + ss = 12; + ui = 13; + si = 14; + ul = 15; + sl = 16; + f1 = 2.12; + d1 = 3.13; + + args[0] = &n; + args[1] = &s1; + args[2] = &l1; + args[3] = &s2; + args[4] = &uc; + args[5] = ≻ + args[6] = &us; + args[7] = &ss; + args[8] = &ui; + args[9] = &si; + args[10] = &ul; + args[11] = &sl; + args[12] = &f1; + args[13] = &d1; + args[14] = NULL; + + ffi_call(&cif, FFI_FN(test_fn), &res, args); + /* { dg-output "5 6 10 11 12 13 14 7 8 uc=9 sc=10 11 12 13 14 15 16 2.120000 3.130000" } */ + printf("res: %d\n", (int) res); + /* { dg-output "\nres: 42" } */ + + return 0; +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct1.c b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct1.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct1.c @@ -0,0 +1,121 @@ +/* Area: ffi_call + Purpose: Test passing struct in variable argument lists. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +/* { dg-output "" { xfail avr32*-*-* } } */ + +#include "ffitest.h" +#include + +struct small_tag +{ + unsigned char a; + unsigned char b; +}; + +struct large_tag +{ + unsigned a; + unsigned b; + unsigned c; + unsigned d; + unsigned e; +}; + +static int +test_fn (int n, ...) +{ + va_list ap; + struct small_tag s1; + struct small_tag s2; + struct large_tag l; + + va_start (ap, n); + s1 = va_arg (ap, struct small_tag); + l = va_arg (ap, struct large_tag); + s2 = va_arg (ap, struct small_tag); + printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, + s2.a, s2.b); + va_end (ap); + return n + 1; +} + +int +main (void) +{ + ffi_cif cif; + void* args[5]; + ffi_type* arg_types[5]; + + ffi_type s_type; + ffi_type *s_type_elements[3]; + + ffi_type l_type; + ffi_type *l_type_elements[6]; + + struct small_tag s1; + struct small_tag s2; + struct large_tag l1; + + int n; + int res; + + s_type.size = 0; + s_type.alignment = 0; + s_type.type = FFI_TYPE_STRUCT; + s_type.elements = s_type_elements; + + s_type_elements[0] = &ffi_type_uchar; + s_type_elements[1] = &ffi_type_uchar; + s_type_elements[2] = NULL; + + l_type.size = 0; + l_type.alignment = 0; + l_type.type = FFI_TYPE_STRUCT; + l_type.elements = l_type_elements; + + l_type_elements[0] = &ffi_type_uint; + l_type_elements[1] = &ffi_type_uint; + l_type_elements[2] = &ffi_type_uint; + l_type_elements[3] = &ffi_type_uint; + l_type_elements[4] = &ffi_type_uint; + l_type_elements[5] = NULL; + + arg_types[0] = &ffi_type_sint; + arg_types[1] = &s_type; + arg_types[2] = &l_type; + arg_types[3] = &s_type; + arg_types[4] = NULL; + + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint, arg_types) == FFI_OK); + + s1.a = 5; + s1.b = 6; + + l1.a = 10; + l1.b = 11; + l1.c = 12; + l1.d = 13; + l1.e = 14; + + s2.a = 7; + s2.b = 8; + + n = 41; + + args[0] = &n; + args[1] = &s1; + args[2] = &l1; + args[3] = &s2; + args[4] = NULL; + + ffi_call(&cif, FFI_FN(test_fn), &res, args); + /* { dg-output "5 6 10 11 12 13 14 7 8" } */ + printf("res: %d\n", (int) res); + /* { dg-output "\nres: 42" } */ + + return 0; +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct2.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct2.c @@ -0,0 +1,123 @@ +/* Area: ffi_call + Purpose: Test passing struct in variable argument lists. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +/* { dg-output "" { xfail avr32*-*-* } } */ + +#include "ffitest.h" +#include + +struct small_tag +{ + unsigned char a; + unsigned char b; +}; + +struct large_tag +{ + unsigned a; + unsigned b; + unsigned c; + unsigned d; + unsigned e; +}; + +static struct small_tag +test_fn (int n, ...) +{ + va_list ap; + struct small_tag s1; + struct small_tag s2; + struct large_tag l; + + va_start (ap, n); + s1 = va_arg (ap, struct small_tag); + l = va_arg (ap, struct large_tag); + s2 = va_arg (ap, struct small_tag); + printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, + s2.a, s2.b); + va_end (ap); + s1.a += s2.a; + s1.b += s2.b; + return s1; +} + +int +main (void) +{ + ffi_cif cif; + void* args[5]; + ffi_type* arg_types[5]; + + ffi_type s_type; + ffi_type *s_type_elements[3]; + + ffi_type l_type; + ffi_type *l_type_elements[6]; + + struct small_tag s1; + struct small_tag s2; + struct large_tag l1; + + int n; + struct small_tag res; + + s_type.size = 0; + s_type.alignment = 0; + s_type.type = FFI_TYPE_STRUCT; + s_type.elements = s_type_elements; + + s_type_elements[0] = &ffi_type_uchar; + s_type_elements[1] = &ffi_type_uchar; + s_type_elements[2] = NULL; + + l_type.size = 0; + l_type.alignment = 0; + l_type.type = FFI_TYPE_STRUCT; + l_type.elements = l_type_elements; + + l_type_elements[0] = &ffi_type_uint; + l_type_elements[1] = &ffi_type_uint; + l_type_elements[2] = &ffi_type_uint; + l_type_elements[3] = &ffi_type_uint; + l_type_elements[4] = &ffi_type_uint; + l_type_elements[5] = NULL; + + arg_types[0] = &ffi_type_sint; + arg_types[1] = &s_type; + arg_types[2] = &l_type; + arg_types[3] = &s_type; + arg_types[4] = NULL; + + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &s_type, arg_types) == FFI_OK); + + s1.a = 5; + s1.b = 6; + + l1.a = 10; + l1.b = 11; + l1.c = 12; + l1.d = 13; + l1.e = 14; + + s2.a = 7; + s2.b = 8; + + n = 41; + + args[0] = &n; + args[1] = &s1; + args[2] = &l1; + args[3] = &s2; + args[4] = NULL; + + ffi_call(&cif, FFI_FN(test_fn), &res, args); + /* { dg-output "5 6 10 11 12 13 14 7 8" } */ + printf("res: %d %d\n", res.a, res.b); + /* { dg-output "\nres: 12 14" } */ + + return 0; +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct3.c b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct3.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/va_struct3.c @@ -0,0 +1,125 @@ +/* Area: ffi_call + Purpose: Test passing struct in variable argument lists. + Limitations: none. + PR: none. + Originator: ARM Ltd. */ + +/* { dg-do run } */ +/* { dg-output "" { xfail avr32*-*-* } } */ + +#include "ffitest.h" +#include + +struct small_tag +{ + unsigned char a; + unsigned char b; +}; + +struct large_tag +{ + unsigned a; + unsigned b; + unsigned c; + unsigned d; + unsigned e; +}; + +static struct large_tag +test_fn (int n, ...) +{ + va_list ap; + struct small_tag s1; + struct small_tag s2; + struct large_tag l; + + va_start (ap, n); + s1 = va_arg (ap, struct small_tag); + l = va_arg (ap, struct large_tag); + s2 = va_arg (ap, struct small_tag); + printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, + s2.a, s2.b); + va_end (ap); + l.a += s1.a; + l.b += s1.b; + l.c += s2.a; + l.d += s2.b; + return l; +} + +int +main (void) +{ + ffi_cif cif; + void* args[5]; + ffi_type* arg_types[5]; + + ffi_type s_type; + ffi_type *s_type_elements[3]; + + ffi_type l_type; + ffi_type *l_type_elements[6]; + + struct small_tag s1; + struct small_tag s2; + struct large_tag l1; + + int n; + struct large_tag res; + + s_type.size = 0; + s_type.alignment = 0; + s_type.type = FFI_TYPE_STRUCT; + s_type.elements = s_type_elements; + + s_type_elements[0] = &ffi_type_uchar; + s_type_elements[1] = &ffi_type_uchar; + s_type_elements[2] = NULL; + + l_type.size = 0; + l_type.alignment = 0; + l_type.type = FFI_TYPE_STRUCT; + l_type.elements = l_type_elements; + + l_type_elements[0] = &ffi_type_uint; + l_type_elements[1] = &ffi_type_uint; + l_type_elements[2] = &ffi_type_uint; + l_type_elements[3] = &ffi_type_uint; + l_type_elements[4] = &ffi_type_uint; + l_type_elements[5] = NULL; + + arg_types[0] = &ffi_type_sint; + arg_types[1] = &s_type; + arg_types[2] = &l_type; + arg_types[3] = &s_type; + arg_types[4] = NULL; + + CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &l_type, arg_types) == FFI_OK); + + s1.a = 5; + s1.b = 6; + + l1.a = 10; + l1.b = 11; + l1.c = 12; + l1.d = 13; + l1.e = 14; + + s2.a = 7; + s2.b = 8; + + n = 41; + + args[0] = &n; + args[1] = &s1; + args[2] = &l1; + args[3] = &s2; + args[4] = NULL; + + ffi_call(&cif, FFI_FN(test_fn), &res, args); + /* { dg-output "5 6 10 11 12 13 14 7 8" } */ + printf("res: %d %d %d %d %d\n", res.a, res.b, res.c, res.d, res.e); + /* { dg-output "\nres: 15 17 19 21 14" } */ + + return 0; +} diff --git a/Modules/_ctypes/libffi/testsuite/libffi.special/ffitestcxx.h b/Modules/_ctypes/libffi/testsuite/libffi.special/ffitestcxx.h --- a/Modules/_ctypes/libffi/testsuite/libffi.special/ffitestcxx.h +++ b/Modules/_ctypes/libffi/testsuite/libffi.special/ffitestcxx.h @@ -53,44 +53,3 @@ #define PRIuLL "llu" #endif -#ifdef USING_MMAP -static inline void * -allocate_mmap (size_t size) -{ - void *page; -#if defined (HAVE_MMAP_DEV_ZERO) - static int dev_zero_fd = -1; -#endif - -#ifdef HAVE_MMAP_DEV_ZERO - if (dev_zero_fd == -1) - { - dev_zero_fd = open ("/dev/zero", O_RDONLY); - if (dev_zero_fd == -1) - { - perror ("open /dev/zero: %m"); - exit (1); - } - } -#endif - - -#ifdef HAVE_MMAP_ANON - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); -#endif -#ifdef HAVE_MMAP_DEV_ZERO - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE, dev_zero_fd, 0); -#endif - - if (page == (char *) MAP_FAILED) - { - perror ("virtual memory exhausted"); - exit (1); - } - - return page; -} - -#endif diff --git a/Modules/_ctypes/libffi/testsuite/libffi.special/special.exp b/Modules/_ctypes/libffi/testsuite/libffi.special/special.exp --- a/Modules/_ctypes/libffi/testsuite/libffi.special/special.exp +++ b/Modules/_ctypes/libffi/testsuite/libffi.special/special.exp @@ -23,10 +23,14 @@ set cxx_options " -shared-libgcc -lstdc++" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O0 -W -Wall" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O2" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O3" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-Os" +if { [string match $using_gcc "yes"] } { + + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O0 -W -Wall" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O2" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O3" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-Os" + +} dg-finish diff --git a/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc b/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc --- a/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc +++ b/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc @@ -5,6 +5,7 @@ Originator: Jeff Sturm */ /* { dg-do run } */ + #include "ffitestcxx.h" #if defined HAVE_STDINT_H diff --git a/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc b/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc --- a/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc +++ b/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc @@ -5,6 +5,7 @@ Originator: Andreas Tobler 20061213 */ /* { dg-do run } */ + #include "ffitestcxx.h" static int checking(int a __UNUSED__, short b __UNUSED__, diff --git a/Modules/_ctypes/libffi/texinfo.tex b/Modules/_ctypes/libffi/texinfo.tex --- a/Modules/_ctypes/libffi/texinfo.tex +++ b/Modules/_ctypes/libffi/texinfo.tex @@ -1,18 +1,18 @@ % texinfo.tex -- TeX macros to handle Texinfo files. -% +% % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2005-07-05.19} -% -% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, -% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software -% Foundation, Inc. -% -% This texinfo.tex file is free software; you can redistribute it and/or +\def\texinfoversion{2012-06-05.14} +% +% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +% 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. +% +% This texinfo.tex file is free software: you can redistribute it and/or % modify it under the terms of the GNU General Public License as -% published by the Free Software Foundation; either version 2, or (at -% your option) any later version. +% published by the Free Software Foundation, either version 3 of the +% License, or (at your option) any later version. % % This texinfo.tex file is distributed in the hope that it will be % useful, but WITHOUT ANY WARRANTY; without even the implied warranty @@ -20,9 +20,7 @@ % General Public License for more details. % % You should have received a copy of the GNU General Public License -% along with this texinfo.tex file; see the file COPYING. If not, write -% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -% Boston, MA 02110-1301, USA. +% along with this program. If not, see . % % As a special exception, when this file is read by TeX when processing % a Texinfo source document, you may use the result without @@ -30,9 +28,9 @@ % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: -% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or -% ftp://tug.org/tex/texinfo.tex -% (and all CTAN mirrors, see http://www.ctan.org). +% http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or +% http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or +% http://www.gnu.org/software/texinfo/ (the Texinfo home page) % The texinfo.tex in any given distribution could well be out % of date, so if that's what you're using, please check. % @@ -67,7 +65,6 @@ \everyjob{\message{[Texinfo version \texinfoversion]}% \catcode`+=\active \catcode`\_=\active} -\message{Basics,} \chardef\other=12 % We never want plain's \outer definition of \+ in Texinfo. @@ -95,10 +92,13 @@ \let\ptexnewwrite\newwrite \let\ptexnoindent=\noindent \let\ptexplus=+ +\let\ptexraggedright=\raggedright \let\ptexrbrace=\} \let\ptexslash=\/ \let\ptexstar=\* \let\ptext=\t +\let\ptextop=\top +{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode % If this character appears in an error message or help string, it % starts a new line in the output. @@ -116,10 +116,11 @@ % Set up fixed words for English if not already set. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putworderror\undefined \gdef\putworderror{error}\fi \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi \ifx\putwordin\undefined \gdef\putwordin{in}\fi -\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi -\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi @@ -153,28 +154,25 @@ \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi -% In some macros, we cannot use the `\? notation---the left quote is -% in some cases the escape char. -\chardef\backChar = `\\ +% Since the category of space is not known, we have to be careful. +\chardef\spacecat = 10 +\def\spaceisspace{\catcode`\ =\spacecat} + +% sometimes characters are active, so we need control sequences. +\chardef\ampChar = `\& \chardef\colonChar = `\: \chardef\commaChar = `\, +\chardef\dashChar = `\- \chardef\dotChar = `\. \chardef\exclamChar= `\! -\chardef\plusChar = `\+ +\chardef\hashChar = `\# +\chardef\lquoteChar= `\` \chardef\questChar = `\? +\chardef\rquoteChar= `\' \chardef\semiChar = `\; +\chardef\slashChar = `\/ \chardef\underChar = `\_ -\chardef\spaceChar = `\ % -\chardef\spacecat = 10 -\def\spaceisspace{\catcode\spaceChar=\spacecat} - -{% for help with debugging. - % example usage: \expandafter\show\activebackslash - \catcode`\! = 0 \catcode`\\ = \active - !global!def!activebackslash{\} -} - % Ignore a token. % \def\gobble#1{} @@ -203,36 +201,7 @@ % that mark overfull boxes (in case you have decided % that the text looks ok even though it passes the margin). % -\def\finalout{\overfullrule=0pt} - -% @| inserts a changebar to the left of the current line. It should -% surround any changed text. This approach does *not* work if the -% change spans more than two lines of output. To handle that, we would -% have adopt a much more difficult approach (putting marks into the main -% vertical list for the beginning and end of each change). -% -\def\|{% - % \vadjust can only be used in horizontal mode. - \leavevmode - % - % Append this vertical mode material after the current line in the output. - \vadjust{% - % We want to insert a rule with the height and depth of the current - % leading; that is exactly what \strutbox is supposed to record. - \vskip-\baselineskip - % - % \vadjust-items are inserted at the left edge of the type. So - % the \llap here moves out into the left-hand margin. - \llap{% - % - % For a thicker or thinner bar, change the `1pt'. - \vrule height\baselineskip width1pt - % - % This is the space between the bar and the text. - \hskip 12pt - }% - }% -} +\def\finalout{\overfullrule=0pt } % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, @@ -250,7 +219,7 @@ \tracingmacros2 \tracingrestores1 \showboxbreadth\maxdimen \showboxdepth\maxdimen - \ifx\eTeXversion\undefined\else % etex gives us more logging + \ifx\eTeXversion\thisisundefined\else % etex gives us more logging \tracingscantokens1 \tracingifs1 \tracinggroups1 @@ -261,6 +230,13 @@ \errorcontextlines16 }% +% @errormsg{MSG}. Do the index-like expansions on MSG, but if things +% aren't perfect, it's not the end of the world, being an error message, +% after all. +% +\def\errormsg{\begingroup \indexnofonts \doerrormsg} +\def\doerrormsg#1{\errmessage{#1}} + % add check for \lastpenalty to plain's definitions. If the last thing % we did was a \nobreak, we don't want to insert more space. % @@ -271,7 +247,6 @@ \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount \removelastskip\penalty-200\bigskip\fi\fi} -% For @cropmarks command. % Do @cropmarks to get crop marks. % \newif\ifcropmarks @@ -285,6 +260,50 @@ \newdimen\cornerthick \cornerthick=.3pt \newdimen\topandbottommargin \topandbottommargin=.75in +% Output a mark which sets \thischapter, \thissection and \thiscolor. +% We dump everything together because we only have one kind of mark. +% This works because we only use \botmark / \topmark, not \firstmark. +% +% A mark contains a subexpression of the \ifcase ... \fi construct. +% \get*marks macros below extract the needed part using \ifcase. +% +% Another complication is to let the user choose whether \thischapter +% (\thissection) refers to the chapter (section) in effect at the top +% of a page, or that at the bottom of a page. The solution is +% described on page 260 of The TeXbook. It involves outputting two +% marks for the sectioning macros, one before the section break, and +% one after. I won't pretend I can describe this better than DEK... +\def\domark{% + \toks0=\expandafter{\lastchapterdefs}% + \toks2=\expandafter{\lastsectiondefs}% + \toks4=\expandafter{\prevchapterdefs}% + \toks6=\expandafter{\prevsectiondefs}% + \toks8=\expandafter{\lastcolordefs}% + \mark{% + \the\toks0 \the\toks2 + \noexpand\or \the\toks4 \the\toks6 + \noexpand\else \the\toks8 + }% +} +% \topmark doesn't work for the very first chapter (after the title +% page or the contents), so we use \firstmark there -- this gets us +% the mark with the chapter defs, unless the user sneaks in, e.g., +% @setcolor (or @url, or @link, etc.) between @contents and the very +% first @chapter. +\def\gettopheadingmarks{% + \ifcase0\topmark\fi + \ifx\thischapter\empty \ifcase0\firstmark\fi \fi +} +\def\getbottomheadingmarks{\ifcase1\botmark\fi} +\def\getcolormarks{\ifcase2\topmark\fi} + +% Avoid "undefined control sequence" errors. +\def\lastchapterdefs{} +\def\lastsectiondefs{} +\def\prevchapterdefs{} +\def\prevsectiondefs{} +\def\lastcolordefs{} + % Main output routine. \chardef\PAGE = 255 \output = {\onepageout{\pagecontents\PAGE}} @@ -302,7 +321,9 @@ % % Do this outside of the \shipout so @code etc. will be expanded in % the headline as they should be, not taken literally (outputting ''code). + \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% % {% @@ -311,6 +332,13 @@ % before the \shipout runs. % \indexdummies % don't expand commands in the output. + \normalturnoffactive % \ in index entries must not stay \, e.g., if + % the page break happens to be in the middle of an example. + % We don't want .vr (or whatever) entries like this: + % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} + % "\acronym" won't work when it's read back in; + % it needs to be + % {\code {{\tt \backslashcurfont }acronym} \shipout\vbox{% % Do this early so pdf references go to the beginning of the page. \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi @@ -338,9 +366,9 @@ \pagebody{#1}% \ifdim\ht\footlinebox > 0pt % Only leave this space if the footline is nonempty. - % (We lessened \vsize for it in \oddfootingxxx.) + % (We lessened \vsize for it in \oddfootingyyy.) % The \baselineskip=24pt in plain's \makefootline has no effect. - \vskip 2\baselineskip + \vskip 24pt \unvbox\footlinebox \fi % @@ -374,7 +402,7 @@ % marginal hacks, juha at viisa.uucp (Juha Takala) \ifvoid\margin\else % marginal info is present \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi -\dimen@=\dp#1 \unvbox#1 +\dimen@=\dp#1\relax \unvbox#1\relax \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi \ifr at ggedbottom \kern-\dimen@ \vfil \fi} } @@ -396,7 +424,7 @@ % \def\parsearg{\parseargusing{}} \def\parseargusing#1#2{% - \def\next{#2}% + \def\argtorun{#2}% \begingroup \obeylines \spaceisspace @@ -415,7 +443,7 @@ \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} -% Each occurence of `\^^M' or `\^^M' is replaced by a single space. +% Each occurrence of `\^^M' or `\^^M' is replaced by a single space. % % \argremovec might leave us with trailing space, e.g., % @end itemize @c foo @@ -427,8 +455,7 @@ \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% \def\temp{#3}% \ifx\temp\empty - % We cannot use \next here, as it holds the macro to run; - % thus we reuse \temp. + % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: \let\temp\finishparsearg \else \let\temp\argcheckspaces @@ -440,14 +467,14 @@ % If a _delimited_ argument is enclosed in braces, they get stripped; so % to get _exactly_ the rest of the line, we had to prevent such situation. % We prepended an \empty token at the very beginning and we expand it now, -% just before passing the control to \next. -% (Similarily, we have to think about #3 of \argcheckspacesY above: it is +% just before passing the control to \argtorun. +% (Similarly, we have to think about #3 of \argcheckspacesY above: it is % either the null string, or it ends with \^^M---thus there is no danger % that a pair of braces would be stripped. % % But first, we have to remove the trailing space token. % -\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} +\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} % \parseargdef\foo{...} % is roughly equivalent to @@ -498,12 +525,12 @@ % used to check whether the current environment is the one expected. % % Non-false conditionals (@iftex, @ifset) don't fit into this, so they -% are not treated as enviroments; they don't open a group. (The +% are not treated as environments; they don't open a group. (The % implementation of @end takes care not to call \endgroup in this % special case.) -% At runtime, environments start with this: +% At run-time, environments start with this: \def\startenvironment#1{\begingroup\def\thisenv{#1}} % initialize \let\thisenv\empty @@ -521,7 +548,7 @@ \fi } -% Evironment mismatch, #1 expected: +% Environment mismatch, #1 expected: \def\badenverr{% \errhelp = \EMsimple \errmessage{This command can appear only \inenvironment\temp, @@ -529,7 +556,7 @@ } \def\inenvironment#1{% \ifx#1\empty - out of any environment% + outside of any environment% \else in environment \expandafter\string#1% \fi @@ -541,7 +568,7 @@ \parseargdef\end{% \if 1\csname iscond.#1\endcsname \else - % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 + % The general wording of \badenverr may not be ideal. \expandafter\checkenv\csname#1\endcsname \csname E#1\endcsname \endgroup @@ -551,85 +578,6 @@ \newhelp\EMsimple{Press RETURN to continue.} -%% Simple single-character @ commands - -% @@ prints an @ -% Kludge this until the fonts are right (grr). -\def\@{{\tt\char64}} - -% This is turned off because it was never documented -% and you can use @w{...} around a quote to suppress ligatures. -%% Define @` and @' to be the same as ` and ' -%% but suppressing ligatures. -%\def\`{{`}} -%\def\'{{'}} - -% Used to generate quoted braces. -\def\mylbrace {{\tt\char123}} -\def\myrbrace {{\tt\char125}} -\let\{=\mylbrace -\let\}=\myrbrace -\begingroup - % Definitions to produce \{ and \} commands for indices, - % and @{ and @} for the aux/toc files. - \catcode`\{ = \other \catcode`\} = \other - \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\! = 0 \catcode`\\ = \other - !gdef!lbracecmd[\{]% - !gdef!rbracecmd[\}]% - !gdef!lbraceatcmd[@{]% - !gdef!rbraceatcmd[@}]% -!endgroup - -% @comma{} to avoid , parsing problems. -\let\comma = , - -% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent -% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. -\let\, = \c -\let\dotaccent = \. -\def\ringaccent#1{{\accent23 #1}} -\let\tieaccent = \t -\let\ubaraccent = \b -\let\udotaccent = \d - -% Other special characters: @questiondown @exclamdown @ordf @ordm -% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. -\def\questiondown{?`} -\def\exclamdown{!`} -\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} -\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} - -% Dotless i and dotless j, used for accents. -\def\imacro{i} -\def\jmacro{j} -\def\dotless#1{% - \def\temp{#1}% - \ifx\temp\imacro \ptexi - \else\ifx\temp\jmacro \j - \else \errmessage{@dotless can be used only with i or j}% - \fi\fi -} - -% The \TeX{} logo, as in plain, but resetting the spacing so that a -% period following counts as ending a sentence. (Idea found in latex.) -% -\edef\TeX{\TeX \spacefactor=1000 } - -% @LaTeX{} logo. Not quite the same results as the definition in -% latex.ltx, since we use a different font for the raised A; it's most -% convenient for us to use an explicitly smaller font, rather than using -% the \scriptstyle font (since we don't reset \scriptstyle and -% \scriptscriptstyle). -% -\def\LaTeX{% - L\kern-.36em - {\setbox0=\hbox{T}% - \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% - \kern-.15em - \TeX -} - % Be sure we're in horizontal mode when doing a tie, since we make space % equivalent to this in @example-like environments. Otherwise, a space % at the beginning of a line will start with \penalty -- and @@ -661,7 +609,7 @@ \def\?{?\spacefactor=\endofsentencespacefactor\space} % @frenchspacing on|off says whether to put extra space after punctuation. -% +% \def\onword{on} \def\offword{off} % @@ -671,7 +619,7 @@ \else\ifx\temp\offword \plainnonfrenchspacing \else \errhelp = \EMsimple - \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% + \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% \fi\fi } @@ -753,15 +701,6 @@ \newdimen\mil \mil=0.001in -% Old definition--didn't work. -%\parseargdef\need{\par % -%% This method tries to make TeX break the page naturally -%% if the depth of the box does not fit. -%{\baselineskip=0pt% -%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak -%\prevdepth=-1000pt -%}} - \parseargdef\need{% % Ensure vertical mode, so we don't make a big box in the middle of a % paragraph. @@ -825,7 +764,7 @@ % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current % paragraph. For more general purposes, use the \margin insertion -% class. WHICH is `l' or `r'. +% class. WHICH is `l' or `r'. Not documented, written for gawk manual. % \newskip\inmarginspacing \inmarginspacing=1cm \def\strutdepth{\dp\strutbox} @@ -872,15 +811,51 @@ \temp } -% @include file insert text of that file as input. +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). This command +% is not documented, not supported, and doesn't work. +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + +% @include FILE -- \input text of FILE. % \def\include{\parseargusing\filenamecatcodes\includezzz} \def\includezzz#1{% \pushthisfilestack \def\thisfile{#1}% {% - \makevalueexpandable - \def\temp{\input #1 }% + \makevalueexpandable % we want to expand any @value in FILE. + \turnoffactive % and allow special characters in the expansion + \indexnofonts % Allow `@@' and other weird things in file names. + \wlog{texinfo.tex: doing @include of #1^^J}% + \edef\temp{\noexpand\input #1 }% + % + % This trickery is to read FILE outside of a group, in case it makes + % definitions, etc. \expandafter }\temp \popthisfilestack @@ -895,6 +870,8 @@ \catcode`>=\other \catcode`+=\other \catcode`-=\other + \catcode`\`=\other + \catcode`\'=\other } \def\pushthisfilestack{% @@ -910,7 +887,7 @@ \def\popthisfilestack{\errthisfilestackempty} \def\errthisfilestackempty{\errmessage{Internal error: the stack of filenames is empty.}} - +% \def\thisfile{} % @center line @@ -918,36 +895,46 @@ % \parseargdef\center{% \ifhmode - \let\next\centerH + \let\centersub\centerH \else - \let\next\centerV + \let\centersub\centerV \fi - \next{\hfil \ignorespaces#1\unskip \hfil}% -} -\def\centerH#1{% - {% - \hfil\break - \advance\hsize by -\leftskip - \advance\hsize by -\rightskip - \line{#1}% - \break - }% -} -\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} + \centersub{\hfil \ignorespaces#1\unskip \hfil}% + \let\centersub\relax % don't let the definition persist, just in case +} +\def\centerH#1{{% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break +}} +% +\newcount\centerpenalty +\def\centerV#1{% + % The idea here is the same as in \startdefun, \cartouche, etc.: if + % @center is the first thing after a section heading, we need to wipe + % out the negative parskip inserted by \sectionheading, but still + % prevent a page break here. + \centerpenalty = \lastpenalty + \ifnum\centerpenalty>10000 \vskip\parskip \fi + \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi + \line{\kern\leftskip #1\kern\rightskip}% +} % @sp n outputs n lines of vertical space - +% \parseargdef\sp{\vskip #1\baselineskip} % @comment ...line which is ignored... % @c is the same as @comment % @ignore ... @end ignore is another way to write a comment - +% \def\comment{\begingroup \catcode`\^^M=\other% \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% \commentxxx} {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} - +% \let\c=\comment % @paragraphindent NCHARS @@ -1040,86 +1027,6 @@ } -% @asis just yields its argument. Used with @table, for example. -% -\def\asis#1{#1} - -% @math outputs its argument in math mode. -% -% One complication: _ usually means subscripts, but it could also mean -% an actual _ character, as in @math{@var{some_variable} + 1}. So make -% _ active, and distinguish by seeing if the current family is \slfam, -% which is what @var uses. -{ - \catcode\underChar = \active - \gdef\mathunderscore{% - \catcode\underChar=\active - \def_{\ifnum\fam=\slfam \_\else\sb\fi}% - } -} -% Another complication: we want \\ (and @\) to output a \ character. -% FYI, plain.tex uses \\ as a temporary control sequence (why?), but -% this is not advertised and we don't care. Texinfo does not -% otherwise define @\. -% -% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. -\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} -% -\def\math{% - \tex - \mathunderscore - \let\\ = \mathbackslash - \mathactive - $\finishmath -} -\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. - -% Some active characters (such as <) are spaced differently in math. -% We have to reset their definitions in case the @math was an argument -% to a command which sets the catcodes (such as @item or @section). -% -{ - \catcode`^ = \active - \catcode`< = \active - \catcode`> = \active - \catcode`+ = \active - \gdef\mathactive{% - \let^ = \ptexhat - \let< = \ptexless - \let> = \ptexgtr - \let+ = \ptexplus - } -} - -% @bullet and @minus need the same treatment as @math, just above. -\def\bullet{$\ptexbullet$} -\def\minus{$-$} - -% @dots{} outputs an ellipsis using the current font. -% We do .5em per period so that it has the same spacing in a typewriter -% font as three actual period characters. -% -\def\dots{% - \leavevmode - \hbox to 1.5em{% - \hskip 0pt plus 0.25fil - .\hfil.\hfil.% - \hskip 0pt plus 0.5fil - }% -} - -% @enddots{} is an end-of-sentence ellipsis. -% -\def\enddots{% - \dots - \spacefactor=\endofsentencespacefactor -} - -% @comma{} is so commas can be inserted into text without messing up -% Texinfo's parsing. -% -\let\comma = , - % @refill is a no-op. \let\refill=\relax @@ -1184,9 +1091,8 @@ \newif\ifpdfmakepagedest % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 -% can be set). So we test for \relax and 0 as well as \undefined, -% borrowed from ifpdf.sty. -\ifx\pdfoutput\undefined +% can be set). So we test for \relax and 0 as well as being undefined. +\ifx\pdfoutput\thisisundefined \else \ifx\pdfoutput\relax \else @@ -1197,99 +1103,156 @@ \fi \fi -% PDF uses PostScript string constants for the names of xref targets, to +% PDF uses PostScript string constants for the names of xref targets, % for display in the outlines, and in other places. Thus, we have to % double any backslashes. Otherwise, a name like "\node" will be % interpreted as a newline (\n), followed by o, d, e. Not good. -% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html -% (and related messages, the final outcome is that it is up to the TeX -% user to double the backslashes and otherwise make the string valid, so -% that's we do). - -% double active backslashes. % -{\catcode`\@=0 \catcode`\\=\active - @gdef at activebackslash{@catcode`@\=@active @otherbackslash} - @gdef at activebackslashdouble{% - @catcode at backChar=@active - @let\=@doublebackslash} -} - -% To handle parens, we must adopt a different approach, since parens are -% not active characters. hyperref.dtx (which has the same problem as -% us) handles it with this amazing macro to replace tokens. I've -% tinkered with it a little for texinfo, but it's definitely from there. -% -% #1 is the tokens to replace. -% #2 is the replacement. -% #3 is the control sequence with the string. -% -\def\HyPsdSubst#1#2#3{% - \def\HyPsdReplace##1#1##2\END{% - ##1% - \ifx\\##2\\% - \else - #2% - \HyReturnAfterFi{% - \HyPsdReplace##2\END +% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and +% related messages. The final outcome is that it is up to the TeX user +% to double the backslashes and otherwise make the string valid, so +% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to +% do this reliably, so we use it. + +% #1 is a control sequence in which to do the replacements, +% which we \xdef. +\def\txiescapepdf#1{% + \ifx\pdfescapestring\thisisundefined + % No primitive available; should we give a warning or log? + % Many times it won't matter. + \else + % The expandable \pdfescapestring primitive escapes parentheses, + % backslashes, and other special chars. + \xdef#1{\pdfescapestring{#1}}% + \fi +} + +\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images +with PDF output, and none of those formats could be found. (.eps cannot +be supported due to the design of the PDF format; use regular TeX (DVI +output) for that.)} + +\ifpdf + % + % Color manipulation macros based on pdfcolor.tex, + % except using rgb instead of cmyk; the latter is said to render as a + % very dark gray on-screen and a very dark halftone in print, instead + % of actual black. + \def\rgbDarkRed{0.50 0.09 0.12} + \def\rgbBlack{0 0 0} + % + % k sets the color for filling (usual text, etc.); + % K sets the color for stroking (thin rules, e.g., normal _'s). + \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} + % + % Set color, and create a mark which defines \thiscolor accordingly, + % so that \makeheadline knows which color to restore. + \def\setcolor#1{% + \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% + \domark + \pdfsetcolor{#1}% + } + % + \def\maincolor{\rgbBlack} + \pdfsetcolor{\maincolor} + \edef\thiscolor{\maincolor} + \def\lastcolordefs{} + % + \def\makefootline{% + \baselineskip24pt + \line{\pdfsetcolor{\maincolor}\the\footline}% + } + % + \def\makeheadline{% + \vbox to 0pt{% + \vskip-22.5pt + \line{% + \vbox to8.5pt{}% + % Extract \thiscolor definition from the marks. + \getcolormarks + % Typeset the headline with \maincolor, then restore the color. + \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% }% - \fi - }% - \xdef#3{\expandafter\HyPsdReplace#3#1\END}% -} -\long\def\HyReturnAfterFi#1\fi{\fi#1} - -% #1 is a control sequence in which to do the replacements. -\def\backslashparens#1{% - \xdef#1{#1}% redefine it as its expansion; the definition is simply - % \lastnode when called from \setref -> \pdfmkdest. - \HyPsdSubst{(}{\backslashlparen}{#1}% - \HyPsdSubst{)}{\backslashrparen}{#1}% -} - -{\catcode\exclamChar = 0 \catcode\backChar = \other - !gdef!backslashlparen{\(}% - !gdef!backslashrparen{\)}% -} - -\ifpdf - \input pdfcolor - \pdfcatalog{/PageMode /UseOutlines}% + \vss + }% + \nointerlineskip + } + % + % + \pdfcatalog{/PageMode /UseOutlines} + % + % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). \def\dopdfimage#1#2#3{% - \def\imagewidth{#2}% - \def\imageheight{#3}% - % without \immediate, pdftex seg faults when the same image is + \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% + \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% + % + % pdftex (and the PDF format) support .pdf, .png, .jpg (among + % others). Let's try in that order, PDF first since if + % someone has a scalable image, presumably better to use that than a + % bitmap. + \let\pdfimgext=\empty + \begingroup + \openin 1 #1.pdf \ifeof 1 + \openin 1 #1.PDF \ifeof 1 + \openin 1 #1.png \ifeof 1 + \openin 1 #1.jpg \ifeof 1 + \openin 1 #1.jpeg \ifeof 1 + \openin 1 #1.JPG \ifeof 1 + \errhelp = \nopdfimagehelp + \errmessage{Could not find image file #1 for pdf}% + \else \gdef\pdfimgext{JPG}% + \fi + \else \gdef\pdfimgext{jpeg}% + \fi + \else \gdef\pdfimgext{jpg}% + \fi + \else \gdef\pdfimgext{png}% + \fi + \else \gdef\pdfimgext{PDF}% + \fi + \else \gdef\pdfimgext{pdf}% + \fi + \closein 1 + \endgroup + % + % without \immediate, ancient pdftex seg faults when the same image is % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) \ifnum\pdftexversion < 14 \immediate\pdfimage \else \immediate\pdfximage \fi - \ifx\empty\imagewidth\else width \imagewidth \fi - \ifx\empty\imageheight\else height \imageheight \fi + \ifdim \wd0 >0pt width \pdfimagewidth \fi + \ifdim \wd2 >0pt height \pdfimageheight \fi \ifnum\pdftexversion<13 - #1.pdf% + #1.\pdfimgext \else - {#1.pdf}% + {#1.\pdfimgext}% \fi \ifnum\pdftexversion < 14 \else \pdfrefximage \pdflastximage \fi} + % \def\pdfmkdest#1{{% % We have to set dummies so commands such as @code, and characters % such as \, aren't expanded when present in a section title. - \atdummies - \activebackslashdouble + \indexnofonts + \turnoffactive + \makevalueexpandable \def\pdfdestname{#1}% - \backslashparens\pdfdestname - \pdfdest name{\pdfdestname} xyz% - }}% + \txiescapepdf\pdfdestname + \safewhatsit{\pdfdest name{\pdfdestname} xyz}% + }} % % used to mark target names; must be expandable. - \def\pdfmkpgn#1{#1}% - % - \let\linkcolor = \Blue % was Cyan, but that seems light? - \def\endlink{\Black\pdfendlink} + \def\pdfmkpgn#1{#1} + % + % by default, use a color that is dark enough to print on paper as + % nearly black, but still distinguishable for online viewing. + \def\urlcolor{\rgbDarkRed} + \def\linkcolor{\rgbDarkRed} + \def\endlink{\setcolor{\maincolor}\pdfendlink} + % % Adding outlines to PDF; macros for calculating structure of outlines % come from Petr Olsak \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% @@ -1309,29 +1272,24 @@ % page number. We could generate a destination for the section % text in the case where a section has no node, but it doesn't % seem worth the trouble, since most documents are normally structured. - \def\pdfoutlinedest{#3}% + \edef\pdfoutlinedest{#3}% \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}% \else - % Doubled backslashes in the name. - {\activebackslashdouble \xdef\pdfoutlinedest{#3}% - \backslashparens\pdfoutlinedest}% + \txiescapepdf\pdfoutlinedest \fi % - % Also double the backslashes in the display string. - {\activebackslashdouble \xdef\pdfoutlinetext{#1}% - \backslashparens\pdfoutlinetext}% + % Also escape PDF chars in the display string. + \edef\pdfoutlinetext{#1}% + \txiescapepdf\pdfoutlinetext % \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% } % \def\pdfmakeoutlines{% \begingroup - % Thanh's hack / proper braces in bookmarks - \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace - \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace - % % Read toc silently, to get counts of subentries for \pdfoutline. + \def\partentry##1##2##3##4{}% ignore parts in the outlines \def\numchapentry##1##2##3##4{% \def\thischapnum{##2}% \def\thissecnum{0}% @@ -1385,35 +1343,63 @@ % Latin 2 (0xea) gets translated to a | character. Info from % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. % - % xx to do this right, we have to translate 8-bit characters to - % their "best" equivalent, based on the @documentencoding. Right - % now, I guess we'll just let the pdf reader have its way. + % TODO this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Too + % much work for too little return. Just use the ASCII equivalents + % we use for the index sort strings. + % \indexnofonts \setupdatafile - \activebackslash - \input \jobname.toc + % We can have normal brace characters in the PDF outlines, unlike + % Texinfo index files. So set that up. + \def\{{\lbracecharliteral}% + \def\}{\rbracecharliteral}% + \catcode`\\=\active \otherbackslash + \input \tocreadfilename \endgroup } + {\catcode`[=1 \catcode`]=2 + \catcode`{=\other \catcode`}=\other + \gdef\lbracecharliteral[{]% + \gdef\rbracecharliteral[}]% + ] % \def\skipspaces#1{\def\PP{#1}\def\D{|}% \ifx\PP\D\let\nextsp\relax \else\let\nextsp\skipspaces - \ifx\p\space\else\addtokens{\filename}{\PP}% - \advance\filenamelength by 1 - \fi + \addtokens{\filename}{\PP}% + \advance\filenamelength by 1 \fi \nextsp} - \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + \def\getfilename#1{% + \filenamelength=0 + % If we don't expand the argument now, \skipspaces will get + % snagged on things like "@value{foo}". + \edef\temp{#1}% + \expandafter\skipspaces\temp|\relax + } \ifnum\pdftexversion < 14 \let \startlink \pdfannotlink \else \let \startlink \pdfstartlink \fi + % make a live url in pdf output. \def\pdfurl#1{% \begingroup - \normalturnoffactive\def\@{@}% + % it seems we really need yet another set of dummies; have not + % tried to figure out what each command should do in the context + % of @url. for now, just make @/ a no-op, that's the only one + % people have actually reported a problem with. + % + \normalturnoffactive + \def\@{@}% + \let\/=\empty \makevalueexpandable - \leavevmode\Red + % do we want to go so far as to use \indexnofonts instead of just + % special-casing \var here? + \def\var##1{##1}% + % + \leavevmode\setcolor{\urlcolor}% \startlink attr{/Border [0 0 0]}% user{/Subtype /Link /A << /S /URI /URI (#1) >>}% \endgroup} @@ -1440,13 +1426,15 @@ {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} \def\pdflink#1{% \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} - \linkcolor #1\endlink} + \setcolor{\linkcolor}#1\endlink} \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} \else + % non-pdf mode \let\pdfmkdest = \gobble \let\pdfurl = \gobble \let\endlink = \relax - \let\linkcolor = \relax + \let\setcolor = \gobble + \let\pdfsetcolor = \gobble \let\pdfmakeoutlines = \relax \fi % \ifx\pdfoutput @@ -1472,6 +1460,10 @@ \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} \def\tt{\fam=\ttfam \setfontstyle{tt}} +% Unfortunately, we have to override this for titles and the like, since +% in those cases "rm" is bold. Sigh. +\def\rmisbold{\rm\def\curfontstyle{bf}} + % Texinfo sort of supports the sans serif font style, which plain TeX does not. % So we set up a \sf. \newfam\sffam @@ -1481,8 +1473,6 @@ % We don't need math for this font style. \def\ttsl{\setfontstyle{ttsl}} -% Default leading. -\newdimen\textleading \textleading = 13.2pt % Set the baselineskip to #1, and the lineskip and strut size % correspondingly. There is no deep meaning behind these magic numbers @@ -1492,8 +1482,13 @@ \def\strutheightpercent{.70833} \def\strutdepthpercent {.29167} % +% can get a sort of poor man's double spacing by redefining this. +\def\baselinefactor{1} +% +\newdimen\textleading \def\setleading#1{% - \normalbaselineskip = #1\relax + \dimen0 = #1\relax + \normalbaselineskip = \baselinefactor\dimen0 \normallineskip = \lineskipfactor\normalbaselineskip \normalbaselines \setbox\strutbox =\hbox{% @@ -1502,20 +1497,295 @@ }% } -% Set the font macro #1 to the font named #2, adding on the -% specified font prefix (normally `cm'). -% #3 is the font's design size, #4 is a scale factor -\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} +% PDF CMaps. See also LaTeX's t1.cmap. +% +% do nothing with this by default. +\expandafter\let\csname cmapOT1\endcsname\gobble +\expandafter\let\csname cmapOT1IT\endcsname\gobble +\expandafter\let\csname cmapOT1TT\endcsname\gobble + +% if we are producing pdf, and we have \pdffontattr, then define cmaps. +% (\pdffontattr was introduced many years ago, but people still run +% older pdftex's; it's easy to conditionalize, so we do.) +\ifpdf \ifx\pdffontattr\thisisundefined \else + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1-0) +%%Title: (TeX-OT1-0 TeX OT1 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1) +/Supplement 0 +>> def +/CMapName /TeX-OT1-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<23> <26> <0023> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +40 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1IT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1IT-0) +%%Title: (TeX-OT1IT-0 TeX OT1IT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1IT) +/Supplement 0 +>> def +/CMapName /TeX-OT1IT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<25> <26> <0025> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +42 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<23> <0023> +<24> <00A3> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1IT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1TT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1TT-0) +%%Title: (TeX-OT1TT-0 TeX OT1TT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1TT) +/Supplement 0 +>> def +/CMapName /TeX-OT1TT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +5 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<21> <26> <0021> +<28> <5F> <0028> +<61> <7E> <0061> +endbfrange +32 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <2191> +<0C> <2193> +<0D> <0027> +<0E> <00A1> +<0F> <00BF> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<20> <2423> +<27> <2019> +<60> <2018> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1TT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +\fi\fi + + +% Set the font macro #1 to the font named \fontprefix#2. +% #3 is the font's design size, #4 is a scale factor, #5 is the CMap +% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit). +% Example: +% #1 = \textrm +% #2 = \rmshape +% #3 = 10 +% #4 = \mainmagstep +% #5 = OT1 +% +\def\setfont#1#2#3#4#5{% + \font#1=\fontprefix#2#3 scaled #4 + \csname cmap#5\endcsname#1% +} +% This is what gets called when #5 of \setfont is empty. +\let\cmap\gobble +% +% (end of cmaps) % Use cm as the default font prefix. % To specify the font prefix, you must define \fontprefix % before you read in texinfo.tex. -\ifx\fontprefix\undefined +\ifx\fontprefix\thisisundefined \def\fontprefix{cm} \fi % Support font families that don't use the same naming scheme as CM. \def\rmshape{r} -\def\rmbshape{bx} %where the normal face is bold +\def\rmbshape{bx} % where the normal face is bold \def\bfshape{b} \def\bxshape{bx} \def\ttshape{tt} @@ -1530,118 +1800,291 @@ \def\scshape{csc} \def\scbshape{csc} +% Definitions for a main text size of 11pt. (The default in Texinfo.) +% +\def\definetextfontsizexi{% % Text fonts (11.2pt, magstep1). \def\textnominalsize{11pt} \edef\mainmagstep{\magstephalf} -\setfont\textrm\rmshape{10}{\mainmagstep} -\setfont\texttt\ttshape{10}{\mainmagstep} -\setfont\textbf\bfshape{10}{\mainmagstep} -\setfont\textit\itshape{10}{\mainmagstep} -\setfont\textsl\slshape{10}{\mainmagstep} -\setfont\textsf\sfshape{10}{\mainmagstep} -\setfont\textsc\scshape{10}{\mainmagstep} -\setfont\textttsl\ttslshape{10}{\mainmagstep} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1095} % A few fonts for @defun names and args. -\setfont\defbf\bfshape{10}{\magstep1} -\setfont\deftt\ttshape{10}{\magstep1} -\setfont\defttsl\ttslshape{10}{\magstep1} +\setfont\defbf\bfshape{10}{\magstep1}{OT1} +\setfont\deftt\ttshape{10}{\magstep1}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} -\setfont\smallrm\rmshape{9}{1000} -\setfont\smalltt\ttshape{9}{1000} -\setfont\smallbf\bfshape{10}{900} -\setfont\smallit\itshape{9}{1000} -\setfont\smallsl\slshape{9}{1000} -\setfont\smallsf\sfshape{9}{1000} -\setfont\smallsc\scshape{10}{900} -\setfont\smallttsl\ttslshape{10}{900} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 +\def\smallecsize{0900} % Fonts for small examples (8pt). \def\smallernominalsize{8pt} -\setfont\smallerrm\rmshape{8}{1000} -\setfont\smallertt\ttshape{8}{1000} -\setfont\smallerbf\bfshape{10}{800} -\setfont\smallerit\itshape{8}{1000} -\setfont\smallersl\slshape{8}{1000} -\setfont\smallersf\sfshape{8}{1000} -\setfont\smallersc\scshape{10}{800} -\setfont\smallerttsl\ttslshape{10}{800} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 +\def\smallerecsize{0800} % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} -\setfont\titlerm\rmbshape{12}{\magstep3} -\setfont\titleit\itbshape{10}{\magstep4} -\setfont\titlesl\slbshape{10}{\magstep4} -\setfont\titlett\ttbshape{12}{\magstep3} -\setfont\titlettsl\ttslshape{10}{\magstep4} -\setfont\titlesf\sfbshape{17}{\magstep1} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm -\setfont\titlesc\scbshape{10}{\magstep4} +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 -\def\authorrm{\secrm} -\def\authortt{\sectt} +\def\titleecsize{2074} % Chapter (and unnumbered) fonts (17.28pt). \def\chapnominalsize{17pt} -\setfont\chaprm\rmbshape{12}{\magstep2} -\setfont\chapit\itbshape{10}{\magstep3} -\setfont\chapsl\slbshape{10}{\magstep3} -\setfont\chaptt\ttbshape{12}{\magstep2} -\setfont\chapttsl\ttslshape{10}{\magstep3} -\setfont\chapsf\sfbshape{17}{1000} +\setfont\chaprm\rmbshape{12}{\magstep2}{OT1} +\setfont\chapit\itbshape{10}{\magstep3}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep3}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} +\setfont\chapsf\sfbshape{17}{1000}{OT1} \let\chapbf=\chaprm -\setfont\chapsc\scbshape{10}{\magstep3} +\setfont\chapsc\scbshape{10}{\magstep3}{OT1} \font\chapi=cmmi12 scaled \magstep2 \font\chapsy=cmsy10 scaled \magstep3 +\def\chapecsize{1728} % Section fonts (14.4pt). \def\secnominalsize{14pt} -\setfont\secrm\rmbshape{12}{\magstep1} -\setfont\secit\itbshape{10}{\magstep2} -\setfont\secsl\slbshape{10}{\magstep2} -\setfont\sectt\ttbshape{12}{\magstep1} -\setfont\secttsl\ttslshape{10}{\magstep2} -\setfont\secsf\sfbshape{12}{\magstep1} +\setfont\secrm\rmbshape{12}{\magstep1}{OT1} +\setfont\secit\itbshape{10}{\magstep2}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep2}{OT1} +\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\secsf\sfbshape{12}{\magstep1}{OT1} \let\secbf\secrm -\setfont\secsc\scbshape{10}{\magstep2} +\setfont\secsc\scbshape{10}{\magstep2}{OT1} \font\seci=cmmi12 scaled \magstep1 \font\secsy=cmsy10 scaled \magstep2 +\def\sececsize{1440} % Subsection fonts (13.15pt). \def\ssecnominalsize{13pt} -\setfont\ssecrm\rmbshape{12}{\magstephalf} -\setfont\ssecit\itbshape{10}{1315} -\setfont\ssecsl\slbshape{10}{1315} -\setfont\ssectt\ttbshape{12}{\magstephalf} -\setfont\ssecttsl\ttslshape{10}{1315} -\setfont\ssecsf\sfbshape{12}{\magstephalf} +\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} +\setfont\ssecit\itbshape{10}{1315}{OT1IT} +\setfont\ssecsl\slbshape{10}{1315}{OT1} +\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} +\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} \let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{1315} +\setfont\ssecsc\scbshape{10}{1315}{OT1} \font\sseci=cmmi12 scaled \magstephalf \font\ssecsy=cmsy10 scaled 1315 +\def\ssececsize{1200} % Reduced fonts for @acro in text (10pt). \def\reducednominalsize{10pt} -\setfont\reducedrm\rmshape{10}{1000} -\setfont\reducedtt\ttshape{10}{1000} -\setfont\reducedbf\bfshape{10}{1000} -\setfont\reducedit\itshape{10}{1000} -\setfont\reducedsl\slshape{10}{1000} -\setfont\reducedsf\sfshape{10}{1000} -\setfont\reducedsc\scshape{10}{1000} -\setfont\reducedttsl\ttslshape{10}{1000} +\setfont\reducedrm\rmshape{10}{1000}{OT1} +\setfont\reducedtt\ttshape{10}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{1000}{OT1} +\setfont\reducedit\itshape{10}{1000}{OT1IT} +\setfont\reducedsl\slshape{10}{1000}{OT1} +\setfont\reducedsf\sfshape{10}{1000}{OT1} +\setfont\reducedsc\scshape{10}{1000}{OT1} +\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} \font\reducedi=cmmi10 \font\reducedsy=cmsy10 +\def\reducedecsize{1000} + +\textleading = 13.2pt % line spacing for 11pt CM +\textfonts % reset the current fonts +\rm +} % end of 11pt text font size definitions, \definetextfontsizexi + + +% Definitions to make the main text be 10pt Computer Modern, with +% section, chapter, etc., sizes following suit. This is for the GNU +% Press printing of the Emacs 22 manual. Maybe other manuals in the +% future. Used with @smallbook, which sets the leading to 12pt. +% +\def\definetextfontsizex{% +% Text fonts (10pt). +\def\textnominalsize{10pt} +\edef\mainmagstep{1000} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1000} + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstephalf}{OT1} +\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 +\def\smallecsize{0900} + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 +\def\smallerecsize{0800} + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\titleecsize{2074} + +% Chapter fonts (14.4pt). +\def\chapnominalsize{14pt} +\setfont\chaprm\rmbshape{12}{\magstep1}{OT1} +\setfont\chapit\itbshape{10}{\magstep2}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep2}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\chapsf\sfbshape{12}{\magstep1}{OT1} +\let\chapbf\chaprm +\setfont\chapsc\scbshape{10}{\magstep2}{OT1} +\font\chapi=cmmi12 scaled \magstep1 +\font\chapsy=cmsy10 scaled \magstep2 +\def\chapecsize{1440} + +% Section fonts (12pt). +\def\secnominalsize{12pt} +\setfont\secrm\rmbshape{12}{1000}{OT1} +\setfont\secit\itbshape{10}{\magstep1}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep1}{OT1} +\setfont\sectt\ttbshape{12}{1000}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} +\setfont\secsf\sfbshape{12}{1000}{OT1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep1}{OT1} +\font\seci=cmmi12 +\font\secsy=cmsy10 scaled \magstep1 +\def\sececsize{1200} + +% Subsection fonts (10pt). +\def\ssecnominalsize{10pt} +\setfont\ssecrm\rmbshape{10}{1000}{OT1} +\setfont\ssecit\itbshape{10}{1000}{OT1IT} +\setfont\ssecsl\slbshape{10}{1000}{OT1} +\setfont\ssectt\ttbshape{10}{1000}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} +\setfont\ssecsf\sfbshape{10}{1000}{OT1} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1000}{OT1} +\font\sseci=cmmi10 +\font\ssecsy=cmsy10 +\def\ssececsize{1000} + +% Reduced fonts for @acro in text (9pt). +\def\reducednominalsize{9pt} +\setfont\reducedrm\rmshape{9}{1000}{OT1} +\setfont\reducedtt\ttshape{9}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{900}{OT1} +\setfont\reducedit\itshape{9}{1000}{OT1IT} +\setfont\reducedsl\slshape{9}{1000}{OT1} +\setfont\reducedsf\sfshape{9}{1000}{OT1} +\setfont\reducedsc\scshape{10}{900}{OT1} +\setfont\reducedttsl\ttslshape{10}{900}{OT1TT} +\font\reducedi=cmmi9 +\font\reducedsy=cmsy9 +\def\reducedecsize{0900} + +\divide\parskip by 2 % reduce space between paragraphs +\textleading = 12pt % line spacing for 10pt CM +\textfonts % reset the current fonts +\rm +} % end of 10pt text font size definitions, \definetextfontsizex + + +% We provide the user-level command +% @fonttextsize 10 +% (or 11) to redefine the text font size. pt is assumed. +% +\def\xiword{11} +\def\xword{10} +\def\xwordpt{10pt} +% +\parseargdef\fonttextsize{% + \def\textsizearg{#1}% + %\wlog{doing @fonttextsize \textsizearg}% + % + % Set \globaldefs so that documents can use this inside @tex, since + % makeinfo 4.8 does not support it, but we need it nonetheless. + % + \begingroup \globaldefs=1 + \ifx\textsizearg\xword \definetextfontsizex + \else \ifx\textsizearg\xiword \definetextfontsizexi + \else + \errhelp=\EMsimple + \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} + \fi\fi + \endgroup +} + % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. Since @@ -1681,8 +2124,8 @@ \let\tenttsl=\titlettsl \def\curfontsize{title}% \def\lsize{chap}\def\lllsize{subsec}% - \resetmathfonts \setleading{25pt}} -\def\titlefont#1{{\titlefonts\rm #1}} + \resetmathfonts \setleading{27pt}} +\def\titlefont#1{{\titlefonts\rmisbold #1}} \def\chapfonts{% \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc @@ -1733,6 +2176,16 @@ \def\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{9.5pt}} +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000}{OT1} +\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000}{OT1} +\setfont\shortconttt\ttshape{12}{1000}{OT1TT} + +% Define these just so they can be easily changed for other fonts. +\def\angleleft{$\langle$} +\def\angleright{$\rangle$} + % Set the fonts to use with the @small... environments. \let\smallexamplefonts = \smallfonts @@ -1746,53 +2199,215 @@ % % By the way, for comparison, here's what fits with @example (10pt): % 8.5x11=71 smallbook=60 a4=75 a5=58 -% -% I wish the USA used A4 paper. % --karl, 24jan03. - % Set up the default fonts, so we can use them for creating boxes. % -\textfonts \rm - -% Define these so they can be easily changed for other fonts. -\def\angleleft{$\langle$} -\def\angleright{$\rangle$} +\definetextfontsizexi + + +\message{markup,} + +% Check if we are currently using a typewriter font. Since all the +% Computer Modern typewriter fonts have zero interword stretch (and +% shrink), and it is reasonable to expect all typewriter fonts to have +% this property, we can check that font parameter. +% +\def\ifmonospace{\ifdim\fontdimen3\font=0pt } + +% Markup style infrastructure. \defmarkupstylesetup\INITMACRO will +% define and register \INITMACRO to be called on markup style changes. +% \INITMACRO can check \currentmarkupstyle for the innermost +% style and the set of \ifmarkupSTYLE switches for all styles +% currently in effect. +\newif\ifmarkupvar +\newif\ifmarkupsamp +\newif\ifmarkupkey +%\newif\ifmarkupfile % @file == @samp. +%\newif\ifmarkupoption % @option == @samp. +\newif\ifmarkupcode +\newif\ifmarkupkbd +%\newif\ifmarkupenv % @env == @code. +%\newif\ifmarkupcommand % @command == @code. +\newif\ifmarkuptex % @tex (and part of @math, for now). +\newif\ifmarkupexample +\newif\ifmarkupverb +\newif\ifmarkupverbatim + +\let\currentmarkupstyle\empty + +\def\setupmarkupstyle#1{% + \csname markup#1true\endcsname + \def\currentmarkupstyle{#1}% + \markupstylesetup +} + +\let\markupstylesetup\empty + +\def\defmarkupstylesetup#1{% + \expandafter\def\expandafter\markupstylesetup + \expandafter{\markupstylesetup #1}% + \def#1% +} + +% Markup style setup for left and right quotes. +\defmarkupstylesetup\markupsetuplq{% + \expandafter\let\expandafter \temp + \csname markupsetuplq\currentmarkupstyle\endcsname + \ifx\temp\relax \markupsetuplqdefault \else \temp \fi +} + +\defmarkupstylesetup\markupsetuprq{% + \expandafter\let\expandafter \temp + \csname markupsetuprq\currentmarkupstyle\endcsname + \ifx\temp\relax \markupsetuprqdefault \else \temp \fi +} + +{ +\catcode`\'=\active +\catcode`\`=\active + +\gdef\markupsetuplqdefault{\let`\lq} +\gdef\markupsetuprqdefault{\let'\rq} + +\gdef\markupsetcodequoteleft{\let`\codequoteleft} +\gdef\markupsetcodequoteright{\let'\codequoteright} + +\gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft} +} + +\let\markupsetuplqcode \markupsetcodequoteleft +\let\markupsetuprqcode \markupsetcodequoteright +% +\let\markupsetuplqexample \markupsetcodequoteleft +\let\markupsetuprqexample \markupsetcodequoteright +% +\let\markupsetuplqsamp \markupsetcodequoteleft +\let\markupsetuprqsamp \markupsetcodequoteright +% +\let\markupsetuplqverb \markupsetcodequoteleft +\let\markupsetuprqverb \markupsetcodequoteright +% +\let\markupsetuplqverbatim \markupsetcodequoteleft +\let\markupsetuprqverbatim \markupsetcodequoteright + +\let\markupsetuplqkbd \markupsetnoligaturesquoteleft + +% Allow an option to not use regular directed right quote/apostrophe +% (char 0x27), but instead the undirected quote from cmtt (char 0x0d). +% The undirected quote is ugly, so don't make it the default, but it +% works for pasting with more pdf viewers (at least evince), the +% lilypond developers report. xpdf does work with the regular 0x27. +% +\def\codequoteright{% + \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax + \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax + '% + \else \char'15 \fi + \else \char'15 \fi +} +% +% and a similar option for the left quote char vs. a grave accent. +% Modern fonts display ASCII 0x60 as a grave accent, so some people like +% the code environments to do likewise. +% +\def\codequoteleft{% + \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax + \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax + % [Knuth] pp. 380,381,391 + % \relax disables Spanish ligatures ?` and !` of \tt font. + \relax`% + \else \char'22 \fi + \else \char'22 \fi +} + +% Commands to set the quote options. +% +\parseargdef\codequoteundirected{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxicodequoteundirected\endcsname + = t% + \else\ifx\temp\offword + \expandafter\let\csname SETtxicodequoteundirected\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% + \fi\fi +} +% +\parseargdef\codequotebacktick{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxicodequotebacktick\endcsname + = t% + \else\ifx\temp\offword + \expandafter\let\csname SETtxicodequotebacktick\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% + \fi\fi +} + +% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. +\def\noligaturesquoteleft{\relax\lq} % Count depth in font-changes, for error checks \newcount\fontdepth \fontdepth=0 -% Fonts for short table of contents. -\setfont\shortcontrm\rmshape{12}{1000} -\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 -\setfont\shortcontsl\slshape{12}{1000} -\setfont\shortconttt\ttshape{12}{1000} - -%% Add scribe-like font environments, plus @l for inline lisp (usually sans -%% serif) and @ii for TeX italic - -% \smartitalic{ARG} outputs arg in italics, followed by an italic correction -% unless the following character is such as not to need one. -\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else - \ptexslash\fi\fi\fi} -\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} -\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} - -% like \smartslanted except unconditionally uses \ttsl. +% Font commands. + +% #1 is the font command (\sl or \it), #2 is the text to slant. +% If we are in a monospaced environment, however, 1) always use \ttsl, +% and 2) do not add an italic correction. +\def\dosmartslant#1#2{% + \ifusingtt + {{\ttsl #2}\let\next=\relax}% + {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}% + \next +} +\def\smartslanted{\dosmartslant\sl} +\def\smartitalic{\dosmartslant\it} + +% Output an italic correction unless \next (presumed to be the following +% character) is such as not to need one. +\def\smartitaliccorrection{% + \ifx\next,% + \else\ifx\next-% + \else\ifx\next.% + \else\ptexslash + \fi\fi\fi + \aftersmartic +} + +% like \smartslanted except unconditionally uses \ttsl, and no ic. % @var is set to this for defun arguments. -\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} - -% like \smartslanted except unconditionally use \sl. We never want +\def\ttslanted#1{{\ttsl #1}} + +% @cite is like \smartslanted except unconditionally use \sl. We never want % ttsl for book titles, do we? -\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} +\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection} + +\def\aftersmartic{} +\def\var#1{% + \let\saveaftersmartic = \aftersmartic + \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% + \smartslanted{#1}% +} \let\i=\smartitalic \let\slanted=\smartslanted -\let\var=\smartslanted \let\dfn=\smartslanted \let\emph=\smartitalic -% @b, explicit bold. +% Explicit font changes: @r, @sc, undocumented @ii. +\def\r#1{{\rm #1}} % roman font +\def\sc#1{{\smallcaps#1}} % smallcaps font +\def\ii#1{{\it #1}} % italic font + +% @b, explicit bold. Also @strong. \def\b#1{{\bf #1}} \let\strong=\b @@ -1824,21 +2439,35 @@ \catcode`@=\other \def\endofsentencespacefactor{3000}% default +% @t, explicit typewriter. \def\t#1{% {\tt \rawbackslash \plainfrenchspacing #1}% \null } -\def\samp#1{`\tclose{#1}'\null} -\setfont\keyrm\rmshape{8}{1000} -\font\keysy=cmsy9 -\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% - \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% - \vbox{\hrule\kern-0.4pt - \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% - \kern-0.4pt\hrule}% - \kern-.06em\raise0.4pt\hbox{\angleright}}}} -% The old definition, with no lozenge: -%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} + +% @samp. +\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} + +% definition of @key that produces a lozenge. Doesn't adjust to text size. +%\setfont\keyrm\rmshape{8}{1000}{OT1} +%\font\keysy=cmsy9 +%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% +% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% +% \vbox{\hrule\kern-0.4pt +% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% +% \kern-0.4pt\hrule}% +% \kern-.06em\raise0.4pt\hbox{\angleright}}}} + +% definition of @key with no lozenge. If the current font is already +% monospace, don't change it; that way, we respect @kbdinputstyle. But +% if it isn't monospace, then use \tt. +% +\def\key#1{{\setupmarkupstyle{key}% + \nohyphenation + \ifmonospace\else\tt\fi + #1}\null} + +% ctrl is no longer a Texinfo command. \def\ctrl #1{{\tt \rawbackslash \hat}#1} % @file, @option are the same as @samp. @@ -1865,7 +2494,7 @@ \plainfrenchspacing #1% }% - \null + \null % reset spacefactor to 1000 } % We *must* turn on hyphenation at `-' and `_' in @code. @@ -1878,11 +2507,14 @@ % and arrange explicitly to hyphenate at a dash. % -- rms. { - \catcode`\-=\active - \catcode`\_=\active + \catcode`\-=\active \catcode`\_=\active + \catcode`\'=\active \catcode`\`=\active + \global\let'=\rq \global\let`=\lq % default definitions % \global\def\code{\begingroup - \catcode`\-=\active \catcode`\_=\active + \setupmarkupstyle{code}% + % The following should really be moved into \setupmarkupstyle handlers. + \catcode\dashChar=\active \catcode\underChar=\active \ifallowcodebreaks \let-\codedash \let_\codeunder @@ -1894,6 +2526,8 @@ } } +\def\codex #1{\tclose{#1}\endgroup} + \def\realdash{-} \def\codedash{-\discretionary{}{}{}} \def\codeunder{% @@ -1907,13 +2541,12 @@ \discretionary{}{}{}}% {\_}% } -\def\codex #1{\tclose{#1}\endgroup} % An additional complication: the above will allow breaks after, e.g., % each of the four underscores in __typeof__. This is undesirable in % some manuals, especially if they don't have long identifiers in % general. @allowcodebreaks provides a way to control this. -% +% \newif\ifallowcodebreaks \allowcodebreakstrue \def\keywordtrue{true} @@ -1927,55 +2560,18 @@ \allowcodebreaksfalse \else \errhelp = \EMsimple - \errmessage{Unknown @allowcodebreaks option `\txiarg'}% + \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% \fi\fi } -% @kbd is like @code, except that if the argument is just one @key command, -% then @kbd has no effect. - -% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), -% `example' (@kbd uses ttsl only inside of @example and friends), -% or `code' (@kbd uses normal tty font always). -\parseargdef\kbdinputstyle{% - \def\txiarg{#1}% - \ifx\txiarg\worddistinct - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% - \else\ifx\txiarg\wordexample - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% - \else\ifx\txiarg\wordcode - \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% - \else - \errhelp = \EMsimple - \errmessage{Unknown @kbdinputstyle option `\txiarg'}% - \fi\fi\fi -} -\def\worddistinct{distinct} -\def\wordexample{example} -\def\wordcode{code} - -% Default is `distinct.' -\kbdinputstyle distinct - -\def\xkey{\key} -\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% -\ifx\one\xkey\ifx\threex\three \key{#2}% -\else{\tclose{\kbdfont\look}}\fi -\else{\tclose{\kbdfont\look}}\fi} - -% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. -\let\indicateurl=\code -\let\env=\code -\let\command=\code - % @uref (abbreviation for `urlref') takes an optional (comma-separated) % second argument specifying the text to display and an optional third % arg as text to display instead of (rather than in addition to) the url -% itself. First (mandatory) arg is the url. Perhaps eventually put in -% a hypertex \special here. -% -\def\uref#1{\douref #1,,,\finish} -\def\douref#1,#2,#3,#4\finish{\begingroup +% itself. First (mandatory) arg is the url. +% (This \urefnobreak definition isn't used now, leaving it for a while +% for comparison.) +\def\urefnobreak#1{\dourefnobreak #1,,,\finish} +\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup \unsepspaces \pdfurl{#1}% \setbox0 = \hbox{\ignorespaces #3}% @@ -1996,6 +2592,103 @@ \endlink \endgroup} +% This \urefbreak definition is the active one. +\def\urefbreak{\begingroup \urefcatcodes \dourefbreak} +\let\uref=\urefbreak +\def\dourefbreak#1{\urefbreakfinish #1,,,\finish} +\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \urefcode{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% Allow line breaks around only a few characters (only). +\def\urefcatcodes{% + \catcode\ampChar=\active \catcode\dotChar=\active + \catcode\hashChar=\active \catcode\questChar=\active + \catcode\slashChar=\active +} +{ + \urefcatcodes + % + \global\def\urefcode{\begingroup + \setupmarkupstyle{code}% + \urefcatcodes + \let&\urefcodeamp + \let.\urefcodedot + \let#\urefcodehash + \let?\urefcodequest + \let/\urefcodeslash + \codex + } + % + % By default, they are just regular characters. + \global\def&{\normalamp} + \global\def.{\normaldot} + \global\def#{\normalhash} + \global\def?{\normalquest} + \global\def/{\normalslash} +} + +% we put a little stretch before and after the breakable chars, to help +% line breaking of long url's. The unequal skips make look better in +% cmtt at least, especially for dots. +\def\urefprestretch{\urefprebreak \hskip0pt plus.13em } +\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em } +% +\def\urefcodeamp{\urefprestretch \&\urefpoststretch} +\def\urefcodedot{\urefprestretch .\urefpoststretch} +\def\urefcodehash{\urefprestretch \#\urefpoststretch} +\def\urefcodequest{\urefprestretch ?\urefpoststretch} +\def\urefcodeslash{\futurelet\next\urefcodeslashfinish} +{ + \catcode`\/=\active + \global\def\urefcodeslashfinish{% + \urefprestretch \slashChar + % Allow line break only after the final / in a sequence of + % slashes, to avoid line break between the slashes in http://. + \ifx\next/\else \urefpoststretch \fi + } +} + +% One more complication: by default we'll break after the special +% characters, but some people like to break before the special chars, so +% allow that. Also allow no breaking at all, for manual control. +% +\parseargdef\urefbreakstyle{% + \def\txiarg{#1}% + \ifx\txiarg\wordnone + \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} + \else\ifx\txiarg\wordbefore + \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak} + \else\ifx\txiarg\wordafter + \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak} + \else + \errhelp = \EMsimple + \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% + \fi\fi\fi +} +\def\wordafter{after} +\def\wordbefore{before} +\def\wordnone{none} + +\urefbreakstyle after + % @url synonym for @uref, since that's how everyone uses it. % \let\url=\uref @@ -2017,34 +2710,65 @@ \let\email=\uref \fi -% Check if we are currently using a typewriter font. Since all the -% Computer Modern typewriter fonts have zero interword stretch (and -% shrink), and it is reasonable to expect all typewriter fonts to have -% this property, we can check that font parameter. -% -\def\ifmonospace{\ifdim\fontdimen3\font=0pt } +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. +\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}} + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\parseargdef\kbdinputstyle{% + \def\txiarg{#1}% + \ifx\txiarg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\txiarg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\txiarg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is `distinct'. +\kbdinputstyle distinct + +\def\xkey{\key} +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% +\ifx\one\xkey\ifx\threex\three \key{#2}% +\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi +\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi} + +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code +\let\env=\code +\let\command=\code + +% @clicksequence{File @click{} Open ...} +\def\clicksequence#1{\begingroup #1\endgroup} + +% @clickstyle @arrow (by default) +\parseargdef\clickstyle{\def\click{#1}} +\def\click{\arrow} % Typeset a dimension, e.g., `in' or `pt'. The only reason for the % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. % \def\dmn#1{\thinspace #1} -\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} - % @l was never documented to mean ``switch to the Lisp font'', % and it is not used as such in any manual I can find. We need it for % Polish suppressed-l. --karl, 22sep96. %\def\l#1{{\li #1}\null} -% Explicit font changes: @r, @sc, undocumented @ii. -\def\r#1{{\rm #1}} % roman font -\def\sc#1{{\smallcaps#1}} % smallcaps font -\def\ii#1{{\it #1}} % italic font - % @acronym for "FBI", "NATO", and the like. % We print this one point size smaller, since it's intended for % all-uppercase. -% +% \def\acronym#1{\doacronym #1,,\finish} \def\doacronym#1,#2,#3\finish{% {\selectfonts\lsize #1}% @@ -2052,11 +2776,12 @@ \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi + \null % reset \spacefactor=1000 } % @abbr for "Comput. J." and the like. % No font change, but don't do end-of-sentence spacing. -% +% \def\abbr#1{\doabbr #1,,\finish} \def\doabbr#1,#2,#3\finish{% {\plainfrenchspacing #1}% @@ -2064,7 +2789,254 @@ \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi -} + \null % reset \spacefactor=1000 +} + +% @asis just yields its argument. Used with @table, for example. +% +\def\asis#1{#1} + +% @math outputs its argument in math mode. +% +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode`\_ = \active + \gdef\mathunderscore{% + \catcode`\_=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} +% Another complication: we want \\ (and @\) to output a math (or tt) \. +% FYI, plain.tex uses \\ as a temporary control sequence (for no +% particular reason), but this is not advertised and we don't care. +% +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + % make the texinfo accent commands work in math mode + \let\"=\ddot + \let\'=\acute + \let\==\bar + \let\^=\hat + \let\`=\grave + \let\u=\breve + \let\v=\check + \let\~=\tilde + \let\dotaccent=\dot + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \catcode`' = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + \let' = \ptexquoteright + } +} + +% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. +% Ignore unless FMTNAME == tex; then it is like @iftex and @tex, +% except specified as a normal braced arg, so no newlines to worry about. +% +\def\outfmtnametex{tex} +% +\long\def\inlinefmt#1{\doinlinefmt #1,\finish} +\long\def\doinlinefmt#1,#2,\finish{% + \def\inlinefmtname{#1}% + \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi +} +% For raw, must switch into @tex before parsing the argument, to avoid +% setting catcodes prematurely. Doing it this way means that, for +% example, @inlineraw{html, foo{bar} gets a parse error instead of being +% ignored. But this isn't important because if people want a literal +% *right* brace they would have to use a command anyway, so they may as +% well use a command to get a left brace too. We could re-use the +% delimiter character idea from \verb, but it seems like overkill. +% +\long\def\inlineraw{\tex \doinlineraw} +\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish} +\def\doinlinerawtwo#1,#2,\finish{% + \def\inlinerawname{#1}% + \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi + \endgroup % close group opened by \tex. +} + + +\message{glyphs,} +% and logos. + +% @@ prints an @, as does @atchar{}. +\def\@{\char64 } +\let\atchar=\@ + +% @{ @} @lbracechar{} @rbracechar{} all generate brace characters. +% Unless we're in typewriter, use \ecfont because the CM text fonts do +% not have braces, and we don't want to switch into math. +\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}} +\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}} +\let\{=\mylbrace \let\lbracechar=\{ +\let\}=\myrbrace \let\rbracechar=\} +\begingroup + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux/toc files. + \catcode`\{ = \other \catcode`\} = \other + \catcode`\[ = 1 \catcode`\] = 2 + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup + +% @comma{} to avoid , parsing problems. +\let\comma = , + +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. +\let\, = \ptexc +\let\dotaccent = \ptexdot +\def\ringaccent#1{{\accent23 #1}} +\let\tieaccent = \ptext +\let\ubaraccent = \ptexb +\let\udotaccent = \d + +% Other special characters: @questiondown @exclamdown @ordf @ordm +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. +\def\questiondown{?`} +\def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} + +% Dotless i and dotless j, used for accents. +\def\imacro{i} +\def\jmacro{j} +\def\dotless#1{% + \def\temp{#1}% + \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi + \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi + \else \errmessage{@dotless can be used only with i or j}% + \fi\fi +} + +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=1000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{% + \ifx\textnominalsize\xwordpt + % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX. + % Revert to plain's \scriptsize, which is 7pt. + \count255=\the\fam $\fam\count255 \scriptstyle A$% + \else + % For 11pt, we can use our lllsize. + \selectfonts\lllsize A% + \fi + }% + \vss + }}% + \kern-.15em + \TeX +} + +% Some math mode symbols. +\def\bullet{$\ptexbullet$} +\def\geq{\ifmmode \ge\else $\ge$\fi} +\def\leq{\ifmmode \le\else $\le$\fi} +\def\minus{\ifmmode -\else $-$\fi} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in the cm +% typewriter fonts as three actual period characters; on the other hand, +% in other typewriter fonts three periods are wider than 1.5em. So do +% whichever is larger. +% +\def\dots{% + \leavevmode + \setbox0=\hbox{...}% get width of three periods + \ifdim\wd0 > 1.5em + \dimen0 = \wd0 + \else + \dimen0 = 1.5em + \fi + \hbox to \dimen0{% + \hskip 0pt plus.25fil + .\hskip 0pt plus1fil + .\hskip 0pt plus1fil + .\hskip 0pt plus.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=\endofsentencespacefactor +} + +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% +% Since these characters are used in examples, they should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% +\def\point{$\star$} +\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} +\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} +\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} +\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} + +% The @error{} command. +% Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% +{\tentt \global\dimen0 = 3em}% Width of the box. +\dimen2 = .55pt % Thickness of rules +% The text. (`r' is open on the right, `e' somewhat less so on the left.) +\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} +% +\setbox\errorbox=\hbox to \dimen0{\hfil + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. + \advance\hsize by -2\dimen2 % Rules. + \vbox{% + \hrule height\dimen2 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. + \kern3pt\vrule width\dimen2}% Space to right. + \hrule height\dimen2} + \hfil} +% +\def\error{\leavevmode\lower.7ex\copy\errorbox} % @pounds{} is a sterling sign, which Knuth put in the CM italic font. % @@ -2075,49 +3047,113 @@ % Theiling, which support regular, slanted, bold and bold slanted (and % "outlined" (blackboard board, sort of) versions, which we don't need). % It is available from http://www.ctan.org/tex-archive/fonts/eurosym. -% +% % Although only regular is the truly official Euro symbol, we ignore % that. The Euro is designed to be slightly taller than the regular % font height. -% +% % feymr - regular % feymo - slanted % feybr - bold % feybo - bold slanted -% +% % There is no good (free) typewriter version, to my knowledge. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. % Hmm. -% +% % Also doesn't work in math. Do we need to do math with euro symbols? % Hope not. -% -% +% +% \def\euro{{\eurofont e}} \def\eurofont{% % We set the font at each command, rather than predefining it in % \textfonts and the other font-switching commands, so that % installations which never need the symbol don't have to have the % font installed. - % + % % There is only one designed size (nominal 10pt), so we always scale % that to the current nominal size. - % + % % By the way, simply using "at 1em" works for cmr10 and the like, but % does not work for cmbx10 and other extended/shrunken fonts. - % + % \def\eurosize{\csname\curfontsize nominalsize\endcsname}% % - \ifx\curfontstyle\bfstylename + \ifx\curfontstyle\bfstylename % bold: \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize - \else + \else % regular: \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize \fi \thiseurofont } +% Glyphs from the EC fonts. We don't use \let for the aliases, because +% sometimes we redefine the original macro, and the alias should reflect +% the redefinition. +% +% Use LaTeX names for the Icelandic letters. +\def\DH{{\ecfont \char"D0}} % Eth +\def\dh{{\ecfont \char"F0}} % eth +\def\TH{{\ecfont \char"DE}} % Thorn +\def\th{{\ecfont \char"FE}} % thorn +% +\def\guillemetleft{{\ecfont \char"13}} +\def\guillemotleft{\guillemetleft} +\def\guillemetright{{\ecfont \char"14}} +\def\guillemotright{\guillemetright} +\def\guilsinglleft{{\ecfont \char"0E}} +\def\guilsinglright{{\ecfont \char"0F}} +\def\quotedblbase{{\ecfont \char"12}} +\def\quotesinglbase{{\ecfont \char"0D}} +% +% This positioning is not perfect (see the ogonek LaTeX package), but +% we have the precomposed glyphs for the most common cases. We put the +% tests to use those glyphs in the single \ogonek macro so we have fewer +% dummy definitions to worry about for index entries, etc. +% +% ogonek is also used with other letters in Lithuanian (IOU), but using +% the precomposed glyphs for those is not so easy since they aren't in +% the same EC font. +\def\ogonek#1{{% + \def\temp{#1}% + \ifx\temp\macrocharA\Aogonek + \else\ifx\temp\macrochara\aogonek + \else\ifx\temp\macrocharE\Eogonek + \else\ifx\temp\macrochare\eogonek + \else + \ecfont \setbox0=\hbox{#1}% + \ifdim\ht0=1ex\accent"0C #1% + \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% + \fi + \fi\fi\fi\fi + }% +} +\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} +\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} +\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} +\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} +% +% Use the ec* fonts (cm-super in outline format) for non-CM glyphs. +\def\ecfont{% + % We can't distinguish serif/sans and italic/slanted, but this + % is used for crude hacks anyway (like adding French and German + % quotes to documents typeset with CM, where we lose kerning), so + % hopefully nobody will notice/care. + \edef\ecsize{\csname\curfontsize ecsize\endcsname}% + \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% + \ifx\curfontstyle\bfstylename + % bold: + \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize + \else + % regular: + \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize + \fi + \thisecfont +} + % @registeredsymbol - R in a circle. The font for the R should really % be smaller yet, but lllsize is the best we can do for now. % Adapted from the plain.tex definition of \copyright. @@ -2128,14 +3164,24 @@ }$% } +% @textdegree - the normal degrees sign. +% +\def\textdegree{$^\circ$} + % Laurent Siebenmann reports \Orb undefined with: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 % so we'll define it if necessary. -% -\ifx\Orb\undefined +% +\ifx\Orb\thisisundefined \def\Orb{\mathhexbox20D} \fi +% Quotes. +\chardef\quotedblleft="5C +\chardef\quotedblright=`\" +\chardef\quoteleft=`\` +\chardef\quoteright=`\' + \message{page headings,} @@ -2154,8 +3200,9 @@ \newif\ifsetshortcontentsaftertitlepage \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue -\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% - \endgroup\page\hbox{}\page} +\parseargdef\shorttitlepage{% + \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} \envdef\titlepage{% % Open one extra group, as we want to close it in the middle of \Etitlepage. @@ -2215,17 +3262,14 @@ \finishedtitlepagetrue } -%%% Macros to be used within @titlepage: +% Macros to be used within @titlepage: \let\subtitlerm=\tenrm \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} -\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines - \let\tt=\authortt} - \parseargdef\title{% \checkenv\titlepage - \leftline{\titlefonts\rm #1} + \leftline{\titlefonts\rmisbold #1} % print a rule at the page bottom also. \finishedtitlepagefalse \vskip4pt \hrule height 4pt width \hsize \vskip4pt @@ -2246,12 +3290,12 @@ \else \checkenv\titlepage \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi - {\authorfont \leftline{#1}}% + {\secfonts\rmisbold \leftline{#1}}% \fi } -%%% Set up page headings and footings. +% Set up page headings and footings. \let\thispage=\folio @@ -2299,12 +3343,39 @@ % % Leave some space for the footline. Hopefully ok to assume % @evenfooting will not be used by itself. - \global\advance\pageheight by -\baselineskip - \global\advance\vsize by -\baselineskip + \global\advance\pageheight by -12pt + \global\advance\vsize by -12pt } \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} +% @evenheadingmarks top \thischapter <- chapter at the top of a page +% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page +% +% The same set of arguments for: +% +% @oddheadingmarks +% @evenfootingmarks +% @oddfootingmarks +% @everyheadingmarks +% @everyfootingmarks + +\def\evenheadingmarks{\headingmarks{even}{heading}} +\def\oddheadingmarks{\headingmarks{odd}{heading}} +\def\evenfootingmarks{\headingmarks{even}{footing}} +\def\oddfootingmarks{\headingmarks{odd}{footing}} +\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} + \headingmarks{odd}{heading}{#1} } +\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} + \headingmarks{odd}{footing}{#1} } +% #1 = even/odd, #2 = heading/footing, #3 = top/bottom. +\def\headingmarks#1#2#3 {% + \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname + \global\expandafter\let\csname get#1#2marks\endcsname \temp +} + +\everyheadingmarks bottom +\everyfootingmarks bottom % @headings double turns headings on for double-sided printing. % @headings single turns headings on for single-sided printing. @@ -2318,10 +3389,14 @@ \def\headings #1 {\csname HEADINGS#1\endcsname} -\def\HEADINGSoff{% -\global\evenheadline={\hfil} \global\evenfootline={\hfil} -\global\oddheadline={\hfil} \global\oddfootline={\hfil}} -\HEADINGSoff +\def\headingsoff{% non-global headings elimination + \evenheadline={\hfil}\evenfootline={\hfil}% + \oddheadline={\hfil}\oddfootline={\hfil}% +} + +\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting +\HEADINGSoff % it's the default + % When we turn headings on, set the page number to 1. % For double-sided printing, put current file name in lower left corner, % chapter name on inside top of right hand pages, document @@ -2372,7 +3447,7 @@ % This produces Day Month Year style of output. % Only define if not already defined, in case a txi-??.tex file has set % up a different format (e.g., txi-cs.tex does this). -\ifx\today\undefined +\ifx\today\thisisundefined \def\today{% \number\day\space \ifcase\month @@ -2433,7 +3508,7 @@ \begingroup \advance\leftskip by-\tableindent \advance\hsize by\tableindent - \advance\rightskip by0pt plus1fil + \advance\rightskip by0pt plus1fil\relax \leavevmode\unhbox0\par \endgroup % @@ -2447,7 +3522,7 @@ % cause the example and the item to crash together. So we use this % bizarre value of 10001 as a signal to \aboveenvbreak to insert % \parskip glue after all. Section titles are handled this way also. - % + % \penalty 10001 \endgroup \itemxneedsnegativevskipfalse @@ -2541,9 +3616,18 @@ \parindent=0pt \parskip=\smallskipamount \ifdim\parskip=0pt \parskip=2pt \fi + % + % Try typesetting the item mark that if the document erroneously says + % something like @itemize @samp (intending @table), there's an error + % right away at the @itemize. It's not the best error message in the + % world, but it's better than leaving it to the @item. This means if + % the user wants an empty mark, they have to say @w{} not just @w. \def\itemcontents{#1}% + \setbox0 = \hbox{\itemcontents}% + % % @itemize with no arg is equivalent to @itemize @bullet. \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + % \let\item=\itemizeitem } @@ -2564,6 +3648,7 @@ \ifnum\lastpenalty<10000 \parskip=0in \fi \noindent \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + % \vadjust{\penalty 1200}}% not good to break after first line of item. \flushcr } @@ -2785,12 +3870,19 @@ % % @headitem starts a heading row, which we typeset in bold. % Assignments have to be global since we are inside the implicit group -% of an alignment entry. Note that \everycr resets \everytab. -\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% +% of an alignment entry. \everycr resets \everytab so we don't have to +% undo it ourselves. +\def\headitemfont{\b}% for people to use in the template row; not changeable +\def\headitem{% + \checkenv\multitable + \crcr + \global\everytab={\bf}% can't use \headitemfont since the parsing differs + \the\everytab % for the first item +}% % % A \tab used to include \hskip1sp. But then the space in a template % line is not enough. That is bad. So let's go back to just `&' until -% we encounter the problem it was intended to solve again. +% we again encounter the problem the 1sp was intended to solve. % --karl, nathan at acm.org, 20apr99. \def\tab{\checkenv\multitable &\the\everytab}% @@ -2902,18 +3994,18 @@ \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip \global\advance\multitablelinespace by-\ht0 \fi -%% Test to see if parskip is larger than space between lines of -%% table. If not, do nothing. -%% If so, set to same dimension as multitablelinespace. +% Test to see if parskip is larger than space between lines of +% table. If not, do nothing. +% If so, set to same dimension as multitablelinespace. \ifdim\multitableparskip>\multitablelinespace \global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. +\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller + % than skip between lines in the table. \fi% \ifdim\multitableparskip=0pt \global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. +\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller + % than skip between lines in the table. \fi} @@ -2959,6 +4051,7 @@ \def\doignore#1{\begingroup % Scan in ``verbatim'' mode: + \obeylines \catcode`\@ = \other \catcode`\{ = \other \catcode`\} = \other @@ -2979,16 +4072,16 @@ \gdef\dodoignore#1{% % #1 contains the command name as a string, e.g., `ifinfo'. % - % Define a command to find the next `@end #1', which must be on a line - % by itself. - \long\def\doignoretext##1^^M at end #1{\doignoretextyyy##1^^M@#1\_STOP_}% + % Define a command to find the next `@end #1'. + \long\def\doignoretext##1^^M at end #1{% + \doignoretextyyy##1^^M@#1\_STOP_}% + % % And this command to find another #1 command, at the beginning of a % line. (Otherwise, we would consider a line `@c @ifset', for % example, to count as an @ifset for nesting.) \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% % % And now expand that command. - \obeylines % \doignoretext ^^M% }% } @@ -3018,7 +4111,12 @@ } % Finish off ignored text. -\def\enddoignore{\endgroup\ignorespaces} +{ \obeylines% + % Ignore anything after the last `@end #1'; this matters in verbatim + % environments, where otherwise the newline after an ignored conditional + % would result in a blank line in the output. + \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% +} % @set VAR sets the variable VAR to an empty value. @@ -3183,11 +4281,11 @@ \def\dosynindex#1#2#3{% % Only do \closeout if we haven't already done it, else we'll end up % closing the target index. - \expandafter \ifx\csname donesynindex#2\endcsname \undefined + \expandafter \ifx\csname donesynindex#2\endcsname \relax % The \closeout helps reduce unnecessary open files; the limit on the % Acorn RISC OS is a mere 16 files. \expandafter\closeout\csname#2indfile\endcsname - \expandafter\let\csname\donesynindex#2\endcsname = 1 + \expandafter\let\csname donesynindex#2\endcsname = 1 \fi % redefine \fooindfile: \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname @@ -3221,11 +4319,41 @@ \escapechar = `\\ % use backslash in output files. \def\@{@}% change to @@ when we switch to @ as escape char in index files. \def\ {\realbackslash\space }% - % Need these in case \tex is in effect and \{ is a \delimiter again. - % But can't use \lbracecmd and \rbracecmd because texindex assumes - % braces and backslashes are used only as delimiters. - \let\{ = \mylbrace - \let\} = \myrbrace + % + % Need these unexpandable (because we define \tt as a dummy) + % definitions when @{ or @} appear in index entry text. Also, more + % complicated, when \tex is in effect and \{ is a \delimiter again. + % We can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. Perhaps we + % should define @lbrace and @rbrace commands a la @comma. + \def\{{{\tt\char123}}% + \def\}{{\tt\char125}}% + % + % I don't entirely understand this, but when an index entry is + % generated from a macro call, the \endinput which \scanmacro inserts + % causes processing to be prematurely terminated. This is, + % apparently, because \indexsorttmp is fully expanded, and \endinput + % is an expandable command. The redefinition below makes \endinput + % disappear altogether for that purpose -- although logging shows that + % processing continues to some further point. On the other hand, it + % seems \endinput does not hurt in the printed index arg, since that + % is still getting written without apparent harm. + % + % Sample source (mac-idx3.tex, reported by Graham Percival to + % help-texinfo, 22may06): + % @macro funindex {WORD} + % @findex xyz + % @end macro + % ... + % @funindex commtest + % + % The above is not enough to reproduce the bug, but it gives the flavor. + % + % Sample whatsit resulting: + % . at write3{\entry{xyz}{@folio }{@code {xyz at endinput }}} + % + % So: + \let\endinput = \empty % % Do the redefinitions. \commondummies @@ -3244,6 +4372,7 @@ % % Do the redefinitions. \commondummies + \otherbackslash } % Called from \indexdummies and \atdummies. @@ -3251,7 +4380,7 @@ \def\commondummies{% % % \definedummyword defines \#1 as \string\#1\space, thus effectively - % preventing its expansion. This is used only for control% words, + % preventing its expansion. This is used only for control words, % not control letters, because the \space would be incorrect for % control characters, but is needed to separate the control word % from whatever follows. @@ -3270,23 +4399,28 @@ \commondummiesnofonts % \definedummyletter\_% + \definedummyletter\-% % % Non-English letters. \definedummyword\AA \definedummyword\AE + \definedummyword\DH \definedummyword\L + \definedummyword\O \definedummyword\OE - \definedummyword\O + \definedummyword\TH \definedummyword\aa \definedummyword\ae + \definedummyword\dh + \definedummyword\exclamdown \definedummyword\l + \definedummyword\o \definedummyword\oe - \definedummyword\o - \definedummyword\ss - \definedummyword\exclamdown - \definedummyword\questiondown \definedummyword\ordf \definedummyword\ordm + \definedummyword\questiondown + \definedummyword\ss + \definedummyword\th % % Although these internal commands shouldn't show up, sometimes they do. \definedummyword\bf @@ -3302,21 +4436,39 @@ \definedummyword\TeX % % Assorted special characters. + \definedummyword\arrow \definedummyword\bullet \definedummyword\comma \definedummyword\copyright \definedummyword\registeredsymbol \definedummyword\dots \definedummyword\enddots + \definedummyword\entrybreak \definedummyword\equiv \definedummyword\error \definedummyword\euro \definedummyword\expansion + \definedummyword\geq + \definedummyword\guillemetleft + \definedummyword\guillemetright + \definedummyword\guilsinglleft + \definedummyword\guilsinglright + \definedummyword\lbracechar + \definedummyword\leq \definedummyword\minus + \definedummyword\ogonek \definedummyword\pounds \definedummyword\point \definedummyword\print + \definedummyword\quotedblbase + \definedummyword\quotedblleft + \definedummyword\quotedblright + \definedummyword\quoteleft + \definedummyword\quoteright + \definedummyword\quotesinglbase + \definedummyword\rbracechar \definedummyword\result + \definedummyword\textdegree % % We want to disable all macros so that they are not expanded by \write. \macrolist @@ -3330,63 +4482,72 @@ % \commondummiesnofonts: common to \commondummies and \indexnofonts. % -% Better have this without active chars. -{ - \catcode`\~=\other - \gdef\commondummiesnofonts{% - % Control letters and accents. - \definedummyletter\!% - \definedummyaccent\"% - \definedummyaccent\'% - \definedummyletter\*% - \definedummyaccent\,% - \definedummyletter\.% - \definedummyletter\/% - \definedummyletter\:% - \definedummyaccent\=% - \definedummyletter\?% - \definedummyaccent\^% - \definedummyaccent\`% - \definedummyaccent\~% - \definedummyword\u - \definedummyword\v - \definedummyword\H - \definedummyword\dotaccent - \definedummyword\ringaccent - \definedummyword\tieaccent - \definedummyword\ubaraccent - \definedummyword\udotaccent - \definedummyword\dotless - % - % Texinfo font commands. - \definedummyword\b - \definedummyword\i - \definedummyword\r - \definedummyword\sc - \definedummyword\t - % - % Commands that take arguments. - \definedummyword\acronym - \definedummyword\cite - \definedummyword\code - \definedummyword\command - \definedummyword\dfn - \definedummyword\emph - \definedummyword\env - \definedummyword\file - \definedummyword\kbd - \definedummyword\key - \definedummyword\math - \definedummyword\option - \definedummyword\samp - \definedummyword\strong - \definedummyword\tie - \definedummyword\uref - \definedummyword\url - \definedummyword\var - \definedummyword\verb - \definedummyword\w - } +\def\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter\!% + \definedummyaccent\"% + \definedummyaccent\'% + \definedummyletter\*% + \definedummyaccent\,% + \definedummyletter\.% + \definedummyletter\/% + \definedummyletter\:% + \definedummyaccent\=% + \definedummyletter\?% + \definedummyaccent\^% + \definedummyaccent\`% + \definedummyaccent\~% + \definedummyword\u + \definedummyword\v + \definedummyword\H + \definedummyword\dotaccent + \definedummyword\ogonek + \definedummyword\ringaccent + \definedummyword\tieaccent + \definedummyword\ubaraccent + \definedummyword\udotaccent + \definedummyword\dotless + % + % Texinfo font commands. + \definedummyword\b + \definedummyword\i + \definedummyword\r + \definedummyword\sansserif + \definedummyword\sc + \definedummyword\slanted + \definedummyword\t + % + % Commands that take arguments. + \definedummyword\abbr + \definedummyword\acronym + \definedummyword\anchor + \definedummyword\cite + \definedummyword\code + \definedummyword\command + \definedummyword\dfn + \definedummyword\dmn + \definedummyword\email + \definedummyword\emph + \definedummyword\env + \definedummyword\file + \definedummyword\image + \definedummyword\indicateurl + \definedummyword\inforef + \definedummyword\kbd + \definedummyword\key + \definedummyword\math + \definedummyword\option + \definedummyword\pxref + \definedummyword\ref + \definedummyword\samp + \definedummyword\strong + \definedummyword\tie + \definedummyword\uref + \definedummyword\url + \definedummyword\var + \definedummyword\verb + \definedummyword\w + \definedummyword\xref } % \indexnofonts is used when outputting the strings to sort the index @@ -3399,7 +4560,7 @@ \def\definedummyaccent##1{\let##1\asis}% % We can just ignore other control letters. \def\definedummyletter##1{\let##1\empty}% - % Hopefully, all control words can become @asis. + % All control words become @asis by default; overrides below. \let\definedummyword\definedummyaccent % \commondummiesnofonts @@ -3411,60 +4572,95 @@ % \def\ { }% \def\@{@}% - % how to handle braces? \def\_{\normalunderscore}% + \def\-{}% @- shouldn't affect sorting + % + % Unfortunately, texindex is not prepared to handle braces in the + % content at all. So for index sorting, we map @{ and @} to strings + % starting with |, since that ASCII character is between ASCII { and }. + \def\{{|a}% + \def\lbracechar{|a}% + % + \def\}{|b}% + \def\rbracechar{|b}% % % Non-English letters. \def\AA{AA}% \def\AE{AE}% + \def\DH{DZZ}% \def\L{L}% \def\OE{OE}% \def\O{O}% + \def\TH{ZZZ}% \def\aa{aa}% \def\ae{ae}% + \def\dh{dzz}% + \def\exclamdown{!}% \def\l{l}% \def\oe{oe}% - \def\o{o}% - \def\ss{ss}% - \def\exclamdown{!}% - \def\questiondown{?}% \def\ordf{a}% \def\ordm{o}% + \def\o{o}% + \def\questiondown{?}% + \def\ss{ss}% + \def\th{zzz}% % \def\LaTeX{LaTeX}% \def\TeX{TeX}% % % Assorted special characters. % (The following {} will end up in the sort string, but that's ok.) + \def\arrow{->}% \def\bullet{bullet}% \def\comma{,}% \def\copyright{copyright}% - \def\registeredsymbol{R}% \def\dots{...}% \def\enddots{...}% \def\equiv{==}% \def\error{error}% \def\euro{euro}% \def\expansion{==>}% + \def\geq{>=}% + \def\guillemetleft{<<}% + \def\guillemetright{>>}% + \def\guilsinglleft{<}% + \def\guilsinglright{>}% + \def\leq{<=}% \def\minus{-}% + \def\point{.}% \def\pounds{pounds}% - \def\point{.}% \def\print{-|}% + \def\quotedblbase{"}% + \def\quotedblleft{"}% + \def\quotedblright{"}% + \def\quoteleft{`}% + \def\quoteright{'}% + \def\quotesinglbase{,}% + \def\registeredsymbol{R}% \def\result{=>}% + \def\textdegree{o}% + % + \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax + \else \indexlquoteignore \fi % % We need to get rid of all macros, leaving only the arguments (if present). % Of course this is not nearly correct, but it is the best we can do for now. % makeinfo does not expand macros in the argument to @deffn, which ends up % writing an index entry, and texindex isn't prepared for an index sort entry % that starts with \. - % + % % Since macro invocations are followed by braces, we can just redefine them % to take a single TeX argument. The case of a macro invocation that % goes to end-of-line is not handled. - % + % \macrolist } +% Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us +% ignore left quotes in the sort term. +{\catcode`\`=\active + \gdef\indexlquoteignore{\let`=\empty}} + \let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? @@ -3490,11 +4686,7 @@ % \edef\writeto{\csname#1indfile\endcsname}% % - \ifvmode - \dosubindsanitize - \else - \dosubindwrite - \fi + \safewhatsit\dosubindwrite }% \fi } @@ -3531,13 +4723,13 @@ \temp } -% Take care of unwanted page breaks: +% Take care of unwanted page breaks/skips around a whatsit: % % If a skip is the last thing on the list now, preserve it % by backing up by \lastskip, doing the \write, then inserting % the skip again. Otherwise, the whatsit generated by the -% \write will make \lastskip zero. The result is that sequences -% like this: +% \write or \pdfdest will make \lastskip zero. The result is that +% sequences like this: % @end defun % @tindex whatever % @defun ... @@ -3561,25 +4753,30 @@ % \edef\zeroskipmacro{\expandafter\the\csname z at skip\endcsname} % +\newskip\whatsitskip +\newcount\whatsitpenalty +% % ..., ready, GO: % -\def\dosubindsanitize{% +\def\safewhatsit#1{\ifhmode + #1% + \else % \lastskip and \lastpenalty cannot both be nonzero simultaneously. - \skip0 = \lastskip + \whatsitskip = \lastskip \edef\lastskipmacro{\the\lastskip}% - \count255 = \lastpenalty + \whatsitpenalty = \lastpenalty % % If \lastskip is nonzero, that means the last item was a % skip. And since a skip is discardable, that means this - % -\skip0 glue we're inserting is preceded by a + % -\whatsitskip glue we're inserting is preceded by a % non-discardable item, therefore it is not a potential % breakpoint, therefore no \nobreak needed. \ifx\lastskipmacro\zeroskipmacro \else - \vskip-\skip0 + \vskip-\whatsitskip \fi % - \dosubindwrite + #1% % \ifx\lastskipmacro\zeroskipmacro % If \lastskip was zero, perhaps the last item was a penalty, and @@ -3587,20 +4784,19 @@ % to re-insert the same penalty (values >10000 are used for various % signals); since we just inserted a non-discardable item, any % following glue (such as a \parskip) would be a breakpoint. For example: - % % @deffn deffn-whatever % @vindex index-whatever % Description. % would allow a break between the index-whatever whatsit % and the "Description." paragraph. - \ifnum\count255>9999 \penalty\count255 \fi + \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi \else % On the other hand, if we had a nonzero \lastskip, % this make-up glue would be preceded by a non-discardable item % (the whatsit from the \write), so we must insert a \nobreak. - \nobreak\vskip\skip0 + \nobreak\vskip\whatsitskip \fi -} +\fi} % The index entry written in the file actually looks like % \entry {sortstring}{page}{topic} @@ -3642,6 +4838,7 @@ % \smallfonts \rm \tolerance = 9500 + \plainfrenchspacing \everypar = {}% don't want the \kern\-parindent from indentation suppression. % % See if the index file exists and is nonempty. @@ -3715,10 +4912,9 @@ % % A straightforward implementation would start like this: % \def\entry#1#2{... -% But this frozes the catcodes in the argument, and can cause problems to +% But this freezes the catcodes in the argument, and can cause problems to % @code, which sets - active. This problem was fixed by a kludge--- % ``-'' was active throughout whole index, but this isn't really right. -% % The right solution is to prevent \entry from swallowing the whole text. % --kasal, 21nov03 \def\entry{% @@ -3755,10 +4951,17 @@ % columns. \vskip 0pt plus1pt % + % When reading the text of entry, convert explicit line breaks + % from @* into spaces. The user might give these in long section + % titles, for instance. + \def\*{\unskip\space\ignorespaces}% + \def\entrybreak{\hfil\break}% + % % Swallow the left brace of the text (first parameter): \afterassignment\doentry \let\temp = } +\def\entrybreak{\unskip\space\ignorespaces}% \def\doentry{% \bgroup % Instead of the swallowed brace. \noindent @@ -3771,11 +4974,8 @@ % The following is kludged to not output a line of dots in the index if % there are no page numbers. The next person who breaks this will be % cursed by a Unix daemon. - \def\tempa{{\rm }}% - \def\tempb{#1}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd + \setbox\boxA = \hbox{#1}% + \ifdim\wd\boxA = 0pt \ % \else % @@ -3799,9 +4999,9 @@ \endgroup } -% Like \dotfill except takes at least 1 em. +% Like plain.tex's \dotfill, except uses up at least 1 em. \def\indexdotfill{\cleaders - \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} + \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} \def\primary #1{\line{#1\hfil}} @@ -3911,6 +5111,34 @@ % % All done with double columns. \def\enddoublecolumns{% + % The following penalty ensures that the page builder is exercised + % _before_ we change the output routine. This is necessary in the + % following situation: + % + % The last section of the index consists only of a single entry. + % Before this section, \pagetotal is less than \pagegoal, so no + % break occurs before the last section starts. However, the last + % section, consisting of \initial and the single \entry, does not + % fit on the page and has to be broken off. Without the following + % penalty the page builder will not be exercised until \eject + % below, and by that time we'll already have changed the output + % routine to the \balancecolumns version, so the next-to-last + % double-column page will be processed with \balancecolumns, which + % is wrong: The two columns will go to the main vertical list, with + % the broken-off section in the recent contributions. As soon as + % the output routine finishes, TeX starts reconsidering the page + % break. The two columns and the broken-off section both fit on the + % page, because the two columns now take up only half of the page + % goal. When TeX sees \eject from below which follows the final + % section, it invokes the new output routine that we've set after + % \balancecolumns below; \onepageout will try to fit the two columns + % and the final section into the vbox of \pageheight (see + % \pagebody), causing an overfull box. + % + % Note that glue won't work here, because glue does not exercise the + % page builder, unlike penalties (see The TeXbook, pp. 280-281). + \penalty0 + % \output = {% % Split the last of the double-column material. Leave it on the % current page, no automatic page break. @@ -3966,7 +5194,22 @@ \message{sectioning,} % Chapters, sections, etc. -% \unnumberedno is an oxymoron, of course. But we count the unnumbered +% Let's start with @part. +\outer\parseargdef\part{\partzzz{#1}} +\def\partzzz#1{% + \chapoddpage + \null + \vskip.3\vsize % move it down on the page a bit + \begingroup + \noindent \titlefonts\rmisbold #1\par % the text + \let\lastnode=\empty % no node to associate with + \writetocentry{part}{#1}{}% but put it in the toc + \headingsoff % no headline or footline on the part page + \chapoddpage + \endgroup +} + +% \unnumberedno is an oxymoron. But we count the unnumbered % sections so that we can refer to them unambiguously in the pdf % outlines by their "section number". We avoid collisions with chapter % numbers by starting them at 10000. (If a document ever has 10000 @@ -4020,11 +5263,15 @@ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} -% Each @chapter defines this as the name of the chapter. -% page headings and footings can use it. @section does likewise. -% However, they are not reliable, because we don't use marks. +% Each @chapter defines these (using marks) as the number+name, number +% and name of the chapter. Page headings and footings can use +% these. @section does likewise. \def\thischapter{} +\def\thischapternum{} +\def\thischaptername{} \def\thissection{} +\def\thissectionnum{} +\def\thissectionname{} \newcount\absseclevel % used to calculate proper heading level \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count @@ -4041,8 +5288,8 @@ \chardef\maxseclevel = 3 % % A numbered section within an unnumbered changes to unnumbered too. -% To achive this, remember the "biggest" unnum. sec. we are currently in: -\chardef\unmlevel = \maxseclevel +% To achieve this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unnlevel = \maxseclevel % % Trace whether the current chapter is an appendix or not: % \chapheadtype is "N" or "A", unnumbered chapters are ignored. @@ -4067,8 +5314,8 @@ % The heading type: \def\headtype{#1}% \if \headtype U% - \ifnum \absseclevel < \unmlevel - \chardef\unmlevel = \absseclevel + \ifnum \absseclevel < \unnlevel + \chardef\unnlevel = \absseclevel \fi \else % Check for appendix sections: @@ -4080,10 +5327,10 @@ \fi\fi \fi % Check for numbered within unnumbered: - \ifnum \absseclevel > \unmlevel + \ifnum \absseclevel > \unnlevel \def\headtype{U}% \else - \chardef\unmlevel = 3 + \chardef\unnlevel = 3 \fi \fi % Now print the heading: @@ -4137,7 +5384,9 @@ \gdef\chaplevelprefix{\the\chapno.}% \resetallfloatnos % - \message{\putwordChapter\space \the\chapno}% + % \putwordChapter can contain complex things in translations. + \toks0=\expandafter{\putwordChapter}% + \message{\the\toks0 \space \the\chapno}% % % Write the actual heading. \chapmacro{#1}{Ynumbered}{\the\chapno}% @@ -4148,15 +5397,17 @@ \global\let\subsubsection = \numberedsubsubsec } -\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz +\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz +% \def\appendixzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\appendixno by 1 \gdef\chaplevelprefix{\appendixletter.}% \resetallfloatnos % - \def\appendixnum{\putwordAppendix\space \appendixletter}% - \message{\appendixnum}% + % \putwordAppendix can contain complex things in translations. + \toks0=\expandafter{\putwordAppendix}% + \message{\the\toks0 \space \appendixletter}% % \chapmacro{#1}{Yappendix}{\appendixletter}% % @@ -4165,7 +5416,8 @@ \global\let\subsubsection = \appendixsubsubsec } -\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz +% normally unnmhead0 calls unnumberedzzz: +\outer\parseargdef\unnumbered{\unnmhead0{#1}} \def\unnumberedzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\unnumberedno by 1 @@ -4209,40 +5461,47 @@ \let\top\unnumbered % Sections. +% \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz \def\seczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% } -\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz +% normally calls appendixsectionzzz: +\outer\parseargdef\appendixsection{\apphead1{#1}} \def\appendixsectionzzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% } \let\appendixsec\appendixsection -\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz +% normally calls unnumberedseczzz: +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} \def\unnumberedseczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% } % Subsections. -\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz +% +% normally calls numberedsubseczzz: +\outer\parseargdef\numberedsubsec{\numhead2{#1}} \def\numberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% } -\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz +% normally calls appendixsubseczzz: +\outer\parseargdef\appendixsubsec{\apphead2{#1}} \def\appendixsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno}% } -\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz +% normally calls unnumberedsubseczzz: +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} \def\unnumberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynothing}% @@ -4250,21 +5509,25 @@ } % Subsubsections. -\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz +% +% normally numberedsubsubseczzz: +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} \def\numberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynumbered}% {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% } -\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz +% normally appendixsubsubseczzz: +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} \def\appendixsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% } -\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz +% normally unnumberedsubsubseczzz: +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} \def\unnumberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynothing}% @@ -4288,7 +5551,6 @@ % 3) Likewise, headings look best if no \parindent is used, and % if justification is not attempted. Hence \raggedright. - \def\majorheading{% {\advance\chapheadingskip by 10pt \chapbreak }% \parsearg\chapheadingzzz @@ -4297,8 +5559,8 @@ \def\chapheading{\chapbreak \parsearg\chapheadingzzz} \def\chapheadingzzz#1{% {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}% + \parindent=0pt\ptexraggedright + \rmisbold #1\hfill}}% \bigskip \par\penalty 200\relax \suppressfirstparagraphindent } @@ -4315,17 +5577,28 @@ % (including whitespace, linebreaking, etc. around it), % given all the information in convenient, parsed form. -%%% Args are the skip and penalty (usually negative) +% Args are the skip and penalty (usually negative) \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} -%%% Define plain chapter starts, and page on/off switching for it % Parameter controlling skip before chapter headings (if needed) - \newskip\chapheadingskip +% Define plain chapter starts, and page on/off switching for it. \def\chapbreak{\dobreak \chapheadingskip {-4000}} \def\chappager{\par\vfill\supereject} -\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} +% Because \domark is called before \chapoddpage, the filler page will +% get the headings for the next chapter, which is wrong. But we don't +% care -- we just disable all headings on the filler page. +\def\chapoddpage{% + \chappager + \ifodd\pageno \else + \begingroup + \headingsoff + \null + \chappager + \endgroup + \fi +} \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} @@ -4359,41 +5632,78 @@ \def\Yappendixkeyword{Yappendix} % \def\chapmacro#1#2#3{% + % Insert the first mark before the heading break (see notes for \domark). + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% + \gdef\thissection{}}% + % + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{\thischaptername}}% + \else\ifx\temptype\Yomitfromtockeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{}}% + \else\ifx\temptype\Yappendixkeyword + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\appendixletter}% + % \noexpand\putwordAppendix avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thischapter{\noexpand\putwordAppendix{} + \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \else + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\the\chapno}% + % \noexpand\putwordChapter avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thischapter{\noexpand\putwordChapter{} + \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \fi\fi\fi + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark + % + % Insert the chapter heading break. \pchapsepmacro + % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \domark + % {% - \chapfonts \rm + \chapfonts \rmisbold % - % Have to define \thissection before calling \donoderef, because the + % Have to define \lastsection before calling \donoderef, because the % xref code eventually uses it. On the other hand, it has to be called % after \pchapsepmacro, or the headline will change too soon. - \gdef\thissection{#1}% - \gdef\thischaptername{#1}% + \gdef\lastsection{#1}% % % Only insert the separating space if we have a chapter/appendix % number, and don't print the unnumbered ``number''. - \def\temptype{#2}% \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unnchap}% - \gdef\thischapter{#1}% \else\ifx\temptype\Yomitfromtockeyword \setbox0 = \hbox{}% contents like unnumbered, but no toc entry \def\toctype{omit}% - \gdef\thischapter{}% \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% \def\toctype{app}% - % We don't substitute the actual chapter name into \thischapter - % because we don't want its macros evaluated now. And we don't - % use \thissection because that changes with each section. - % - \xdef\thischapter{\putwordAppendix{} \appendixletter: - \noexpand\thischaptername}% \else \setbox0 = \hbox{#3\enspace}% \def\toctype{numchap}% - \xdef\thischapter{\putwordChapter{} \the\chapno: - \noexpand\thischaptername}% \fi\fi\fi % % Write the toc entry for this chapter. Must come before the @@ -4409,7 +5719,8 @@ \donoderef{#2}% % % Typeset the actual heading. - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \nobreak % Avoid page breaks at the interline glue. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright \hangindent=\wd0 \centerparametersmaybe \unhbox0 #1\par}% }% @@ -4433,8 +5744,8 @@ % \def\unnchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\nobreak + \parindent=0pt\ptexraggedright + \rmisbold #1\hfill}}\bigskip \par\nobreak } \def\chfopen #1#2{\chapoddpage {\chapfonts \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% @@ -4443,7 +5754,7 @@ \def\centerchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt - \hfill {\rm #1}\hfill}}\bigskip \par\nobreak + \hfill {\rmisbold #1}\hfill}}\bigskip \par\nobreak } \def\CHAPFopen{% \global\let\chapmacro=\chfopen @@ -4471,47 +5782,110 @@ % the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the % section number. % +\def\seckeyword{sec} +% \def\sectionheading#1#2#3#4{% {% + \checkenv{}% should not be in an environment. + % % Switch to the right set of fonts. - \csname #2fonts\endcsname \rm + \csname #2fonts\endcsname \rmisbold + % + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + % Insert first mark before the heading break (see notes for \domark). + \let\prevsectiondefs=\lastsectiondefs + \ifx\temptype\Ynothingkeyword + \ifx\sectionlevel\seckeyword + \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% + \gdef\thissection{\thissectionname}}% + \fi + \else\ifx\temptype\Yomitfromtockeyword + % Don't redefine \thissection. + \else\ifx\temptype\Yappendixkeyword + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + % \noexpand\putwordSection avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thissection{\noexpand\putwordSection{} + \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \else + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + % \noexpand\putwordSection avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thissection{\noexpand\putwordSection{} + \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \fi\fi\fi + % + % Go into vertical mode. Usually we'll already be there, but we + % don't want the following whatsit to end up in a preceding paragraph + % if the document didn't happen to have a blank line. + \par + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark % % Insert space above the heading. \csname #2headingbreak\endcsname % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevsectiondefs=\lastsectiondefs + \domark + % % Only insert the space after the number if we have a section number. - \def\sectionlevel{#2}% - \def\temptype{#3}% - % \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unn}% - \gdef\thissection{#1}% + \gdef\lastsection{#1}% \else\ifx\temptype\Yomitfromtockeyword % for @headings -- no section number, don't include in toc, - % and don't redefine \thissection. + % and don't redefine \lastsection. \setbox0 = \hbox{}% \def\toctype{omit}% \let\sectionlevel=\empty \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{#4\enspace}% \def\toctype{app}% - \gdef\thissection{#1}% + \gdef\lastsection{#1}% \else \setbox0 = \hbox{#4\enspace}% \def\toctype{num}% - \gdef\thissection{#1}% + \gdef\lastsection{#1}% \fi\fi\fi % - % Write the toc entry (before \donoderef). See comments in \chfplain. + % Write the toc entry (before \donoderef). See comments in \chapmacro. \writetocentry{\toctype\sectionlevel}{#1}{#4}% % % Write the node reference (= pdf destination for pdftex). - % Again, see comments in \chfplain. + % Again, see comments in \chapmacro. \donoderef{#3}% % + % Interline glue will be inserted when the vbox is completed. + % That glue will be a valid breakpoint for the page, since it'll be + % preceded by a whatsit (usually from the \donoderef, or from the + % \writetocentry if there was no node). We don't want to allow that + % break, since then the whatsits could end up on page n while the + % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. + \nobreak + % % Output the actual section heading. - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright \hangindent=\wd0 % zero if no section number \unhbox0 #1}% }% @@ -4525,15 +5899,15 @@ % % We'll almost certainly start a paragraph next, so don't let that % glue accumulate. (Not a breakpoint because it's preceded by a - % discardable item.) + % discardable item.) However, when a paragraph is not started next + % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out + % or the negative glue will cause weirdly wrong output, typically + % obscuring the section heading with something else. \vskip-\parskip - % - % This is purely so the last item on the list is a known \penalty > - % 10000. This is so \startdefun can avoid allowing breakpoints after - % section headings. Otherwise, it would insert a valid breakpoint between: - % - % @section sec-whatever - % @deffn def-whatever + % + % This is so the last item on the main vertical list is a known + % \penalty > 10000, so \startdefun, etc., can recognize the situation + % and do the needful. \penalty 10001 } @@ -4572,7 +5946,7 @@ \edef\temp{% \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% \temp - } + }% \fi \fi % @@ -4589,7 +5963,7 @@ % These characters do not print properly in the Computer Modern roman % fonts, so we must take special care. This is more or less redundant % with the Texinfo input format setup at the end of this file. -% +% \def\activecatcodes{% \catcode`\"=\active \catcode`\$=\active @@ -4607,7 +5981,7 @@ \def\readtocfile{% \setupdatafile \activecatcodes - \input \jobname.toc + \input \tocreadfilename } \newskip\contentsrightmargin \contentsrightmargin=1in @@ -4626,7 +6000,6 @@ % % Don't need to put `Contents' or `Short Contents' in the headline. % It is abundantly clear what they are. - \def\thischapter{}% \chapmacro{#1}{Yomitfromtoc}{}% % \savepageno = \pageno @@ -4638,11 +6011,16 @@ \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi } +% redefined for the two-volume lispref. We always output on +% \jobname.toc even if this is redefined. +% +\def\tocreadfilename{\jobname.toc} % Normal (long) toc. +% \def\contents{% \startcontents{\putwordTOC}% - \openin 1 \jobname.toc + \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi @@ -4661,6 +6039,7 @@ \def\summarycontents{% \startcontents{\putwordShortTOC}% % + \let\partentry = \shortpartentry \let\numchapentry = \shortchapentry \let\appentry = \shortchapentry \let\unnchapentry = \shortunnchapentry @@ -4680,7 +6059,7 @@ \let\numsubsubsecentry = \numsecentry \let\appsubsubsecentry = \numsecentry \let\unnsubsubsecentry = \numsecentry - \openin 1 \jobname.toc + \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi @@ -4716,6 +6095,19 @@ % The last argument is the page number. % The arguments in between are the chapter number, section number, ... +% Parts, in the main contents. Replace the part number, which doesn't +% exist, with an empty box. Let's hope all the numbers have the same width. +% Also ignore the page number, which is conventionally not printed. +\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} +\def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}} +% +% Parts, in the short toc. +\def\shortpartentry#1#2#3#4{% + \penalty-300 + \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip + \shortchapentry{{\bf #1}}{\numeralbox}{}{}% +} + % Chapters, in the main contents. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} % @@ -4805,45 +6197,12 @@ \message{environments,} % @foo ... @end foo. -% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. -% -% Since these characters are used in examples, it should be an even number of -% \tt widths. Each \tt character is 1en, so two makes it 1em. -% -\def\point{$\star$} -\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} -\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} -\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} -\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} - -% The @error{} command. -% Adapted from the TeXbook's \boxit. -% -\newbox\errorbox -% -{\tentt \global\dimen0 = 3em}% Width of the box. -\dimen2 = .55pt % Thickness of rules -% The text. (`r' is open on the right, `e' somewhat less so on the left.) -\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} -% -\setbox\errorbox=\hbox to \dimen0{\hfil - \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. - \advance\hsize by -2\dimen2 % Rules. - \vbox{% - \hrule height\dimen2 - \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. - \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. - \kern3pt\vrule width\dimen2}% Space to right. - \hrule height\dimen2} - \hfil} -% -\def\error{\leavevmode\lower.7ex\copy\errorbox} - -% @tex ... @end tex escapes into raw Tex temporarily. +% @tex ... @end tex escapes into raw TeX temporarily. % One exception: @ is still an escape character, so that @end tex works. -% But \@ or @@ will get a plain tex @ character. +% But \@ or @@ will get a plain @ character. \envdef\tex{% + \setupmarkupstyle{tex}% \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie @@ -4853,8 +6212,14 @@ \catcode `\|=\other \catcode `\<=\other \catcode `\>=\other + \catcode`\`=\other + \catcode`\'=\other \escapechar=`\\ % + % ' is active in math mode (mathcode"8000). So reset it, and all our + % other math active characters (just in case), to plain's definitions. + \mathactive + % \let\b=\ptexb \let\bullet=\ptexbullet \let\c=\ptexc @@ -4872,6 +6237,7 @@ \let\/=\ptexslash \let\*=\ptexstar \let\t=\ptext + \expandafter \let\csname top\endcsname=\ptextop % outer \let\frenchspacing=\plainfrenchspacing % \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% @@ -4957,6 +6323,12 @@ \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip % Flag to tell @lisp, etc., not to narrow margin. \let\nonarrowing = t% + % + % If this cartouche directly follows a sectioning command, we need the + % \parskip glue (backspaced over by default) or the cartouche can + % collide with the section heading. + \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi + % \vbox\bgroup \baselineskip=0pt\parskip=0pt\lineskip=0pt \carttop @@ -4970,7 +6342,7 @@ \lineskip=\normlskip \parskip=\normpskip \vskip -\parskip - \comment % For explanation, see the end of \def\group. + \comment % For explanation, see the end of def\group. } \def\Ecartouche{% \ifhmode\par\fi @@ -4987,6 +6359,7 @@ % This macro is called at the beginning of all the @example variants, % inside a group. +\newdimen\nonfillparindent \def\nonfillstart{% \aboveenvbreak \hfuzz = 12pt % Don't be fussy @@ -4994,7 +6367,12 @@ \let\par = \lisppar % don't ignore blank lines \obeylines % each line of input is a line of output \parskip = 0pt + % Turn off paragraph indentation but redefine \indent to emulate + % the normal \indent. + \nonfillparindent=\parindent \parindent = 0pt + \let\indent\nonfillindent + % \emergencystretch = 0pt % don't try to avoid overfull boxes \ifx\nonarrowing\relax \advance \leftskip by \lispnarrowing @@ -5005,6 +6383,24 @@ \let\exdent=\nofillexdent } +\begingroup +\obeyspaces +% We want to swallow spaces (but not other tokens) after the fake +% @indent in our nonfill-environments, where spaces are normally +% active and set to @tie, resulting in them not being ignored after +% @indent. +\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}% +\gdef\nonfillindentcheck{% +\ifx\temp % +\expandafter\nonfillindentgobble% +\else% +\leavevmode\nonfillindentbox% +\fi% +}% +\endgroup +\def\nonfillindentgobble#1{\nonfillindent} +\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}} + % If you want all examples etc. small: @set dispenvsize small. % If you want even small examples the full size: @set dispenvsize nosmall. % This affects the following displayed environments: @@ -5015,53 +6411,59 @@ \let\SETdispenvsize\relax \def\setnormaldispenv{% \ifx\SETdispenvsize\smallword + % end paragraph for sake of leading, in case document has no blank + % line. This is redundant with what happens in \aboveenvbreak, but + % we need to do it before changing the fonts, and it's inconvenient + % to change the fonts afterward. + \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } \def\setsmalldispenv{% \ifx\SETdispenvsize\nosmallword \else + \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } % We often define two environments, @foo and @smallfoo. -% Let's do it by one command: -\def\makedispenv #1#2{ - \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} - \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} +% Let's do it in one command. #1 is the env name, #2 the definition. +\def\makedispenvdef#1#2{% + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}% + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}% \expandafter\let\csname E#1\endcsname \afterenvbreak \expandafter\let\csname Esmall#1\endcsname \afterenvbreak } -% Define two synonyms: -\def\maketwodispenvs #1#2#3{ - \makedispenv{#1}{#3} - \makedispenv{#2}{#3} -} - -% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. +% Define two environment synonyms (#1 and #2) for an environment. +\def\maketwodispenvdef#1#2#3{% + \makedispenvdef{#1}{#3}% + \makedispenvdef{#2}{#3}% +} +% +% @lisp: indented, narrowed, typewriter font; +% @example: same as @lisp. % % @smallexample and @smalllisp: use smaller fonts. % Originally contributed by Pavel at xerox. % -\maketwodispenvs {lisp}{example}{% +\maketwodispenvdef{lisp}{example}{% \nonfillstart - \tt + \tt\setupmarkupstyle{example}% \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. - \gobble % eat return -} - + \gobble % eat return +} % @display/@smalldisplay: same as @lisp except keep current font. % -\makedispenv {display}{% +\makedispenvdef{display}{% \nonfillstart \gobble } % @format/@smallformat: same as @display except don't narrow margins. % -\makedispenv{format}{% +\makedispenvdef{format}{% \let\nonarrowing = t% \nonfillstart \gobble @@ -5080,18 +6482,44 @@ \envdef\flushright{% \let\nonarrowing = t% \nonfillstart - \advance\leftskip by 0pt plus 1fill + \advance\leftskip by 0pt plus 1fill\relax \gobble } \let\Eflushright = \afterenvbreak +% @raggedright does more-or-less normal line breaking but no right +% justification. From plain.tex. +\envdef\raggedright{% + \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax +} +\let\Eraggedright\par + +\envdef\raggedleft{% + \parindent=0pt \leftskip0pt plus2em + \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt + \hbadness=10000 % Last line will usually be underfull, so turn off + % badness reporting. +} +\let\Eraggedleft\par + +\envdef\raggedcenter{% + \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em + \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt + \hbadness=10000 % Last line will usually be underfull, so turn off + % badness reporting. +} +\let\Eraggedcenter\par + + % @quotation does normal linebreaking (hence we can't use \nonfillstart) % and narrows the margins. We keep \parskip nonzero in general, since % we're doing normal filling. So, when using \aboveenvbreak and % \afterenvbreak, temporarily make \parskip 0. % -\envdef\quotation{% +\makedispenvdef{quotation}{\quotationstart} +% +\def\quotationstart{% {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip \parindent=0pt % @@ -5111,12 +6539,13 @@ % \def\Equotation{% \par - \ifx\quotationauthor\undefined\else + \ifx\quotationauthor\thisisundefined\else % indent a bit. \leftline{\kern 2\leftskip \sl ---\quotationauthor}% \fi {\parskip=0pt \afterenvbreak}% } +\def\Esmallquotation{\Equotation} % If we're given an argument, typeset it in bold with a colon after. \def\quotationlabel#1{% @@ -5141,18 +6570,16 @@ \do\ \do\\\do\{\do\}\do\$\do\&% \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% \do\<\do\>\do\|\do\@\do+\do\"% + % Don't do the quotes -- if we do, @set txicodequoteundirected and + % @set txicodequotebacktick will not have effect on @verb and + % @verbatim, and ?` and !` ligatures won't get disabled. + %\do\`\do\'% } % % [Knuth] p. 380 \def\uncatcodespecials{% \def\do##1{\catcode`##1=\other}\dospecials} % -% [Knuth] pp. 380,381,391 -% Disable Spanish ligatures ?` and !` of \tt font -\begingroup - \catcode`\`=\active\gdef`{\relax\lq} -\endgroup -% % Setup for the @verb command. % % Eight spaces for a tab @@ -5164,7 +6591,7 @@ \def\setupverb{% \tt % easiest (and conventionally used) font for verbatim \def\par{\leavevmode\endgraf}% - \catcode`\`=\active + \setupmarkupstyle{verb}% \tabeightspaces % Respect line breaks, % print special symbols as themselves, and @@ -5175,35 +6602,46 @@ % Setup for the @verbatim environment % -% Real tab expansion +% Real tab expansion. \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount % -\def\starttabbox{\setbox0=\hbox\bgroup} +% We typeset each line of the verbatim in an \hbox, so we can handle +% tabs. The \global is in case the verbatim line starts with an accent, +% or some other command that starts with a begin-group. Otherwise, the +% entire \verbbox would disappear at the corresponding end-group, before +% it is typeset. Meanwhile, we can't have nested verbatim commands +% (can we?), so the \global won't be overwriting itself. +\newbox\verbbox +\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup} +% \begingroup \catcode`\^^I=\active \gdef\tabexpand{% \catcode`\^^I=\active \def^^I{\leavevmode\egroup - \dimen0=\wd0 % the width so far, or since the previous tab - \divide\dimen0 by\tabw - \multiply\dimen0 by\tabw % compute previous multiple of \tabw - \advance\dimen0 by\tabw % advance to next multiple of \tabw - \wd0=\dimen0 \box0 \starttabbox + \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab + \divide\dimen\verbbox by\tabw + \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw + \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw + \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox }% } \endgroup + +% start the verbatim environment. \def\setupverbatim{% \let\nonarrowing = t% \nonfillstart - % Easiest (and conventionally used) font for verbatim - \tt - \def\par{\leavevmode\egroup\box0\endgraf}% - \catcode`\`=\active + \tt % easiest (and conventionally used) font for verbatim + % The \leavevmode here is for blank lines. Otherwise, we would + % never \starttabox and the \egroup would end verbatim mode. + \def\par{\leavevmode\egroup\box\verbbox\endgraf}% \tabexpand + \setupmarkupstyle{verbatim}% % Respect line breaks, % print special symbols as themselves, and - % make each space count - % must do in this order: + % make each space count. + % Must do in this order: \obeylines \uncatcodespecials \sepspaces \everypar{\starttabbox}% } @@ -5259,6 +6697,8 @@ {% \makevalueexpandable \setupverbatim + \indexnofonts % Allow `@@' and other weird things in file names. + \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% \input #1 \afterenvbreak }% @@ -5284,27 +6724,35 @@ \endgroup } + \message{defuns,} % @defun etc. \newskip\defbodyindent \defbodyindent=.4in \newskip\defargsindent \defargsindent=50pt \newskip\deflastargmargin \deflastargmargin=18pt +\newcount\defunpenalty % Start the processing of @deffn: \def\startdefun{% \ifnum\lastpenalty<10000 \medbreak + \defunpenalty=10003 % Will keep this @deffn together with the + % following @def command, see below. \else % If there are two @def commands in a row, we'll have a \nobreak, % which is there to keep the function description together with its % header. But if there's nothing but headers, we need to allow a % break somewhere. Check specifically for penalty 10002, inserted - % by \defargscommonending, instead of 10000, since the sectioning + % by \printdefunline, instead of 10000, since the sectioning % commands also insert a nobreak penalty, and we don't want to allow % a break between a section heading and a defun. - % - \ifnum\lastpenalty=10002 \penalty2000 \fi + % + % As a further refinement, we avoid "club" headers by signalling + % with penalty of 10003 after the very first @deffn in the + % sequence (see above), and penalty of 10002 after any following + % @def command. + \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi % % Similarly, after a section heading, do not allow a break. % But do insert the glue. @@ -5322,7 +6770,7 @@ % % As above, allow line break if we have multiple x headers in a row. % It's not a great place, though. - \ifnum\lastpenalty=10002 \penalty3000 \fi + \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi % % And now, it's time to reuse the body of the original defun: \expandafter\gobbledefun#1% @@ -5337,10 +6785,10 @@ #1#2 \endheader % common ending: \interlinepenalty = 10000 - \advance\rightskip by 0pt plus 1fil + \advance\rightskip by 0pt plus 1fil\relax \endgraf \nobreak\vskip -\parskip - \penalty 10002 % signal to \startdefun and \dodefunx + \penalty\defunpenalty % signal to \startdefun and \dodefunx % Some of the @defun-type tags do not enable magic parentheses, % rendering the following check redundant. But we don't optimize. \checkparencounts @@ -5350,7 +6798,7 @@ \def\Edefun{\endgraf\medbreak} % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; -% the only thing remainnig is to define \deffnheader. +% the only thing remaining is to define \deffnheader. % \def\makedefun#1{% \expandafter\let\csname E#1\endcsname = \Edefun @@ -5367,13 +6815,36 @@ \def\domakedefun#1#2#3{% \envdef#1{% \startdefun + \doingtypefnfalse % distinguish typed functions from all else \parseargusing\activeparens{\printdefunline#3}% }% \def#2{\dodefunx#1}% \def#3% } -%%% Untyped functions: +\newif\ifdoingtypefn % doing typed function? +\newif\ifrettypeownline % typeset return type on its own line? + +% @deftypefnnewline on|off says whether the return type of typed functions +% are printed on their own line. This affects @deftypefn, @deftypefun, +% @deftypeop, and @deftypemethod. +% +\parseargdef\deftypefnnewline{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxideftypefnnl\endcsname + = \empty + \else\ifx\temp\offword + \expandafter\let\csname SETtxideftypefnnl\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @txideftypefnnl value `\temp', + must be on|off}% + \fi\fi +} + +% Untyped functions: % @deffn category name args \makedefun{deffn}{\deffngeneral{}} @@ -5392,7 +6863,7 @@ \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% } -%%% Typed functions: +% Typed functions: % @deftypefn category type name args \makedefun{deftypefn}{\deftypefngeneral{}} @@ -5407,10 +6878,11 @@ % \def\deftypefngeneral#1#2 #3 #4 #5\endheader{% \dosubind{fn}{\code{#4}}{#1}% + \doingtypefntrue \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } -%%% Typed variables: +% Typed variables: % @deftypevr category type var args \makedefun{deftypevr}{\deftypecvgeneral{}} @@ -5428,7 +6900,7 @@ \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } -%%% Untyped variables: +% Untyped variables: % @defvr category var args \makedefun{defvr}#1 {\deftypevrheader{#1} {} } @@ -5439,7 +6911,8 @@ % \defcvof {category of}class var args \def\defcvof#1#2 {\deftypecvof{#1}#2 {} } -%%% Type: +% Types: + % @deftp category name args \makedefun{deftp}#1 #2 #3\endheader{% \doind{tp}{\code{#2}}% @@ -5467,25 +6940,49 @@ % We are followed by (but not passed) the arguments, if any. % \def\defname#1#2#3{% + \par % Get the values of \leftskip and \rightskip as they were outside the @def... \advance\leftskip by -\defbodyindent % - % How we'll format the type name. Putting it in brackets helps + % Determine if we are typesetting the return type of a typed function + % on a line by itself. + \rettypeownlinefalse + \ifdoingtypefn % doing a typed function specifically? + % then check user option for putting return type on its own line: + \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else + \rettypeownlinetrue + \fi + \fi + % + % How we'll format the category name. Putting it in brackets helps % distinguish it from the body text that may end up on the next line % just below it. \def\temp{#1}% \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} % - % Figure out line sizes for the paragraph shape. + % Figure out line sizes for the paragraph shape. We'll always have at + % least two. + \tempnum = 2 + % % The first line needs space for \box0; but if \rightskip is nonzero, % we need only space for the part of \box0 which exceeds it: \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % + % If doing a return type on its own line, we'll have another line. + \ifrettypeownline + \advance\tempnum by 1 + \def\maybeshapeline{0in \hsize}% + \else + \def\maybeshapeline{}% + \fi + % % The continuations: \dimen2=\hsize \advance\dimen2 by -\defargsindent - % (plain.tex says that \dimen1 should be used only as global.) - \parshape 2 0in \dimen0 \defargsindent \dimen2 - % - % Put the type name to the right margin. + % + % The final paragraph shape: + \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 + % + % Put the category name at the right margin. \noindent \hbox to 0pt{% \hfil\box0 \kern-\hsize @@ -5507,8 +7004,16 @@ % . this still does not fix the ?` and !` ligatures, but so far no % one has made identifiers using them :). \df \tt - \def\temp{#2}% return value type - \ifx\temp\empty\else \tclose{\temp} \fi + \def\temp{#2}% text of the return type + \ifx\temp\empty\else + \tclose{\temp}% typeset the return type + \ifrettypeownline + % put return type on its own line; prohibit line break following: + \hfil\vadjust{\nobreak}\break + \else + \space % type on same line, so just followed by a space + \fi + \fi % no return type #3% output function name }% {\rm\enskip}% hskip 0.5 em of \tenrm @@ -5529,7 +7034,7 @@ % % On the other hand, if an argument has two dashes (for instance), we % want a way to get ttsl. Let's try @var for that. - \let\var=\ttslanted + \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}% #1% \sl\hyphenchar\font=45 } @@ -5609,12 +7114,14 @@ \ifnum\parencount=0 \else \badparencount \fi \ifnum\brackcount=0 \else \badbrackcount \fi } +% these should not use \errmessage; the glibc manual, at least, actually +% has such constructs (when documenting function pointers). \def\badparencount{% - \errmessage{Unbalanced parentheses in @def}% + \message{Warning: unbalanced parentheses in @def...}% \global\parencount=0 } \def\badbrackcount{% - \errmessage{Unbalanced square braces in @def}% + \message{Warning: unbalanced square brackets in @def...}% \global\brackcount=0 } @@ -5624,7 +7131,7 @@ % To do this right we need a feature of e-TeX, \scantokens, % which we arrange to emulate with a temporary file in ordinary TeX. -\ifx\eTeXversion\undefined +\ifx\eTeXversion\thisisundefined \newwrite\macscribble \def\scantokens#1{% \toks0={#1}% @@ -5635,26 +7142,30 @@ } \fi -\def\scanmacro#1{% - \begingroup - \newlinechar`\^^M - \let\xeatspaces\eatspaces - % Undo catcode changes of \startcontents and \doprintindex - % When called from @insertcopying or (short)caption, we need active - % backslash to get it printed correctly. Previously, we had - % \catcode`\\=\other instead. We'll see whether a problem appears - % with macro expansion. --kasal, 19aug04 - \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ - % ... and \example - \spaceisspace - % - % Append \endinput to make sure that TeX does not see the ending newline. - % - % I've verified that it is necessary both for e-TeX and for ordinary TeX - % --kasal, 29nov03 - \scantokens{#1\endinput}% - \endgroup -} +\def\scanmacro#1{\begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % + % ... and for \example: + \spaceisspace + % + % The \empty here causes a following catcode 5 newline to be eaten as + % part of reading whitespace after a control sequence. It does not + % eat a catcode 13 newline. There's no good way to handle the two + % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX + % would then have different behavior). See the Macro Details node in + % the manual for the workaround we recommend for macros and + % line-oriented commands. + % + \scantokens{#1\empty}% +\endgroup} \def\scanexp#1{% \edef\temp{\noexpand\scanmacro{#1}}% @@ -5682,7 +7193,7 @@ % This does \let #1 = #2, with \csnames; that is, % \let \csname#1\endcsname = \csname#2\endcsname % (except of course we have to play expansion games). -% +% \def\cslet#1#2{% \expandafter\let \csname#1\expandafter\endcsname @@ -5708,13 +7219,18 @@ % Macro bodies are absorbed as an argument in a context where % all characters are catcode 10, 11 or 12, except \ which is active -% (as in normal texinfo). It is necessary to change the definition of \. - +% (as in normal texinfo). It is necessary to change the definition of \ +% to recognize macro arguments; this is the job of \mbodybackslash. +% +% Non-ASCII encodings make 8-bit characters active, so un-activate +% them to avoid their expansion. Must do this non-globally, to +% confine the change to the current group. +% % It's necessary to have hard CRs when the macro is executed. This is -% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% done by making ^^M (\endlinechar) catcode 12 when reading the macro % body, and then making it the \newlinechar in \scanmacro. - -\def\scanctxt{% +% +\def\scanctxt{% used as subroutine \catcode`\"=\other \catcode`\+=\other \catcode`\<=\other @@ -5724,15 +7240,16 @@ \catcode`\_=\other \catcode`\|=\other \catcode`\~=\other -} - -\def\scanargctxt{% + \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi +} + +\def\scanargctxt{% used for copying and captions, not macros. \scanctxt \catcode`\\=\other \catcode`\^^M=\other } -\def\macrobodyctxt{% +\def\macrobodyctxt{% used for @macro definitions \scanctxt \catcode`\{=\other \catcode`\}=\other @@ -5740,32 +7257,56 @@ \usembodybackslash } -\def\macroargctxt{% +\def\macroargctxt{% used when scanning invocations \scanctxt - \catcode`\\=\other -} + \catcode`\\=0 +} +% why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes" +% for the single characters \ { }. Thus, we end up with the "commands" +% that would be written @\ @{ @} in a Texinfo document. +% +% We already have @{ and @}. For @\, we define it here, and only for +% this purpose, to produce a typewriter backslash (so, the @\ that we +% define for @math can't be used with @macro calls): +% +\def\\{\normalbackslash}% +% +% We would like to do this for \, too, since that is what makeinfo does. +% But it is not possible, because Texinfo already has a command @, for a +% cedilla accent. Documents must use @comma{} instead. +% +% \anythingelse will almost certainly be an error of some kind. + % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N % where N is the macro parameter number. % We define \csname macarg.\endcsname to be \realbackslash, so % \\ in macro replacement text gets you a backslash. - +% {\catcode`@=0 @catcode`@\=@active @gdef at usembodybackslash{@let\=@mbodybackslash} @gdef at mbodybackslash#1\{@csname macarg.#1 at endcsname} } \expandafter\def\csname macarg.\endcsname{\realbackslash} +\def\margbackslash#1{\char`\#1 } + \def\macro{\recursivefalse\parsearg\macroxxx} \def\rmacro{\recursivetrue\parsearg\macroxxx} \def\macroxxx#1{% - \getargs{#1}% now \macname is the macname and \argl the arglist + \getargs{#1}% now \macname is the macname and \argl the arglist \ifx\argl\empty % no arguments - \paramno=0% + \paramno=0\relax \else \expandafter\parsemargdef \argl;% + \if\paramno>256\relax + \ifx\eTeXversion\thisisundefined + \errhelp = \EMsimple + \errmessage{You need eTeX to compile a file with macros with more than 256 arguments} + \fi + \fi \fi \if1\csname ismacro.\the\macname\endcsname \message{Warning: redefining \the\macname}% @@ -5812,46 +7353,269 @@ % an opening brace, and that opening brace is not consumed. \def\getargs#1{\getargsxxx#1{}} \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} -\def\getmacname #1 #2\relax{\macname={#1}} +\def\getmacname#1 #2\relax{\macname={#1}} \def\getmacargs#1{\def\argl{#1}} +% For macro processing make @ a letter so that we can make Texinfo private macro names. +\edef\texiatcatcode{\the\catcode`\@} +\catcode `@=11\relax + % Parse the optional {params} list. Set up \paramno and \paramlist -% so \defmacro knows what to do. Define \macarg.blah for each blah -% in the params list, to be ##N where N is the position in that list. +% so \defmacro knows what to do. Define \macarg.BLAH for each BLAH +% in the params list to some hook where the argument si to be expanded. If +% there are less than 10 arguments that hook is to be replaced by ##N where N +% is the position in that list, that is to say the macro arguments are to be +% defined `a la TeX in the macro body. +% % That gets used by \mbodybackslash (above). - +% % We need to get `macro parameter char #' into several definitions. -% The technique used is stolen from LaTeX: let \hash be something +% The technique used is stolen from LaTeX: let \hash be something % unexpandable, insert that wherever you need a #, and then redefine % it to # just before using the token list produced. % % The same technique is used to protect \eatspaces till just before % the macro is used. - -\def\parsemargdef#1;{\paramno=0\def\paramlist{}% - \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} +% +% If there are 10 or more arguments, a different technique is used, where the +% hook remains in the body, and when macro is to be expanded the body is +% processed again to replace the arguments. +% +% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the +% argument N value and then \edef the body (nothing else will expand because of +% the catcode regime underwhich the body was input). +% +% If you compile with TeX (not eTeX), and you have macros with 10 or more +% arguments, you need that no macro has more than 256 arguments, otherwise an +% error is produced. +\def\parsemargdef#1;{% + \paramno=0\def\paramlist{}% + \let\hash\relax + \let\xeatspaces\relax + \parsemargdefxxx#1,;,% + % In case that there are 10 or more arguments we parse again the arguments + % list to set new definitions for the \macarg.BLAH macros corresponding to + % each BLAH argument. It was anyhow needed to parse already once this list + % in order to count the arguments, and as macros with at most 9 arguments + % are by far more frequent than macro with 10 or more arguments, defining + % twice the \macarg.BLAH macros does not cost too much processing power. + \ifnum\paramno<10\relax\else + \paramno0\relax + \parsemmanyargdef@@#1,;,% 10 or more arguments + \fi +} \def\parsemargdefxxx#1,{% \if#1;\let\next=\relax \else \let\next=\parsemargdefxxx - \advance\paramno by 1% + \advance\paramno by 1 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname {\xeatspaces{\hash\the\paramno}}% \edef\paramlist{\paramlist\hash\the\paramno,}% \fi\next} +\def\parsemmanyargdef@@#1,{% + \if#1;\let\next=\relax + \else + \let\next=\parsemmanyargdef@@ + \edef\tempb{\eatspaces{#1}}% + \expandafter\def\expandafter\tempa + \expandafter{\csname macarg.\tempb\endcsname}% + % Note that we need some extra \noexpand\noexpand, this is because we + % don't want \the to be expanded in the \parsermacbody as it uses an + % \xdef . + \expandafter\edef\tempa + {\noexpand\noexpand\noexpand\the\toks\the\paramno}% + \advance\paramno by 1\relax + \fi\next} + % These two commands read recursive and nonrecursive macro bodies. % (They're different since rec and nonrec macros end differently.) - +% + +\catcode `\@\texiatcatcode \long\def\parsemacbody#1 at end macro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% \long\def\parsermacbody#1 at end rmacro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% - -% This defines the macro itself. There are six cases: recursive and -% nonrecursive macros of zero, one, and many arguments. +\catcode `\@=11\relax + +\let\endargs@\relax +\let\nil@\relax +\def\nilm@{\nil@}% +\long\def\nillm@{\nil@}% + +% This macro is expanded during the Texinfo macro expansion, not during its +% definition. It gets all the arguments values and assigns them to macros +% macarg.ARGNAME +% +% #1 is the macro name +% #2 is the list of argument names +% #3 is the list of argument values +\def\getargvals@#1#2#3{% + \def\macargdeflist@{}% + \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion. + \def\paramlist{#2,\nil@}% + \def\macroname{#1}% + \begingroup + \macroargctxt + \def\argvaluelist{#3,\nil@}% + \def\@tempa{#3}% + \ifx\@tempa\empty + \setemptyargvalues@ + \else + \getargvals@@ + \fi +} + +% +\def\getargvals@@{% + \ifx\paramlist\nilm@ + % Some sanity check needed here that \argvaluelist is also empty. + \ifx\argvaluelist\nillm@ + \else + \errhelp = \EMsimple + \errmessage{Too many arguments in macro `\macroname'!}% + \fi + \let\next\macargexpandinbody@ + \else + \ifx\argvaluelist\nillm@ + % No more arguments values passed to macro. Set remaining named-arg + % macros to empty. + \let\next\setemptyargvalues@ + \else + % pop current arg name into \@tempb + \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}% + \expandafter\@tempa\expandafter{\paramlist}% + % pop current argument value into \@tempc + \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}% + \expandafter\@tempa\expandafter{\argvaluelist}% + % Here \@tempb is the current arg name and \@tempc is the current arg value. + % First place the new argument macro definition into \@tempd + \expandafter\macname\expandafter{\@tempc}% + \expandafter\let\csname macarg.\@tempb\endcsname\relax + \expandafter\def\expandafter\@tempe\expandafter{% + \csname macarg.\@tempb\endcsname}% + \edef\@tempd{\long\def\@tempe{\the\macname}}% + \push@\@tempd\macargdeflist@ + \let\next\getargvals@@ + \fi + \fi + \next +} + +\def\push@#1#2{% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter#2% + \expandafter\expandafter\expandafter{% + \expandafter#1#2}% +} + +% Replace arguments by their values in the macro body, and place the result +% in macro \@tempa +\def\macvalstoargs@{% + % To do this we use the property that token registers that are \the'ed + % within an \edef expand only once. So we are going to place all argument + % values into respective token registers. + % + % First we save the token context, and initialize argument numbering. + \begingroup + \paramno0\relax + % Then, for each argument number #N, we place the corresponding argument + % value into a new token list register \toks#N + \expandafter\putargsintokens@\saveparamlist@,;,% + % Then, we expand the body so that argument are replaced by their + % values. The trick for values not to be expanded themselves is that they + % are within tokens and that tokens expand only once in an \edef . + \edef\@tempc{\csname mac.\macroname .body\endcsname}% + % Now we restore the token stack pointer to free the token list registers + % which we have used, but we make sure that expanded body is saved after + % group. + \expandafter + \endgroup + \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% + } + +\def\macargexpandinbody@{% + %% Define the named-macro outside of this group and then close this group. + \expandafter + \endgroup + \macargdeflist@ + % First the replace in body the macro arguments by their values, the result + % is in \@tempa . + \macvalstoargs@ + % Then we point at the \norecurse or \gobble (for recursive) macro value + % with \@tempb . + \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname + % Depending on whether it is recursive or not, we need some tailing + % \egroup . + \ifx\@tempb\gobble + \let\@tempc\relax + \else + \let\@tempc\egroup + \fi + % And now we do the real job: + \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}% + \@tempd +} + +\def\putargsintokens@#1,{% + \if#1;\let\next\relax + \else + \let\next\putargsintokens@ + % First we allocate the new token list register, and give it a temporary + % alias \@tempb . + \toksdef\@tempb\the\paramno + % Then we place the argument value into that token list register. + \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname + \expandafter\@tempb\expandafter{\@tempa}% + \advance\paramno by 1\relax + \fi + \next +} + +% Save the token stack pointer into macro #1 +\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}} +% Restore the token stack pointer from number in macro #1 +\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax} +% newtoks that can be used non \outer . +\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi} + +% Tailing missing arguments are set to empty +\def\setemptyargvalues@{% + \ifx\paramlist\nilm@ + \let\next\macargexpandinbody@ + \else + \expandafter\setemptyargvaluesparser@\paramlist\endargs@ + \let\next\setemptyargvalues@ + \fi + \next +} + +\def\setemptyargvaluesparser@#1,#2\endargs@{% + \expandafter\def\expandafter\@tempa\expandafter{% + \expandafter\def\csname macarg.#1\endcsname{}}% + \push@\@tempa\macargdeflist@ + \def\paramlist{#2}% +} + +% #1 is the element target macro +% #2 is the list macro +% #3,#4\endargs@ is the list value +\def\pop@#1#2#3,#4\endargs@{% + \def#1{#3}% + \def#2{#4}% +} +\long\def\longpop@#1#2#3,#4\endargs@{% + \long\def#1{#3}% + \long\def#2{#4}% +} + +% This defines a Texinfo @macro. There are eight cases: recursive and +% nonrecursive macros of zero, one, up to nine, and many arguments. % Much magic with \expandafter here. % \xdef is used so that macro definitions will survive the file % they're defined in; @include reads the file inside a group. +% \def\defmacro{% \let\hash=##% convert placeholders to macro parameter chars \ifrecursive @@ -5866,17 +7630,25 @@ \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup\noexpand\scanmacro{\temp}}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \else + \ifnum\paramno<10\relax % at most 9 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \else % 10 or more + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\getargvals@{\the\macname}{\argl}% + }% + \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp + \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble + \fi \fi \else \ifcase\paramno @@ -5893,39 +7665,51 @@ \egroup \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \expandafter\noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% + \else % at most 9 + \ifnum\paramno<10\relax + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % 10 or more: + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\getargvals@{\the\macname}{\argl}% + }% + \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp + \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse + \fi \fi \fi} +\catcode `\@\texiatcatcode\relax + \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} % \braceorline decides whether the next nonwhitespace character is a % {. If so it reads up to the closing }, if not, it reads the whole % line. Whatever was read is then fed to the next control sequence -% as an argument (by \parsebrace or \parsearg) -\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} +% as an argument (by \parsebrace or \parsearg). +% +\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} \def\braceorlinexxx{% \ifx\nchar\bgroup\else \expandafter\parsearg - \fi \next} + \fi \macnamexxx} % @alias. % We need some trickery to remove the optional spaces around the equal -% sign. Just make them active and then expand them all to nothing. +% sign. Make them active and then expand them all to nothing. +% \def\alias{\parseargusing\obeyspaces\aliasxxx} \def\aliasxxx #1{\aliasyyy#1\relax} \def\aliasyyy #1=#2\relax{% @@ -5941,13 +7725,13 @@ \message{cross references,} \newwrite\auxfile - \newif\ifhavexrefs % True if xref values are known. \newif\ifwarnedxrefs % True if we warned once that they aren't known. % @inforef is relatively simple. \def\inforef #1{\inforefzzz #1,,,,**} -\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, +\def\inforefzzz #1,#2,#3,#4**{% + \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, node \samp{\ignorespaces#1{}}} % @node's only job in TeX is to define \lastnode, which is used in @@ -5986,7 +7770,7 @@ % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an % anchor), which consists of three parts: -% 1) NAME-title - the current sectioning name taken from \thissection, +% 1) NAME-title - the current sectioning name taken from \lastsection, % or the anchor name. % 2) NAME-snt - section number and type, passed as the SNT arg, or % empty for anchors. @@ -6005,14 +7789,35 @@ \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef ##1}{##2}}% these are parameters of \writexrdef }% - \toks0 = \expandafter{\thissection}% + \toks0 = \expandafter{\lastsection}% \immediate \writexrdef{title}{\the\toks0 }% \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. - \writexrdef{pg}{\folio}% will be written later, during \shipout + \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout }% \fi } +% @xrefautosectiontitle on|off says whether @section(ing) names are used +% automatically in xrefs, if the third arg is not explicitly specified. +% This was provided as a "secret" @set xref-automatic-section-title +% variable, now it's official. +% +\parseargdef\xrefautomaticsectiontitle{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETxref-automatic-section-title\endcsname + = \empty + \else\ifx\temp\offword + \expandafter\let\csname SETxref-automatic-section-title\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', + must be on|off}% + \fi\fi +} + +% % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is % the node name, #2 the name of the Info cross-reference, #3 the printed % node name, #4 the name of the Info file, #5 the name of the printed @@ -6021,26 +7826,41 @@ \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} \def\ref#1{\xrefX[#1,,,,,,,]} +% +\newbox\toprefbox +\newbox\printedrefnamebox +\newbox\infofilenamebox +\newbox\printedmanualbox +% \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup \unsepspaces + % + % Get args without leading/trailing spaces. + \def\printedrefname{\ignorespaces #3}% + \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}% + % + \def\infofilename{\ignorespaces #4}% + \setbox\infofilenamebox = \hbox{\infofilename\unskip}% + % \def\printedmanual{\ignorespaces #5}% - \def\printedrefname{\ignorespaces #3}% - \setbox1=\hbox{\printedmanual\unskip}% - \setbox0=\hbox{\printedrefname\unskip}% - \ifdim \wd0 = 0pt + \setbox\printedmanualbox = \hbox{\printedmanual\unskip}% + % + % If the printed reference name (arg #3) was not explicitly given in + % the @xref, figure out what we want to use. + \ifdim \wd\printedrefnamebox = 0pt % No printed node name was explicitly given. - \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax - % Use the node name inside the square brackets. + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax + % Not auto section-title: use node name inside the square brackets. \def\printedrefname{\ignorespaces #1}% \else - % Use the actual chapter/section title appear inside - % the square brackets. Use the real section title if we have it. - \ifdim \wd1 > 0pt - % It is in another manual, so we don't have it. + % Auto section-title: use chapter/section title inside + % the square brackets if we have it. + \ifdim \wd\printedmanualbox > 0pt + % It is in another manual, so we don't have it; use node name. \def\printedrefname{\ignorespaces #1}% \else \ifhavexrefs - % We know the real title if we have the xref values. + % We (should) know the real title if we have the xref values. \def\printedrefname{\refx{#1-title}{}}% \else % Otherwise just copy the Info node name. @@ -6052,22 +7872,32 @@ % % Make link in pdf output. \ifpdf - \leavevmode - \getfilename{#4}% - {\turnoffactive - % See comments at \activebackslashdouble. - {\activebackslashdouble \xdef\pdfxrefdest{#1}% - \backslashparens\pdfxrefdest}% + {\indexnofonts + \turnoffactive + \makevalueexpandable + % This expands tokens, so do it after making catcode changes, so _ + % etc. don't get their TeX definitions. This ignores all spaces in + % #4, including (wrongly) those in the middle of the filename. + \getfilename{#4}% % + % This (wrongly) does not take account of leading or trailing + % spaces in #1, which should be ignored. + \edef\pdfxrefdest{#1}% + \ifx\pdfxrefdest\empty + \def\pdfxrefdest{Top}% no empty targets + \else + \txiescapepdf\pdfxrefdest % escape PDF special chars + \fi + % + \leavevmode + \startlink attr{/Border [0 0 0]}% \ifnum\filenamelength>0 - \startlink attr{/Border [0 0 0]}% - goto file{\the\filename.pdf} name{\pdfxrefdest}% + goto file{\the\filename.pdf} name{\pdfxrefdest}% \else - \startlink attr{/Border [0 0 0]}% - goto name{\pdfmkpgn{\pdfxrefdest}}% + goto name{\pdfmkpgn{\pdfxrefdest}}% \fi }% - \linkcolor + \setcolor{\linkcolor}% \fi % % Float references are printed completely differently: "Figure 1.2" @@ -6084,29 +7914,42 @@ \iffloat\Xthisreftitle % If the user specified the print name (third arg) to the ref, % print it instead of our usual "Figure 1.2". - \ifdim\wd0 = 0pt - \refx{#1-snt}% + \ifdim\wd\printedrefnamebox = 0pt + \refx{#1-snt}{}% \else \printedrefname \fi % - % if the user also gave the printed manual name (fifth arg), append + % If the user also gave the printed manual name (fifth arg), append % "in MANUALNAME". - \ifdim \wd1 > 0pt + \ifdim \wd\printedmanualbox > 0pt \space \putwordin{} \cite{\printedmanual}% \fi \else % node/anchor (non-float) references. + % + % If we use \unhbox to print the node names, TeX does not insert + % empty discretionaries after hyphens, which means that it will not + % find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, + % this is a loss. Therefore, we give the text of the node name + % again, so it is as if TeX is seeing it for the first time. + % + \ifdim \wd\printedmanualbox > 0pt + % Cross-manual reference with a printed manual name. + % + \crossmanualxref{\cite{\printedmanual\unskip}}% % - % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not - % insert empty discretionaries after hyphens, which means that it will - % not find a line break at a hyphen in a node names. Since some manuals - % are best written with fairly long node names, containing hyphens, this - % is a loss. Therefore, we give the text of the node name again, so it - % is as if TeX is seeing it for the first time. - \ifdim \wd1 > 0pt - \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + \else\ifdim \wd\infofilenamebox > 0pt + % Cross-manual reference with only an info filename (arg 4), no + % printed manual name (arg 5). This is essentially the same as + % the case above; we output the filename, since we have nothing else. + % + \crossmanualxref{\code{\infofilename\unskip}}% + % \else + % Reference within this manual. + % % _ (for example) has to be the character _ for the purposes of the % control sequence corresponding to the node, but it has to expand % into the usual \leavevmode...\vrule stuff for purposes of @@ -6118,7 +7961,7 @@ \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi }% - % output the `[mynode]' via a macro so it can be overridden. + % output the `[mynode]' via the macro below so it can be overridden. \xrefprintnodename\printedrefname % % But we always want a comma and a space: @@ -6126,11 +7969,37 @@ % % output the `page 3'. \turnoffactive \putwordpage\tie\refx{#1-pg}{}% - \fi + \fi\fi \fi \endlink \endgroup} +% Output a cross-manual xref to #1. Used just above (twice). +% +% Only include the text "Section ``foo'' in" if the foo is neither +% missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply +% "see The Foo Manual", the idea being to refer to the whole manual. +% +% But, this being TeX, we can't easily compare our node name against the +% string "Top" while ignoring the possible spaces before and after in +% the input. By adding the arbitrary 7sp below, we make it much less +% likely that a real node name would have the same width as "Top" (e.g., +% in a monospaced font). Hopefully it will never happen in practice. +% +% For the same basic reason, we retypeset the "Top" at every +% reference, since the current font is indeterminate. +% +\def\crossmanualxref#1{% + \setbox\toprefbox = \hbox{Top\kern7sp}% + \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}% + \ifdim \wd2 > 7sp % nonempty? + \ifdim \wd2 = \wd\toprefbox \else % same as Top? + \putwordSection{} ``\printedrefname'' \putwordin{}\space + \fi + \fi + #1% +} + % This macro is called from \xrefX for the `[nodename]' part of xref % output. It's a separate macro only so it can be changed more easily, % since square brackets don't work well in some documents. Particularly @@ -6181,7 +8050,8 @@ \angleleft un\-de\-fined\angleright \iflinks \ifhavexrefs - \message{\linenumber Undefined cross reference `#1'.}% + {\toks0 = {#1}% avoid expansion of possibly-complex value + \message{\linenumber Undefined cross reference `\the\toks0'.}}% \else \ifwarnedxrefs\else \global\warnedxrefstrue @@ -6201,10 +8071,18 @@ % collisions). But if this is a float type, we have more work to do. % \def\xrdef#1#2{% - \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. + {% The node name might contain 8-bit characters, which in our current + % implementation are changed to commands like @'e. Don't let these + % mess up the control sequence name. + \indexnofonts + \turnoffactive + \xdef\safexrefname{#1}% + }% + % + \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref % % Was that xref control sequence that we just defined for a float? - \expandafter\iffloat\csname XR#1\endcsname + \expandafter\iffloat\csname XR\safexrefname\endcsname % it was a float, and we have the (safe) float type in \iffloattype. \expandafter\let\expandafter\floatlist \csname floatlist\iffloattype\endcsname @@ -6219,7 +8097,8 @@ % % Remember this xref in the control sequence \floatlistFLOATTYPE, % for later use in \listoffloats. - \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 + {\safexrefname}}% \fi } @@ -6323,6 +8202,7 @@ \input\jobname.#1 \endgroup} + \message{insertions,} % including footnotes. @@ -6335,7 +8215,7 @@ % space to prevent strange expansion errors.) \def\supereject{\par\penalty -20000\footnoteno =0 } -% @footnotestyle is meaningful for info output only. +% @footnotestyle is meaningful for Info output only. \let\footnotestyle=\comment {\catcode `\@=11 @@ -6398,6 +8278,8 @@ % expands into a box, it must come within the paragraph, lest it % provide a place where TeX can split the footnote. \footstrut + % + % Invoke rest of plain TeX footnote routine. \futurelet\next\fo at t } }%end \catcode `\@=11 @@ -6405,7 +8287,7 @@ % In case a @footnote appears in a vbox, save the footnote text and create % the real \insert just after the vbox finished. Otherwise, the insertion % would be lost. -% Similarily, if a @footnote appears inside an alignment, save the footnote +% Similarly, if a @footnote appears inside an alignment, save the footnote % text to a box and make the \insert when a row of the table is finished. % And the same can be done for other insert classes. --kasal, 16nov03. @@ -6485,7 +8367,7 @@ it from ftp://tug.org/tex/epsf.tex.} % \def\image#1{% - \ifx\epsfbox\undefined + \ifx\epsfbox\thisisundefined \ifwarnednoepsf \else \errhelp = \noepsfhelp \errmessage{epsf.tex not found, images will be ignored}% @@ -6501,7 +8383,7 @@ % #2 is (optional) width, #3 is (optional) height. % #4 is (ignored optional) html alt text. % #5 is (ignored optional) extension. -% #6 is just the usual extra ignored arg for parsing this stuff. +% #6 is just the usual extra ignored arg for parsing stuff. \newif\ifimagevmode \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup \catcode`\^^M = 5 % in case we're inside an example @@ -6509,15 +8391,30 @@ % If the image is by itself, center it. \ifvmode \imagevmodetrue - \nobreak\bigskip + \else \ifx\centersub\centerV + % for @center @image, we need a vbox so we can have our vertical space + \imagevmodetrue + \vbox\bgroup % vbox has better behavior than vtop herev + \fi\fi + % + \ifimagevmode + \nobreak\medskip % Usually we'll have text after the image which will insert % \parskip glue, so insert it here too to equalize the space % above and below. \nobreak\vskip\parskip \nobreak - \line\bgroup\hss \fi % + % Leave vertical mode so that indentation from an enclosing + % environment such as @quotation is respected. + % However, if we're at the top level, we don't want the + % normal paragraph indentation. + % On the other hand, if we are in the case of @center @image, we don't + % want to start a paragraph, which will create a hsize-width box and + % eradicate the centering. + \ifx\centersub\centerV\else \noindent \fi + % % Output the image. \ifpdf \dopdfimage{#1}{#2}{#3}% @@ -6528,7 +8425,10 @@ \epsfbox{#1.eps}% \fi % - \ifimagevmode \hss \egroup \bigbreak \fi % space after the image + \ifimagevmode + \medskip % space after a standalone image + \fi + \ifx\centersub\centerV \egroup \fi \endgroup} @@ -6595,13 +8495,13 @@ \global\advance\floatno by 1 % {% - % This magic value for \thissection is output by \setref as the + % This magic value for \lastsection is output by \setref as the % XREFLABEL-title value. \xrefX uses it to distinguish float % labels (which have a completely different output format) from % node and anchor labels. And \xrdef uses it to construct the % lists of floats. % - \edef\thissection{\floatmagic=\safefloattype}% + \edef\lastsection{\floatmagic=\safefloattype}% \setref{\floatlabel}{Yfloat}% }% \fi @@ -6669,6 +8569,7 @@ % caption if specified, else the full caption if specified, else nothing. {% \atdummies + % % since we read the caption text in the macro world, where ^^M % is turned into a normal character, we have to scan it back, so % we don't write the literal three characters "^^M" into the aux file. @@ -6689,8 +8590,9 @@ % % place the captured inserts % - % BEWARE: when the floats start float, we have to issue warning whenever an - % insert appears inside a float which could possibly float. --kasal, 26may04 + % BEWARE: when the floats start floating, we have to issue warning + % whenever an insert appears inside a float which could possibly + % float. --kasal, 26may04 % \checkinserts } @@ -6734,7 +8636,7 @@ % #1 is the control sequence we are passed; we expand into a conditional % which is true if #1 represents a float ref. That is, the magic -% \thissection value which we \setref above. +% \lastsection value which we \setref above. % \def\iffloat#1{\expandafter\doiffloat#1==\finish} % @@ -6795,39 +8697,909 @@ \writeentry }} + \message{localization,} -% and i18n. - -% @documentlanguage is usually given very early, just after -% @setfilename. If done too late, it may not override everything -% properly. Single argument is the language abbreviation. -% It would be nice if we could set up a hyphenation file here. -% -\parseargdef\documentlanguage{% + +% For single-language documents, @documentlanguage is usually given very +% early, just after @documentencoding. Single argument is the language +% (de) or locale (de_DE) abbreviation. +% +{ + \catcode`\_ = \active + \globaldefs=1 +\parseargdef\documentlanguage{\begingroup + \let_=\normalunderscore % normal _ character for filenames \tex % read txi-??.tex file in plain TeX. - % Read the file if it exists. + % Read the file by the name they passed if it exists. \openin 1 txi-#1.tex \ifeof 1 - \errhelp = \nolanghelp - \errmessage{Cannot read language file txi-#1.tex}% + \documentlanguagetrywithoutunderscore{#1_\finish}% \else + \globaldefs = 1 % everything in the txi-LL files needs to persist \input txi-#1.tex \fi \closein 1 - \endgroup -} + \endgroup % end raw TeX +\endgroup} +% +% If they passed de_DE, and txi-de_DE.tex doesn't exist, +% try txi-de.tex. +% +\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{% + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \globaldefs = 1 % everything in the txi-LL files needs to persist + \input txi-#1.tex + \fi + \closein 1 +} +}% end of special _ catcode +% \newhelp\nolanghelp{The given language definition file cannot be found or -is empty. Maybe you need to install it? In the current directory -should work if nowhere else does.} - - -% @documentencoding should change something in TeX eventually, most -% likely, but for now just recognize it. -\let\documentencoding = \comment - - -% Page size parameters. -% +is empty. Maybe you need to install it? Putting it in the current +directory should work if nowhere else does.} + +% This macro is called from txi-??.tex files; the first argument is the +% \language name to set (without the "\lang@" prefix), the second and +% third args are \{left,right}hyphenmin. +% +% The language names to pass are determined when the format is built. +% See the etex.log file created at that time, e.g., +% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. +% +% With TeX Live 2008, etex now includes hyphenation patterns for all +% available languages. This means we can support hyphenation in +% Texinfo, at least to some extent. (This still doesn't solve the +% accented characters problem.) +% +\catcode`@=11 +\def\txisetlanguage#1#2#3{% + % do not set the language if the name is undefined in the current TeX. + \expandafter\ifx\csname lang@#1\endcsname \relax + \message{no patterns for #1}% + \else + \global\language = \csname lang@#1\endcsname + \fi + % but there is no harm in adjusting the hyphenmin values regardless. + \global\lefthyphenmin = #2\relax + \global\righthyphenmin = #3\relax +} + +% Helpers for encodings. +% Set the catcode of characters 128 through 255 to the specified number. +% +\def\setnonasciicharscatcode#1{% + \count255=128 + \loop\ifnum\count255<256 + \global\catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} + +\def\setnonasciicharscatcodenonglobal#1{% + \count255=128 + \loop\ifnum\count255<256 + \catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} + +% @documentencoding sets the definition of non-ASCII characters +% according to the specified encoding. +% +\parseargdef\documentencoding{% + % Encoding being declared for the document. + \def\declaredencoding{\csname #1.enc\endcsname}% + % + % Supported encodings: names converted to tokens in order to be able + % to compare them with \ifx. + \def\ascii{\csname US-ASCII.enc\endcsname}% + \def\latnine{\csname ISO-8859-15.enc\endcsname}% + \def\latone{\csname ISO-8859-1.enc\endcsname}% + \def\lattwo{\csname ISO-8859-2.enc\endcsname}% + \def\utfeight{\csname UTF-8.enc\endcsname}% + % + \ifx \declaredencoding \ascii + \asciichardefs + % + \else \ifx \declaredencoding \lattwo + \setnonasciicharscatcode\active + \lattwochardefs + % + \else \ifx \declaredencoding \latone + \setnonasciicharscatcode\active + \latonechardefs + % + \else \ifx \declaredencoding \latnine + \setnonasciicharscatcode\active + \latninechardefs + % + \else \ifx \declaredencoding \utfeight + \setnonasciicharscatcode\active + \utfeightchardefs + % + \else + \message{Unknown document encoding #1, ignoring.}% + % + \fi % utfeight + \fi % latnine + \fi % latone + \fi % lattwo + \fi % ascii +} + +% A message to be logged when using a character that isn't available +% the default font encoding (OT1). +% +\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} + +% Take account of \c (plain) vs. \, (Texinfo) difference. +\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} + +% First, make active non-ASCII characters in order for them to be +% correctly categorized when TeX reads the replacement text of +% macros containing the character definitions. +\setnonasciicharscatcode\active +% +% Latin1 (ISO-8859-1) character definitions. +\def\latonechardefs{% + \gdef^^a0{\tie} + \gdef^^a1{\exclamdown} + \gdef^^a2{\missingcharmsg{CENT SIGN}} + \gdef^^a3{{\pounds}} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\missingcharmsg{YEN SIGN}} + \gdef^^a6{\missingcharmsg{BROKEN BAR}} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\copyright} + \gdef^^aa{\ordf} + \gdef^^ab{\guillemetleft} + \gdef^^ac{$\lnot$} + \gdef^^ad{\-} + \gdef^^ae{\registeredsymbol} + \gdef^^af{\={}} + % + \gdef^^b0{\textdegree} + \gdef^^b1{$\pm$} + \gdef^^b2{$^2$} + \gdef^^b3{$^3$} + \gdef^^b4{\'{}} + \gdef^^b5{$\mu$} + \gdef^^b6{\P} + % + \gdef^^b7{$^.$} + \gdef^^b8{\cedilla\ } + \gdef^^b9{$^1$} + \gdef^^ba{\ordm} + % + \gdef^^bb{\guillemetright} + \gdef^^bc{$1\over4$} + \gdef^^bd{$1\over2$} + \gdef^^be{$3\over4$} + \gdef^^bf{\questiondown} + % + \gdef^^c0{\`A} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\~A} + \gdef^^c4{\"A} + \gdef^^c5{\ringaccent A} + \gdef^^c6{\AE} + \gdef^^c7{\cedilla C} + \gdef^^c8{\`E} + \gdef^^c9{\'E} + \gdef^^ca{\^E} + \gdef^^cb{\"E} + \gdef^^cc{\`I} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\"I} + % + \gdef^^d0{\DH} + \gdef^^d1{\~N} + \gdef^^d2{\`O} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\~O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\O} + \gdef^^d9{\`U} + \gdef^^da{\'U} + \gdef^^db{\^U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\TH} + \gdef^^df{\ss} + % + \gdef^^e0{\`a} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\~a} + \gdef^^e4{\"a} + \gdef^^e5{\ringaccent a} + \gdef^^e6{\ae} + \gdef^^e7{\cedilla c} + \gdef^^e8{\`e} + \gdef^^e9{\'e} + \gdef^^ea{\^e} + \gdef^^eb{\"e} + \gdef^^ec{\`{\dotless i}} + \gdef^^ed{\'{\dotless i}} + \gdef^^ee{\^{\dotless i}} + \gdef^^ef{\"{\dotless i}} + % + \gdef^^f0{\dh} + \gdef^^f1{\~n} + \gdef^^f2{\`o} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\~o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\o} + \gdef^^f9{\`u} + \gdef^^fa{\'u} + \gdef^^fb{\^u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\th} + \gdef^^ff{\"y} +} + +% Latin9 (ISO-8859-15) encoding character definitions. +\def\latninechardefs{% + % Encoding is almost identical to Latin1. + \latonechardefs + % + \gdef^^a4{\euro} + \gdef^^a6{\v S} + \gdef^^a8{\v s} + \gdef^^b4{\v Z} + \gdef^^b8{\v z} + \gdef^^bc{\OE} + \gdef^^bd{\oe} + \gdef^^be{\"Y} +} + +% Latin2 (ISO-8859-2) character definitions. +\def\lattwochardefs{% + \gdef^^a0{\tie} + \gdef^^a1{\ogonek{A}} + \gdef^^a2{\u{}} + \gdef^^a3{\L} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\v L} + \gdef^^a6{\'S} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\v S} + \gdef^^aa{\cedilla S} + \gdef^^ab{\v T} + \gdef^^ac{\'Z} + \gdef^^ad{\-} + \gdef^^ae{\v Z} + \gdef^^af{\dotaccent Z} + % + \gdef^^b0{\textdegree} + \gdef^^b1{\ogonek{a}} + \gdef^^b2{\ogonek{ }} + \gdef^^b3{\l} + \gdef^^b4{\'{}} + \gdef^^b5{\v l} + \gdef^^b6{\'s} + \gdef^^b7{\v{}} + \gdef^^b8{\cedilla\ } + \gdef^^b9{\v s} + \gdef^^ba{\cedilla s} + \gdef^^bb{\v t} + \gdef^^bc{\'z} + \gdef^^bd{\H{}} + \gdef^^be{\v z} + \gdef^^bf{\dotaccent z} + % + \gdef^^c0{\'R} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\u A} + \gdef^^c4{\"A} + \gdef^^c5{\'L} + \gdef^^c6{\'C} + \gdef^^c7{\cedilla C} + \gdef^^c8{\v C} + \gdef^^c9{\'E} + \gdef^^ca{\ogonek{E}} + \gdef^^cb{\"E} + \gdef^^cc{\v E} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\v D} + % + \gdef^^d0{\DH} + \gdef^^d1{\'N} + \gdef^^d2{\v N} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\H O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\v R} + \gdef^^d9{\ringaccent U} + \gdef^^da{\'U} + \gdef^^db{\H U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\cedilla T} + \gdef^^df{\ss} + % + \gdef^^e0{\'r} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\u a} + \gdef^^e4{\"a} + \gdef^^e5{\'l} + \gdef^^e6{\'c} + \gdef^^e7{\cedilla c} + \gdef^^e8{\v c} + \gdef^^e9{\'e} + \gdef^^ea{\ogonek{e}} + \gdef^^eb{\"e} + \gdef^^ec{\v e} + \gdef^^ed{\'{\dotless{i}}} + \gdef^^ee{\^{\dotless{i}}} + \gdef^^ef{\v d} + % + \gdef^^f0{\dh} + \gdef^^f1{\'n} + \gdef^^f2{\v n} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\H o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\v r} + \gdef^^f9{\ringaccent u} + \gdef^^fa{\'u} + \gdef^^fb{\H u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\cedilla t} + \gdef^^ff{\dotaccent{}} +} + +% UTF-8 character definitions. +% +% This code to support UTF-8 is based on LaTeX's utf8.def, with some +% changes for Texinfo conventions. It is included here under the GPL by +% permission from Frank Mittelbach and the LaTeX team. +% +\newcount\countUTFx +\newcount\countUTFy +\newcount\countUTFz + +\gdef\UTFviiiTwoOctets#1#2{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\endcsname} +% +\gdef\UTFviiiThreeOctets#1#2#3{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} +% +\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} + +\gdef\UTFviiiDefined#1{% + \ifx #1\relax + \message{\linenumber Unicode char \string #1 not defined for Texinfo}% + \else + \expandafter #1% + \fi +} + +\begingroup + \catcode`\~13 + \catcode`\"12 + + \def\UTFviiiLoop{% + \global\catcode\countUTFx\active + \uccode`\~\countUTFx + \uppercase\expandafter{\UTFviiiTmp}% + \advance\countUTFx by 1 + \ifnum\countUTFx < \countUTFy + \expandafter\UTFviiiLoop + \fi} + + \countUTFx = "C2 + \countUTFy = "E0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiTwoOctets\string~}} + \UTFviiiLoop + + \countUTFx = "E0 + \countUTFy = "F0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiThreeOctets\string~}} + \UTFviiiLoop + + \countUTFx = "F0 + \countUTFy = "F4 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiFourOctets\string~}} + \UTFviiiLoop +\endgroup + +\begingroup + \catcode`\"=12 + \catcode`\<=12 + \catcode`\.=12 + \catcode`\,=12 + \catcode`\;=12 + \catcode`\!=12 + \catcode`\~=13 + + \gdef\DeclareUnicodeCharacter#1#2{% + \countUTFz = "#1\relax + %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% + \begingroup + \parseXMLCharref + \def\UTFviiiTwoOctets##1##2{% + \csname u8:##1\string ##2\endcsname}% + \def\UTFviiiThreeOctets##1##2##3{% + \csname u8:##1\string ##2\string ##3\endcsname}% + \def\UTFviiiFourOctets##1##2##3##4{% + \csname u8:##1\string ##2\string ##3\string ##4\endcsname}% + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter + \gdef\UTFviiiTmp{#2}% + \endgroup} + + \gdef\parseXMLCharref{% + \ifnum\countUTFz < "A0\relax + \errhelp = \EMsimple + \errmessage{Cannot define Unicode char value < 00A0}% + \else\ifnum\countUTFz < "800\relax + \parseUTFviiiA,% + \parseUTFviiiB C\UTFviiiTwoOctets.,% + \else\ifnum\countUTFz < "10000\relax + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiB E\UTFviiiThreeOctets.{,;}% + \else + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiA!% + \parseUTFviiiB F\UTFviiiFourOctets.{!,;}% + \fi\fi\fi + } + + \gdef\parseUTFviiiA#1{% + \countUTFx = \countUTFz + \divide\countUTFz by 64 + \countUTFy = \countUTFz + \multiply\countUTFz by 64 + \advance\countUTFx by -\countUTFz + \advance\countUTFx by 128 + \uccode `#1\countUTFx + \countUTFz = \countUTFy} + + \gdef\parseUTFviiiB#1#2#3#4{% + \advance\countUTFz by "#10\relax + \uccode `#3\countUTFz + \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} +\endgroup + +\def\utfeightchardefs{% + \DeclareUnicodeCharacter{00A0}{\tie} + \DeclareUnicodeCharacter{00A1}{\exclamdown} + \DeclareUnicodeCharacter{00A3}{\pounds} + \DeclareUnicodeCharacter{00A8}{\"{ }} + \DeclareUnicodeCharacter{00A9}{\copyright} + \DeclareUnicodeCharacter{00AA}{\ordf} + \DeclareUnicodeCharacter{00AB}{\guillemetleft} + \DeclareUnicodeCharacter{00AD}{\-} + \DeclareUnicodeCharacter{00AE}{\registeredsymbol} + \DeclareUnicodeCharacter{00AF}{\={ }} + + \DeclareUnicodeCharacter{00B0}{\ringaccent{ }} + \DeclareUnicodeCharacter{00B4}{\'{ }} + \DeclareUnicodeCharacter{00B8}{\cedilla{ }} + \DeclareUnicodeCharacter{00BA}{\ordm} + \DeclareUnicodeCharacter{00BB}{\guillemetright} + \DeclareUnicodeCharacter{00BF}{\questiondown} + + \DeclareUnicodeCharacter{00C0}{\`A} + \DeclareUnicodeCharacter{00C1}{\'A} + \DeclareUnicodeCharacter{00C2}{\^A} + \DeclareUnicodeCharacter{00C3}{\~A} + \DeclareUnicodeCharacter{00C4}{\"A} + \DeclareUnicodeCharacter{00C5}{\AA} + \DeclareUnicodeCharacter{00C6}{\AE} + \DeclareUnicodeCharacter{00C7}{\cedilla{C}} + \DeclareUnicodeCharacter{00C8}{\`E} + \DeclareUnicodeCharacter{00C9}{\'E} + \DeclareUnicodeCharacter{00CA}{\^E} + \DeclareUnicodeCharacter{00CB}{\"E} + \DeclareUnicodeCharacter{00CC}{\`I} + \DeclareUnicodeCharacter{00CD}{\'I} + \DeclareUnicodeCharacter{00CE}{\^I} + \DeclareUnicodeCharacter{00CF}{\"I} + + \DeclareUnicodeCharacter{00D0}{\DH} + \DeclareUnicodeCharacter{00D1}{\~N} + \DeclareUnicodeCharacter{00D2}{\`O} + \DeclareUnicodeCharacter{00D3}{\'O} + \DeclareUnicodeCharacter{00D4}{\^O} + \DeclareUnicodeCharacter{00D5}{\~O} + \DeclareUnicodeCharacter{00D6}{\"O} + \DeclareUnicodeCharacter{00D8}{\O} + \DeclareUnicodeCharacter{00D9}{\`U} + \DeclareUnicodeCharacter{00DA}{\'U} + \DeclareUnicodeCharacter{00DB}{\^U} + \DeclareUnicodeCharacter{00DC}{\"U} + \DeclareUnicodeCharacter{00DD}{\'Y} + \DeclareUnicodeCharacter{00DE}{\TH} + \DeclareUnicodeCharacter{00DF}{\ss} + + \DeclareUnicodeCharacter{00E0}{\`a} + \DeclareUnicodeCharacter{00E1}{\'a} + \DeclareUnicodeCharacter{00E2}{\^a} + \DeclareUnicodeCharacter{00E3}{\~a} + \DeclareUnicodeCharacter{00E4}{\"a} + \DeclareUnicodeCharacter{00E5}{\aa} + \DeclareUnicodeCharacter{00E6}{\ae} + \DeclareUnicodeCharacter{00E7}{\cedilla{c}} + \DeclareUnicodeCharacter{00E8}{\`e} + \DeclareUnicodeCharacter{00E9}{\'e} + \DeclareUnicodeCharacter{00EA}{\^e} + \DeclareUnicodeCharacter{00EB}{\"e} + \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}} + \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}} + \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}} + \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}} + + \DeclareUnicodeCharacter{00F0}{\dh} + \DeclareUnicodeCharacter{00F1}{\~n} + \DeclareUnicodeCharacter{00F2}{\`o} + \DeclareUnicodeCharacter{00F3}{\'o} + \DeclareUnicodeCharacter{00F4}{\^o} + \DeclareUnicodeCharacter{00F5}{\~o} + \DeclareUnicodeCharacter{00F6}{\"o} + \DeclareUnicodeCharacter{00F8}{\o} + \DeclareUnicodeCharacter{00F9}{\`u} + \DeclareUnicodeCharacter{00FA}{\'u} + \DeclareUnicodeCharacter{00FB}{\^u} + \DeclareUnicodeCharacter{00FC}{\"u} + \DeclareUnicodeCharacter{00FD}{\'y} + \DeclareUnicodeCharacter{00FE}{\th} + \DeclareUnicodeCharacter{00FF}{\"y} + + \DeclareUnicodeCharacter{0100}{\=A} + \DeclareUnicodeCharacter{0101}{\=a} + \DeclareUnicodeCharacter{0102}{\u{A}} + \DeclareUnicodeCharacter{0103}{\u{a}} + \DeclareUnicodeCharacter{0104}{\ogonek{A}} + \DeclareUnicodeCharacter{0105}{\ogonek{a}} + \DeclareUnicodeCharacter{0106}{\'C} + \DeclareUnicodeCharacter{0107}{\'c} + \DeclareUnicodeCharacter{0108}{\^C} + \DeclareUnicodeCharacter{0109}{\^c} + \DeclareUnicodeCharacter{0118}{\ogonek{E}} + \DeclareUnicodeCharacter{0119}{\ogonek{e}} + \DeclareUnicodeCharacter{010A}{\dotaccent{C}} + \DeclareUnicodeCharacter{010B}{\dotaccent{c}} + \DeclareUnicodeCharacter{010C}{\v{C}} + \DeclareUnicodeCharacter{010D}{\v{c}} + \DeclareUnicodeCharacter{010E}{\v{D}} + + \DeclareUnicodeCharacter{0112}{\=E} + \DeclareUnicodeCharacter{0113}{\=e} + \DeclareUnicodeCharacter{0114}{\u{E}} + \DeclareUnicodeCharacter{0115}{\u{e}} + \DeclareUnicodeCharacter{0116}{\dotaccent{E}} + \DeclareUnicodeCharacter{0117}{\dotaccent{e}} + \DeclareUnicodeCharacter{011A}{\v{E}} + \DeclareUnicodeCharacter{011B}{\v{e}} + \DeclareUnicodeCharacter{011C}{\^G} + \DeclareUnicodeCharacter{011D}{\^g} + \DeclareUnicodeCharacter{011E}{\u{G}} + \DeclareUnicodeCharacter{011F}{\u{g}} + + \DeclareUnicodeCharacter{0120}{\dotaccent{G}} + \DeclareUnicodeCharacter{0121}{\dotaccent{g}} + \DeclareUnicodeCharacter{0124}{\^H} + \DeclareUnicodeCharacter{0125}{\^h} + \DeclareUnicodeCharacter{0128}{\~I} + \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}} + \DeclareUnicodeCharacter{012A}{\=I} + \DeclareUnicodeCharacter{012B}{\={\dotless{i}}} + \DeclareUnicodeCharacter{012C}{\u{I}} + \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}} + + \DeclareUnicodeCharacter{0130}{\dotaccent{I}} + \DeclareUnicodeCharacter{0131}{\dotless{i}} + \DeclareUnicodeCharacter{0132}{IJ} + \DeclareUnicodeCharacter{0133}{ij} + \DeclareUnicodeCharacter{0134}{\^J} + \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}} + \DeclareUnicodeCharacter{0139}{\'L} + \DeclareUnicodeCharacter{013A}{\'l} + + \DeclareUnicodeCharacter{0141}{\L} + \DeclareUnicodeCharacter{0142}{\l} + \DeclareUnicodeCharacter{0143}{\'N} + \DeclareUnicodeCharacter{0144}{\'n} + \DeclareUnicodeCharacter{0147}{\v{N}} + \DeclareUnicodeCharacter{0148}{\v{n}} + \DeclareUnicodeCharacter{014C}{\=O} + \DeclareUnicodeCharacter{014D}{\=o} + \DeclareUnicodeCharacter{014E}{\u{O}} + \DeclareUnicodeCharacter{014F}{\u{o}} + + \DeclareUnicodeCharacter{0150}{\H{O}} + \DeclareUnicodeCharacter{0151}{\H{o}} + \DeclareUnicodeCharacter{0152}{\OE} + \DeclareUnicodeCharacter{0153}{\oe} + \DeclareUnicodeCharacter{0154}{\'R} + \DeclareUnicodeCharacter{0155}{\'r} + \DeclareUnicodeCharacter{0158}{\v{R}} + \DeclareUnicodeCharacter{0159}{\v{r}} + \DeclareUnicodeCharacter{015A}{\'S} + \DeclareUnicodeCharacter{015B}{\'s} + \DeclareUnicodeCharacter{015C}{\^S} + \DeclareUnicodeCharacter{015D}{\^s} + \DeclareUnicodeCharacter{015E}{\cedilla{S}} + \DeclareUnicodeCharacter{015F}{\cedilla{s}} + + \DeclareUnicodeCharacter{0160}{\v{S}} + \DeclareUnicodeCharacter{0161}{\v{s}} + \DeclareUnicodeCharacter{0162}{\cedilla{t}} + \DeclareUnicodeCharacter{0163}{\cedilla{T}} + \DeclareUnicodeCharacter{0164}{\v{T}} + + \DeclareUnicodeCharacter{0168}{\~U} + \DeclareUnicodeCharacter{0169}{\~u} + \DeclareUnicodeCharacter{016A}{\=U} + \DeclareUnicodeCharacter{016B}{\=u} + \DeclareUnicodeCharacter{016C}{\u{U}} + \DeclareUnicodeCharacter{016D}{\u{u}} + \DeclareUnicodeCharacter{016E}{\ringaccent{U}} + \DeclareUnicodeCharacter{016F}{\ringaccent{u}} + + \DeclareUnicodeCharacter{0170}{\H{U}} + \DeclareUnicodeCharacter{0171}{\H{u}} + \DeclareUnicodeCharacter{0174}{\^W} + \DeclareUnicodeCharacter{0175}{\^w} + \DeclareUnicodeCharacter{0176}{\^Y} + \DeclareUnicodeCharacter{0177}{\^y} + \DeclareUnicodeCharacter{0178}{\"Y} + \DeclareUnicodeCharacter{0179}{\'Z} + \DeclareUnicodeCharacter{017A}{\'z} + \DeclareUnicodeCharacter{017B}{\dotaccent{Z}} + \DeclareUnicodeCharacter{017C}{\dotaccent{z}} + \DeclareUnicodeCharacter{017D}{\v{Z}} + \DeclareUnicodeCharacter{017E}{\v{z}} + + \DeclareUnicodeCharacter{01C4}{D\v{Z}} + \DeclareUnicodeCharacter{01C5}{D\v{z}} + \DeclareUnicodeCharacter{01C6}{d\v{z}} + \DeclareUnicodeCharacter{01C7}{LJ} + \DeclareUnicodeCharacter{01C8}{Lj} + \DeclareUnicodeCharacter{01C9}{lj} + \DeclareUnicodeCharacter{01CA}{NJ} + \DeclareUnicodeCharacter{01CB}{Nj} + \DeclareUnicodeCharacter{01CC}{nj} + \DeclareUnicodeCharacter{01CD}{\v{A}} + \DeclareUnicodeCharacter{01CE}{\v{a}} + \DeclareUnicodeCharacter{01CF}{\v{I}} + + \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}} + \DeclareUnicodeCharacter{01D1}{\v{O}} + \DeclareUnicodeCharacter{01D2}{\v{o}} + \DeclareUnicodeCharacter{01D3}{\v{U}} + \DeclareUnicodeCharacter{01D4}{\v{u}} + + \DeclareUnicodeCharacter{01E2}{\={\AE}} + \DeclareUnicodeCharacter{01E3}{\={\ae}} + \DeclareUnicodeCharacter{01E6}{\v{G}} + \DeclareUnicodeCharacter{01E7}{\v{g}} + \DeclareUnicodeCharacter{01E8}{\v{K}} + \DeclareUnicodeCharacter{01E9}{\v{k}} + + \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}} + \DeclareUnicodeCharacter{01F1}{DZ} + \DeclareUnicodeCharacter{01F2}{Dz} + \DeclareUnicodeCharacter{01F3}{dz} + \DeclareUnicodeCharacter{01F4}{\'G} + \DeclareUnicodeCharacter{01F5}{\'g} + \DeclareUnicodeCharacter{01F8}{\`N} + \DeclareUnicodeCharacter{01F9}{\`n} + \DeclareUnicodeCharacter{01FC}{\'{\AE}} + \DeclareUnicodeCharacter{01FD}{\'{\ae}} + \DeclareUnicodeCharacter{01FE}{\'{\O}} + \DeclareUnicodeCharacter{01FF}{\'{\o}} + + \DeclareUnicodeCharacter{021E}{\v{H}} + \DeclareUnicodeCharacter{021F}{\v{h}} + + \DeclareUnicodeCharacter{0226}{\dotaccent{A}} + \DeclareUnicodeCharacter{0227}{\dotaccent{a}} + \DeclareUnicodeCharacter{0228}{\cedilla{E}} + \DeclareUnicodeCharacter{0229}{\cedilla{e}} + \DeclareUnicodeCharacter{022E}{\dotaccent{O}} + \DeclareUnicodeCharacter{022F}{\dotaccent{o}} + + \DeclareUnicodeCharacter{0232}{\=Y} + \DeclareUnicodeCharacter{0233}{\=y} + \DeclareUnicodeCharacter{0237}{\dotless{j}} + + \DeclareUnicodeCharacter{02DB}{\ogonek{ }} + + \DeclareUnicodeCharacter{1E02}{\dotaccent{B}} + \DeclareUnicodeCharacter{1E03}{\dotaccent{b}} + \DeclareUnicodeCharacter{1E04}{\udotaccent{B}} + \DeclareUnicodeCharacter{1E05}{\udotaccent{b}} + \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}} + \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}} + \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}} + \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}} + \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}} + \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}} + \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}} + \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}} + + \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}} + \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}} + + \DeclareUnicodeCharacter{1E20}{\=G} + \DeclareUnicodeCharacter{1E21}{\=g} + \DeclareUnicodeCharacter{1E22}{\dotaccent{H}} + \DeclareUnicodeCharacter{1E23}{\dotaccent{h}} + \DeclareUnicodeCharacter{1E24}{\udotaccent{H}} + \DeclareUnicodeCharacter{1E25}{\udotaccent{h}} + \DeclareUnicodeCharacter{1E26}{\"H} + \DeclareUnicodeCharacter{1E27}{\"h} + + \DeclareUnicodeCharacter{1E30}{\'K} + \DeclareUnicodeCharacter{1E31}{\'k} + \DeclareUnicodeCharacter{1E32}{\udotaccent{K}} + \DeclareUnicodeCharacter{1E33}{\udotaccent{k}} + \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}} + \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}} + \DeclareUnicodeCharacter{1E36}{\udotaccent{L}} + \DeclareUnicodeCharacter{1E37}{\udotaccent{l}} + \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}} + \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}} + \DeclareUnicodeCharacter{1E3E}{\'M} + \DeclareUnicodeCharacter{1E3F}{\'m} + + \DeclareUnicodeCharacter{1E40}{\dotaccent{M}} + \DeclareUnicodeCharacter{1E41}{\dotaccent{m}} + \DeclareUnicodeCharacter{1E42}{\udotaccent{M}} + \DeclareUnicodeCharacter{1E43}{\udotaccent{m}} + \DeclareUnicodeCharacter{1E44}{\dotaccent{N}} + \DeclareUnicodeCharacter{1E45}{\dotaccent{n}} + \DeclareUnicodeCharacter{1E46}{\udotaccent{N}} + \DeclareUnicodeCharacter{1E47}{\udotaccent{n}} + \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}} + \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}} + + \DeclareUnicodeCharacter{1E54}{\'P} + \DeclareUnicodeCharacter{1E55}{\'p} + \DeclareUnicodeCharacter{1E56}{\dotaccent{P}} + \DeclareUnicodeCharacter{1E57}{\dotaccent{p}} + \DeclareUnicodeCharacter{1E58}{\dotaccent{R}} + \DeclareUnicodeCharacter{1E59}{\dotaccent{r}} + \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}} + \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}} + \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}} + \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}} + + \DeclareUnicodeCharacter{1E60}{\dotaccent{S}} + \DeclareUnicodeCharacter{1E61}{\dotaccent{s}} + \DeclareUnicodeCharacter{1E62}{\udotaccent{S}} + \DeclareUnicodeCharacter{1E63}{\udotaccent{s}} + \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}} + \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}} + \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}} + \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}} + \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}} + \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}} + + \DeclareUnicodeCharacter{1E7C}{\~V} + \DeclareUnicodeCharacter{1E7D}{\~v} + \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}} + \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}} + + \DeclareUnicodeCharacter{1E80}{\`W} + \DeclareUnicodeCharacter{1E81}{\`w} + \DeclareUnicodeCharacter{1E82}{\'W} + \DeclareUnicodeCharacter{1E83}{\'w} + \DeclareUnicodeCharacter{1E84}{\"W} + \DeclareUnicodeCharacter{1E85}{\"w} + \DeclareUnicodeCharacter{1E86}{\dotaccent{W}} + \DeclareUnicodeCharacter{1E87}{\dotaccent{w}} + \DeclareUnicodeCharacter{1E88}{\udotaccent{W}} + \DeclareUnicodeCharacter{1E89}{\udotaccent{w}} + \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}} + \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}} + \DeclareUnicodeCharacter{1E8C}{\"X} + \DeclareUnicodeCharacter{1E8D}{\"x} + \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}} + \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}} + + \DeclareUnicodeCharacter{1E90}{\^Z} + \DeclareUnicodeCharacter{1E91}{\^z} + \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}} + \DeclareUnicodeCharacter{1E93}{\udotaccent{z}} + \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}} + \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}} + \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}} + \DeclareUnicodeCharacter{1E97}{\"t} + \DeclareUnicodeCharacter{1E98}{\ringaccent{w}} + \DeclareUnicodeCharacter{1E99}{\ringaccent{y}} + + \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}} + \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}} + + \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}} + \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}} + \DeclareUnicodeCharacter{1EBC}{\~E} + \DeclareUnicodeCharacter{1EBD}{\~e} + + \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}} + \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}} + \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}} + \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}} + + \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}} + \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}} + + \DeclareUnicodeCharacter{1EF2}{\`Y} + \DeclareUnicodeCharacter{1EF3}{\`y} + \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}} + + \DeclareUnicodeCharacter{1EF8}{\~Y} + \DeclareUnicodeCharacter{1EF9}{\~y} + + \DeclareUnicodeCharacter{2013}{--} + \DeclareUnicodeCharacter{2014}{---} + \DeclareUnicodeCharacter{2018}{\quoteleft} + \DeclareUnicodeCharacter{2019}{\quoteright} + \DeclareUnicodeCharacter{201A}{\quotesinglbase} + \DeclareUnicodeCharacter{201C}{\quotedblleft} + \DeclareUnicodeCharacter{201D}{\quotedblright} + \DeclareUnicodeCharacter{201E}{\quotedblbase} + \DeclareUnicodeCharacter{2022}{\bullet} + \DeclareUnicodeCharacter{2026}{\dots} + \DeclareUnicodeCharacter{2039}{\guilsinglleft} + \DeclareUnicodeCharacter{203A}{\guilsinglright} + \DeclareUnicodeCharacter{20AC}{\euro} + + \DeclareUnicodeCharacter{2192}{\expansion} + \DeclareUnicodeCharacter{21D2}{\result} + + \DeclareUnicodeCharacter{2212}{\minus} + \DeclareUnicodeCharacter{2217}{\point} + \DeclareUnicodeCharacter{2261}{\equiv} +}% end of \utfeightchardefs + + +% US-ASCII character definitions. +\def\asciichardefs{% nothing need be done + \relax +} + +% Make non-ASCII characters printable again for compatibility with +% existing Texinfo documents that may use them, even without declaring a +% document encoding. +% +\setnonasciicharscatcode \other + + +\message{formatting,} + \newdimen\defaultparindent \defaultparindent = 15pt \chapheadingskip = 15pt plus 4pt minus 2pt @@ -6837,10 +9609,10 @@ % Prevent underfull vbox error messages. \vbadness = 10000 -% Don't be so finicky about underfull hboxes, either. -\hbadness = 2000 - -% Following George Bush, just get rid of widows and orphans. +% Don't be very finicky about underfull hboxes, either. +\hbadness = 6666 + +% Following George Bush, get rid of widows and orphans. \widowpenalty=10000 \clubpenalty=10000 @@ -6887,6 +9659,10 @@ \ifpdf \pdfpageheight #7\relax \pdfpagewidth #8\relax + % if we don't reset these, they will remain at "1 true in" of + % whatever layout pdftex was dumped with. + \pdfhorigin = 1 true in + \pdfvorigin = 1 true in \fi % \setleading{\textleading} @@ -6901,7 +9677,7 @@ \textleading = 13.2pt % % If page is nothing but text, make it come out even. - \internalpagesizes{46\baselineskip}{6in}% + \internalpagesizes{607.2pt}{6in}% that's 46 lines {\voffset}{.25in}% {\bindingoffset}{36pt}% {11in}{8.5in}% @@ -6913,7 +9689,7 @@ \textleading = 12pt % \internalpagesizes{7.5in}{5in}% - {\voffset}{.25in}% + {-.2in}{0in}% {\bindingoffset}{16pt}% {9.25in}{7in}% % @@ -6957,7 +9733,7 @@ % \global\normaloffset = -6mm % \global\bindingoffset = 10mm % @end tex - \internalpagesizes{51\baselineskip}{160mm} + \internalpagesizes{673.2pt}{160mm}% that's 51 lines {\voffset}{\hoffset}% {\bindingoffset}{44pt}% {297mm}{210mm}% @@ -7022,7 +9798,7 @@ \parskip = 3pt plus 2pt minus 1pt \setleading{\textleading}% % - \dimen0 = #1 + \dimen0 = #1\relax \advance\dimen0 by \voffset % \dimen2 = \hsize @@ -7041,25 +9817,21 @@ \message{and turning on texinfo input format.} +\def^^L{\par} % remove \outer, so ^L can appear in an @comment + +% DEL is a comment character, in case @c does not suffice. +\catcode`\^^? = 14 + % Define macros to output various characters with catcode for normal text. -\catcode`\"=\other -\catcode`\~=\other -\catcode`\^=\other -\catcode`\_=\other -\catcode`\|=\other -\catcode`\<=\other -\catcode`\>=\other -\catcode`\+=\other -\catcode`\$=\other -\def\normaldoublequote{"} -\def\normaltilde{~} -\def\normalcaret{^} -\def\normalunderscore{_} -\def\normalverticalbar{|} -\def\normalless{<} -\def\normalgreater{>} -\def\normalplus{+} -\def\normaldollar{$}%$ font-lock fix +\catcode`\"=\other \def\normaldoublequote{"} +\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix +\catcode`\+=\other \def\normalplus{+} +\catcode`\<=\other \def\normalless{<} +\catcode`\>=\other \def\normalgreater{>} +\catcode`\^=\other \def\normalcaret{^} +\catcode`\_=\other \def\normalunderscore{_} +\catcode`\|=\other \def\normalverticalbar{|} +\catcode`\~=\other \def\normaltilde{~} % This macro is used to make a character print one way in \tt % (where it can probably be output as-is), and another way in other fonts, @@ -7117,6 +9889,13 @@ % \otherifyactive is called near the end of this file. \def\otherifyactive{\catcode`+=\other \catcode`\_=\other} +% Used sometimes to turn off (effectively) the active characters even after +% parsing them. +\def\turnoffactive{% + \normalturnoffactive + \otherbackslash +} + \catcode`\@=0 % \backslashcurfont outputs one backslash character in current font, @@ -7124,45 +9903,52 @@ \global\chardef\backslashcurfont=`\\ \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work -% \rawbackslash defines an active \ to do \backslashcurfont. -% \otherbackslash defines an active \ to be a literal `\' character with -% catcode other. -{\catcode`\\=\active - @gdef at rawbackslash{@let\=@backslashcurfont} - @gdef at otherbackslash{@let\=@realbackslash} -} - % \realbackslash is an actual character `\' with catcode other, and % \doublebackslash is two of them (for the pdf outlines). {\catcode`\\=\other @gdef at realbackslash{\} @gdef at doublebackslash{\\}} -% \normalbackslash outputs one backslash in fixed width font. -\def\normalbackslash{{\tt\backslashcurfont}} - -\catcode`\\=\active - -% Used sometimes to turn off (effectively) the active characters -% even after parsing them. - at def@turnoffactive{% +% In texinfo, backslash is an active character; it prints the backslash +% in fixed width font. +\catcode`\\=\active % @ for escape char from now on. + +% The story here is that in math mode, the \char of \backslashcurfont +% ends up printing the roman \ from the math symbol font (because \char +% in math mode uses the \mathcode, and plain.tex sets +% \mathcode`\\="026E). It seems better for @backslashchar{} to always +% print a typewriter backslash, hence we use an explicit \mathchar, +% which is the decimal equivalent of "715c (class 7, e.g., use \fam; +% ignored family value; char position "5C). We can't use " for the +% usual hex value because it has already been made active. + at def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} + at let@backslashchar = @normalbackslash % @backslashchar{} is for user documents. + +% On startup, @fixbackslash assigns: +% @let \ = @normalbackslash +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. We switch back and forth between these. + at gdef@rawbackslash{@let\=@backslashcurfont} + at gdef@otherbackslash{@let\=@realbackslash} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. +% + at def@normalturnoffactive{% @let"=@normaldoublequote - @let\=@realbackslash - @let~=@normaltilde + @let$=@normaldollar %$ font-lock fix + @let+=@normalplus + @let<=@normalless + @let>=@normalgreater + @let\=@normalbackslash @let^=@normalcaret @let_=@normalunderscore @let|=@normalverticalbar - @let<=@normalless - @let>=@normalgreater - @let+=@normalplus - @let$=@normaldollar %$ font-lock fix + @let~=@normaltilde + @markupsetuplqdefault + @markupsetuprqdefault @unsepspaces } -% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of -% the literal character `\'. (Thus, \ is not expandable when this is in -% effect.) -% - at def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} - % Make _ and + \other characters, temporarily. % This is canceled by @fixbackslash. @otherifyactive @@ -7175,7 +9961,7 @@ @global at let\ = @eatinput % On the other hand, perhaps the file did not have a `\input texinfo'. Then -% the first `\{ in the file would cause an error. This macro tries to fix +% the first `\' in the file would cause an error. This macro tries to fix % that, assuming it is called before the first `\' could plausibly occur. % Also turn back on active characters that might appear in the input % file name, in case not using a pre-dumped format. @@ -7189,11 +9975,28 @@ % Say @foo, not \foo, in error messages. @escapechar = `@@ +% These (along with & and #) are made active for url-breaking, so need +% active definitions as the normal characters. + at def@normaldot{.} + at def@normalquest{?} + at def@normalslash{/} + % These look ok in all fonts, so just make them not special. - at catcode`@& = @other - at catcode`@# = @other - at catcode`@% = @other - +% @hashchar{} gets its own user-level command, because of #line. + at catcode`@& = @other @def at normalamp{&} + at catcode`@# = @other @def at normalhash{#} + at catcode`@% = @other @def at normalpercent{%} + + at let @hashchar = @normalhash + + at c Finally, make ` and ' active, so that txicodequoteundirected and + at c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we + at c don't make ` and ' active, @code will not get them as active chars. + at c Do this last of all since we use ` in the previous @catcode assignments. + at catcode`@'=@active + at catcode`@`=@active + at markupsetuplqdefault + at markupsetuprqdefault @c Local variables: @c eval: (add-hook 'write-file-hooks 'time-stamp) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:34:03 2013 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 19 Mar 2013 23:34:03 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMik6?= =?utf-8?q?_merge_heads_in_3=2E2?= Message-ID: <3ZVpvv5ScczS5r@mail.python.org> http://hg.python.org/cpython/rev/fa475953f183 changeset: 82788:fa475953f183 branch: 3.2 parent: 82786:43e8da639462 parent: 82773:33f02ccb5301 user: Gregory P. Smith date: Tue Mar 19 15:03:26 2013 -0700 summary: merge heads in 3.2 files: Doc/library/http.client.rst | 6 +- Lib/imaplib.py | 2 + Lib/pydoc.py | 5 +- Lib/test/test_pydoc.py | 24 +++++++++++ Lib/test/test_urllib2.py | 3 + Lib/tkinter/test/test_ttk/test_widgets.py | 2 +- Misc/ACKS | 1 + Misc/NEWS | 9 ++++ Modules/_cursesmodule.c | 4 +- 9 files changed, 50 insertions(+), 6 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -51,7 +51,7 @@ .. versionchanged:: 3.2 *source_address* was added. - .. versionchanged:: 3.2 + .. deprecated:: 3.2 The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" are not supported anymore. @@ -89,7 +89,7 @@ This class now supports HTTPS virtual hosts if possible (that is, if :data:`ssl.HAS_SNI` is true). - .. versionchanged:: 3.2 + .. deprecated:: 3.2 The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" are not supported anymore. @@ -99,7 +99,7 @@ Class whose instances are returned upon successful connection. Not instantiated directly by user. - .. versionchanged:: 3.2 + .. deprecated:: 3.2 The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" are not supported anymore. diff --git a/Lib/imaplib.py b/Lib/imaplib.py --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -23,6 +23,7 @@ __version__ = "2.58" import binascii, errno, random, re, socket, subprocess, sys, time, calendar +from io import DEFAULT_BUFFER_SIZE try: import ssl @@ -1237,6 +1238,7 @@ self.sock = None self.file = None self.process = subprocess.Popen(self.command, + bufsize=DEFAULT_BUFFER_SIZE, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True, close_fds=True) self.writefile = self.process.stdin diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -137,7 +137,10 @@ return _re_stripid.sub(r'\1', text) def _is_some_method(obj): - return inspect.ismethod(obj) or inspect.ismethoddescriptor(obj) + return (inspect.isfunction(obj) or + inspect.ismethod(obj) or + inspect.isbuiltin(obj) or + inspect.ismethoddescriptor(obj)) def allmethods(cl): methods = {} diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -389,6 +389,30 @@ synopsis = pydoc.synopsis(TESTFN, {}) self.assertEqual(synopsis, 'line 1: h\xe9') + def test_allmethods(self): + # issue 17476: allmethods was no longer returning unbound methods. + # This test is a bit fragile in the face of changes to object and type, + # but I can't think of a better way to do it without duplicating the + # logic of the function under test. + + class TestClass(object): + def method_returning_true(self): + return True + + # What we expect to get back: everything on object... + expected = dict(vars(object)) + # ...plus our unbound method... + expected['method_returning_true'] = TestClass.method_returning_true + # ...but not the non-methods on object. + del expected['__doc__'] + del expected['__class__'] + # inspect resolves descriptors on type into methods, but vars doesn't, + # so we need to update __subclasshook__. + expected['__subclasshook__'] = TestClass.__subclasshook__ + + methods = pydoc.allmethods(TestClass) + self.assertDictEqual(methods, expected) + class PydocImportTest(unittest.TestCase): diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -47,6 +47,9 @@ for string, list in tests: self.assertEqual(urllib.request.parse_http_list(string), list) + def test_URLError_reasonstr(self): + err = urllib.error.URLError('reason') + self.assertIn(err.reason, str(err)) def test_request_headers_dict(): """ diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py --- a/Lib/tkinter/test/test_ttk/test_widgets.py +++ b/Lib/tkinter/test/test_ttk/test_widgets.py @@ -947,7 +947,7 @@ anchor=1) # XXX skipping for now; should be fixed to work with newer ttk - @unittest.skip + @unittest.skip("skipping pending resolution of Issue #10734") def test_heading_callback(self): def simulate_heading_click(x, y): support.simulate_mouse_click(self.tv, x, y) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1098,6 +1098,7 @@ Nathan Trapuzzano Laurence Tratt John Tromp +Diane Trout Jason Trowbridge Brent Tubbs Anthony Tuininga diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,6 +233,15 @@ Library ------- +- Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal. + +- Issue #17443: impalib.IMAP4_stream was using the default unbuffered IO + in subprocess, but the imap code assumes buffered IO. In Python2 this + worked by accident. IMAP4_stream now explicitly uses buffered IO. + +- Issue #17476: Fixed regression relative to Python2 in undocumented pydoc + 'allmethods'; it was missing unbound methods on the class. + - Issue #16389: Fixed a performance regression relative to Python 3.1 in the caching of compiled regular expressions. diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -895,7 +895,9 @@ } if (rtn == ERR) { /* getch() returns ERR in nodelay mode */ - PyErr_SetString(PyCursesError, "no input"); + PyErr_CheckSignals(); + if (!PyErr_Occurred()) + PyErr_SetString(PyCursesError, "no input"); return NULL; } else if (rtn<=255) { return Py_BuildValue("C", rtn); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:34:05 2013 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 19 Mar 2013 23:34:05 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4zIC0+IDMuMyk6?= =?utf-8?q?_merge_heads_in_3=2E3?= Message-ID: <3ZVpvx49TrzSFs@mail.python.org> http://hg.python.org/cpython/rev/b3385d7aee7c changeset: 82789:b3385d7aee7c branch: 3.3 parent: 82787:f23274357fc8 parent: 82774:4e59a7fc69c6 user: Gregory P. Smith date: Tue Mar 19 15:05:52 2013 -0700 summary: merge heads in 3.3 files: Doc/library/http.client.rst | 6 +- Lib/imaplib.py | 3 + Lib/pydoc.py | 5 +- Lib/test/test_pydoc.py | 24 +++++++++++ Lib/test/test_urllib2.py | 3 + Lib/tkinter/test/test_ttk/test_widgets.py | 2 +- Misc/ACKS | 1 + Misc/NEWS | 9 ++++ Modules/_cursesmodule.c | 4 +- 9 files changed, 51 insertions(+), 6 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -51,7 +51,7 @@ .. versionchanged:: 3.2 *source_address* was added. - .. versionchanged:: 3.2 + .. deprecated-removed:: 3.2 3.4 The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" are not supported anymore. @@ -89,7 +89,7 @@ This class now supports HTTPS virtual hosts if possible (that is, if :data:`ssl.HAS_SNI` is true). - .. versionchanged:: 3.2 + .. deprecated-removed:: 3.2 3.4 The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" are not supported anymore. @@ -99,7 +99,7 @@ Class whose instances are returned upon successful connection. Not instantiated directly by user. - .. versionchanged:: 3.2 + .. deprecated-removed:: 3.2 3.4 The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" are not supported anymore. diff --git a/Lib/imaplib.py b/Lib/imaplib.py --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -24,6 +24,8 @@ import binascii, errno, random, re, socket, subprocess, sys, time, calendar from datetime import datetime, timezone, timedelta +from io import DEFAULT_BUFFER_SIZE + try: import ssl HAVE_SSL = True @@ -1244,6 +1246,7 @@ self.sock = None self.file = None self.process = subprocess.Popen(self.command, + bufsize=DEFAULT_BUFFER_SIZE, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True, close_fds=True) self.writefile = self.process.stdin diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -132,7 +132,10 @@ return _re_stripid.sub(r'\1', text) def _is_some_method(obj): - return inspect.ismethod(obj) or inspect.ismethoddescriptor(obj) + return (inspect.isfunction(obj) or + inspect.ismethod(obj) or + inspect.isbuiltin(obj) or + inspect.ismethoddescriptor(obj)) def allmethods(cl): methods = {} diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -395,6 +395,30 @@ synopsis = pydoc.synopsis(TESTFN, {}) self.assertEqual(synopsis, 'line 1: h\xe9') + def test_allmethods(self): + # issue 17476: allmethods was no longer returning unbound methods. + # This test is a bit fragile in the face of changes to object and type, + # but I can't think of a better way to do it without duplicating the + # logic of the function under test. + + class TestClass(object): + def method_returning_true(self): + return True + + # What we expect to get back: everything on object... + expected = dict(vars(object)) + # ...plus our unbound method... + expected['method_returning_true'] = TestClass.method_returning_true + # ...but not the non-methods on object. + del expected['__doc__'] + del expected['__class__'] + # inspect resolves descriptors on type into methods, but vars doesn't, + # so we need to update __subclasshook__. + expected['__subclasshook__'] = TestClass.__subclasshook__ + + methods = pydoc.allmethods(TestClass) + self.assertDictEqual(methods, expected) + class PydocImportTest(unittest.TestCase): diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -64,6 +64,9 @@ for string, list in tests: self.assertEqual(urllib.request.parse_http_list(string), list) + def test_URLError_reasonstr(self): + err = urllib.error.URLError('reason') + self.assertIn(err.reason, str(err)) def test_request_headers_dict(): """ diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py --- a/Lib/tkinter/test/test_ttk/test_widgets.py +++ b/Lib/tkinter/test/test_ttk/test_widgets.py @@ -947,7 +947,7 @@ anchor=1) # XXX skipping for now; should be fixed to work with newer ttk - @unittest.skip + @unittest.skip("skipping pending resolution of Issue #10734") def test_heading_callback(self): def simulate_heading_click(x, y): support.simulate_mouse_click(self.tv, x, y) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1216,6 +1216,7 @@ Matthias Troffaes Tom Tromey John Tromp +Diane Trout Jason Trowbridge Brent Tubbs Anthony Tuininga diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -197,6 +197,15 @@ specifically addresses a stack misalignment issue on x86 and issues on some more recent platforms. +- Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal. + +- Issue #17443: imaplib.IMAP4_stream was using the default unbuffered IO + in subprocess, but the imap code assumes buffered IO. In Python2 this + worked by accident. IMAP4_stream now explicitly uses buffered IO. + +- Issue #17476: Fixed regression relative to Python2 in undocumented pydoc + 'allmethods'; it was missing unbound methods on the class. + - Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. - Issue #16389: Fixed a performance regression relative to Python 3.1 in the diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -1138,7 +1138,9 @@ } if (rtn == ERR) { /* getch() returns ERR in nodelay mode */ - PyErr_SetString(PyCursesError, "no input"); + PyErr_CheckSignals(); + if (!PyErr_Occurred()) + PyErr_SetString(PyCursesError, "no input"); return NULL; } else if (rtn<=255) { return Py_BuildValue("C", rtn); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:34:07 2013 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 19 Mar 2013 23:34:07 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4zIC0+IDMuMyk6?= =?utf-8?q?_merge_heads?= Message-ID: <3ZVpvz2ClnzS93@mail.python.org> http://hg.python.org/cpython/rev/9e501d0fb68c changeset: 82790:9e501d0fb68c branch: 3.3 parent: 82789:b3385d7aee7c parent: 82780:6dcc9628065c user: Gregory P. Smith date: Tue Mar 19 15:07:22 2013 -0700 summary: merge heads files: config.guess | 43 ++++++++++++---------- config.sub | 75 ++++++++++++++++++++++++--------------- 2 files changed, 70 insertions(+), 48 deletions(-) diff --git a/config.guess b/config.guess --- a/config.guess +++ b/config.guess @@ -2,13 +2,13 @@ # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# 2011, 2012, 2013 Free Software Foundation, Inc. -timestamp='2012-02-10' +timestamp='2012-12-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -22,19 +22,17 @@ # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches at gnu.org. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -55,8 +53,8 @@ Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -200,6 +198,10 @@ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} @@ -302,7 +304,7 @@ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -801,6 +803,9 @@ i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; @@ -1201,6 +1206,9 @@ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1256,7 +1264,7 @@ NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1330,9 +1338,6 @@ exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - eval $set_cc_for_build cat >$dummy.c <. @@ -26,11 +22,12 @@ # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches with a ChangeLog entry to config-patches at gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -74,8 +71,8 @@ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -123,7 +120,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) @@ -156,7 +153,7 @@ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; @@ -225,6 +222,12 @@ -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -253,8 +256,10 @@ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | be32 | be64 \ + | arc \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ @@ -267,7 +272,7 @@ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -383,7 +388,8 @@ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -782,9 +788,13 @@ basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze*) basic_machine=microblaze-xilinx ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) basic_machine=i386-pc os=-mingw32 @@ -1013,7 +1023,11 @@ basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1346,15 +1360,15 @@ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ @@ -1537,6 +1551,9 @@ c4x-* | tic4x-*) os=-coff ;; + hexagon-*) + os=-elf + ;; tic54x-*) os=-coff ;; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:34:09 2013 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 19 Mar 2013 23:34:09 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Fixes_Issue_=2317192=3A_Update_the_ctypes_module=27s_lib?= =?utf-8?q?ffi_to_v3=2E0=2E13=2E__This?= Message-ID: <3ZVpw15wL4zSFs@mail.python.org> http://hg.python.org/cpython/rev/a94b3b4599f1 changeset: 82791:a94b3b4599f1 parent: 82781:7779dbc20536 parent: 82790:9e501d0fb68c user: Gregory P. Smith date: Tue Mar 19 15:24:46 2013 -0700 summary: Fixes Issue #17192: Update the ctypes module's libffi to v3.0.13. This specifically addresses a stack misalignment issue on x86 and issues on some more recent platforms. files: Misc/NEWS | 6 +- Modules/_ctypes/libffi.diff | 141 ++-- Modules/_ctypes/libffi/.gitignore | 21 + Modules/_ctypes/libffi/.travis.yml | 8 + Modules/_ctypes/libffi/ChangeLog | 46 + Modules/_ctypes/libffi/Makefile.am | 72 +- Modules/_ctypes/libffi/Makefile.in | 107 +- Modules/_ctypes/libffi/README | 15 +- Modules/_ctypes/libffi/build-ios.sh | 0 Modules/_ctypes/libffi/configure | 50 +- Modules/_ctypes/libffi/configure.ac | 21 +- Modules/_ctypes/libffi/doc/libffi.info | Bin Modules/_ctypes/libffi/doc/libffi.texi | 2 +- Modules/_ctypes/libffi/doc/stamp-vti | 8 +- Modules/_ctypes/libffi/doc/version.texi | 8 +- Modules/_ctypes/libffi/fficonfig.py.in | 1 - Modules/_ctypes/libffi/libtool-ldflags | 0 Modules/_ctypes/libffi/ltmain.sh | 0 Modules/_ctypes/libffi/mdate-sh | 0 Modules/_ctypes/libffi/msvcc.sh | 0 Modules/_ctypes/libffi/src/arm/gentramp.sh | 0 Modules/_ctypes/libffi/src/closures.c | 6 +- Modules/_ctypes/libffi/src/dlmalloc.c | 12 +- Modules/_ctypes/libffi/src/ia64/ffi.c | 4 +- Modules/_ctypes/libffi/src/m68k/sysv.S | 45 +- Modules/_ctypes/libffi/src/metag/ffi.c | 330 ++++++++++ Modules/_ctypes/libffi/src/metag/ffitarget.h | 53 + Modules/_ctypes/libffi/src/metag/sysv.S | 311 +++++++++ Modules/_ctypes/libffi/src/mips/ffi.c | 11 +- Modules/_ctypes/libffi/src/powerpc/ffi.c | 54 +- Modules/_ctypes/libffi/src/sparc/ffi.c | 16 +- Modules/_ctypes/libffi/src/x86/ffi.c | 2 - Modules/_ctypes/libffi/src/x86/ffi64.c | 44 +- Modules/_ctypes/libffi/src/x86/ffitarget.h | 3 +- Modules/_ctypes/libffi/src/x86/sysv.S | 17 +- Modules/_ctypes/libffi/src/x86/unix64.S | 10 +- Modules/_ctypes/libffi/stamp-h.in | 1 + Modules/_ctypes/libffi/testsuite/Makefile.am | 145 ++-- Modules/_ctypes/libffi/testsuite/Makefile.in | 195 ++--- Modules/_ctypes/libffi/testsuite/lib/libffi.exp | 19 - Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c | 4 +- Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h | 44 +- Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c | 16 +- Modules/_ctypes/libffi/testsuite/libffi.call/huge_struct.c | 9 +- Modules/_ctypes/libffi/testsuite/libffi.call/many2.c | 5 +- 45 files changed, 1259 insertions(+), 603 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -289,9 +289,13 @@ Library ------- +- Issue #17192: Update the ctypes module's libffi to v3.0.13. This + specifically addresses a stack misalignment issue on x86 and issues on + some more recent platforms. + - Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal. -- Issue #17443: impalib.IMAP4_stream was using the default unbuffered IO +- Issue #17443: imaplib.IMAP4_stream was using the default unbuffered IO in subprocess, but the imap code assumes buffered IO. In Python2 this worked by accident. IMAP4_stream now explicitly uses buffered IO. diff --git a/Modules/_ctypes/libffi.diff b/Modules/_ctypes/libffi.diff --- a/Modules/_ctypes/libffi.diff +++ b/Modules/_ctypes/libffi.diff @@ -1,26 +1,19 @@ -diff -urN libffi.orig/configure.ac libffi/configure.ac ---- libffi.orig/configure.ac 2013-02-11 20:24:24.000000000 +0100 -+++ libffi/configure.ac 2013-02-12 15:05:46.209844321 +0100 -@@ -1,4 +1,7 @@ - dnl Process this with autoconf to create configure -+# -+# file from libffi - slightly patched for ctypes -+# - - AC_PREREQ(2.68) - -@@ -146,6 +149,10 @@ - fi +diff -r -N -u libffi.orig/autom4te.cache/output.0 libffi/autom4te.cache/output.0 +diff -r -N -u libffi.orig/configure libffi/configure +--- libffi.orig/configure 2013-03-17 15:37:50.000000000 -0700 ++++ libffi/configure 2013-03-18 15:11:39.611575163 -0700 +@@ -13368,6 +13368,10 @@ + fi ;; -+ i*86-*-nto-qnx*) -+ TARGET=X86; TARGETDIR=x86 -+ ;; ++ i*86-*-nto-qnx*) ++ TARGET=X86; TARGETDIR=x86 ++ ;; + x86_64-*-darwin*) TARGET=X86_DARWIN; TARGETDIR=x86 ;; -@@ -200,12 +207,12 @@ +@@ -13426,12 +13430,12 @@ ;; mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) @@ -35,39 +28,60 @@ ;; powerpc*-*-linux* | powerpc-*-sysv*) -@@ -265,7 +272,7 @@ - AC_MSG_ERROR(["libffi has not been ported to $host."]) +@@ -13491,7 +13495,7 @@ + as_fn_error $? "\"libffi has not been ported to $host.\"" "$LINENO" 5 fi --AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS) -+AM_CONDITIONAL(MIPS,[expr x$TARGET : 'xMIPS' > /dev/null]) - AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN) - AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) - AM_CONDITIONAL(X86, test x$TARGET = xX86) -@@ -562,4 +569,8 @@ +- if test x$TARGET = xMIPS; then ++ if expr x$TARGET : 'xMIPS' > /dev/null; then + MIPS_TRUE= + MIPS_FALSE='#' + else +@@ -14862,6 +14866,12 @@ + ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc" - AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc) -+AC_CONFIG_LINKS(include/ffi_common.h:include/ffi_common.h) ++ac_config_links="$ac_config_links include/ffi_common.h:include/ffi_common.h" + -+AC_CONFIG_FILES(fficonfig.py) + - AC_OUTPUT -diff -urN libffi.orig/configure libffi/configure ---- libffi.orig/configure 2013-02-11 20:24:24.000000000 +0100 -+++ libffi/configure 2013-02-12 15:11:42.353853081 +0100 -@@ -13366,6 +13366,10 @@ - fi ++ac_config_files="$ac_config_files fficonfig.py" ++ ++ + cat >confcache <<\_ACEOF + # This file is a shell script that caches the results of configure + # tests run on this system so they can be shared between configure +@@ -16047,6 +16057,8 @@ + "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;; + "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; + "libffi.pc") CONFIG_FILES="$CONFIG_FILES libffi.pc" ;; ++ "include/ffi_common.h") CONFIG_LINKS="$CONFIG_LINKS include/ffi_common.h:include/ffi_common.h" ;; ++ "fficonfig.py") CONFIG_FILES="$CONFIG_FILES fficonfig.py" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +diff -r -N -u libffi.orig/configure.ac libffi/configure.ac +--- libffi.orig/configure.ac 2013-03-17 15:37:50.000000000 -0700 ++++ libffi/configure.ac 2013-03-18 15:11:11.392989136 -0700 +@@ -1,4 +1,7 @@ + dnl Process this with autoconf to create configure ++# ++# file from libffi - slightly patched for Python's ctypes ++# + + AC_PREREQ(2.68) + +@@ -146,6 +149,10 @@ + fi ;; -+ i*86-*-nto-qnx*) -+ TARGET=X86; TARGETDIR=x86 -+ ;; ++ i*86-*-nto-qnx*) ++ TARGET=X86; TARGETDIR=x86 ++ ;; + x86_64-*-darwin*) TARGET=X86_DARWIN; TARGETDIR=x86 ;; -@@ -13420,12 +13424,12 @@ +@@ -204,12 +211,12 @@ ;; mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) @@ -82,41 +96,27 @@ ;; powerpc*-*-linux* | powerpc-*-sysv*) -@@ -13485,7 +13489,7 @@ - as_fn_error $? "\"libffi has not been ported to $host.\"" "$LINENO" 5 +@@ -269,7 +276,7 @@ + AC_MSG_ERROR(["libffi has not been ported to $host."]) fi -- if test x$TARGET = xMIPS; then -+ if expr x$TARGET : 'xMIPS' > /dev/null; then - MIPS_TRUE= - MIPS_FALSE='#' - else -@@ -14848,6 +14852,12 @@ - ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc" +-AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS) ++AM_CONDITIONAL(MIPS,[expr x$TARGET : 'xMIPS' > /dev/null]) + AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN) + AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) + AM_CONDITIONAL(X86, test x$TARGET = xX86) +@@ -567,4 +574,8 @@ + AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc) -+ac_config_links="$ac_config_links include/ffi_common.h:include/ffi_common.h" ++AC_CONFIG_LINKS(include/ffi_common.h:include/ffi_common.h) + ++AC_CONFIG_FILES(fficonfig.py) + -+ac_config_files="$ac_config_files fficonfig.py" -+ -+ - cat >confcache <<\_ACEOF - # This file is a shell script that caches the results of configure - # tests run on this system so they can be shared between configure -@@ -16029,6 +16039,8 @@ - "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;; - "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; - "libffi.pc") CONFIG_FILES="$CONFIG_FILES libffi.pc" ;; -+ "include/ffi_common.h") CONFIG_LINKS="$CONFIG_LINKS include/ffi_common.h:include/ffi_common.h" ;; -+ "fficonfig.py") CONFIG_FILES="$CONFIG_FILES fficonfig.py" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -diff -urN libffi.orig/fficonfig.py.in libffi/fficonfig.py.in ---- libffi.orig/fficonfig.py.in 1970-01-01 01:00:00.000000000 +0100 -+++ libffi/fficonfig.py.in 2013-02-12 15:11:24.589852644 +0100 -@@ -0,0 +1,36 @@ + AC_OUTPUT +--- libffi-3.0.11/fficonfig.py.in 1970-01-01 01:00:00.000000000 +0100 ++++ libffi/fficonfig.py.in 2012-03-15 01:04:27.000000000 +0100 +@@ -0,0 +1,35 @@ +ffi_sources = """ +src/prep_cif.c +src/closures.c @@ -130,7 +130,6 @@ + 'X86_FREEBSD': ['src/x86/ffi.c', 'src/x86/freebsd.S'], + 'X86_WIN32': ['src/x86/ffi.c', 'src/x86/win32.S'], + 'SPARC': ['src/sparc/ffi.c', 'src/sparc/v8.S', 'src/sparc/v9.S'], -+ 'AARCH64': ['src/aarch64/ffi.c', 'src/aarch64/sysv.S'], + 'ALPHA': ['src/alpha/ffi.c', 'src/alpha/osf.S'], + 'IA64': ['src/ia64/ffi.c', 'src/ia64/unix.S'], + 'M32R': ['src/m32r/sysv.S', 'src/m32r/ffi.c'], @@ -153,9 +152,9 @@ +ffi_sources += ffi_platforms['@TARGET@'] + +ffi_cflags = '@CFLAGS@' -diff -urN libffi.orig/src/dlmalloc.c libffi/src/dlmalloc.c ---- libffi.orig/src/dlmalloc.c 2013-02-11 20:24:18.000000000 +0100 -+++ libffi/src/dlmalloc.c 2013-02-12 15:15:12.113858241 +0100 +diff -urN libffi-3.0.11/src/dlmalloc.c libffi/src/dlmalloc.c +--- libffi-3.0.11/src/dlmalloc.c 2012-04-12 04:46:06.000000000 +0200 ++++ libffi/src/dlmalloc.c 2012-06-26 15:15:58.949547461 +0200 @@ -457,6 +457,11 @@ #define LACKS_ERRNO_H #define MALLOC_FAILURE_ACTION diff --git a/Modules/_ctypes/libffi/.gitignore b/Modules/_ctypes/libffi/.gitignore new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/.gitignore @@ -0,0 +1,21 @@ +.libs +.deps +*.o +*.lo +.dirstamp +*.la +Makefile +config.log +config.status +*~ +fficonfig.h +include/ffi.h +include/ffitarget.h +libffi.pc +libtool +stamp-h1 +libffi*gz +autom4te.cache +libffi.xcodeproj/xcuserdata +libffi.xcodeproj/project.xcworkspace +ios/ diff --git a/Modules/_ctypes/libffi/.travis.yml b/Modules/_ctypes/libffi/.travis.yml new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/.travis.yml @@ -0,0 +1,8 @@ +language: c +compiler: + - gcc + - clang + +before_script: sudo apt-get install dejagnu + +script: ./configure && make && make check diff --git a/Modules/_ctypes/libffi/ChangeLog b/Modules/_ctypes/libffi/ChangeLog --- a/Modules/_ctypes/libffi/ChangeLog +++ b/Modules/_ctypes/libffi/ChangeLog @@ -1,3 +1,49 @@ +2013-03-17 Anthony Green + + * README: Update for 3.0.13. + * configure.ac: Ditto. + * configure: Rebuilt. + * doc/*: Update version. + +2013-03-17 Dave Korn + + * src/closures.c (is_emutramp_enabled + [!FFI_MMAP_EXEC_EMUTRAMP_PAX]): Move default definition outside + enclosing #if scope. + +2013-03-17 Anthony Green + + * configure.ac: Only modify toolexecdir in certain cases. + * configure: Rebuilt. + +2013-03-16 Gilles Talis + + * src/powerpc/ffi.c (ffi_prep_args_SYSV): Don't use + fparg_count,etc on __NO_FPRS__ targets. + +2013-03-16 Alan Hourihane + + * src/m68k/sysv.S (epilogue): Don't use extb instruction on + m680000 machines. + +2013-03-16 Alex Gaynor + + * src/x86/ffi.c (ffi_prep_cif_machdep): Always align stack. + +2013-03-13 Markos Chandras + + * configure.ac: Add support for Imagination Technologies Meta. + * Makefile.am: Likewise. + * README: Add Imagination Technologies Meta details. + * src/metag/ffi.c: New. + * src/metag/ffitarget.h: Likewise. + * src/metag/sysv.S: Likewise. + +2013-02-24 Andreas Schwab + + * doc/libffi.texi (Structures): Fix missing category argument of + @deftp. + 2013-02-11 Anthony Green * configure.ac: Update release number to 3.0.12. diff --git a/Modules/_ctypes/libffi/Makefile.am b/Modules/_ctypes/libffi/Makefile.am --- a/Modules/_ctypes/libffi/Makefile.am +++ b/Modules/_ctypes/libffi/Makefile.am @@ -7,44 +7,45 @@ SUBDIRS = include testsuite man EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ - src/aarch64/ffi.c src/aarch64/ffitarget.h \ - src/aarch64/sysv.S build-ios.sh \ - src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \ - src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \ - src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \ - src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \ - src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \ - src/ia64/unix.S src/mips/ffi.c src/mips/n32.S src/mips/o32.S \ - src/mips/ffitarget.h src/m32r/ffi.c src/m32r/sysv.S \ - src/m32r/ffitarget.h src/m68k/ffi.c src/m68k/sysv.S \ - src/m68k/ffitarget.h src/microblaze/ffi.c \ - src/microblaze/sysv.S src/microblaze/ffitarget.h \ - src/powerpc/ffi.c src/powerpc/sysv.S \ - src/powerpc/linux64.S src/powerpc/linux64_closure.S \ - src/powerpc/ppc_closure.S src/powerpc/asm.h \ - src/powerpc/aix.S src/powerpc/darwin.S \ - src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ - src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ - src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ - src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c \ - src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S \ - src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c \ - src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S \ - src/x86/win32.S src/x86/darwin.S src/x86/win64.S \ - src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S \ - src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c \ - src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c \ - src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S \ - src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c \ - src/tile/ffitarget.h src/tile/tile.S libtool-version \ - src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S \ + src/aarch64/ffi.c src/aarch64/ffitarget.h src/aarch64/sysv.S \ + build-ios.sh src/alpha/ffi.c src/alpha/osf.S \ + src/alpha/ffitarget.h src/arm/ffi.c src/arm/sysv.S \ + src/arm/ffitarget.h src/avr32/ffi.c src/avr32/sysv.S \ + src/avr32/ffitarget.h src/cris/ffi.c src/cris/sysv.S \ + src/cris/ffitarget.h src/ia64/ffi.c src/ia64/ffitarget.h \ + src/ia64/ia64_flags.h src/ia64/unix.S src/mips/ffi.c \ + src/mips/n32.S src/mips/o32.S src/metag/ffi.c \ + src/metag/ffitarget.h src/metag/sysv.S src/moxie/ffi.c \ + src/moxie/ffitarget.h src/moxie/eabi.S src/mips/ffitarget.h \ + src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ + src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ + src/microblaze/ffi.c src/microblaze/sysv.S \ + src/microblaze/ffitarget.h src/powerpc/ffi.c \ + src/powerpc/sysv.S src/powerpc/linux64.S \ + src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \ + src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S \ + src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ + src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ + src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ + src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c \ + src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S \ + src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c \ + src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S \ + src/x86/win32.S src/x86/darwin.S src/x86/win64.S \ + src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S \ + src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c \ + src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c \ + src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S \ + src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c \ + src/tile/ffitarget.h src/tile/tile.S libtool-version \ + src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S \ ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4 \ m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \ m4/ltversion.m4 src/arm/gentramp.sh src/debug.c msvcc.sh \ - generate-ios-source-and-headers.py \ + generate-ios-source-and-headers.py \ generate-osx-source-and-headers.py \ - libffi.xcodeproj/project.pbxproj src/arm/trampoline.S \ - libtool-ldflags + libffi.xcodeproj/project.pbxproj src/arm/trampoline.S \ + libtool-ldflags info_TEXINFOS = doc/libffi.texi @@ -208,6 +209,9 @@ if XTENSA nodist_libffi_la_SOURCES += src/xtensa/sysv.S src/xtensa/ffi.c endif +if METAG +nodist_libffi_la_SOURCES += src/metag/sysv.S src/metag/ffi.c +endif libffi_convenience_la_SOURCES = $(libffi_la_SOURCES) nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) diff --git a/Modules/_ctypes/libffi/Makefile.in b/Modules/_ctypes/libffi/Makefile.in --- a/Modules/_ctypes/libffi/Makefile.in +++ b/Modules/_ctypes/libffi/Makefile.in @@ -85,6 +85,7 @@ @PA_HPUX_TRUE at am__append_31 = src/pa/hpux32.S src/pa/ffi.c @TILE_TRUE at am__append_32 = src/tile/tile.S src/tile/ffi.c @XTENSA_TRUE at am__append_33 = src/xtensa/sysv.S src/xtensa/ffi.c + at METAG_TRUE@am__append_34 = src/metag/sysv.S src/metag/ffi.c subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/doc/stamp-vti \ @@ -196,6 +197,7 @@ @PA_HPUX_TRUE at am__objects_31 = src/pa/hpux32.lo src/pa/ffi.lo @TILE_TRUE at am__objects_32 = src/tile/tile.lo src/tile/ffi.lo @XTENSA_TRUE at am__objects_33 = src/xtensa/sysv.lo src/xtensa/ffi.lo + at METAG_TRUE@am__objects_34 = src/metag/sysv.lo src/metag/ffi.lo nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ $(am__objects_3) $(am__objects_4) $(am__objects_5) \ $(am__objects_6) $(am__objects_7) $(am__objects_8) \ @@ -207,17 +209,17 @@ $(am__objects_24) $(am__objects_25) $(am__objects_26) \ $(am__objects_27) $(am__objects_28) $(am__objects_29) \ $(am__objects_30) $(am__objects_31) $(am__objects_32) \ - $(am__objects_33) + $(am__objects_33) $(am__objects_34) libffi_la_OBJECTS = $(am_libffi_la_OBJECTS) \ $(nodist_libffi_la_OBJECTS) libffi_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libffi_la_LDFLAGS) $(LDFLAGS) -o $@ libffi_convenience_la_LIBADD = -am__objects_34 = src/prep_cif.lo src/types.lo src/raw_api.lo \ +am__objects_35 = src/prep_cif.lo src/types.lo src/raw_api.lo \ src/java_raw_api.lo src/closures.lo -am_libffi_convenience_la_OBJECTS = $(am__objects_34) -am__objects_35 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \ +am_libffi_convenience_la_OBJECTS = $(am__objects_35) +am__objects_36 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \ $(am__objects_4) $(am__objects_5) $(am__objects_6) \ $(am__objects_7) $(am__objects_8) $(am__objects_9) \ $(am__objects_10) $(am__objects_11) $(am__objects_12) \ @@ -227,8 +229,9 @@ $(am__objects_22) $(am__objects_23) $(am__objects_24) \ $(am__objects_25) $(am__objects_26) $(am__objects_27) \ $(am__objects_28) $(am__objects_29) $(am__objects_30) \ - $(am__objects_31) $(am__objects_32) $(am__objects_33) -nodist_libffi_convenience_la_OBJECTS = $(am__objects_35) + $(am__objects_31) $(am__objects_32) $(am__objects_33) \ + $(am__objects_34) +nodist_libffi_convenience_la_OBJECTS = $(am__objects_36) libffi_convenience_la_OBJECTS = $(am_libffi_convenience_la_OBJECTS) \ $(nodist_libffi_convenience_la_OBJECTS) DEFAULT_INCLUDES = -I. at am__isrc@ @@ -466,44 +469,45 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = include testsuite man EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ - src/aarch64/ffi.c src/aarch64/ffitarget.h \ - src/aarch64/sysv.S build-ios.sh \ - src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \ - src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \ - src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \ - src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \ - src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \ - src/ia64/unix.S src/mips/ffi.c src/mips/n32.S src/mips/o32.S \ - src/mips/ffitarget.h src/m32r/ffi.c src/m32r/sysv.S \ - src/m32r/ffitarget.h src/m68k/ffi.c src/m68k/sysv.S \ - src/m68k/ffitarget.h src/microblaze/ffi.c \ - src/microblaze/sysv.S src/microblaze/ffitarget.h \ - src/powerpc/ffi.c src/powerpc/sysv.S \ - src/powerpc/linux64.S src/powerpc/linux64_closure.S \ - src/powerpc/ppc_closure.S src/powerpc/asm.h \ - src/powerpc/aix.S src/powerpc/darwin.S \ - src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ - src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ - src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ - src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c \ - src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S \ - src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c \ - src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S \ - src/x86/win32.S src/x86/darwin.S src/x86/win64.S \ - src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S \ - src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c \ - src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c \ - src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S \ - src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c \ - src/tile/ffitarget.h src/tile/tile.S libtool-version \ - src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S \ + src/aarch64/ffi.c src/aarch64/ffitarget.h src/aarch64/sysv.S \ + build-ios.sh src/alpha/ffi.c src/alpha/osf.S \ + src/alpha/ffitarget.h src/arm/ffi.c src/arm/sysv.S \ + src/arm/ffitarget.h src/avr32/ffi.c src/avr32/sysv.S \ + src/avr32/ffitarget.h src/cris/ffi.c src/cris/sysv.S \ + src/cris/ffitarget.h src/ia64/ffi.c src/ia64/ffitarget.h \ + src/ia64/ia64_flags.h src/ia64/unix.S src/mips/ffi.c \ + src/mips/n32.S src/mips/o32.S src/metag/ffi.c \ + src/metag/ffitarget.h src/metag/sysv.S src/moxie/ffi.c \ + src/moxie/ffitarget.h src/moxie/eabi.S src/mips/ffitarget.h \ + src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ + src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ + src/microblaze/ffi.c src/microblaze/sysv.S \ + src/microblaze/ffitarget.h src/powerpc/ffi.c \ + src/powerpc/sysv.S src/powerpc/linux64.S \ + src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \ + src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S \ + src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ + src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ + src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ + src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c \ + src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S \ + src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c \ + src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S \ + src/x86/win32.S src/x86/darwin.S src/x86/win64.S \ + src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S \ + src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c \ + src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c \ + src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S \ + src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c \ + src/tile/ffitarget.h src/tile/tile.S libtool-version \ + src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S \ ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4 \ m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \ m4/ltversion.m4 src/arm/gentramp.sh src/debug.c msvcc.sh \ - generate-ios-source-and-headers.py \ + generate-ios-source-and-headers.py \ generate-osx-source-and-headers.py \ - libffi.xcodeproj/project.pbxproj src/arm/trampoline.S \ - libtool-ldflags + libffi.xcodeproj/project.pbxproj src/arm/trampoline.S \ + libtool-ldflags info_TEXINFOS = doc/libffi.texi @@ -567,7 +571,7 @@ $(am__append_24) $(am__append_25) $(am__append_26) \ $(am__append_27) $(am__append_28) $(am__append_29) \ $(am__append_30) $(am__append_31) $(am__append_32) \ - $(am__append_33) + $(am__append_33) $(am__append_34) libffi_convenience_la_SOURCES = $(libffi_la_SOURCES) nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/libtool-ldflags $(LDFLAGS)) @@ -943,6 +947,16 @@ src/xtensa/$(DEPDIR)/$(am__dirstamp) src/xtensa/ffi.lo: src/xtensa/$(am__dirstamp) \ src/xtensa/$(DEPDIR)/$(am__dirstamp) +src/metag/$(am__dirstamp): + @$(MKDIR_P) src/metag + @: > src/metag/$(am__dirstamp) +src/metag/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/metag/$(DEPDIR) + @: > src/metag/$(DEPDIR)/$(am__dirstamp) +src/metag/sysv.lo: src/metag/$(am__dirstamp) \ + src/metag/$(DEPDIR)/$(am__dirstamp) +src/metag/ffi.lo: src/metag/$(am__dirstamp) \ + src/metag/$(DEPDIR)/$(am__dirstamp) libffi.la: $(libffi_la_OBJECTS) $(libffi_la_DEPENDENCIES) $(EXTRA_libffi_la_DEPENDENCIES) $(libffi_la_LINK) -rpath $(toolexeclibdir) $(libffi_la_OBJECTS) $(libffi_la_LIBADD) $(LIBS) libffi_convenience.la: $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_DEPENDENCIES) $(EXTRA_libffi_convenience_la_DEPENDENCIES) @@ -972,6 +986,8 @@ -rm -f src/m32r/*.lo -rm -f src/m68k/*.$(OBJEXT) -rm -f src/m68k/*.lo + -rm -f src/metag/*.$(OBJEXT) + -rm -f src/metag/*.lo -rm -f src/microblaze/*.$(OBJEXT) -rm -f src/microblaze/*.lo -rm -f src/mips/*.$(OBJEXT) @@ -1027,6 +1043,8 @@ @AMDEP_TRUE@@am__include@ @am__quote at src/m32r/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/m68k/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/m68k/$(DEPDIR)/sysv.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/metag/$(DEPDIR)/ffi.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at src/metag/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/microblaze/$(DEPDIR)/ffi.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/microblaze/$(DEPDIR)/sysv.Plo at am__quote@ @AMDEP_TRUE@@am__include@ @am__quote at src/mips/$(DEPDIR)/ffi.Plo at am__quote@ @@ -1134,6 +1152,7 @@ -rm -rf src/ia64/.libs src/ia64/_libs -rm -rf src/m32r/.libs src/m32r/_libs -rm -rf src/m68k/.libs src/m68k/_libs + -rm -rf src/metag/.libs src/metag/_libs -rm -rf src/microblaze/.libs src/microblaze/_libs -rm -rf src/mips/.libs src/mips/_libs -rm -rf src/moxie/.libs src/moxie/_libs @@ -1711,6 +1730,8 @@ -rm -f src/m32r/$(am__dirstamp) -rm -f src/m68k/$(DEPDIR)/$(am__dirstamp) -rm -f src/m68k/$(am__dirstamp) + -rm -f src/metag/$(DEPDIR)/$(am__dirstamp) + -rm -f src/metag/$(am__dirstamp) -rm -f src/microblaze/$(DEPDIR)/$(am__dirstamp) -rm -f src/microblaze/$(am__dirstamp) -rm -f src/mips/$(DEPDIR)/$(am__dirstamp) @@ -1747,7 +1768,7 @@ distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR) + -rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/metag/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags @@ -1886,7 +1907,7 @@ maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR) + -rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/metag/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-aminfo \ maintainer-clean-generic maintainer-clean-vti diff --git a/Modules/_ctypes/libffi/README b/Modules/_ctypes/libffi/README --- a/Modules/_ctypes/libffi/README +++ b/Modules/_ctypes/libffi/README @@ -1,7 +1,7 @@ Status ====== -libffi-3.0.12 was released on February 11, 2013. Check the libffi web +libffi-3.0.13 was released on March 17, 2013. Check the libffi web page for updates: . @@ -43,7 +43,7 @@ For specific configuration details and testing status, please refer to the wiki page here: - http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.12 + http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.13 At the time of release, the following basic configurations have been tested: @@ -63,6 +63,7 @@ | M68K | FreeMiNT | GCC | | M68K | Linux | GCC | | M68K | RTEMS | GCC | +| Meta | Linux | GCC | | MicroBlaze | Linux | GCC | | MIPS | IRIX | GCC | | MIPS | Linux | GCC | @@ -162,6 +163,16 @@ See the ChangeLog files for details. +3.0.13 Mar-17-13 + Add Meta support. + Add missing Moxie bits. + Fix stack alignment bug on 32-bit x86. + Build fix for m68000 targets. + Build fix for soft-float Power targets. + Fix the install dir location for some platforms when building + with GCC (OS X, Solaris). + Fix Cygwin regression. + 3.0.12 Feb-11-13 Add Moxie support. Add AArch64 support. diff --git a/Modules/_ctypes/libffi/build-ios.sh b/Modules/_ctypes/libffi/build-ios.sh old mode 100755 new mode 100644 diff --git a/Modules/_ctypes/libffi/configure b/Modules/_ctypes/libffi/configure --- a/Modules/_ctypes/libffi/configure +++ b/Modules/_ctypes/libffi/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libffi 3.0.12. +# Generated by GNU Autoconf 2.69 for libffi 3.0.13. # # Report bugs to . # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='libffi' PACKAGE_TARNAME='libffi' -PACKAGE_VERSION='3.0.12' -PACKAGE_STRING='libffi 3.0.12' +PACKAGE_VERSION='3.0.13' +PACKAGE_STRING='libffi 3.0.13' PACKAGE_BUGREPORT='http://github.com/atgreen/libffi/issues' PACKAGE_URL='' @@ -685,6 +685,8 @@ POWERPC_TRUE MOXIE_FALSE MOXIE_TRUE +METAG_FALSE +METAG_TRUE MICROBLAZE_FALSE MICROBLAZE_TRUE M68K_FALSE @@ -1405,7 +1407,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libffi 3.0.12 to adapt to many kinds of systems. +\`configure' configures libffi 3.0.13 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1476,7 +1478,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libffi 3.0.12:";; + short | recursive ) echo "Configuration of libffi 3.0.13:";; esac cat <<\_ACEOF @@ -1596,7 +1598,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libffi configure 3.0.12 +libffi configure 3.0.13 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2202,7 +2204,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libffi $as_me 3.0.12, which was +It was created by libffi $as_me 3.0.13, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3245,7 +3247,7 @@ # Define the identity of the package. PACKAGE='libffi' - VERSION='3.0.12' + VERSION='3.0.13' cat >>confdefs.h <<_ACEOF @@ -13367,8 +13369,8 @@ ;; i*86-*-nto-qnx*) - TARGET=X86; TARGETDIR=x86 - ;; + TARGET=X86; TARGETDIR=x86 + ;; x86_64-*-darwin*) TARGET=X86_DARWIN; TARGETDIR=x86 @@ -13423,6 +13425,10 @@ TARGET=MOXIE; TARGETDIR=moxie ;; + metag-*-*) + TARGET=METAG; TARGETDIR=metag + ;; + mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) TARGET=MIPS_IRIX; TARGETDIR=mips ;; @@ -13593,6 +13599,14 @@ MICROBLAZE_FALSE= fi + if test x$TARGET = xMETAG; then + METAG_TRUE= + METAG_FALSE='#' +else + METAG_TRUE='#' + METAG_FALSE= +fi + if test x$TARGET = xMOXIE; then MOXIE_TRUE= MOXIE_FALSE='#' @@ -14491,10 +14505,10 @@ $as_echo_n "(cached) " >&6 else - libffi_cv_as_x86_pcrel=no + libffi_cv_as_x86_pcrel=yes echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s - if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then - libffi_cv_as_x86_pcrel=yes + if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then + libffi_cv_as_x86_pcrel=no fi fi @@ -14833,7 +14847,7 @@ multi_os_directory=`$CC -print-multi-os-directory` case $multi_os_directory in .) ;; # Avoid trailing /. - *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; + ../*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; esac else @@ -15055,6 +15069,10 @@ as_fn_error $? "conditional \"MICROBLAZE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${METAG_TRUE}" && test -z "${METAG_FALSE}"; then + as_fn_error $? "conditional \"METAG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${MOXIE_TRUE}" && test -z "${MOXIE_FALSE}"; then as_fn_error $? "conditional \"MOXIE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -15541,7 +15559,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libffi $as_me 3.0.12, which was +This file was extended by libffi $as_me 3.0.13, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15611,7 +15629,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libffi config.status 3.0.12 +libffi config.status 3.0.13 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Modules/_ctypes/libffi/configure.ac b/Modules/_ctypes/libffi/configure.ac --- a/Modules/_ctypes/libffi/configure.ac +++ b/Modules/_ctypes/libffi/configure.ac @@ -1,11 +1,11 @@ dnl Process this with autoconf to create configure # -# file from libffi - slightly patched for ctypes +# file from libffi - slightly patched for Python's ctypes # AC_PREREQ(2.68) -AC_INIT([libffi], [3.0.12], [http://github.com/atgreen/libffi/issues]) +AC_INIT([libffi], [3.0.13], [http://github.com/atgreen/libffi/issues]) AC_CONFIG_HEADERS([fficonfig.h]) AC_CANONICAL_SYSTEM @@ -150,8 +150,8 @@ ;; i*86-*-nto-qnx*) - TARGET=X86; TARGETDIR=x86 - ;; + TARGET=X86; TARGETDIR=x86 + ;; x86_64-*-darwin*) TARGET=X86_DARWIN; TARGETDIR=x86 @@ -206,6 +206,10 @@ TARGET=MOXIE; TARGETDIR=moxie ;; + metag-*-*) + TARGET=METAG; TARGETDIR=metag + ;; + mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) TARGET=MIPS_IRIX; TARGETDIR=mips ;; @@ -285,6 +289,7 @@ AM_CONDITIONAL(M32R, test x$TARGET = xM32R) AM_CONDITIONAL(M68K, test x$TARGET = xM68K) AM_CONDITIONAL(MICROBLAZE, test x$TARGET = xMICROBLAZE) +AM_CONDITIONAL(METAG, test x$TARGET = xMETAG) AM_CONDITIONAL(MOXIE, test x$TARGET = xMOXIE) AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC) AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX) @@ -362,10 +367,10 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then AC_CACHE_CHECK([assembler supports pc related relocs], libffi_cv_as_x86_pcrel, [ - libffi_cv_as_x86_pcrel=no + libffi_cv_as_x86_pcrel=yes echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s - if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then - libffi_cv_as_x86_pcrel=yes + if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then + libffi_cv_as_x86_pcrel=no fi ]) if test "x$libffi_cv_as_x86_pcrel" = xyes; then @@ -551,7 +556,7 @@ multi_os_directory=`$CC -print-multi-os-directory` case $multi_os_directory in .) ;; # Avoid trailing /. - *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; + ../*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; esac AC_SUBST(toolexecdir) else diff --git a/Modules/_ctypes/libffi/doc/libffi.info b/Modules/_ctypes/libffi/doc/libffi.info index 7b3d7565751d015d0b0fd239f2473cf270fbebf4..896a5ec0f1efe6231df04e22e25ec1e280b5e077 GIT binary patch [stripped] diff --git a/Modules/_ctypes/libffi/doc/libffi.texi b/Modules/_ctypes/libffi/doc/libffi.texi --- a/Modules/_ctypes/libffi/doc/libffi.texi +++ b/Modules/_ctypes/libffi/doc/libffi.texi @@ -360,7 +360,7 @@ new @code{ffi_type} object for it. @tindex ffi_type - at deftp ffi_type + at deftp {Data type} ffi_type The @code{ffi_type} has the following members: @table @code @item size_t size diff --git a/Modules/_ctypes/libffi/doc/stamp-vti b/Modules/_ctypes/libffi/doc/stamp-vti --- a/Modules/_ctypes/libffi/doc/stamp-vti +++ b/Modules/_ctypes/libffi/doc/stamp-vti @@ -1,4 +1,4 @@ - at set UPDATED 6 February 2013 - at set UPDATED-MONTH February 2013 - at set EDITION 3.0.12 - at set VERSION 3.0.12 + at set UPDATED 16 March 2013 + at set UPDATED-MONTH March 2013 + at set EDITION 3.0.13 + at set VERSION 3.0.13 diff --git a/Modules/_ctypes/libffi/doc/version.texi b/Modules/_ctypes/libffi/doc/version.texi --- a/Modules/_ctypes/libffi/doc/version.texi +++ b/Modules/_ctypes/libffi/doc/version.texi @@ -1,4 +1,4 @@ - at set UPDATED 6 February 2013 - at set UPDATED-MONTH February 2013 - at set EDITION 3.0.12 - at set VERSION 3.0.12 + at set UPDATED 16 March 2013 + at set UPDATED-MONTH March 2013 + at set EDITION 3.0.13 + at set VERSION 3.0.13 diff --git a/Modules/_ctypes/libffi/fficonfig.py.in b/Modules/_ctypes/libffi/fficonfig.py.in --- a/Modules/_ctypes/libffi/fficonfig.py.in +++ b/Modules/_ctypes/libffi/fficonfig.py.in @@ -11,7 +11,6 @@ 'X86_FREEBSD': ['src/x86/ffi.c', 'src/x86/freebsd.S'], 'X86_WIN32': ['src/x86/ffi.c', 'src/x86/win32.S'], 'SPARC': ['src/sparc/ffi.c', 'src/sparc/v8.S', 'src/sparc/v9.S'], - 'AARCH64': ['src/aarch64/ffi.c', 'src/aarch64/sysv.S'], 'ALPHA': ['src/alpha/ffi.c', 'src/alpha/osf.S'], 'IA64': ['src/ia64/ffi.c', 'src/ia64/unix.S'], 'M32R': ['src/m32r/sysv.S', 'src/m32r/ffi.c'], diff --git a/Modules/_ctypes/libffi/libtool-ldflags b/Modules/_ctypes/libffi/libtool-ldflags old mode 100755 new mode 100644 diff --git a/Modules/_ctypes/libffi/ltmain.sh b/Modules/_ctypes/libffi/ltmain.sh old mode 100644 new mode 100755 diff --git a/Modules/_ctypes/libffi/mdate-sh b/Modules/_ctypes/libffi/mdate-sh old mode 100644 new mode 100755 diff --git a/Modules/_ctypes/libffi/msvcc.sh b/Modules/_ctypes/libffi/msvcc.sh old mode 100755 new mode 100644 diff --git a/Modules/_ctypes/libffi/src/arm/gentramp.sh b/Modules/_ctypes/libffi/src/arm/gentramp.sh old mode 100755 new mode 100644 diff --git a/Modules/_ctypes/libffi/src/closures.c b/Modules/_ctypes/libffi/src/closures.c --- a/Modules/_ctypes/libffi/src/closures.c +++ b/Modules/_ctypes/libffi/src/closures.c @@ -189,8 +189,6 @@ #define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \ : (emutramp_enabled = emutramp_enabled_check ())) -#else -#define is_emutramp_enabled() 0 #endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */ #elif defined (__CYGWIN__) || defined(__INTERIX) @@ -202,6 +200,10 @@ #endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */ +#ifndef FFI_MMAP_EXEC_EMUTRAMP_PAX +#define is_emutramp_enabled() 0 +#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */ + /* Declare all functions defined in dlmalloc.c as static. */ static void *dlmalloc(size_t); static void dlfree(void*); diff --git a/Modules/_ctypes/libffi/src/dlmalloc.c b/Modules/_ctypes/libffi/src/dlmalloc.c --- a/Modules/_ctypes/libffi/src/dlmalloc.c +++ b/Modules/_ctypes/libffi/src/dlmalloc.c @@ -100,7 +100,7 @@ If you don't like either of these options, you can define CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything - else. And if you are sure that your program using malloc has + else. And if if you are sure that your program using malloc has no errors or vulnerabilities, you can define INSECURE to 1, which might (or might not) provide a small performance improvement. @@ -607,7 +607,7 @@ declaration needed is the mallinfo struct that is returned (by-copy) by mallinfo(). The malloinfo struct contains a bunch of fields that are not even meaningful in this version of malloc. These fields are - instead filled by mallinfo() with other numbers that might be of + are instead filled by mallinfo() with other numbers that might be of interest. HAVE_USR_INCLUDE_MALLOC_H should be set if you have a @@ -1621,7 +1621,7 @@ Each freshly allocated chunk must have both cinuse and pinuse set. That is, each allocated chunk borders either a previously allocated and still in-use chunk, or the base of its memory arena. This is - ensured by making all allocations from the `lowest' part of any + ensured by making all allocations from the the `lowest' part of any found chunk. Further, no free chunk physically borders another one, so each free chunk is known to be preceded and followed by either inuse chunks or the ends of memory. @@ -1827,12 +1827,12 @@ of the same size are arranged in a circularly-linked list, with only the oldest chunk (the next to be used, in our FIFO ordering) actually in the tree. (Tree members are distinguished by a non-null - parent pointer.) If a chunk with the same size as an existing node + parent pointer.) If a chunk with the same size an an existing node is inserted, it is linked off the existing node using pointers that work in the same way as fd/bk pointers of small chunks. Each tree contains a power of 2 sized range of chunk sizes (the - smallest is 0x100 <= x < 0x180), which is divided in half at each + smallest is 0x100 <= x < 0x180), which is is divided in half at each tree level, with the chunks in the smaller half of the range (0x100 <= x < 0x140 for the top nose) in the left subtree and the larger half (0x140 <= x < 0x180) in the right subtree. This is, of course, @@ -3442,7 +3442,7 @@ least-preferred order): 1. A call to MORECORE that can normally contiguously extend memory. (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or - main space is mmapped or a previous contiguous call failed) + or main space is mmapped or a previous contiguous call failed) 2. A call to MMAP new space (disabled if not HAVE_MMAP). Note that under the default settings, if MORECORE is unable to fulfill a request, and HAVE_MMAP is true, then mmap is diff --git a/Modules/_ctypes/libffi/src/ia64/ffi.c b/Modules/_ctypes/libffi/src/ia64/ffi.c --- a/Modules/_ctypes/libffi/src/ia64/ffi.c +++ b/Modules/_ctypes/libffi/src/ia64/ffi.c @@ -85,7 +85,7 @@ #define ldf_fill(result, addr) \ asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr)); -/* Return the size of the C type associated with TYPE, which will +/* Return the size of the C type associated with with TYPE. Which will be one of the FFI_IA64_TYPE_HFA_* values. */ static size_t @@ -185,7 +185,7 @@ break; case FFI_TYPE_LONGDOUBLE: - /* Similarly, except that HFA is true for double extended, + /* Similarly, except that that HFA is true for double extended, but not quad precision. Both have sizeof == 16, so tell the difference based on the precision. */ if (LDBL_MANT_DIG == 64 && nested) diff --git a/Modules/_ctypes/libffi/src/m68k/sysv.S b/Modules/_ctypes/libffi/src/m68k/sysv.S --- a/Modules/_ctypes/libffi/src/m68k/sysv.S +++ b/Modules/_ctypes/libffi/src/m68k/sysv.S @@ -2,10 +2,9 @@ sysv.S - Copyright (c) 2012 Alan Hourihane Copyright (c) 1998, 2012 Andreas Schwab - Copyright (c) 2008 Red Hat, Inc. - Copyright (c) 2012 Thorsten Glaser - - m68k Foreign Function Interface + Copyright (c) 2008 Red Hat, Inc. + + m68k Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -169,22 +168,8 @@ retstruct2: btst #7,%d2 - jbeq retsint8 + jbeq noretval move.w %d0,(%a1) - jbra epilogue - -retsint8: - btst #8,%d2 - jbeq retsint16 - extb.l %d0 - move.l %d0,(%a1) - jbra epilogue - -retsint16: - btst #9,%d2 - jbeq noretval - ext.l %d0 - move.l %d0,(%a1) noretval: epilogue: @@ -216,10 +201,8 @@ lsr.l #1,%d0 jne 1f jcc .Lcls_epilogue - | CIF_FLAGS_INT move.l -12(%fp),%d0 .Lcls_epilogue: - | no CIF_FLAGS_* unlk %fp rts 1: @@ -227,7 +210,6 @@ lsr.l #2,%d0 jne 1f jcs .Lcls_ret_float - | CIF_FLAGS_DINT move.l (%a0)+,%d0 move.l (%a0),%d1 jra .Lcls_epilogue @@ -242,7 +224,6 @@ lsr.l #2,%d0 jne 1f jcs .Lcls_ret_ldouble - | CIF_FLAGS_DOUBLE #if defined(__MC68881__) || defined(__HAVE_68881__) fmove.d (%a0),%fp0 #else @@ -261,31 +242,17 @@ jra .Lcls_epilogue 1: lsr.l #2,%d0 - jne 1f + jne .Lcls_ret_struct2 jcs .Lcls_ret_struct1 - | CIF_FLAGS_POINTER move.l (%a0),%a0 move.l %a0,%d0 jra .Lcls_epilogue .Lcls_ret_struct1: move.b (%a0),%d0 jra .Lcls_epilogue -1: - lsr.l #2,%d0 - jne 1f - jcs .Lcls_ret_sint8 - | CIF_FLAGS_STRUCT2 +.Lcls_ret_struct2: move.w (%a0),%d0 jra .Lcls_epilogue -.Lcls_ret_sint8: - move.l (%a0),%d0 - extb.l %d0 - jra .Lcls_epilogue -1: - | CIF_FLAGS_SINT16 - move.l (%a0),%d0 - ext.l %d0 - jra .Lcls_epilogue CFI_ENDPROC() .size CALLFUNC(ffi_closure_SYSV),.-CALLFUNC(ffi_closure_SYSV) diff --git a/Modules/_ctypes/libffi/src/metag/ffi.c b/Modules/_ctypes/libffi/src/metag/ffi.c new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/metag/ffi.c @@ -0,0 +1,330 @@ +/* ---------------------------------------------------------------------- + ffi.c - Copyright (c) 2013 Imagination Technologies + + Meta Foreign Function Interface + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + `Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED `AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +----------------------------------------------------------------------- */ + +#include +#include + +#include + +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) + +/* + * ffi_prep_args is called by the assembly routine once stack space has been + * allocated for the function's arguments + */ + +unsigned int ffi_prep_args(char *stack, extended_cif *ecif) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + + /* Store return value */ + if ( ecif->cif->flags == FFI_TYPE_STRUCT ) { + argp -= 4; + *(void **) argp = ecif->rvalue; + } + + p_argv = ecif->avalue; + + /* point to next location */ + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++, p_argv++) + { + size_t z; + + /* Move argp to address of argument */ + z = (*p_arg)->size; + argp -= z; + + /* Align if necessary */ + argp = (char *) ALIGN_DOWN(ALIGN_DOWN(argp, (*p_arg)->alignment), 4); + + if (z < sizeof(int)) { + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); + break; + case FFI_TYPE_UINT8: + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); + break; + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); + break; + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); + case FFI_TYPE_STRUCT: + memcpy(argp, *p_argv, (*p_arg)->size); + break; + default: + FFI_ASSERT(0); + } + } else if ( z == sizeof(int)) { + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + } else { + memcpy(argp, *p_argv, z); + } + } + + /* return the size of the arguments to be passed in registers, + padded to an 8 byte boundary to preserve stack alignment */ + return ALIGN(MIN(stack - argp, 6*4), 8); +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + ffi_type **ptr; + unsigned i, bytes = 0; + + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { + if ((*ptr)->size == 0) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the argument type, do this + check after the initialization. */ + FFI_ASSERT_VALID_TYPE(*ptr); + + /* Add any padding if necessary */ + if (((*ptr)->alignment - 1) & bytes) + bytes = ALIGN(bytes, (*ptr)->alignment); + + bytes += ALIGN((*ptr)->size, 4); + } + + /* Ensure arg space is aligned to an 8-byte boundary */ + bytes = ALIGN(bytes, 8); + + /* Make space for the return structure pointer */ + if (cif->rtype->type == FFI_TYPE_STRUCT) { + bytes += sizeof(void*); + + /* Ensure stack is aligned to an 8-byte boundary */ + bytes = ALIGN(bytes, 8); + } + + cif->bytes = bytes; + + /* Set the return type flag */ + switch (cif->rtype->type) { + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + cif->flags = (unsigned) cif->rtype->type; + break; + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + cif->flags = (unsigned) FFI_TYPE_SINT64; + break; + case FFI_TYPE_STRUCT: + /* Meta can store return values which are <= 64 bits */ + if (cif->rtype->size <= 4) + /* Returned to D0Re0 as 32-bit value */ + cif->flags = (unsigned)FFI_TYPE_INT; + else if ((cif->rtype->size > 4) && (cif->rtype->size <= 8)) + /* Returned valued is stored to D1Re0|R0Re0 */ + cif->flags = (unsigned)FFI_TYPE_DOUBLE; + else + /* value stored in memory */ + cif->flags = (unsigned)FFI_TYPE_STRUCT; + break; + default: + cif->flags = (unsigned)FFI_TYPE_INT; + break; + } + return FFI_OK; +} + +extern void ffi_call_SYSV(void (*fn)(void), extended_cif *, unsigned, unsigned, double *); + +/* + * Exported in API. Entry point + * cif -> ffi_cif object + * fn -> function pointer + * rvalue -> pointer to return value + * avalue -> vector of void * pointers pointing to memory locations holding the + * arguments + */ +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + int small_struct = (((cif->flags == FFI_TYPE_INT) || (cif->flags == FFI_TYPE_DOUBLE)) && (cif->rtype->type == FFI_TYPE_STRUCT)); + ecif.cif = cif; + ecif.avalue = avalue; + + double temp; + + /* + * If the return value is a struct and we don't have a return value address + * then we need to make one + */ + + if ((rvalue == NULL ) && (cif->flags == FFI_TYPE_STRUCT)) + ecif.rvalue = alloca(cif->rtype->size); + else if (small_struct) + ecif.rvalue = &temp; + else + ecif.rvalue = rvalue; + + switch (cif->abi) { + case FFI_SYSV: + ffi_call_SYSV(fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); + break; + default: + FFI_ASSERT(0); + break; + } + + if (small_struct) + memcpy (rvalue, &temp, cif->rtype->size); +} + +/* private members */ + +static void ffi_prep_incoming_args_SYSV (char *, void **, void **, + ffi_cif*, float *); + +void ffi_closure_SYSV (ffi_closure *); + +/* Do NOT change that without changing the FFI_TRAMPOLINE_SIZE */ +extern unsigned int ffi_metag_trampoline[10]; /* 10 instructions */ + +/* end of private members */ + +/* + * __tramp: trampoline memory location + * __fun: assembly routine + * __ctx: memory location for wrapper + * + * At this point, tramp[0] == __ctx ! + */ +void ffi_init_trampoline(unsigned char *__tramp, unsigned int __fun, unsigned int __ctx) { + memcpy (__tramp, ffi_metag_trampoline, sizeof(ffi_metag_trampoline)); + *(unsigned int*) &__tramp[40] = __ctx; + *(unsigned int*) &__tramp[44] = __fun; + /* This will flush the instruction cache */ + __builtin_meta2_cachewd(&__tramp[0], 1); + __builtin_meta2_cachewd(&__tramp[47], 1); +} + + + +/* the cif must already be prepared */ + +ffi_status +ffi_prep_closure_loc (ffi_closure *closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + void (*closure_func)(ffi_closure*) = NULL; + + if (cif->abi == FFI_SYSV) + closure_func = &ffi_closure_SYSV; + else + return FFI_BAD_ABI; + + ffi_init_trampoline( + (unsigned char*)&closure->tramp[0], + (unsigned int)closure_func, + (unsigned int)codeloc); + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + + +/* This function is jumped to by the trampoline */ +unsigned int ffi_closure_SYSV_inner (closure, respp, args, vfp_args) + ffi_closure *closure; + void **respp; + void *args; + void *vfp_args; +{ + ffi_cif *cif; + void **arg_area; + + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + + /* + * This call will initialize ARG_AREA, such that each + * element in that array points to the corresponding + * value on the stack; and if the function returns + * a structure, it will re-set RESP to point to the + * structure return address. + */ + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif, vfp_args); + + (closure->fun) ( cif, *respp, arg_area, closure->user_data); + + return cif->flags; +} + +static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, + void **avalue, ffi_cif *cif, + float *vfp_stack) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + /* stack points to original arguments */ + argp = stack; + + /* Store return value */ + if ( cif->flags == FFI_TYPE_STRUCT ) { + argp -= 4; + *rvalue = *(void **) argp; + } + + p_argv = avalue; + + for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { + size_t z; + size_t alignment; + + alignment = (*p_arg)->alignment; + if (alignment < 4) + alignment = 4; + if ((alignment - 1) & (unsigned)argp) + argp = (char *) ALIGN(argp, alignment); + + z = (*p_arg)->size; + *p_argv = (void*) argp; + p_argv++; + argp -= z; + } + return; +} diff --git a/Modules/_ctypes/libffi/src/metag/ffitarget.h b/Modules/_ctypes/libffi/src/metag/ffitarget.h new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/metag/ffitarget.h @@ -0,0 +1,53 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2013 Imagination Technologies Ltd. + Target configuration macros for Meta + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_DEFAULT_ABI = FFI_SYSV, + FFI_LAST_ABI = FFI_DEFAULT_ABI + 1, +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 48 +#define FFI_NATIVE_RAW_API 0 + +#endif + diff --git a/Modules/_ctypes/libffi/src/metag/sysv.S b/Modules/_ctypes/libffi/src/metag/sysv.S new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/src/metag/sysv.S @@ -0,0 +1,311 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2013 Imagination Technologies Ltd. + + Meta Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include +#ifdef HAVE_MACHINE_ASM_H +#include +#else +#ifdef __USER_LABEL_PREFIX__ +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b + +/* Use the right prefix for global labels. */ +#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x) +#else +#define CNAME(x) x +#endif +#define ENTRY(x) .globl CNAME(x); .type CNAME(x), %function; CNAME(x): +#endif + +#ifdef __ELF__ +#define LSYM(x) .x +#else +#define LSYM(x) x +#endif + +.macro call_reg x= + .text + .balign 4 + mov D1RtP, \x + swap D1RtP, PC +.endm + +! Save register arguments +.macro SAVE_ARGS + .text + .balign 4 + setl [A0StP++], D0Ar6, D1Ar5 + setl [A0StP++], D0Ar4, D1Ar3 + setl [A0StP++], D0Ar2, D1Ar1 +.endm + +! Save retrun, frame pointer and other regs +.macro SAVE_REGS regs= + .text + .balign 4 + setl [A0StP++], D0FrT, D1RtP + ! Needs to be a pair of regs + .ifnc "\regs","" + setl [A0StP++], \regs + .endif +.endm + +! Declare a global function +.macro METAG_FUNC_START name + .text + .balign 4 + ENTRY(\name) +.endm + +! Return registers from the stack. Reverse SAVE_REGS operation +.macro RET_REGS regs=, cond= + .ifnc "\regs", "" + getl \regs, [--A0StP] + .endif + getl D0FrT, D1RtP, [--A0StP] +.endm + +! Return arguments +.macro RET_ARGS + getl D0Ar2, D1Ar1, [--A0StP] + getl D0Ar4, D1Ar3, [--A0StP] + getl D0Ar6, D1Ar5, [--A0StP] +.endm + + + ! D1Ar1: fn + ! D0Ar2: &ecif + ! D1Ar3: cif->bytes + ! D0Ar4: fig->flags + ! D1Ar5: ecif.rvalue + + ! This assumes we are using GNU as +METAG_FUNC_START ffi_call_SYSV + ! Save argument registers + + SAVE_ARGS + + ! new frame + mov D0FrT, A0FrP + add A0FrP, A0StP, #0 + + ! Preserve the old frame pointer + SAVE_REGS "D1.5, D0.5" + + ! Make room for new args. cifs->bytes is the total space for input + ! and return arguments + + add A0StP, A0StP, D1Ar3 + + ! Preserve cifs->bytes & fn + mov D0.5, D1Ar3 + mov D1.5, D1Ar1 + + ! Place all of the ffi_prep_args in position + mov D1Ar1, A0StP + + ! Call ffi_prep_args(stack, &ecif) +#ifdef __PIC__ + callr D1RtP, CNAME(ffi_prep_args at PLT) +#else + callr D1RtP, CNAME(ffi_prep_args) +#endif + + ! Restore fn pointer + + ! The foreign stack should look like this + ! XXXXX XXXXXX <--- stack pointer + ! FnArgN rvalue + ! FnArgN+2 FnArgN+1 + ! FnArgN+4 FnArgN+3 + ! .... + ! + + ! A0StP now points to the first (or return) argument + 4 + + ! Preserve cif->bytes + getl D0Ar2, D1Ar1, [--A0StP] + getl D0Ar4, D1Ar3, [--A0StP] + getl D0Ar6, D1Ar5, [--A0StP] + + ! Place A0StP to the first argument again + add A0StP, A0StP, #24 ! That's because we loaded 6 regs x 4 byte each + + ! A0FrP points to the initial stack without the reserved space for the + ! cifs->bytes, whilst A0StP points to the stack after the space allocation + + ! fn was the first argument of ffi_call_SYSV. + ! The stack at this point looks like this: + ! + ! A0StP(on entry to _SYSV) -> Arg6 Arg5 | low + ! Arg4 Arg3 | + ! Arg2 Arg1 | + ! A0FrP ----> D0FrtP D1RtP | + ! D1.5 D0.5 | + ! A0StP(bf prep_args) -> FnArgn FnArgn-1 | + ! FnArgn-2FnArgn-3 | + ! ................ | <= cifs->bytes + ! FnArg4 FnArg3 | + ! A0StP (prv_A0StP+cifs->bytes) FnArg2 FnArg1 | high + ! + ! fn was in Arg1 so it's located in in A0FrP+#-0xC + ! + + ! D0Re0 contains the size of arguments stored in registers + sub A0StP, A0StP, D0Re0 + + ! Arg1 is the function pointer for the foreign call. This has been + ! preserved in D1.5 + + ! Time to call (fn). Arguments should be like this: + ! Arg1-Arg6 are loaded to regs + ! The rest of the arguments are stored in stack pointed by A0StP + + call_reg D1.5 + + ! Reset stack. + + mov A0StP, A0FrP + + ! Load Arg1 with the pointer to storage for the return type + ! This was stored in Arg5 + + getd D1Ar1, [A0FrP+#-20] + + ! Load D0Ar2 with the return type code. This was stored in Arg4 (flags) + + getd D0Ar2, [A0FrP+#-16] + + ! We are ready to start processing the return value + ! D0Re0 (and D1Re0) hold the return value + + ! If the return value is NULL, assume no return value + cmp D1Ar1, #0 + beq LSYM(Lepilogue) + + ! return INT + cmp D0Ar2, #FFI_TYPE_INT + ! Sadly, there is no setd{cc} instruction so we need to workaround that + bne .INT64 + setd [D1Ar1], D0Re0 + b LSYM(Lepilogue) + + ! return INT64 +.INT64: + cmp D0Ar2, #FFI_TYPE_SINT64 + setleq [D1Ar1], D0Re0, D1Re0 + + ! return DOUBLE + cmp D0Ar2, #FFI_TYPE_DOUBLE + setl [D1AR1++], D0Re0, D1Re0 + +LSYM(Lepilogue): + ! At this point, the stack pointer points right after the argument + ! saved area. We need to restore 4 regs, therefore we need to move + ! 16 bytes ahead. + add A0StP, A0StP, #16 + RET_REGS "D1.5, D0.5" + RET_ARGS + getd D0Re0, [A0StP] + mov A0FrP, D0FrT + swap D1RtP, PC + +.ffi_call_SYSV_end: + .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) + + +/* + (called by ffi_metag_trampoline) + void ffi_closure_SYSV (ffi_closure*) + + (called by ffi_closure_SYSV) + unsigned int FFI_HIDDEN + ffi_closure_SYSV_inner (closure,respp, args) + ffi_closure *closure; + void **respp; + void *args; +*/ + +METAG_FUNC_START ffi_closure_SYSV + ! We assume that D1Ar1 holds the address of the + ! ffi_closure struct. We will use that to fetch the + ! arguments. The stack pointer points to an empty space + ! and it is ready to store more data. + + ! D1Ar1 is ready + ! Allocate stack space for return value + add A0StP, A0StP, #8 + ! Store it to D0Ar2 + sub D0Ar2, A0StP, #8 + + sub D1Ar3, A0FrP, #4 + + ! D1Ar3 contains the address of the original D1Ar1 argument + ! We need to subtract #4 later on + + ! Preverve D0Ar2 + mov D0.5, D0Ar2 + +#ifdef __PIC__ + callr D1RtP, CNAME(ffi_closure_SYSV_inner at PLT) +#else + callr D1RtP, CNAME(ffi_closure_SYSV_inner) +#endif + + ! Check the return value and store it to D0.5 + cmp D0Re0, #FFI_TYPE_INT + beq .Lretint + cmp D0Re0, #FFI_TYPE_DOUBLE + beq .Lretdouble +.Lclosure_epilogue: + sub A0StP, A0StP, #8 + RET_REGS "D1.5, D0.5" + RET_ARGS + swap D1RtP, PC + +.Lretint: + setd [D0.5], D0Re0 + b .Lclosure_epilogue +.Lretdouble: + setl [D0.5++], D0Re0, D1Re0 + b .Lclosure_epilogue +.ffi_closure_SYSV_end: +.size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) + + +ENTRY(ffi_metag_trampoline) + SAVE_ARGS + ! New frame + mov A0FrP, A0StP + SAVE_REGS "D1.5, D0.5" + mov D0.5, PC + ! Load D1Ar1 the value of ffi_metag_trampoline + getd D1Ar1, [D0.5 + #8] + ! Jump to ffi_closure_SYSV + getd PC, [D0.5 + #12] diff --git a/Modules/_ctypes/libffi/src/mips/ffi.c b/Modules/_ctypes/libffi/src/mips/ffi.c --- a/Modules/_ctypes/libffi/src/mips/ffi.c +++ b/Modules/_ctypes/libffi/src/mips/ffi.c @@ -670,16 +670,9 @@ if (cif->abi != FFI_O32 && cif->abi != FFI_O32_SOFT_FLOAT) return FFI_BAD_ABI; fn = ffi_closure_O32; -#else -#if _MIPS_SIM ==_ABIN32 - if (cif->abi != FFI_N32 - && cif->abi != FFI_N32_SOFT_FLOAT) +#else /* FFI_MIPS_N32 */ + if (cif->abi != FFI_N32 && cif->abi != FFI_N64) return FFI_BAD_ABI; -#else - if (cif->abi != FFI_N64 - && cif->abi != FFI_N64_SOFT_FLOAT) - return FFI_BAD_ABI; -#endif fn = ffi_closure_N32; #endif /* FFI_MIPS_O32 */ diff --git a/Modules/_ctypes/libffi/src/powerpc/ffi.c b/Modules/_ctypes/libffi/src/powerpc/ffi.c --- a/Modules/_ctypes/libffi/src/powerpc/ffi.c +++ b/Modules/_ctypes/libffi/src/powerpc/ffi.c @@ -48,11 +48,6 @@ FLAG_RETURNS_128BITS = 1 << (31-27), /* cr6 */ - FLAG_SYSV_SMST_R4 = 1 << (31-26), /* use r4 for FFI_SYSV 8 byte - structs. */ - FLAG_SYSV_SMST_R3 = 1 << (31-25), /* use r3 for FFI_SYSV 4 byte - structs. */ - FLAG_ARG_NEEDS_COPY = 1 << (31- 7), #ifndef __NO_FPRS__ FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ @@ -372,12 +367,6 @@ /* Check that we didn't overrun the stack... */ FFI_ASSERT (copy_space.c >= next_arg.c); FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS); - /* The assert below is testing that the number of integer arguments agrees - with the number found in ffi_prep_cif_machdep(). However, intarg_count - is incremeneted whenever we place an FP arg on the stack, so account for - that before our assert test. */ - if (fparg_count > NUM_FPR_ARG_REGISTERS) - intarg_count -= fparg_count - NUM_FPR_ARG_REGISTERS; #ifndef __NO_FPRS__ FFI_ASSERT (fpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); @@ -675,11 +664,9 @@ switch (type) { #ifndef __NO_FPRS__ -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: flags |= FLAG_RETURNS_128BITS; /* Fall through. */ -#endif case FFI_TYPE_DOUBLE: flags |= FLAG_RETURNS_64BITS; /* Fall through. */ @@ -697,35 +684,18 @@ break; case FFI_TYPE_STRUCT: - if (cif->abi == FFI_SYSV) - { - /* The final SYSV ABI says that structures smaller or equal 8 bytes - are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them - in memory. */ - - /* Treat structs with size <= 8 bytes. */ - if (size <= 8) - { - flags |= FLAG_RETURNS_SMST; - /* These structs are returned in r3. We pack the type and the - precalculated shift value (needed in the sysv.S) into flags. - The same applies for the structs returned in r3/r4. */ - if (size <= 4) - { - flags |= FLAG_SYSV_SMST_R3; - flags |= 8 * (4 - size) << 8; - break; - } - /* These structs are returned in r3 and r4. See above. */ - if (size <= 8) - { - flags |= FLAG_SYSV_SMST_R3 | FLAG_SYSV_SMST_R4; - flags |= 8 * (8 - size) << 8; - break; - } - } - } - + /* + * The final SYSV ABI says that structures smaller or equal 8 bytes + * are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them + * in memory. + * + * NOTE: The assembly code can safely assume that it just needs to + * store both r3 and r4 into a 8-byte word-aligned buffer, as + * we allocate a temporary buffer in ffi_call() if this flag is + * set. + */ + if (cif->abi == FFI_SYSV && size <= 8) + flags |= FLAG_RETURNS_SMST; intarg_count++; flags |= FLAG_RETVAL_REFERENCE; /* Fall through. */ diff --git a/Modules/_ctypes/libffi/src/sparc/ffi.c b/Modules/_ctypes/libffi/src/sparc/ffi.c --- a/Modules/_ctypes/libffi/src/sparc/ffi.c +++ b/Modules/_ctypes/libffi/src/sparc/ffi.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2011, 2013 Anthony Green + ffi.c - Copyright (c) 2011 Anthony Green Copyright (c) 1996, 2003-2004, 2007-2008 Red Hat, Inc. SPARC Foreign Function Interface @@ -376,10 +376,6 @@ unsigned, unsigned *, void (*fn)(void)); #endif -#ifndef __GNUC__ -void ffi_flush_icache (void *, size_t); -#endif - void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; @@ -421,7 +417,7 @@ /* behind "call", so we alloc some executable space for it. */ /* l7 is used, we need to make sure v8.S doesn't use %l7. */ unsigned int *call_struct = NULL; - ffi_closure_alloc(32, (void **)&call_struct); + ffi_closure_alloc(32, &call_struct); if (call_struct) { unsigned long f = (unsigned long)fn; @@ -436,14 +432,10 @@ call_struct[5] = 0x01000000; /* nop */ call_struct[6] = 0x81c7e008; /* ret */ call_struct[7] = 0xbe100017; /* mov %l7, %i7 */ -#ifdef __GNUC__ asm volatile ("iflush %0; iflush %0+8; iflush %0+16; iflush %0+24" : : "r" (call_struct) : "memory"); /* SPARC v8 requires 5 instructions for flush to be visible */ asm volatile ("nop; nop; nop; nop; nop"); -#else - ffi_flush_icache (call_struct, 32); -#endif ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes, cif->flags, rvalue, call_struct); ffi_closure_free(call_struct); @@ -521,7 +513,6 @@ closure->user_data = user_data; /* Flush the Icache. closure is 8 bytes aligned. */ -#ifdef __GNUC__ #ifdef SPARC64 asm volatile ("flush %0; flush %0+8" : : "r" (closure) : "memory"); #else @@ -529,9 +520,6 @@ /* SPARC v8 requires 5 instructions for flush to be visible */ asm volatile ("nop; nop; nop; nop; nop"); #endif -#else - ffi_flush_icache (closure, 16); -#endif return FFI_OK; } diff --git a/Modules/_ctypes/libffi/src/x86/ffi.c b/Modules/_ctypes/libffi/src/x86/ffi.c --- a/Modules/_ctypes/libffi/src/x86/ffi.c +++ b/Modules/_ctypes/libffi/src/x86/ffi.c @@ -315,9 +315,7 @@ cif->bytes += 4 * sizeof(ffi_arg); #endif -#ifdef X86_DARWIN cif->bytes = (cif->bytes + 15) & ~0xF; -#endif return FFI_OK; } diff --git a/Modules/_ctypes/libffi/src/x86/ffi64.c b/Modules/_ctypes/libffi/src/x86/ffi64.c --- a/Modules/_ctypes/libffi/src/x86/ffi64.c +++ b/Modules/_ctypes/libffi/src/x86/ffi64.c @@ -1,6 +1,5 @@ /* ----------------------------------------------------------------------- - ffi64.c - Copyright (c) 2013 The Written Word, Inc. - Copyright (c) 2011 Anthony Green + ffi64.c - Copyright (c) 20011 Anthony Green Copyright (c) 2008, 2010 Red Hat, Inc. Copyright (c) 2002, 2007 Bo Thorsen @@ -38,29 +37,17 @@ #define MAX_GPR_REGS 6 #define MAX_SSE_REGS 8 -#if defined(__INTEL_COMPILER) +#ifdef __INTEL_COMPILER #define UINT128 __m128 #else -#if defined(__SUNPRO_C) -#include -#define UINT128 __m128i -#else #define UINT128 __int128_t #endif -#endif - -union big_int_union -{ - UINT32 i32; - UINT64 i64; - UINT128 i128; -}; struct register_args { /* Registers for argument passing. */ UINT64 gpr[MAX_GPR_REGS]; - union big_int_union sse[MAX_SSE_REGS]; + UINT128 sse[MAX_SSE_REGS]; }; extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, @@ -484,33 +471,16 @@ { case X86_64_INTEGER_CLASS: case X86_64_INTEGERSI_CLASS: - /* Sign-extend integer arguments passed in general - purpose registers, to cope with the fact that - LLVM incorrectly assumes that this will be done - (the x86-64 PS ABI does not specify this). */ - switch (arg_types[i]->type) - { - case FFI_TYPE_SINT8: - *(SINT64 *)®_args->gpr[gprcount] = (SINT64) *((SINT8 *) a); - break; - case FFI_TYPE_SINT16: - *(SINT64 *)®_args->gpr[gprcount] = (SINT64) *((SINT16 *) a); - break; - case FFI_TYPE_SINT32: - *(SINT64 *)®_args->gpr[gprcount] = (SINT64) *((SINT32 *) a); - break; - default: - reg_args->gpr[gprcount] = 0; - memcpy (®_args->gpr[gprcount], a, size < 8 ? size : 8); - } + reg_args->gpr[gprcount] = 0; + memcpy (®_args->gpr[gprcount], a, size < 8 ? size : 8); gprcount++; break; case X86_64_SSE_CLASS: case X86_64_SSEDF_CLASS: - reg_args->sse[ssecount++].i64 = *(UINT64 *) a; + reg_args->sse[ssecount++] = *(UINT64 *) a; break; case X86_64_SSESF_CLASS: - reg_args->sse[ssecount++].i32 = *(UINT32 *) a; + reg_args->sse[ssecount++] = *(UINT32 *) a; break; default: abort(); diff --git a/Modules/_ctypes/libffi/src/x86/ffitarget.h b/Modules/_ctypes/libffi/src/x86/ffitarget.h --- a/Modules/_ctypes/libffi/src/x86/ffitarget.h +++ b/Modules/_ctypes/libffi/src/x86/ffitarget.h @@ -61,9 +61,8 @@ typedef long long ffi_sarg; #endif #else -#if defined __x86_64__ && defined __ILP32__ +#if defined __x86_64__ && !defined __LP64__ #define FFI_SIZEOF_ARG 8 -#define FFI_SIZEOF_JAVA_RAW 4 typedef unsigned long long ffi_arg; typedef long long ffi_sarg; #else diff --git a/Modules/_ctypes/libffi/src/x86/sysv.S b/Modules/_ctypes/libffi/src/x86/sysv.S --- a/Modules/_ctypes/libffi/src/x86/sysv.S +++ b/Modules/_ctypes/libffi/src/x86/sysv.S @@ -1,6 +1,5 @@ /* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 2013 The Written Word, Inc. - - Copyright (c) 1996,1998,2001-2003,2005,2008,2010 Red Hat, Inc. + sysv.S - Copyright (c) 1996, 1998, 2001-2003, 2005, 2008, 2010 Red Hat, Inc. X86 Foreign Function Interface @@ -182,19 +181,9 @@ leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 8(%ebp), %edx -#ifdef __SUNPRO_C - /* The SUNPRO compiler doesn't support GCC's regparm function - attribute, so we have to pass all three arguments to - ffi_closure_SYSV_inner on the stack. */ - movl %edx, 8(%esp) /* args = __builtin_dwarf_cfa () */ - leal -12(%ebp), %edx - movl %edx, 4(%esp) /* &resp */ - movl %eax, (%esp) /* closure */ -#else movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ -#endif #if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__ call ffi_closure_SYSV_inner #else @@ -339,9 +328,6 @@ .size ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV #endif -#if defined __GNUC__ -/* Only emit dwarf unwind info when building with GNU toolchain. */ - #if defined __PIC__ # if defined __sun__ && defined __svr4__ /* 32-bit Solaris 2/x86 uses datarel encoding for PIC. GNU ld before 2.22 @@ -474,7 +460,6 @@ .LEFDE3: #endif -#endif #endif /* ifndef __x86_64__ */ diff --git a/Modules/_ctypes/libffi/src/x86/unix64.S b/Modules/_ctypes/libffi/src/x86/unix64.S --- a/Modules/_ctypes/libffi/src/x86/unix64.S +++ b/Modules/_ctypes/libffi/src/x86/unix64.S @@ -1,7 +1,6 @@ /* ----------------------------------------------------------------------- - unix64.S - Copyright (c) 2013 The Written Word, Inc. - - Copyright (c) 2008 Red Hat, Inc - - Copyright (c) 2002 Bo Thorsen + unix64.S - Copyright (c) 2002 Bo Thorsen + Copyright (c) 2008 Red Hat, Inc x86-64 Foreign Function Interface @@ -325,9 +324,6 @@ .LUW9: .size ffi_closure_unix64,.-ffi_closure_unix64 -#ifdef __GNUC__ -/* Only emit DWARF unwind info when building with the GNU toolchain. */ - #ifdef HAVE_AS_X86_64_UNWIND_SECTION_TYPE .section .eh_frame,"a", at unwind #else @@ -423,8 +419,6 @@ .align 8 .LEFDE3: -#endif /* __GNUC__ */ - #endif /* __x86_64__ */ #if defined __ELF__ && defined __linux__ diff --git a/Modules/_ctypes/libffi/stamp-h.in b/Modules/_ctypes/libffi/stamp-h.in new file mode 100644 --- /dev/null +++ b/Modules/_ctypes/libffi/stamp-h.in @@ -0,0 +1,1 @@ +timestamp diff --git a/Modules/_ctypes/libffi/testsuite/Makefile.am b/Modules/_ctypes/libffi/testsuite/Makefile.am --- a/Modules/_ctypes/libffi/testsuite/Makefile.am +++ b/Modules/_ctypes/libffi/testsuite/Makefile.am @@ -13,82 +13,73 @@ AM_RUNTESTFLAGS = -EXTRA_DEJAGNU_SITE_CONFIG=../local.exp - CLEANFILES = *.exe core* *.log *.sum -EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \ -libffi.call/cls_align_longdouble_split.c \ -libffi.call/closure_loc_fn0.c libffi.call/cls_schar.c \ -libffi.call/closure_fn1.c libffi.call/many2_win32.c \ -libffi.call/return_ul.c libffi.call/cls_align_double.c \ -libffi.call/return_fl2.c libffi.call/cls_1_1byte.c \ -libffi.call/cls_64byte.c libffi.call/nested_struct7.c \ -libffi.call/cls_align_sint32.c libffi.call/nested_struct2.c \ -libffi.call/ffitest.h libffi.call/nested_struct4.c \ -libffi.call/cls_multi_ushort.c libffi.call/struct3.c \ -libffi.call/cls_3byte1.c libffi.call/cls_16byte.c \ -libffi.call/struct8.c libffi.call/nested_struct8.c \ -libffi.call/cls_multi_sshort.c libffi.call/cls_3byte2.c \ -libffi.call/fastthis2_win32.c libffi.call/cls_pointer.c \ -libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c \ -libffi.call/cls_9byte2.c libffi.call/cls_multi_schar.c \ -libffi.call/stret_medium2.c libffi.call/cls_5_1_byte.c \ -libffi.call/call.exp libffi.call/cls_double.c \ -libffi.call/cls_align_sint16.c libffi.call/cls_uint.c \ -libffi.call/return_ll1.c libffi.call/nested_struct3.c \ -libffi.call/cls_20byte1.c libffi.call/closure_fn4.c \ -libffi.call/cls_uchar.c libffi.call/struct2.c libffi.call/cls_7byte.c \ -libffi.call/strlen.c libffi.call/many.c libffi.call/testclosure.c \ -libffi.call/return_fl.c libffi.call/struct5.c \ -libffi.call/cls_12byte.c libffi.call/cls_multi_sshortchar.c \ -libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \ -libffi.call/return_fl3.c libffi.call/stret_medium.c \ -libffi.call/nested_struct6.c libffi.call/closure_fn3.c \ -libffi.call/float3.c libffi.call/many2.c \ -libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \ -libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \ -libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \ -libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \ -libffi.call/cls_sshort.c libffi.call/many_win32.c \ -libffi.call/nested_struct.c libffi.call/cls_20byte.c \ -libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \ -libffi.call/return_uc.c libffi.call/closure_thiscall.c \ -libffi.call/cls_18byte.c libffi.call/cls_8byte.c \ -libffi.call/promotion.c libffi.call/struct1_win32.c \ -libffi.call/return_dbl.c libffi.call/cls_24byte.c \ -libffi.call/struct4.c libffi.call/cls_6byte.c \ -libffi.call/cls_align_uint32.c libffi.call/float.c \ -libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \ -libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \ -libffi.call/cls_align_float.c libffi.call/return_fl1.c \ -libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ -libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \ -libffi.call/stret_large2.c libffi.call/return_sl.c \ -libffi.call/closure_fn0.c libffi.call/cls_5byte.c \ -libffi.call/cls_2byte.c libffi.call/float2.c \ -libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \ -libffi.call/stret_large.c libffi.call/cls_ulonglong.c \ -libffi.call/cls_ushort.c libffi.call/nested_struct1.c \ -libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \ -libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \ -libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \ -libffi.call/struct1.c libffi.call/nested_struct9.c \ -libffi.call/huge_struct.c libffi.call/problem1.c \ -libffi.call/float4.c libffi.call/fastthis3_win32.c \ -libffi.call/return_ldl.c libffi.call/strlen2_win32.c \ -libffi.call/closure_fn5.c libffi.call/struct2_win32.c \ -libffi.call/struct6.c libffi.call/return_ll.c libffi.call/struct9.c \ -libffi.call/return_sc.c libffi.call/struct7.c \ -libffi.call/cls_align_uint64.c libffi.call/cls_4byte.c \ -libffi.call/strlen_win32.c libffi.call/cls_6_1_byte.c \ -libffi.call/cls_7_1_byte.c libffi.special/unwindtest.cc \ -libffi.special/special.exp libffi.special/unwindtest_ffi_call.cc \ -libffi.special/ffitestcxx.h lib/wrapper.exp lib/target-libpath.exp \ -lib/libffi.exp libffi.call/cls_struct_va1.c \ -libffi.call/cls_uchar_va.c libffi.call/cls_uint_va.c \ -libffi.call/cls_ulong_va.c libffi.call/cls_ushort_va.c \ -libffi.call/nested_struct11.c libffi.call/uninitialized.c \ -libffi.call/va_1.c libffi.call/va_struct1.c libffi.call/va_struct2.c \ -libffi.call/va_struct3.c - +EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \ +libffi.call/cls_align_longdouble_split.c libffi.call/closure_loc_fn0.c \ +libffi.call/cls_schar.c libffi.call/closure_fn1.c \ +libffi.call/many2_win32.c libffi.call/return_ul.c \ +libffi.call/cls_align_double.c libffi.call/return_fl2.c \ +libffi.call/cls_1_1byte.c libffi.call/cls_64byte.c \ +libffi.call/nested_struct7.c libffi.call/cls_align_sint32.c \ +libffi.call/nested_struct2.c libffi.call/ffitest.h \ +libffi.call/nested_struct4.c libffi.call/cls_multi_ushort.c \ +libffi.call/struct3.c libffi.call/cls_3byte1.c \ +libffi.call/cls_16byte.c libffi.call/struct8.c \ +libffi.call/nested_struct8.c libffi.call/cls_multi_sshort.c \ +libffi.call/cls_3byte2.c libffi.call/fastthis2_win32.c \ +libffi.call/cls_pointer.c libffi.call/err_bad_typedef.c \ +libffi.call/cls_4_1byte.c libffi.call/cls_9byte2.c \ +libffi.call/cls_multi_schar.c libffi.call/stret_medium2.c \ +libffi.call/cls_5_1_byte.c libffi.call/call.exp \ +libffi.call/cls_double.c libffi.call/cls_align_sint16.c \ +libffi.call/cls_uint.c libffi.call/return_ll1.c \ +libffi.call/nested_struct3.c libffi.call/cls_20byte1.c \ +libffi.call/closure_fn4.c libffi.call/cls_uchar.c \ +libffi.call/struct2.c libffi.call/cls_7byte.c libffi.call/strlen.c \ +libffi.call/many.c libffi.call/testclosure.c libffi.call/return_fl.c \ +libffi.call/struct5.c libffi.call/cls_12byte.c \ +libffi.call/cls_multi_sshortchar.c \ +libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \ +libffi.call/return_fl3.c libffi.call/stret_medium.c \ +libffi.call/nested_struct6.c libffi.call/a.out \ +libffi.call/closure_fn3.c libffi.call/float3.c libffi.call/many2.c \ +libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \ +libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \ +libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \ +libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \ +libffi.call/cls_sshort.c libffi.call/many_win32.c \ +libffi.call/nested_struct.c libffi.call/cls_20byte.c \ +libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \ +libffi.call/return_uc.c libffi.call/closure_thiscall.c \ +libffi.call/cls_18byte.c libffi.call/cls_8byte.c \ +libffi.call/promotion.c libffi.call/struct1_win32.c \ +libffi.call/return_dbl.c libffi.call/cls_24byte.c \ +libffi.call/struct4.c libffi.call/cls_6byte.c \ +libffi.call/cls_align_uint32.c libffi.call/float.c \ +libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \ +libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \ +libffi.call/cls_align_float.c libffi.call/return_fl1.c \ +libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ +libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \ +libffi.call/stret_large2.c libffi.call/return_sl.c \ +libffi.call/closure_fn0.c libffi.call/cls_5byte.c \ +libffi.call/cls_2byte.c libffi.call/float2.c \ +libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \ +libffi.call/stret_large.c libffi.call/cls_ulonglong.c \ +libffi.call/cls_ushort.c libffi.call/nested_struct1.c \ +libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \ +libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \ +libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \ +libffi.call/struct1.c libffi.call/nested_struct9.c \ +libffi.call/huge_struct.c libffi.call/problem1.c libffi.call/float4.c \ +libffi.call/fastthis3_win32.c libffi.call/return_ldl.c \ +libffi.call/strlen2_win32.c libffi.call/closure_fn5.c \ +libffi.call/struct2_win32.c libffi.call/struct6.c \ +libffi.call/return_ll.c libffi.call/struct9.c libffi.call/return_sc.c \ +libffi.call/struct7.c libffi.call/cls_align_uint64.c \ +libffi.call/cls_4byte.c libffi.call/strlen_win32.c \ +libffi.call/cls_6_1_byte.c libffi.call/cls_7_1_byte.c \ +libffi.special/unwindtest.cc libffi.special/special.exp \ +libffi.special/unwindtest_ffi_call.cc libffi.special/ffitestcxx.h \ +lib/wrapper.exp lib/target-libpath.exp lib/libffi.exp diff --git a/Modules/_ctypes/libffi/testsuite/Makefile.in b/Modules/_ctypes/libffi/testsuite/Makefile.in --- a/Modules/_ctypes/libffi/testsuite/Makefile.in +++ b/Modules/_ctypes/libffi/testsuite/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.12.2 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2012 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,23 +15,6 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -53,19 +37,7 @@ subdir = testsuite DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \ - $(top_srcdir)/m4/ax_append_flag.m4 \ - $(top_srcdir)/m4/ax_cc_maxopt.m4 \ - $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compiler_vendor.m4 \ - $(top_srcdir)/m4/ax_configure_args.m4 \ - $(top_srcdir)/m4/ax_enable_builddir.m4 \ - $(top_srcdir)/m4/ax_gcc_archflag.m4 \ - $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -75,11 +47,6 @@ CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac DEJATOOL = $(PACKAGE) RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -147,7 +114,6 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -PRTDIAG = @PRTDIAG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -168,7 +134,6 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -204,7 +169,6 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ -sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ @@ -227,82 +191,75 @@ echo $(top_srcdir)/../dejagnu/runtest ; \ else echo runtest; fi` -EXTRA_DEJAGNU_SITE_CONFIG = ../local.exp CLEANFILES = *.exe core* *.log *.sum -EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \ -libffi.call/cls_align_longdouble_split.c \ -libffi.call/closure_loc_fn0.c libffi.call/cls_schar.c \ -libffi.call/closure_fn1.c libffi.call/many2_win32.c \ -libffi.call/return_ul.c libffi.call/cls_align_double.c \ -libffi.call/return_fl2.c libffi.call/cls_1_1byte.c \ -libffi.call/cls_64byte.c libffi.call/nested_struct7.c \ -libffi.call/cls_align_sint32.c libffi.call/nested_struct2.c \ -libffi.call/ffitest.h libffi.call/nested_struct4.c \ -libffi.call/cls_multi_ushort.c libffi.call/struct3.c \ -libffi.call/cls_3byte1.c libffi.call/cls_16byte.c \ -libffi.call/struct8.c libffi.call/nested_struct8.c \ -libffi.call/cls_multi_sshort.c libffi.call/cls_3byte2.c \ -libffi.call/fastthis2_win32.c libffi.call/cls_pointer.c \ -libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c \ -libffi.call/cls_9byte2.c libffi.call/cls_multi_schar.c \ -libffi.call/stret_medium2.c libffi.call/cls_5_1_byte.c \ -libffi.call/call.exp libffi.call/cls_double.c \ -libffi.call/cls_align_sint16.c libffi.call/cls_uint.c \ -libffi.call/return_ll1.c libffi.call/nested_struct3.c \ -libffi.call/cls_20byte1.c libffi.call/closure_fn4.c \ -libffi.call/cls_uchar.c libffi.call/struct2.c libffi.call/cls_7byte.c \ -libffi.call/strlen.c libffi.call/many.c libffi.call/testclosure.c \ -libffi.call/return_fl.c libffi.call/struct5.c \ -libffi.call/cls_12byte.c libffi.call/cls_multi_sshortchar.c \ -libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \ -libffi.call/return_fl3.c libffi.call/stret_medium.c \ -libffi.call/nested_struct6.c libffi.call/closure_fn3.c \ -libffi.call/float3.c libffi.call/many2.c \ -libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \ -libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \ -libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \ -libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \ -libffi.call/cls_sshort.c libffi.call/many_win32.c \ -libffi.call/nested_struct.c libffi.call/cls_20byte.c \ -libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \ -libffi.call/return_uc.c libffi.call/closure_thiscall.c \ -libffi.call/cls_18byte.c libffi.call/cls_8byte.c \ -libffi.call/promotion.c libffi.call/struct1_win32.c \ -libffi.call/return_dbl.c libffi.call/cls_24byte.c \ -libffi.call/struct4.c libffi.call/cls_6byte.c \ -libffi.call/cls_align_uint32.c libffi.call/float.c \ -libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \ -libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \ -libffi.call/cls_align_float.c libffi.call/return_fl1.c \ -libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ -libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \ -libffi.call/stret_large2.c libffi.call/return_sl.c \ -libffi.call/closure_fn0.c libffi.call/cls_5byte.c \ -libffi.call/cls_2byte.c libffi.call/float2.c \ -libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \ -libffi.call/stret_large.c libffi.call/cls_ulonglong.c \ -libffi.call/cls_ushort.c libffi.call/nested_struct1.c \ -libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \ -libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \ -libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \ -libffi.call/struct1.c libffi.call/nested_struct9.c \ -libffi.call/huge_struct.c libffi.call/problem1.c \ -libffi.call/float4.c libffi.call/fastthis3_win32.c \ -libffi.call/return_ldl.c libffi.call/strlen2_win32.c \ -libffi.call/closure_fn5.c libffi.call/struct2_win32.c \ -libffi.call/struct6.c libffi.call/return_ll.c libffi.call/struct9.c \ -libffi.call/return_sc.c libffi.call/struct7.c \ -libffi.call/cls_align_uint64.c libffi.call/cls_4byte.c \ -libffi.call/strlen_win32.c libffi.call/cls_6_1_byte.c \ -libffi.call/cls_7_1_byte.c libffi.special/unwindtest.cc \ -libffi.special/special.exp libffi.special/unwindtest_ffi_call.cc \ -libffi.special/ffitestcxx.h lib/wrapper.exp lib/target-libpath.exp \ -lib/libffi.exp libffi.call/cls_struct_va1.c \ -libffi.call/cls_uchar_va.c libffi.call/cls_uint_va.c \ -libffi.call/cls_ulong_va.c libffi.call/cls_ushort_va.c \ -libffi.call/nested_struct11.c libffi.call/uninitialized.c \ -libffi.call/va_1.c libffi.call/va_struct1.c libffi.call/va_struct2.c \ -libffi.call/va_struct3.c +EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \ +libffi.call/cls_align_longdouble_split.c libffi.call/closure_loc_fn0.c \ +libffi.call/cls_schar.c libffi.call/closure_fn1.c \ +libffi.call/many2_win32.c libffi.call/return_ul.c \ +libffi.call/cls_align_double.c libffi.call/return_fl2.c \ +libffi.call/cls_1_1byte.c libffi.call/cls_64byte.c \ +libffi.call/nested_struct7.c libffi.call/cls_align_sint32.c \ +libffi.call/nested_struct2.c libffi.call/ffitest.h \ +libffi.call/nested_struct4.c libffi.call/cls_multi_ushort.c \ +libffi.call/struct3.c libffi.call/cls_3byte1.c \ +libffi.call/cls_16byte.c libffi.call/struct8.c \ +libffi.call/nested_struct8.c libffi.call/cls_multi_sshort.c \ +libffi.call/cls_3byte2.c libffi.call/fastthis2_win32.c \ +libffi.call/cls_pointer.c libffi.call/err_bad_typedef.c \ +libffi.call/cls_4_1byte.c libffi.call/cls_9byte2.c \ +libffi.call/cls_multi_schar.c libffi.call/stret_medium2.c \ +libffi.call/cls_5_1_byte.c libffi.call/call.exp \ +libffi.call/cls_double.c libffi.call/cls_align_sint16.c \ +libffi.call/cls_uint.c libffi.call/return_ll1.c \ +libffi.call/nested_struct3.c libffi.call/cls_20byte1.c \ +libffi.call/closure_fn4.c libffi.call/cls_uchar.c \ +libffi.call/struct2.c libffi.call/cls_7byte.c libffi.call/strlen.c \ +libffi.call/many.c libffi.call/testclosure.c libffi.call/return_fl.c \ +libffi.call/struct5.c libffi.call/cls_12byte.c \ +libffi.call/cls_multi_sshortchar.c \ +libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \ +libffi.call/return_fl3.c libffi.call/stret_medium.c \ +libffi.call/nested_struct6.c libffi.call/a.out \ +libffi.call/closure_fn3.c libffi.call/float3.c libffi.call/many2.c \ +libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \ +libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \ +libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \ +libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \ +libffi.call/cls_sshort.c libffi.call/many_win32.c \ +libffi.call/nested_struct.c libffi.call/cls_20byte.c \ +libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \ +libffi.call/return_uc.c libffi.call/closure_thiscall.c \ +libffi.call/cls_18byte.c libffi.call/cls_8byte.c \ +libffi.call/promotion.c libffi.call/struct1_win32.c \ +libffi.call/return_dbl.c libffi.call/cls_24byte.c \ +libffi.call/struct4.c libffi.call/cls_6byte.c \ +libffi.call/cls_align_uint32.c libffi.call/float.c \ +libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \ +libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \ +libffi.call/cls_align_float.c libffi.call/return_fl1.c \ +libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ +libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \ +libffi.call/stret_large2.c libffi.call/return_sl.c \ +libffi.call/closure_fn0.c libffi.call/cls_5byte.c \ +libffi.call/cls_2byte.c libffi.call/float2.c \ +libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \ +libffi.call/stret_large.c libffi.call/cls_ulonglong.c \ +libffi.call/cls_ushort.c libffi.call/nested_struct1.c \ +libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \ +libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \ +libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \ +libffi.call/struct1.c libffi.call/nested_struct9.c \ +libffi.call/huge_struct.c libffi.call/problem1.c libffi.call/float4.c \ +libffi.call/fastthis3_win32.c libffi.call/return_ldl.c \ +libffi.call/strlen2_win32.c libffi.call/closure_fn5.c \ +libffi.call/struct2_win32.c libffi.call/struct6.c \ +libffi.call/return_ll.c libffi.call/struct9.c libffi.call/return_sc.c \ +libffi.call/struct7.c libffi.call/cls_align_uint64.c \ +libffi.call/cls_4byte.c libffi.call/strlen_win32.c \ +libffi.call/cls_6_1_byte.c libffi.call/cls_7_1_byte.c \ +libffi.special/unwindtest.cc libffi.special/special.exp \ +libffi.special/unwindtest_ffi_call.cc libffi.special/ffitestcxx.h \ +lib/wrapper.exp lib/target-libpath.exp lib/libffi.exp all: all-am @@ -349,8 +306,6 @@ ctags: CTAGS CTAGS: -cscope cscopelist: - check-DEJAGNU: site.exp srcdir='$(srcdir)'; export srcdir; \ @@ -361,11 +316,11 @@ if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \ then :; else exit_status=1; fi; \ done; \ - else echo "WARNING: could not find 'runtest'" 1>&2; :;\ + else echo "WARNING: could not find \`runtest'" 1>&2; :;\ fi; \ exit $$exit_status site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG) - @echo 'Making a new site.exp file ...' + @echo 'Making a new site.exp file...' @echo '## these variables are automatically generated by make ##' >site.tmp @echo '# Do not edit here. If you wish to override these values' >>site.tmp @echo '# edit the last section' >>site.tmp diff --git a/Modules/_ctypes/libffi/testsuite/lib/libffi.exp b/Modules/_ctypes/libffi/testsuite/lib/libffi.exp --- a/Modules/_ctypes/libffi/testsuite/lib/libffi.exp +++ b/Modules/_ctypes/libffi/testsuite/lib/libffi.exp @@ -101,17 +101,9 @@ global tool_root_dir global ld_library_path - global using_gcc - set blddirffi [pwd]/.. verbose "libffi $blddirffi" - # Are we building with GCC? - set tmp [grep ../config.status "GCC='yes'"] - if { [string match $tmp "GCC='yes'"] } { - - set using_gcc "yes" - set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] if {$gccdir != ""} { set gccdir [file dirname $gccdir] @@ -135,13 +127,6 @@ } } } - - } else { - - set using_gcc "no" - - } - # add the library path for libffi. append ld_library_path ":${blddirffi}/.libs" @@ -218,10 +203,6 @@ lappend options "libs= -lffi" - if { [string match "aarch64*-*-linux*" $target_triplet] } { - lappend options "libs= -lpthread" - } - verbose "options: $options" return [target_compile $source $dest $type $options] } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/cls_longdouble.c @@ -5,9 +5,7 @@ Originator: Blake Chaffin */ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ -/* This test is known to PASS on armv7l-unknown-linux-gnueabihf, so I have - remove the xfail for arm*-*-* below, until we know more. */ -/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ +/* { dg-do run { xfail arm*-*-* strongarm*-*-* xscale*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h b/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h --- a/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h @@ -15,7 +15,7 @@ #define MAX_ARGS 256 -#define CHECK(x) !(x) ? (abort(), 1) : 0 +#define CHECK(x) !(x) ? abort() : 0 /* Define __UNUSED__ that also other compilers than gcc can run the tests. */ #undef __UNUSED__ @@ -127,6 +127,44 @@ #define PRId64 "I64d" #endif -#ifndef PRIuPTR -#define PRIuPTR "u" +#ifdef USING_MMAP +static inline void * +allocate_mmap (size_t size) +{ + void *page; +#if defined (HAVE_MMAP_DEV_ZERO) + static int dev_zero_fd = -1; #endif + +#ifdef HAVE_MMAP_DEV_ZERO + if (dev_zero_fd == -1) + { + dev_zero_fd = open ("/dev/zero", O_RDONLY); + if (dev_zero_fd == -1) + { + perror ("open /dev/zero: %m"); + exit (1); + } + } +#endif + + +#ifdef HAVE_MMAP_ANON + page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); +#endif +#ifdef HAVE_MMAP_DEV_ZERO + page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE, dev_zero_fd, 0); +#endif + + if (page == (void *) MAP_FAILED) + { + perror ("virtual memory exhausted"); + exit (1); + } + + return page; +} + +#endif diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c b/Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/float_va.c @@ -56,9 +56,9 @@ * different. */ /* Call it statically and then via ffi */ resfp=float_va_fn(0,2.0); - /* { dg-output "0: 2.0 : total: 2.0" } */ + // { dg-output "0: 2.0 : total: 2.0" } printf("compiled: %.1f\n", resfp); - /* { dg-output "\ncompiled: 2.0" } */ + // { dg-output "\ncompiled: 2.0" } arg_types[0] = &ffi_type_uint; arg_types[1] = &ffi_type_double; @@ -71,16 +71,16 @@ values[0] = &firstarg; values[1] = &doubles[0]; ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values); - /* { dg-output "\n0: 2.0 : total: 2.0" } */ + // { dg-output "\n0: 2.0 : total: 2.0" } printf("ffi: %.1f\n", resfp); - /* { dg-output "\nffi: 2.0" } */ + // { dg-output "\nffi: 2.0" } /* Second test, float_va_fn(2,2.0,3.0,4.0), now with variadic params */ /* Call it statically and then via ffi */ resfp=float_va_fn(2,2.0,3.0,4.0); - /* { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } */ + // { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } printf("compiled: %.1f\n", resfp); - /* { dg-output "\ncompiled: 11.0" } */ + // { dg-output "\ncompiled: 11.0" } arg_types[0] = &ffi_type_uint; arg_types[1] = &ffi_type_double; @@ -99,9 +99,9 @@ values[2] = &doubles[1]; values[3] = &doubles[2]; ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values); - /* { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } */ + // { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } printf("ffi: %.1f\n", resfp); - /* { dg-output "\nffi: 11.0" } */ + // { dg-output "\nffi: 11.0" } exit(0); } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/huge_struct.c b/Modules/_ctypes/libffi/testsuite/libffi.call/huge_struct.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/huge_struct.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/huge_struct.c @@ -8,7 +8,6 @@ /* { dg-excess-errors "" { target x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ -/* { dg-options -Wformat=0 { target moxie*-*-elf } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" @@ -296,7 +295,7 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 50, &ret_struct_type, argTypes) == FFI_OK); ffi_call(&cif, FFI_FN(test_large_fn), &retVal, argValues); - /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */ + // { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " @@ -309,7 +308,7 @@ retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); - /* { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */ + // { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } CHECK(ffi_prep_closure_loc(pcl, &cif, cls_large_fn, NULL, code) == FFI_OK); @@ -324,7 +323,7 @@ ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8); - /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */ + // { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " @@ -337,7 +336,7 @@ retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); - /* { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */ + // { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } return 0; } diff --git a/Modules/_ctypes/libffi/testsuite/libffi.call/many2.c b/Modules/_ctypes/libffi/testsuite/libffi.call/many2.c --- a/Modules/_ctypes/libffi/testsuite/libffi.call/many2.c +++ b/Modules/_ctypes/libffi/testsuite/libffi.call/many2.c @@ -12,10 +12,7 @@ typedef unsigned char u8; -#ifdef __GNUC__ -__attribute__((noinline)) -#endif -uint8_t +__attribute__((noinline)) uint8_t foo (uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e, uint8_t f, uint8_t g) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:34:11 2013 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 19 Mar 2013 23:34:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMik6?= =?utf-8?q?_merge_heads?= Message-ID: <3ZVpw32VLtzS8V@mail.python.org> http://hg.python.org/cpython/rev/2277e43fef8b changeset: 82792:2277e43fef8b branch: 3.2 parent: 82788:fa475953f183 parent: 82783:ba500b179c3a user: Gregory P. Smith date: Tue Mar 19 15:25:28 2013 -0700 summary: merge heads files: Doc/library/email.mime.rst | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/Doc/library/email.mime.rst b/Doc/library/email.mime.rst --- a/Doc/library/email.mime.rst +++ b/Doc/library/email.mime.rst @@ -185,5 +185,15 @@ minor type and defaults to :mimetype:`plain`. *_charset* is the character set of the text and is passed as a parameter to the :class:`~email.mime.nonmultipart.MIMENonMultipart` constructor; it defaults - to ``us-ascii``. No guessing or encoding is performed on the text data. + to ``us-ascii``. + Unless the ``_charset`` parameter is explicitly set to ``None``, the + MIMEText object created will have both a :mailheader:`Content-Type` header + with a ``charset`` parameter, and a :mailheader:`Content-Transfer-Endcoding` + header. This means that a subsequent ``set_payload`` call will not result + in an encoded payload, even if a charset is passed in the ``set_payload`` + command. You can "reset" this behavior by deleting the + ``Content-Transfer-Encoding`` header, after which a ``set_payload`` call + will automatically encode the new payload (and add a new + :mailheader:`Content-Transfer-Encoding` header). + -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:34:12 2013 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 19 Mar 2013 23:34:12 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4zIC0+IDMuMyk6?= =?utf-8?q?_merge_heads?= Message-ID: <3ZVpw469LdzS8W@mail.python.org> http://hg.python.org/cpython/rev/a5a0d87f3dcc changeset: 82793:a5a0d87f3dcc branch: 3.3 parent: 82790:9e501d0fb68c parent: 82784:fcbc28ef96a3 user: Gregory P. Smith date: Tue Mar 19 15:25:46 2013 -0700 summary: merge heads files: Doc/library/email.mime.rst | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/Doc/library/email.mime.rst b/Doc/library/email.mime.rst --- a/Doc/library/email.mime.rst +++ b/Doc/library/email.mime.rst @@ -187,3 +187,13 @@ :class:`~email.mime.nonmultipart.MIMENonMultipart` constructor; it defaults to ``us-ascii`` if the string contains only ``ascii`` codepoints, and ``utf-8`` otherwise. + + Unless the ``_charset`` parameter is explicitly set to ``None``, the + MIMEText object created will have both a :mailheader:`Content-Type` header + with a ``charset`` parameter, and a :mailheader:`Content-Transfer-Endcoding` + header. This means that a subsequent ``set_payload`` call will not result + in an encoded payload, even if a charset is passed in the ``set_payload`` + command. You can "reset" this behavior by deleting the + ``Content-Transfer-Encoding`` header, after which a ``set_payload`` call + will automatically encode the new payload (and add a new + :mailheader:`Content-Transfer-Encoding` header). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:34:14 2013 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 19 Mar 2013 23:34:14 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_merge_from_3=2E2?= Message-ID: <3ZVpw62d6hzRhf@mail.python.org> http://hg.python.org/cpython/rev/7127dda7e8ed changeset: 82794:7127dda7e8ed branch: 3.3 parent: 82793:a5a0d87f3dcc parent: 82792:2277e43fef8b user: Gregory P. Smith date: Tue Mar 19 15:30:41 2013 -0700 summary: merge from 3.2 files: Misc/NEWS | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -7,7 +7,7 @@ *Not yet released, see sections below for changes released in 3.3.0* -.. *Release date: XX-XXX-2012* +.. *Release date: 2013-XX-XX* Core and Builtins ----------------- @@ -21,6 +21,9 @@ - Issue #17223: Fix PyUnicode_FromUnicode() for string of 1 character outside the range U+0000-U+10ffff. +- Issue #1692335: Move initial args assignment to + BaseException.__new__ to help pickling of naive subclasses. + - Issue #17275: Corrected class name in init error messages of the C version of BufferedWriter and BufferedRandom. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:34:15 2013 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 19 Mar 2013 23:34:15 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_merge_heads?= Message-ID: <3ZVpw76Jn2zSMm@mail.python.org> http://hg.python.org/cpython/rev/012ea6e295c3 changeset: 82795:012ea6e295c3 parent: 82791:a94b3b4599f1 parent: 82785:b9e07f20832e user: Gregory P. Smith date: Tue Mar 19 15:31:05 2013 -0700 summary: merge heads files: Doc/library/email.mime.rst | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/Doc/library/email.mime.rst b/Doc/library/email.mime.rst --- a/Doc/library/email.mime.rst +++ b/Doc/library/email.mime.rst @@ -187,3 +187,13 @@ :class:`~email.mime.nonmultipart.MIMENonMultipart` constructor; it defaults to ``us-ascii`` if the string contains only ``ascii`` codepoints, and ``utf-8`` otherwise. + + Unless the ``_charset`` parameter is explicitly set to ``None``, the + MIMEText object created will have both a :mailheader:`Content-Type` header + with a ``charset`` parameter, and a :mailheader:`Content-Transfer-Endcoding` + header. This means that a subsequent ``set_payload`` call will not result + in an encoded payload, even if a charset is passed in the ``set_payload`` + command. You can "reset" this behavior by deleting the + ``Content-Transfer-Encoding`` header, after which a ``set_payload`` call + will automatically encode the new payload (and add a new + :mailheader:`Content-Transfer-Encoding` header). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 19 23:34:17 2013 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 19 Mar 2013 23:34:17 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge_heads_=26_use_iso8601_date_format?= Message-ID: <3ZVpw933SmzSQl@mail.python.org> http://hg.python.org/cpython/rev/5f873f5f4ec3 changeset: 82796:5f873f5f4ec3 parent: 82795:012ea6e295c3 parent: 82794:7127dda7e8ed user: Gregory P. Smith date: Tue Mar 19 15:33:23 2013 -0700 summary: merge heads & use iso8601 date format files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -5,7 +5,7 @@ What's New in Python 3.4.0 Alpha 1? =================================== -*Relase date: XX-XXX-2014* +*Relase date: 2014-XX-XX* Core and Builtins ----------------- -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 00:00:53 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 00:00:53 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEwMjk2?= =?utf-8?q?_=3A_Don=27t_handle_BreakPoint_exceptions_using?= Message-ID: <3ZVqVs1gkszSCh@mail.python.org> http://hg.python.org/cpython/rev/b2e8392a8f77 changeset: 82797:b2e8392a8f77 branch: 2.7 parent: 82782:37f52e71f4cd user: Kristj?n Valur J?nsson date: Tue Mar 19 15:24:10 2013 -0700 summary: Issue #10296 : Don't handle BreakPoint exceptions using Structured Exception Handling on windows. files: Modules/_ctypes/callproc.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -401,6 +401,11 @@ { *pdw = ptrs->ExceptionRecord->ExceptionCode; *record = *ptrs->ExceptionRecord; + /* We don't want to catch breakpoint exceptions, they are used to attach + * a debugger to the process. + */ + if (*pdw == EXCEPTION_BREAKPOINT) + return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_EXECUTE_HANDLER; } #endif -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 00:00:54 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 00:00:54 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEwMjk2?= =?utf-8?q?_=3A_Don=27t_handle_BreakPoint_exceptions_using?= Message-ID: <3ZVqVt4jd7zSJt@mail.python.org> http://hg.python.org/cpython/rev/bc5778b488c1 changeset: 82798:bc5778b488c1 branch: 3.2 parent: 82773:33f02ccb5301 user: Kristj?n Valur J?nsson date: Tue Mar 19 15:24:10 2013 -0700 summary: Issue #10296 : Don't handle BreakPoint exceptions using Structured Exception Handling on windows. files: Modules/_ctypes/callproc.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -397,6 +397,11 @@ { *pdw = ptrs->ExceptionRecord->ExceptionCode; *record = *ptrs->ExceptionRecord; + /* We don't want to catch breakpoint exceptions, they are used to attach + * a debugger to the process. + */ + if (*pdw == EXCEPTION_BREAKPOINT) + return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_EXECUTE_HANDLER; } #endif -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 00:00:56 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 00:00:56 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2310296=3A_Merge_to_3=2E3?= Message-ID: <3ZVqVw0L4MzS8W@mail.python.org> http://hg.python.org/cpython/rev/4c7eb717ea88 changeset: 82799:4c7eb717ea88 branch: 3.3 parent: 82780:6dcc9628065c parent: 82798:bc5778b488c1 user: Kristj?n Valur J?nsson date: Tue Mar 19 15:35:28 2013 -0700 summary: #10296: Merge to 3.3 files: Modules/_ctypes/callproc.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -397,6 +397,11 @@ { *pdw = ptrs->ExceptionRecord->ExceptionCode; *record = *ptrs->ExceptionRecord; + /* We don't want to catch breakpoint exceptions, they are used to attach + * a debugger to the process. + */ + if (*pdw == EXCEPTION_BREAKPOINT) + return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_EXECUTE_HANDLER; } #endif -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 00:00:57 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 00:00:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2310296=3A_Merge_to_default?= Message-ID: <3ZVqVx3HXmzPCm@mail.python.org> http://hg.python.org/cpython/rev/4f3fbdb4d748 changeset: 82800:4f3fbdb4d748 parent: 82796:5f873f5f4ec3 parent: 82799:4c7eb717ea88 user: Kristj?n Valur J?nsson date: Tue Mar 19 15:38:32 2013 -0700 summary: Issue #10296: Merge to default files: Modules/_ctypes/callproc.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -397,6 +397,11 @@ { *pdw = ptrs->ExceptionRecord->ExceptionCode; *record = *ptrs->ExceptionRecord; + /* We don't want to catch breakpoint exceptions, they are used to attach + * a debugger to the process. + */ + if (*pdw == EXCEPTION_BREAKPOINT) + return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_EXECUTE_HANDLER; } #endif -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 00:00:58 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 00:00:58 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMik6?= =?utf-8?q?_Merge?= Message-ID: <3ZVqVy5rqHzSJt@mail.python.org> http://hg.python.org/cpython/rev/ec4486b5e845 changeset: 82801:ec4486b5e845 branch: 3.2 parent: 82792:2277e43fef8b parent: 82798:bc5778b488c1 user: Kristj?n Valur J?nsson date: Tue Mar 19 15:57:19 2013 -0700 summary: Merge files: Modules/_ctypes/callproc.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -397,6 +397,11 @@ { *pdw = ptrs->ExceptionRecord->ExceptionCode; *record = *ptrs->ExceptionRecord; + /* We don't want to catch breakpoint exceptions, they are used to attach + * a debugger to the process. + */ + if (*pdw == EXCEPTION_BREAKPOINT) + return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_EXECUTE_HANDLER; } #endif -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 00:01:00 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 00:01:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4zIC0+IDMuMyk6?= =?utf-8?q?_Merge?= Message-ID: <3ZVqW01JNzzSJt@mail.python.org> http://hg.python.org/cpython/rev/c34b580338d8 changeset: 82802:c34b580338d8 branch: 3.3 parent: 82794:7127dda7e8ed parent: 82799:4c7eb717ea88 user: Kristj?n Valur J?nsson date: Tue Mar 19 16:00:01 2013 -0700 summary: Merge files: Modules/_ctypes/callproc.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -397,6 +397,11 @@ { *pdw = ptrs->ExceptionRecord->ExceptionCode; *record = *ptrs->ExceptionRecord; + /* We don't want to catch breakpoint exceptions, they are used to attach + * a debugger to the process. + */ + if (*pdw == EXCEPTION_BREAKPOINT) + return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_EXECUTE_HANDLER; } #endif -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 00:20:58 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 00:20:58 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E2_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E2?= Message-ID: <3ZVqy24B3NzPPY@mail.python.org> http://hg.python.org/cpython/rev/f847854cb0de changeset: 82803:f847854cb0de parent: 82800:4f3fbdb4d748 parent: 82801:ec4486b5e845 user: Kristj?n Valur J?nsson date: Tue Mar 19 16:19:24 2013 -0700 summary: Merge with 3.2 files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 00:20:59 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 00:20:59 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E3?= Message-ID: <3ZVqy36ZjQzSDF@mail.python.org> http://hg.python.org/cpython/rev/2a5035b92d85 changeset: 82804:2a5035b92d85 parent: 82803:f847854cb0de parent: 82802:c34b580338d8 user: Kristj?n Valur J?nsson date: Tue Mar 19 16:20:16 2013 -0700 summary: Merge with 3.3 files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 00:36:02 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 00:36:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_with_3=2E2?= Message-ID: <3ZVrHQ6fRDzPh2@mail.python.org> http://hg.python.org/cpython/rev/152e2d009098 changeset: 82805:152e2d009098 branch: 3.3 parent: 82802:c34b580338d8 parent: 82801:ec4486b5e845 user: Kristj?n Valur J?nsson date: Tue Mar 19 16:34:39 2013 -0700 summary: Merge with 3.2 files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 00:36:04 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 00:36:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E3?= Message-ID: <3ZVrHS1yx1zPh2@mail.python.org> http://hg.python.org/cpython/rev/e98e207f0524 changeset: 82806:e98e207f0524 parent: 82804:2a5035b92d85 parent: 82805:152e2d009098 user: Kristj?n Valur J?nsson date: Tue Mar 19 16:35:26 2013 -0700 summary: Merge with 3.3 files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 00:44:35 2013 From: python-checkins at python.org (terry.reedy) Date: Wed, 20 Mar 2013 00:44:35 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2313248=3A_removed_?= =?utf-8?q?deprecated_and_undocumented_difflib=2Eisbjunk=2C_isbpopular=2E?= Message-ID: <3ZVrTH23v4zPCm@mail.python.org> http://hg.python.org/cpython/rev/612d8bbcfa3a changeset: 82807:612d8bbcfa3a user: Terry Jan Reedy date: Tue Mar 19 19:44:04 2013 -0400 summary: Issue #13248: removed deprecated and undocumented difflib.isbjunk, isbpopular. files: Lib/difflib.py | 14 -------------- 1 files changed, 0 insertions(+), 14 deletions(-) diff --git a/Lib/difflib.py b/Lib/difflib.py --- a/Lib/difflib.py +++ b/Lib/difflib.py @@ -336,20 +336,6 @@ for elt in popular: # ditto; as fast for 1% deletion del b2j[elt] - def isbjunk(self, item): - "Deprecated; use 'item in SequenceMatcher().bjunk'." - warnings.warn("'SequenceMatcher().isbjunk(item)' is deprecated;\n" - "use 'item in SMinstance.bjunk' instead.", - DeprecationWarning, 2) - return item in self.bjunk - - def isbpopular(self, item): - "Deprecated; use 'item in SequenceMatcher().bpopular'." - warnings.warn("'SequenceMatcher().isbpopular(item)' is deprecated;\n" - "use 'item in SMinstance.bpopular' instead.", - DeprecationWarning, 2) - return item in self.bpopular - def find_longest_match(self, alo, ahi, blo, bhi): """Find longest matching block in a[alo:ahi] and b[blo:bhi]. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 00:49:28 2013 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 20 Mar 2013 00:49:28 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3NDcxIC0gSW5j?= =?utf-8?q?reasing_the_urllib=2Eerror_test_coverage=2E_Bringing_it_to_100?= =?utf-8?q?=25=2E_Based?= Message-ID: <3ZVrZw46glzPhm@mail.python.org> http://hg.python.org/cpython/rev/ae9aea1b3546 changeset: 82808:ae9aea1b3546 branch: 3.2 parent: 82801:ec4486b5e845 user: Senthil Kumaran date: Tue Mar 19 16:11:07 2013 -0700 summary: #17471 - Increasing the urllib.error test coverage. Bringing it to 100%. Based on patch contributed by Daniel Wozniak files: Lib/test/test_urllib2.py | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -1446,10 +1446,18 @@ Issue 13211 reveals that HTTPError didn't implement the URLError interface even though HTTPError is a subclass of URLError. - >>> err = urllib.error.HTTPError(msg='something bad happened', url=None, code=None, hdrs=None, fp=None) + >>> msg = 'something bad happened' + >>> url = code = fp = None + >>> hdrs = 'Content-Length: 42' + >>> err = urllib.error.HTTPError(url, code, msg, hdrs, fp) >>> assert hasattr(err, 'reason') >>> err.reason 'something bad happened' + >>> assert hasattr(err, 'hdrs') + >>> err.hdrs + 'Content-Length: 42' + >>> expected_errmsg = 'HTTP Error %s: %s' % (err.code, err.msg) + >>> assert str(err) == expected_errmsg """ def test_HTTPError_interface_call(self): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 00:49:29 2013 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 20 Mar 2013 00:49:29 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2317471_-_merge_from_3=2E2?= Message-ID: <3ZVrZx73XdzR52@mail.python.org> http://hg.python.org/cpython/rev/8e9cf147fbca changeset: 82809:8e9cf147fbca branch: 3.3 parent: 82805:152e2d009098 parent: 82808:ae9aea1b3546 user: Senthil Kumaran date: Tue Mar 19 16:46:34 2013 -0700 summary: #17471 - merge from 3.2 files: Lib/test/test_urllib2.py | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -1504,11 +1504,17 @@ interface even though HTTPError is a subclass of URLError. >>> msg = 'something bad happened' - >>> url = code = hdrs = fp = None + >>> url = code = fp = None + >>> hdrs = 'Content-Length: 42' >>> err = urllib.error.HTTPError(url, code, msg, hdrs, fp) >>> assert hasattr(err, 'reason') >>> err.reason 'something bad happened' + >>> assert hasattr(err, 'hdrs') + >>> err.hdrs + 'Content-Length: 42' + >>> expected_errmsg = 'HTTP Error %s: %s' % (err.code, err.msg) + >>> assert str(err) == expected_errmsg """ def test_HTTPError_interface_call(self): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 00:49:31 2013 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 20 Mar 2013 00:49:31 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_=2317471=3A_merge_from_3=2E3?= Message-ID: <3ZVrZz2lVGzSDF@mail.python.org> http://hg.python.org/cpython/rev/64183c2aa05e changeset: 82810:64183c2aa05e parent: 82807:612d8bbcfa3a parent: 82809:8e9cf147fbca user: Senthil Kumaran date: Tue Mar 19 16:52:06 2013 -0700 summary: #17471: merge from 3.3 files: Lib/test/test_urllib2.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -1461,6 +1461,8 @@ >>> assert hasattr(err, 'headers') >>> err.headers 'Content-Length: 42' + >>> expected_errmsg = 'HTTP Error %s: %s' % (err.code, err.msg) + >>> assert str(err) == expected_errmsg """ class RequestTests(unittest.TestCase): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 01:22:58 2013 From: python-checkins at python.org (michael.foord) Date: Wed, 20 Mar 2013 01:22:58 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Closes_issue_17467=2E_Add_?= =?utf-8?q?readline_and_readlines_support_to?= Message-ID: <3ZVsKZ6MKPzPF3@mail.python.org> http://hg.python.org/cpython/rev/684b75600fa9 changeset: 82811:684b75600fa9 user: Michael Foord date: Tue Mar 19 17:22:51 2013 -0700 summary: Closes issue 17467. Add readline and readlines support to unittest.mock.mock_open files: Doc/library/unittest.mock.rst | 8 +- Lib/unittest/mock.py | 55 ++++++++- Lib/unittest/test/testmock/testwith.py | 83 ++++++++++++++ Misc/NEWS | 3 + 4 files changed, 141 insertions(+), 8 deletions(-) diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -1989,8 +1989,12 @@ default) then a `MagicMock` will be created for you, with the API limited to methods or attributes available on standard file handles. - `read_data` is a string for the `read` method of the file handle to return. - This is an empty string by default. + `read_data` is a string for the `read`, `readline`, and `readlines` methods + of the file handle to return. Calls to those methods will take data from + `read_data` until it is depleted. The mock of these methods is pretty + simplistic. If you need more control over the data that you are feeding to + the tested code you will need to customize this mock for yourself. + `read_data` is an empty string by default. Using `open` as a context manager is a great way to ensure your file handles are closed properly and is becoming common:: diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -934,8 +934,6 @@ return result ret_val = effect(*args, **kwargs) - if ret_val is DEFAULT: - ret_val = self.return_value if (self._mock_wraps is not None and self._mock_return_value is DEFAULT): @@ -2207,6 +2205,24 @@ file_spec = None +def _iterate_read_data(read_data): + # Helper for mock_open: + # Retrieve lines from read_data via a generator so that separate calls to + # readline, read, and readlines are properly interleaved + data_as_list = ['{}\n'.format(l) for l in read_data.split('\n')] + + if data_as_list[-1] == '\n': + # If the last line ended in a newline, the list comprehension will have an + # extra entry that's just a newline. Remove this. + data_as_list = data_as_list[:-1] + else: + # If there wasn't an extra newline by itself, then the file being + # emulated doesn't have a newline to end the last line remove the + # newline that our naive format() added + data_as_list[-1] = data_as_list[-1][:-1] + + for line in data_as_list: + yield line def mock_open(mock=None, read_data=''): """ @@ -2217,9 +2233,27 @@ default) then a `MagicMock` will be created for you, with the API limited to methods or attributes available on standard file handles. - `read_data` is a string for the `read` method of the file handle to return. - This is an empty string by default. + `read_data` is a string for the `read` methoddline`, and `readlines` of the + file handle to return. This is an empty string by default. """ + def _readlines_side_effect(*args, **kwargs): + if handle.readlines.return_value is not None: + return handle.readlines.return_value + return list(_data) + + def _read_side_effect(*args, **kwargs): + if handle.read.return_value is not None: + return handle.read.return_value + return ''.join(_data) + + def _readline_side_effect(): + if handle.readline.return_value is not None: + while True: + yield handle.readline.return_value + for line in _data: + yield line + + global file_spec if file_spec is None: import _io @@ -2229,9 +2263,18 @@ mock = MagicMock(name='open', spec=open) handle = MagicMock(spec=file_spec) + handle.__enter__.return_value = handle + + _data = _iterate_read_data(read_data) + handle.write.return_value = None - handle.__enter__.return_value = handle - handle.read.return_value = read_data + handle.read.return_value = None + handle.readline.return_value = None + handle.readlines.return_value = None + + handle.read.side_effect = _read_side_effect + handle.readline.side_effect = _readline_side_effect() + handle.readlines.side_effect = _readlines_side_effect mock.return_value = handle return mock diff --git a/Lib/unittest/test/testmock/testwith.py b/Lib/unittest/test/testmock/testwith.py --- a/Lib/unittest/test/testmock/testwith.py +++ b/Lib/unittest/test/testmock/testwith.py @@ -172,5 +172,88 @@ self.assertEqual(result, 'foo') + def test_readline_data(self): + # Check that readline will return all the lines from the fake file + mock = mock_open(read_data='foo\nbar\nbaz\n') + with patch('%s.open' % __name__, mock, create=True): + h = open('bar') + line1 = h.readline() + line2 = h.readline() + line3 = h.readline() + self.assertEqual(line1, 'foo\n') + self.assertEqual(line2, 'bar\n') + self.assertEqual(line3, 'baz\n') + + # Check that we properly emulate a file that doesn't end in a newline + mock = mock_open(read_data='foo') + with patch('%s.open' % __name__, mock, create=True): + h = open('bar') + result = h.readline() + self.assertEqual(result, 'foo') + + + def test_readlines_data(self): + # Test that emulating a file that ends in a newline character works + mock = mock_open(read_data='foo\nbar\nbaz\n') + with patch('%s.open' % __name__, mock, create=True): + h = open('bar') + result = h.readlines() + self.assertEqual(result, ['foo\n', 'bar\n', 'baz\n']) + + # Test that files without a final newline will also be correctly + # emulated + mock = mock_open(read_data='foo\nbar\nbaz') + with patch('%s.open' % __name__, mock, create=True): + h = open('bar') + result = h.readlines() + + self.assertEqual(result, ['foo\n', 'bar\n', 'baz']) + + + def test_mock_open_read_with_argument(self): + # At one point calling read with an argument was broken + # for mocks returned by mock_open + some_data = 'foo\nbar\nbaz' + mock = mock_open(read_data=some_data) + self.assertEqual(mock().read(10), some_data) + + + def test_interleaved_reads(self): + # Test that calling read, readline, and readlines pulls data + # sequentially from the data we preload with + mock = mock_open(read_data='foo\nbar\nbaz\n') + with patch('%s.open' % __name__, mock, create=True): + h = open('bar') + line1 = h.readline() + rest = h.readlines() + self.assertEqual(line1, 'foo\n') + self.assertEqual(rest, ['bar\n', 'baz\n']) + + mock = mock_open(read_data='foo\nbar\nbaz\n') + with patch('%s.open' % __name__, mock, create=True): + h = open('bar') + line1 = h.readline() + rest = h.read() + self.assertEqual(line1, 'foo\n') + self.assertEqual(rest, 'bar\nbaz\n') + + + def test_overriding_return_values(self): + mock = mock_open(read_data='foo') + handle = mock() + + handle.read.return_value = 'bar' + handle.readline.return_value = 'bar' + handle.readlines.return_value = ['bar'] + + self.assertEqual(handle.read(), 'bar') + self.assertEqual(handle.readline(), 'bar') + self.assertEqual(handle.readlines(), ['bar']) + + # call repeatedly to check that a StopIteration is not propagated + self.assertEqual(handle.readline(), 'bar') + self.assertEqual(handle.readline(), 'bar') + + if __name__ == '__main__': unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -289,6 +289,9 @@ Library ------- +- Issue #17467: add readline and readlines support to mock_open in + unittest.mock. + - Issue #17192: Update the ctypes module's libffi to v3.0.13. This specifically addresses a stack misalignment issue on x86 and issues on some more recent platforms. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 01:35:22 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 01:35:22 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyMDk4?= =?utf-8?q?_=3A_Fix_a_missing_import_in_the_unittests=2E?= Message-ID: <3ZVsbt5647zSJf@mail.python.org> http://hg.python.org/cpython/rev/b0b507268d7c changeset: 82812:b0b507268d7c branch: 2.7 parent: 82797:b2e8392a8f77 user: Kristj?n Valur J?nsson date: Tue Mar 19 17:30:30 2013 -0700 summary: Issue #12098 : Fix a missing import in the unittests. files: Lib/test/test_support.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -1344,6 +1344,7 @@ def args_from_interpreter_flags(): """Return a list of command-line arguments reproducing the current settings in sys.flags.""" + import subprocess return subprocess._args_from_interpreter_flags() def strip_python_stderr(stderr): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 01:40:32 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 01:40:32 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEwMjEx?= =?utf-8?q?_=3A_Buffer_object_should_support_the_new_buffer_interface=2E?= Message-ID: <3ZVsjr3W5xzPPY@mail.python.org> http://hg.python.org/cpython/rev/6b3217b96a77 changeset: 82813:6b3217b96a77 branch: 2.7 user: Kristj?n Valur J?nsson date: Tue Mar 19 16:50:51 2013 -0700 summary: Issue #10211 : Buffer object should support the new buffer interface. files: Lib/test/test_buffer.py | 8 ++++++++ Objects/bufferobject.c | 15 +++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py --- a/Lib/test/test_buffer.py +++ b/Lib/test/test_buffer.py @@ -21,6 +21,14 @@ self.assertEqual(b[start:stop:step], s[start:stop:step]) + def test_newbuffer_interface(self): + # Test that the buffer object has the new buffer interface + # as used by the memoryview object + s = "".join(chr(c) for c in list(range(255, -1, -1))) + b = buffer(s) + m = memoryview(b) # Should not raise an exception + self.assertEqual(m.tobytes(), s) + def test_main(): with test_support.check_py3k_warnings(("buffer.. not supported", diff --git a/Objects/bufferobject.c b/Objects/bufferobject.c --- a/Objects/bufferobject.c +++ b/Objects/bufferobject.c @@ -802,6 +802,16 @@ return size; } +static int buffer_getbuffer(PyBufferObject *self, Py_buffer *buf, int flags) +{ + void *ptr; + Py_ssize_t size; + if (!get_buf(self, &ptr, &size, ANY_BUFFER)) + return -1; + return PyBuffer_FillInfo(buf, (PyObject*)self, ptr, size, + self->b_readonly, flags); +} + static PySequenceMethods buffer_as_sequence = { (lenfunc)buffer_length, /*sq_length*/ (binaryfunc)buffer_concat, /*sq_concat*/ @@ -823,6 +833,7 @@ (writebufferproc)buffer_getwritebuf, (segcountproc)buffer_getsegcount, (charbufferproc)buffer_getcharbuf, + (getbufferproc)buffer_getbuffer, }; PyTypeObject PyBuffer_Type = { @@ -845,7 +856,7 @@ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ &buffer_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GETCHARBUFFER, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GETCHARBUFFER | Py_TPFLAGS_HAVE_NEWBUFFER, /* tp_flags */ buffer_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ @@ -864,4 +875,4 @@ 0, /* tp_init */ 0, /* tp_alloc */ buffer_new, /* tp_new */ -}; +}; \ No newline at end of file -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 01:40:34 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 01:40:34 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEwMjEy?= =?utf-8?q?=3A_Support_new_buffer_interface_for_struct=2Eunpack_and?= Message-ID: <3ZVsjt0Zq4zSDw@mail.python.org> http://hg.python.org/cpython/rev/be4bec689de3 changeset: 82814:be4bec689de3 branch: 2.7 user: Kristj?n Valur J?nsson date: Tue Mar 19 17:17:47 2013 -0700 summary: Issue #10212: Support new buffer interface for struct.unpack and cStringIO files: Lib/test/test_StringIO.py | 5 ++- Lib/test/test_struct.py | 11 +++++ Misc/NEWS | 4 ++ Modules/_struct.c | 29 ++++++++++----- Modules/cStringIO.c | 51 +++++++++++++------------- 5 files changed, 64 insertions(+), 36 deletions(-) diff --git a/Lib/test/test_StringIO.py b/Lib/test/test_StringIO.py --- a/Lib/test/test_StringIO.py +++ b/Lib/test/test_StringIO.py @@ -20,7 +20,6 @@ constructor = str def setUp(self): - self._line = self.constructor(self._line) self._lines = self.constructor((self._line + '\n') * 5) self._fp = self.MODULE.StringIO(self._lines) @@ -210,12 +209,16 @@ class TestBuffercStringIO(TestcStringIO): constructor = buffer +class TestMemoryviewcStringIO(TestcStringIO): + constructor = memoryview + def test_main(): test_support.run_unittest(TestStringIO, TestcStringIO) with test_support.check_py3k_warnings(("buffer.. not supported", DeprecationWarning)): test_support.run_unittest(TestBufferStringIO, TestBuffercStringIO) + test_support.run_unittest(TestMemoryviewcStringIO) if __name__ == '__main__': test_main() diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -496,6 +496,17 @@ self.test_unpack_from(cls=buffer) + def test_unpack_with_memoryview(self): + with check_py3k_warnings(("buffer.. not supported in 3.x", + DeprecationWarning)): + # SF bug 1563759: struct.unpack doesn't support buffer protocol objects + data1 = memoryview('\x12\x34\x56\x78') + for data in [data1,]: + value, = struct.unpack('>I', data) + self.assertEqual(value, 0x12345678) + + self.test_unpack_from(cls=memoryview) + def test_bool(self): class ExplodingBool(object): def __nonzero__(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,8 @@ Core and Builtins ----------------- +- Issue #10211: Buffer objects expose the new buffer interface internally + - Issue #16445: Fixed potential segmentation fault when deleting an exception message. @@ -214,6 +216,8 @@ Library ------- +- Issue #10212: cStringIO and struct.unpack support new buffer objects. + - Issue #12098: multiprocessing on Windows now starts child processes using the same sys.flags as the current process. Initial patch by Sergey Mezentsev. diff --git a/Modules/_struct.c b/Modules/_struct.c --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -1439,6 +1439,7 @@ static PyObject * s_unpack(PyObject *self, PyObject *inputstr) { + Py_buffer buf; char *start; Py_ssize_t len; PyObject *args=NULL, *result; @@ -1454,12 +1455,17 @@ args = PyTuple_Pack(1, inputstr); if (args == NULL) return NULL; - if (!PyArg_ParseTuple(args, "s#:unpack", &start, &len)) + if (!PyArg_ParseTuple(args, "s*:unpack", &buf)) goto fail; - if (soself->s_size != len) + start = buf.buf; + len = buf.len; + if (soself->s_size != len) { + PyBuffer_Release(&buf); goto fail; + } result = s_unpack_internal(soself, start); Py_DECREF(args); + PyBuffer_Release(&buf); return result; fail: @@ -1482,24 +1488,24 @@ s_unpack_from(PyObject *self, PyObject *args, PyObject *kwds) { static char *kwlist[] = {"buffer", "offset", 0}; -#if (PY_VERSION_HEX < 0x02050000) - static char *fmt = "z#|i:unpack_from"; -#else - static char *fmt = "z#|n:unpack_from"; -#endif + static char *fmt = "z*|n:unpack_from"; + Py_buffer buf; Py_ssize_t buffer_len = 0, offset = 0; char *buffer = NULL; PyStructObject *soself = (PyStructObject *)self; + PyObject *result; assert(PyStruct_Check(self)); assert(soself->s_codes != NULL); if (!PyArg_ParseTupleAndKeywords(args, kwds, fmt, kwlist, - &buffer, &buffer_len, &offset)) + &buf, &offset)) return NULL; - + buffer = buf.buf; + buffer_len = buf.len; if (buffer == NULL) { PyErr_Format(StructError, "unpack_from requires a buffer argument"); + PyBuffer_Release(&buf); return NULL; } @@ -1510,9 +1516,12 @@ PyErr_Format(StructError, "unpack_from requires a buffer of at least %zd bytes", soself->s_size); + PyBuffer_Release(&buf); return NULL; } - return s_unpack_internal(soself, buffer + offset); + result = s_unpack_internal(soself, buffer + offset); + PyBuffer_Release(&buf); + return result; } diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c --- a/Modules/cStringIO.c +++ b/Modules/cStringIO.c @@ -66,9 +66,7 @@ PyObject_HEAD char *buf; Py_ssize_t pos, string_size; - /* We store a reference to the object here in order to keep - the buffer alive during the lifetime of the Iobject. */ - PyObject *pbuf; + Py_buffer pbuf; } Iobject; /* IOobject (common) methods */ @@ -448,12 +446,14 @@ static PyObject * O_write(Oobject *self, PyObject *args) { - char *c; - int l; + Py_buffer buf; + int result; - if (!PyArg_ParseTuple(args, "t#:write", &c, &l)) return NULL; + if (!PyArg_ParseTuple(args, "s*:write", &buf)) return NULL; - if (O_cwrite((PyObject*)self,c,l) < 0) return NULL; + result = O_cwrite((PyObject*)self, buf.buf, buf.len); + PyBuffer_Release(&buf); + if (result < 0) return NULL; Py_INCREF(Py_None); return Py_None; @@ -606,7 +606,7 @@ static PyObject * I_close(Iobject *self, PyObject *unused) { - Py_CLEAR(self->pbuf); + PyBuffer_Release(&self->pbuf); self->buf = NULL; self->pos = self->string_size = 0; @@ -635,7 +635,7 @@ static void I_dealloc(Iobject *self) { - Py_XDECREF(self->pbuf); + PyBuffer_Release(&self->pbuf); PyObject_Del(self); } @@ -680,25 +680,26 @@ static PyObject * newIobject(PyObject *s) { Iobject *self; - char *buf; - Py_ssize_t size; + Py_buffer buf; + PyObject *args; + int result; - if (PyUnicode_Check(s)) { - if (PyObject_AsCharBuffer(s, (const char **)&buf, &size) != 0) + args = Py_BuildValue("(O)", s); + if (args == NULL) + return NULL; + result = PyArg_ParseTuple(args, "s*:StringIO", &buf); + Py_DECREF(args); + if (!result) + return NULL; + + self = PyObject_New(Iobject, &Itype); + if (!self) { + PyBuffer_Release(&buf); return NULL; } - else if (PyObject_AsReadBuffer(s, (const void **)&buf, &size)) { - PyErr_Format(PyExc_TypeError, "expected read buffer, %.200s found", - s->ob_type->tp_name); - return NULL; - } - - self = PyObject_New(Iobject, &Itype); - if (!self) return NULL; - Py_INCREF(s); - self->buf=buf; - self->string_size=size; - self->pbuf=s; + self->buf=buf.buf; + self->string_size=buf.len; + self->pbuf=buf; self->pos=0; return (PyObject*)self; -- Repository URL: http://hg.python.org/cpython From ezio.melotti at gmail.com Wed Mar 20 02:31:05 2013 From: ezio.melotti at gmail.com (Ezio Melotti) Date: Wed, 20 Mar 2013 03:31:05 +0200 Subject: [Python-checkins] cpython: Issue #17385: Fix quadratic behavior in threading.Condition In-Reply-To: References: <3ZPLXL0jVYzS7C@mail.python.org> Message-ID: On Mon, Mar 11, 2013 at 3:14 AM, Ezio Melotti wrote: > Hi, > > On Mon, Mar 11, 2013 at 2:58 AM, raymond.hettinger > wrote: >> http://hg.python.org/cpython/rev/0f86b51f8f8b >> changeset: 82592:0f86b51f8f8b >> user: Raymond Hettinger >> date: Sun Mar 10 17:57:28 2013 -0700 >> summary: >> Issue #17385: Fix quadratic behavior in threading.Condition >> >> files: >> Lib/threading.py | 10 ++++++++-- >> Misc/NEWS | 3 +++ >> 2 files changed, 11 insertions(+), 2 deletions(-) >> >> >> diff --git a/Lib/threading.py b/Lib/threading.py >> --- a/Lib/threading.py >> +++ b/Lib/threading.py >> @@ -10,6 +10,12 @@ >> from time import time as _time >> from traceback import format_exc as _format_exc >> from _weakrefset import WeakSet >> +try: >> + from _itertools import islice as _slice >> + from _collections import deque as _deque >> +except ImportError: >> + from itertools import islice as _islice >> + from collections import deque as _deque >> > > Shouldn't the one in the 'try' be _islice too? > Also I don't seem to have an _itertools module. Is this something used by the other VMs? > Best Regards, > Ezio Melotti From python-checkins at python.org Wed Mar 20 03:42:04 2013 From: python-checkins at python.org (r.david.murray) Date: Wed, 20 Mar 2013 03:42:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=2315927=3A_Fix_cvs=2Eread?= =?utf-8?q?er_parsing_of_escaped_=5Cr=5Cn_with_quoting_off=2E?= Message-ID: <3ZVwQ43t3lzSHt@mail.python.org> http://hg.python.org/cpython/rev/940748853712 changeset: 82815:940748853712 parent: 82811:684b75600fa9 user: R David Murray date: Tue Mar 19 22:41:47 2013 -0400 summary: #15927: Fix cvs.reader parsing of escaped \r\n with quoting off. This fix means that such values are correctly roundtripped, since cvs.writer already does the correct escaping. Patch by Michael Johnson. files: Lib/test/test_csv.py | 9 +++++++++ Misc/ACKS | 1 + Misc/NEWS | 3 +++ Modules/_csv.c | 13 ++++++++++++- 4 files changed, 25 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py --- a/Lib/test/test_csv.py +++ b/Lib/test/test_csv.py @@ -308,6 +308,15 @@ for i, row in enumerate(csv.reader(fileobj)): self.assertEqual(row, rows[i]) + def test_roundtrip_escaped_unquoted_newlines(self): + with TemporaryFile("w+", newline='') as fileobj: + writer = csv.writer(fileobj,quoting=csv.QUOTE_NONE,escapechar="\\") + rows = [['a\nb','b'],['c','x\r\nd']] + writer.writerows(rows) + fileobj.seek(0) + for i, row in enumerate(csv.reader(fileobj,quoting=csv.QUOTE_NONE,escapechar="\\")): + self.assertEqual(row,rows[i]) + class TestDialectRegistry(unittest.TestCase): def test_registry_badargs(self): self.assertRaises(TypeError, csv.list_dialects, None) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -591,6 +591,7 @@ Fredrik Johansson Gregory K. Johnson Kent Johnson +Michael Johnson Simon Johnston Matt Joiner Thomas Jollans diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -289,6 +289,9 @@ Library ------- +- Issue #15927: CVS now correctly parses escaped newlines and carriage + when parsing with quoting turned off. + - Issue #17467: add readline and readlines support to mock_open in unittest.mock. diff --git a/Modules/_csv.c b/Modules/_csv.c --- a/Modules/_csv.c +++ b/Modules/_csv.c @@ -51,7 +51,7 @@ typedef enum { START_RECORD, START_FIELD, ESCAPED_CHAR, IN_FIELD, IN_QUOTED_FIELD, ESCAPE_IN_QUOTED_FIELD, QUOTE_IN_QUOTED_FIELD, - EAT_CRNL + EAT_CRNL,AFTER_ESCAPED_CRNL } ParserState; typedef enum { @@ -644,6 +644,12 @@ break; case ESCAPED_CHAR: + if (c == '\n' | c=='\r') { + if (parse_add_char(self, c) < 0) + return -1; + self->state = AFTER_ESCAPED_CRNL; + break; + } if (c == '\0') c = '\n'; if (parse_add_char(self, c) < 0) @@ -651,6 +657,11 @@ self->state = IN_FIELD; break; + case AFTER_ESCAPED_CRNL: + if (c == '\0') + break; + /*fallthru*/ + case IN_FIELD: /* in unquoted field */ if (c == '\n' || c == '\r' || c == '\0') { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 04:01:16 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 04:01:16 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2316475=3A_Support_?= =?utf-8?q?object_instancing=2C_recursion_and_interned_strings?= Message-ID: <3ZVwrD1hJyzS3x@mail.python.org> http://hg.python.org/cpython/rev/01372117a5b4 changeset: 82816:01372117a5b4 user: Kristj?n Valur J?nsson date: Tue Mar 19 18:02:10 2013 -0700 summary: Issue #16475: Support object instancing, recursion and interned strings in marshal files: Doc/library/marshal.rst | 9 +- Include/marshal.h | 2 +- Lib/test/test_marshal.py | 122 ++++++++++++- Misc/NEWS | 3 + Python/marshal.c | 272 ++++++++++++++++++++++++-- 5 files changed, 376 insertions(+), 32 deletions(-) diff --git a/Doc/library/marshal.rst b/Doc/library/marshal.rst --- a/Doc/library/marshal.rst +++ b/Doc/library/marshal.rst @@ -40,10 +40,11 @@ point numbers, complex numbers, strings, bytes, bytearrays, tuples, lists, sets, frozensets, dictionaries, and code objects, where it should be understood that tuples, lists, sets, frozensets and dictionaries are only supported as long as -the values contained therein are themselves supported; and recursive lists, sets -and dictionaries should not be written (they will cause infinite loops). The +the values contained therein are themselves supported. singletons :const:`None`, :const:`Ellipsis` and :exc:`StopIteration` can also be marshalled and unmarshalled. +For format *version* lower than 3, recursive lists, sets and dictionaries cannot +be written (see below). There are functions that read/write files as well as functions operating on strings. @@ -103,7 +104,9 @@ Indicates the format that the module uses. Version 0 is the historical format, version 1 shares interned strings and version 2 uses a binary format - for floating point numbers. The current version is 2. + for floating point numbers. + Version 3 adds support for object instancing and recursion. + The current version is 3. .. rubric:: Footnotes diff --git a/Include/marshal.h b/Include/marshal.h --- a/Include/marshal.h +++ b/Include/marshal.h @@ -7,7 +7,7 @@ extern "C" { #endif -#define Py_MARSHAL_VERSION 2 +#define Py_MARSHAL_VERSION 3 PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int); PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int); diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py --- a/Lib/test/test_marshal.py +++ b/Lib/test/test_marshal.py @@ -200,8 +200,12 @@ except Exception: pass + def test_loads_2x_code(self): + s = b'c' + (b'X' * 4*4) + b'{' * 2**20 + self.assertRaises(ValueError, marshal.loads, s) + def test_loads_recursion(self): - s = b'c' + (b'X' * 4*4) + b'{' * 2**20 + s = b'c' + (b'X' * 4*5) + b'{' * 2**20 self.assertRaises(ValueError, marshal.loads, s) def test_recursion_limit(self): @@ -323,6 +327,122 @@ def test_bytearray(self, size): self.check_unmarshallable(bytearray(size)) +def CollectObjectIDs(ids, obj): + """Collect object ids seen in a structure""" + if id(obj) in ids: + return + ids.add(id(obj)) + if isinstance(obj, (list, tuple, set, frozenset)): + for e in obj: + CollectObjectIDs(ids, e) + elif isinstance(obj, dict): + for k, v in obj.items(): + CollectObjectIDs(ids, k) + CollectObjectIDs(ids, v) + return len(ids) + +class InstancingTestCase(unittest.TestCase, HelperMixin): + intobj = 123321 + floatobj = 1.2345 + strobj = "abcde"*3 + dictobj = {"hello":floatobj, "goodbye":floatobj, floatobj:"hello"} + + def helper3(self, rsample, recursive=False, simple=False): + #we have two instances + sample = (rsample, rsample) + + n0 = CollectObjectIDs(set(), sample) + + s3 = marshal.dumps(sample, 3) + n3 = CollectObjectIDs(set(), marshal.loads(s3)) + + #same number of instances generated + self.assertEqual(n3, n0) + + if not recursive: + #can compare with version 2 + s2 = marshal.dumps(sample, 2) + n2 = CollectObjectIDs(set(), marshal.loads(s2)) + #old format generated more instances + self.assertGreater(n2, n0) + + #if complex objects are in there, old format is larger + if not simple: + self.assertGreater(len(s2), len(s3)) + else: + self.assertGreaterEqual(len(s2), len(s3)) + + def testInt(self): + self.helper(self.intobj) + self.helper3(self.intobj, simple=True) + + def testFloat(self): + self.helper(self.floatobj) + self.helper3(self.floatobj) + + def testStr(self): + self.helper(self.strobj) + self.helper3(self.strobj) + + def testDict(self): + self.helper(self.dictobj) + self.helper3(self.dictobj) + + def testModule(self): + with open(__file__, "rb") as f: + code = f.read() + if __file__.endswith(".py"): + code = compile(code, __file__, "exec") + self.helper(code) + self.helper3(code) + + def testRecursion(self): + d = dict(self.dictobj) + d["self"] = d + self.helper3(d, recursive=True) + l = [self.dictobj] + l.append(l) + self.helper3(l, recursive=True) + +class CompatibilityTestCase(unittest.TestCase): + def _test(self, version): + with open(__file__, "rb") as f: + code = f.read() + if __file__.endswith(".py"): + code = compile(code, __file__, "exec") + data = marshal.dumps(code, version) + marshal.loads(data) + + def test0To3(self): + self._test(0) + + def test1To3(self): + self._test(1) + + def test2To3(self): + self._test(2) + + def test3To3(self): + self._test(3) + +class InterningTestCase(unittest.TestCase, HelperMixin): + strobj = "this is an interned string" + strobj = sys.intern(strobj) + + def testIntern(self): + s = marshal.loads(marshal.dumps(self.strobj)) + self.assertEqual(s, self.strobj) + self.assertEqual(id(s), id(self.strobj)) + s2 = sys.intern(s) + self.assertEqual(id(s2), id(s)) + + def testNoIntern(self): + s = marshal.loads(marshal.dumps(self.strobj, 2)) + self.assertEqual(s, self.strobj) + self.assertNotEqual(id(s), id(self.strobj)) + s2 = sys.intern(s) + self.assertNotEqual(id(s2), id(s)) + def test_main(): support.run_unittest(IntTestCase, diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #16475: Support object instancing, recursion and interned strings + in marshal + - Use the HTTPS PyPI url for upload, overriding any plain HTTP URL in pypirc. - Issue #16795: On the ast.arguments object, unify vararg with varargannotation diff --git a/Python/marshal.c b/Python/marshal.c --- a/Python/marshal.c +++ b/Python/marshal.c @@ -1,8 +1,10 @@ /* Write Python objects to files and read them back. - This is intended for writing and reading compiled Python code only; - a true persistent storage facility would be much harder, since - it would have to take circular links and sharing into account. */ + This is primarily intended for writing and reading compiled Python code, + even though dicts, lists, sets and frozensets, not commonly seen in + code objects, are supported. + Version 3 of this protocol properly supports circular links + and sharing. */ #define PY_SSIZE_T_CLEAN @@ -41,6 +43,8 @@ #define TYPE_BINARY_COMPLEX 'y' #define TYPE_LONG 'l' #define TYPE_STRING 's' +#define TYPE_INTERNED 't' +#define TYPE_REF 'r' #define TYPE_TUPLE '(' #define TYPE_LIST '[' #define TYPE_DICT '{' @@ -49,6 +53,7 @@ #define TYPE_UNKNOWN '?' #define TYPE_SET '<' #define TYPE_FROZENSET '>' +#define FLAG_REF '\x80' /* with a type, add obj to index */ #define WFERR_OK 0 #define WFERR_UNMARSHALLABLE 1 @@ -65,6 +70,7 @@ PyObject *current_filename; char *ptr; char *end; + PyObject *refs; /* dict on marshal, list on unmarshal */ int version; } WFILE; @@ -151,13 +157,17 @@ #endif #define PyLong_MARSHAL_RATIO (PyLong_SHIFT / PyLong_MARSHAL_SHIFT) +#define W_TYPE(t, p) do { \ + w_byte((t) | flag, (p)); \ +} while(0) + static void -w_PyLong(const PyLongObject *ob, WFILE *p) +w_PyLong(const PyLongObject *ob, char flag, WFILE *p) { Py_ssize_t i, j, n, l; digit d; - w_byte(TYPE_LONG, p); + W_TYPE(TYPE_LONG, p); if (Py_SIZE(ob) == 0) { w_long((long)0, p); return; @@ -194,10 +204,64 @@ } while (d != 0); } +static int +w_ref(PyObject *v, char *flag, WFILE *p) +{ + PyObject *id; + PyObject *idx; + + if (p->version < 3 || p->refs == NULL) + return 0; /* not writing object references */ + + /* if it has only one reference, it definitely isn't shared */ + if (Py_REFCNT(v) == 1) + return 0; + + id = PyLong_FromVoidPtr((void*)v); + if (id == NULL) + goto err; + idx = PyDict_GetItem(p->refs, id); + if (idx != NULL) { + /* write the reference index to the stream */ + long w = PyLong_AsLong(idx); + Py_DECREF(id); + if (w == -1 && PyErr_Occurred()) { + goto err; + } + /* we don't store "long" indices in the dict */ + assert(0 <= w && w <= 0x7fffffff); + w_byte(TYPE_REF, p); + w_long(w, p); + return 1; + } else { + int ok; + Py_ssize_t s = PyDict_Size(p->refs); + /* we don't support long indices */ + if (s >= 0x7fffffff) { + PyErr_SetString(PyExc_ValueError, "too many objects"); + goto err; + } + idx = PyLong_FromSsize_t(s); + ok = idx && PyDict_SetItem(p->refs, id, idx) == 0; + Py_DECREF(id); + Py_XDECREF(idx); + if (!ok) + goto err; + *flag |= FLAG_REF; + return 0; + } +err: + p->error = WFERR_UNMARSHALLABLE; + return 1; +} + +static void +w_complex_object(PyObject *v, char flag, WFILE *p); + static void w_object(PyObject *v, WFILE *p) { - Py_ssize_t i, n; + char flag = '\0'; p->depth++; @@ -222,24 +286,35 @@ else if (v == Py_True) { w_byte(TYPE_TRUE, p); } - else if (PyLong_CheckExact(v)) { + else if (!w_ref(v, &flag, p)) + w_complex_object(v, flag, p); + + p->depth--; +} + +static void +w_complex_object(PyObject *v, char flag, WFILE *p) +{ + Py_ssize_t i, n; + + if (PyLong_CheckExact(v)) { long x = PyLong_AsLong(v); if ((x == -1) && PyErr_Occurred()) { PyLongObject *ob = (PyLongObject *)v; PyErr_Clear(); - w_PyLong(ob, p); + w_PyLong(ob, flag, p); } else { #if SIZEOF_LONG > 4 long y = Py_ARITHMETIC_RIGHT_SHIFT(long, x, 31); if (y && y != -1) { /* Too large for TYPE_INT */ - w_PyLong((PyLongObject*)v, p); + w_PyLong((PyLongObject*)v, flag, p); } else #endif { - w_byte(TYPE_INT, p); + W_TYPE(TYPE_INT, p); w_long(x, p); } } @@ -252,7 +327,7 @@ p->error = WFERR_UNMARSHALLABLE; return; } - w_byte(TYPE_BINARY_FLOAT, p); + W_TYPE(TYPE_BINARY_FLOAT, p); w_string((char*)buf, 8, p); } else { @@ -263,7 +338,7 @@ return; } n = strlen(buf); - w_byte(TYPE_FLOAT, p); + W_TYPE(TYPE_FLOAT, p); w_byte((int)n, p); w_string(buf, n, p); PyMem_Free(buf); @@ -277,7 +352,7 @@ p->error = WFERR_UNMARSHALLABLE; return; } - w_byte(TYPE_BINARY_COMPLEX, p); + W_TYPE(TYPE_BINARY_COMPLEX, p); w_string((char*)buf, 8, p); if (_PyFloat_Pack8(PyComplex_ImagAsDouble(v), buf, 1) < 0) { @@ -288,7 +363,7 @@ } else { char *buf; - w_byte(TYPE_COMPLEX, p); + W_TYPE(TYPE_COMPLEX, p); buf = PyOS_double_to_string(PyComplex_RealAsDouble(v), 'g', 17, 0, NULL); if (!buf) { @@ -312,7 +387,7 @@ } } else if (PyBytes_CheckExact(v)) { - w_byte(TYPE_STRING, p); + W_TYPE(TYPE_STRING, p); n = PyBytes_GET_SIZE(v); W_SIZE(n, p); w_string(PyBytes_AS_STRING(v), n, p); @@ -325,14 +400,17 @@ p->error = WFERR_UNMARSHALLABLE; return; } - w_byte(TYPE_UNICODE, p); + if (p->version >= 3 && PyUnicode_CHECK_INTERNED(v)) + W_TYPE(TYPE_INTERNED, p); + else + W_TYPE(TYPE_UNICODE, p); n = PyBytes_GET_SIZE(utf8); W_SIZE(n, p); w_string(PyBytes_AS_STRING(utf8), n, p); Py_DECREF(utf8); } else if (PyTuple_CheckExact(v)) { - w_byte(TYPE_TUPLE, p); + W_TYPE(TYPE_TUPLE, p); n = PyTuple_Size(v); W_SIZE(n, p); for (i = 0; i < n; i++) { @@ -340,7 +418,7 @@ } } else if (PyList_CheckExact(v)) { - w_byte(TYPE_LIST, p); + W_TYPE(TYPE_LIST, p); n = PyList_GET_SIZE(v); W_SIZE(n, p); for (i = 0; i < n; i++) { @@ -350,7 +428,7 @@ else if (PyDict_CheckExact(v)) { Py_ssize_t pos; PyObject *key, *value; - w_byte(TYPE_DICT, p); + W_TYPE(TYPE_DICT, p); /* This one is NULL object terminated! */ pos = 0; while (PyDict_Next(v, &pos, &key, &value)) { @@ -363,9 +441,9 @@ PyObject *value, *it; if (PyObject_TypeCheck(v, &PySet_Type)) - w_byte(TYPE_SET, p); + W_TYPE(TYPE_SET, p); else - w_byte(TYPE_FROZENSET, p); + W_TYPE(TYPE_FROZENSET, p); n = PyObject_Size(v); if (n == -1) { p->depth--; @@ -392,7 +470,7 @@ } else if (PyCode_Check(v)) { PyCodeObject *co = (PyCodeObject *)v; - w_byte(TYPE_CODE, p); + W_TYPE(TYPE_CODE, p); w_long(co->co_argcount, p); w_long(co->co_kwonlyargcount, p); w_long(co->co_nlocals, p); @@ -419,7 +497,7 @@ p->error = WFERR_UNMARSHALLABLE; return; } - w_byte(TYPE_STRING, p); + W_TYPE(TYPE_STRING, p); n = view.len; s = view.buf; W_SIZE(n, p); @@ -427,10 +505,9 @@ PyBuffer_Release(&view); } else { - w_byte(TYPE_UNKNOWN, p); + W_TYPE(TYPE_UNKNOWN, p); p->error = WFERR_UNMARSHALLABLE; } - p->depth--; } /* version currently has no effect for writing longs. */ @@ -441,6 +518,7 @@ wf.fp = fp; wf.error = WFERR_OK; wf.depth = 0; + wf.refs = NULL; wf.version = version; w_long(x, &wf); } @@ -452,8 +530,14 @@ wf.fp = fp; wf.error = WFERR_OK; wf.depth = 0; + if (version >= 3) { + if ((wf.refs = PyDict_New()) == NULL) + return; /* caller mush check PyErr_Occurred() */ + } else + wf.refs = NULL; wf.version = version; w_object(x, &wf); + Py_XDECREF(wf.refs); } typedef WFILE RFILE; /* Same struct with different invariants */ @@ -489,7 +573,7 @@ data->ob_type->tp_name); } else { - read = PyBytes_GET_SIZE(data); + read = (int)PyBytes_GET_SIZE(data); if (read > 0) { ptr = PyBytes_AS_STRING(data); memcpy(s, ptr, read); @@ -659,6 +743,59 @@ return NULL; } +/* allocate the reflist index */ +static PyObject * +r_ref_reserve(PyObject *o, Py_ssize_t *idx, int flag, RFILE *p) +{ + if (flag) { /* currently only FLAG_REF is defined */ + *idx = PyList_Size(p->refs); + if (*idx < 0) + goto err; + if (*idx >= 0x7ffffffe) { + PyErr_SetString(PyExc_ValueError, "bad marshal data (index list too large)"); + goto err; + } + if (PyList_Append(p->refs, Py_None) < 0) + goto err; + } else + *idx = 0; + return o; +err: + Py_XDECREF(o); /* release the new object */ + *idx = -1; + return NULL; +} + +/* insert actual object to the reflist */ +static PyObject * +r_ref_insert(PyObject *o, Py_ssize_t idx, int flag, RFILE *p) +{ + if (o && (flag & FLAG_REF)) { + if (PyList_SetItem(p->refs, idx, o) < 0) { + Py_DECREF(o); /* release the new object */ + return NULL; + } else { + Py_INCREF(o); /* a reference for the list */ + } + } + return o; +} + +/* combination of both above, used when an object can be + * created whenever it is seen in the file, as opposed to + * after having loaded its sub-objects. + */ +static PyObject * +r_ref(PyObject *o, int flag, RFILE *p) +{ + if (o && (flag & FLAG_REF)) { + if (PyList_Append(p->refs, o) < 0) { + Py_DECREF(o); /* release the new object */ + return NULL; + } + } + return o; +} static PyObject * r_object(RFILE *p) @@ -666,8 +803,10 @@ /* NULL is a valid return value, it does not necessarily means that an exception is set. */ PyObject *v, *v2; + Py_ssize_t idx; long i, n; int type = r_byte(p); + int flag; PyObject *retval; p->depth++; @@ -678,6 +817,13 @@ return NULL; } + flag = type & FLAG_REF; + type = type & ~FLAG_REF; + +#define R_REF(O) do{\ + O = r_ref(O, flag, p);\ +} while (0) + switch (type) { case EOF: @@ -718,14 +864,17 @@ case TYPE_INT: n = r_long(p); retval = PyErr_Occurred() ? NULL : PyLong_FromLong(n); + R_REF(retval); break; case TYPE_INT64: retval = r_long64(p); + R_REF(retval); break; case TYPE_LONG: retval = r_PyLong(p); + R_REF(retval); break; case TYPE_FLOAT: @@ -744,6 +893,7 @@ if (dx == -1.0 && PyErr_Occurred()) break; retval = PyFloat_FromDouble(dx); + R_REF(retval); break; } @@ -763,6 +913,7 @@ break; } retval = PyFloat_FromDouble(x); + R_REF(retval); break; } @@ -792,6 +943,7 @@ if (c.imag == -1.0 && PyErr_Occurred()) break; retval = PyComplex_FromCComplex(c); + R_REF(retval); break; } @@ -822,6 +974,7 @@ break; } retval = PyComplex_FromCComplex(c); + R_REF(retval); break; } @@ -849,9 +1002,11 @@ break; } retval = v; + R_REF(retval); break; case TYPE_UNICODE: + case TYPE_INTERNED: { char *buffer; @@ -879,7 +1034,10 @@ } v = PyUnicode_DecodeUTF8(buffer, n, "surrogatepass"); PyMem_DEL(buffer); + if (type == TYPE_INTERNED) + PyUnicode_InternInPlace(&v); retval = v; + R_REF(retval); break; } @@ -895,6 +1053,7 @@ break; } v = PyTuple_New(n); + R_REF(v); if (v == NULL) { retval = NULL; break; @@ -926,6 +1085,7 @@ break; } v = PyList_New(n); + R_REF(v); if (v == NULL) { retval = NULL; break; @@ -947,6 +1107,7 @@ case TYPE_DICT: v = PyDict_New(); + R_REF(v); if (v == NULL) { retval = NULL; break; @@ -982,6 +1143,13 @@ break; } v = (type == TYPE_SET) ? PySet_New(NULL) : PyFrozenSet_New(NULL); + /* must use delayed registration of frozensets because they must + * be init with a refcount of 1 + */ + if (type == TYPE_SET) + R_REF(v); + else + v = r_ref_reserve(v, &idx, flag, p); if (v == NULL) { retval = NULL; break; @@ -1004,6 +1172,8 @@ } Py_DECREF(v2); } + if (type != TYPE_SET) + v = r_ref_insert(v, idx, flag, p); retval = v; break; @@ -1024,6 +1194,12 @@ PyObject *name = NULL; int firstlineno; PyObject *lnotab = NULL; + + r_ref_reserve(NULL, &idx, flag, p); + if (idx < 0) { + retval = NULL; + break; + } v = NULL; @@ -1090,6 +1266,7 @@ code, consts, names, varnames, freevars, cellvars, filename, name, firstlineno, lnotab); + v = r_ref_insert(v, idx, flag, p); code_error: Py_XDECREF(code); @@ -1105,6 +1282,23 @@ retval = v; break; + case TYPE_REF: + n = r_long(p); + if (n < 0 || n >= PyList_GET_SIZE(p->refs)) { + PyErr_SetString(PyExc_ValueError, "bad marshal data (invalid reference)"); + retval = NULL; + break; + } + v = PyList_GET_ITEM(p->refs, n); + if (v == Py_None) { + PyErr_SetString(PyExc_ValueError, "bad marshal data (invalid reference)"); + retval = NULL; + break; + } + Py_INCREF(v); + retval = v; + break; + default: /* Bogus data got written, which isn't ideal. This will let you keep working and recover. */ @@ -1210,7 +1404,11 @@ rf.current_filename = NULL; rf.depth = 0; rf.ptr = rf.end = NULL; + rf.refs = PyList_New(0); + if (rf.refs == NULL) + return NULL; result = r_object(&rf); + Py_DECREF(rf.refs); return result; } @@ -1225,7 +1423,11 @@ rf.ptr = str; rf.end = str + len; rf.depth = 0; + rf.refs = PyList_New(0); + if (rf.refs == NULL) + return NULL; result = r_object(&rf); + Py_DECREF(rf.refs); return result; } @@ -1244,7 +1446,13 @@ wf.error = WFERR_OK; wf.depth = 0; wf.version = version; + if (version >= 3) { + if ((wf.refs = PyDict_New()) == NULL) + return NULL; + } else + wf.refs = NULL; w_object(x, &wf); + Py_XDECREF(wf.refs); if (wf.str != NULL) { char *base = PyBytes_AS_STRING((PyBytesObject *)wf.str); if (wf.ptr - base > PY_SSIZE_T_MAX) { @@ -1316,6 +1524,8 @@ * Make a call to the read method, but read zero bytes. * This is to ensure that the object passed in at least * has a read method which returns bytes. + * This can be removed if we guarantee good error handling + * for r_string() */ data = _PyObject_CallMethodId(f, &PyId_read, "i", 0); if (data == NULL) @@ -1331,7 +1541,11 @@ rf.fp = NULL; rf.readable = f; rf.current_filename = NULL; - result = read_object(&rf); + if ((rf.refs = PyList_New(0)) != NULL) { + result = read_object(&rf); + Py_DECREF(rf.refs); + } else + result = NULL; } Py_DECREF(data); return result; @@ -1388,8 +1602,11 @@ rf.ptr = s; rf.end = s + n; rf.depth = 0; + if ((rf.refs = PyList_New(0)) == NULL) + return NULL; result = read_object(&rf); PyBuffer_Release(&p); + Py_DECREF(rf.refs); return result; } @@ -1429,6 +1646,7 @@ version -- indicates the format that the module uses. Version 0 is the\n\ historical format, version 1 shares interned strings and version 2\n\ uses a binary format for floating point numbers.\n\ + Version 3 shares common object references (New in version 3.4).\n\ \n\ Functions:\n\ \n\ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 04:35:54 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 04:35:54 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2315038_=3A_Fixing_?= =?utf-8?q?the_condition_broadcast_and_docs=2E?= Message-ID: <3ZVxcB4hKjzSDw@mail.python.org> http://hg.python.org/cpython/rev/08b87dda6f6a changeset: 82817:08b87dda6f6a user: Kristj?n Valur J?nsson date: Tue Mar 19 20:18:37 2013 -0700 summary: Issue #15038 : Fixing the condition broadcast and docs. files: Python/condvar.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Python/condvar.h b/Python/condvar.h --- a/Python/condvar.h +++ b/Python/condvar.h @@ -163,10 +163,9 @@ Generic emulations of the pthread_cond_* API using earlier Win32 functions can be found on the Web. - The following read can be edificating (or not): + The following read can be give background information to these issues, + but the implementations are all broken in some way. http://www.cse.wustl.edu/~schmidt/win32-cv-1.html - - See also */ typedef CRITICAL_SECTION PyMUTEX_T; @@ -297,9 +296,10 @@ Py_LOCAL_INLINE(int) PyCOND_BROADCAST(PyCOND_T *cv) { - if (cv->waiting > 0) { - return ReleaseSemaphore(cv->sem, cv->waiting, NULL) ? 0 : -1; - cv->waiting = 0; + int waiting = cv->waiting; + if (waiting > 0) { + cv->waiting = 0; + return ReleaseSemaphore(cv->sem, waiting, NULL) ? 0 : -1; } return 0; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 04:35:56 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 04:35:56 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE1MDM4?= =?utf-8?q?_=3A_Fixing_the_condition_broadcast_and_docs=2E?= Message-ID: <3ZVxcD0JYXzSMj@mail.python.org> http://hg.python.org/cpython/rev/fde60d3f542e changeset: 82818:fde60d3f542e branch: 3.3 parent: 82809:8e9cf147fbca user: Kristj?n Valur J?nsson date: Tue Mar 19 20:18:37 2013 -0700 summary: Issue #15038 : Fixing the condition broadcast and docs. files: Python/condvar.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Python/condvar.h b/Python/condvar.h --- a/Python/condvar.h +++ b/Python/condvar.h @@ -163,10 +163,9 @@ Generic emulations of the pthread_cond_* API using earlier Win32 functions can be found on the Web. - The following read can be edificating (or not): + The following read can be give background information to these issues, + but the implementations are all broken in some way. http://www.cse.wustl.edu/~schmidt/win32-cv-1.html - - See also */ typedef CRITICAL_SECTION PyMUTEX_T; @@ -297,9 +296,10 @@ Py_LOCAL_INLINE(int) PyCOND_BROADCAST(PyCOND_T *cv) { - if (cv->waiting > 0) { - return ReleaseSemaphore(cv->sem, cv->waiting, NULL) ? 0 : -1; - cv->waiting = 0; + int waiting = cv->waiting; + if (waiting > 0) { + cv->waiting = 0; + return ReleaseSemaphore(cv->sem, waiting, NULL) ? 0 : -1; } return 0; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 04:35:57 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 04:35:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E3?= Message-ID: <3ZVxcF35l8zSLq@mail.python.org> http://hg.python.org/cpython/rev/c6af0b3de726 changeset: 82819:c6af0b3de726 parent: 82817:08b87dda6f6a parent: 82818:fde60d3f542e user: Kristj?n Valur J?nsson date: Tue Mar 19 20:26:39 2013 -0700 summary: Merge with 3.3 files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 05:15:41 2013 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 20 Mar 2013 05:15:41 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_update_2=2E7=2E4_release_date?= =?utf-8?q?s?= Message-ID: <3ZVyV50rrYzSFs@mail.python.org> http://hg.python.org/peps/rev/ce17779c395c changeset: 4810:ce17779c395c user: Benjamin Peterson date: Tue Mar 19 23:15:23 2013 -0500 summary: update 2.7.4 release dates files: pep-0373.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pep-0373.txt b/pep-0373.txt --- a/pep-0373.txt +++ b/pep-0373.txt @@ -56,8 +56,8 @@ Planned future release dates: -- 2.7.4rc1 2013-02-02 -- 2.7.4 2012-02-16 +- 2.7.4rc1 2013-03-23 +- 2.7.4 2012-04-06 Dates of previous maintenance releases: -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Wed Mar 20 05:16:00 2013 From: python-checkins at python.org (r.david.murray) Date: Wed, 20 Mar 2013 05:16:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=2317485=3A_Delete_the_Con?= =?utf-8?q?tent-Length_header_if_the_data_attribute_is_deleted=2E?= Message-ID: <3ZVyVS2wFNzSMj@mail.python.org> http://hg.python.org/cpython/rev/b1579eb4e1bc changeset: 82820:b1579eb4e1bc user: R David Murray date: Wed Mar 20 00:10:51 2013 -0400 summary: #17485: Delete the Content-Length header if the data attribute is deleted. This is a follow on to issue 16464. Original patch by Daniel Wozniak. files: Lib/test/test_urllib2.py | 13 +++++++++++-- Lib/urllib/request.py | 2 +- Misc/ACKS | 1 + Misc/NEWS | 3 +++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -1488,11 +1488,20 @@ # if we change data we need to remove content-length header # (cause it's most probably calculated for previous value) def test_setting_data_should_remove_content_length(self): - self.assertFalse("Content-length" in self.get.unredirected_hdrs) + self.assertNotIn("Content-length", self.get.unredirected_hdrs) self.get.add_unredirected_header("Content-length", 42) self.assertEqual(42, self.get.unredirected_hdrs["Content-length"]) self.get.data = "spam" - self.assertFalse("Content-length" in self.get.unredirected_hdrs) + self.assertNotIn("Content-length", self.get.unredirected_hdrs) + + # issue 17485 same for deleting data. + def test_deleting_data_should_remove_content_length(self): + self.assertNotIn("Content-length", self.get.unredirected_hdrs) + self.get.data = 'foo' + self.get.add_unredirected_header("Content-length", 3) + self.assertEqual(3, self.get.unredirected_hdrs["Content-length"]) + del self.get.data + self.assertNotIn("Content-length", self.get.unredirected_hdrs) def test_get_full_url(self): self.assertEqual("http://www.python.org/~jeremy/", diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -296,7 +296,7 @@ @data.deleter def data(self): - self._data = None + self.data = None def _parse(self): self.type, rest = splittype(self.full_url) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1341,6 +1341,7 @@ Gordon Worley Darren Worrall Thomas Wouters +Daniel Wozniak Heiko Wundram Doug Wyatt Robert Xiao diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -292,6 +292,9 @@ Library ------- +- Issue #17485: Also delete the Request Content-Length header if the data + attribute is deleted. (Follow on to issue 16464). + - Issue #15927: CVS now correctly parses escaped newlines and carriage when parsing with quoting turned off. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 05:16:01 2013 From: python-checkins at python.org (r.david.murray) Date: Wed, 20 Mar 2013 05:16:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_logic_operator=2C_not_?= =?utf-8?q?bitwise_operator=2C_for_conditional=2E?= Message-ID: <3ZVyVT5dlpzSQL@mail.python.org> http://hg.python.org/cpython/rev/ced9602a3710 changeset: 82821:ced9602a3710 user: R David Murray date: Wed Mar 20 00:15:20 2013 -0400 summary: Use logic operator, not bitwise operator, for conditional. files: Modules/_csv.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/_csv.c b/Modules/_csv.c --- a/Modules/_csv.c +++ b/Modules/_csv.c @@ -644,7 +644,7 @@ break; case ESCAPED_CHAR: - if (c == '\n' | c=='\r') { + if (c == '\n' || c=='\r') { if (parse_add_char(self, c) < 0) return -1; self->state = AFTER_ESCAPED_CRNL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 05:25:01 2013 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 20 Mar 2013 05:25:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzE3NDc0IC0gTWFy?= =?utf-8?q?k_the_deprecated_Request_methods_as_deprecated-removed=2E_Revie?= =?utf-8?q?w_by?= Message-ID: <3ZVyhs46vBzSR9@mail.python.org> http://hg.python.org/cpython/rev/d805cfa523ec changeset: 82822:d805cfa523ec branch: 3.3 parent: 82809:8e9cf147fbca user: Senthil Kumaran date: Tue Mar 19 18:01:43 2013 -0700 summary: #17474 - Mark the deprecated Request methods as deprecated-removed. Review by Ezio Melotti files: Doc/library/urllib.request.rst | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -478,7 +478,7 @@ request to be ``POST`` rather than ``GET``. Deprecated in 3.3, use :attr:`Request.data`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. method:: Request.has_data() @@ -486,14 +486,14 @@ Return whether the instance has a non-\ ``None`` data. Deprecated in 3.3, use :attr:`Request.data`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. method:: Request.get_data() Return the instance's data. Deprecated in 3.3, use :attr:`Request.data`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. method:: Request.get_type() @@ -501,7 +501,7 @@ Return the type of the URL --- also known as the scheme. Deprecated in 3.3, use :attr:`Request.type`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. method:: Request.get_host() @@ -509,7 +509,7 @@ Return the host to which a connection will be made. Deprecated in 3.3, use :attr:`Request.host`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. method:: Request.get_selector() @@ -517,7 +517,7 @@ Return the selector --- the part of the URL that is sent to the server. Deprecated in 3.3, use :attr:`Request.selector`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. method:: Request.get_header(header_name, default=None) @@ -538,7 +538,7 @@ :rfc:`2965`. See the documentation for the :class:`Request` constructor. Deprecated in 3.3, use :attr:`Request.origin_req_host`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. method:: Request.is_unverifiable() @@ -547,7 +547,7 @@ documentation for the :class:`Request` constructor. Deprecated in 3.3, use :attr:`Request.unverifiable`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. _opener-director-objects: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 05:25:02 2013 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 20 Mar 2013 05:25:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_=2317474_-_merge_from_3=2E3=2E_Update_default_Docs_with_?= =?utf-8?q?versionchanged_markup_on?= Message-ID: <3ZVyht6qCszSPY@mail.python.org> http://hg.python.org/cpython/rev/ed6817ff19b8 changeset: 82823:ed6817ff19b8 parent: 82811:684b75600fa9 parent: 82822:d805cfa523ec user: Senthil Kumaran date: Tue Mar 19 18:03:39 2013 -0700 summary: #17474 - merge from 3.3. Update default Docs with versionchanged markup on what's removed files: Doc/library/urllib.request.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -498,6 +498,11 @@ Return a list of tuples (header_name, header_value) of the Request headers. +.. versionchanged:: 3.4 + Request methods add_data, has_data, get_data, get_type, get_host, + get_selector, get_origin_req_host and is_unverifiable deprecated since 3.3 + have been removed. + .. _opener-director-objects: OpenerDirector Objects -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 05:25:04 2013 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 20 Mar 2013 05:25:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_Automated_merge_with_ssh=3A//hg=2Epython=2Eorg/cpython?= Message-ID: <3ZVyhw2GczzSR9@mail.python.org> http://hg.python.org/cpython/rev/b50df62722a3 changeset: 82824:b50df62722a3 parent: 82821:ced9602a3710 parent: 82823:ed6817ff19b8 user: Senthil Kumaran date: Tue Mar 19 21:27:21 2013 -0700 summary: Automated merge with ssh://hg.python.org/cpython files: Doc/library/urllib.request.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -498,6 +498,11 @@ Return a list of tuples (header_name, header_value) of the Request headers. +.. versionchanged:: 3.4 + Request methods add_data, has_data, get_data, get_type, get_host, + get_selector, get_origin_req_host and is_unverifiable deprecated since 3.3 + have been removed. + .. _opener-director-objects: OpenerDirector Objects -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 05:25:05 2013 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 20 Mar 2013 05:25:05 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4zIC0+IDMuMyk6?= =?utf-8?q?_Automated_merge_with_file=3A///Users/skumaran/python/cpython?= Message-ID: <3ZVyhx4rZwzSMm@mail.python.org> http://hg.python.org/cpython/rev/e1fdda86e937 changeset: 82825:e1fdda86e937 branch: 3.3 parent: 82818:fde60d3f542e parent: 82822:d805cfa523ec user: Senthil Kumaran date: Tue Mar 19 21:27:23 2013 -0700 summary: Automated merge with file:///Users/skumaran/python/cpython files: Doc/library/urllib.request.rst | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -478,7 +478,7 @@ request to be ``POST`` rather than ``GET``. Deprecated in 3.3, use :attr:`Request.data`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. method:: Request.has_data() @@ -486,14 +486,14 @@ Return whether the instance has a non-\ ``None`` data. Deprecated in 3.3, use :attr:`Request.data`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. method:: Request.get_data() Return the instance's data. Deprecated in 3.3, use :attr:`Request.data`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. method:: Request.get_type() @@ -501,7 +501,7 @@ Return the type of the URL --- also known as the scheme. Deprecated in 3.3, use :attr:`Request.type`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. method:: Request.get_host() @@ -509,7 +509,7 @@ Return the host to which a connection will be made. Deprecated in 3.3, use :attr:`Request.host`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. method:: Request.get_selector() @@ -517,7 +517,7 @@ Return the selector --- the part of the URL that is sent to the server. Deprecated in 3.3, use :attr:`Request.selector`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. method:: Request.get_header(header_name, default=None) @@ -538,7 +538,7 @@ :rfc:`2965`. See the documentation for the :class:`Request` constructor. Deprecated in 3.3, use :attr:`Request.origin_req_host`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. method:: Request.is_unverifiable() @@ -547,7 +547,7 @@ documentation for the :class:`Request` constructor. Deprecated in 3.3, use :attr:`Request.unverifiable`. - .. deprecated:: 3.3 + .. deprecated-removed:: 3.3 3.4 .. _opener-director-objects: -- Repository URL: http://hg.python.org/cpython From andrew.svetlov at gmail.com Wed Mar 20 05:25:00 2013 From: andrew.svetlov at gmail.com (Andrew Svetlov) Date: Tue, 19 Mar 2013 21:25:00 -0700 Subject: [Python-checkins] peps: update 2.7.4 release dates In-Reply-To: <3ZVyV50rrYzSFs@mail.python.org> References: <3ZVyV50rrYzSFs@mail.python.org> Message-ID: Are you sure about 2.7.4 2012-04-06? I mean 2012 year. On Tue, Mar 19, 2013 at 9:15 PM, benjamin.peterson wrote: > http://hg.python.org/peps/rev/ce17779c395c > changeset: 4810:ce17779c395c > user: Benjamin Peterson > date: Tue Mar 19 23:15:23 2013 -0500 > summary: > update 2.7.4 release dates > > files: > pep-0373.txt | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > > diff --git a/pep-0373.txt b/pep-0373.txt > --- a/pep-0373.txt > +++ b/pep-0373.txt > @@ -56,8 +56,8 @@ > > Planned future release dates: > > -- 2.7.4rc1 2013-02-02 > -- 2.7.4 2012-02-16 > +- 2.7.4rc1 2013-03-23 > +- 2.7.4 2012-04-06 > > Dates of previous maintenance releases: > > > -- > Repository URL: http://hg.python.org/peps > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > -- Thanks, Andrew Svetlov From benjamin at python.org Wed Mar 20 05:30:33 2013 From: benjamin at python.org (Benjamin Peterson) Date: Tue, 19 Mar 2013 21:30:33 -0700 Subject: [Python-checkins] peps: update 2.7.4 release dates In-Reply-To: References: <3ZVyV50rrYzSFs@mail.python.org> Message-ID: Good catch. 2013/3/19 Andrew Svetlov : > Are you sure about 2.7.4 2012-04-06? I mean 2012 year. > > On Tue, Mar 19, 2013 at 9:15 PM, benjamin.peterson > wrote: >> http://hg.python.org/peps/rev/ce17779c395c >> changeset: 4810:ce17779c395c >> user: Benjamin Peterson >> date: Tue Mar 19 23:15:23 2013 -0500 >> summary: >> update 2.7.4 release dates >> >> files: >> pep-0373.txt | 4 ++-- >> 1 files changed, 2 insertions(+), 2 deletions(-) >> >> >> diff --git a/pep-0373.txt b/pep-0373.txt >> --- a/pep-0373.txt >> +++ b/pep-0373.txt >> @@ -56,8 +56,8 @@ >> >> Planned future release dates: >> >> -- 2.7.4rc1 2013-02-02 >> -- 2.7.4 2012-02-16 >> +- 2.7.4rc1 2013-03-23 >> +- 2.7.4 2012-04-06 >> >> Dates of previous maintenance releases: >> >> >> -- >> Repository URL: http://hg.python.org/peps >> >> _______________________________________________ >> Python-checkins mailing list >> Python-checkins at python.org >> http://mail.python.org/mailman/listinfo/python-checkins >> > > > > -- > Thanks, > Andrew Svetlov > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins -- Regards, Benjamin From python-checkins at python.org Wed Mar 20 05:30:35 2013 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 20 Mar 2013 05:30:35 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_backdating_releases=2C_like_s?= =?utf-8?q?tocks=2C_is_not_allowed?= Message-ID: <3ZVyqH3gR7zSHW@mail.python.org> http://hg.python.org/peps/rev/efcae2da2a4c changeset: 4811:efcae2da2a4c user: Benjamin Peterson date: Tue Mar 19 23:30:25 2013 -0500 summary: backdating releases, like stocks, is not allowed files: pep-0373.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0373.txt b/pep-0373.txt --- a/pep-0373.txt +++ b/pep-0373.txt @@ -57,7 +57,7 @@ Planned future release dates: - 2.7.4rc1 2013-03-23 -- 2.7.4 2012-04-06 +- 2.7.4 2013-04-06 Dates of previous maintenance releases: -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Wed Mar 20 05:38:23 2013 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 20 Mar 2013 05:38:23 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_null_merge=2E?= Message-ID: <3ZVz0H59ZyzSK2@mail.python.org> http://hg.python.org/cpython/rev/425d5ff0c043 changeset: 82826:425d5ff0c043 parent: 82824:b50df62722a3 parent: 82825:e1fdda86e937 user: Senthil Kumaran date: Tue Mar 19 21:41:35 2013 -0700 summary: null merge. files: -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Wed Mar 20 05:52:16 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 20 Mar 2013 05:52:16 +0100 Subject: [Python-checkins] Daily reference leaks (684b75600fa9): sum=0 Message-ID: results for 684b75600fa9 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogJoSfsJ', '-x'] From python-checkins at python.org Wed Mar 20 06:39:06 2013 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 20 Mar 2013 06:39:06 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_fix_compiler_warning?= Message-ID: <3ZW0LL0YvpzSDw@mail.python.org> http://hg.python.org/cpython/rev/521232b05b97 changeset: 82827:521232b05b97 user: Benjamin Peterson date: Tue Mar 19 23:20:59 2013 -0500 summary: fix compiler warning files: Grammar/Grammar | 3 +- Python/graminit.c | 505 +++++++++++++++++---------------- Python/marshal.c | 2 +- 3 files changed, 267 insertions(+), 243 deletions(-) diff --git a/Grammar/Grammar b/Grammar/Grammar --- a/Grammar/Grammar +++ b/Grammar/Grammar @@ -24,7 +24,8 @@ decorated: decorators (classdef | funcdef) funcdef: 'def' NAME parameters ['->' test] ':' suite parameters: '(' [typedargslist] ')' -typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* [',' +typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* + [',' '/' (',' tfpdef ['=' test])*] [',' ['*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] | '**' tfpdef]] | '*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] | '**' tfpdef) tfpdef: NAME [':' test] diff --git a/Python/graminit.c b/Python/graminit.c --- a/Python/graminit.c +++ b/Python/graminit.c @@ -160,8 +160,8 @@ }; static arc arcs_8_0[3] = { {28, 1}, - {31, 2}, - {32, 3}, + {32, 2}, + {33, 3}, }; static arc arcs_8_1[3] = { {29, 4}, @@ -179,10 +179,11 @@ static arc arcs_8_4[1] = { {24, 9}, }; -static arc arcs_8_5[4] = { +static arc arcs_8_5[5] = { {28, 10}, {31, 11}, - {32, 3}, + {32, 12}, + {33, 3}, {0, 5}, }; static arc arcs_8_6[2] = { @@ -190,8 +191,8 @@ {0, 6}, }; static arc arcs_8_7[2] = { - {28, 12}, - {32, 3}, + {28, 13}, + {33, 3}, }; static arc arcs_8_8[1] = { {0, 8}, @@ -205,54 +206,76 @@ {29, 4}, {0, 10}, }; -static arc arcs_8_11[3] = { - {28, 13}, +static arc arcs_8_11[2] = { {30, 14}, {0, 11}, }; static arc arcs_8_12[3] = { - {30, 7}, - {29, 15}, + {28, 15}, + {30, 16}, {0, 12}, }; -static arc arcs_8_13[2] = { - {30, 14}, +static arc arcs_8_13[3] = { + {30, 7}, + {29, 17}, {0, 13}, }; -static arc arcs_8_14[2] = { - {28, 16}, - {32, 3}, +static arc arcs_8_14[4] = { + {28, 18}, + {32, 12}, + {33, 3}, + {0, 14}, }; -static arc arcs_8_15[1] = { +static arc arcs_8_15[2] = { + {30, 16}, + {0, 15}, +}; +static arc arcs_8_16[2] = { + {28, 19}, + {33, 3}, +}; +static arc arcs_8_17[1] = { {24, 6}, }; -static arc arcs_8_16[3] = { +static arc arcs_8_18[3] = { {30, 14}, - {29, 17}, - {0, 16}, + {29, 20}, + {0, 18}, }; -static arc arcs_8_17[1] = { - {24, 13}, +static arc arcs_8_19[3] = { + {30, 16}, + {29, 21}, + {0, 19}, }; -static state states_8[18] = { +static arc arcs_8_20[1] = { + {24, 11}, +}; +static arc arcs_8_21[1] = { + {24, 15}, +}; +static state states_8[22] = { {3, arcs_8_0}, {3, arcs_8_1}, {3, arcs_8_2}, {1, arcs_8_3}, {1, arcs_8_4}, - {4, arcs_8_5}, + {5, arcs_8_5}, {2, arcs_8_6}, {2, arcs_8_7}, {1, arcs_8_8}, {2, arcs_8_9}, {3, arcs_8_10}, - {3, arcs_8_11}, + {2, arcs_8_11}, {3, arcs_8_12}, - {2, arcs_8_13}, - {2, arcs_8_14}, - {1, arcs_8_15}, - {3, arcs_8_16}, + {3, arcs_8_13}, + {4, arcs_8_14}, + {2, arcs_8_15}, + {2, arcs_8_16}, {1, arcs_8_17}, + {3, arcs_8_18}, + {3, arcs_8_19}, + {1, arcs_8_20}, + {1, arcs_8_21}, }; static arc arcs_9_0[1] = { {21, 1}, @@ -274,9 +297,9 @@ {1, arcs_9_3}, }; static arc arcs_10_0[3] = { - {34, 1}, - {31, 2}, - {32, 3}, + {35, 1}, + {32, 2}, + {33, 3}, }; static arc arcs_10_1[3] = { {29, 4}, @@ -284,20 +307,20 @@ {0, 1}, }; static arc arcs_10_2[3] = { - {34, 6}, + {35, 6}, {30, 7}, {0, 2}, }; static arc arcs_10_3[1] = { - {34, 8}, + {35, 8}, }; static arc arcs_10_4[1] = { {24, 9}, }; static arc arcs_10_5[4] = { - {34, 10}, - {31, 11}, - {32, 3}, + {35, 10}, + {32, 11}, + {33, 3}, {0, 5}, }; static arc arcs_10_6[2] = { @@ -305,8 +328,8 @@ {0, 6}, }; static arc arcs_10_7[2] = { - {34, 12}, - {32, 3}, + {35, 12}, + {33, 3}, }; static arc arcs_10_8[1] = { {0, 8}, @@ -321,7 +344,7 @@ {0, 10}, }; static arc arcs_10_11[3] = { - {34, 13}, + {35, 13}, {30, 14}, {0, 11}, }; @@ -335,8 +358,8 @@ {0, 13}, }; static arc arcs_10_14[2] = { - {34, 16}, - {32, 3}, + {35, 16}, + {33, 3}, }; static arc arcs_10_15[1] = { {24, 6}, @@ -391,14 +414,14 @@ {1, arcs_12_1}, }; static arc arcs_13_0[1] = { - {35, 1}, + {36, 1}, }; static arc arcs_13_1[2] = { - {36, 2}, + {37, 2}, {2, 3}, }; static arc arcs_13_2[2] = { - {35, 1}, + {36, 1}, {2, 3}, }; static arc arcs_13_3[1] = { @@ -411,7 +434,6 @@ {1, arcs_13_3}, }; static arc arcs_14_0[8] = { - {37, 1}, {38, 1}, {39, 1}, {40, 1}, @@ -419,6 +441,7 @@ {42, 1}, {43, 1}, {44, 1}, + {45, 1}, }; static arc arcs_14_1[1] = { {0, 1}, @@ -428,20 +451,20 @@ {1, arcs_14_1}, }; static arc arcs_15_0[1] = { - {45, 1}, + {46, 1}, }; static arc arcs_15_1[3] = { - {46, 2}, + {47, 2}, {29, 3}, {0, 1}, }; static arc arcs_15_2[2] = { - {47, 4}, + {48, 4}, {9, 4}, }; static arc arcs_15_3[2] = { - {47, 5}, - {45, 5}, + {48, 5}, + {46, 5}, }; static arc arcs_15_4[1] = { {0, 4}, @@ -460,7 +483,7 @@ }; static arc arcs_16_0[2] = { {24, 1}, - {48, 1}, + {49, 1}, }; static arc arcs_16_1[2] = { {30, 2}, @@ -468,7 +491,7 @@ }; static arc arcs_16_2[3] = { {24, 1}, - {48, 1}, + {49, 1}, {0, 2}, }; static state states_16[3] = { @@ -477,7 +500,6 @@ {3, arcs_16_2}, }; static arc arcs_17_0[12] = { - {49, 1}, {50, 1}, {51, 1}, {52, 1}, @@ -489,6 +511,7 @@ {58, 1}, {59, 1}, {60, 1}, + {61, 1}, }; static arc arcs_17_1[1] = { {0, 1}, @@ -498,10 +521,10 @@ {1, arcs_17_1}, }; static arc arcs_18_0[1] = { - {61, 1}, + {62, 1}, }; static arc arcs_18_1[1] = { - {62, 2}, + {63, 2}, }; static arc arcs_18_2[1] = { {0, 2}, @@ -512,7 +535,7 @@ {1, arcs_18_2}, }; static arc arcs_19_0[1] = { - {63, 1}, + {64, 1}, }; static arc arcs_19_1[1] = { {0, 1}, @@ -522,11 +545,11 @@ {1, arcs_19_1}, }; static arc arcs_20_0[5] = { - {64, 1}, {65, 1}, {66, 1}, {67, 1}, {68, 1}, + {69, 1}, }; static arc arcs_20_1[1] = { {0, 1}, @@ -536,7 +559,7 @@ {1, arcs_20_1}, }; static arc arcs_21_0[1] = { - {69, 1}, + {70, 1}, }; static arc arcs_21_1[1] = { {0, 1}, @@ -546,7 +569,7 @@ {1, arcs_21_1}, }; static arc arcs_22_0[1] = { - {70, 1}, + {71, 1}, }; static arc arcs_22_1[1] = { {0, 1}, @@ -556,7 +579,7 @@ {1, arcs_22_1}, }; static arc arcs_23_0[1] = { - {71, 1}, + {72, 1}, }; static arc arcs_23_1[2] = { {9, 2}, @@ -571,7 +594,7 @@ {1, arcs_23_2}, }; static arc arcs_24_0[1] = { - {47, 1}, + {48, 1}, }; static arc arcs_24_1[1] = { {0, 1}, @@ -581,14 +604,14 @@ {1, arcs_24_1}, }; static arc arcs_25_0[1] = { - {72, 1}, + {73, 1}, }; static arc arcs_25_1[2] = { {24, 2}, {0, 1}, }; static arc arcs_25_2[2] = { - {73, 3}, + {74, 3}, {0, 2}, }; static arc arcs_25_3[1] = { @@ -605,8 +628,8 @@ {1, arcs_25_4}, }; static arc arcs_26_0[2] = { - {74, 1}, {75, 1}, + {76, 1}, }; static arc arcs_26_1[1] = { {0, 1}, @@ -616,10 +639,10 @@ {1, arcs_26_1}, }; static arc arcs_27_0[1] = { - {76, 1}, + {77, 1}, }; static arc arcs_27_1[1] = { - {77, 2}, + {78, 2}, }; static arc arcs_27_2[1] = { {0, 2}, @@ -630,32 +653,32 @@ {1, arcs_27_2}, }; static arc arcs_28_0[1] = { - {73, 1}, + {74, 1}, }; static arc arcs_28_1[3] = { - {78, 2}, {79, 2}, + {80, 2}, {12, 3}, }; static arc arcs_28_2[4] = { - {78, 2}, {79, 2}, + {80, 2}, {12, 3}, - {76, 4}, + {77, 4}, }; static arc arcs_28_3[1] = { - {76, 4}, + {77, 4}, }; static arc arcs_28_4[3] = { - {31, 5}, + {32, 5}, {13, 6}, - {80, 5}, + {81, 5}, }; static arc arcs_28_5[1] = { {0, 5}, }; static arc arcs_28_6[1] = { - {80, 7}, + {81, 7}, }; static arc arcs_28_7[1] = { {15, 5}, @@ -674,7 +697,7 @@ {21, 1}, }; static arc arcs_29_1[2] = { - {82, 2}, + {83, 2}, {0, 1}, }; static arc arcs_29_2[1] = { @@ -693,7 +716,7 @@ {12, 1}, }; static arc arcs_30_1[2] = { - {82, 2}, + {83, 2}, {0, 1}, }; static arc arcs_30_2[1] = { @@ -709,14 +732,14 @@ {1, arcs_30_3}, }; static arc arcs_31_0[1] = { - {81, 1}, + {82, 1}, }; static arc arcs_31_1[2] = { {30, 2}, {0, 1}, }; static arc arcs_31_2[2] = { - {81, 1}, + {82, 1}, {0, 2}, }; static state states_31[3] = { @@ -725,7 +748,7 @@ {2, arcs_31_2}, }; static arc arcs_32_0[1] = { - {83, 1}, + {84, 1}, }; static arc arcs_32_1[2] = { {30, 0}, @@ -739,7 +762,7 @@ {21, 1}, }; static arc arcs_33_1[2] = { - {78, 0}, + {79, 0}, {0, 1}, }; static state states_33[2] = { @@ -747,7 +770,7 @@ {2, arcs_33_1}, }; static arc arcs_34_0[1] = { - {84, 1}, + {85, 1}, }; static arc arcs_34_1[1] = { {21, 2}, @@ -762,7 +785,7 @@ {2, arcs_34_2}, }; static arc arcs_35_0[1] = { - {85, 1}, + {86, 1}, }; static arc arcs_35_1[1] = { {21, 2}, @@ -777,7 +800,7 @@ {2, arcs_35_2}, }; static arc arcs_36_0[1] = { - {86, 1}, + {87, 1}, }; static arc arcs_36_1[1] = { {24, 2}, @@ -800,11 +823,11 @@ {1, arcs_36_4}, }; static arc arcs_37_0[8] = { - {87, 1}, {88, 1}, {89, 1}, {90, 1}, {91, 1}, + {92, 1}, {19, 1}, {18, 1}, {17, 1}, @@ -817,7 +840,7 @@ {1, arcs_37_1}, }; static arc arcs_38_0[1] = { - {92, 1}, + {93, 1}, }; static arc arcs_38_1[1] = { {24, 2}, @@ -829,8 +852,8 @@ {26, 4}, }; static arc arcs_38_4[3] = { - {93, 1}, - {94, 5}, + {94, 1}, + {95, 5}, {0, 4}, }; static arc arcs_38_5[1] = { @@ -853,7 +876,7 @@ {1, arcs_38_7}, }; static arc arcs_39_0[1] = { - {95, 1}, + {96, 1}, }; static arc arcs_39_1[1] = { {24, 2}, @@ -865,7 +888,7 @@ {26, 4}, }; static arc arcs_39_4[2] = { - {94, 5}, + {95, 5}, {0, 4}, }; static arc arcs_39_5[1] = { @@ -888,13 +911,13 @@ {1, arcs_39_7}, }; static arc arcs_40_0[1] = { - {96, 1}, + {97, 1}, }; static arc arcs_40_1[1] = { - {62, 2}, + {63, 2}, }; static arc arcs_40_2[1] = { - {97, 3}, + {98, 3}, }; static arc arcs_40_3[1] = { {9, 4}, @@ -906,7 +929,7 @@ {26, 6}, }; static arc arcs_40_6[2] = { - {94, 7}, + {95, 7}, {0, 6}, }; static arc arcs_40_7[1] = { @@ -931,7 +954,7 @@ {1, arcs_40_9}, }; static arc arcs_41_0[1] = { - {98, 1}, + {99, 1}, }; static arc arcs_41_1[1] = { {25, 2}, @@ -940,8 +963,8 @@ {26, 3}, }; static arc arcs_41_3[2] = { - {99, 4}, - {100, 5}, + {100, 4}, + {101, 5}, }; static arc arcs_41_4[1] = { {25, 6}, @@ -956,9 +979,9 @@ {26, 9}, }; static arc arcs_41_8[4] = { - {99, 4}, - {94, 10}, - {100, 5}, + {100, 4}, + {95, 10}, + {101, 5}, {0, 8}, }; static arc arcs_41_9[1] = { @@ -971,7 +994,7 @@ {26, 12}, }; static arc arcs_41_12[2] = { - {100, 5}, + {101, 5}, {0, 12}, }; static state states_41[13] = { @@ -990,10 +1013,10 @@ {2, arcs_41_12}, }; static arc arcs_42_0[1] = { - {101, 1}, + {102, 1}, }; static arc arcs_42_1[1] = { - {102, 2}, + {103, 2}, }; static arc arcs_42_2[2] = { {30, 1}, @@ -1016,11 +1039,11 @@ {24, 1}, }; static arc arcs_43_1[2] = { - {82, 2}, + {83, 2}, {0, 1}, }; static arc arcs_43_2[1] = { - {103, 3}, + {104, 3}, }; static arc arcs_43_3[1] = { {0, 3}, @@ -1032,14 +1055,14 @@ {1, arcs_43_3}, }; static arc arcs_44_0[1] = { - {104, 1}, + {105, 1}, }; static arc arcs_44_1[2] = { {24, 2}, {0, 1}, }; static arc arcs_44_2[2] = { - {82, 3}, + {83, 3}, {0, 2}, }; static arc arcs_44_3[1] = { @@ -1063,14 +1086,14 @@ {0, 1}, }; static arc arcs_45_2[1] = { - {105, 3}, + {106, 3}, }; static arc arcs_45_3[1] = { {6, 4}, }; static arc arcs_45_4[2] = { {6, 4}, - {106, 1}, + {107, 1}, }; static state states_45[5] = { {2, arcs_45_0}, @@ -1080,21 +1103,21 @@ {2, arcs_45_4}, }; static arc arcs_46_0[2] = { - {107, 1}, - {108, 2}, + {108, 1}, + {109, 2}, }; static arc arcs_46_1[2] = { - {92, 3}, + {93, 3}, {0, 1}, }; static arc arcs_46_2[1] = { {0, 2}, }; static arc arcs_46_3[1] = { - {107, 4}, + {108, 4}, }; static arc arcs_46_4[1] = { - {94, 5}, + {95, 5}, }; static arc arcs_46_5[1] = { {24, 2}, @@ -1108,8 +1131,8 @@ {1, arcs_46_5}, }; static arc arcs_47_0[2] = { - {107, 1}, - {110, 1}, + {108, 1}, + {111, 1}, }; static arc arcs_47_1[1] = { {0, 1}, @@ -1119,10 +1142,10 @@ {1, arcs_47_1}, }; static arc arcs_48_0[1] = { - {111, 1}, + {112, 1}, }; static arc arcs_48_1[2] = { - {33, 2}, + {34, 2}, {25, 3}, }; static arc arcs_48_2[1] = { @@ -1142,17 +1165,17 @@ {1, arcs_48_4}, }; static arc arcs_49_0[1] = { - {111, 1}, + {112, 1}, }; static arc arcs_49_1[2] = { - {33, 2}, + {34, 2}, {25, 3}, }; static arc arcs_49_2[1] = { {25, 3}, }; static arc arcs_49_3[1] = { - {109, 4}, + {110, 4}, }; static arc arcs_49_4[1] = { {0, 4}, @@ -1165,10 +1188,10 @@ {1, arcs_49_4}, }; static arc arcs_50_0[1] = { - {112, 1}, + {113, 1}, }; static arc arcs_50_1[2] = { - {113, 0}, + {114, 0}, {0, 1}, }; static state states_50[2] = { @@ -1176,10 +1199,10 @@ {2, arcs_50_1}, }; static arc arcs_51_0[1] = { - {114, 1}, + {115, 1}, }; static arc arcs_51_1[2] = { - {115, 0}, + {116, 0}, {0, 1}, }; static state states_51[2] = { @@ -1187,11 +1210,11 @@ {2, arcs_51_1}, }; static arc arcs_52_0[2] = { - {116, 1}, - {117, 2}, + {117, 1}, + {118, 2}, }; static arc arcs_52_1[1] = { - {114, 2}, + {115, 2}, }; static arc arcs_52_2[1] = { {0, 2}, @@ -1202,10 +1225,10 @@ {1, arcs_52_2}, }; static arc arcs_53_0[1] = { - {103, 1}, + {104, 1}, }; static arc arcs_53_1[2] = { - {118, 0}, + {119, 0}, {0, 1}, }; static state states_53[2] = { @@ -1213,25 +1236,25 @@ {2, arcs_53_1}, }; static arc arcs_54_0[10] = { - {119, 1}, {120, 1}, {121, 1}, {122, 1}, {123, 1}, {124, 1}, {125, 1}, - {97, 1}, - {116, 2}, - {126, 3}, + {126, 1}, + {98, 1}, + {117, 2}, + {127, 3}, }; static arc arcs_54_1[1] = { {0, 1}, }; static arc arcs_54_2[1] = { - {97, 1}, + {98, 1}, }; static arc arcs_54_3[2] = { - {116, 1}, + {117, 1}, {0, 3}, }; static state states_54[4] = { @@ -1241,10 +1264,10 @@ {2, arcs_54_3}, }; static arc arcs_55_0[1] = { - {31, 1}, + {32, 1}, }; static arc arcs_55_1[1] = { - {103, 2}, + {104, 2}, }; static arc arcs_55_2[1] = { {0, 2}, @@ -1255,10 +1278,10 @@ {1, arcs_55_2}, }; static arc arcs_56_0[1] = { - {127, 1}, + {128, 1}, }; static arc arcs_56_1[2] = { - {128, 0}, + {129, 0}, {0, 1}, }; static state states_56[2] = { @@ -1266,10 +1289,10 @@ {2, arcs_56_1}, }; static arc arcs_57_0[1] = { - {129, 1}, + {130, 1}, }; static arc arcs_57_1[2] = { - {130, 0}, + {131, 0}, {0, 1}, }; static state states_57[2] = { @@ -1277,10 +1300,10 @@ {2, arcs_57_1}, }; static arc arcs_58_0[1] = { - {131, 1}, + {132, 1}, }; static arc arcs_58_1[2] = { - {132, 0}, + {133, 0}, {0, 1}, }; static state states_58[2] = { @@ -1288,11 +1311,11 @@ {2, arcs_58_1}, }; static arc arcs_59_0[1] = { - {133, 1}, + {134, 1}, }; static arc arcs_59_1[3] = { - {134, 0}, {135, 0}, + {136, 0}, {0, 1}, }; static state states_59[2] = { @@ -1300,11 +1323,11 @@ {3, arcs_59_1}, }; static arc arcs_60_0[1] = { - {136, 1}, + {137, 1}, }; static arc arcs_60_1[3] = { - {137, 0}, {138, 0}, + {139, 0}, {0, 1}, }; static state states_60[2] = { @@ -1312,11 +1335,11 @@ {3, arcs_60_1}, }; static arc arcs_61_0[1] = { - {139, 1}, + {140, 1}, }; static arc arcs_61_1[5] = { + {32, 0}, {31, 0}, - {140, 0}, {141, 0}, {142, 0}, {0, 1}, @@ -1326,13 +1349,13 @@ {5, arcs_61_1}, }; static arc arcs_62_0[4] = { - {137, 1}, {138, 1}, + {139, 1}, {143, 1}, {144, 2}, }; static arc arcs_62_1[1] = { - {139, 2}, + {140, 2}, }; static arc arcs_62_2[1] = { {0, 2}, @@ -1347,11 +1370,11 @@ }; static arc arcs_63_1[3] = { {146, 1}, - {32, 2}, + {33, 2}, {0, 1}, }; static arc arcs_63_2[1] = { - {139, 3}, + {140, 3}, }; static arc arcs_63_3[1] = { {0, 3}, @@ -1369,13 +1392,13 @@ {21, 4}, {153, 4}, {154, 5}, - {79, 4}, + {80, 4}, {155, 4}, {156, 4}, {157, 4}, }; static arc arcs_64_1[3] = { - {47, 6}, + {48, 6}, {147, 6}, {15, 4}, }; @@ -1416,7 +1439,7 @@ }; static arc arcs_65_0[2] = { {24, 1}, - {48, 1}, + {49, 1}, }; static arc arcs_65_1[3] = { {158, 2}, @@ -1428,7 +1451,7 @@ }; static arc arcs_65_3[3] = { {24, 4}, - {48, 4}, + {49, 4}, {0, 3}, }; static arc arcs_65_4[2] = { @@ -1445,7 +1468,7 @@ static arc arcs_66_0[3] = { {13, 1}, {148, 2}, - {78, 3}, + {79, 3}, }; static arc arcs_66_1[2] = { {14, 4}, @@ -1534,16 +1557,16 @@ {1, arcs_69_2}, }; static arc arcs_70_0[2] = { - {103, 1}, - {48, 1}, + {104, 1}, + {49, 1}, }; static arc arcs_70_1[2] = { {30, 2}, {0, 1}, }; static arc arcs_70_2[3] = { - {103, 1}, - {48, 1}, + {104, 1}, + {49, 1}, {0, 2}, }; static state states_70[3] = { @@ -1660,8 +1683,8 @@ }; static arc arcs_74_0[3] = { {163, 1}, - {31, 2}, - {32, 3}, + {32, 2}, + {33, 3}, }; static arc arcs_74_1[2] = { {30, 4}, @@ -1675,8 +1698,8 @@ }; static arc arcs_74_4[4] = { {163, 1}, - {31, 2}, - {32, 3}, + {32, 2}, + {33, 3}, {0, 4}, }; static arc arcs_74_5[2] = { @@ -1688,7 +1711,7 @@ }; static arc arcs_74_7[2] = { {163, 5}, - {32, 3}, + {33, 3}, }; static state states_74[8] = { {3, arcs_74_0}, @@ -1732,16 +1755,16 @@ {1, arcs_76_1}, }; static arc arcs_77_0[1] = { - {96, 1}, + {97, 1}, }; static arc arcs_77_1[1] = { - {62, 2}, + {63, 2}, }; static arc arcs_77_2[1] = { - {97, 3}, + {98, 3}, }; static arc arcs_77_3[1] = { - {107, 4}, + {108, 4}, }; static arc arcs_77_4[2] = { {164, 5}, @@ -1759,10 +1782,10 @@ {1, arcs_77_5}, }; static arc arcs_78_0[1] = { - {92, 1}, + {93, 1}, }; static arc arcs_78_1[1] = { - {109, 2}, + {110, 2}, }; static arc arcs_78_2[2] = { {164, 3}, @@ -1803,7 +1826,7 @@ {1, arcs_80_2}, }; static arc arcs_81_0[2] = { - {73, 1}, + {74, 1}, {9, 2}, }; static arc arcs_81_1[1] = { @@ -1819,11 +1842,11 @@ }; static dfa dfas[82] = { {256, "single_input", 0, 3, states_0, - "\004\050\060\200\000\000\000\240\340\223\160\220\045\200\020\000\000\206\120\076\204\000"}, + "\004\050\060\000\001\000\000\100\301\047\341\040\113\000\041\000\000\214\120\076\204\000"}, {257, "file_input", 0, 2, states_1, - "\204\050\060\200\000\000\000\240\340\223\160\220\045\200\020\000\000\206\120\076\204\000"}, + "\204\050\060\000\001\000\000\100\301\047\341\040\113\000\041\000\000\214\120\076\204\000"}, {258, "eval_input", 0, 3, states_2, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, {259, "decorator", 0, 7, states_3, "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {260, "decorators", 0, 2, states_4, @@ -1834,48 +1857,48 @@ "\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {263, "parameters", 0, 4, states_7, "\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {264, "typedargslist", 0, 18, states_8, - "\000\000\040\200\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {264, "typedargslist", 0, 22, states_8, + "\000\000\040\000\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {265, "tfpdef", 0, 4, states_9, "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {266, "varargslist", 0, 18, states_10, - "\000\000\040\200\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\040\000\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {267, "vfpdef", 0, 2, states_11, "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {268, "stmt", 0, 2, states_12, - "\000\050\060\200\000\000\000\240\340\223\160\220\045\200\020\000\000\206\120\076\204\000"}, + "\000\050\060\000\001\000\000\100\301\047\341\040\113\000\041\000\000\214\120\076\204\000"}, {269, "simple_stmt", 0, 4, states_13, - "\000\040\040\200\000\000\000\240\340\223\160\000\000\200\020\000\000\206\120\076\200\000"}, + "\000\040\040\000\001\000\000\100\301\047\341\000\000\000\041\000\000\214\120\076\200\000"}, {270, "small_stmt", 0, 2, states_14, - "\000\040\040\200\000\000\000\240\340\223\160\000\000\200\020\000\000\206\120\076\200\000"}, + "\000\040\040\000\001\000\000\100\301\047\341\000\000\000\041\000\000\214\120\076\200\000"}, {271, "expr_stmt", 0, 6, states_15, - "\000\040\040\200\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, + "\000\040\040\000\001\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, {272, "testlist_star_expr", 0, 3, states_16, - "\000\040\040\200\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, + "\000\040\040\000\001\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, {273, "augassign", 0, 2, states_17, - "\000\000\000\000\000\000\376\037\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\374\077\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {274, "del_stmt", 0, 3, states_18, - "\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {275, "pass_stmt", 0, 2, states_19, - "\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {276, "flow_stmt", 0, 2, states_20, - "\000\000\000\000\000\000\000\000\340\001\000\000\000\000\000\000\000\000\000\000\200\000"}, + "\000\000\000\000\000\000\000\000\300\003\000\000\000\000\000\000\000\000\000\000\200\000"}, {277, "break_stmt", 0, 2, states_21, - "\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {278, "continue_stmt", 0, 2, states_22, - "\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {279, "return_stmt", 0, 3, states_23, - "\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000"}, {280, "yield_stmt", 0, 2, states_24, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000"}, {281, "raise_stmt", 0, 5, states_25, - "\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000"}, {282, "import_stmt", 0, 2, states_26, - "\000\000\000\000\000\000\000\000\000\022\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\044\000\000\000\000\000\000\000\000\000\000\000\000"}, {283, "import_name", 0, 3, states_27, - "\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000"}, {284, "import_from", 0, 8, states_28, - "\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000"}, {285, "import_as_name", 0, 4, states_29, "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {286, "dotted_as_name", 0, 4, states_30, @@ -1887,101 +1910,101 @@ {289, "dotted_name", 0, 2, states_33, "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {290, "global_stmt", 0, 3, states_34, - "\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000"}, {291, "nonlocal_stmt", 0, 3, states_35, - "\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000"}, {292, "assert_stmt", 0, 5, states_36, - "\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000"}, {293, "compound_stmt", 0, 2, states_37, - "\000\010\020\000\000\000\000\000\000\000\000\220\045\000\000\000\000\000\000\000\004\000"}, + "\000\010\020\000\000\000\000\000\000\000\000\040\113\000\000\000\000\000\000\000\004\000"}, {294, "if_stmt", 0, 8, states_38, - "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000"}, {295, "while_stmt", 0, 8, states_39, - "\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, {296, "for_stmt", 0, 10, states_40, - "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000"}, {297, "try_stmt", 0, 13, states_41, - "\000\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000"}, {298, "with_stmt", 0, 5, states_42, - "\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000"}, {299, "with_item", 0, 4, states_43, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, {300, "except_clause", 0, 5, states_44, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000"}, {301, "suite", 0, 5, states_45, - "\004\040\040\200\000\000\000\240\340\223\160\000\000\200\020\000\000\206\120\076\200\000"}, + "\004\040\040\000\001\000\000\100\301\047\341\000\000\000\041\000\000\214\120\076\200\000"}, {302, "test", 0, 6, states_46, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, {303, "test_nocond", 0, 2, states_47, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, {304, "lambdef", 0, 5, states_48, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000"}, {305, "lambdef_nocond", 0, 5, states_49, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000"}, {306, "or_test", 0, 2, states_50, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\020\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\040\000\000\214\120\076\000\000"}, {307, "and_test", 0, 2, states_51, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\020\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\040\000\000\214\120\076\000\000"}, {308, "not_test", 0, 3, states_52, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\020\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\040\000\000\214\120\076\000\000"}, {309, "comparison", 0, 2, states_53, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, {310, "comp_op", 0, 4, states_54, - "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\220\177\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\004\000\040\377\000\000\000\000\000\000"}, {311, "star_expr", 0, 3, states_55, - "\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {312, "expr", 0, 2, states_56, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, {313, "xor_expr", 0, 2, states_57, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, {314, "and_expr", 0, 2, states_58, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, {315, "shift_expr", 0, 2, states_59, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, {316, "arith_expr", 0, 2, states_60, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, {317, "term", 0, 2, states_61, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, {318, "factor", 0, 3, states_62, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, {319, "power", 0, 4, states_63, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\120\076\000\000"}, {320, "atom", 0, 9, states_64, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\120\076\000\000"}, {321, "testlist_comp", 0, 5, states_65, - "\000\040\040\200\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, + "\000\040\040\000\001\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, {322, "trailer", 0, 7, states_66, - "\000\040\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\020\000\000\000"}, + "\000\040\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\020\000\000\000"}, {323, "subscriptlist", 0, 3, states_67, - "\000\040\040\002\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, + "\000\040\040\002\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, {324, "subscript", 0, 5, states_68, - "\000\040\040\002\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, + "\000\040\040\002\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, {325, "sliceop", 0, 3, states_69, "\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {326, "exprlist", 0, 3, states_70, - "\000\040\040\200\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, + "\000\040\040\000\001\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, {327, "testlist", 0, 3, states_71, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, {328, "dictorsetmaker", 0, 11, states_72, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, {329, "classdef", 0, 8, states_73, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\004\000"}, {330, "arglist", 0, 8, states_74, - "\000\040\040\200\001\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, + "\000\040\040\000\003\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, {331, "argument", 0, 4, states_75, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, {332, "comp_iter", 0, 2, states_76, - "\000\000\000\000\000\000\000\000\000\000\000\020\001\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\040\002\000\000\000\000\000\000\000\000\000"}, {333, "comp_for", 0, 6, states_77, - "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000"}, {334, "comp_if", 0, 4, states_78, - "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000"}, {335, "encoding_decl", 0, 2, states_79, "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {336, "yield_expr", 0, 3, states_80, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000"}, {337, "yield_arg", 0, 3, states_81, - "\000\040\040\000\000\000\000\000\000\202\000\000\000\200\020\000\000\206\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\004\001\000\000\000\041\000\000\214\120\076\000\000"}, }; static label labels[169] = { {0, "EMPTY"}, @@ -2015,6 +2038,7 @@ {265, 0}, {22, 0}, {12, 0}, + {17, 0}, {16, 0}, {35, 0}, {266, 0}, @@ -2124,7 +2148,6 @@ {14, 0}, {15, 0}, {318, 0}, - {17, 0}, {24, 0}, {47, 0}, {31, 0}, diff --git a/Python/marshal.c b/Python/marshal.c --- a/Python/marshal.c +++ b/Python/marshal.c @@ -803,7 +803,7 @@ /* NULL is a valid return value, it does not necessarily means that an exception is set. */ PyObject *v, *v2; - Py_ssize_t idx; + Py_ssize_t idx = 0; long i, n; int type = r_byte(p); int flag; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 06:39:59 2013 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 20 Mar 2013 06:39:59 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Backed_out_changeset_52123?= =?utf-8?q?2b05b97?= Message-ID: <3ZW0MM32hvzSDw@mail.python.org> http://hg.python.org/cpython/rev/30001c8ee3a9 changeset: 82828:30001c8ee3a9 user: Benjamin Peterson date: Wed Mar 20 00:39:41 2013 -0500 summary: Backed out changeset 521232b05b97 files: Grammar/Grammar | 3 +- Python/graminit.c | 511 ++++++++++++++++----------------- Python/marshal.c | 2 +- 3 files changed, 246 insertions(+), 270 deletions(-) diff --git a/Grammar/Grammar b/Grammar/Grammar --- a/Grammar/Grammar +++ b/Grammar/Grammar @@ -24,8 +24,7 @@ decorated: decorators (classdef | funcdef) funcdef: 'def' NAME parameters ['->' test] ':' suite parameters: '(' [typedargslist] ')' -typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* - [',' '/' (',' tfpdef ['=' test])*] [',' +typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* [',' ['*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] | '**' tfpdef]] | '*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] | '**' tfpdef) tfpdef: NAME [':' test] diff --git a/Python/graminit.c b/Python/graminit.c --- a/Python/graminit.c +++ b/Python/graminit.c @@ -160,8 +160,8 @@ }; static arc arcs_8_0[3] = { {28, 1}, - {32, 2}, - {33, 3}, + {31, 2}, + {32, 3}, }; static arc arcs_8_1[3] = { {29, 4}, @@ -179,11 +179,10 @@ static arc arcs_8_4[1] = { {24, 9}, }; -static arc arcs_8_5[5] = { +static arc arcs_8_5[4] = { {28, 10}, {31, 11}, - {32, 12}, - {33, 3}, + {32, 3}, {0, 5}, }; static arc arcs_8_6[2] = { @@ -191,8 +190,8 @@ {0, 6}, }; static arc arcs_8_7[2] = { - {28, 13}, - {33, 3}, + {28, 12}, + {32, 3}, }; static arc arcs_8_8[1] = { {0, 8}, @@ -206,76 +205,54 @@ {29, 4}, {0, 10}, }; -static arc arcs_8_11[2] = { +static arc arcs_8_11[3] = { + {28, 13}, {30, 14}, {0, 11}, }; static arc arcs_8_12[3] = { - {28, 15}, - {30, 16}, + {30, 7}, + {29, 15}, {0, 12}, }; -static arc arcs_8_13[3] = { - {30, 7}, - {29, 17}, +static arc arcs_8_13[2] = { + {30, 14}, {0, 13}, }; -static arc arcs_8_14[4] = { - {28, 18}, - {32, 12}, - {33, 3}, - {0, 14}, +static arc arcs_8_14[2] = { + {28, 16}, + {32, 3}, }; -static arc arcs_8_15[2] = { - {30, 16}, - {0, 15}, +static arc arcs_8_15[1] = { + {24, 6}, }; -static arc arcs_8_16[2] = { - {28, 19}, - {33, 3}, +static arc arcs_8_16[3] = { + {30, 14}, + {29, 17}, + {0, 16}, }; static arc arcs_8_17[1] = { - {24, 6}, + {24, 13}, }; -static arc arcs_8_18[3] = { - {30, 14}, - {29, 20}, - {0, 18}, -}; -static arc arcs_8_19[3] = { - {30, 16}, - {29, 21}, - {0, 19}, -}; -static arc arcs_8_20[1] = { - {24, 11}, -}; -static arc arcs_8_21[1] = { - {24, 15}, -}; -static state states_8[22] = { +static state states_8[18] = { {3, arcs_8_0}, {3, arcs_8_1}, {3, arcs_8_2}, {1, arcs_8_3}, {1, arcs_8_4}, - {5, arcs_8_5}, + {4, arcs_8_5}, {2, arcs_8_6}, {2, arcs_8_7}, {1, arcs_8_8}, {2, arcs_8_9}, {3, arcs_8_10}, - {2, arcs_8_11}, + {3, arcs_8_11}, {3, arcs_8_12}, - {3, arcs_8_13}, - {4, arcs_8_14}, - {2, arcs_8_15}, - {2, arcs_8_16}, + {2, arcs_8_13}, + {2, arcs_8_14}, + {1, arcs_8_15}, + {3, arcs_8_16}, {1, arcs_8_17}, - {3, arcs_8_18}, - {3, arcs_8_19}, - {1, arcs_8_20}, - {1, arcs_8_21}, }; static arc arcs_9_0[1] = { {21, 1}, @@ -297,9 +274,9 @@ {1, arcs_9_3}, }; static arc arcs_10_0[3] = { - {35, 1}, - {32, 2}, - {33, 3}, + {34, 1}, + {31, 2}, + {32, 3}, }; static arc arcs_10_1[3] = { {29, 4}, @@ -307,20 +284,20 @@ {0, 1}, }; static arc arcs_10_2[3] = { - {35, 6}, + {34, 6}, {30, 7}, {0, 2}, }; static arc arcs_10_3[1] = { - {35, 8}, + {34, 8}, }; static arc arcs_10_4[1] = { {24, 9}, }; static arc arcs_10_5[4] = { - {35, 10}, - {32, 11}, - {33, 3}, + {34, 10}, + {31, 11}, + {32, 3}, {0, 5}, }; static arc arcs_10_6[2] = { @@ -328,8 +305,8 @@ {0, 6}, }; static arc arcs_10_7[2] = { - {35, 12}, - {33, 3}, + {34, 12}, + {32, 3}, }; static arc arcs_10_8[1] = { {0, 8}, @@ -344,7 +321,7 @@ {0, 10}, }; static arc arcs_10_11[3] = { - {35, 13}, + {34, 13}, {30, 14}, {0, 11}, }; @@ -358,8 +335,8 @@ {0, 13}, }; static arc arcs_10_14[2] = { - {35, 16}, - {33, 3}, + {34, 16}, + {32, 3}, }; static arc arcs_10_15[1] = { {24, 6}, @@ -414,14 +391,14 @@ {1, arcs_12_1}, }; static arc arcs_13_0[1] = { - {36, 1}, + {35, 1}, }; static arc arcs_13_1[2] = { - {37, 2}, + {36, 2}, {2, 3}, }; static arc arcs_13_2[2] = { - {36, 1}, + {35, 1}, {2, 3}, }; static arc arcs_13_3[1] = { @@ -434,6 +411,7 @@ {1, arcs_13_3}, }; static arc arcs_14_0[8] = { + {37, 1}, {38, 1}, {39, 1}, {40, 1}, @@ -441,7 +419,6 @@ {42, 1}, {43, 1}, {44, 1}, - {45, 1}, }; static arc arcs_14_1[1] = { {0, 1}, @@ -451,20 +428,20 @@ {1, arcs_14_1}, }; static arc arcs_15_0[1] = { - {46, 1}, + {45, 1}, }; static arc arcs_15_1[3] = { - {47, 2}, + {46, 2}, {29, 3}, {0, 1}, }; static arc arcs_15_2[2] = { - {48, 4}, + {47, 4}, {9, 4}, }; static arc arcs_15_3[2] = { - {48, 5}, - {46, 5}, + {47, 5}, + {45, 5}, }; static arc arcs_15_4[1] = { {0, 4}, @@ -483,7 +460,7 @@ }; static arc arcs_16_0[2] = { {24, 1}, - {49, 1}, + {48, 1}, }; static arc arcs_16_1[2] = { {30, 2}, @@ -491,7 +468,7 @@ }; static arc arcs_16_2[3] = { {24, 1}, - {49, 1}, + {48, 1}, {0, 2}, }; static state states_16[3] = { @@ -500,6 +477,7 @@ {3, arcs_16_2}, }; static arc arcs_17_0[12] = { + {49, 1}, {50, 1}, {51, 1}, {52, 1}, @@ -511,7 +489,6 @@ {58, 1}, {59, 1}, {60, 1}, - {61, 1}, }; static arc arcs_17_1[1] = { {0, 1}, @@ -521,10 +498,10 @@ {1, arcs_17_1}, }; static arc arcs_18_0[1] = { - {62, 1}, + {61, 1}, }; static arc arcs_18_1[1] = { - {63, 2}, + {62, 2}, }; static arc arcs_18_2[1] = { {0, 2}, @@ -535,7 +512,7 @@ {1, arcs_18_2}, }; static arc arcs_19_0[1] = { - {64, 1}, + {63, 1}, }; static arc arcs_19_1[1] = { {0, 1}, @@ -545,11 +522,11 @@ {1, arcs_19_1}, }; static arc arcs_20_0[5] = { + {64, 1}, {65, 1}, {66, 1}, {67, 1}, {68, 1}, - {69, 1}, }; static arc arcs_20_1[1] = { {0, 1}, @@ -559,7 +536,7 @@ {1, arcs_20_1}, }; static arc arcs_21_0[1] = { - {70, 1}, + {69, 1}, }; static arc arcs_21_1[1] = { {0, 1}, @@ -569,7 +546,7 @@ {1, arcs_21_1}, }; static arc arcs_22_0[1] = { - {71, 1}, + {70, 1}, }; static arc arcs_22_1[1] = { {0, 1}, @@ -579,7 +556,7 @@ {1, arcs_22_1}, }; static arc arcs_23_0[1] = { - {72, 1}, + {71, 1}, }; static arc arcs_23_1[2] = { {9, 2}, @@ -594,7 +571,7 @@ {1, arcs_23_2}, }; static arc arcs_24_0[1] = { - {48, 1}, + {47, 1}, }; static arc arcs_24_1[1] = { {0, 1}, @@ -604,14 +581,14 @@ {1, arcs_24_1}, }; static arc arcs_25_0[1] = { - {73, 1}, + {72, 1}, }; static arc arcs_25_1[2] = { {24, 2}, {0, 1}, }; static arc arcs_25_2[2] = { - {74, 3}, + {73, 3}, {0, 2}, }; static arc arcs_25_3[1] = { @@ -628,8 +605,8 @@ {1, arcs_25_4}, }; static arc arcs_26_0[2] = { + {74, 1}, {75, 1}, - {76, 1}, }; static arc arcs_26_1[1] = { {0, 1}, @@ -639,10 +616,10 @@ {1, arcs_26_1}, }; static arc arcs_27_0[1] = { - {77, 1}, + {76, 1}, }; static arc arcs_27_1[1] = { - {78, 2}, + {77, 2}, }; static arc arcs_27_2[1] = { {0, 2}, @@ -653,32 +630,32 @@ {1, arcs_27_2}, }; static arc arcs_28_0[1] = { - {74, 1}, + {73, 1}, }; static arc arcs_28_1[3] = { + {78, 2}, {79, 2}, - {80, 2}, {12, 3}, }; static arc arcs_28_2[4] = { + {78, 2}, {79, 2}, - {80, 2}, {12, 3}, - {77, 4}, + {76, 4}, }; static arc arcs_28_3[1] = { - {77, 4}, + {76, 4}, }; static arc arcs_28_4[3] = { - {32, 5}, + {31, 5}, {13, 6}, - {81, 5}, + {80, 5}, }; static arc arcs_28_5[1] = { {0, 5}, }; static arc arcs_28_6[1] = { - {81, 7}, + {80, 7}, }; static arc arcs_28_7[1] = { {15, 5}, @@ -697,7 +674,7 @@ {21, 1}, }; static arc arcs_29_1[2] = { - {83, 2}, + {82, 2}, {0, 1}, }; static arc arcs_29_2[1] = { @@ -716,7 +693,7 @@ {12, 1}, }; static arc arcs_30_1[2] = { - {83, 2}, + {82, 2}, {0, 1}, }; static arc arcs_30_2[1] = { @@ -732,14 +709,14 @@ {1, arcs_30_3}, }; static arc arcs_31_0[1] = { - {82, 1}, + {81, 1}, }; static arc arcs_31_1[2] = { {30, 2}, {0, 1}, }; static arc arcs_31_2[2] = { - {82, 1}, + {81, 1}, {0, 2}, }; static state states_31[3] = { @@ -748,7 +725,7 @@ {2, arcs_31_2}, }; static arc arcs_32_0[1] = { - {84, 1}, + {83, 1}, }; static arc arcs_32_1[2] = { {30, 0}, @@ -762,7 +739,7 @@ {21, 1}, }; static arc arcs_33_1[2] = { - {79, 0}, + {78, 0}, {0, 1}, }; static state states_33[2] = { @@ -770,7 +747,7 @@ {2, arcs_33_1}, }; static arc arcs_34_0[1] = { - {85, 1}, + {84, 1}, }; static arc arcs_34_1[1] = { {21, 2}, @@ -785,7 +762,7 @@ {2, arcs_34_2}, }; static arc arcs_35_0[1] = { - {86, 1}, + {85, 1}, }; static arc arcs_35_1[1] = { {21, 2}, @@ -800,7 +777,7 @@ {2, arcs_35_2}, }; static arc arcs_36_0[1] = { - {87, 1}, + {86, 1}, }; static arc arcs_36_1[1] = { {24, 2}, @@ -823,11 +800,11 @@ {1, arcs_36_4}, }; static arc arcs_37_0[8] = { + {87, 1}, {88, 1}, {89, 1}, {90, 1}, {91, 1}, - {92, 1}, {19, 1}, {18, 1}, {17, 1}, @@ -840,7 +817,7 @@ {1, arcs_37_1}, }; static arc arcs_38_0[1] = { - {93, 1}, + {92, 1}, }; static arc arcs_38_1[1] = { {24, 2}, @@ -852,8 +829,8 @@ {26, 4}, }; static arc arcs_38_4[3] = { - {94, 1}, - {95, 5}, + {93, 1}, + {94, 5}, {0, 4}, }; static arc arcs_38_5[1] = { @@ -876,7 +853,7 @@ {1, arcs_38_7}, }; static arc arcs_39_0[1] = { - {96, 1}, + {95, 1}, }; static arc arcs_39_1[1] = { {24, 2}, @@ -888,7 +865,7 @@ {26, 4}, }; static arc arcs_39_4[2] = { - {95, 5}, + {94, 5}, {0, 4}, }; static arc arcs_39_5[1] = { @@ -911,13 +888,13 @@ {1, arcs_39_7}, }; static arc arcs_40_0[1] = { - {97, 1}, + {96, 1}, }; static arc arcs_40_1[1] = { - {63, 2}, + {62, 2}, }; static arc arcs_40_2[1] = { - {98, 3}, + {97, 3}, }; static arc arcs_40_3[1] = { {9, 4}, @@ -929,7 +906,7 @@ {26, 6}, }; static arc arcs_40_6[2] = { - {95, 7}, + {94, 7}, {0, 6}, }; static arc arcs_40_7[1] = { @@ -954,7 +931,7 @@ {1, arcs_40_9}, }; static arc arcs_41_0[1] = { - {99, 1}, + {98, 1}, }; static arc arcs_41_1[1] = { {25, 2}, @@ -963,8 +940,8 @@ {26, 3}, }; static arc arcs_41_3[2] = { - {100, 4}, - {101, 5}, + {99, 4}, + {100, 5}, }; static arc arcs_41_4[1] = { {25, 6}, @@ -979,9 +956,9 @@ {26, 9}, }; static arc arcs_41_8[4] = { - {100, 4}, - {95, 10}, - {101, 5}, + {99, 4}, + {94, 10}, + {100, 5}, {0, 8}, }; static arc arcs_41_9[1] = { @@ -994,7 +971,7 @@ {26, 12}, }; static arc arcs_41_12[2] = { - {101, 5}, + {100, 5}, {0, 12}, }; static state states_41[13] = { @@ -1013,10 +990,10 @@ {2, arcs_41_12}, }; static arc arcs_42_0[1] = { - {102, 1}, + {101, 1}, }; static arc arcs_42_1[1] = { - {103, 2}, + {102, 2}, }; static arc arcs_42_2[2] = { {30, 1}, @@ -1039,11 +1016,11 @@ {24, 1}, }; static arc arcs_43_1[2] = { - {83, 2}, + {82, 2}, {0, 1}, }; static arc arcs_43_2[1] = { - {104, 3}, + {103, 3}, }; static arc arcs_43_3[1] = { {0, 3}, @@ -1055,14 +1032,14 @@ {1, arcs_43_3}, }; static arc arcs_44_0[1] = { - {105, 1}, + {104, 1}, }; static arc arcs_44_1[2] = { {24, 2}, {0, 1}, }; static arc arcs_44_2[2] = { - {83, 3}, + {82, 3}, {0, 2}, }; static arc arcs_44_3[1] = { @@ -1086,14 +1063,14 @@ {0, 1}, }; static arc arcs_45_2[1] = { - {106, 3}, + {105, 3}, }; static arc arcs_45_3[1] = { {6, 4}, }; static arc arcs_45_4[2] = { {6, 4}, - {107, 1}, + {106, 1}, }; static state states_45[5] = { {2, arcs_45_0}, @@ -1103,21 +1080,21 @@ {2, arcs_45_4}, }; static arc arcs_46_0[2] = { - {108, 1}, - {109, 2}, + {107, 1}, + {108, 2}, }; static arc arcs_46_1[2] = { - {93, 3}, + {92, 3}, {0, 1}, }; static arc arcs_46_2[1] = { {0, 2}, }; static arc arcs_46_3[1] = { - {108, 4}, + {107, 4}, }; static arc arcs_46_4[1] = { - {95, 5}, + {94, 5}, }; static arc arcs_46_5[1] = { {24, 2}, @@ -1131,8 +1108,8 @@ {1, arcs_46_5}, }; static arc arcs_47_0[2] = { - {108, 1}, - {111, 1}, + {107, 1}, + {110, 1}, }; static arc arcs_47_1[1] = { {0, 1}, @@ -1142,10 +1119,10 @@ {1, arcs_47_1}, }; static arc arcs_48_0[1] = { - {112, 1}, + {111, 1}, }; static arc arcs_48_1[2] = { - {34, 2}, + {33, 2}, {25, 3}, }; static arc arcs_48_2[1] = { @@ -1165,17 +1142,17 @@ {1, arcs_48_4}, }; static arc arcs_49_0[1] = { - {112, 1}, + {111, 1}, }; static arc arcs_49_1[2] = { - {34, 2}, + {33, 2}, {25, 3}, }; static arc arcs_49_2[1] = { {25, 3}, }; static arc arcs_49_3[1] = { - {110, 4}, + {109, 4}, }; static arc arcs_49_4[1] = { {0, 4}, @@ -1188,10 +1165,10 @@ {1, arcs_49_4}, }; static arc arcs_50_0[1] = { - {113, 1}, + {112, 1}, }; static arc arcs_50_1[2] = { - {114, 0}, + {113, 0}, {0, 1}, }; static state states_50[2] = { @@ -1199,10 +1176,10 @@ {2, arcs_50_1}, }; static arc arcs_51_0[1] = { - {115, 1}, + {114, 1}, }; static arc arcs_51_1[2] = { - {116, 0}, + {115, 0}, {0, 1}, }; static state states_51[2] = { @@ -1210,11 +1187,11 @@ {2, arcs_51_1}, }; static arc arcs_52_0[2] = { - {117, 1}, - {118, 2}, + {116, 1}, + {117, 2}, }; static arc arcs_52_1[1] = { - {115, 2}, + {114, 2}, }; static arc arcs_52_2[1] = { {0, 2}, @@ -1225,10 +1202,10 @@ {1, arcs_52_2}, }; static arc arcs_53_0[1] = { - {104, 1}, + {103, 1}, }; static arc arcs_53_1[2] = { - {119, 0}, + {118, 0}, {0, 1}, }; static state states_53[2] = { @@ -1236,25 +1213,25 @@ {2, arcs_53_1}, }; static arc arcs_54_0[10] = { + {119, 1}, {120, 1}, {121, 1}, {122, 1}, {123, 1}, {124, 1}, {125, 1}, - {126, 1}, - {98, 1}, - {117, 2}, - {127, 3}, + {97, 1}, + {116, 2}, + {126, 3}, }; static arc arcs_54_1[1] = { {0, 1}, }; static arc arcs_54_2[1] = { - {98, 1}, + {97, 1}, }; static arc arcs_54_3[2] = { - {117, 1}, + {116, 1}, {0, 3}, }; static state states_54[4] = { @@ -1264,10 +1241,10 @@ {2, arcs_54_3}, }; static arc arcs_55_0[1] = { - {32, 1}, + {31, 1}, }; static arc arcs_55_1[1] = { - {104, 2}, + {103, 2}, }; static arc arcs_55_2[1] = { {0, 2}, @@ -1278,10 +1255,10 @@ {1, arcs_55_2}, }; static arc arcs_56_0[1] = { - {128, 1}, + {127, 1}, }; static arc arcs_56_1[2] = { - {129, 0}, + {128, 0}, {0, 1}, }; static state states_56[2] = { @@ -1289,10 +1266,10 @@ {2, arcs_56_1}, }; static arc arcs_57_0[1] = { - {130, 1}, + {129, 1}, }; static arc arcs_57_1[2] = { - {131, 0}, + {130, 0}, {0, 1}, }; static state states_57[2] = { @@ -1300,10 +1277,10 @@ {2, arcs_57_1}, }; static arc arcs_58_0[1] = { - {132, 1}, + {131, 1}, }; static arc arcs_58_1[2] = { - {133, 0}, + {132, 0}, {0, 1}, }; static state states_58[2] = { @@ -1311,11 +1288,11 @@ {2, arcs_58_1}, }; static arc arcs_59_0[1] = { - {134, 1}, + {133, 1}, }; static arc arcs_59_1[3] = { + {134, 0}, {135, 0}, - {136, 0}, {0, 1}, }; static state states_59[2] = { @@ -1323,11 +1300,11 @@ {3, arcs_59_1}, }; static arc arcs_60_0[1] = { - {137, 1}, + {136, 1}, }; static arc arcs_60_1[3] = { + {137, 0}, {138, 0}, - {139, 0}, {0, 1}, }; static state states_60[2] = { @@ -1335,11 +1312,11 @@ {3, arcs_60_1}, }; static arc arcs_61_0[1] = { - {140, 1}, + {139, 1}, }; static arc arcs_61_1[5] = { - {32, 0}, {31, 0}, + {140, 0}, {141, 0}, {142, 0}, {0, 1}, @@ -1349,13 +1326,13 @@ {5, arcs_61_1}, }; static arc arcs_62_0[4] = { + {137, 1}, {138, 1}, - {139, 1}, {143, 1}, {144, 2}, }; static arc arcs_62_1[1] = { - {140, 2}, + {139, 2}, }; static arc arcs_62_2[1] = { {0, 2}, @@ -1370,11 +1347,11 @@ }; static arc arcs_63_1[3] = { {146, 1}, - {33, 2}, + {32, 2}, {0, 1}, }; static arc arcs_63_2[1] = { - {140, 3}, + {139, 3}, }; static arc arcs_63_3[1] = { {0, 3}, @@ -1392,13 +1369,13 @@ {21, 4}, {153, 4}, {154, 5}, - {80, 4}, + {79, 4}, {155, 4}, {156, 4}, {157, 4}, }; static arc arcs_64_1[3] = { - {48, 6}, + {47, 6}, {147, 6}, {15, 4}, }; @@ -1439,7 +1416,7 @@ }; static arc arcs_65_0[2] = { {24, 1}, - {49, 1}, + {48, 1}, }; static arc arcs_65_1[3] = { {158, 2}, @@ -1451,7 +1428,7 @@ }; static arc arcs_65_3[3] = { {24, 4}, - {49, 4}, + {48, 4}, {0, 3}, }; static arc arcs_65_4[2] = { @@ -1468,7 +1445,7 @@ static arc arcs_66_0[3] = { {13, 1}, {148, 2}, - {79, 3}, + {78, 3}, }; static arc arcs_66_1[2] = { {14, 4}, @@ -1557,16 +1534,16 @@ {1, arcs_69_2}, }; static arc arcs_70_0[2] = { - {104, 1}, - {49, 1}, + {103, 1}, + {48, 1}, }; static arc arcs_70_1[2] = { {30, 2}, {0, 1}, }; static arc arcs_70_2[3] = { - {104, 1}, - {49, 1}, + {103, 1}, + {48, 1}, {0, 2}, }; static state states_70[3] = { @@ -1683,8 +1660,8 @@ }; static arc arcs_74_0[3] = { {163, 1}, - {32, 2}, - {33, 3}, + {31, 2}, + {32, 3}, }; static arc arcs_74_1[2] = { {30, 4}, @@ -1698,8 +1675,8 @@ }; static arc arcs_74_4[4] = { {163, 1}, - {32, 2}, - {33, 3}, + {31, 2}, + {32, 3}, {0, 4}, }; static arc arcs_74_5[2] = { @@ -1711,7 +1688,7 @@ }; static arc arcs_74_7[2] = { {163, 5}, - {33, 3}, + {32, 3}, }; static state states_74[8] = { {3, arcs_74_0}, @@ -1755,16 +1732,16 @@ {1, arcs_76_1}, }; static arc arcs_77_0[1] = { - {97, 1}, + {96, 1}, }; static arc arcs_77_1[1] = { - {63, 2}, + {62, 2}, }; static arc arcs_77_2[1] = { - {98, 3}, + {97, 3}, }; static arc arcs_77_3[1] = { - {108, 4}, + {107, 4}, }; static arc arcs_77_4[2] = { {164, 5}, @@ -1782,10 +1759,10 @@ {1, arcs_77_5}, }; static arc arcs_78_0[1] = { - {93, 1}, + {92, 1}, }; static arc arcs_78_1[1] = { - {110, 2}, + {109, 2}, }; static arc arcs_78_2[2] = { {164, 3}, @@ -1826,7 +1803,7 @@ {1, arcs_80_2}, }; static arc arcs_81_0[2] = { - {74, 1}, + {73, 1}, {9, 2}, }; static arc arcs_81_1[1] = { @@ -1842,11 +1819,11 @@ }; static dfa dfas[82] = { {256, "single_input", 0, 3, states_0, - "\004\050\060\000\001\000\000\100\301\047\341\040\113\000\041\000\000\214\120\076\204\000"}, + "\004\050\060\200\000\000\000\240\340\223\160\220\045\200\020\000\000\206\120\076\204\000"}, {257, "file_input", 0, 2, states_1, - "\204\050\060\000\001\000\000\100\301\047\341\040\113\000\041\000\000\214\120\076\204\000"}, + "\204\050\060\200\000\000\000\240\340\223\160\220\045\200\020\000\000\206\120\076\204\000"}, {258, "eval_input", 0, 3, states_2, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {259, "decorator", 0, 7, states_3, "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {260, "decorators", 0, 2, states_4, @@ -1857,48 +1834,48 @@ "\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {263, "parameters", 0, 4, states_7, "\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {264, "typedargslist", 0, 22, states_8, - "\000\000\040\000\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {264, "typedargslist", 0, 18, states_8, + "\000\000\040\200\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {265, "tfpdef", 0, 4, states_9, "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {266, "varargslist", 0, 18, states_10, - "\000\000\040\000\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\040\200\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {267, "vfpdef", 0, 2, states_11, "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {268, "stmt", 0, 2, states_12, - "\000\050\060\000\001\000\000\100\301\047\341\040\113\000\041\000\000\214\120\076\204\000"}, + "\000\050\060\200\000\000\000\240\340\223\160\220\045\200\020\000\000\206\120\076\204\000"}, {269, "simple_stmt", 0, 4, states_13, - "\000\040\040\000\001\000\000\100\301\047\341\000\000\000\041\000\000\214\120\076\200\000"}, + "\000\040\040\200\000\000\000\240\340\223\160\000\000\200\020\000\000\206\120\076\200\000"}, {270, "small_stmt", 0, 2, states_14, - "\000\040\040\000\001\000\000\100\301\047\341\000\000\000\041\000\000\214\120\076\200\000"}, + "\000\040\040\200\000\000\000\240\340\223\160\000\000\200\020\000\000\206\120\076\200\000"}, {271, "expr_stmt", 0, 6, states_15, - "\000\040\040\000\001\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, + "\000\040\040\200\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {272, "testlist_star_expr", 0, 3, states_16, - "\000\040\040\000\001\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, + "\000\040\040\200\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {273, "augassign", 0, 2, states_17, - "\000\000\000\000\000\000\374\077\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\376\037\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {274, "del_stmt", 0, 3, states_18, - "\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {275, "pass_stmt", 0, 2, states_19, - "\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {276, "flow_stmt", 0, 2, states_20, - "\000\000\000\000\000\000\000\000\300\003\000\000\000\000\000\000\000\000\000\000\200\000"}, + "\000\000\000\000\000\000\000\000\340\001\000\000\000\000\000\000\000\000\000\000\200\000"}, {277, "break_stmt", 0, 2, states_21, + "\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {278, "continue_stmt", 0, 2, states_22, "\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {278, "continue_stmt", 0, 2, states_22, + {279, "return_stmt", 0, 3, states_23, "\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {279, "return_stmt", 0, 3, states_23, - "\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000"}, {280, "yield_stmt", 0, 2, states_24, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000"}, {281, "raise_stmt", 0, 5, states_25, + "\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000"}, + {282, "import_stmt", 0, 2, states_26, + "\000\000\000\000\000\000\000\000\000\022\000\000\000\000\000\000\000\000\000\000\000\000"}, + {283, "import_name", 0, 3, states_27, + "\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000"}, + {284, "import_from", 0, 8, states_28, "\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000"}, - {282, "import_stmt", 0, 2, states_26, - "\000\000\000\000\000\000\000\000\000\044\000\000\000\000\000\000\000\000\000\000\000\000"}, - {283, "import_name", 0, 3, states_27, - "\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000"}, - {284, "import_from", 0, 8, states_28, - "\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000"}, {285, "import_as_name", 0, 4, states_29, "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {286, "dotted_as_name", 0, 4, states_30, @@ -1910,101 +1887,101 @@ {289, "dotted_name", 0, 2, states_33, "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {290, "global_stmt", 0, 3, states_34, + "\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000"}, + {291, "nonlocal_stmt", 0, 3, states_35, "\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000"}, - {291, "nonlocal_stmt", 0, 3, states_35, + {292, "assert_stmt", 0, 5, states_36, "\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000"}, - {292, "assert_stmt", 0, 5, states_36, - "\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000"}, {293, "compound_stmt", 0, 2, states_37, - "\000\010\020\000\000\000\000\000\000\000\000\040\113\000\000\000\000\000\000\000\004\000"}, + "\000\010\020\000\000\000\000\000\000\000\000\220\045\000\000\000\000\000\000\000\004\000"}, {294, "if_stmt", 0, 8, states_38, - "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, {295, "while_stmt", 0, 8, states_39, + "\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000"}, + {296, "for_stmt", 0, 10, states_40, "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, - {296, "for_stmt", 0, 10, states_40, - "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000"}, {297, "try_stmt", 0, 13, states_41, - "\000\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000"}, {298, "with_stmt", 0, 5, states_42, - "\000\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000"}, {299, "with_item", 0, 4, states_43, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {300, "except_clause", 0, 5, states_44, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000"}, {301, "suite", 0, 5, states_45, - "\004\040\040\000\001\000\000\100\301\047\341\000\000\000\041\000\000\214\120\076\200\000"}, + "\004\040\040\200\000\000\000\240\340\223\160\000\000\200\020\000\000\206\120\076\200\000"}, {302, "test", 0, 6, states_46, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {303, "test_nocond", 0, 2, states_47, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {304, "lambdef", 0, 5, states_48, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000"}, {305, "lambdef_nocond", 0, 5, states_49, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000"}, {306, "or_test", 0, 2, states_50, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\040\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\020\000\000\206\120\076\000\000"}, {307, "and_test", 0, 2, states_51, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\040\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\020\000\000\206\120\076\000\000"}, {308, "not_test", 0, 3, states_52, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\040\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\020\000\000\206\120\076\000\000"}, {309, "comparison", 0, 2, states_53, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {310, "comp_op", 0, 4, states_54, - "\000\000\000\000\000\000\000\000\000\000\000\000\004\000\040\377\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\220\177\000\000\000\000\000\000"}, {311, "star_expr", 0, 3, states_55, - "\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {312, "expr", 0, 2, states_56, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {313, "xor_expr", 0, 2, states_57, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {314, "and_expr", 0, 2, states_58, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {315, "shift_expr", 0, 2, states_59, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {316, "arith_expr", 0, 2, states_60, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {317, "term", 0, 2, states_61, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {318, "factor", 0, 3, states_62, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {319, "power", 0, 4, states_63, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\120\076\000\000"}, {320, "atom", 0, 9, states_64, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\120\076\000\000"}, {321, "testlist_comp", 0, 5, states_65, - "\000\040\040\000\001\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, + "\000\040\040\200\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {322, "trailer", 0, 7, states_66, - "\000\040\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\020\000\000\000"}, + "\000\040\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\020\000\000\000"}, {323, "subscriptlist", 0, 3, states_67, - "\000\040\040\002\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, + "\000\040\040\002\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {324, "subscript", 0, 5, states_68, - "\000\040\040\002\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, + "\000\040\040\002\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {325, "sliceop", 0, 3, states_69, "\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {326, "exprlist", 0, 3, states_70, - "\000\040\040\000\001\000\000\000\000\000\001\000\000\000\000\000\000\214\120\076\000\000"}, + "\000\040\040\200\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {327, "testlist", 0, 3, states_71, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {328, "dictorsetmaker", 0, 11, states_72, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {329, "classdef", 0, 8, states_73, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\004\000"}, {330, "arglist", 0, 8, states_74, - "\000\040\040\000\003\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, + "\000\040\040\200\001\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {331, "argument", 0, 4, states_75, - "\000\040\040\000\000\000\000\000\000\000\001\000\000\000\041\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {332, "comp_iter", 0, 2, states_76, - "\000\000\000\000\000\000\000\000\000\000\000\040\002\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\020\001\000\000\000\000\000\000\000\000\000"}, {333, "comp_for", 0, 6, states_77, - "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, {334, "comp_if", 0, 4, states_78, - "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, {335, "encoding_decl", 0, 2, states_79, "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {336, "yield_expr", 0, 3, states_80, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000"}, {337, "yield_arg", 0, 3, states_81, - "\000\040\040\000\000\000\000\000\000\004\001\000\000\000\041\000\000\214\120\076\000\000"}, + "\000\040\040\000\000\000\000\000\000\202\000\000\000\200\020\000\000\206\120\076\000\000"}, }; static label labels[169] = { {0, "EMPTY"}, @@ -2038,7 +2015,6 @@ {265, 0}, {22, 0}, {12, 0}, - {17, 0}, {16, 0}, {35, 0}, {266, 0}, @@ -2148,6 +2124,7 @@ {14, 0}, {15, 0}, {318, 0}, + {17, 0}, {24, 0}, {47, 0}, {31, 0}, diff --git a/Python/marshal.c b/Python/marshal.c --- a/Python/marshal.c +++ b/Python/marshal.c @@ -803,7 +803,7 @@ /* NULL is a valid return value, it does not necessarily means that an exception is set. */ PyObject *v, *v2; - Py_ssize_t idx = 0; + Py_ssize_t idx; long i, n; int type = r_byte(p); int flag; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 06:40:19 2013 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 20 Mar 2013 06:40:19 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_fix_compiler_warning?= Message-ID: <3ZW0Ml0hkMzSHt@mail.python.org> http://hg.python.org/cpython/rev/511d17372402 changeset: 82829:511d17372402 user: Benjamin Peterson date: Wed Mar 20 00:40:07 2013 -0500 summary: fix compiler warning files: Python/marshal.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/marshal.c b/Python/marshal.c --- a/Python/marshal.c +++ b/Python/marshal.c @@ -803,7 +803,7 @@ /* NULL is a valid return value, it does not necessarily means that an exception is set. */ PyObject *v, *v2; - Py_ssize_t idx; + Py_ssize_t idx = 0; long i, n; int type = r_byte(p); int flag; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 07:27:24 2013 From: python-checkins at python.org (gregory.p.smith) Date: Wed, 20 Mar 2013 07:27:24 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Use_a_larger_a?= =?utf-8?q?mount_of_data_for_the_interrupted=5Fwrite_tests_so_that?= Message-ID: <3ZW1Q43rjzzSTf@mail.python.org> http://hg.python.org/cpython/rev/3876d86e2642 changeset: 82830:3876d86e2642 branch: 2.7 parent: 82814:be4bec689de3 user: Gregory P. Smith date: Tue Mar 19 23:21:03 2013 -0700 summary: Use a larger amount of data for the interrupted_write tests so that they work properly on systems configured with large pipe buffers. files: Lib/test/test_io.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -2880,7 +2880,7 @@ # The buffered IO layer must check for pending signal # handlers, which in this case will invoke alarm_interrupt(). self.assertRaises(ZeroDivisionError, - wio.write, item * (1024 * 1024)) + wio.write, item * (3 * 1000 * 1000)) t.join() # We got one byte, get another one and check that it isn't a # repeat of the first one. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 07:27:25 2013 From: python-checkins at python.org (gregory.p.smith) Date: Wed, 20 Mar 2013 07:27:25 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Use_a_larger_a?= =?utf-8?q?mount_of_data_for_tests_such_as_the_interrupted=5Fwrite?= Message-ID: <3ZW1Q56X5pzSQl@mail.python.org> http://hg.python.org/cpython/rev/993b7e0eb8be changeset: 82831:993b7e0eb8be branch: 3.3 parent: 82825:e1fdda86e937 user: Gregory P. Smith date: Tue Mar 19 23:25:16 2013 -0700 summary: Use a larger amount of data for tests such as the interrupted_write tests that depend on filling up an OS pipe so that they work properly on systems configured with large pipe buffers. files: Lib/subprocess.py | 7 +++++-- Lib/test/support.py | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -166,7 +166,7 @@ '/bin/ls' check_output(*popenargs, **kwargs): - Run command with arguments and return its output as a byte string. + Run command with arguments and return its output. If the exit code was non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode @@ -547,7 +547,7 @@ def check_output(*popenargs, timeout=None, **kwargs): - r"""Run command with arguments and return its output as a byte string. + r"""Run command with arguments and return its output. If the exit code was non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode @@ -565,6 +565,9 @@ ... "ls -l non_existent_file ; exit 0"], ... stderr=STDOUT) b'ls: non_existent_file: No such file or directory\n' + + If universal_newlines=True is passed, the return value will be a + string rather than bytes. """ if 'stdout' in kwargs: raise ValueError('stdout argument not allowed, it will be overridden.') diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -574,9 +574,9 @@ # A constant likely larger than the underlying OS pipe buffer size. -# Windows limit seems to be around 512B, and most Unix kernels have a 64K pipe -# buffer size: take 1M to be sure. -PIPE_MAX_SIZE = 1024 * 1024 +# Windows limit seems to be around 512B, and many Unix kernels have a 64K pipe +# buffer size or 16*PAGE_SIZE: take a few megs to be sure. This +PIPE_MAX_SIZE = 3 * 1000 * 1000 # decorator for skipping tests on non-IEEE 754 platforms -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 07:27:27 2013 From: python-checkins at python.org (gregory.p.smith) Date: Wed, 20 Mar 2013 07:27:27 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Use_a_larger_amount_of_data_for_tests_such_as_the_interr?= =?utf-8?q?upted=5Fwrite?= Message-ID: <3ZW1Q72F4KzSTf@mail.python.org> http://hg.python.org/cpython/rev/ee30400efceb changeset: 82832:ee30400efceb parent: 82829:511d17372402 parent: 82831:993b7e0eb8be user: Gregory P. Smith date: Tue Mar 19 23:27:09 2013 -0700 summary: Use a larger amount of data for tests such as the interrupted_write tests that depend on filling up an OS pipe so that they work properly on systems configured with large pipe buffers. Also a subprocess docstring update that i forgot was in my client when i did the original 3.3 commit... easier to just leave that in here with this one than go back and undo/redo. files: Lib/subprocess.py | 7 +++++-- Lib/test/support.py | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -166,7 +166,7 @@ '/bin/ls' check_output(*popenargs, **kwargs): - Run command with arguments and return its output as a byte string. + Run command with arguments and return its output. If the exit code was non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode @@ -545,7 +545,7 @@ def check_output(*popenargs, timeout=None, **kwargs): - r"""Run command with arguments and return its output as a byte string. + r"""Run command with arguments and return its output. If the exit code was non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode @@ -563,6 +563,9 @@ ... "ls -l non_existent_file ; exit 0"], ... stderr=STDOUT) b'ls: non_existent_file: No such file or directory\n' + + If universal_newlines=True is passed, the return value will be a + string rather than bytes. """ if 'stdout' in kwargs: raise ValueError('stdout argument not allowed, it will be overridden.') diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -576,9 +576,9 @@ # A constant likely larger than the underlying OS pipe buffer size. -# Windows limit seems to be around 512B, and most Unix kernels have a 64K pipe -# buffer size: take 1M to be sure. -PIPE_MAX_SIZE = 1024 * 1024 +# Windows limit seems to be around 512B, and many Unix kernels have a 64K pipe +# buffer size or 16*PAGE_SIZE: take a few megs to be sure. This +PIPE_MAX_SIZE = 3 * 1000 * 1000 # decorator for skipping tests on non-IEEE 754 platforms -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 07:37:08 2013 From: python-checkins at python.org (gregory.p.smith) Date: Wed, 20 Mar 2013 07:37:08 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_clarifiy_the_d?= =?utf-8?q?ocumentation_for_issue17285=2E_see_also_commit?= Message-ID: <3ZW1dJ19yJzRJ6@mail.python.org> http://hg.python.org/cpython/rev/f4accfad1bf6 changeset: 82833:f4accfad1bf6 branch: 3.3 parent: 82831:993b7e0eb8be user: Gregory P. Smith date: Tue Mar 19 23:36:31 2013 -0700 summary: clarifiy the documentation for issue17285. see also commit ee30400efceb which updated the docstring. files: Doc/library/subprocess.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -118,7 +118,7 @@ .. function:: check_output(args, *, stdin=None, stderr=None, shell=False, universal_newlines=False, timeout=None) - Run command with arguments and return its output as a byte string. + Run command with arguments and return its output. If the return code was non-zero it raises a :exc:`CalledProcessError`. The :exc:`CalledProcessError` object will have the return code in the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 07:37:09 2013 From: python-checkins at python.org (gregory.p.smith) Date: Wed, 20 Mar 2013 07:37:09 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_clarifiy_the_documentation_for_issue17285=2E_see_also_co?= =?utf-8?q?mmit?= Message-ID: <3ZW1dK42gszSVk@mail.python.org> http://hg.python.org/cpython/rev/d31cab1dabae changeset: 82834:d31cab1dabae parent: 82832:ee30400efceb parent: 82833:f4accfad1bf6 user: Gregory P. Smith date: Tue Mar 19 23:36:59 2013 -0700 summary: clarifiy the documentation for issue17285. see also commit ee30400efceb which updated the docstring. files: Doc/library/subprocess.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -118,7 +118,7 @@ .. function:: check_output(args, *, stdin=None, stderr=None, shell=False, universal_newlines=False, timeout=None) - Run command with arguments and return its output as a byte string. + Run command with arguments and return its output. If the return code was non-zero it raises a :exc:`CalledProcessError`. The :exc:`CalledProcessError` object will have the return code in the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 12:54:44 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 20 Mar 2013 12:54:44 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_Fix_usage_of_a?= =?utf-8?q?rgument/parameter_and_markup=2E?= Message-ID: <3ZW8gm0jPbzS2q@mail.python.org> http://hg.python.org/cpython/rev/5cbb3bcdb390 changeset: 82835:5cbb3bcdb390 branch: 3.2 parent: 82808:ae9aea1b3546 user: Ezio Melotti date: Wed Mar 20 13:53:32 2013 +0200 summary: Fix usage of argument/parameter and markup. files: Doc/library/email.mime.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/email.mime.rst b/Doc/library/email.mime.rst --- a/Doc/library/email.mime.rst +++ b/Doc/library/email.mime.rst @@ -116,7 +116,7 @@ this data can be decoded by the standard Python module :mod:`sndhdr`, then the subtype will be automatically included in the :mailheader:`Content-Type` header. Otherwise you can explicitly specify the audio subtype via the *_subtype* - parameter. If the minor type could not be guessed and *_subtype* was not given, + argument. If the minor type could not be guessed and *_subtype* was not given, then :exc:`TypeError` is raised. Optional *_encoder* is a callable (i.e. function) which will perform the actual @@ -142,7 +142,7 @@ this data can be decoded by the standard Python module :mod:`imghdr`, then the subtype will be automatically included in the :mailheader:`Content-Type` header. Otherwise you can explicitly specify the image subtype via the *_subtype* - parameter. If the minor type could not be guessed and *_subtype* was not given, + argument. If the minor type could not be guessed and *_subtype* was not given, then :exc:`TypeError` is raised. Optional *_encoder* is a callable (i.e. function) which will perform the actual @@ -183,11 +183,11 @@ :class:`MIMEText` class is used to create MIME objects of major type :mimetype:`text`. *_text* is the string for the payload. *_subtype* is the minor type and defaults to :mimetype:`plain`. *_charset* is the character - set of the text and is passed as a parameter to the + set of the text and is passed as an argument to the :class:`~email.mime.nonmultipart.MIMENonMultipart` constructor; it defaults to ``us-ascii``. - Unless the ``_charset`` parameter is explicitly set to ``None``, the + Unless the *_charset* argument is explicitly set to ``None``, the MIMEText object created will have both a :mailheader:`Content-Type` header with a ``charset`` parameter, and a :mailheader:`Content-Transfer-Endcoding` header. This means that a subsequent ``set_payload`` call will not result -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 12:54:45 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 20 Mar 2013 12:54:45 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_usage_of_argument/parameter_and_markup_fixes_from_3=2E2?= =?utf-8?q?=2E?= Message-ID: <3ZW8gn3n2GzSHC@mail.python.org> http://hg.python.org/cpython/rev/30dcb8dbd495 changeset: 82836:30dcb8dbd495 branch: 3.3 parent: 82833:f4accfad1bf6 parent: 82835:5cbb3bcdb390 user: Ezio Melotti date: Wed Mar 20 13:54:18 2013 +0200 summary: Merge usage of argument/parameter and markup fixes from 3.2. files: Doc/library/email.mime.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/email.mime.rst b/Doc/library/email.mime.rst --- a/Doc/library/email.mime.rst +++ b/Doc/library/email.mime.rst @@ -116,7 +116,7 @@ this data can be decoded by the standard Python module :mod:`sndhdr`, then the subtype will be automatically included in the :mailheader:`Content-Type` header. Otherwise you can explicitly specify the audio subtype via the *_subtype* - parameter. If the minor type could not be guessed and *_subtype* was not given, + argument. If the minor type could not be guessed and *_subtype* was not given, then :exc:`TypeError` is raised. Optional *_encoder* is a callable (i.e. function) which will perform the actual @@ -142,7 +142,7 @@ this data can be decoded by the standard Python module :mod:`imghdr`, then the subtype will be automatically included in the :mailheader:`Content-Type` header. Otherwise you can explicitly specify the image subtype via the *_subtype* - parameter. If the minor type could not be guessed and *_subtype* was not given, + argument. If the minor type could not be guessed and *_subtype* was not given, then :exc:`TypeError` is raised. Optional *_encoder* is a callable (i.e. function) which will perform the actual @@ -183,12 +183,12 @@ :class:`MIMEText` class is used to create MIME objects of major type :mimetype:`text`. *_text* is the string for the payload. *_subtype* is the minor type and defaults to :mimetype:`plain`. *_charset* is the character - set of the text and is passed as a parameter to the + set of the text and is passed as an argument to the :class:`~email.mime.nonmultipart.MIMENonMultipart` constructor; it defaults to ``us-ascii`` if the string contains only ``ascii`` codepoints, and ``utf-8`` otherwise. - Unless the ``_charset`` parameter is explicitly set to ``None``, the + Unless the *_charset* argument is explicitly set to ``None``, the MIMEText object created will have both a :mailheader:`Content-Type` header with a ``charset`` parameter, and a :mailheader:`Content-Transfer-Endcoding` header. This means that a subsequent ``set_payload`` call will not result -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 12:54:46 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 20 Mar 2013 12:54:46 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_usage_of_argument/parameter_and_markup_fixes_from_?= =?utf-8?q?3=2E3=2E?= Message-ID: <3ZW8gp6KFvzSQL@mail.python.org> http://hg.python.org/cpython/rev/a6e6efa2f4dd changeset: 82837:a6e6efa2f4dd parent: 82834:d31cab1dabae parent: 82836:30dcb8dbd495 user: Ezio Melotti date: Wed Mar 20 13:54:30 2013 +0200 summary: Merge usage of argument/parameter and markup fixes from 3.3. files: Doc/library/email.mime.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/email.mime.rst b/Doc/library/email.mime.rst --- a/Doc/library/email.mime.rst +++ b/Doc/library/email.mime.rst @@ -116,7 +116,7 @@ this data can be decoded by the standard Python module :mod:`sndhdr`, then the subtype will be automatically included in the :mailheader:`Content-Type` header. Otherwise you can explicitly specify the audio subtype via the *_subtype* - parameter. If the minor type could not be guessed and *_subtype* was not given, + argument. If the minor type could not be guessed and *_subtype* was not given, then :exc:`TypeError` is raised. Optional *_encoder* is a callable (i.e. function) which will perform the actual @@ -142,7 +142,7 @@ this data can be decoded by the standard Python module :mod:`imghdr`, then the subtype will be automatically included in the :mailheader:`Content-Type` header. Otherwise you can explicitly specify the image subtype via the *_subtype* - parameter. If the minor type could not be guessed and *_subtype* was not given, + argument. If the minor type could not be guessed and *_subtype* was not given, then :exc:`TypeError` is raised. Optional *_encoder* is a callable (i.e. function) which will perform the actual @@ -183,12 +183,12 @@ :class:`MIMEText` class is used to create MIME objects of major type :mimetype:`text`. *_text* is the string for the payload. *_subtype* is the minor type and defaults to :mimetype:`plain`. *_charset* is the character - set of the text and is passed as a parameter to the + set of the text and is passed as an argument to the :class:`~email.mime.nonmultipart.MIMENonMultipart` constructor; it defaults to ``us-ascii`` if the string contains only ``ascii`` codepoints, and ``utf-8`` otherwise. - Unless the ``_charset`` parameter is explicitly set to ``None``, the + Unless the *_charset* argument is explicitly set to ``None``, the MIMEText object created will have both a :mailheader:`Content-Type` header with a ``charset`` parameter, and a :mailheader:`Content-Transfer-Endcoding` header. This means that a subsequent ``set_payload`` call will not result -- Repository URL: http://hg.python.org/cpython From eliben at gmail.com Wed Mar 20 13:23:43 2013 From: eliben at gmail.com (Eli Bendersky) Date: Wed, 20 Mar 2013 05:23:43 -0700 Subject: [Python-checkins] cpython: Issue #13248: removed deprecated and undocumented difflib.isbjunk, isbpopular. In-Reply-To: <3ZVrTH23v4zPCm@mail.python.org> References: <3ZVrTH23v4zPCm@mail.python.org> Message-ID: A mention in Misc/NEWS can't hurt here, Terry. Even though it's undocumented, some old code could rely on it being there and this code will break with the transition to 3.4 Eli On Tue, Mar 19, 2013 at 4:44 PM, terry.reedy wrote: > http://hg.python.org/cpython/rev/612d8bbcfa3a > changeset: 82807:612d8bbcfa3a > user: Terry Jan Reedy > date: Tue Mar 19 19:44:04 2013 -0400 > summary: > Issue #13248: removed deprecated and undocumented difflib.isbjunk, > isbpopular. > > files: > Lib/difflib.py | 14 -------------- > 1 files changed, 0 insertions(+), 14 deletions(-) > > > diff --git a/Lib/difflib.py b/Lib/difflib.py > --- a/Lib/difflib.py > +++ b/Lib/difflib.py > @@ -336,20 +336,6 @@ > for elt in popular: # ditto; as fast for 1% deletion > del b2j[elt] > > - def isbjunk(self, item): > - "Deprecated; use 'item in SequenceMatcher().bjunk'." > - warnings.warn("'SequenceMatcher().isbjunk(item)' is deprecated;\n" > - "use 'item in SMinstance.bjunk' instead.", > - DeprecationWarning, 2) > - return item in self.bjunk > - > - def isbpopular(self, item): > - "Deprecated; use 'item in SequenceMatcher().bpopular'." > - warnings.warn("'SequenceMatcher().isbpopular(item)' is > deprecated;\n" > - "use 'item in SMinstance.bpopular' instead.", > - DeprecationWarning, 2) > - return item in self.bpopular > - > def find_longest_match(self, alo, ahi, blo, bhi): > """Find longest matching block in a[alo:ahi] and b[blo:bhi]. > > > -- > Repository URL: http://hg.python.org/cpython > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From python-checkins at python.org Wed Mar 20 16:21:36 2013 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 20 Mar 2013 16:21:36 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Fix_to_schedule=28=29_pseudo-?= =?utf-8?q?code_by_Yuval_Greenfield=2E?= Message-ID: <3ZWFGS1G6XzSJF@mail.python.org> http://hg.python.org/peps/rev/6505bfc65a6d changeset: 4812:6505bfc65a6d user: Guido van Rossum date: Wed Mar 20 08:21:20 2013 -0700 summary: Fix to schedule() pseudo-code by Yuval Greenfield. files: pep-0342.txt | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/pep-0342.txt b/pep-0342.txt --- a/pep-0342.txt +++ b/pep-0342.txt @@ -486,8 +486,9 @@ def stop(self): self.running = False - def schedule(self, coroutine, stack=(), value=None, *exc): + def schedule(self, coroutine, stack=(), val=None, *exc): def resume(): + value = val try: if exc: value = coroutine.throw(value,*exc) -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Wed Mar 20 17:18:10 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 20 Mar 2013 17:18:10 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3NDkzOiByZS1l?= =?utf-8?q?nable_a_test_on_Windows=2E__Patch_by_Zachary_Ware=2E?= Message-ID: <3ZWGWk5qcszPQ0@mail.python.org> http://hg.python.org/cpython/rev/54ee934400b3 changeset: 82838:54ee934400b3 branch: 3.2 parent: 82835:5cbb3bcdb390 user: Ezio Melotti date: Wed Mar 20 18:14:48 2013 +0200 summary: #17493: re-enable a test on Windows. Patch by Zachary Ware. files: Lib/test/test_sys.py | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -237,9 +237,6 @@ def test_recursionlimit_fatalerror(self): # A fatal error occurs if a second recursion limit is hit when recovering # from a first one. - if os.name == "nt": - raise unittest.SkipTest( - "under Windows, test would generate a spurious crash dialog") code = textwrap.dedent(""" import sys @@ -251,14 +248,15 @@ sys.setrecursionlimit(%d) f()""") - for i in (50, 1000): - sub = subprocess.Popen([sys.executable, '-c', code % i], - stderr=subprocess.PIPE) - err = sub.communicate()[1] - self.assertTrue(sub.returncode, sub.returncode) - self.assertTrue( - b"Fatal Python error: Cannot recover from stack overflow" in err, - err) + with test.support.suppress_crash_popup(): + for i in (50, 1000): + sub = subprocess.Popen([sys.executable, '-c', code % i], + stderr=subprocess.PIPE) + err = sub.communicate()[1] + self.assertTrue(sub.returncode, sub.returncode) + self.assertIn( + b"Fatal Python error: Cannot recover from stack overflow", + err) def test_getwindowsversion(self): # Raise SkipTest if sys doesn't have getwindowsversion attribute -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 17:18:12 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 20 Mar 2013 17:18:12 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2317493=3A_merge_with_3=2E2=2E?= Message-ID: <3ZWGWm1RV3zRK7@mail.python.org> http://hg.python.org/cpython/rev/8d22b6ed44e6 changeset: 82839:8d22b6ed44e6 branch: 3.3 parent: 82836:30dcb8dbd495 parent: 82838:54ee934400b3 user: Ezio Melotti date: Wed Mar 20 18:15:37 2013 +0200 summary: #17493: merge with 3.2. files: Lib/test/test_sys.py | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -237,9 +237,6 @@ def test_recursionlimit_fatalerror(self): # A fatal error occurs if a second recursion limit is hit when recovering # from a first one. - if os.name == "nt": - raise unittest.SkipTest( - "under Windows, test would generate a spurious crash dialog") code = textwrap.dedent(""" import sys @@ -251,14 +248,15 @@ sys.setrecursionlimit(%d) f()""") - for i in (50, 1000): - sub = subprocess.Popen([sys.executable, '-c', code % i], - stderr=subprocess.PIPE) - err = sub.communicate()[1] - self.assertTrue(sub.returncode, sub.returncode) - self.assertTrue( - b"Fatal Python error: Cannot recover from stack overflow" in err, - err) + with test.support.suppress_crash_popup(): + for i in (50, 1000): + sub = subprocess.Popen([sys.executable, '-c', code % i], + stderr=subprocess.PIPE) + err = sub.communicate()[1] + self.assertTrue(sub.returncode, sub.returncode) + self.assertIn( + b"Fatal Python error: Cannot recover from stack overflow", + err) def test_getwindowsversion(self): # Raise SkipTest if sys doesn't have getwindowsversion attribute -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 17:18:13 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 20 Mar 2013 17:18:13 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3NDkzOiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZWGWn4QPszR3f@mail.python.org> http://hg.python.org/cpython/rev/2873f4971281 changeset: 82840:2873f4971281 parent: 82837:a6e6efa2f4dd parent: 82839:8d22b6ed44e6 user: Ezio Melotti date: Wed Mar 20 18:16:05 2013 +0200 summary: #17493: merge with 3.3. files: Lib/test/test_sys.py | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -239,9 +239,6 @@ def test_recursionlimit_fatalerror(self): # A fatal error occurs if a second recursion limit is hit when recovering # from a first one. - if os.name == "nt": - raise unittest.SkipTest( - "under Windows, test would generate a spurious crash dialog") code = textwrap.dedent(""" import sys @@ -253,14 +250,15 @@ sys.setrecursionlimit(%d) f()""") - for i in (50, 1000): - sub = subprocess.Popen([sys.executable, '-c', code % i], - stderr=subprocess.PIPE) - err = sub.communicate()[1] - self.assertTrue(sub.returncode, sub.returncode) - self.assertTrue( - b"Fatal Python error: Cannot recover from stack overflow" in err, - err) + with test.support.suppress_crash_popup(): + for i in (50, 1000): + sub = subprocess.Popen([sys.executable, '-c', code % i], + stderr=subprocess.PIPE) + err = sub.communicate()[1] + self.assertTrue(sub.returncode, sub.returncode) + self.assertIn( + b"Fatal Python error: Cannot recover from stack overflow", + err) def test_getwindowsversion(self): # Raise SkipTest if sys doesn't have getwindowsversion attribute -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 18:48:10 2013 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 20 Mar 2013 18:48:10 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogc2l0ZS5weSBpcyBu?= =?utf-8?q?eeded_to_set_up_paths?= Message-ID: <3ZWJWZ3m1DzR4n@mail.python.org> http://hg.python.org/cpython/rev/1987166ef586 changeset: 82841:1987166ef586 branch: 2.7 parent: 82830:3876d86e2642 user: Benjamin Peterson date: Wed Mar 20 12:47:57 2013 -0500 summary: site.py is needed to set up paths files: Lib/test/test_multiprocessing.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -2427,7 +2427,7 @@ prog = ('from test.test_multiprocessing import TestFlags; ' + 'TestFlags.run_in_child()') data = subprocess.check_output( - [sys.executable, '-E', '-S', '-O', '-c', prog]) + [sys.executable, '-E', '-B', '-O', '-c', prog]) child_flags, grandchild_flags = json.loads(data.decode('ascii')) self.assertEqual(child_flags, grandchild_flags) # -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 19:11:18 2013 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 20 Mar 2013 19:11:18 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_this_obviously?= =?utf-8?q?_is_not_going_to_raise_any_-3_warnings?= Message-ID: <3ZWK2G0lYDzSJs@mail.python.org> http://hg.python.org/cpython/rev/15deaa6e33a8 changeset: 82842:15deaa6e33a8 branch: 2.7 user: Benjamin Peterson date: Wed Mar 20 13:10:41 2013 -0500 summary: this obviously is not going to raise any -3 warnings files: Lib/test/test_struct.py | 15 ++++++--------- 1 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -497,15 +497,12 @@ self.test_unpack_from(cls=buffer) def test_unpack_with_memoryview(self): - with check_py3k_warnings(("buffer.. not supported in 3.x", - DeprecationWarning)): - # SF bug 1563759: struct.unpack doesn't support buffer protocol objects - data1 = memoryview('\x12\x34\x56\x78') - for data in [data1,]: - value, = struct.unpack('>I', data) - self.assertEqual(value, 0x12345678) - - self.test_unpack_from(cls=memoryview) + # SF bug 1563759: struct.unpack doesn't support buffer protocol objects + data1 = memoryview('\x12\x34\x56\x78') + for data in [data1,]: + value, = struct.unpack('>I', data) + self.assertEqual(value, 0x12345678) + self.test_unpack_from(cls=memoryview) def test_bool(self): class ExplodingBool(object): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 19:11:19 2013 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 20 Mar 2013 19:11:19 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_fix_issue_refe?= =?utf-8?q?rence?= Message-ID: <3ZWK2H3mthzSlX@mail.python.org> http://hg.python.org/cpython/rev/71adf21421d9 changeset: 82843:71adf21421d9 branch: 2.7 user: Benjamin Peterson date: Wed Mar 20 13:11:04 2013 -0500 summary: fix issue reference files: Lib/test/test_struct.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -497,7 +497,7 @@ self.test_unpack_from(cls=buffer) def test_unpack_with_memoryview(self): - # SF bug 1563759: struct.unpack doesn't support buffer protocol objects + # Bug 10212: struct.unpack doesn't support new buffer protocol objects data1 = memoryview('\x12\x34\x56\x78') for data in [data1,]: value, = struct.unpack('>I', data) -- Repository URL: http://hg.python.org/cpython From rdmurray at bitdance.com Wed Mar 20 19:13:20 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Wed, 20 Mar 2013 14:13:20 -0400 Subject: [Python-checkins] [Python-Dev] cpython: Issue #13248: removed deprecated and undocumented difflib.isbjunk, isbpopular. In-Reply-To: References: <3ZVrTH23v4zPCm@mail.python.org> Message-ID: <20130320181320.5B45C2500B3@webabinitio.net> On Wed, 20 Mar 2013 05:23:43 -0700, Eli Bendersky wrote: > A mention in Misc/NEWS can't hurt here, Terry. Even though it's > undocumented, some old code could rely on it being there and this code will > break with the transition to 3.4 Note that we also have a list of deprecated things that were removed in What's New. Aside: given the 3.3 experience, I think people should be thinking in terms of always updating What's New when appropriate, at the time a commit is made. --David From python-checkins at python.org Wed Mar 20 20:21:04 2013 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 20 Mar 2013 20:21:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2316997=3A_unittest?= =?utf-8?q?=2ETestCase_now_provides_a_subTest=28=29_context_manager_to?= Message-ID: <3ZWLZm14RPzSsL@mail.python.org> http://hg.python.org/cpython/rev/5c09e1c57200 changeset: 82844:5c09e1c57200 parent: 82840:2873f4971281 user: Antoine Pitrou date: Wed Mar 20 20:16:47 2013 +0100 summary: Issue #16997: unittest.TestCase now provides a subTest() context manager to procedurally generate, in an easy way, small test instances. files: Doc/library/unittest.rst | 93 ++++++ Lib/test/test_socket.py | 4 - Lib/unittest/case.py | 252 +++++++++++----- Lib/unittest/result.py | 16 + Lib/unittest/test/support.py | 38 ++- Lib/unittest/test/test_case.py | 94 ++++++- Lib/unittest/test/test_result.py | 58 +++ Lib/unittest/test/test_runner.py | 12 +- Lib/unittest/test/test_skipping.py | 74 ++++ Misc/NEWS | 3 + 10 files changed, 539 insertions(+), 105 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -556,6 +556,68 @@ Skipped classes will not have :meth:`setUpClass` or :meth:`tearDownClass` run. +.. _subtests: + +Distinguishing test iterations using subtests +--------------------------------------------- + +.. versionadded:: 3.4 + +When some of your tests differ only by a some very small differences, for +instance some parameters, unittest allows you to distinguish them inside +the body of a test method using the :meth:`~TestCase.subTest` context manager. + +For example, the following test:: + + class NumbersTest(unittest.TestCase): + + def test_even(self): + """ + Test that numbers between 0 and 5 are all even. + """ + for i in range(0, 6): + with self.subTest(i=i): + self.assertEqual(i % 2, 0) + +will produce the following output:: + + ====================================================================== + FAIL: test_even (__main__.NumbersTest) (i=1) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "subtests.py", line 32, in test_even + self.assertEqual(i % 2, 0) + AssertionError: 1 != 0 + + ====================================================================== + FAIL: test_even (__main__.NumbersTest) (i=3) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "subtests.py", line 32, in test_even + self.assertEqual(i % 2, 0) + AssertionError: 1 != 0 + + ====================================================================== + FAIL: test_even (__main__.NumbersTest) (i=5) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "subtests.py", line 32, in test_even + self.assertEqual(i % 2, 0) + AssertionError: 1 != 0 + +Without using a subtest, execution would stop after the first failure, +and the error would be less easy to diagnose because the value of ``i`` +wouldn't be displayed:: + + ====================================================================== + FAIL: test_even (__main__.NumbersTest) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "subtests.py", line 32, in test_even + self.assertEqual(i % 2, 0) + AssertionError: 1 != 0 + + .. _unittest-contents: Classes and functions @@ -669,6 +731,21 @@ .. versionadded:: 3.1 + .. method:: subTest(msg=None, **params) + + Return a context manager which executes the enclosed code block as a + subtest. *msg* and *params* are optional, arbitrary values which are + displayed whenever a subtest fails, allowing you to identify them + clearly. + + A test case can contain any number of subtest declarations, and + they can be arbitrarily nested. + + See :ref:`subtests` for more information. + + .. versionadded:: 3.4 + + .. method:: debug() Run the test without collecting the result. This allows exceptions raised @@ -1733,6 +1810,22 @@ :attr:`unexpectedSuccesses` attribute. + .. method:: addSubTest(test, subtest, outcome) + + Called when a subtest finishes. *test* is the test case + corresponding to the test method. *subtest* is a custom + :class:`TestCase` instance describing the subtest. + + If *outcome* is :const:`None`, the subtest succeeded. Otherwise, + it failed with an exception where *outcome* is a tuple of the form + returned by :func:`sys.exc_info`: ``(type, value, traceback)``. + + The default implementation does nothing when the outcome is a + success, and records subtest failures as normal failures. + + .. versionadded:: 3.4 + + .. class:: TextTestResult(stream, descriptions, verbosity) A concrete implementation of :class:`TestResult` used by the diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -2,7 +2,6 @@ import unittest from test import support -from unittest.case import _ExpectedFailure import errno import io @@ -272,9 +271,6 @@ raise TypeError("test_func must be a callable function") try: test_func() - except _ExpectedFailure: - # We deliberately ignore expected failures - pass except BaseException as e: self.queue.put(e) finally: diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -7,6 +7,7 @@ import re import warnings import collections +import contextlib from . import result from .util import (strclass, safe_repr, _count_diff_all_purpose, @@ -26,17 +27,11 @@ instead of raising this directly. """ -class _ExpectedFailure(Exception): +class _ShouldStop(Exception): """ - Raise this when a test is expected to fail. - - This is an implementation detail. + The test should stop. """ - def __init__(self, exc_info): - super(_ExpectedFailure, self).__init__() - self.exc_info = exc_info - class _UnexpectedSuccess(Exception): """ The test was supposed to fail, but it didn't! @@ -44,13 +39,40 @@ class _Outcome(object): - def __init__(self): + def __init__(self, result=None): + self.expecting_failure = False + self.result = result + self.result_supports_subtests = hasattr(result, "addSubTest") self.success = True - self.skipped = None - self.unexpectedSuccess = None + self.skipped = [] self.expectedFailure = None self.errors = [] - self.failures = [] + + @contextlib.contextmanager + def testPartExecutor(self, test_case, isTest=False): + old_success = self.success + self.success = True + try: + yield + except KeyboardInterrupt: + raise + except SkipTest as e: + self.success = False + self.skipped.append((test_case, str(e))) + except _ShouldStop: + pass + except: + exc_info = sys.exc_info() + if self.expecting_failure: + self.expectedFailure = exc_info + else: + self.success = False + self.errors.append((test_case, exc_info)) + else: + if self.result_supports_subtests and self.success: + self.errors.append((test_case, None)) + finally: + self.success = self.success and old_success def _id(obj): @@ -88,16 +110,9 @@ return skip(reason) return _id - -def expectedFailure(func): - @functools.wraps(func) - def wrapper(*args, **kwargs): - try: - func(*args, **kwargs) - except Exception: - raise _ExpectedFailure(sys.exc_info()) - raise _UnexpectedSuccess - return wrapper +def expectedFailure(test_item): + test_item.__unittest_expecting_failure__ = True + return test_item class _AssertRaisesBaseContext(object): @@ -271,7 +286,7 @@ not have a method with the specified name. """ self._testMethodName = methodName - self._outcomeForDoCleanups = None + self._outcome = None self._testMethodDoc = 'No test' try: testMethod = getattr(self, methodName) @@ -284,6 +299,7 @@ else: self._testMethodDoc = testMethod.__doc__ self._cleanups = [] + self._subtest = None # Map types to custom assertEqual functions that will compare # instances of said type in more detail to generate a more useful @@ -371,44 +387,80 @@ return "<%s testMethod=%s>" % \ (strclass(self.__class__), self._testMethodName) - def _addSkip(self, result, reason): + def _addSkip(self, result, test_case, reason): addSkip = getattr(result, 'addSkip', None) if addSkip is not None: - addSkip(self, reason) + addSkip(test_case, reason) else: warnings.warn("TestResult has no addSkip method, skips not reported", RuntimeWarning, 2) + result.addSuccess(test_case) + + @contextlib.contextmanager + def subTest(self, msg=None, **params): + """Return a context manager that will return the enclosed block + of code in a subtest identified by the optional message and + keyword parameters. A failure in the subtest marks the test + case as failed but resumes execution at the end of the enclosed + block, allowing further test code to be executed. + """ + if not self._outcome.result_supports_subtests: + yield + return + parent = self._subtest + if parent is None: + params_map = collections.ChainMap(params) + else: + params_map = parent.params.new_child(params) + self._subtest = _SubTest(self, msg, params_map) + try: + with self._outcome.testPartExecutor(self._subtest, isTest=True): + yield + if not self._outcome.success: + result = self._outcome.result + if result is not None and result.failfast: + raise _ShouldStop + elif self._outcome.expectedFailure: + # If the test is expecting a failure, we really want to + # stop now and register the expected failure. + raise _ShouldStop + finally: + self._subtest = parent + + def _feedErrorsToResult(self, result, errors): + for test, exc_info in errors: + if isinstance(test, _SubTest): + result.addSubTest(test.test_case, test, exc_info) + elif exc_info is not None: + if issubclass(exc_info[0], self.failureException): + result.addFailure(test, exc_info) + else: + result.addError(test, exc_info) + + def _addExpectedFailure(self, result, exc_info): + try: + addExpectedFailure = result.addExpectedFailure + except AttributeError: + warnings.warn("TestResult has no addExpectedFailure method, reporting as passes", + RuntimeWarning) result.addSuccess(self) + else: + addExpectedFailure(self, exc_info) - def _executeTestPart(self, function, outcome, isTest=False): + def _addUnexpectedSuccess(self, result): try: - function() - except KeyboardInterrupt: - raise - except SkipTest as e: - outcome.success = False - outcome.skipped = str(e) - except _UnexpectedSuccess: - exc_info = sys.exc_info() - outcome.success = False - if isTest: - outcome.unexpectedSuccess = exc_info - else: - outcome.errors.append(exc_info) - except _ExpectedFailure: - outcome.success = False - exc_info = sys.exc_info() - if isTest: - outcome.expectedFailure = exc_info - else: - outcome.errors.append(exc_info) - except self.failureException: - outcome.success = False - outcome.failures.append(sys.exc_info()) - exc_info = sys.exc_info() - except: - outcome.success = False - outcome.errors.append(sys.exc_info()) + addUnexpectedSuccess = result.addUnexpectedSuccess + except AttributeError: + warnings.warn("TestResult has no addUnexpectedSuccess method, reporting as failure", + RuntimeWarning) + # We need to pass an actual exception and traceback to addFailure, + # otherwise the legacy result can choke. + try: + raise _UnexpectedSuccess from None + except _UnexpectedSuccess: + result.addFailure(self, sys.exc_info()) + else: + addUnexpectedSuccess(self) def run(self, result=None): orig_result = result @@ -427,46 +479,38 @@ try: skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) - self._addSkip(result, skip_why) + self._addSkip(result, self, skip_why) finally: result.stopTest(self) return + expecting_failure = getattr(testMethod, + "__unittest_expecting_failure__", False) try: - outcome = _Outcome() - self._outcomeForDoCleanups = outcome + outcome = _Outcome(result) + self._outcome = outcome - self._executeTestPart(self.setUp, outcome) + with outcome.testPartExecutor(self): + self.setUp() if outcome.success: - self._executeTestPart(testMethod, outcome, isTest=True) - self._executeTestPart(self.tearDown, outcome) + outcome.expecting_failure = expecting_failure + with outcome.testPartExecutor(self, isTest=True): + testMethod() + outcome.expecting_failure = False + with outcome.testPartExecutor(self): + self.tearDown() self.doCleanups() + for test, reason in outcome.skipped: + self._addSkip(result, test, reason) + self._feedErrorsToResult(result, outcome.errors) if outcome.success: - result.addSuccess(self) - else: - if outcome.skipped is not None: - self._addSkip(result, outcome.skipped) - for exc_info in outcome.errors: - result.addError(self, exc_info) - for exc_info in outcome.failures: - result.addFailure(self, exc_info) - if outcome.unexpectedSuccess is not None: - addUnexpectedSuccess = getattr(result, 'addUnexpectedSuccess', None) - if addUnexpectedSuccess is not None: - addUnexpectedSuccess(self) + if expecting_failure: + if outcome.expectedFailure: + self._addExpectedFailure(result, outcome.expectedFailure) else: - warnings.warn("TestResult has no addUnexpectedSuccess method, reporting as failures", - RuntimeWarning) - result.addFailure(self, outcome.unexpectedSuccess) - - if outcome.expectedFailure is not None: - addExpectedFailure = getattr(result, 'addExpectedFailure', None) - if addExpectedFailure is not None: - addExpectedFailure(self, outcome.expectedFailure) - else: - warnings.warn("TestResult has no addExpectedFailure method, reporting as passes", - RuntimeWarning) - result.addSuccess(self) + self._addUnexpectedSuccess(result) + else: + result.addSuccess(self) return result finally: result.stopTest(self) @@ -478,11 +522,11 @@ def doCleanups(self): """Execute all cleanup functions. Normally called for you after tearDown.""" - outcome = self._outcomeForDoCleanups or _Outcome() + outcome = self._outcome or _Outcome() while self._cleanups: function, args, kwargs = self._cleanups.pop() - part = lambda: function(*args, **kwargs) - self._executeTestPart(part, outcome) + with outcome.testPartExecutor(self): + function(*args, **kwargs) # return this for backwards compatibility # even though we no longer us it internally @@ -1213,3 +1257,39 @@ return self._description doc = self._testFunc.__doc__ return doc and doc.split("\n")[0].strip() or None + + +class _SubTest(TestCase): + + def __init__(self, test_case, message, params): + super().__init__() + self._message = message + self.test_case = test_case + self.params = params + self.failureException = test_case.failureException + + def runTest(self): + raise NotImplementedError("subtests cannot be run directly") + + def _subDescription(self): + parts = [] + if self._message: + parts.append("[{}]".format(self._message)) + if self.params: + params_desc = ', '.join( + "{}={!r}".format(k, v) + for (k, v) in sorted(self.params.items())) + parts.append("({})".format(params_desc)) + return " ".join(parts) or '()' + + def id(self): + return "{} {}".format(self.test_case.id(), self._subDescription()) + + def shortDescription(self): + """Returns a one-line description of the subtest, or None if no + description has been provided. + """ + return self.test_case.shortDescription() + + def __str__(self): + return "{} {}".format(self.test_case, self._subDescription()) diff --git a/Lib/unittest/result.py b/Lib/unittest/result.py --- a/Lib/unittest/result.py +++ b/Lib/unittest/result.py @@ -121,6 +121,22 @@ self.failures.append((test, self._exc_info_to_string(err, test))) self._mirrorOutput = True + @failfast + def addSubTest(self, test, subtest, err): + """Called at the end of a subtest. + 'err' is None if the subtest ended successfully, otherwise it's a + tuple of values as returned by sys.exc_info(). + """ + # By default, we don't do anything with successful subtests, but + # more sophisticated test results might want to record them. + if err is not None: + if issubclass(err[0], test.failureException): + errors = self.failures + else: + errors = self.errors + errors.append((test, self._exc_info_to_string(err, test))) + self._mirrorOutput = True + def addSuccess(self, test): "Called when a test has completed successfully" pass diff --git a/Lib/unittest/test/support.py b/Lib/unittest/test/support.py --- a/Lib/unittest/test/support.py +++ b/Lib/unittest/test/support.py @@ -41,7 +41,7 @@ self.fail("Problem hashing %s and %s: %s" % (obj_1, obj_2, e)) -class LoggingResult(unittest.TestResult): +class _BaseLoggingResult(unittest.TestResult): def __init__(self, log): self._events = log super().__init__() @@ -52,7 +52,7 @@ def startTestRun(self): self._events.append('startTestRun') - super(LoggingResult, self).startTestRun() + super().startTestRun() def stopTest(self, test): self._events.append('stopTest') @@ -60,7 +60,7 @@ def stopTestRun(self): self._events.append('stopTestRun') - super(LoggingResult, self).stopTestRun() + super().stopTestRun() def addFailure(self, *args): self._events.append('addFailure') @@ -68,7 +68,7 @@ def addSuccess(self, *args): self._events.append('addSuccess') - super(LoggingResult, self).addSuccess(*args) + super().addSuccess(*args) def addError(self, *args): self._events.append('addError') @@ -76,15 +76,39 @@ def addSkip(self, *args): self._events.append('addSkip') - super(LoggingResult, self).addSkip(*args) + super().addSkip(*args) def addExpectedFailure(self, *args): self._events.append('addExpectedFailure') - super(LoggingResult, self).addExpectedFailure(*args) + super().addExpectedFailure(*args) def addUnexpectedSuccess(self, *args): self._events.append('addUnexpectedSuccess') - super(LoggingResult, self).addUnexpectedSuccess(*args) + super().addUnexpectedSuccess(*args) + + +class LegacyLoggingResult(_BaseLoggingResult): + """ + A legacy TestResult implementation, without an addSubTest method, + which records its method calls. + """ + + @property + def addSubTest(self): + raise AttributeError + + +class LoggingResult(_BaseLoggingResult): + """ + A TestResult implementation which records its method calls. + """ + + def addSubTest(self, test, subtest, err): + if err is None: + self._events.append('addSubTestSuccess') + else: + self._events.append('addSubTestFailure') + super().addSubTest(test, subtest, err) class ResultWithNoStartTestRunStopTestRun(object): diff --git a/Lib/unittest/test/test_case.py b/Lib/unittest/test/test_case.py --- a/Lib/unittest/test/test_case.py +++ b/Lib/unittest/test/test_case.py @@ -13,7 +13,7 @@ import unittest from .support import ( - TestEquality, TestHashing, LoggingResult, + TestEquality, TestHashing, LoggingResult, LegacyLoggingResult, ResultWithNoStartTestRunStopTestRun ) @@ -297,6 +297,98 @@ Foo('test').run() + def _check_call_order__subtests(self, result, events, expected_events): + class Foo(Test.LoggingTestCase): + def test(self): + super(Foo, self).test() + for i in [1, 2, 3]: + with self.subTest(i=i): + if i == 1: + self.fail('failure') + for j in [2, 3]: + with self.subTest(j=j): + if i * j == 6: + raise RuntimeError('raised by Foo.test') + 1 / 0 + + # Order is the following: + # i=1 => subtest failure + # i=2, j=2 => subtest success + # i=2, j=3 => subtest error + # i=3, j=2 => subtest error + # i=3, j=3 => subtest success + # toplevel => error + Foo(events).run(result) + self.assertEqual(events, expected_events) + + def test_run_call_order__subtests(self): + events = [] + result = LoggingResult(events) + expected = ['startTest', 'setUp', 'test', 'tearDown', + 'addSubTestFailure', 'addSubTestSuccess', + 'addSubTestFailure', 'addSubTestFailure', + 'addSubTestSuccess', 'addError', 'stopTest'] + self._check_call_order__subtests(result, events, expected) + + def test_run_call_order__subtests_legacy(self): + # With a legacy result object (without a addSubTest method), + # text execution stops after the first subtest failure. + events = [] + result = LegacyLoggingResult(events) + expected = ['startTest', 'setUp', 'test', 'tearDown', + 'addFailure', 'stopTest'] + self._check_call_order__subtests(result, events, expected) + + def _check_call_order__subtests_success(self, result, events, expected_events): + class Foo(Test.LoggingTestCase): + def test(self): + super(Foo, self).test() + for i in [1, 2]: + with self.subTest(i=i): + for j in [2, 3]: + with self.subTest(j=j): + pass + + Foo(events).run(result) + self.assertEqual(events, expected_events) + + def test_run_call_order__subtests_success(self): + events = [] + result = LoggingResult(events) + # The 6 subtest successes are individually recorded, in addition + # to the whole test success. + expected = (['startTest', 'setUp', 'test', 'tearDown'] + + 6 * ['addSubTestSuccess'] + + ['addSuccess', 'stopTest']) + self._check_call_order__subtests_success(result, events, expected) + + def test_run_call_order__subtests_success_legacy(self): + # With a legacy result, only the whole test success is recorded. + events = [] + result = LegacyLoggingResult(events) + expected = ['startTest', 'setUp', 'test', 'tearDown', + 'addSuccess', 'stopTest'] + self._check_call_order__subtests_success(result, events, expected) + + def test_run_call_order__subtests_failfast(self): + events = [] + result = LoggingResult(events) + result.failfast = True + + class Foo(Test.LoggingTestCase): + def test(self): + super(Foo, self).test() + with self.subTest(i=1): + self.fail('failure') + with self.subTest(i=2): + self.fail('failure') + self.fail('failure') + + expected = ['startTest', 'setUp', 'test', 'tearDown', + 'addSubTestFailure', 'stopTest'] + Foo(events).run(result) + self.assertEqual(events, expected) + # "This class attribute gives the exception raised by the test() method. # If a test framework needs to use a specialized exception, possibly to # carry additional information, it must subclass this exception in diff --git a/Lib/unittest/test/test_result.py b/Lib/unittest/test/test_result.py --- a/Lib/unittest/test/test_result.py +++ b/Lib/unittest/test/test_result.py @@ -234,6 +234,37 @@ 'testGetDescriptionWithoutDocstring (' + __name__ + '.Test_TestResult)') + def testGetSubTestDescriptionWithoutDocstring(self): + with self.subTest(foo=1, bar=2): + result = unittest.TextTestResult(None, True, 1) + self.assertEqual( + result.getDescription(self._subtest), + 'testGetSubTestDescriptionWithoutDocstring (' + __name__ + + '.Test_TestResult) (bar=2, foo=1)') + with self.subTest('some message'): + result = unittest.TextTestResult(None, True, 1) + self.assertEqual( + result.getDescription(self._subtest), + 'testGetSubTestDescriptionWithoutDocstring (' + __name__ + + '.Test_TestResult) [some message]') + + def testGetSubTestDescriptionWithoutDocstringAndParams(self): + with self.subTest(): + result = unittest.TextTestResult(None, True, 1) + self.assertEqual( + result.getDescription(self._subtest), + 'testGetSubTestDescriptionWithoutDocstringAndParams ' + '(' + __name__ + '.Test_TestResult) ()') + + def testGetNestedSubTestDescriptionWithoutDocstring(self): + with self.subTest(foo=1): + with self.subTest(bar=2): + result = unittest.TextTestResult(None, True, 1) + self.assertEqual( + result.getDescription(self._subtest), + 'testGetNestedSubTestDescriptionWithoutDocstring ' + '(' + __name__ + '.Test_TestResult) (bar=2, foo=1)') + @unittest.skipIf(sys.flags.optimize >= 2, "Docstrings are omitted with -O2 and above") def testGetDescriptionWithOneLineDocstring(self): @@ -247,6 +278,18 @@ @unittest.skipIf(sys.flags.optimize >= 2, "Docstrings are omitted with -O2 and above") + def testGetSubTestDescriptionWithOneLineDocstring(self): + """Tests getDescription() for a method with a docstring.""" + result = unittest.TextTestResult(None, True, 1) + with self.subTest(foo=1, bar=2): + self.assertEqual( + result.getDescription(self._subtest), + ('testGetSubTestDescriptionWithOneLineDocstring ' + '(' + __name__ + '.Test_TestResult) (bar=2, foo=1)\n' + 'Tests getDescription() for a method with a docstring.')) + + @unittest.skipIf(sys.flags.optimize >= 2, + "Docstrings are omitted with -O2 and above") def testGetDescriptionWithMultiLineDocstring(self): """Tests getDescription() for a method with a longer docstring. The second line of the docstring. @@ -259,6 +302,21 @@ 'Tests getDescription() for a method with a longer ' 'docstring.')) + @unittest.skipIf(sys.flags.optimize >= 2, + "Docstrings are omitted with -O2 and above") + def testGetSubTestDescriptionWithMultiLineDocstring(self): + """Tests getDescription() for a method with a longer docstring. + The second line of the docstring. + """ + result = unittest.TextTestResult(None, True, 1) + with self.subTest(foo=1, bar=2): + self.assertEqual( + result.getDescription(self._subtest), + ('testGetSubTestDescriptionWithMultiLineDocstring ' + '(' + __name__ + '.Test_TestResult) (bar=2, foo=1)\n' + 'Tests getDescription() for a method with a longer ' + 'docstring.')) + def testStackFrameTrimming(self): class Frame(object): class tb_frame(object): diff --git a/Lib/unittest/test/test_runner.py b/Lib/unittest/test/test_runner.py --- a/Lib/unittest/test/test_runner.py +++ b/Lib/unittest/test/test_runner.py @@ -5,6 +5,7 @@ import subprocess import unittest +from unittest.case import _Outcome from .support import LoggingResult, ResultWithNoStartTestRunStopTestRun @@ -42,12 +43,8 @@ def testNothing(self): pass - class MockOutcome(object): - success = True - errors = [] - test = TestableTest('testNothing') - test._outcomeForDoCleanups = MockOutcome + outcome = test._outcome = _Outcome() exc1 = Exception('foo') exc2 = Exception('bar') @@ -61,9 +58,10 @@ test.addCleanup(cleanup2) self.assertFalse(test.doCleanups()) - self.assertFalse(MockOutcome.success) + self.assertFalse(outcome.success) - (Type1, instance1, _), (Type2, instance2, _) = reversed(MockOutcome.errors) + ((_, (Type1, instance1, _)), + (_, (Type2, instance2, _))) = reversed(outcome.errors) self.assertEqual((Type1, instance1), (Exception, exc1)) self.assertEqual((Type2, instance2), (Exception, exc2)) diff --git a/Lib/unittest/test/test_skipping.py b/Lib/unittest/test/test_skipping.py --- a/Lib/unittest/test/test_skipping.py +++ b/Lib/unittest/test/test_skipping.py @@ -29,6 +29,31 @@ self.assertEqual(result.skipped, [(test, "testing")]) self.assertEqual(result.testsRun, 1) + def test_skipping_subtests(self): + class Foo(unittest.TestCase): + def test_skip_me(self): + with self.subTest(a=1): + with self.subTest(b=2): + self.skipTest("skip 1") + self.skipTest("skip 2") + self.skipTest("skip 3") + events = [] + result = LoggingResult(events) + test = Foo("test_skip_me") + test.run(result) + self.assertEqual(events, ['startTest', 'addSkip', 'addSkip', + 'addSkip', 'stopTest']) + self.assertEqual(len(result.skipped), 3) + subtest, msg = result.skipped[0] + self.assertEqual(msg, "skip 1") + self.assertIsInstance(subtest, unittest.TestCase) + self.assertIsNot(subtest, test) + subtest, msg = result.skipped[1] + self.assertEqual(msg, "skip 2") + self.assertIsInstance(subtest, unittest.TestCase) + self.assertIsNot(subtest, test) + self.assertEqual(result.skipped[2], (test, "skip 3")) + def test_skipping_decorators(self): op_table = ((unittest.skipUnless, False, True), (unittest.skipIf, True, False)) @@ -95,6 +120,31 @@ self.assertEqual(result.expectedFailures[0][0], test) self.assertTrue(result.wasSuccessful()) + def test_expected_failure_subtests(self): + # A failure in any subtest counts as the expected failure of the + # whole test. + class Foo(unittest.TestCase): + @unittest.expectedFailure + def test_die(self): + with self.subTest(): + # This one succeeds + pass + with self.subTest(): + self.fail("help me!") + with self.subTest(): + # This one doesn't get executed + self.fail("shouldn't come here") + events = [] + result = LoggingResult(events) + test = Foo("test_die") + test.run(result) + self.assertEqual(events, + ['startTest', 'addSubTestSuccess', + 'addExpectedFailure', 'stopTest']) + self.assertEqual(len(result.expectedFailures), 1) + self.assertIs(result.expectedFailures[0][0], test) + self.assertTrue(result.wasSuccessful()) + def test_unexpected_success(self): class Foo(unittest.TestCase): @unittest.expectedFailure @@ -110,6 +160,30 @@ self.assertEqual(result.unexpectedSuccesses, [test]) self.assertTrue(result.wasSuccessful()) + def test_unexpected_success_subtests(self): + # Success in all subtests counts as the unexpected success of + # the whole test. + class Foo(unittest.TestCase): + @unittest.expectedFailure + def test_die(self): + with self.subTest(): + # This one succeeds + pass + with self.subTest(): + # So does this one + pass + events = [] + result = LoggingResult(events) + test = Foo("test_die") + test.run(result) + self.assertEqual(events, + ['startTest', + 'addSubTestSuccess', 'addSubTestSuccess', + 'addUnexpectedSuccess', 'stopTest']) + self.assertFalse(result.failures) + self.assertEqual(result.unexpectedSuccesses, [test]) + self.assertTrue(result.wasSuccessful()) + def test_skip_doesnt_run_setup(self): class Foo(unittest.TestCase): wasSetUp = False diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -292,6 +292,9 @@ Library ------- +- Issue #16997: unittest.TestCase now provides a subTest() context manager + to procedurally generate, in an easy way, small test instances. + - Issue #17485: Also delete the Request Content-Length header if the data attribute is deleted. (Follow on to issue 16464). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 20:39:45 2013 From: python-checkins at python.org (matthias.klose) Date: Wed, 20 Mar 2013 20:39:45 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogLSAuaGd0b3VjaDog?= =?utf-8?q?Add_dependencies_for_GRAMMAR=5FH_and_GRAMMAR=5FC?= Message-ID: <3ZWM0K73gzzQyZ@mail.python.org> http://hg.python.org/cpython/rev/f2cc3d8b88bb changeset: 82845:f2cc3d8b88bb branch: 3.3 parent: 82839:8d22b6ed44e6 user: doko at ubuntu.com date: Wed Mar 20 12:38:50 2013 -0700 summary: - .hgtouch: Add dependencies for GRAMMAR_H and GRAMMAR_C files: .hgtouch | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/.hgtouch b/.hgtouch --- a/.hgtouch +++ b/.hgtouch @@ -10,3 +10,6 @@ Python/opcode_targets.h: Python/makeopcodetargets.py Lib/opcode.py Objects/typeslots.inc: Include/typeslots.h Objects/typeslots.py + +Include/graminit.h: Grammar/Grammar Parser/acceler.c Parser/grammar1.c Parser/listnode.c Parser/node.c Parser/parser.c Parser/bitset.c Parser/metagrammar.c Parser/firstsets.c Parser/grammar.c Parser/pgen.c Objects/obmalloc.c Python/dynamic_annotations.c Python/mysnprintf.c Python/pyctype.c Parser/tokenizer_pgen.c Parser/printgrammar.c Parser/parsetok_pgen.c Parser/pgenmain.c +Python/graminit.c: Include/graminit.h Grammar/Grammar Parser/acceler.c Parser/grammar1.c Parser/listnode.c Parser/node.c Parser/parser.c Parser/bitset.c Parser/metagrammar.c Parser/firstsets.c Parser/grammar.c Parser/pgen.c Objects/obmalloc.c Python/dynamic_annotations.c Python/mysnprintf.c Python/pyctype.c Parser/tokenizer_pgen.c Parser/printgrammar.c Parser/parsetok_pgen.c Parser/pgenmain.c -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 20:39:47 2013 From: python-checkins at python.org (matthias.klose) Date: Wed, 20 Mar 2013 20:39:47 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogLSBNZXJnZSAzLjMgKC5oZ3RvdWNoKQ==?= Message-ID: <3ZWM0M2WNpzSSh@mail.python.org> http://hg.python.org/cpython/rev/ca4ffcbd325c changeset: 82846:ca4ffcbd325c parent: 82844:5c09e1c57200 parent: 82845:f2cc3d8b88bb user: doko at ubuntu.com date: Wed Mar 20 12:39:38 2013 -0700 summary: - Merge 3.3 (.hgtouch) files: .hgtouch | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/.hgtouch b/.hgtouch --- a/.hgtouch +++ b/.hgtouch @@ -10,3 +10,6 @@ Python/opcode_targets.h: Python/makeopcodetargets.py Lib/opcode.py Objects/typeslots.inc: Include/typeslots.h Objects/typeslots.py + +Include/graminit.h: Grammar/Grammar Parser/acceler.c Parser/grammar1.c Parser/listnode.c Parser/node.c Parser/parser.c Parser/bitset.c Parser/metagrammar.c Parser/firstsets.c Parser/grammar.c Parser/pgen.c Objects/obmalloc.c Python/dynamic_annotations.c Python/mysnprintf.c Python/pyctype.c Parser/tokenizer_pgen.c Parser/printgrammar.c Parser/parsetok_pgen.c Parser/pgenmain.c +Python/graminit.c: Include/graminit.h Grammar/Grammar Parser/acceler.c Parser/grammar1.c Parser/listnode.c Parser/node.c Parser/parser.c Parser/bitset.c Parser/metagrammar.c Parser/firstsets.c Parser/grammar.c Parser/pgen.c Objects/obmalloc.c Python/dynamic_annotations.c Python/mysnprintf.c Python/pyctype.c Parser/tokenizer_pgen.c Parser/printgrammar.c Parser/parsetok_pgen.c Parser/pgenmain.c -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 23:01:41 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 23:01:41 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2316475=3A_Simplify?= =?utf-8?q?_the_interface_to_r=5Fref=5Fallocate_and_improve_comments=2E?= Message-ID: <3ZWQ852BzpzSwX@mail.python.org> http://hg.python.org/cpython/rev/f4c21179690b changeset: 82847:f4c21179690b user: Kristj?n Valur J?nsson date: Wed Mar 20 11:43:57 2013 -0700 summary: Issue #16475: Simplify the interface to r_ref_allocate and improve comments. files: Python/marshal.c | 59 ++++++++++++++++++++--------------- 1 files changed, 33 insertions(+), 26 deletions(-) diff --git a/Python/marshal.c b/Python/marshal.c --- a/Python/marshal.c +++ b/Python/marshal.c @@ -743,34 +743,37 @@ return NULL; } -/* allocate the reflist index */ -static PyObject * -r_ref_reserve(PyObject *o, Py_ssize_t *idx, int flag, RFILE *p) +/* allocate the reflist index for a new object. Return -1 on failure */ +static Py_ssize_t +r_ref_reserve(int flag, RFILE *p) { if (flag) { /* currently only FLAG_REF is defined */ - *idx = PyList_Size(p->refs); - if (*idx < 0) - goto err; - if (*idx >= 0x7ffffffe) { + Py_ssize_t idx = PyList_Size(p->refs); + if (idx < 0) + return -1; + if (idx >= 0x7ffffffe) { PyErr_SetString(PyExc_ValueError, "bad marshal data (index list too large)"); - goto err; + return -1; } if (PyList_Append(p->refs, Py_None) < 0) - goto err; + return -1; + return idx; } else - *idx = 0; - return o; -err: - Py_XDECREF(o); /* release the new object */ - *idx = -1; - return NULL; + return 0; } -/* insert actual object to the reflist */ +/* insert the new object 'o' to the reflist at previously + * allocated index 'idx'. + * 'o' can be NULL, in which case nothing is done. + * if 'o' was non-NULL, and the function succeeds, 'o' is returned. + * if 'o' was non-NULL, and the function fails, 'o' is released and + * NULL returned. This simplifies error checking at the call site since + * a single test for NULL for the function result is enough. + */ static PyObject * r_ref_insert(PyObject *o, Py_ssize_t idx, int flag, RFILE *p) { - if (o && (flag & FLAG_REF)) { + if (o != NULL && flag) { /* currently only FLAG_REF is defined */ if (PyList_SetItem(p->refs, idx, o) < 0) { Py_DECREF(o); /* release the new object */ return NULL; @@ -788,7 +791,7 @@ static PyObject * r_ref(PyObject *o, int flag, RFILE *p) { - if (o && (flag & FLAG_REF)) { + if (o != NULL && flag) { /* currently only FLAG_REF is defined */ if (PyList_Append(p->refs, o) < 0) { Py_DECREF(o); /* release the new object */ return NULL; @@ -821,7 +824,8 @@ type = type & ~FLAG_REF; #define R_REF(O) do{\ - O = r_ref(O, flag, p);\ + if (flag) \ + O = r_ref(O, flag, p);\ } while (0) switch (type) { @@ -1143,13 +1147,16 @@ break; } v = (type == TYPE_SET) ? PySet_New(NULL) : PyFrozenSet_New(NULL); - /* must use delayed registration of frozensets because they must - * be init with a refcount of 1 - */ - if (type == TYPE_SET) + if (type == TYPE_SET) { R_REF(v); - else - v = r_ref_reserve(v, &idx, flag, p); + } else { + /* must use delayed registration of frozensets because they must + * be init with a refcount of 1 + */ + idx = r_ref_reserve(flag, p); + if (idx < 0) + Py_CLEAR(v); /* signal error */ + } if (v == NULL) { retval = NULL; break; @@ -1195,7 +1202,7 @@ int firstlineno; PyObject *lnotab = NULL; - r_ref_reserve(NULL, &idx, flag, p); + idx = r_ref_reserve(flag, p); if (idx < 0) { retval = NULL; break; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 20 23:01:42 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 20 Mar 2013 23:01:42 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2316475_=3A_Correct?= =?utf-8?q?ly_handle_the_EOF_when_reading_marshal_streams=2E?= Message-ID: <3ZWQ864wgSzSwM@mail.python.org> http://hg.python.org/cpython/rev/42bf74b90626 changeset: 82848:42bf74b90626 user: Kristj?n Valur J?nsson date: Wed Mar 20 14:26:33 2013 -0700 summary: Issue #16475 : Correctly handle the EOF when reading marshal streams. files: Lib/test/test_marshal.py | 5 +++++ Python/marshal.c | 18 +++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py --- a/Lib/test/test_marshal.py +++ b/Lib/test/test_marshal.py @@ -283,6 +283,11 @@ unicode_string = 'T' self.assertRaises(TypeError, marshal.loads, unicode_string) + def _test_eof(self): + data = marshal.dumps(("hello", "dolly", None)) + for i in range(len(data)): + self.assertRaises(EOFError, marshal.loads, data[0: i]) + LARGE_SIZE = 2**31 pointer_size = 8 if sys.maxsize > 0xFFFFFFFF else 4 diff --git a/Python/marshal.c b/Python/marshal.c --- a/Python/marshal.c +++ b/Python/marshal.c @@ -808,10 +808,16 @@ PyObject *v, *v2; Py_ssize_t idx = 0; long i, n; - int type = r_byte(p); + int type, code = r_byte(p); int flag; PyObject *retval; + if (code == EOF) { + PyErr_SetString(PyExc_EOFError, + "EOF read where object expected"); + return NULL; + } + p->depth++; if (p->depth > MAX_MARSHAL_STACK_DEPTH) { @@ -820,8 +826,8 @@ return NULL; } - flag = type & FLAG_REF; - type = type & ~FLAG_REF; + flag = code & FLAG_REF; + type = code & ~FLAG_REF; #define R_REF(O) do{\ if (flag) \ @@ -830,12 +836,6 @@ switch (type) { - case EOF: - PyErr_SetString(PyExc_EOFError, - "EOF read where object expected"); - retval = NULL; - break; - case TYPE_NULL: retval = NULL; break; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 01:25:35 2013 From: python-checkins at python.org (richard.jones) Date: Thu, 21 Mar 2013 01:25:35 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_PEP_438=3A_clarifications_and?= =?utf-8?q?_adding_API_information?= Message-ID: <3ZWTL75vyHzRJ6@mail.python.org> http://hg.python.org/peps/rev/5900f1d6f0b1 changeset: 4813:5900f1d6f0b1 user: Richard Jones date: Wed Mar 20 17:25:30 2013 -0700 summary: PEP 438: clarifications and adding API information files: pep-0438.txt | 188 ++++++++++++++++++++++++++++---------- 1 files changed, 135 insertions(+), 53 deletions(-) diff --git a/pep-0438.txt b/pep-0438.txt --- a/pep-0438.txt +++ b/pep-0438.txt @@ -3,6 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Holger Krekel , Carl Meyer +BDFL-Delegate: Richard Jones Discussions-To: catalog-sig at python.org Status: Draft Type: Process @@ -22,7 +23,7 @@ transition phase, which will result in faster, more reliable installs for most existing packages**. -The first transition phase implements an easy and explicit means for a +The first transition phase implements easy and explicit means for a package maintainer to control which release file links are served to present-day installation tools. The first phase also includes the implementation of analysis tools for present-day packages, to support @@ -34,7 +35,16 @@ The second transition phase concerns end-user installation tools, which shall default to only install release files that are hosted on PyPI and tell the user if external release files exist, offering a -choice to automatically use those external files. +choice to automatically use those external files. External release +files shall in the future be registered together with a checksum +hash so that installation tools can verify the integrity of the +eventual download (PyPI-hosted release files always carry such +a checksum). + +Alternative PyPI server implementations should implement the new +simple index serving behaviour of transition phase 1 to avoid +installation tools treating their release links as external ones in +phase 2. Rationale @@ -70,11 +80,15 @@ crawled by installation tools and, if HTML, are themselves scraped for release-file links in the above formats. -Today, most packages released on PyPI host their release files on -PyPI, but a small percentage (XXX need updated data) rely on external -hosting. +See the easy_install documentation for a complete description of this +behavior. [1]_ -There are many reasons [2]_ why people have chosen external +Today, most packages indexed on PyPI host their release files on +PyPI. Out of 29,117 total projects on PyPI, only 2,581 (less than 10%) +include any links to installable files that are available only +off-PyPI. [2]_ + +There are many reasons [3]_ why people have chosen external hosting. To cite just a few: - release processes and scripts have been developed already and upload @@ -100,8 +114,8 @@ Irrespective of the present-day validity of these reasons, there clearly is a history why people choose to host files externally and it even was for some time the only way you could do things. This PEP -takes the position that there are at least some valid reasons for -external hosting. +takes the position that there remain some valid reasons for +external hosting even today. Problem ------- @@ -117,7 +131,7 @@ :pep:`381` mirroring infrastructure, further decreasing reliability and speed of automated installation processes around the world. -Most packages are hosted directly on pypi.python.org [1]_. Even for +Most packages are hosted directly on pypi.python.org [2]_. Even for these packages, installers still crawl their homepage and download-url, if specified. Many package uploaders are not aware that specifying the "homepage" or "download-url" in their package metadata @@ -137,7 +151,7 @@ There is currently no way for package maintainers to avoid external-link crawling, other than removing all homepage/download url -metadata for all historic releases. While a script [3]_ has been +metadata for all historic releases. While a script [4]_ has been written to perform this action, it is not a good general solution because it removes useful metadata from PyPI releases. @@ -165,13 +179,14 @@ * It should remain possible for package owners to choose to host their release files on their own hosting, external to PyPI. It should be easy for a user to request the installation of such releases using - automated installer tools. + automated installer tools, especially if the external release files + were registered together with a checksum hash. * Automated installer tools should not install externally-hosted - packages **by default**, but only when explicitly authorized to do - so by the user. When tools refuse to install such a package by - default, they should tell the user exactly which external link(s) - they would need to follow, and what option(s) the user can provide + packages **by default**, but require explicit authorization to do so + by the user. When tools refuse to install such a package by default, + they should tell the user exactly which external link(s) the + installer needs to follow, and what option(s) the user can provide to authorize the tool to follow those links. PyPI should provide all necessary metadata for installer tools to implement this easily and within a single request/reply interaction. @@ -200,14 +215,16 @@ admins if maintainers are not reachable. Also in the first phase, each link served in the ``simple/`` index -will be explicitly marked as ``rel="internal"`` (hosted by the index -itself) or ``rel="external"`` (linking to an external site that is not -part of the index). +will be explicitly marked as ``rel="internal"`` if it is hosted by the +index itself (even if on a separate domain, which may be the case if +the index uses a CDN for file-serving). Any link not so marked will be +considered an external link. In the second transition phase, PyPI client installation tools shall be updated to default to only install ``rel="internal"`` packages unless a user specifies option(s) to permit installing from external -links. +links. See `second transition phase`_ for details on how installers +should behave. Maintainers of packages which currently host release files on non-PyPI sites shall receive instructions and tools to ease "re-hosting" of @@ -249,8 +266,12 @@ - ``pypi-explicit``: for a package in this mode, only links to release files uploaded to PyPI, and external links to release files - explicitly nominated by the package owner (via a new interface - exposed by PyPI) will be added to the ``simple/`` index. + explicitly nominated by the package owner, will be added to the + ``simple/`` index. PyPI will provide a new interface for package + owners to supply external release-file URLs. These URLs MUST include + a URL fragment in the form "#hashtype=hashvalue" specifying a hash + of the externally-linked file which installer tools MUST use to + validate that they have downloaded the intended file. Thus the hope is that eventually all projects on PyPI can be migrated to the ``pypi-explicit`` mode, while preserving the ability to install @@ -273,19 +294,23 @@ interface for package owners to select the mode for each package and register explicit external file URLs. -#. For packages in all modes, label all links in the ``simple/`` index - with ``rel="internal"`` or ``rel="external"``, to make it easier - for client tools to distinguish the types of links in the second - transition phase. +#. For packages in all modes, label links in the ``simple/`` index to + index-hosted files with ``rel="internal"``, to make it easier for + client tools to distinguish these links in the second phase. + +#. Add an HTML tag ```` to all + ``simple/`` index pages, to allow clients to distinguish between + indexes providing the ``rel="internal"`` metadata and older ones + that do not. #. Default all newly-registered packages to ``pypi-explicit`` mode (package owners can still switch to the other modes as desired). -#. Determine (via an automated analysis tool) which packages have all +#. Determine (via automated analysis [2]_) which packages have all installable files available on PyPI itself (group A), which have - all installable files linked directly from PyPI metadata (group B), - and which have installable versions available that are linked only - from external homepage/download HTML pages (group C). + all installable files on PyPI or linked directly from PyPI metadata + (group B), and which have installable versions available that are + linked only from external homepage/download HTML pages (group C). #. Send mail to maintainers of projects in group A that their project will be automatically configured to ``pypi-explicit`` mode in one @@ -305,6 +330,8 @@ with these transitions. +.. _`second transition phase`: + Second transition phase (installer tools) ----------------------------------------- @@ -312,46 +339,101 @@ asked to release two updates. The first update shall provide clear warnings if externally-hosted -release files (that is, files whose link is ``rel="external"``) are -selected for download, for which projects and URLs exactly this -happens, and warn that in future versions externally-hosted downloads -will be disabled by default. +release files (that is, files whose link does not include +``rel="internal"``) are selected for download, for which projects and +URLs exactly this happens, and warn that in future versions +externally-hosted downloads will be disabled by default. The second update should change the default mode to allow only installation of ``rel="internal"`` package files, and allow installation of externally-hosted packages only when the user supplies -an option (ideally an option specifying exactly which external domains -are to be trusted as download sources). When download of an -externally-hosted package is disallowed, the user should be notified, -with instructions for how to make the install succeed and warnings -about the implication (that a file will be downloaded from a site that -is not part of the package index). +an option. +The installer should distinguish between verifiable and non-verifiable +external links. A verifiable external link is a direct link to an +installable file from the PyPI ``simple/`` index that includes a hash +in the URL fragment ("#hashtype=hashvalue") which can be used to +verify the integrity of the downloaded file. A non-verifiable external +link is any link (other than those explicitly supplied by the user of +an installer tool) without a hash, scraped from external HTML, or +injected into the search via some other non-PyPI source +(e.g. setuptools' ``dependency_links`` feature). -Open Questions / tasks -====================== +Installers should provide a blanket option to allow +installing any verifiable external link. Non-verifiable external links +should only be installed if the user-provided option specifies exactly +which external domains can be used or for which specific package names +external links can be used. -- Should we introduce some form of PyPI API versioning in this PEP? - (it might complicate matters and delay the implementation but is - often seen as good practise). +When download of an externally-hosted package is disallowed by the +default configuration, the user should be notified, with instructions +for how to make the install succeed and warnings about the implication +(that a file will be downloaded from a site that is not part of the +package index). The warning given for non-verifiable links should +clearly state that the installer cannot verify the integrity of the +downloaded file. The warning given for verifiable external links +should simply note that the file will be downloaded from an external +URL, but that the file integrity can be verified by checksum. -- Do another round of discussions with installation tool authors and - see about incorporating their feedback. There is one known issue in - particular from Philip J. Eby who considers a host-based pattern - matching algorithm preferable to interpreting "rel" attributes. +Alternative PyPI-compatible index implementations should upgrade to +begin providing the ``rel="internal"`` metadata and the ```` tag as soon as possible. For +alternative indexes which do not yet provide the meta tag in their +``simple/`` pages, installation tools should provide +backwards-compatible fallback behavior (treat links as internal as in +pre-PEP times and provide a warning). + + +API For Submitting External Distribution URLs +--------------------------------------------- + +New distribution URLs may be submitted by performing a HTTP POST to +the URL: + + https://pypi.python.org/pypi + +With the following form-encoded data: + +============== ================================ +Name Value +-------------- -------------------------------- +:action The string "urls" +name The package name as a string +version The release version as a string +new-url The new URL to store +submit_new_url The string "yes" +============== ================================ + +The POST must be accompanied by an HTTP Basic Auth header encoding the +username and password of the user authorized to maintain the package +on PyPI. + +The HTTP response to this request will be one of: + +======= ============ ================================================ +Code Meaning URL submission implications +------- ------------ ------------------------------------------------ +200 OK Everything worked just fine +400 Bad request Data provided for submission was malformed +401 Unauthorised The username or password supplied were incorrect +403 Forbidden User does not have permission to update the + package information (not Owner or Maintainer) +======= ============ ================================================ References ========== -.. [1] Donald Stufft, ratio of externally hosted versus pypi-hosted, - http://mail.python.org/pipermail/catalog-sig/2013-March/005549.html - (XXX need to update this data for all easy_install-supported formats) +.. [1] Philip Eby, easy_install 'Package Index "API"' documentation, + http://peak.telecommunity.com/DevCenter/EasyInstall#package-index-api -.. [2] Marc-Andre Lemburg, reasons for external hosting, +.. [2] Donald Stufft, automated analysis of PyPI project links, + https://github.com/dstufft/pypi.linkcheck + +.. [3] Marc-Andre Lemburg, reasons for external hosting, http://mail.python.org/pipermail/catalog-sig/2013-March/005626.html -.. [3] Holger Krekel, script to remove homepage/download metadata for +.. [4] Holger Krekel, script to remove homepage/download metadata for all releases http://mail.python.org/pipermail/catalog-sig/2013-February/005423.html -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Mar 21 02:15:11 2013 From: python-checkins at python.org (r.david.murray) Date: Thu, 21 Mar 2013 02:15:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzU3MTM6IEhhbmRs?= =?utf-8?q?e_421_error_codes_during_sendmail_by_closing_the_socket=2E?= Message-ID: <3ZWVRM3nW6zR9r@mail.python.org> http://hg.python.org/cpython/rev/bc538bc8e65d changeset: 82849:bc538bc8e65d branch: 3.2 parent: 82838:54ee934400b3 user: R David Murray date: Wed Mar 20 20:36:14 2013 -0400 summary: #5713: Handle 421 error codes during sendmail by closing the socket. This is a partial fix to the issue of servers disconnecting unexpectedly; in this case the 421 says they are disconnecting, so we close the socket and return the 421 in the appropriate error context. Original patch by Mark Sapiro, updated by Kushal Das, with additional tests by me. files: Lib/smtplib.py | 13 ++++- Lib/test/test_smtplib.py | 65 +++++++++++++++++++++++++++- Misc/NEWS | 4 + 3 files changed, 79 insertions(+), 3 deletions(-) diff --git a/Lib/smtplib.py b/Lib/smtplib.py --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -742,7 +742,10 @@ esmtp_opts.append(option) (code, resp) = self.mail(from_addr, esmtp_opts) if code != 250: - self.rset() + if code == 421: + self.close() + else: + self.rset() raise SMTPSenderRefused(code, resp, from_addr) senderrs = {} if isinstance(to_addrs, str): @@ -751,13 +754,19 @@ (code, resp) = self.rcpt(each, rcpt_options) if (code != 250) and (code != 251): senderrs[each] = (code, resp) + if code == 421: + self.close() + raise SMTPRecipientsRefused(senderrs) if len(senderrs) == len(to_addrs): # the server refused all our recipients self.rset() raise SMTPRecipientsRefused(senderrs) (code, resp) = self.data(msg) if code != 250: - self.rset() + if code == 421: + self.close() + else: + self.rset() raise SMTPDataError(code, resp) #if we got here then somebody got our mail return senderrs diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -560,6 +560,12 @@ # Simulated SMTP channel & server class SimSMTPChannel(smtpd.SMTPChannel): + mail_response = None + rcpt_response = None + data_response = None + rcpt_count = 0 + rset_count = 0 + def __init__(self, extra_features, *args, **kw): self._extrafeatures = ''.join( [ "250-{0}\r\n".format(x) for x in extra_features ]) @@ -610,18 +616,43 @@ else: self.push('550 No access for you!') + def smtp_MAIL(self, arg): + if self.mail_response is None: + super().smtp_MAIL(arg) + else: + self.push(self.mail_response) + + def smtp_RCPT(self, arg): + if self.rcpt_response is None: + super().smtp_RCPT(arg) + return + self.push(self.rcpt_response[self.rcpt_count]) + self.rcpt_count += 1 + + def smtp_RSET(self, arg): + super().smtp_RSET(arg) + self.rset_count += 1 + + def smtp_DATA(self, arg): + if self.data_response is None: + super().smtp_DATA(arg) + else: + self.push(self.data_response) + def handle_error(self): raise class SimSMTPServer(smtpd.SMTPServer): + channel_class = SimSMTPChannel + def __init__(self, *args, **kw): self._extra_features = [] smtpd.SMTPServer.__init__(self, *args, **kw) def handle_accepted(self, conn, addr): - self._SMTPchannel = SimSMTPChannel(self._extra_features, + self._SMTPchannel = self.channel_class(self._extra_features, self, conn, addr) def process_message(self, peer, mailfrom, rcpttos, data): @@ -755,6 +786,38 @@ #TODO: add tests for correct AUTH method fallback now that the #test infrastructure can support it. + # Issue 5713: make sure close, not rset, is called if we get a 421 error + def test_421_from_mail_cmd(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + self.serv._SMTPchannel.mail_response = '421 closing connection' + with self.assertRaises(smtplib.SMTPSenderRefused): + smtp.sendmail('John', 'Sally', 'test message') + self.assertIsNone(smtp.sock) + self.assertEqual(self.serv._SMTPchannel.rcpt_count, 0) + + def test_421_from_rcpt_cmd(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + self.serv._SMTPchannel.rcpt_response = ['250 accepted', '421 closing'] + with self.assertRaises(smtplib.SMTPRecipientsRefused) as r: + smtp.sendmail('John', ['Sally', 'Frank', 'George'], 'test message') + self.assertIsNone(smtp.sock) + self.assertEqual(self.serv._SMTPchannel.rset_count, 0) + self.assertDictEqual(r.exception.args[0], {'Frank': (421, b'closing')}) + + def test_421_from_data_cmd(self): + class MySimSMTPChannel(SimSMTPChannel): + def found_terminator(self): + if self.smtp_state == self.DATA: + self.push('421 closing') + else: + super().found_terminator() + self.serv.channel_class = MySimSMTPChannel + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + with self.assertRaises(smtplib.SMTPDataError): + smtp.sendmail('John at foo.org', ['Sally at foo.org'], 'test message') + self.assertIsNone(smtp.sock) + self.assertEqual(self.serv._SMTPchannel.rcpt_count, 0) + @support.reap_threads def test_main(verbose=None): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,6 +233,10 @@ Library ------- +- Issue #5713: smtplib now handles 421 (closing connection) error codes when + sending mail by closing the socket and reporting the 421 error code via the + exception appropriate to the command that received the error response. + - Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal. - Issue #17443: impalib.IMAP4_stream was using the default unbuffered IO -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 02:15:13 2013 From: python-checkins at python.org (r.david.murray) Date: Thu, 21 Mar 2013 02:15:13 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge=3A_=235713=3A_Handle_421_error_codes_during_sendmail_by_?= =?utf-8?q?closing_the_socket=2E?= Message-ID: <3ZWVRP0kKlzS9k@mail.python.org> http://hg.python.org/cpython/rev/cf5c40025af2 changeset: 82850:cf5c40025af2 branch: 3.3 parent: 82845:f2cc3d8b88bb parent: 82849:bc538bc8e65d user: R David Murray date: Wed Mar 20 21:12:17 2013 -0400 summary: Merge: #5713: Handle 421 error codes during sendmail by closing the socket. This is a partial fix to the issue of servers disconnecting unexpectedly; in this case the 421 says they are disconnecting, so we close the socket and return the 421 in the appropriate error context. Original patch by Mark Sapiro, updated by Kushal Das, with additional tests by me. files: Lib/smtplib.py | 13 ++++- Lib/test/test_smtplib.py | 74 ++++++++++++++++++++++++--- Misc/NEWS | 4 + 3 files changed, 80 insertions(+), 11 deletions(-) diff --git a/Lib/smtplib.py b/Lib/smtplib.py --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -751,7 +751,10 @@ esmtp_opts.append(option) (code, resp) = self.mail(from_addr, esmtp_opts) if code != 250: - self.rset() + if code == 421: + self.close() + else: + self.rset() raise SMTPSenderRefused(code, resp, from_addr) senderrs = {} if isinstance(to_addrs, str): @@ -760,13 +763,19 @@ (code, resp) = self.rcpt(each, rcpt_options) if (code != 250) and (code != 251): senderrs[each] = (code, resp) + if code == 421: + self.close() + raise SMTPRecipientsRefused(senderrs) if len(senderrs) == len(to_addrs): # the server refused all our recipients self.rset() raise SMTPRecipientsRefused(senderrs) (code, resp) = self.data(msg) if code != 250: - self.rset() + if code == 421: + self.close() + else: + self.rset() raise SMTPDataError(code, resp) #if we got here then somebody got our mail return senderrs diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -592,8 +592,12 @@ # Simulated SMTP channel & server class SimSMTPChannel(smtpd.SMTPChannel): - # For testing failures in QUIT when using the context manager API. quit_response = None + mail_response = None + rcpt_response = None + data_response = None + rcpt_count = 0 + rset_count = 0 def __init__(self, extra_features, *args, **kw): self._extrafeatures = ''.join( @@ -608,6 +612,8 @@ '250-DELIVERBY\r\n') resp = resp + self._extrafeatures + '250 HELP' self.push(resp) + self.seen_greeting = arg + self.extended_smtp = True def smtp_VRFY(self, arg): # For max compatibility smtplib should be sending the raw address. @@ -646,30 +652,50 @@ self.push('550 No access for you!') def smtp_QUIT(self, arg): - # args is ignored if self.quit_response is None: super(SimSMTPChannel, self).smtp_QUIT(arg) else: self.push(self.quit_response) self.close_when_done() + def smtp_MAIL(self, arg): + if self.mail_response is None: + super().smtp_MAIL(arg) + else: + self.push(self.mail_response) + + def smtp_RCPT(self, arg): + if self.rcpt_response is None: + super().smtp_RCPT(arg) + return + self.push(self.rcpt_response[self.rcpt_count]) + self.rcpt_count += 1 + + def smtp_RSET(self, arg): + super().smtp_RSET(arg) + self.rset_count += 1 + + def smtp_DATA(self, arg): + if self.data_response is None: + super().smtp_DATA(arg) + else: + self.push(self.data_response) + def handle_error(self): raise class SimSMTPServer(smtpd.SMTPServer): - # For testing failures in QUIT when using the context manager API. - quit_response = None + channel_class = SimSMTPChannel def __init__(self, *args, **kw): self._extra_features = [] smtpd.SMTPServer.__init__(self, *args, **kw) def handle_accepted(self, conn, addr): - self._SMTPchannel = SimSMTPChannel( + self._SMTPchannel = self.channel_class( self._extra_features, self, conn, addr) - self._SMTPchannel.quit_response = self.quit_response def process_message(self, peer, mailfrom, rcpttos, data): pass @@ -809,18 +835,48 @@ self.assertRaises(smtplib.SMTPServerDisconnected, smtp.send, b'foo') def test_with_statement_QUIT_failure(self): - self.serv.quit_response = '421 QUIT FAILED' with self.assertRaises(smtplib.SMTPResponseException) as error: with smtplib.SMTP(HOST, self.port) as smtp: + self.serv._SMTPchannel.quit_response = '421 QUIT FAILED' smtp.noop() self.assertEqual(error.exception.smtp_code, 421) self.assertEqual(error.exception.smtp_error, b'QUIT FAILED') - # We don't need to clean up self.serv.quit_response because a new - # server is always instantiated in the setUp(). #TODO: add tests for correct AUTH method fallback now that the #test infrastructure can support it. + # Issue 5713: make sure close, not rset, is called if we get a 421 error + def test_421_from_mail_cmd(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + self.serv._SMTPchannel.mail_response = '421 closing connection' + with self.assertRaises(smtplib.SMTPSenderRefused): + smtp.sendmail('John', 'Sally', 'test message') + self.assertIsNone(smtp.sock) + self.assertEqual(self.serv._SMTPchannel.rcpt_count, 0) + + def test_421_from_rcpt_cmd(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + self.serv._SMTPchannel.rcpt_response = ['250 accepted', '421 closing'] + with self.assertRaises(smtplib.SMTPRecipientsRefused) as r: + smtp.sendmail('John', ['Sally', 'Frank', 'George'], 'test message') + self.assertIsNone(smtp.sock) + self.assertEqual(self.serv._SMTPchannel.rset_count, 0) + self.assertDictEqual(r.exception.args[0], {'Frank': (421, b'closing')}) + + def test_421_from_data_cmd(self): + class MySimSMTPChannel(SimSMTPChannel): + def found_terminator(self): + if self.smtp_state == self.DATA: + self.push('421 closing') + else: + super().found_terminator() + self.serv.channel_class = MySimSMTPChannel + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + with self.assertRaises(smtplib.SMTPDataError): + smtp.sendmail('John at foo.org', ['Sally at foo.org'], 'test message') + self.assertIsNone(smtp.sock) + self.assertEqual(self.serv._SMTPchannel.rcpt_count, 0) + @support.reap_threads def test_main(verbose=None): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -196,6 +196,10 @@ Library ------- +- Issue #5713: smtplib now handles 421 (closing connection) error codes when + sending mail by closing the socket and reporting the 421 error code via the + exception appropriate to the command that received the error response. + - Issue #17192: Update the ctypes module's libffi to v3.0.13. This specifically addresses a stack misalignment issue on x86 and issues on some more recent platforms. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 02:15:14 2013 From: python-checkins at python.org (r.david.murray) Date: Thu, 21 Mar 2013 02:15:14 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=235713=3A_Handle_421_error_codes_during_sendma?= =?utf-8?q?il_by_closing_the_socket=2E?= Message-ID: <3ZWVRQ52j5zSJf@mail.python.org> http://hg.python.org/cpython/rev/ce4154268c47 changeset: 82851:ce4154268c47 parent: 82848:42bf74b90626 parent: 82850:cf5c40025af2 user: R David Murray date: Wed Mar 20 21:13:56 2013 -0400 summary: Merge: #5713: Handle 421 error codes during sendmail by closing the socket. This is a partial fix to the issue of servers disconnecting unexpectedly; in this case the 421 says they are disconnecting, so we close the socket and return the 421 in the appropriate error context. Original patch by Mark Sapiro, updated by Kushal Das, with additional tests by me. files: Lib/smtplib.py | 13 ++++- Lib/test/test_smtplib.py | 74 ++++++++++++++++++++++++--- Misc/NEWS | 4 + 3 files changed, 80 insertions(+), 11 deletions(-) diff --git a/Lib/smtplib.py b/Lib/smtplib.py --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -751,7 +751,10 @@ esmtp_opts.append(option) (code, resp) = self.mail(from_addr, esmtp_opts) if code != 250: - self.rset() + if code == 421: + self.close() + else: + self.rset() raise SMTPSenderRefused(code, resp, from_addr) senderrs = {} if isinstance(to_addrs, str): @@ -760,13 +763,19 @@ (code, resp) = self.rcpt(each, rcpt_options) if (code != 250) and (code != 251): senderrs[each] = (code, resp) + if code == 421: + self.close() + raise SMTPRecipientsRefused(senderrs) if len(senderrs) == len(to_addrs): # the server refused all our recipients self.rset() raise SMTPRecipientsRefused(senderrs) (code, resp) = self.data(msg) if code != 250: - self.rset() + if code == 421: + self.close() + else: + self.rset() raise SMTPDataError(code, resp) #if we got here then somebody got our mail return senderrs diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -586,8 +586,12 @@ # Simulated SMTP channel & server class SimSMTPChannel(smtpd.SMTPChannel): - # For testing failures in QUIT when using the context manager API. quit_response = None + mail_response = None + rcpt_response = None + data_response = None + rcpt_count = 0 + rset_count = 0 def __init__(self, extra_features, *args, **kw): self._extrafeatures = ''.join( @@ -602,6 +606,8 @@ '250-DELIVERBY\r\n') resp = resp + self._extrafeatures + '250 HELP' self.push(resp) + self.seen_greeting = arg + self.extended_smtp = True def smtp_VRFY(self, arg): # For max compatibility smtplib should be sending the raw address. @@ -640,30 +646,50 @@ self.push('550 No access for you!') def smtp_QUIT(self, arg): - # args is ignored if self.quit_response is None: super(SimSMTPChannel, self).smtp_QUIT(arg) else: self.push(self.quit_response) self.close_when_done() + def smtp_MAIL(self, arg): + if self.mail_response is None: + super().smtp_MAIL(arg) + else: + self.push(self.mail_response) + + def smtp_RCPT(self, arg): + if self.rcpt_response is None: + super().smtp_RCPT(arg) + return + self.push(self.rcpt_response[self.rcpt_count]) + self.rcpt_count += 1 + + def smtp_RSET(self, arg): + super().smtp_RSET(arg) + self.rset_count += 1 + + def smtp_DATA(self, arg): + if self.data_response is None: + super().smtp_DATA(arg) + else: + self.push(self.data_response) + def handle_error(self): raise class SimSMTPServer(smtpd.SMTPServer): - # For testing failures in QUIT when using the context manager API. - quit_response = None + channel_class = SimSMTPChannel def __init__(self, *args, **kw): self._extra_features = [] smtpd.SMTPServer.__init__(self, *args, **kw) def handle_accepted(self, conn, addr): - self._SMTPchannel = SimSMTPChannel( + self._SMTPchannel = self.channel_class( self._extra_features, self, conn, addr) - self._SMTPchannel.quit_response = self.quit_response def process_message(self, peer, mailfrom, rcpttos, data): pass @@ -803,18 +829,48 @@ self.assertRaises(smtplib.SMTPServerDisconnected, smtp.send, b'foo') def test_with_statement_QUIT_failure(self): - self.serv.quit_response = '421 QUIT FAILED' with self.assertRaises(smtplib.SMTPResponseException) as error: with smtplib.SMTP(HOST, self.port) as smtp: + self.serv._SMTPchannel.quit_response = '421 QUIT FAILED' smtp.noop() self.assertEqual(error.exception.smtp_code, 421) self.assertEqual(error.exception.smtp_error, b'QUIT FAILED') - # We don't need to clean up self.serv.quit_response because a new - # server is always instantiated in the setUp(). #TODO: add tests for correct AUTH method fallback now that the #test infrastructure can support it. + # Issue 5713: make sure close, not rset, is called if we get a 421 error + def test_421_from_mail_cmd(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + self.serv._SMTPchannel.mail_response = '421 closing connection' + with self.assertRaises(smtplib.SMTPSenderRefused): + smtp.sendmail('John', 'Sally', 'test message') + self.assertIsNone(smtp.sock) + self.assertEqual(self.serv._SMTPchannel.rcpt_count, 0) + + def test_421_from_rcpt_cmd(self): + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + self.serv._SMTPchannel.rcpt_response = ['250 accepted', '421 closing'] + with self.assertRaises(smtplib.SMTPRecipientsRefused) as r: + smtp.sendmail('John', ['Sally', 'Frank', 'George'], 'test message') + self.assertIsNone(smtp.sock) + self.assertEqual(self.serv._SMTPchannel.rset_count, 0) + self.assertDictEqual(r.exception.args[0], {'Frank': (421, b'closing')}) + + def test_421_from_data_cmd(self): + class MySimSMTPChannel(SimSMTPChannel): + def found_terminator(self): + if self.smtp_state == self.DATA: + self.push('421 closing') + else: + super().found_terminator() + self.serv.channel_class = MySimSMTPChannel + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + with self.assertRaises(smtplib.SMTPDataError): + smtp.sendmail('John at foo.org', ['Sally at foo.org'], 'test message') + self.assertIsNone(smtp.sock) + self.assertEqual(self.serv._SMTPchannel.rcpt_count, 0) + @support.reap_threads def test_main(verbose=None): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -292,6 +292,10 @@ Library ------- +- Issue #5713: smtplib now handles 421 (closing connection) error codes when + sending mail by closing the socket and reporting the 421 error code via the + exception appropriate to the command that received the error response. + - Issue #16997: unittest.TestCase now provides a subTest() context manager to procedurally generate, in an easy way, small test instances. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 02:32:54 2013 From: python-checkins at python.org (gregory.p.smith) Date: Thu, 21 Mar 2013 02:32:54 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_remove_the_lon?= =?utf-8?q?g_obsolete_mention_of_universal_newlines_mode_only_being?= Message-ID: <3ZWVqp24jmzR9r@mail.python.org> http://hg.python.org/cpython/rev/72056f06632f changeset: 82852:72056f06632f branch: 3.2 parent: 82849:bc538bc8e65d user: Gregory P. Smith date: Wed Mar 20 18:32:03 2013 -0700 summary: remove the long obsolete mention of universal newlines mode only being available when configured at compile time. files: Doc/library/subprocess.rst | 8 +++----- Lib/subprocess.py | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -238,11 +238,9 @@ .. note:: - The *universal_newlines* feature is supported only if Python is built - with universal newline support (the default). Also, the newlines - attribute of the file objects :attr:`Popen.stdin`, :attr:`Popen.stdout` - and :attr:`Popen.stderr` are not updated by the - :meth:`Popen.communicate` method. + The newlines attribute of the file objects :attr:`Popen.stdin`, + :attr:`Popen.stdout` and :attr:`Popen.stderr` are not updated by + the :meth:`Popen.communicate` method. If *shell* is ``True``, the specified command will be executed through the shell. This can be useful if you are using Python primarily for the diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -108,10 +108,9 @@ opened as a text files, but lines may be terminated by any of '\n', the Unix end-of-line convention, '\r', the old Macintosh convention or '\r\n', the Windows convention. All of these external representations -are seen as '\n' by the Python program. Note: This feature is only -available if Python is built with universal newline support (the -default). Also, the newlines attribute of the file objects stdout, -stdin and stderr are not updated by the communicate() method. +are seen as '\n' by the Python program. Also, the newlines attribute +of the file objects stdout, stdin and stderr are not updated by the +communicate() method. The startupinfo and creationflags, if given, will be passed to the underlying CreateProcess() function. They can specify things such as -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 02:32:55 2013 From: python-checkins at python.org (gregory.p.smith) Date: Thu, 21 Mar 2013 02:32:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_merge?= Message-ID: <3ZWVqq4rcHzS84@mail.python.org> http://hg.python.org/cpython/rev/4f99a4337cea changeset: 82853:4f99a4337cea branch: 3.3 parent: 82850:cf5c40025af2 parent: 82852:72056f06632f user: Gregory P. Smith date: Wed Mar 20 18:32:22 2013 -0700 summary: merge files: Doc/library/subprocess.rst | 8 +++----- Lib/subprocess.py | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -300,11 +300,9 @@ .. note:: - The *universal_newlines* feature is supported only if Python is built - with universal newline support (the default). Also, the newlines - attribute of the file objects :attr:`Popen.stdin`, :attr:`Popen.stdout` - and :attr:`Popen.stderr` are not updated by the - :meth:`Popen.communicate` method. + The newlines attribute of the file objects :attr:`Popen.stdin`, + :attr:`Popen.stdout` and :attr:`Popen.stderr` are not updated by + the :meth:`Popen.communicate` method. If *shell* is ``True``, the specified command will be executed through the shell. This can be useful if you are using Python primarily for the diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -108,10 +108,9 @@ opened as a text files, but lines may be terminated by any of '\n', the Unix end-of-line convention, '\r', the old Macintosh convention or '\r\n', the Windows convention. All of these external representations -are seen as '\n' by the Python program. Note: This feature is only -available if Python is built with universal newline support (the -default). Also, the newlines attribute of the file objects stdout, -stdin and stderr are not updated by the communicate() method. +are seen as '\n' by the Python program. Also, the newlines attribute +of the file objects stdout, stdin and stderr are not updated by the +communicate() method. The startupinfo and creationflags, if given, will be passed to the underlying CreateProcess() function. They can specify things such as -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 02:32:57 2013 From: python-checkins at python.org (gregory.p.smith) Date: Thu, 21 Mar 2013 02:32:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZWVqs0LKXzRK7@mail.python.org> http://hg.python.org/cpython/rev/d3d170d32533 changeset: 82854:d3d170d32533 parent: 82851:ce4154268c47 parent: 82853:4f99a4337cea user: Gregory P. Smith date: Wed Mar 20 18:32:45 2013 -0700 summary: merge files: Doc/library/subprocess.rst | 8 +++----- Lib/subprocess.py | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -300,11 +300,9 @@ .. note:: - The *universal_newlines* feature is supported only if Python is built - with universal newline support (the default). Also, the newlines - attribute of the file objects :attr:`Popen.stdin`, :attr:`Popen.stdout` - and :attr:`Popen.stderr` are not updated by the - :meth:`Popen.communicate` method. + The newlines attribute of the file objects :attr:`Popen.stdin`, + :attr:`Popen.stdout` and :attr:`Popen.stderr` are not updated by + the :meth:`Popen.communicate` method. If *shell* is ``True``, the specified command will be executed through the shell. This can be useful if you are using Python primarily for the diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -108,10 +108,9 @@ opened as a text files, but lines may be terminated by any of '\n', the Unix end-of-line convention, '\r', the old Macintosh convention or '\r\n', the Windows convention. All of these external representations -are seen as '\n' by the Python program. Note: This feature is only -available if Python is built with universal newline support (the -default). Also, the newlines attribute of the file objects stdout, -stdin and stderr are not updated by the communicate() method. +are seen as '\n' by the Python program. Also, the newlines attribute +of the file objects stdout, stdin and stderr are not updated by the +communicate() method. The startupinfo and creationflags, if given, will be passed to the underlying CreateProcess() function. They can specify things such as -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 02:56:34 2013 From: python-checkins at python.org (r.david.murray) Date: Thu, 21 Mar 2013 02:56:34 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzU3MTM6IGZpeCB0?= =?utf-8?q?iming_issue_in_smtplib_tests=2E?= Message-ID: <3ZWWM61RjvzQ7D@mail.python.org> http://hg.python.org/cpython/rev/fbf54209de75 changeset: 82855:fbf54209de75 branch: 3.2 parent: 82852:72056f06632f user: R David Murray date: Wed Mar 20 21:54:05 2013 -0400 summary: #5713: fix timing issue in smtplib tests. files: Lib/test/test_smtplib.py | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -789,6 +789,7 @@ # Issue 5713: make sure close, not rset, is called if we get a 421 error def test_421_from_mail_cmd(self): smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp.noop() self.serv._SMTPchannel.mail_response = '421 closing connection' with self.assertRaises(smtplib.SMTPSenderRefused): smtp.sendmail('John', 'Sally', 'test message') @@ -797,6 +798,7 @@ def test_421_from_rcpt_cmd(self): smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp.noop() self.serv._SMTPchannel.rcpt_response = ['250 accepted', '421 closing'] with self.assertRaises(smtplib.SMTPRecipientsRefused) as r: smtp.sendmail('John', ['Sally', 'Frank', 'George'], 'test message') @@ -813,6 +815,7 @@ super().found_terminator() self.serv.channel_class = MySimSMTPChannel smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp.noop() with self.assertRaises(smtplib.SMTPDataError): smtp.sendmail('John at foo.org', ['Sally at foo.org'], 'test message') self.assertIsNone(smtp.sock) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 02:56:35 2013 From: python-checkins at python.org (r.david.murray) Date: Thu, 21 Mar 2013 02:56:35 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge=3A_=235713=3A_fix_timing_issue_in_smtplib_tests=2E?= Message-ID: <3ZWWM7471QzSDf@mail.python.org> http://hg.python.org/cpython/rev/0de74602692f changeset: 82856:0de74602692f branch: 3.3 parent: 82853:4f99a4337cea parent: 82855:fbf54209de75 user: R David Murray date: Wed Mar 20 21:55:14 2013 -0400 summary: Merge: #5713: fix timing issue in smtplib tests. files: Lib/test/test_smtplib.py | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -848,6 +848,7 @@ # Issue 5713: make sure close, not rset, is called if we get a 421 error def test_421_from_mail_cmd(self): smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp.noop() self.serv._SMTPchannel.mail_response = '421 closing connection' with self.assertRaises(smtplib.SMTPSenderRefused): smtp.sendmail('John', 'Sally', 'test message') @@ -856,6 +857,7 @@ def test_421_from_rcpt_cmd(self): smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp.noop() self.serv._SMTPchannel.rcpt_response = ['250 accepted', '421 closing'] with self.assertRaises(smtplib.SMTPRecipientsRefused) as r: smtp.sendmail('John', ['Sally', 'Frank', 'George'], 'test message') @@ -872,6 +874,7 @@ super().found_terminator() self.serv.channel_class = MySimSMTPChannel smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp.noop() with self.assertRaises(smtplib.SMTPDataError): smtp.sendmail('John at foo.org', ['Sally at foo.org'], 'test message') self.assertIsNone(smtp.sock) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 02:56:36 2013 From: python-checkins at python.org (r.david.murray) Date: Thu, 21 Mar 2013 02:56:36 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=235713=3A_fix_timing_issue_in_smtplib_tests=2E?= Message-ID: <3ZWWM86h0qzSJF@mail.python.org> http://hg.python.org/cpython/rev/6dc948e4ea8f changeset: 82857:6dc948e4ea8f parent: 82854:d3d170d32533 parent: 82856:0de74602692f user: R David Murray date: Wed Mar 20 21:56:03 2013 -0400 summary: Merge: #5713: fix timing issue in smtplib tests. files: Lib/test/test_smtplib.py | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -842,6 +842,7 @@ # Issue 5713: make sure close, not rset, is called if we get a 421 error def test_421_from_mail_cmd(self): smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp.noop() self.serv._SMTPchannel.mail_response = '421 closing connection' with self.assertRaises(smtplib.SMTPSenderRefused): smtp.sendmail('John', 'Sally', 'test message') @@ -850,6 +851,7 @@ def test_421_from_rcpt_cmd(self): smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp.noop() self.serv._SMTPchannel.rcpt_response = ['250 accepted', '421 closing'] with self.assertRaises(smtplib.SMTPRecipientsRefused) as r: smtp.sendmail('John', ['Sally', 'Frank', 'George'], 'test message') @@ -866,6 +868,7 @@ super().found_terminator() self.serv.channel_class = MySimSMTPChannel smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp.noop() with self.assertRaises(smtplib.SMTPDataError): smtp.sendmail('John at foo.org', ['Sally at foo.org'], 'test message') self.assertIsNone(smtp.sock) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 03:13:45 2013 From: python-checkins at python.org (r.david.murray) Date: Thu, 21 Mar 2013 03:13:45 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzU3MTI6IFByZWVt?= =?utf-8?q?ptively_fix_some_other_possible_timing_issues=2E?= Message-ID: <3ZWWkx6gQyzRDf@mail.python.org> http://hg.python.org/cpython/rev/2ce557101136 changeset: 82858:2ce557101136 branch: 3.2 parent: 82855:fbf54209de75 user: R David Murray date: Wed Mar 20 22:11:40 2013 -0400 summary: #5712: Preemptively fix some other possible timing issues. files: Lib/test/test_smtplib.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -626,12 +626,12 @@ if self.rcpt_response is None: super().smtp_RCPT(arg) return - self.push(self.rcpt_response[self.rcpt_count]) self.rcpt_count += 1 + self.push(self.rcpt_response[self.rcpt_count-1]) def smtp_RSET(self, arg): + self.rset_count += 1 super().smtp_RSET(arg) - self.rset_count += 1 def smtp_DATA(self, arg): if self.data_response is None: @@ -794,7 +794,7 @@ with self.assertRaises(smtplib.SMTPSenderRefused): smtp.sendmail('John', 'Sally', 'test message') self.assertIsNone(smtp.sock) - self.assertEqual(self.serv._SMTPchannel.rcpt_count, 0) + self.assertEqual(self.serv._SMTPchannel.rset_count, 0) def test_421_from_rcpt_cmd(self): smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 03:13:47 2013 From: python-checkins at python.org (r.david.murray) Date: Thu, 21 Mar 2013 03:13:47 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge=3A_=235712=3A_Preemptively_fix_some_other_possible_timin?= =?utf-8?q?g_issues=2E?= Message-ID: <3ZWWkz2fttzS2q@mail.python.org> http://hg.python.org/cpython/rev/c412ca9aa915 changeset: 82859:c412ca9aa915 branch: 3.3 parent: 82856:0de74602692f parent: 82858:2ce557101136 user: R David Murray date: Wed Mar 20 22:12:14 2013 -0400 summary: Merge: #5712: Preemptively fix some other possible timing issues. files: Lib/test/test_smtplib.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -668,12 +668,12 @@ if self.rcpt_response is None: super().smtp_RCPT(arg) return - self.push(self.rcpt_response[self.rcpt_count]) self.rcpt_count += 1 + self.push(self.rcpt_response[self.rcpt_count-1]) def smtp_RSET(self, arg): + self.rset_count += 1 super().smtp_RSET(arg) - self.rset_count += 1 def smtp_DATA(self, arg): if self.data_response is None: @@ -853,7 +853,7 @@ with self.assertRaises(smtplib.SMTPSenderRefused): smtp.sendmail('John', 'Sally', 'test message') self.assertIsNone(smtp.sock) - self.assertEqual(self.serv._SMTPchannel.rcpt_count, 0) + self.assertEqual(self.serv._SMTPchannel.rset_count, 0) def test_421_from_rcpt_cmd(self): smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 03:13:48 2013 From: python-checkins at python.org (r.david.murray) Date: Thu, 21 Mar 2013 03:13:48 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=235712=3A_Preemptively_fix_some_other_possible?= =?utf-8?q?_timing_issues=2E?= Message-ID: <3ZWWl05RmszS9l@mail.python.org> http://hg.python.org/cpython/rev/5b0669ff19c5 changeset: 82860:5b0669ff19c5 parent: 82857:6dc948e4ea8f parent: 82859:c412ca9aa915 user: R David Murray date: Wed Mar 20 22:12:53 2013 -0400 summary: Merge: #5712: Preemptively fix some other possible timing issues. files: Lib/test/test_smtplib.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -662,12 +662,12 @@ if self.rcpt_response is None: super().smtp_RCPT(arg) return - self.push(self.rcpt_response[self.rcpt_count]) self.rcpt_count += 1 + self.push(self.rcpt_response[self.rcpt_count-1]) def smtp_RSET(self, arg): + self.rset_count += 1 super().smtp_RSET(arg) - self.rset_count += 1 def smtp_DATA(self, arg): if self.data_response is None: @@ -847,7 +847,7 @@ with self.assertRaises(smtplib.SMTPSenderRefused): smtp.sendmail('John', 'Sally', 'test message') self.assertIsNone(smtp.sock) - self.assertEqual(self.serv._SMTPchannel.rcpt_count, 0) + self.assertEqual(self.serv._SMTPchannel.rset_count, 0) def test_421_from_rcpt_cmd(self): smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 03:28:54 2013 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 21 Mar 2013 03:28:54 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_import?= Message-ID: <3ZWX4Q2lyZzRK7@mail.python.org> http://hg.python.org/cpython/rev/3969797dd598 changeset: 82861:3969797dd598 user: Raymond Hettinger date: Wed Mar 20 19:28:19 2013 -0700 summary: Fix import files: Lib/threading.py | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Lib/threading.py b/Lib/threading.py --- a/Lib/threading.py +++ b/Lib/threading.py @@ -10,11 +10,10 @@ from time import time as _time from traceback import format_exc as _format_exc from _weakrefset import WeakSet +from itertools import islice as _islice try: - from _itertools import islice as _slice from _collections import deque as _deque except ImportError: - from itertools import islice as _islice from collections import deque as _deque # Note regarding PEP 8 compliant names -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 05:01:09 2013 From: python-checkins at python.org (gregory.p.smith) Date: Thu, 21 Mar 2013 05:01:09 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Refactor_the_Windows_speci?= =?utf-8?q?fic_and_POSIX_specific_implementations_of?= Message-ID: <3ZWZ6s2d6PzRLX@mail.python.org> http://hg.python.org/cpython/rev/04b5681d813e changeset: 82862:04b5681d813e parent: 82854:d3d170d32533 user: Gregory P. Smith date: Wed Mar 20 18:51:33 2013 -0700 summary: Refactor the Windows specific and POSIX specific implementations of listdir into two separate coherent functions rather than interleaved #ifdef's. files: Modules/posixmodule.c | 73 ++++++++++++++++++++---------- 1 files changed, 48 insertions(+), 25 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -3249,15 +3249,14 @@ the file descriptor must refer to a directory.\n\ If this functionality is unavailable, using it raises NotImplementedError."); -static PyObject * -posix_listdir(PyObject *self, PyObject *args, PyObject *kwargs) +#if defined(MS_WINDOWS) && !defined(HAVE_OPENDIR) +static PyObject * +_listdir_windows_no_opendir(PyObject *self, PyObject *args, PyObject *kwargs) { path_t path; PyObject *list = NULL; static char *keywords[] = {"path", NULL}; int fd = -1; - -#if defined(MS_WINDOWS) && !defined(HAVE_OPENDIR) PyObject *v; HANDLE hFindFile = INVALID_HANDLE_VALUE; BOOL result; @@ -3268,28 +3267,16 @@ Py_ssize_t len = sizeof(namebuf)-5; PyObject *po = NULL; wchar_t *wnamebuf = NULL; -#else - PyObject *v; - DIR *dirp = NULL; - struct dirent *ep; - int return_str; /* if false, return bytes */ -#endif memset(&path, 0, sizeof(path)); path.function_name = "listdir"; path.nullable = 1; -#ifdef HAVE_FDOPENDIR - path.allow_fd = 1; - path.fd = -1; -#endif + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&:listdir", keywords, - path_converter, &path - )) - return NULL; - - /* XXX Should redo this putting the (now four) versions of opendir - in separate files instead of having them all here... */ -#if defined(MS_WINDOWS) && !defined(HAVE_OPENDIR) + path_converter, &path)) { + return NULL; + } + if (!path.narrow) { WIN32_FIND_DATAW wFileData; wchar_t *po_wchars; @@ -3429,7 +3416,34 @@ return list; -#else +} /* end of _listdir_windows_no_opendir */ + +#else /* thus POSIX, ie: not (MS_WINDOWS and not HAVE_OPENDIR) */ + +static PyObject * +_posix_listdir(PyObject *self, PyObject *args, PyObject *kwargs) +{ + path_t path; + PyObject *list = NULL; + static char *keywords[] = {"path", NULL}; + int fd = -1; + + PyObject *v; + DIR *dirp = NULL; + struct dirent *ep; + int return_str; /* if false, return bytes */ + + memset(&path, 0, sizeof(path)); + path.function_name = "listdir"; + path.nullable = 1; +#ifdef HAVE_FDOPENDIR + path.allow_fd = 1; + path.fd = -1; +#endif + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&:listdir", keywords, + path_converter, &path)) { + return NULL; + } errno = 0; #ifdef HAVE_FDOPENDIR @@ -3522,9 +3536,18 @@ path_cleanup(&path); return list; - -#endif /* which OS */ -} /* end of posix_listdir */ +} /* end of _posix_listdir */ +#endif /* which OS */ + +static PyObject * +posix_listdir(PyObject *self, PyObject *args, PyObject *kwargs) +{ +#if defined(MS_WINDOWS) && !defined(HAVE_OPENDIR) + return _listdir_windows_no_opendir(self, args, kwargs); +#else + return _posix_listdir(self, args, kwargs); +#endif +} #ifdef MS_WINDOWS /* A helper function for abspath on win32 */ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 05:01:10 2013 From: python-checkins at python.org (gregory.p.smith) Date: Thu, 21 Mar 2013 05:01:10 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Refactor_the_common_code_o?= =?utf-8?q?ut_of_the_posix_and_windows_listdir?= Message-ID: <3ZWZ6t6tmZzSFs@mail.python.org> http://hg.python.org/cpython/rev/231a7fa6c5be changeset: 82863:231a7fa6c5be user: Gregory P. Smith date: Wed Mar 20 20:52:50 2013 -0700 summary: Refactor the common code out of the posix and windows listdir implementations from my previous commit into the higher level function. files: Modules/posixmodule.c | 103 +++++++++++++---------------- 1 files changed, 46 insertions(+), 57 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -3251,12 +3251,9 @@ #if defined(MS_WINDOWS) && !defined(HAVE_OPENDIR) static PyObject * -_listdir_windows_no_opendir(PyObject *self, PyObject *args, PyObject *kwargs) -{ - path_t path; - PyObject *list = NULL; +_listdir_windows_no_opendir(path_t *path, PyObject *list) +{ static char *keywords[] = {"path", NULL}; - int fd = -1; PyObject *v; HANDLE hFindFile = INVALID_HANDLE_VALUE; BOOL result; @@ -3268,25 +3265,16 @@ PyObject *po = NULL; wchar_t *wnamebuf = NULL; - memset(&path, 0, sizeof(path)); - path.function_name = "listdir"; - path.nullable = 1; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&:listdir", keywords, - path_converter, &path)) { - return NULL; - } - - if (!path.narrow) { + if (!path->narrow) { WIN32_FIND_DATAW wFileData; wchar_t *po_wchars; - if (!path.wide) { /* Default arg: "." */ + if (!path->wide) { /* Default arg: "." */ po_wchars = L"."; len = 1; } else { - po_wchars = path.wide; - len = wcslen(path.wide); + po_wchars = path->wide; + len = wcslen(path->wide); } /* The +5 is so we can append "\\*.*\0" */ wnamebuf = malloc((len + 5) * sizeof(wchar_t)); @@ -3312,7 +3300,7 @@ if (error == ERROR_FILE_NOT_FOUND) goto exit; Py_DECREF(list); - list = path_error(&path); + list = path_error(path); goto exit; } do { @@ -3341,15 +3329,15 @@ it got to the end of the directory. */ if (!result && GetLastError() != ERROR_NO_MORE_FILES) { Py_DECREF(list); - list = path_error(&path); + list = path_error(path); goto exit; } } while (result == TRUE); goto exit; } - strcpy(namebuf, path.narrow); - len = path.length; + strcpy(namebuf, path->narrow); + len = path->length; if (len > 0) { char ch = namebuf[len-1]; if (ch != SEP && ch != ALTSEP && ch != ':') @@ -3368,7 +3356,7 @@ if (error == ERROR_FILE_NOT_FOUND) goto exit; Py_DECREF(list); - list = path_error(&path); + list = path_error(path); goto exit; } do { @@ -3396,7 +3384,7 @@ it got to the end of the directory. */ if (!result && GetLastError() != ERROR_NO_MORE_FILES) { Py_DECREF(list); - list = path_error(&path); + list = path_error(path); goto exit; } } while (result == TRUE); @@ -3406,26 +3394,21 @@ if (FindClose(hFindFile) == FALSE) { if (list != NULL) { Py_DECREF(list); - list = path_error(&path); + list = path_error(path); } } } if (wnamebuf) free(wnamebuf); - path_cleanup(&path); return list; - } /* end of _listdir_windows_no_opendir */ #else /* thus POSIX, ie: not (MS_WINDOWS and not HAVE_OPENDIR) */ static PyObject * -_posix_listdir(PyObject *self, PyObject *args, PyObject *kwargs) -{ - path_t path; - PyObject *list = NULL; - static char *keywords[] = {"path", NULL}; +_posix_listdir(path_t *path, PyObject *list) +{ int fd = -1; PyObject *v; @@ -3433,24 +3416,12 @@ struct dirent *ep; int return_str; /* if false, return bytes */ - memset(&path, 0, sizeof(path)); - path.function_name = "listdir"; - path.nullable = 1; -#ifdef HAVE_FDOPENDIR - path.allow_fd = 1; - path.fd = -1; -#endif - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&:listdir", keywords, - path_converter, &path)) { - return NULL; - } - errno = 0; #ifdef HAVE_FDOPENDIR - if (path.fd != -1) { + if (path->fd != -1) { /* closedir() closes the FD, so we duplicate it */ Py_BEGIN_ALLOW_THREADS - fd = dup(path.fd); + fd = dup(path->fd); Py_END_ALLOW_THREADS if (fd == -1) { @@ -3468,10 +3439,10 @@ #endif { char *name; - if (path.narrow) { - name = path.narrow; + if (path->narrow) { + name = path->narrow; /* only return bytes if they specified a bytes object */ - return_str = !(PyBytes_Check(path.object)); + return_str = !(PyBytes_Check(path->object)); } else { name = "."; @@ -3484,7 +3455,7 @@ } if (dirp == NULL) { - list = path_error(&path); + list = path_error(path); goto exit; } if ((list = PyList_New(0)) == NULL) { @@ -3500,7 +3471,7 @@ break; } else { Py_DECREF(list); - list = path_error(&path); + list = path_error(path); goto exit; } } @@ -3533,8 +3504,6 @@ Py_END_ALLOW_THREADS } - path_cleanup(&path); - return list; } /* end of _posix_listdir */ #endif /* which OS */ @@ -3542,11 +3511,31 @@ static PyObject * posix_listdir(PyObject *self, PyObject *args, PyObject *kwargs) { + path_t path; + PyObject *list = NULL; + static char *keywords[] = {"path", NULL}; + PyObject *return_value; + + memset(&path, 0, sizeof(path)); + path.function_name = "listdir"; + path.nullable = 1; +#ifdef HAVE_FDOPENDIR + path.allow_fd = 1; + path.fd = -1; +#endif + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&:listdir", keywords, + path_converter, &path)) { + return NULL; + } + #if defined(MS_WINDOWS) && !defined(HAVE_OPENDIR) - return _listdir_windows_no_opendir(self, args, kwargs); -#else - return _posix_listdir(self, args, kwargs); -#endif + return_value = _listdir_windows_no_opendir(&path, list); +#else + return_value = _posix_listdir(&path, list); +#endif + path_cleanup(&path); + return return_value; } #ifdef MS_WINDOWS -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 05:01:12 2013 From: python-checkins at python.org (gregory.p.smith) Date: Thu, 21 Mar 2013 05:01:12 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_merge_heads?= Message-ID: <3ZWZ6w2Hm5zSHr@mail.python.org> http://hg.python.org/cpython/rev/792ffbf6295e changeset: 82864:792ffbf6295e parent: 82863:231a7fa6c5be parent: 82861:3969797dd598 user: Gregory P. Smith date: Wed Mar 20 20:53:21 2013 -0700 summary: merge heads files: Lib/test/test_smtplib.py | 9 ++++++--- Lib/threading.py | 3 +-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -662,12 +662,12 @@ if self.rcpt_response is None: super().smtp_RCPT(arg) return - self.push(self.rcpt_response[self.rcpt_count]) self.rcpt_count += 1 + self.push(self.rcpt_response[self.rcpt_count-1]) def smtp_RSET(self, arg): + self.rset_count += 1 super().smtp_RSET(arg) - self.rset_count += 1 def smtp_DATA(self, arg): if self.data_response is None: @@ -842,14 +842,16 @@ # Issue 5713: make sure close, not rset, is called if we get a 421 error def test_421_from_mail_cmd(self): smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp.noop() self.serv._SMTPchannel.mail_response = '421 closing connection' with self.assertRaises(smtplib.SMTPSenderRefused): smtp.sendmail('John', 'Sally', 'test message') self.assertIsNone(smtp.sock) - self.assertEqual(self.serv._SMTPchannel.rcpt_count, 0) + self.assertEqual(self.serv._SMTPchannel.rset_count, 0) def test_421_from_rcpt_cmd(self): smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp.noop() self.serv._SMTPchannel.rcpt_response = ['250 accepted', '421 closing'] with self.assertRaises(smtplib.SMTPRecipientsRefused) as r: smtp.sendmail('John', ['Sally', 'Frank', 'George'], 'test message') @@ -866,6 +868,7 @@ super().found_terminator() self.serv.channel_class = MySimSMTPChannel smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp.noop() with self.assertRaises(smtplib.SMTPDataError): smtp.sendmail('John at foo.org', ['Sally at foo.org'], 'test message') self.assertIsNone(smtp.sock) diff --git a/Lib/threading.py b/Lib/threading.py --- a/Lib/threading.py +++ b/Lib/threading.py @@ -10,11 +10,10 @@ from time import time as _time from traceback import format_exc as _format_exc from _weakrefset import WeakSet +from itertools import islice as _islice try: - from _itertools import islice as _slice from _collections import deque as _deque except ImportError: - from itertools import islice as _islice from collections import deque as _deque # Note regarding PEP 8 compliant names -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 05:34:16 2013 From: python-checkins at python.org (r.david.murray) Date: Thu, 21 Mar 2013 05:34:16 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzU3MTM6IE9uZSBt?= =?utf-8?q?ore_test=5Fsmtplib_timing_fix=2E?= Message-ID: <3ZWZs41LJGzSQt@mail.python.org> http://hg.python.org/cpython/rev/d068fcbe5009 changeset: 82865:d068fcbe5009 branch: 3.3 parent: 82859:c412ca9aa915 user: R David Murray date: Thu Mar 21 00:32:31 2013 -0400 summary: #5713: One more test_smtplib timing fix. files: Lib/test/test_smtplib.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -837,8 +837,8 @@ def test_with_statement_QUIT_failure(self): with self.assertRaises(smtplib.SMTPResponseException) as error: with smtplib.SMTP(HOST, self.port) as smtp: + smtp.noop() self.serv._SMTPchannel.quit_response = '421 QUIT FAILED' - smtp.noop() self.assertEqual(error.exception.smtp_code, 421) self.assertEqual(error.exception.smtp_error, b'QUIT FAILED') -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 05:34:17 2013 From: python-checkins at python.org (r.david.murray) Date: Thu, 21 Mar 2013 05:34:17 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=235713=3A_One_more_test=5Fsmtplib_timing_fix?= =?utf-8?q?=2E?= Message-ID: <3ZWZs540VkzS93@mail.python.org> http://hg.python.org/cpython/rev/fcef6a33de17 changeset: 82866:fcef6a33de17 parent: 82864:792ffbf6295e parent: 82865:d068fcbe5009 user: R David Murray date: Thu Mar 21 00:33:30 2013 -0400 summary: Merge: #5713: One more test_smtplib timing fix. files: Lib/test/test_smtplib.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -831,8 +831,8 @@ def test_with_statement_QUIT_failure(self): with self.assertRaises(smtplib.SMTPResponseException) as error: with smtplib.SMTP(HOST, self.port) as smtp: + smtp.noop() self.serv._SMTPchannel.quit_response = '421 QUIT FAILED' - smtp.noop() self.assertEqual(error.exception.smtp_code, 421) self.assertEqual(error.exception.smtp_error, b'QUIT FAILED') -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Thu Mar 21 05:51:55 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 21 Mar 2013 05:51:55 +0100 Subject: [Python-checkins] Daily reference leaks (3969797dd598): sum=4 Message-ID: results for 3969797dd598 on branch "default" -------------------------------------------- test_imaplib leaked [6, -3, -3] references, sum=0 test_imaplib leaked [3, -2, 3] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogMpGuZq', '-x'] From python-checkins at python.org Thu Mar 21 07:27:09 2013 From: python-checkins at python.org (georg.brandl) Date: Thu, 21 Mar 2013 07:27:09 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_PEP_439=2C_submitted_by_R?= =?utf-8?q?ichard_Jones=3A_Inclusion_of_pip_bootstrap_in_Python?= Message-ID: <3ZWdMK46K7zSm4@mail.python.org> http://hg.python.org/peps/rev/4552e03b21d4 changeset: 4814:4552e03b21d4 user: Georg Brandl date: Thu Mar 21 07:27:06 2013 +0100 summary: Add PEP 439, submitted by Richard Jones: Inclusion of pip bootstrap in Python installation files: pep-0439.txt | 199 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 199 insertions(+), 0 deletions(-) diff --git a/pep-0439.txt b/pep-0439.txt new file mode 100644 --- /dev/null +++ b/pep-0439.txt @@ -0,0 +1,199 @@ +PEP: 439 +Title: Inclusion of pip bootstrap in Python installation +Version: $Revision$ +Last-Modified: $Date$ +Author: Richard Jones +BDFL-Delegate: Nick Coghlan +Discussions-To: +Status: Draft +Type: Standards Track +Created: 18-Mar-2013 +Python-Version: 3.4 +Post-History: 19-Mar-2013 + + +Abstract +======== + +This PEP proposes the inclusion of a pip boostrap executable in the +Python installation to simplify the use of 3rd-party modules by Python +users. + +This PEP does not propose to include the pip implementation in the +Python standard library. Nor does it propose to implement any package +management or installation mechanisms beyond those provided by PEPs +427 ("The Wheel Binary Package Format 1.0") and TODO distlib PEP. + + +Rationale +========= + +Currently the user story for installing 3rd-party Python modules is +not as simple as it could be. It requires that all 3rd-party modules +inform the user of how to install the installer, typically via a link +to the installer. That link may be out of date or the steps required +to perform the install of the installer may be enough of a roadblock +to prevent the user from further progress. + +Large Python projects which emphasise a low barrier to entry have +shied away from depending on third party packages because of the +introduction of this potential stumbling block for new users. + +With the inclusion of the package installer command in the standard +Python installation the barrier to installing additional software is +considerably reduced. It is hoped that this will therefore increase +the likelihood that Python projects will reuse third party software. + +It is also hoped that this is reduces the number of proposals to +include more and more software in the Python standard library, and +therefore that more popular Python software is more easily upgradeable +beyond requiring Python installation upgrades. + + +Proposal +======== + +Python install includes an executable called "pip" that attempts to +import pip machinery. If it can then the pip command proceeds as +normal. If it cannot it will bootstrap pip by downloading the pip +implementation wheel file. Once installed, the pip command proceeds +as normal. + +A boostrap is used in the place of a the full pip code so that we +don't have to bundle pip and also the install tool is upgradeable +outside of the regular Python upgrade timeframe and processes. + +To avoid issues with sudo we will have the bootstrap default to +installing the pip implementation to the per-user site-packages +directory defined in PEP 370 and implemented in Python 2.6/3.0. Since +we avoid installing to the system Python we also avoid conflicting +with any other packaging system (on Linux systems, for example.) If +the user is inside a virtual environment [1]_ then the pip +implementation will be installed into that virtual environment. + +The bootstrapping process will proceed as follows: + +1. The user system has Python (3.4+) installed. In the "scripts" + directory of the Python installation there is the bootstrap script + called "pip". +2. The user will invoke a pip command, typically "pip install + ", for example "pip install Django". +3. The boostrap script will attempt to import the pip implementation. + If this succeeds, the pip command is processed normally. +4. On failing to import the pip implementation the bootstrap notifies + the user that it is "upgrading pip" and contacts PyPI to obtain the + latest download wheel file (see PEP 427.) +5. Upon downloading the file it is installed using the distlib + installation machinery for wheel packages. Upon completing the + installation the user is notified that "pip has been upgraded." + TODO how is it verified? +6. The pip tool may now import the pip implementation and continues to + process the requested user command normally. + +Users may be running in an environment which cannot access the public +Internet and are relying solely on a local package repository. They +would use the "-i" (Base URL of Python Package Index) argument to the +"pip install" command. This use case will be handled by: + +1. Recognising the command-line arguments that specify alternative or + additional locations to discover packages and attempting to + download the package from those locations. +2. If the package is not found there then we attempt to donwload it + using the standard "https://pypi.python.org/pypi/simple/pip" index. +3. If that also fails, for any reason, we indicate to the user the + operation we were attempting, the reason for failure (if we know + it) and display further instructions for downloading and installing + the file manually. + +Manual installation of the pip implementation will be supported +through the manual download of the wheel file and "pip install +". + +This installation will not perform standard pip installation steps of +saving the file to a cache directory or updating any local database of +installed files. + +The download of the pip implementation install file should be +performed securely. The transport from pypi.python.org will be done +over HTTPS but the CA certificate check will most likely not be +performed. Therefore we will utilise the embedded signature support +in the wheel format to validate the downloaded file. + +Beyond those arguments controlling index location and download +options, the "pip" boostrap command may support further standard pip +options for verbosity, quietness and logging. + +The "--no-install" option to the "pip" command will not affect the +bootstrapping process. + +An additional new Python package will be proposed, "pypublish", which +will be a tool for publishing packages to PyPI. It would replace the +current "python setup.py register" and "python setup.py upload" +distutils commands. Again because of the measured Python release +cycle and extensive existing Python installations these commands are +difficult to bugfix and extend. Additionally it is desired that the +"register" and "upload" commands be able to be performed over HTTPS +with certificate validation. Since shipping CA certificate keychains +with Python is not really feasible (updating the keychain is quite +difficult to manage) it is desirable that those commands, and the +accompanying keychain, be made installable and upgradeable outside of +Python itself. + + +Implementation +============== + +TBD + + +Risks +===== + +The Fedora variant of Linux has had a separate program called "pip" (a +Perl package installer) available for install for some time. The +current Python "pip" program is installed as "pip-python". It is +hoped that the Fedora community will resolve this issue by renaming +the Perl installer. + +Currently pip depends upon setuptools functionality. It is intended +that before Python 3.4 is shipped that the required functionlity will +be present in Python's standard library as the distlib module, and +that pip would be modified to use that functionality when present. +TODO PEP reference for distlib + +The key that is used to sign the pip implementation download might be +compromised and this PEP currently proposes no mechanism for key +revocation. + + +References +========== + +.. [1] PEP 405, Python Virtual Environments + http://www.python.org/dev/peps/pep-0405/ + + +Acknowledgments +=============== + +Nick Coghlan for his thoughts on the proposal and dealing with the Red +Hat issue. + +Jannis Leidel and Carl Meyer for their thoughts. + + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Mar 21 07:28:28 2013 From: python-checkins at python.org (georg.brandl) Date: Thu, 21 Mar 2013 07:28:28 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_release_schedule_update_for_3?= =?utf-8?b?LjIuNCBhbmQgMy4zLjE=?= Message-ID: <3ZWdNr0QdfzNtB@mail.python.org> http://hg.python.org/peps/rev/c4798da31ab0 changeset: 4815:c4798da31ab0 user: Georg Brandl date: Thu Mar 21 07:28:31 2013 +0100 summary: release schedule update for 3.2.4 and 3.3.1 files: pep-0392.txt | 6 ++---- pep-0398.txt | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pep-0392.txt b/pep-0392.txt --- a/pep-0392.txt +++ b/pep-0392.txt @@ -87,10 +87,8 @@ 3.2.4 schedule -------------- -- 3.2.4 beta 1: planned for Oct/Nov 2012 -- 3.2.4 candidate 1: following two weeks after beta 1 -- 3.2.4 final: following two weeks after candidate 1, if no further RC - are necessary +- 3.2.4 candidate 1: March 23, 2013 +- 3.2.4 final: April 6, 2013 -- Only security releases after 3.2.4 -- diff --git a/pep-0398.txt b/pep-0398.txt --- a/pep-0398.txt +++ b/pep-0398.txt @@ -70,10 +70,8 @@ 3.3.1 schedule -------------- -- 3.3.1 beta 1: planned for Oct/Nov 2012 -- 3.3.1 candidate 1: following two weeks after beta 1 -- 3.3.1 final: following two weeks after candidate 1, if no further RC - are necessary +- 3.3.1 candidate 1: March 23, 2013 +- 3.3.1 final: April 6, 2013 Features for 3.3 -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Mar 21 08:33:43 2013 From: python-checkins at python.org (georg.brandl) Date: Thu, 21 Mar 2013 08:33:43 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?devguide=3A_Add_Roger=2E?= Message-ID: <3ZWfr707qWzSFV@mail.python.org> http://hg.python.org/devguide/rev/1c1f42a0d911 changeset: 613:1c1f42a0d911 user: Georg Brandl date: Thu Mar 21 08:33:38 2013 +0100 summary: Add Roger. files: developers.rst | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/developers.rst b/developers.rst --- a/developers.rst +++ b/developers.rst @@ -24,6 +24,9 @@ Permissions History ------------------- +- Roger Serwy was given push privileges on Mar 21 2013 by GFB, for IDLE + contributions, on recommendation by Ned Deily. + - Serhiy Storchaka was given push privileges on Dec 26 2012 by GFB, for general contributions, on recommendation by Trent Nelson. -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Thu Mar 21 12:21:54 2013 From: python-checkins at python.org (victor.stinner) Date: Thu, 21 Mar 2013 12:21:54 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE3MjA5?= =?utf-8?q?=3A_curses=2Ewindow=2Eget=5Fwch=28=29_now_handles_correctly_Key?= =?utf-8?q?boardInterrupt?= Message-ID: <3ZWlvQ0PFMzSCd@mail.python.org> http://hg.python.org/cpython/rev/d98a515489db changeset: 82867:d98a515489db branch: 3.3 parent: 82865:d068fcbe5009 user: Victor Stinner date: Thu Mar 21 12:21:06 2013 +0100 summary: Issue #17209: curses.window.get_wch() now handles correctly KeyboardInterrupt (CTRL+c) files: Misc/NEWS | 3 +++ Modules/_cursesmodule.c | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -196,6 +196,9 @@ Library ------- +- Issue #17209: curses.window.get_wch() now handles correctly KeyboardInterrupt + (CTRL+c). + - Issue #5713: smtplib now handles 421 (closing connection) error codes when sending mail by closing the socket and reporting the 421 error code via the exception appropriate to the command that received the error response. diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -1181,6 +1181,9 @@ return NULL; } if (ct == ERR) { + if (PyErr_CheckSignals()) + return NULL; + /* get_wch() returns ERR in nodelay mode */ PyErr_SetString(PyCursesError, "no input"); return NULL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 12:21:55 2013 From: python-checkins at python.org (victor.stinner) Date: Thu, 21 Mar 2013 12:21:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogKE1lcmdlIDMuMykgSXNzdWUgIzE3MjA5OiBjdXJzZXMud2luZG93Lmdl?= =?utf-8?q?t=5Fwch=28=29_now_handles_correctly?= Message-ID: <3ZWlvR37QZzRwR@mail.python.org> http://hg.python.org/cpython/rev/b9d9bba9dfe5 changeset: 82868:b9d9bba9dfe5 parent: 82866:fcef6a33de17 parent: 82867:d98a515489db user: Victor Stinner date: Thu Mar 21 12:21:43 2013 +0100 summary: (Merge 3.3) Issue #17209: curses.window.get_wch() now handles correctly KeyboardInterrupt (CTRL+c) files: Misc/NEWS | 3 +++ Modules/_cursesmodule.c | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -292,6 +292,9 @@ Library ------- +- Issue #17209: curses.window.get_wch() now handles correctly KeyboardInterrupt + (CTRL+c). + - Issue #5713: smtplib now handles 421 (closing connection) error codes when sending mail by closing the socket and reporting the 421 error code via the exception appropriate to the command that received the error response. diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -1181,6 +1181,9 @@ return NULL; } if (ct == ERR) { + if (PyErr_CheckSignals()) + return NULL; + /* get_wch() returns ERR in nodelay mode */ PyErr_SetString(PyCursesError, "no input"); return NULL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 17:13:29 2013 From: python-checkins at python.org (richard.jones) Date: Thu, 21 Mar 2013 17:13:29 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_correct_spelling_of_Phillip_E?= =?utf-8?q?by=27s_name?= Message-ID: <3ZWtMs2GRPzSLK@mail.python.org> http://hg.python.org/peps/rev/6605b658710c changeset: 4816:6605b658710c parent: 4813:5900f1d6f0b1 user: Richard Jones date: Wed Mar 20 23:49:47 2013 -0700 summary: correct spelling of Phillip Eby's name files: pep-0438.txt | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pep-0438.txt b/pep-0438.txt --- a/pep-0438.txt +++ b/pep-0438.txt @@ -57,7 +57,7 @@ When PyPI went online, it offered release registration but had no facility to host release files itself. When hosting was added, no -automated downloading tool existed yet. When Philip Eby implemented +automated downloading tool existed yet. When Phillip Eby implemented automated downloading (through setuptools), he made the choice to allow people to use download hosts of their choice. The finding of externally-hosted packages was implemented as follows: @@ -424,7 +424,7 @@ References ========== -.. [1] Philip Eby, easy_install 'Package Index "API"' documentation, +.. [1] Phillip Eby, easy_install 'Package Index "API"' documentation, http://peak.telecommunity.com/DevCenter/EasyInstall#package-index-api .. [2] Donald Stufft, automated analysis of PyPI project links, @@ -441,7 +441,7 @@ Acknowledgments =============== -Philip Eby for precise information and the basic ideas to implement +Phillip Eby for precise information and the basic ideas to implement the transition via server-side changes only. Donald Stufft for pushing away from external hosting and offering to -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Mar 21 17:13:30 2013 From: python-checkins at python.org (richard.jones) Date: Thu, 21 Mar 2013 17:13:30 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps_=28merge_default_-=3E_default=29?= =?utf-8?q?=3A_merge?= Message-ID: <3ZWtMt6Cd1zSLK@mail.python.org> http://hg.python.org/peps/rev/be717b8c29e1 changeset: 4817:be717b8c29e1 parent: 4816:6605b658710c parent: 4815:c4798da31ab0 user: Richard Jones date: Thu Mar 21 09:13:23 2013 -0700 summary: merge files: pep-0392.txt | 6 +- pep-0398.txt | 6 +- pep-0439.txt | 199 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 203 insertions(+), 8 deletions(-) diff --git a/pep-0392.txt b/pep-0392.txt --- a/pep-0392.txt +++ b/pep-0392.txt @@ -87,10 +87,8 @@ 3.2.4 schedule -------------- -- 3.2.4 beta 1: planned for Oct/Nov 2012 -- 3.2.4 candidate 1: following two weeks after beta 1 -- 3.2.4 final: following two weeks after candidate 1, if no further RC - are necessary +- 3.2.4 candidate 1: March 23, 2013 +- 3.2.4 final: April 6, 2013 -- Only security releases after 3.2.4 -- diff --git a/pep-0398.txt b/pep-0398.txt --- a/pep-0398.txt +++ b/pep-0398.txt @@ -70,10 +70,8 @@ 3.3.1 schedule -------------- -- 3.3.1 beta 1: planned for Oct/Nov 2012 -- 3.3.1 candidate 1: following two weeks after beta 1 -- 3.3.1 final: following two weeks after candidate 1, if no further RC - are necessary +- 3.3.1 candidate 1: March 23, 2013 +- 3.3.1 final: April 6, 2013 Features for 3.3 diff --git a/pep-0439.txt b/pep-0439.txt new file mode 100644 --- /dev/null +++ b/pep-0439.txt @@ -0,0 +1,199 @@ +PEP: 439 +Title: Inclusion of pip bootstrap in Python installation +Version: $Revision$ +Last-Modified: $Date$ +Author: Richard Jones +BDFL-Delegate: Nick Coghlan +Discussions-To: +Status: Draft +Type: Standards Track +Created: 18-Mar-2013 +Python-Version: 3.4 +Post-History: 19-Mar-2013 + + +Abstract +======== + +This PEP proposes the inclusion of a pip boostrap executable in the +Python installation to simplify the use of 3rd-party modules by Python +users. + +This PEP does not propose to include the pip implementation in the +Python standard library. Nor does it propose to implement any package +management or installation mechanisms beyond those provided by PEPs +427 ("The Wheel Binary Package Format 1.0") and TODO distlib PEP. + + +Rationale +========= + +Currently the user story for installing 3rd-party Python modules is +not as simple as it could be. It requires that all 3rd-party modules +inform the user of how to install the installer, typically via a link +to the installer. That link may be out of date or the steps required +to perform the install of the installer may be enough of a roadblock +to prevent the user from further progress. + +Large Python projects which emphasise a low barrier to entry have +shied away from depending on third party packages because of the +introduction of this potential stumbling block for new users. + +With the inclusion of the package installer command in the standard +Python installation the barrier to installing additional software is +considerably reduced. It is hoped that this will therefore increase +the likelihood that Python projects will reuse third party software. + +It is also hoped that this is reduces the number of proposals to +include more and more software in the Python standard library, and +therefore that more popular Python software is more easily upgradeable +beyond requiring Python installation upgrades. + + +Proposal +======== + +Python install includes an executable called "pip" that attempts to +import pip machinery. If it can then the pip command proceeds as +normal. If it cannot it will bootstrap pip by downloading the pip +implementation wheel file. Once installed, the pip command proceeds +as normal. + +A boostrap is used in the place of a the full pip code so that we +don't have to bundle pip and also the install tool is upgradeable +outside of the regular Python upgrade timeframe and processes. + +To avoid issues with sudo we will have the bootstrap default to +installing the pip implementation to the per-user site-packages +directory defined in PEP 370 and implemented in Python 2.6/3.0. Since +we avoid installing to the system Python we also avoid conflicting +with any other packaging system (on Linux systems, for example.) If +the user is inside a virtual environment [1]_ then the pip +implementation will be installed into that virtual environment. + +The bootstrapping process will proceed as follows: + +1. The user system has Python (3.4+) installed. In the "scripts" + directory of the Python installation there is the bootstrap script + called "pip". +2. The user will invoke a pip command, typically "pip install + ", for example "pip install Django". +3. The boostrap script will attempt to import the pip implementation. + If this succeeds, the pip command is processed normally. +4. On failing to import the pip implementation the bootstrap notifies + the user that it is "upgrading pip" and contacts PyPI to obtain the + latest download wheel file (see PEP 427.) +5. Upon downloading the file it is installed using the distlib + installation machinery for wheel packages. Upon completing the + installation the user is notified that "pip has been upgraded." + TODO how is it verified? +6. The pip tool may now import the pip implementation and continues to + process the requested user command normally. + +Users may be running in an environment which cannot access the public +Internet and are relying solely on a local package repository. They +would use the "-i" (Base URL of Python Package Index) argument to the +"pip install" command. This use case will be handled by: + +1. Recognising the command-line arguments that specify alternative or + additional locations to discover packages and attempting to + download the package from those locations. +2. If the package is not found there then we attempt to donwload it + using the standard "https://pypi.python.org/pypi/simple/pip" index. +3. If that also fails, for any reason, we indicate to the user the + operation we were attempting, the reason for failure (if we know + it) and display further instructions for downloading and installing + the file manually. + +Manual installation of the pip implementation will be supported +through the manual download of the wheel file and "pip install +". + +This installation will not perform standard pip installation steps of +saving the file to a cache directory or updating any local database of +installed files. + +The download of the pip implementation install file should be +performed securely. The transport from pypi.python.org will be done +over HTTPS but the CA certificate check will most likely not be +performed. Therefore we will utilise the embedded signature support +in the wheel format to validate the downloaded file. + +Beyond those arguments controlling index location and download +options, the "pip" boostrap command may support further standard pip +options for verbosity, quietness and logging. + +The "--no-install" option to the "pip" command will not affect the +bootstrapping process. + +An additional new Python package will be proposed, "pypublish", which +will be a tool for publishing packages to PyPI. It would replace the +current "python setup.py register" and "python setup.py upload" +distutils commands. Again because of the measured Python release +cycle and extensive existing Python installations these commands are +difficult to bugfix and extend. Additionally it is desired that the +"register" and "upload" commands be able to be performed over HTTPS +with certificate validation. Since shipping CA certificate keychains +with Python is not really feasible (updating the keychain is quite +difficult to manage) it is desirable that those commands, and the +accompanying keychain, be made installable and upgradeable outside of +Python itself. + + +Implementation +============== + +TBD + + +Risks +===== + +The Fedora variant of Linux has had a separate program called "pip" (a +Perl package installer) available for install for some time. The +current Python "pip" program is installed as "pip-python". It is +hoped that the Fedora community will resolve this issue by renaming +the Perl installer. + +Currently pip depends upon setuptools functionality. It is intended +that before Python 3.4 is shipped that the required functionlity will +be present in Python's standard library as the distlib module, and +that pip would be modified to use that functionality when present. +TODO PEP reference for distlib + +The key that is used to sign the pip implementation download might be +compromised and this PEP currently proposes no mechanism for key +revocation. + + +References +========== + +.. [1] PEP 405, Python Virtual Environments + http://www.python.org/dev/peps/pep-0405/ + + +Acknowledgments +=============== + +Nick Coghlan for his thoughts on the proposal and dealing with the Red +Hat issue. + +Jannis Leidel and Carl Meyer for their thoughts. + + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Mar 21 19:09:30 2013 From: python-checkins at python.org (richard.jones) Date: Thu, 21 Mar 2013 19:09:30 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_fix_content-type?= Message-ID: <3ZWwxk0H4szSZm@mail.python.org> http://hg.python.org/peps/rev/5158dad0b1ae changeset: 4818:5158dad0b1ae user: Richard Jones date: Thu Mar 21 11:09:22 2013 -0700 summary: fix content-type files: pep-0439.txt | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/pep-0439.txt b/pep-0439.txt --- a/pep-0439.txt +++ b/pep-0439.txt @@ -10,6 +10,7 @@ Created: 18-Mar-2013 Python-Version: 3.4 Post-History: 19-Mar-2013 +Content-Type: text/x-rst Abstract -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Mar 21 21:40:07 2013 From: python-checkins at python.org (matthias.klose) Date: Thu, 21 Mar 2013 21:40:07 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogLSBJc3N1ZSAjMTY3?= =?utf-8?q?54=3A_Fix_the_incorrect_shared_library_extension_on_linux=2E_In?= =?utf-8?q?troduce?= Message-ID: <3ZX0HW0wf4zSqR@mail.python.org> http://hg.python.org/cpython/rev/8f91014c8f00 changeset: 82869:8f91014c8f00 branch: 3.2 parent: 82858:2ce557101136 user: doko at ubuntu.com date: Thu Mar 21 13:21:49 2013 -0700 summary: - Issue #16754: Fix the incorrect shared library extension on linux. Introduce two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. files: Doc/whatsnew/3.2.rst | 4 +- Lib/distutils/command/build_ext.py | 6 +- Lib/distutils/sysconfig.py | 8 +- Lib/distutils/tests/test_build_ext.py | 8 +- Lib/distutils/tests/test_install.py | 2 +- Lib/sysconfig.py | 1 + Makefile.pre.in | 11 ++- Misc/NEWS | 4 + Misc/python-config.in | 2 +- configure | 66 ++++++-------- configure.ac | 59 +++++------- pyconfig.h.in | 3 - setup.py | 13 +-- 13 files changed, 88 insertions(+), 99 deletions(-) diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst --- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -368,9 +368,9 @@ module:: >>> import sysconfig - >>> sysconfig.get_config_var('SOABI') # find the version tag + >>> sysconfig.get_config_var('SOABI') # find the version tag 'cpython-32mu' - >>> sysconfig.get_config_var('SO') # find the full filename extension + >>> sysconfig.get_config_var('EXT_SUFFIX') # find the full filename extension '.cpython-32mu.so' .. seealso:: diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -667,10 +667,10 @@ if os.name == "os2": ext_path[len(ext_path) - 1] = ext_path[len(ext_path) - 1][:8] # extensions in debug_mode are named 'module_d.pyd' under windows - so_ext = get_config_var('SO') + ext_suffix = get_config_var('EXT_SUFFIX') if os.name == 'nt' and self.debug: - return os.path.join(*ext_path) + '_d' + so_ext - return os.path.join(*ext_path) + so_ext + return os.path.join(*ext_path) + '_d' + ext_suffix + return os.path.join(*ext_path) + ext_suffix def get_export_symbols(self, ext): """Return the list of symbols that a shared extension has to diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -170,9 +170,9 @@ _osx_support.customize_compiler(_config_vars) _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' - (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \ + (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', - 'CCSHARED', 'LDSHARED', 'SO', 'AR', 'ARFLAGS') + 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') newcc = None if 'CC' in os.environ: @@ -211,7 +211,7 @@ linker_exe=cc, archiver=archiver) - compiler.shared_lib_extension = so_ext + compiler.shared_lib_extension = shlib_suffix def get_config_h_filename(): @@ -466,6 +466,7 @@ g['INCLUDEPY'] = get_python_inc(plat_specific=0) g['SO'] = '.pyd' + g['EXT_SUFFIX'] = '.pyd' g['EXE'] = ".exe" g['VERSION'] = get_python_version().replace(".", "") g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable)) @@ -485,6 +486,7 @@ g['INCLUDEPY'] = get_python_inc(plat_specific=0) g['SO'] = '.pyd' + g['EXT_SUFFIX'] = '.pyd' g['EXE'] = ".exe" global _config_vars diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -318,8 +318,8 @@ finally: os.chdir(old_wd) self.assertTrue(os.path.exists(so_file)) - so_ext = sysconfig.get_config_var('SO') - self.assertTrue(so_file.endswith(so_ext)) + ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') + self.assertTrue(so_file.endswith(ext_suffix)) so_dir = os.path.dirname(so_file) self.assertEqual(so_dir, other_tmp_dir) @@ -328,7 +328,7 @@ cmd.run() so_file = cmd.get_outputs()[0] self.assertTrue(os.path.exists(so_file)) - self.assertTrue(so_file.endswith(so_ext)) + self.assertTrue(so_file.endswith(ext_suffix)) so_dir = os.path.dirname(so_file) self.assertEqual(so_dir, cmd.build_lib) @@ -355,7 +355,7 @@ self.assertEqual(lastdir, 'bar') def test_ext_fullpath(self): - ext = sysconfig.get_config_vars()['SO'] + ext = sysconfig.get_config_var('EXT_SUFFIX') # building lxml.etree inplace #etree_c = os.path.join(self.tmp_dir, 'lxml.etree.c') #etree_ext = Extension('lxml.etree', [etree_c]) diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py --- a/Lib/distutils/tests/test_install.py +++ b/Lib/distutils/tests/test_install.py @@ -23,7 +23,7 @@ def _make_ext_name(modname): if os.name == 'nt' and sys.executable.endswith('_d.exe'): modname += '_d' - return modname + sysconfig.get_config_var('SO') + return modname + sysconfig.get_config_var('EXT_SUFFIX') class InstallTestCase(support.TempdirManager, diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -360,6 +360,7 @@ vars['BINLIBDEST'] = get_path('platstdlib') vars['INCLUDEPY'] = get_path('include') vars['SO'] = '.pyd' + vars['EXT_SUFFIX'] = '.pyd' vars['EXE'] = '.exe' vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable)) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -125,7 +125,9 @@ CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION) # Symbols used for using shared libraries -SO= @SO@ +SHLIB_SUFFIX= @SHLIB_SUFFIX@ +EXT_SUFFIX= @EXT_SUFFIX@ +SO= $(SHLIB_SUFFIX) LDSHARED= @LDSHARED@ $(PY_LDFLAGS) BLDSHARED= @BLDSHARED@ $(PY_LDFLAGS) LDCXXSHARED= @LDCXXSHARED@ @@ -598,6 +600,11 @@ -DSOABI='"$(SOABI)"' \ -o $@ $(srcdir)/Python/dynload_shlib.c +Python/dynload_hpux.o: $(srcdir)/Python/dynload_hpux.c Makefile + $(CC) -c $(PY_CORE_CFLAGS) \ + -DSHLIB_EXT='"$(EXT_SUFFIX)"' \ + -o $@ $(srcdir)/Python/dynload_hpux.c + Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile $(CC) -c $(PY_CORE_CFLAGS) \ -DABIFLAGS='"$(ABIFLAGS)"' \ @@ -1098,7 +1105,7 @@ done @if test -d $(LIBRARY); then :; else \ if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ - if test "$(SO)" = .dll; then \ + if test "$(SHLIB_SUFFIX)" = .dll; then \ $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ else \ $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1073,6 +1073,10 @@ Build ----- +- Issue #16754: Fix the incorrect shared library extension on linux. Introduce + two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of + SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. + - Issue #5033: Fix building of the sqlite3 extension module when the SQLite library version has "beta" in it. Patch by Andreas Pelme. diff --git a/Misc/python-config.in b/Misc/python-config.in --- a/Misc/python-config.in +++ b/Misc/python-config.in @@ -57,7 +57,7 @@ print(' '.join(libs)) elif opt == '--extension-suffix': - print(sysconfig.get_config_var('SO')) + print(sysconfig.get_config_var('EXT_SUFFIX')) elif opt == '--abiflags': print(sys.abiflags) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -626,6 +626,7 @@ ac_subst_vars='LTLIBOBJS SRCDIRS THREADHEADERS +EXT_SUFFIX SOABI LIBC LIBM @@ -653,7 +654,7 @@ BLDSHARED LDCXXSHARED LDSHARED -SO +SHLIB_SUFFIX LIBTOOL_CRUFT OTHER_LIBTOOL_OPT UNIVERSAL_ARCH_FLAGS @@ -7701,10 +7702,24 @@ - -cat >>confdefs.h <<_ACEOF -#define SHLIB_EXT "$SO" -_ACEOF +# SHLIB_SUFFIX is the extension of shared libraries `(including the dot!) +# -- usually .so, .sl on HP-UX, .dll on Cygwin +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the extension of shared libraries" >&5 +$as_echo_n "checking the extension of shared libraries... " >&6; } +if test -z "$SHLIB_SUFFIX"; then + case $ac_sys_system in + hp*|HP*) + case `uname -m` in + ia64) SHLIB_SUFFIX=.so;; + *) SHLIB_SUFFIX=.sl;; + esac + ;; + CYGWIN*) SHLIB_SUFFIX=.dll;; + *) SHLIB_SUFFIX=.so;; + esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHLIB_SUFFIX" >&5 +$as_echo "$SHLIB_SUFFIX" >&6; } # LDSHARED is the ld *command* used to create shared library # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5 @@ -12843,45 +12858,20 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SOABI" >&5 $as_echo "$SOABI" >&6; } + +case $ac_sys_system in + Linux*|GNU*) + EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};; + *) + EXT_SUFFIX=${SHLIB_SUFFIX};; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking LDVERSION" >&5 $as_echo_n "checking LDVERSION... " >&6; } LDVERSION='$(VERSION)$(ABIFLAGS)' { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDVERSION" >&5 $as_echo "$LDVERSION" >&6; } -# SO is the extension of shared libraries `(including the dot!) -# -- usually .so, .sl on HP-UX, .dll on Cygwin -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking SO" >&5 -$as_echo_n "checking SO... " >&6; } -if test -z "$SO" -then - case $ac_sys_system in - hp*|HP*) - case `uname -m` in - ia64) SO=.so;; - *) SO=.sl;; - esac - ;; - CYGWIN*) SO=.dll;; - Linux*|GNU*) - SO=.${SOABI}.so;; - *) SO=.so;; - esac -else - # this might also be a termcap variable, see #610332 - echo - echo '=====================================================================' - echo '+ +' - echo '+ WARNING: You have set SO in your environment. +' - echo '+ Do you really mean to change the extension for shared libraries? +' - echo '+ Continuing in 10 seconds to let you to ponder. +' - echo '+ +' - echo '=====================================================================' - sleep 10 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SO" >&5 -$as_echo "$SO" >&6; } - # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether right shift extends the sign bit" >&5 diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -1721,14 +1721,30 @@ esac # Set info about shared libraries. -AC_SUBST(SO) +AC_SUBST(SHLIB_SUFFIX) AC_SUBST(LDSHARED) AC_SUBST(LDCXXSHARED) AC_SUBST(BLDSHARED) AC_SUBST(CCSHARED) AC_SUBST(LINKFORSHARED) -AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).]) +# SHLIB_SUFFIX is the extension of shared libraries `(including the dot!) +# -- usually .so, .sl on HP-UX, .dll on Cygwin +AC_MSG_CHECKING(the extension of shared libraries) +if test -z "$SHLIB_SUFFIX"; then + case $ac_sys_system in + hp*|HP*) + case `uname -m` in + ia64) SHLIB_SUFFIX=.so;; + *) SHLIB_SUFFIX=.sl;; + esac + ;; + CYGWIN*) SHLIB_SUFFIX=.dll;; + *) SHLIB_SUFFIX=.so;; + esac +fi +AC_MSG_RESULT($SHLIB_SUFFIX) + # LDSHARED is the ld *command* used to create shared library # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5 # (Shared libraries in this instance are shared modules to be loaded into @@ -3754,41 +3770,18 @@ SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS} AC_MSG_RESULT($SOABI) +AC_SUBST(EXT_SUFFIX) +case $ac_sys_system in + Linux*|GNU*) + EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};; + *) + EXT_SUFFIX=${SHLIB_SUFFIX};; +esac + AC_MSG_CHECKING(LDVERSION) LDVERSION='$(VERSION)$(ABIFLAGS)' AC_MSG_RESULT($LDVERSION) -# SO is the extension of shared libraries `(including the dot!) -# -- usually .so, .sl on HP-UX, .dll on Cygwin -AC_MSG_CHECKING(SO) -if test -z "$SO" -then - case $ac_sys_system in - hp*|HP*) - case `uname -m` in - ia64) SO=.so;; - *) SO=.sl;; - esac - ;; - CYGWIN*) SO=.dll;; - Linux*|GNU*) - SO=.${SOABI}.so;; - *) SO=.so;; - esac -else - # this might also be a termcap variable, see #610332 - echo - echo '=====================================================================' - echo '+ +' - echo '+ WARNING: You have set SO in your environment. +' - echo '+ Do you really mean to change the extension for shared libraries? +' - echo '+ Continuing in 10 seconds to let you to ponder. +' - echo '+ +' - echo '=====================================================================' - sleep 10 -fi -AC_MSG_RESULT($SO) - # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). AC_MSG_CHECKING(whether right shift extends the sign bit) diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1003,9 +1003,6 @@ /* Define if setpgrp() must be called as setpgrp(0, 0). */ #undef SETPGRP_HAVE_ARG -/* Define this to be extension of shared libraries (including the dot!). */ -#undef SHLIB_EXT - /* Define if i>>j for signed int i does not extend the sign bit when i < 0 */ #undef SIGNED_RIGHT_SHIFT_ZERO_FILLS diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -163,13 +163,7 @@ def build_extensions(self): # Detect which modules should be compiled - old_so = self.compiler.shared_lib_extension - # Workaround PEP 3149 stuff - self.compiler.shared_lib_extension = os.environ.get("SO", ".so") - try: - missing = self.detect_modules() - finally: - self.compiler.shared_lib_extension = old_so + missing = self.detect_modules() # Remove modules that are present on the disabled list extensions = [ext for ext in self.extensions @@ -1835,7 +1829,8 @@ # mode 644 unless they are a shared library in which case they will get # mode 755. All installed directories will get mode 755. - so_ext = sysconfig.get_config_var("SO") + # this is works for EXT_SUFFIX too, which ends with SHLIB_SUFFIX + shlib_suffix = sysconfig.get_config_var("SHLIB_SUFFIX") def install(self): outfiles = install_lib.install(self) @@ -1850,7 +1845,7 @@ for filename in files: if os.path.islink(filename): continue mode = defaultMode - if filename.endswith(self.so_ext): mode = sharedLibMode + if filename.endswith(self.shlib_suffix): mode = sharedLibMode log.info("changing mode of %s to %o", filename, mode) if not self.dry_run: os.chmod(filename, mode) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 21:40:09 2013 From: python-checkins at python.org (matthias.klose) Date: Thu, 21 Mar 2013 21:40:09 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_-_Issue_=2316754=3A_Fix_the_incorrect_shared_library_extension?= =?utf-8?q?_on_linux=2E_Introduce?= Message-ID: <3ZX0HY0Z9mzSpD@mail.python.org> http://hg.python.org/cpython/rev/14f0c9e595a5 changeset: 82870:14f0c9e595a5 branch: 3.3 parent: 82867:d98a515489db parent: 82869:8f91014c8f00 user: doko at ubuntu.com date: Thu Mar 21 13:31:41 2013 -0700 summary: - Issue #16754: Fix the incorrect shared library extension on linux. Introduce two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. files: Doc/whatsnew/3.2.rst | 4 +- Lib/distutils/command/build_ext.py | 6 +- Lib/distutils/sysconfig.py | 8 +- Lib/distutils/tests/test_build_ext.py | 8 +- Lib/distutils/tests/test_install.py | 2 +- Lib/sysconfig.py | 1 + Makefile.pre.in | 11 +- Misc/NEWS | 4 + Misc/python-config.in | 2 +- configure | 69 ++++++-------- configure.ac | 60 +++++------- setup.py | 13 +- 12 files changed, 89 insertions(+), 99 deletions(-) diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst --- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -368,9 +368,9 @@ module:: >>> import sysconfig - >>> sysconfig.get_config_var('SOABI') # find the version tag + >>> sysconfig.get_config_var('SOABI') # find the version tag 'cpython-32mu' - >>> sysconfig.get_config_var('SO') # find the full filename extension + >>> sysconfig.get_config_var('EXT_SUFFIX') # find the full filename extension '.cpython-32mu.so' .. seealso:: diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -677,10 +677,10 @@ if os.name == "os2": ext_path[len(ext_path) - 1] = ext_path[len(ext_path) - 1][:8] # extensions in debug_mode are named 'module_d.pyd' under windows - so_ext = get_config_var('SO') + ext_suffix = get_config_var('EXT_SUFFIX') if os.name == 'nt' and self.debug: - return os.path.join(*ext_path) + '_d' + so_ext - return os.path.join(*ext_path) + so_ext + return os.path.join(*ext_path) + '_d' + ext_suffix + return os.path.join(*ext_path) + ext_suffix def get_export_symbols(self, ext): """Return the list of symbols that a shared extension has to diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -191,9 +191,9 @@ _osx_support.customize_compiler(_config_vars) _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' - (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \ + (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', - 'CCSHARED', 'LDSHARED', 'SO', 'AR', 'ARFLAGS') + 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') newcc = None if 'CC' in os.environ: @@ -232,7 +232,7 @@ linker_exe=cc, archiver=archiver) - compiler.shared_lib_extension = so_ext + compiler.shared_lib_extension = shlib_suffix def get_config_h_filename(): @@ -487,6 +487,7 @@ g['INCLUDEPY'] = get_python_inc(plat_specific=0) g['SO'] = '.pyd' + g['EXT_SUFFIX'] = '.pyd' g['EXE'] = ".exe" g['VERSION'] = get_python_version().replace(".", "") g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable)) @@ -506,6 +507,7 @@ g['INCLUDEPY'] = get_python_inc(plat_specific=0) g['SO'] = '.pyd' + g['EXT_SUFFIX'] = '.pyd' g['EXE'] = ".exe" global _config_vars diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -318,8 +318,8 @@ finally: os.chdir(old_wd) self.assertTrue(os.path.exists(so_file)) - so_ext = sysconfig.get_config_var('SO') - self.assertTrue(so_file.endswith(so_ext)) + ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') + self.assertTrue(so_file.endswith(ext_suffix)) so_dir = os.path.dirname(so_file) self.assertEqual(so_dir, other_tmp_dir) @@ -328,7 +328,7 @@ cmd.run() so_file = cmd.get_outputs()[0] self.assertTrue(os.path.exists(so_file)) - self.assertTrue(so_file.endswith(so_ext)) + self.assertTrue(so_file.endswith(ext_suffix)) so_dir = os.path.dirname(so_file) self.assertEqual(so_dir, cmd.build_lib) @@ -355,7 +355,7 @@ self.assertEqual(lastdir, 'bar') def test_ext_fullpath(self): - ext = sysconfig.get_config_vars()['SO'] + ext = sysconfig.get_config_var('EXT_SUFFIX') # building lxml.etree inplace #etree_c = os.path.join(self.tmp_dir, 'lxml.etree.c') #etree_ext = Extension('lxml.etree', [etree_c]) diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py --- a/Lib/distutils/tests/test_install.py +++ b/Lib/distutils/tests/test_install.py @@ -23,7 +23,7 @@ def _make_ext_name(modname): if os.name == 'nt' and sys.executable.endswith('_d.exe'): modname += '_d' - return modname + sysconfig.get_config_var('SO') + return modname + sysconfig.get_config_var('EXT_SUFFIX') class InstallTestCase(support.TempdirManager, diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -437,6 +437,7 @@ vars['BINLIBDEST'] = get_path('platstdlib') vars['INCLUDEPY'] = get_path('include') vars['SO'] = '.pyd' + vars['EXT_SUFFIX'] = '.pyd' vars['EXE'] = '.exe' vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable)) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -125,7 +125,9 @@ CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION) # Symbols used for using shared libraries -SO= @SO@ +SHLIB_SUFFIX= @SHLIB_SUFFIX@ +EXT_SUFFIX= @EXT_SUFFIX@ +SO= $(SHLIB_SUFFIX) LDSHARED= @LDSHARED@ $(PY_LDFLAGS) BLDSHARED= @BLDSHARED@ $(PY_LDFLAGS) LDCXXSHARED= @LDCXXSHARED@ @@ -652,6 +654,11 @@ -DSOABI='"$(SOABI)"' \ -o $@ $(srcdir)/Python/dynload_shlib.c +Python/dynload_hpux.o: $(srcdir)/Python/dynload_hpux.c Makefile + $(CC) -c $(PY_CORE_CFLAGS) \ + -DSHLIB_EXT='"$(EXT_SUFFIX)"' \ + -o $@ $(srcdir)/Python/dynload_hpux.c + Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile $(CC) -c $(PY_CORE_CFLAGS) \ -DABIFLAGS='"$(ABIFLAGS)"' \ @@ -1186,7 +1193,7 @@ done @if test -d $(LIBRARY); then :; else \ if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ - if test "$(SO)" = .dll; then \ + if test "$(SHLIB_SUFFIX)" = .dll; then \ $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ else \ $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -794,6 +794,10 @@ Build ----- +- Issue #16754: Fix the incorrect shared library extension on linux. Introduce + two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of + SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. + - Issue #5033: Fix building of the sqlite3 extension module when the SQLite library version has "beta" in it. Patch by Andreas Pelme. diff --git a/Misc/python-config.in b/Misc/python-config.in --- a/Misc/python-config.in +++ b/Misc/python-config.in @@ -57,7 +57,7 @@ print(' '.join(libs)) elif opt == '--extension-suffix': - print(sysconfig.get_config_var('SO')) + print(sysconfig.get_config_var('EXT_SUFFIX')) elif opt == '--abiflags': print(sys.abiflags) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -625,6 +625,7 @@ ac_subst_vars='LTLIBOBJS SRCDIRS THREADHEADERS +EXT_SUFFIX SOABI LIBC LIBM @@ -652,7 +653,7 @@ BLDSHARED LDCXXSHARED LDSHARED -SO +SHLIB_SUFFIX LIBTOOL_CRUFT OTHER_LIBTOOL_OPT UNIVERSAL_ARCH_FLAGS @@ -8392,6 +8393,25 @@ +# SHLIB_SUFFIX is the extension of shared libraries `(including the dot!) +# -- usually .so, .sl on HP-UX, .dll on Cygwin +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the extension of shared libraries" >&5 +$as_echo_n "checking the extension of shared libraries... " >&6; } +if test -z "$SHLIB_SUFFIX"; then + case $ac_sys_system in + hp*|HP*) + case `uname -m` in + ia64) SHLIB_SUFFIX=.so;; + *) SHLIB_SUFFIX=.sl;; + esac + ;; + CYGWIN*) SHLIB_SUFFIX=.dll;; + *) SHLIB_SUFFIX=.so;; + esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHLIB_SUFFIX" >&5 +$as_echo "$SHLIB_SUFFIX" >&6; } + # LDSHARED is the ld *command* used to create shared library # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5 # (Shared libraries in this instance are shared modules to be loaded into @@ -13685,51 +13705,20 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SOABI" >&5 $as_echo "$SOABI" >&6; } + +case $ac_sys_system in + Linux*|GNU*) + EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};; + *) + EXT_SUFFIX=${SHLIB_SUFFIX};; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking LDVERSION" >&5 $as_echo_n "checking LDVERSION... " >&6; } LDVERSION='$(VERSION)$(ABIFLAGS)' { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDVERSION" >&5 $as_echo "$LDVERSION" >&6; } -# SO is the extension of shared libraries `(including the dot!) -# -- usually .so, .sl on HP-UX, .dll on Cygwin -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking SO" >&5 -$as_echo_n "checking SO... " >&6; } -if test -z "$SO" -then - case $ac_sys_system in - hp*|HP*) - case `uname -m` in - ia64) SO=.so;; - *) SO=.sl;; - esac - ;; - CYGWIN*) SO=.dll;; - Linux*|GNU*) - SO=.${SOABI}.so;; - *) SO=.so;; - esac -else - # this might also be a termcap variable, see #610332 - echo - echo '=====================================================================' - echo '+ +' - echo '+ WARNING: You have set SO in your environment. +' - echo '+ Do you really mean to change the extension for shared libraries? +' - echo '+ Continuing in 10 seconds to let you to ponder. +' - echo '+ +' - echo '=====================================================================' - sleep 10 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SO" >&5 -$as_echo "$SO" >&6; } - - -cat >>confdefs.h <<_ACEOF -#define SHLIB_EXT "$SO" -_ACEOF - - # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether right shift extends the sign bit" >&5 diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -1896,13 +1896,30 @@ esac # Set info about shared libraries. -AC_SUBST(SO) +AC_SUBST(SHLIB_SUFFIX) AC_SUBST(LDSHARED) AC_SUBST(LDCXXSHARED) AC_SUBST(BLDSHARED) AC_SUBST(CCSHARED) AC_SUBST(LINKFORSHARED) +# SHLIB_SUFFIX is the extension of shared libraries `(including the dot!) +# -- usually .so, .sl on HP-UX, .dll on Cygwin +AC_MSG_CHECKING(the extension of shared libraries) +if test -z "$SHLIB_SUFFIX"; then + case $ac_sys_system in + hp*|HP*) + case `uname -m` in + ia64) SHLIB_SUFFIX=.so;; + *) SHLIB_SUFFIX=.sl;; + esac + ;; + CYGWIN*) SHLIB_SUFFIX=.dll;; + *) SHLIB_SUFFIX=.so;; + esac +fi +AC_MSG_RESULT($SHLIB_SUFFIX) + # LDSHARED is the ld *command* used to create shared library # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5 # (Shared libraries in this instance are shared modules to be loaded into @@ -3925,43 +3942,18 @@ SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS} AC_MSG_RESULT($SOABI) +AC_SUBST(EXT_SUFFIX) +case $ac_sys_system in + Linux*|GNU*) + EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};; + *) + EXT_SUFFIX=${SHLIB_SUFFIX};; +esac + AC_MSG_CHECKING(LDVERSION) LDVERSION='$(VERSION)$(ABIFLAGS)' AC_MSG_RESULT($LDVERSION) -# SO is the extension of shared libraries `(including the dot!) -# -- usually .so, .sl on HP-UX, .dll on Cygwin -AC_MSG_CHECKING(SO) -if test -z "$SO" -then - case $ac_sys_system in - hp*|HP*) - case `uname -m` in - ia64) SO=.so;; - *) SO=.sl;; - esac - ;; - CYGWIN*) SO=.dll;; - Linux*|GNU*) - SO=.${SOABI}.so;; - *) SO=.so;; - esac -else - # this might also be a termcap variable, see #610332 - echo - echo '=====================================================================' - echo '+ +' - echo '+ WARNING: You have set SO in your environment. +' - echo '+ Do you really mean to change the extension for shared libraries? +' - echo '+ Continuing in 10 seconds to let you to ponder. +' - echo '+ +' - echo '=====================================================================' - sleep 10 -fi -AC_MSG_RESULT($SO) - -AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).]) - # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). AC_MSG_CHECKING(whether right shift extends the sign bit) diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -169,13 +169,7 @@ def build_extensions(self): # Detect which modules should be compiled - old_so = self.compiler.shared_lib_extension - # Workaround PEP 3149 stuff - self.compiler.shared_lib_extension = os.environ.get("SO", ".so") - try: - missing = self.detect_modules() - finally: - self.compiler.shared_lib_extension = old_so + missing = self.detect_modules() # Remove modules that are present on the disabled list extensions = [ext for ext in self.extensions @@ -2055,7 +2049,8 @@ # mode 644 unless they are a shared library in which case they will get # mode 755. All installed directories will get mode 755. - so_ext = sysconfig.get_config_var("SO") + # this is works for EXT_SUFFIX too, which ends with SHLIB_SUFFIX + shlib_suffix = sysconfig.get_config_var("SHLIB_SUFFIX") def install(self): outfiles = install_lib.install(self) @@ -2070,7 +2065,7 @@ for filename in files: if os.path.islink(filename): continue mode = defaultMode - if filename.endswith(self.so_ext): mode = sharedLibMode + if filename.endswith(self.shlib_suffix): mode = sharedLibMode log.info("changing mode of %s to %o", filename, mode) if not self.dry_run: os.chmod(filename, mode) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 21:40:10 2013 From: python-checkins at python.org (matthias.klose) Date: Thu, 21 Mar 2013 21:40:10 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_-_Issue_=2316754=3A_Fix_the_incorrect_shared_library_ext?= =?utf-8?q?ension_on_linux=2E_Introduce?= Message-ID: <3ZX0HZ5W90zSJq@mail.python.org> http://hg.python.org/cpython/rev/f6a6b4eed5b0 changeset: 82871:f6a6b4eed5b0 parent: 82868:b9d9bba9dfe5 parent: 82870:14f0c9e595a5 user: doko at ubuntu.com date: Thu Mar 21 13:39:52 2013 -0700 summary: - Issue #16754: Fix the incorrect shared library extension on linux. Introduce two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. files: Doc/whatsnew/3.2.rst | 4 +- Lib/distutils/command/build_ext.py | 6 +- Lib/distutils/sysconfig.py | 8 +- Lib/distutils/tests/test_build_ext.py | 8 +- Lib/distutils/tests/test_install.py | 2 +- Lib/sysconfig.py | 2 +- Makefile.pre.in | 10 +- Misc/NEWS | 4 + Misc/python-config.in | 2 +- configure | 69 ++++++-------- configure.ac | 60 +++++------- setup.py | 13 +- 12 files changed, 87 insertions(+), 101 deletions(-) diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst --- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -368,9 +368,9 @@ module:: >>> import sysconfig - >>> sysconfig.get_config_var('SOABI') # find the version tag + >>> sysconfig.get_config_var('SOABI') # find the version tag 'cpython-32mu' - >>> sysconfig.get_config_var('SO') # find the full filename extension + >>> sysconfig.get_config_var('EXT_SUFFIX') # find the full filename extension '.cpython-32mu.so' .. seealso:: diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -666,10 +666,10 @@ from distutils.sysconfig import get_config_var ext_path = ext_name.split('.') # extensions in debug_mode are named 'module_d.pyd' under windows - so_ext = get_config_var('SO') + ext_suffix = get_config_var('EXT_SUFFIX') if os.name == 'nt' and self.debug: - return os.path.join(*ext_path) + '_d' + so_ext - return os.path.join(*ext_path) + so_ext + return os.path.join(*ext_path) + '_d' + ext_suffix + return os.path.join(*ext_path) + ext_suffix def get_export_symbols(self, ext): """Return the list of symbols that a shared extension has to diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -184,9 +184,9 @@ _osx_support.customize_compiler(_config_vars) _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' - (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \ + (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', - 'CCSHARED', 'LDSHARED', 'SO', 'AR', 'ARFLAGS') + 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') newcc = None if 'CC' in os.environ: @@ -225,7 +225,7 @@ linker_exe=cc, archiver=archiver) - compiler.shared_lib_extension = so_ext + compiler.shared_lib_extension = shlib_suffix def get_config_h_filename(): @@ -479,7 +479,7 @@ # XXX hmmm.. a normal install puts include files here g['INCLUDEPY'] = get_python_inc(plat_specific=0) - g['SO'] = '.pyd' + g['EXT_SUFFIX'] = '.pyd' g['EXE'] = ".exe" g['VERSION'] = get_python_version().replace(".", "") g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable)) diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -318,8 +318,8 @@ finally: os.chdir(old_wd) self.assertTrue(os.path.exists(so_file)) - so_ext = sysconfig.get_config_var('SO') - self.assertTrue(so_file.endswith(so_ext)) + ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') + self.assertTrue(so_file.endswith(ext_suffix)) so_dir = os.path.dirname(so_file) self.assertEqual(so_dir, other_tmp_dir) @@ -328,7 +328,7 @@ cmd.run() so_file = cmd.get_outputs()[0] self.assertTrue(os.path.exists(so_file)) - self.assertTrue(so_file.endswith(so_ext)) + self.assertTrue(so_file.endswith(ext_suffix)) so_dir = os.path.dirname(so_file) self.assertEqual(so_dir, cmd.build_lib) @@ -355,7 +355,7 @@ self.assertEqual(lastdir, 'bar') def test_ext_fullpath(self): - ext = sysconfig.get_config_vars()['SO'] + ext = sysconfig.get_config_var('EXT_SUFFIX') # building lxml.etree inplace #etree_c = os.path.join(self.tmp_dir, 'lxml.etree.c') #etree_ext = Extension('lxml.etree', [etree_c]) diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py --- a/Lib/distutils/tests/test_install.py +++ b/Lib/distutils/tests/test_install.py @@ -23,7 +23,7 @@ def _make_ext_name(modname): if os.name == 'nt' and sys.executable.endswith('_d.exe'): modname += '_d' - return modname + sysconfig.get_config_var('SO') + return modname + sysconfig.get_config_var('EXT_SUFFIX') class InstallTestCase(support.TempdirManager, diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -416,7 +416,7 @@ vars['LIBDEST'] = get_path('stdlib') vars['BINLIBDEST'] = get_path('platstdlib') vars['INCLUDEPY'] = get_path('include') - vars['SO'] = '.pyd' + vars['EXT_SUFFIX'] = '.pyd' vars['EXE'] = '.exe' vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable)) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -125,7 +125,8 @@ CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION) # Symbols used for using shared libraries -SO= @SO@ +SHLIB_SUFFIX= @SHLIB_SUFFIX@ +EXT_SUFFIX= @EXT_SUFFIX@ LDSHARED= @LDSHARED@ $(PY_LDFLAGS) BLDSHARED= @BLDSHARED@ $(PY_LDFLAGS) LDCXXSHARED= @LDCXXSHARED@ @@ -652,6 +653,11 @@ -DSOABI='"$(SOABI)"' \ -o $@ $(srcdir)/Python/dynload_shlib.c +Python/dynload_hpux.o: $(srcdir)/Python/dynload_hpux.c Makefile + $(CC) -c $(PY_CORE_CFLAGS) \ + -DSHLIB_EXT='"$(EXT_SUFFIX)"' \ + -o $@ $(srcdir)/Python/dynload_hpux.c + Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile $(CC) -c $(PY_CORE_CFLAGS) \ -DABIFLAGS='"$(ABIFLAGS)"' \ @@ -1188,7 +1194,7 @@ done @if test -d $(LIBRARY); then :; else \ if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ - if test "$(SO)" = .dll; then \ + if test "$(SHLIB_SUFFIX)" = .dll; then \ $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ else \ $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1121,6 +1121,10 @@ Build ----- +- Issue #16754: Fix the incorrect shared library extension on linux. Introduce + two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of + SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. + - Issue #5033: Fix building of the sqlite3 extension module when the SQLite library version has "beta" in it. Patch by Andreas Pelme. diff --git a/Misc/python-config.in b/Misc/python-config.in --- a/Misc/python-config.in +++ b/Misc/python-config.in @@ -57,7 +57,7 @@ print(' '.join(libs)) elif opt == '--extension-suffix': - print(sysconfig.get_config_var('SO')) + print(sysconfig.get_config_var('EXT_SUFFIX')) elif opt == '--abiflags': print(sys.abiflags) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -627,6 +627,7 @@ THREADHEADERS LIBPL PY_ENABLE_SHARED +EXT_SUFFIX SOABI LIBC LIBM @@ -654,7 +655,7 @@ BLDSHARED LDCXXSHARED LDSHARED -SO +SHLIB_SUFFIX LIBTOOL_CRUFT OTHER_LIBTOOL_OPT UNIVERSAL_ARCH_FLAGS @@ -8396,6 +8397,25 @@ +# SHLIB_SUFFIX is the extension of shared libraries `(including the dot!) +# -- usually .so, .sl on HP-UX, .dll on Cygwin +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the extension of shared libraries" >&5 +$as_echo_n "checking the extension of shared libraries... " >&6; } +if test -z "$SHLIB_SUFFIX"; then + case $ac_sys_system in + hp*|HP*) + case `uname -m` in + ia64) SHLIB_SUFFIX=.so;; + *) SHLIB_SUFFIX=.sl;; + esac + ;; + CYGWIN*) SHLIB_SUFFIX=.dll;; + *) SHLIB_SUFFIX=.so;; + esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHLIB_SUFFIX" >&5 +$as_echo "$SHLIB_SUFFIX" >&6; } + # LDSHARED is the ld *command* used to create shared library # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5 # (Shared libraries in this instance are shared modules to be loaded into @@ -13689,6 +13709,14 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SOABI" >&5 $as_echo "$SOABI" >&6; } + +case $ac_sys_system in + Linux*|GNU*) + EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};; + *) + EXT_SUFFIX=${SHLIB_SUFFIX};; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking LDVERSION" >&5 $as_echo_n "checking LDVERSION... " >&6; } LDVERSION='$(VERSION)$(ABIFLAGS)' @@ -13699,45 +13727,6 @@ LIBPL="${prefix}/lib/python${VERSION}/config-${LDVERSION}" -# SO is the extension of shared libraries `(including the dot!) -# -- usually .so, .sl on HP-UX, .dll on Cygwin -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking SO" >&5 -$as_echo_n "checking SO... " >&6; } -if test -z "$SO" -then - case $ac_sys_system in - hp*|HP*) - case `uname -m` in - ia64) SO=.so;; - *) SO=.sl;; - esac - ;; - CYGWIN*) SO=.dll;; - Linux*|GNU*) - SO=.${SOABI}.so;; - *) SO=.so;; - esac -else - # this might also be a termcap variable, see #610332 - echo - echo '=====================================================================' - echo '+ +' - echo '+ WARNING: You have set SO in your environment. +' - echo '+ Do you really mean to change the extension for shared libraries? +' - echo '+ Continuing in 10 seconds to let you to ponder. +' - echo '+ +' - echo '=====================================================================' - sleep 10 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SO" >&5 -$as_echo "$SO" >&6; } - - -cat >>confdefs.h <<_ACEOF -#define SHLIB_EXT "$SO" -_ACEOF - - # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether right shift extends the sign bit" >&5 diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -1898,13 +1898,30 @@ esac # Set info about shared libraries. -AC_SUBST(SO) +AC_SUBST(SHLIB_SUFFIX) AC_SUBST(LDSHARED) AC_SUBST(LDCXXSHARED) AC_SUBST(BLDSHARED) AC_SUBST(CCSHARED) AC_SUBST(LINKFORSHARED) +# SHLIB_SUFFIX is the extension of shared libraries `(including the dot!) +# -- usually .so, .sl on HP-UX, .dll on Cygwin +AC_MSG_CHECKING(the extension of shared libraries) +if test -z "$SHLIB_SUFFIX"; then + case $ac_sys_system in + hp*|HP*) + case `uname -m` in + ia64) SHLIB_SUFFIX=.so;; + *) SHLIB_SUFFIX=.sl;; + esac + ;; + CYGWIN*) SHLIB_SUFFIX=.dll;; + *) SHLIB_SUFFIX=.so;; + esac +fi +AC_MSG_RESULT($SHLIB_SUFFIX) + # LDSHARED is the ld *command* used to create shared library # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5 # (Shared libraries in this instance are shared modules to be loaded into @@ -3927,6 +3944,14 @@ SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS} AC_MSG_RESULT($SOABI) +AC_SUBST(EXT_SUFFIX) +case $ac_sys_system in + Linux*|GNU*) + EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};; + *) + EXT_SUFFIX=${SHLIB_SUFFIX};; +esac + AC_MSG_CHECKING(LDVERSION) LDVERSION='$(VERSION)$(ABIFLAGS)' AC_MSG_RESULT($LDVERSION) @@ -3936,39 +3961,6 @@ LIBPL="${prefix}/lib/python${VERSION}/config-${LDVERSION}" AC_SUBST(LIBPL) -# SO is the extension of shared libraries `(including the dot!) -# -- usually .so, .sl on HP-UX, .dll on Cygwin -AC_MSG_CHECKING(SO) -if test -z "$SO" -then - case $ac_sys_system in - hp*|HP*) - case `uname -m` in - ia64) SO=.so;; - *) SO=.sl;; - esac - ;; - CYGWIN*) SO=.dll;; - Linux*|GNU*) - SO=.${SOABI}.so;; - *) SO=.so;; - esac -else - # this might also be a termcap variable, see #610332 - echo - echo '=====================================================================' - echo '+ +' - echo '+ WARNING: You have set SO in your environment. +' - echo '+ Do you really mean to change the extension for shared libraries? +' - echo '+ Continuing in 10 seconds to let you to ponder. +' - echo '+ +' - echo '=====================================================================' - sleep 10 -fi -AC_MSG_RESULT($SO) - -AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).]) - # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). AC_MSG_CHECKING(whether right shift extends the sign bit) diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -169,13 +169,7 @@ def build_extensions(self): # Detect which modules should be compiled - old_so = self.compiler.shared_lib_extension - # Workaround PEP 3149 stuff - self.compiler.shared_lib_extension = os.environ.get("SO", ".so") - try: - missing = self.detect_modules() - finally: - self.compiler.shared_lib_extension = old_so + missing = self.detect_modules() # Remove modules that are present on the disabled list extensions = [ext for ext in self.extensions @@ -2066,7 +2060,8 @@ # mode 644 unless they are a shared library in which case they will get # mode 755. All installed directories will get mode 755. - so_ext = sysconfig.get_config_var("SO") + # this is works for EXT_SUFFIX too, which ends with SHLIB_SUFFIX + shlib_suffix = sysconfig.get_config_var("SHLIB_SUFFIX") def install(self): outfiles = install_lib.install(self) @@ -2081,7 +2076,7 @@ for filename in files: if os.path.islink(filename): continue mode = defaultMode - if filename.endswith(self.so_ext): mode = sharedLibMode + if filename.endswith(self.shlib_suffix): mode = sharedLibMode log.info("changing mode of %s to %o", filename, mode) if not self.dry_run: os.chmod(filename, mode) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 21 23:02:23 2013 From: python-checkins at python.org (matthias.klose) Date: Thu, 21 Mar 2013 23:02:23 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogLSBJc3N1ZSAjMTMx?= =?utf-8?q?50=3A_sysconfig_no_longer_parses_the_Makefile_and_config=2Eh_fi?= =?utf-8?q?les?= Message-ID: <3ZX26R49RDzSn4@mail.python.org> http://hg.python.org/cpython/rev/66e30c4870bb changeset: 82872:66e30c4870bb branch: 2.7 parent: 82843:71adf21421d9 user: doko at ubuntu.com date: Thu Mar 21 15:02:16 2013 -0700 summary: - Issue #13150: sysconfig no longer parses the Makefile and config.h files when imported, instead doing it at build time. This makes importing sysconfig faster and reduces Python startup time by 20%. files: Lib/distutils/sysconfig.py | 63 +-------------------- Lib/pprint.py | 5 +- Lib/sysconfig.py | 75 ++++++++++++++++++++++++- Makefile.pre.in | 12 +++- Misc/NEWS | 4 + 5 files changed, 93 insertions(+), 66 deletions(-) diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -387,66 +387,11 @@ def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" - g = {} - # load the installed Makefile: - try: - filename = get_makefile_filename() - parse_makefile(filename, g) - except IOError, msg: - my_msg = "invalid Python installation: unable to open %s" % filename - if hasattr(msg, "strerror"): - my_msg = my_msg + " (%s)" % msg.strerror - - raise DistutilsPlatformError(my_msg) - - # load the installed pyconfig.h: - try: - filename = get_config_h_filename() - parse_config_h(file(filename), g) - except IOError, msg: - my_msg = "invalid Python installation: unable to open %s" % filename - if hasattr(msg, "strerror"): - my_msg = my_msg + " (%s)" % msg.strerror - - raise DistutilsPlatformError(my_msg) - - # On AIX, there are wrong paths to the linker scripts in the Makefile - # -- these paths are relative to the Python source, but when installed - # the scripts are in another directory. - if python_build: - g['LDSHARED'] = g['BLDSHARED'] - - elif get_python_version() < '2.1': - # The following two branches are for 1.5.2 compatibility. - if sys.platform == 'aix4': # what about AIX 3.x ? - # Linker script is in the config directory, not in Modules as the - # Makefile says. - python_lib = get_python_lib(standard_lib=1) - ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix') - python_exp = os.path.join(python_lib, 'config', 'python.exp') - - g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp) - - elif sys.platform == 'beos': - # Linker script is in the config directory. In the Makefile it is - # relative to the srcdir, which after installation no longer makes - # sense. - python_lib = get_python_lib(standard_lib=1) - linkerscript_path = string.split(g['LDSHARED'])[0] - linkerscript_name = os.path.basename(linkerscript_path) - linkerscript = os.path.join(python_lib, 'config', - linkerscript_name) - - # XXX this isn't the right place to do this: adding the Python - # library to the link, if needed, should be in the "build_ext" - # command. (It's also needed for non-MS compilers on Windows, and - # it's taken care of for them by the 'build_ext.get_libraries()' - # method.) - g['LDSHARED'] = ("%s -L%s/lib -lpython%s" % - (linkerscript, PREFIX, get_python_version())) - + # _sysconfigdata is generated at build time, see the sysconfig module + from _sysconfigdata import build_time_vars global _config_vars - _config_vars = g + _config_vars = {} + _config_vars.update(build_time_vars) def _init_nt(): diff --git a/Lib/pprint.py b/Lib/pprint.py --- a/Lib/pprint.py +++ b/Lib/pprint.py @@ -37,7 +37,10 @@ import sys as _sys import warnings -from cStringIO import StringIO as _StringIO +try: + from cStringIO import StringIO as _StringIO +except ImportError: + from StringIO import StringIO as _StringIO __all__ = ["pprint","pformat","isreadable","isrecursive","saferepr", "PrettyPrinter"] diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -278,9 +278,10 @@ return os.path.join(_PROJECT_BASE, "Makefile") return os.path.join(get_path('platstdlib'), "config", "Makefile") - -def _init_posix(vars): - """Initialize the module as appropriate for POSIX systems.""" +def _generate_posix_vars(): + """Generate the Python module containing build-time variables.""" + import pprint + vars = {} # load the installed Makefile: makefile = _get_makefile_filename() try: @@ -308,6 +309,49 @@ if _PYTHON_BUILD: vars['LDSHARED'] = vars['BLDSHARED'] + # There's a chicken-and-egg situation on OS X with regards to the + # _sysconfigdata module after the changes introduced by #15298: + # get_config_vars() is called by get_platform() as part of the + # `make pybuilddir.txt` target -- which is a precursor to the + # _sysconfigdata.py module being constructed. Unfortunately, + # get_config_vars() eventually calls _init_posix(), which attempts + # to import _sysconfigdata, which we won't have built yet. In order + # for _init_posix() to work, if we're on Darwin, just mock up the + # _sysconfigdata module manually and populate it with the build vars. + # This is more than sufficient for ensuring the subsequent call to + # get_platform() succeeds. + name = '_sysconfigdata' + if 'darwin' in sys.platform: + import imp + module = imp.new_module(name) + module.build_time_vars = vars + sys.modules[name] = module + + pybuilddir = 'build/lib.%s-%s' % (get_platform(), sys.version[:3]) + if hasattr(sys, "gettotalrefcount"): + pybuilddir += '-pydebug' + try: + os.makedirs(pybuilddir) + except OSError: + pass + destfile = os.path.join(pybuilddir, name + '.py') + + with open(destfile, 'wb') as f: + f.write('# system configuration generated and used by' + ' the sysconfig module\n') + f.write('build_time_vars = ') + pprint.pprint(vars, stream=f) + + # Create file used for sys.path fixup -- see Modules/getpath.c + with open('pybuilddir.txt', 'w') as f: + f.write(pybuilddir) + +def _init_posix(vars): + """Initialize the module as appropriate for POSIX systems.""" + # _sysconfigdata is generated at build time, see _generate_posix_vars() + from _sysconfigdata import build_time_vars + vars.update(build_time_vars) + def _init_non_posix(vars): """Initialize the module as appropriate for NT""" # set basic install directories @@ -565,3 +609,28 @@ def get_python_version(): return _PY_VERSION_SHORT + + +def _print_dict(title, data): + for index, (key, value) in enumerate(sorted(data.items())): + if index == 0: + print '%s: ' % (title) + print '\t%s = "%s"' % (key, value) + + +def _main(): + """Display all information sysconfig detains.""" + if '--generate-posix-vars' in sys.argv: + _generate_posix_vars() + return + print 'Platform: "%s"' % get_platform() + print 'Python version: "%s"' % get_python_version() + print 'Current installation scheme: "%s"' % _get_default_scheme() + print + _print_dict('Paths', get_paths()) + print + _print_dict('Variables', get_config_vars()) + + +if __name__ == '__main__': + _main() diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -437,15 +437,20 @@ Modules/python.o \ $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) -platform: $(BUILDPYTHON) +platform: $(BUILDPYTHON) pybuilddir.txt $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform +# Create build directory and generate the sysconfig build-time data there. +# pybuilddir.txt contains the name of the build dir and is used for +# sys.path fixup -- see Modules/getpath.c. +pybuilddir.txt: $(BUILDPYTHON) + $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars # Build the shared modules # Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for # -s, --silent or --quiet is always the first char. # Under BSD make, MAKEFLAGS might be " -s -v x=y". -sharedmods: $(BUILDPYTHON) +sharedmods: $(BUILDPYTHON) pybuilddir.txt @case "$$MAKEFLAGS" in \ *\ -s*|s*) quiet="-q";; \ *) quiet="";; \ @@ -955,7 +960,7 @@ else true; \ fi; \ done - @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \ + @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \ do \ if test -x $$i; then \ $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \ @@ -1133,6 +1138,7 @@ --install-scripts=$(BINDIR) \ --install-platlib=$(DESTSHARED) \ --root=$(DESTDIR)/ + -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py* # Here are a couple of targets for MacOSX again, to install a full # framework-based Python. frameworkinstall installs everything, the diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -216,6 +216,10 @@ Library ------- +- Issue #13150: sysconfig no longer parses the Makefile and config.h files + when imported, instead doing it at build time. This makes importing + sysconfig faster and reduces Python startup time by 20%. + - Issue #10212: cStringIO and struct.unpack support new buffer objects. - Issue #12098: multiprocessing on Windows now starts child processes -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 22 00:13:19 2013 From: python-checkins at python.org (victor.stinner) Date: Fri, 22 Mar 2013 00:13:19 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_test=5Fast=3A_pass_the_fil?= =?utf-8?q?ename_to_ast=2Eparse=28=29?= Message-ID: <3ZX3hH0tjFzPlS@mail.python.org> http://hg.python.org/cpython/rev/95fb7b66107e changeset: 82873:95fb7b66107e parent: 82871:f6a6b4eed5b0 user: Victor Stinner date: Fri Mar 22 00:06:20 2013 +0100 summary: test_ast: pass the filename to ast.parse() files: Lib/test/test_ast.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -947,7 +947,7 @@ fn = os.path.join(stdlib, module) with open(fn, "r", encoding="utf-8") as fp: source = fp.read() - mod = ast.parse(source) + mod = ast.parse(source, fn) compile(mod, fn, "exec") -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 22 00:26:39 2013 From: python-checkins at python.org (brett.cannon) Date: Fri, 22 Mar 2013 00:26:39 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?devinabox=3A_Completely_rework_devina?= =?utf-8?q?box_to_be_easier_for_core_devs_to_use=2E?= Message-ID: <3ZX3zg02c9zQyZ@mail.python.org> http://hg.python.org/devinabox/rev/2c20681befa8 changeset: 47:2c20681befa8 user: Brett Cannon date: Thu Mar 21 19:26:30 2013 -0400 summary: Completely rework devinabox to be easier for core devs to use. Previously devinabox was essentially a script for people to use to pull together a directory full of the code needed to contribute to Python. Unfortunately the script turned out to be brittle, requiring patches for every sprint it was used with. Since the users of this project have continually been core devs, re-orient towards core devs leading sprints. This means a README outlining what hg repos to clone, a script to help generate a coverage report using coverage.py, and a script for new contributors to use to help build CPython quickly and with sane defaults in a single step. All other details should be gleaned from the devguide. files: .hgignore | 12 +- README | 158 +++++++++++++++ build_cpython.py | 12 +- full_coverage.py | 127 ++++++++++++ index.html | 43 ++++ make_a_box.py | 362 ----------------------------------- 6 files changed, 338 insertions(+), 376 deletions(-) diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -1,20 +1,12 @@ syntax: glob -# Repositories/files +# Repositories coveragepy cpython devguide -Mercurial peps -Visual C++ Express # Generated -.coverage coverage_report -build -coverage.html -README +original_coverage_report # Misc -.*.swp -*.pyc -*.pyo __pycache__ diff --git a/README b/README new file mode 100644 --- /dev/null +++ b/README @@ -0,0 +1,158 @@ +devinabox -- Bootstrapping a Python core dev sprint +///////////////////////////////////////////////////////// + +The devinabox project is meant to help a CPython core developer produce a +directory which contains everything necessary to enable someone at a sprint +(regardless of OS) to get set up quickly. This README is **NOT** meant for a new +contributor! If you *are* a new contributor, ask the core developer leading your +sprint about how to get started. + +This README outlines two things: what to download to create a devinabox and what +is provided to help new contributors. + + +Stuff to download +================= + +The following sections outline various files to download and repositories to +clone into your devinabox. Make sure to **NOT** change the directories that +repositories are cloned into. The default names are assumed by the other files +in the devinabox. + +When you are done you should have in this directory everything +someone needs to contribute. Simply copy the whole directory to some sort of +media (USB 3 thumb drive and CD tend to work well) and then pass it around for +people to copy somewhere on to their system. They can run ``hg pull -u`` to +get updates, sparing the probably taxed internet connection at the sprint from +doing complete repository cloning. + + +Mercurial +--------- + +You will want to download the latest release of Mercurial +(http://pypi.python.org/pypi/Mercurial) and TortoiseHg for Windows users +(http://tortoisehg.bitbucket.org/download/). OS X users can be told that +Mercurial is available through Homebrew if they prefer +(XXX; if they use MacPorts or any other package manager then tell them they +should switch to Homebrew at home as it handles Python the best and to use the +download of Mercurial you have provided to save time). + +Providing Mercurial guarantees there is no issue with new contributors trying to +update repositories or generating patches. + + +A Compiler +----------- + +Since you will most likely be dealing with developers this section is probably +not important, but just in case you get questions about compilers, here are some +suggestions. + +OS X users should be told to download XCode from the Apple App Store **ahead of +time**. It's on the order of a couple GiB in size, so you don't want to have +people downloading it at the sprint. + +If new contributors think they may be doing C development, suggest LLVM + clang +for better error reporting than gcc. OS X users can get an up-to-date version +of the toolchain through Homebrew. + +For Windows users, tell them to download and install Visual C++ Express +(http://www.microsoft.com/express/Downloads/) **ahead of time**. + + +CPython +------- + +Clone the CPython repository and build it (you will be cleaning up your build +later, though as a final step). + +Also make sure to build the documentation. This not only alleviates the need for +everyone to build it from scratch, but it will also pull in copies of projects +that users can rely on, if necessary, to build other documentation +(e.g. everything needed to build the devguide). If the documentation starts +being built by a repository build of CPython (and thus Python 3) this may no +longer hold true. + + +PEPs +---- + +Clone the repository and build it. That way if people need to reference a PEP +they can easily find itand will be able to use the easier-to-read HTML version. + +No specific guidelines for building the PEPs are provided for new contributors +since there is only a slim chance they will be editing a PEP, and if they are +then they should be able to figure out how to get the PEPs to build on their +own. + + +Devguide +-------- + +Clone the repository and build it. This gives people a local copy to use +rather than having to use the (probably slow) internet connection at the sprint. + +If a new contributor needs to be able to build the devguide, they should only +need to set their ``PYTHONPATH`` to point at the ``cpython/Doc/tools`` directory +in the CPython repository thanks to the requisite projects being pulled in when +you built the CPython documentation. + + +Coverage.py +----------- + +01. Build the CPython repository +02. Clone the repository from https://bitbucket.org/ned/coveragepy +03. Download Distribute from https://pypi.python.org/pypi/distribute +04. Unpack and build Distribute with Python 3 in the coveragepy repository +05. Symlink the ``distribute-N.N.N/build/lib/setuptools`` directory into + ``coveragepy`` +06. Symlink ``distribute-N.N.N/build/lib/pkg_resources.py`` into ``coveragepy`` +07. Run ``./cpython/python full_coverage.py build`` +08. Run ``./cpython/python full_coverage.py run`` +09. Run ``./cpython/python full_coverage.py html original_coverage_report`` +10. ``make distclean`` the CPython repository + + +All these steps will generate a complete coverage report for the standard +library and put it in the ``original_coverage_report`` directory. Do note that +the location is **not** the default one for the script to prevent users from +accidentally overwriting the original copy (and thus needing to run the whole +coverage again from scratch). + +Do be aware that this step takes a few **hours**. + + +Included files to help out +========================== + +A couple of files are included in order to make things a little bit easier for +both you and the new contributors. + + +``full_coverage.py`` +--------------------- + +As discussed earlier, this generates the coverage report for the standard +library in the most thorough way possible. The ``run`` option can take specific +tests as an argument. The ``html`` directory can take an argument for a +directory to write to, but the default should not conflict with the original +coverage run you did earlier (if you followed the directions =) . + + +``build_cpython.py`` +-------------------- +On UNIX-based OSs, builds the CPython repository, and on all platforms it +verifies that the expected CPython binary exists. + +While the devguide includes instructions on how to build under UNIX, the script +just simplifies this by having a single command subsume both the configure and +build steps. It also uses reasonable defaults (e.g. all cores on the CPU). + + +``index.html`` +-------------- + +An HTML file with links to the various pieces of documentation you built +previously and the helper scripts. \ No newline at end of file diff --git a/build_cpython.py b/build_cpython.py --- a/build_cpython.py +++ b/build_cpython.py @@ -1,5 +1,9 @@ #!/usr/bin/env python -"""Build CPython""" +"""Build CPython on UNIX. + +On all platforms, return the path to the executable. + +""" import multiprocessing import os import subprocess @@ -45,6 +49,6 @@ return executable() if __name__ == '__main__': - if not main(): - print('No executable found') - sys.exit(1) + executable = main() + print(executable or 'No executable found') + sys.exit(0 if executable else 1) diff --git a/full_coverage.py b/full_coverage.py new file mode 100644 --- /dev/null +++ b/full_coverage.py @@ -0,0 +1,127 @@ +"""Use coverage.py on CPython's standard library. + +See the ``-h`` or ``help`` command of the script for instructions on use. + +""" +import importlib.machinery +import contextlib +import os +import shutil +import subprocess +import sys +import webbrowser + + +def path_from_here(path): + """Calculate the absolute path to 'path' from where this file is located.""" + return os.path.abspath(os.path.join(os.path.dirname(__file__), path)) + +COVERAGE = path_from_here('coveragepy') +REPORT = path_from_here('coverage_report') +CPYTHON = os.path.dirname(sys.executable) + + + at contextlib.contextmanager +def chdir(directory): + """Change the directory temporarily.""" + original_directory = os.getcwd() + os.chdir(directory) + yield + os.chdir(original_directory) + + +def build(args): + """Build coverage.py's C-based tracer. + + Make sure to delete any pre-existing build to make sure it uses the latest + source from CPython. + """ + with chdir(COVERAGE): + for ext in importlib.machinery.EXTENSION_SUFFIXES: + tracer_path = os.path.join('coverage', 'tracer' + ext) + try: + os.unlink(tracer_path) + except FileNotFoundError: + pass + subprocess.check_call([sys.executable, 'setup.py', 'clean']) + env = os.environ.copy() + env['CPPFLAGS'] = '-I {} -I {}'.format(CPYTHON, + os.path.join(CPYTHON, 'Include')) + command = [sys.executable, 'setup.py', 'build_ext', '--inplace'] + process = subprocess.Popen(command, env=env) + process.wait() + + +def run(args): + """Run coverage.py against Python's stdlib as best as possible. + + If any specific tests are listed, then limit the run to those tests. + """ + command = [sys.executable, COVERAGE, 'run', '--pylib', 'Lib/test/regrtest.py'] + if args.tests: + command.extend(args.tests) + with chdir(CPYTHON): + try: + os.unlink(os.path.join(CPYTHON, '.coverage')) + except FileNotFoundError: + pass + pythonpath = os.path.join(COVERAGE, 'coverage', 'fullcoverage') + process = subprocess.Popen(command, env={'PYTHONPATH': pythonpath}) + process.wait() + + +def report(args): + """Generate the HTML-based coverage report. + + Write the results to either REPORT or a user-specified location. + """ + report = os.path.abspath(args.directory) + title = '{} {} test coverage'.format(sys.implementation.name, + sys.version.partition(' \n')[0]) + if os.path.exists(report): + shutil.rmtree(report) + with chdir(CPYTHON): + subprocess.check_call([sys.executable, COVERAGE, 'html', '-i', + '-d', report, '--omit', 'Lib/test/*', + '--title', title]) + print(os.path.join(report, 'index.html')) + + +if __name__ == '__main__': + import argparse + parser = argparse.ArgumentParser() + subparsers = parser.add_subparsers(dest='subparser_name', + help="use coverage.py on Python's standard library") + + build_parser = subparsers.add_parser('build', + help='build coverage.py using {}'.format(sys.executable)) + build_parser.set_defaults(func=build) + + stdlib_path = os.path.join(CPYTHON, 'Lib') + run_parser = subparsers.add_parser('run', + help='run coverage.py over the standard library at {} ' + '(coverage.py must already be built)'.format(stdlib_path)) + run_parser.add_argument('tests', action='store', nargs='*', + help='optional list of tests to run (default: all tests)') + run_parser.set_defaults(func=run) + + report_parser = subparsers.add_parser('html', + help='generate an HTML coverage report') + report_parser.add_argument('directory', + help='where to save the report (default: {})'.format(REPORT), + nargs='?', action='store', default=REPORT) + report_parser.set_defaults(func=report) + + help_parser = subparsers.add_parser('help', + help='show the help message for the specified command') + help_parser.add_argument('command', nargs='?', + help='for which command to show a help message') + + args = parser.parse_args() + if args.subparser_name != 'help': + args.func(args) + else: + help_args = ['-h'] + if args.command: + help_args.insert(0, args.command) + parser.parse_args(help_args) \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 --- /dev/null +++ b/index.html @@ -0,0 +1,43 @@ + +devinabox Documentation Index + + +

Documentation

+ + +

Scripts

+
    +
  • build_cpython.py + (find the CPython binary & build if possible) +
  • full_coverage.py + (build, run, and/or report for coverage.py; see help message for usage) +
\ No newline at end of file diff --git a/make_a_box.py b/make_a_box.py deleted file mode 100755 --- a/make_a_box.py +++ /dev/null @@ -1,362 +0,0 @@ -#!/usr/bin/env python3 -"""Python-Dev In a Box: everything you need to contribute to Python in under -700 MB. - -This script will clone, checkout, or (ask you to) download almost everything -you need to contribute to (C)Python's development. It will also "build" -everything so that users do not need to do **everything** from scratch. This -also allows for easy offline use. - -Beyond this script itself, there are other scripts provided along side this one -to help in executing common tasks. - -""" -import abc -import contextlib -import datetime -from distutils.version import LooseVersion as Version -import operator -import os -import os.path -import shutil -import subprocess -import sys -import urllib.request -import urllib.parse -import webbrowser -import xmlrpc.client -import build_cpython - - -def rename(new_name): - """Decorator to rename an object that defines __name__.""" - def do_rename(ob): - ob.__name__ = new_name - return ob - return do_rename - - - at contextlib.contextmanager -def change_cwd(directory): - cwd = os.getcwd() - os.chdir(directory) - try: - yield - finally: - os.chdir(cwd) - - -class Provider(metaclass=abc.ABCMeta): - - """Base class for items to be provided.""" - - @abc.abstractproperty - def directory(self): - """Directory to put everything.""" - raise NotImplementedError - - @abc.abstractproperty - def size(self): - """Size of what is provided (built and everything).""" - raise NotImplementedError - - def _prompt(self, message): - """Prompt the user to perform an action, waiting for a response.""" - input("{} [press Enter when done]".format(message)) - - @abc.abstractmethod - def create(self): - """Create what is to be provided.""" - raise NotImplementedError - - def build(self): - """Optional step to "build" something.""" - - -class HgProvider(Provider): - - """Provide an Hg repository.""" - - @abc.abstractproperty - def url(self): - """Location of the repository.""" - raise NotImplementedError - - @property - def directory(self): - return os.path.abspath(os.path.basename(self.url)) - - def create(self): - """Clone an Hg repository to 'directory'.""" - if os.path.exists(self.directory): - subprocess.check_call(['hg', 'pull', '-u', self.url], - cwd=self.directory) - else: - subprocess.check_call(['hg', 'clone', self.url, self.directory]) - - - at rename('Visual C++ Express') -class VisualCPPExpress(Provider): - - """The Web installer for Visual C++ Express""" - - size = 4 - directory = 'Visual C++ Express' - - def create(self): - """Bring up a browser window to download the release.""" - try: - os.mkdir(self.directory) - except OSError: - pass - url = 'http://www.microsoft.com/express/Downloads/' - try: - webbrowser.open(url) - except webbrowser.Error: - pass - self._prompt('download Visual C++ Express at {} and put in {}'.format( - url, self.directory)) - - - at rename('coverage.py') -class CoveragePy(HgProvider): - - """Clone of coverage.py (WARNING: building takes a while)""" - - url = 'https://bitbucket.org/ned/coveragepy' - size = 133 # Includes the coverage report - docs = os.path.join('coverage_report', 'index.html') - - @contextlib.contextmanager - def build_cpython(self): - self.executable = build_cpython.main() - if not self.executable: - print('No CPython executable found') - sys.exit(1) - self.cpython_dir = os.path.dirname(self.executable) - yield - print('Cleaning up the CPython build ...') - with change_cwd(self.cpython_dir): - subprocess.check_call(['make', 'distclean']) - - @contextlib.contextmanager - def build_coveragepy(self): - env = os.environ.copy() - env['CPPFLAGS'] = '-I {} -I {}'.format(self.cpython_dir, - os.path.join(self.cpython_dir, 'Include')) - with change_cwd(self.coveragepy_dir): - # Don't want to use venv because we want the file paths to match - # up with the repo and not installation locations. - print('Compiling coverage.py extension(s) ...') - cmd = [self.executable, 'setup.py', 'build_ext', '--inplace'] - subprocess.check_call(cmd, env=env) - yield - print('Cleaning up coverage.py build ...') - shutil.rmtree('build') - os.unlink(os.path.join('coverage', 'tracer.so')) - - def generate_coveragepy_command(self, command, *args): - exclude = '{},{}'.format(os.path.join('Lib', 'test', '*'), - os.path.join('Lib', '*', 'tests', '*')) - return [self.executable, self.coveragepy_dir, command, - '--include', os.path.join(self.cpython_dir, 'Lib', '*'), - '--omit', exclude] + list(args) - - @contextlib.contextmanager - def run_coveragepy(self): - print('Running coverage ...') - regrtest_path = os.path.join(self.cpython_dir, 'Lib', 'test', - 'regrtest.py') - fullcoverage = os.path.join(self.coveragepy_dir, 'coverage', - 'fullcoverage') - env = os.environ.copy() - env['PYTHONPATH'] = fullcoverage - cmd = self.generate_coveragepy_command('run', '--pylib', regrtest_path) - subprocess.check_call(cmd, env=env) - yield - os.unlink('.coverage') - - def report_coveragepy(self): - print('Generating report ...') - cmd = self.generate_coveragepy_command('html', '-i', '-d', - os.path.join(self.root_dir, 'coverage_report')) - subprocess.check_call(cmd) - - def build(self): - """Run coverage over CPython.""" - self.coveragepy_dir = self.directory - self.root_dir = os.path.dirname(self.directory) - with self.build_cpython(), self.build_coveragepy(): - with change_cwd(self.cpython_dir): - with self.run_coveragepy(): - self.report_coveragepy() - - -class Mercurial(Provider): - - """Source release of Mercurial along with TortoiseHg""" - - directory = 'Mercurial' - size = 47 # Includes TortoiseHg for 32/64-bit Windows - - def _download_url(self): - """Discover the URL to download Mercurial from.""" - pypi = xmlrpc.client.ServerProxy('http://pypi.python.org/pypi') - hg_versions = pypi.package_releases('Mercurial') - hg_versions.sort(key=Version) - latest_release = hg_versions[-1] - # Mercurial keeps releases on their servers - release_data = pypi.release_data('Mercurial', latest_release) - fname = "mercurial-%s.tar.gz" % latest_release - try: - release_url = release_data['download_url'] - except KeyError: - print('Mercurial has changed how it releases software on PyPI; ' - 'please report this to bugs.python.org') - sys.exit(1) - return os.path.join(release_url, fname) - - def _url_filename(self, url): - """Find the filename from the URL.""" - return os.path.split(urllib.parse.urlparse(url).path)[1] - - def _create_mercurial(self): - """Download the latest source release of Mercurial.""" - file_url = self._download_url() - file_name = self._url_filename(file_url) - with urllib.request.urlopen(file_url) as url_file: - with open(os.path.join(self.directory, file_name), 'wb') as file: - file.write(url_file.read()) - - def _create_tortoisehg(self): - """Open a web page to the TortoiseHg download page.""" - url = 'http://tortoisehg.bitbucket.org/download/' - try: - webbrowser.open(url) - except webbrowser.Error: - pass - self._prompt('Download TortoiseHg from {} and put in {}'.format(url, - self.directory)) - - def create(self): - """Fetch the latest source distribution for Mercurial.""" - try: - os.mkdir(self.directory) - except OSError: - pass - self._create_mercurial() - self._create_tortoisehg() - - -class PEPs(HgProvider): - - """Checkout of the Python Enhancement Proposals (for PEPs 7 & 8)""" - - url = 'http://hg.python.org/peps' - size = 20 - docs = os.path.join('peps', 'pep-0000.html') - - def build(self): - """Build the PEPs.""" - with change_cwd(self.directory): - subprocess.check_call(['make']) - - -class Devguide(HgProvider): - - """Clone of the Python Developer's Guide""" - - size = 4 - - url = 'http://hg.python.org/devguide' - docs = os.path.join('devguide', '_build', 'html', 'index.html') - - def build(self): - """Build the devguide using Sphinx from CPython's docs.""" - # Grab Sphinx from cpython/Doc/tools/ - tools_directory = os.path.join('cpython', 'Doc', 'tools') - sphinx_build_path = os.path.join(tools_directory, 'sphinx-build.py') - sphinx_build_path = os.path.abspath(sphinx_build_path) - orig_pythonpath = os.environ.get('PYTHONPATH') - os.environ['PYTHONPATH'] = os.path.abspath(tools_directory) - orig_sphinxbuild = os.environ.get('SPHINXBUILD') - os.environ['SPHINXBUILD'] = 'python {}'.format(sphinx_build_path) - try: - with change_cwd(self.directory): - subprocess.check_call(['make', 'html']) - finally: - if orig_pythonpath: - os.environ['PYTHONPATH'] = orig_pythonpath - if orig_sphinxbuild: - os.environ['SPHINXBUILD'] = orig_sphinxbuild - index_path = os.path.join(self.directory, '_build', 'html', - 'index.html') - - -class CPython(HgProvider): - - """Clone of CPython (and requisite tools to build the documentation)""" - - url = 'http://hg.python.org/cpython' - size = 330 # Only docs are built - docs = os.path.join('cpython', 'Doc', 'build', 'html', 'index.html') - - def create(self): - """Clone CPython and get the necessary tools to build the - documentation.""" - super().create() - with change_cwd(os.path.join(self.directory, 'Doc')): - subprocess.check_call(['make', 'checkout']) - - def build(self): - """Build CPython's documentation. - - CPython itself is not built as one will most likely not want to - distribute that on a CD. The build_cpython.py script can be used by the - Box user for building CPython. - - """ - cmd = 'make' if sys.platform != 'win32' else 'make.bat' - with change_cwd(os.path.join(self.directory, 'Doc')): - subprocess.check_call([cmd, 'html']) - - -if __name__ == '__main__': - # XXX CLI: create, build, list - all_providers = (CPython, Devguide, PEPs, CoveragePy, Mercurial, - VisualCPPExpress) - print(__doc__) - print('Please choose what to provide [answer y/n]:\n') - desired_providers = [] - for provider in all_providers: - docstring = provider.__doc__#.replace('\n', ' ') - msg = '{} ({} MB built)? '.format(docstring, provider.size) - response = input(msg) - if response in ('Y', 'y'): - desired_providers.append(provider) - print() - getting = ', '.join(map(operator.attrgetter('__name__'), - desired_providers)) - print('Getting {}'.format(getting)) - total_size = sum(map(operator.attrgetter('size'), desired_providers)) - msg = 'The requested Box will be about {} MB. OK? [y/n] '.format(total_size) - response = input(msg) - if response not in ('Y', 'y'): - sys.exit(0) - else: - print() - for provider in desired_providers: - ins = provider() - print('Fetching {} ...'.format(provider.__name__)) - ins.create() - print('Building {} ...'.format(provider.__name__)) - ins.build() - with open('README', 'w') as file: - header = 'Python-Dev In a Box: created on {}\n' - file.write(header.format(datetime.date.today())) - file.write('\n') - file.write('Documentation indices can be found at:\n') - for provider in desired_providers: - if hasattr(provider, 'docs'): - file.write(' {}\n'.format(provider.docs)) - sys.exit(0) -- Repository URL: http://hg.python.org/devinabox From python-checkins at python.org Fri Mar 22 00:36:57 2013 From: python-checkins at python.org (terry.reedy) Date: Fri, 22 Mar 2013 00:36:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2313248=3A_NEWS_and?= =?utf-8?q?_What=27s_New_items?= Message-ID: <3ZX4CY02XFzSpD@mail.python.org> http://hg.python.org/cpython/rev/62a988b3bf2e changeset: 82874:62a988b3bf2e user: Terry Jan Reedy date: Thu Mar 21 19:36:26 2013 -0400 summary: Issue #13248: NEWS and What's New items files: Doc/whatsnew/3.4.rst | 4 +++- Misc/NEWS | 2 ++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst --- a/Doc/whatsnew/3.4.rst +++ b/Doc/whatsnew/3.4.rst @@ -185,7 +185,9 @@ Deprecated Python modules, functions and methods ------------------------------------------------ -* None yet. +* :meth:`difflib.SequenceMatcher.isbjunk` and + :meth:`difflib.SequenceMatcher.isbpopulur`: use ``x in sm.bjunk`` and + ``x in sm.bpopular``, where sm is a :class:`~difflib.SequenceMatcher` object. Deprecated functions and types of the C API diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1461,6 +1461,8 @@ Library ------- +- Issue #13248: removed deprecated and undocumented difflib.isbjunk, isbpopular. + - Issue #13370: Ensure that ctypes works on Mac OS X when Python is compiled using the clang compiler. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 22 01:57:16 2013 From: python-checkins at python.org (r.david.murray) Date: Fri, 22 Mar 2013 01:57:16 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=2317472=3A_add_tests_for_?= =?utf-8?q?a_couple_of_untested_methods_in_urllib=2Eurlparse=2E?= Message-ID: <3ZX60D1VrNzSsw@mail.python.org> http://hg.python.org/cpython/rev/472b72a61b0a changeset: 82875:472b72a61b0a user: R David Murray date: Thu Mar 21 20:56:51 2013 -0400 summary: #17472: add tests for a couple of untested methods in urllib.urlparse. Original patch by Daniel Wozniak. files: Lib/test/test_urlparse.py | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py --- a/Lib/test/test_urlparse.py +++ b/Lib/test/test_urlparse.py @@ -847,6 +847,14 @@ self.assertEqual(p1.path, '863-1234') self.assertEqual(p1.params, 'phone-context=+1-914-555') + def test_unwrap(self): + url = urllib.parse.unwrap('') + self.assertEqual(url, 'type://host/path') + + def test_Quoter_repr(self): + quoter = urllib.parse.Quoter(urllib.parse._ALWAYS_SAFE) + self.assertIn('Quoter', repr(quoter)) + def test_main(): support.run_unittest(UrlParseTestCase) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 22 02:31:51 2013 From: python-checkins at python.org (brett.cannon) Date: Fri, 22 Mar 2013 02:31:51 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Fix_header_order_for_PEP_439?= Message-ID: <3ZX6m74WcMzSPB@mail.python.org> http://hg.python.org/peps/rev/47ce51c00f00 changeset: 4819:47ce51c00f00 user: Brett Cannon date: Thu Mar 21 21:31:45 2013 -0400 summary: Fix header order for PEP 439 files: pep-0439.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0439.txt b/pep-0439.txt --- a/pep-0439.txt +++ b/pep-0439.txt @@ -7,10 +7,10 @@ Discussions-To: Status: Draft Type: Standards Track +Content-Type: text/x-rst Created: 18-Mar-2013 Python-Version: 3.4 Post-History: 19-Mar-2013 -Content-Type: text/x-rst Abstract -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Mar 22 05:04:57 2013 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 22 Mar 2013 05:04:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_copy_2=2E7_magic_numbers_f?= =?utf-8?q?or_historical_interest?= Message-ID: <3ZXB8n6NT0zSc5@mail.python.org> http://hg.python.org/cpython/rev/a2128cb22372 changeset: 82876:a2128cb22372 user: Benjamin Peterson date: Thu Mar 21 23:04:45 2013 -0500 summary: copy 2.7 magic numbers for historical interest files: Lib/importlib/_bootstrap.py | 6 + Python/importlib.h | 7250 ++++++++++------------ 2 files changed, 3164 insertions(+), 4092 deletions(-) diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -351,6 +351,12 @@ Python 2.5c2: 62131 (fix wrong code: for x, in ... in listcomp/genexp) Python 2.6a0: 62151 (peephole optimizations and STORE_MAP opcode) Python 2.6a1: 62161 (WITH_CLEANUP optimization) + Python 2.7a0: 62171 (optimize list comprehensions/change LIST_APPEND) + Python 2.7a0: 62181 (optimize conditional branches: + introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE) + Python 2.7a0 62191 (introduce SETUP_WITH) + Python 2.7a0 62201 (introduce BUILD_SET) + Python 2.7a0 62211 (introduce MAP_ADD and SET_ADD) Python 3000: 3000 3010 (removed UNARY_CONVERT) 3020 (added BUILD_SET) diff --git a/Python/importlib.h b/Python/importlib.h --- a/Python/importlib.h +++ b/Python/importlib.h [stripped] -- Repository URL: http://hg.python.org/cpython From andrew.svetlov at gmail.com Fri Mar 22 05:54:30 2013 From: andrew.svetlov at gmail.com (Andrew Svetlov) Date: Thu, 21 Mar 2013 21:54:30 -0700 Subject: [Python-checkins] cpython (2.7): - Issue #13150: sysconfig no longer parses the Makefile and config.h files In-Reply-To: <3ZX26R49RDzSn4@mail.python.org> References: <3ZX26R49RDzSn4@mail.python.org> Message-ID: Great! On Thu, Mar 21, 2013 at 3:02 PM, matthias.klose wrote: > http://hg.python.org/cpython/rev/66e30c4870bb > changeset: 82872:66e30c4870bb > branch: 2.7 > parent: 82843:71adf21421d9 > user: doko at ubuntu.com > date: Thu Mar 21 15:02:16 2013 -0700 > summary: > - Issue #13150: sysconfig no longer parses the Makefile and config.h files > when imported, instead doing it at build time. This makes importing > sysconfig faster and reduces Python startup time by 20%. > > files: > Lib/distutils/sysconfig.py | 63 +-------------------- > Lib/pprint.py | 5 +- > Lib/sysconfig.py | 75 ++++++++++++++++++++++++- > Makefile.pre.in | 12 +++- > Misc/NEWS | 4 + > 5 files changed, 93 insertions(+), 66 deletions(-) > > > diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py > --- a/Lib/distutils/sysconfig.py > +++ b/Lib/distutils/sysconfig.py > @@ -387,66 +387,11 @@ > > def _init_posix(): > """Initialize the module as appropriate for POSIX systems.""" > - g = {} > - # load the installed Makefile: > - try: > - filename = get_makefile_filename() > - parse_makefile(filename, g) > - except IOError, msg: > - my_msg = "invalid Python installation: unable to open %s" % filename > - if hasattr(msg, "strerror"): > - my_msg = my_msg + " (%s)" % msg.strerror > - > - raise DistutilsPlatformError(my_msg) > - > - # load the installed pyconfig.h: > - try: > - filename = get_config_h_filename() > - parse_config_h(file(filename), g) > - except IOError, msg: > - my_msg = "invalid Python installation: unable to open %s" % filename > - if hasattr(msg, "strerror"): > - my_msg = my_msg + " (%s)" % msg.strerror > - > - raise DistutilsPlatformError(my_msg) > - > - # On AIX, there are wrong paths to the linker scripts in the Makefile > - # -- these paths are relative to the Python source, but when installed > - # the scripts are in another directory. > - if python_build: > - g['LDSHARED'] = g['BLDSHARED'] > - > - elif get_python_version() < '2.1': > - # The following two branches are for 1.5.2 compatibility. > - if sys.platform == 'aix4': # what about AIX 3.x ? > - # Linker script is in the config directory, not in Modules as the > - # Makefile says. > - python_lib = get_python_lib(standard_lib=1) > - ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix') > - python_exp = os.path.join(python_lib, 'config', 'python.exp') > - > - g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp) > - > - elif sys.platform == 'beos': > - # Linker script is in the config directory. In the Makefile it is > - # relative to the srcdir, which after installation no longer makes > - # sense. > - python_lib = get_python_lib(standard_lib=1) > - linkerscript_path = string.split(g['LDSHARED'])[0] > - linkerscript_name = os.path.basename(linkerscript_path) > - linkerscript = os.path.join(python_lib, 'config', > - linkerscript_name) > - > - # XXX this isn't the right place to do this: adding the Python > - # library to the link, if needed, should be in the "build_ext" > - # command. (It's also needed for non-MS compilers on Windows, and > - # it's taken care of for them by the 'build_ext.get_libraries()' > - # method.) > - g['LDSHARED'] = ("%s -L%s/lib -lpython%s" % > - (linkerscript, PREFIX, get_python_version())) > - > + # _sysconfigdata is generated at build time, see the sysconfig module > + from _sysconfigdata import build_time_vars > global _config_vars > - _config_vars = g > + _config_vars = {} > + _config_vars.update(build_time_vars) > > > def _init_nt(): > diff --git a/Lib/pprint.py b/Lib/pprint.py > --- a/Lib/pprint.py > +++ b/Lib/pprint.py > @@ -37,7 +37,10 @@ > import sys as _sys > import warnings > > -from cStringIO import StringIO as _StringIO > +try: > + from cStringIO import StringIO as _StringIO > +except ImportError: > + from StringIO import StringIO as _StringIO > > __all__ = ["pprint","pformat","isreadable","isrecursive","saferepr", > "PrettyPrinter"] > diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py > --- a/Lib/sysconfig.py > +++ b/Lib/sysconfig.py > @@ -278,9 +278,10 @@ > return os.path.join(_PROJECT_BASE, "Makefile") > return os.path.join(get_path('platstdlib'), "config", "Makefile") > > - > -def _init_posix(vars): > - """Initialize the module as appropriate for POSIX systems.""" > +def _generate_posix_vars(): > + """Generate the Python module containing build-time variables.""" > + import pprint > + vars = {} > # load the installed Makefile: > makefile = _get_makefile_filename() > try: > @@ -308,6 +309,49 @@ > if _PYTHON_BUILD: > vars['LDSHARED'] = vars['BLDSHARED'] > > + # There's a chicken-and-egg situation on OS X with regards to the > + # _sysconfigdata module after the changes introduced by #15298: > + # get_config_vars() is called by get_platform() as part of the > + # `make pybuilddir.txt` target -- which is a precursor to the > + # _sysconfigdata.py module being constructed. Unfortunately, > + # get_config_vars() eventually calls _init_posix(), which attempts > + # to import _sysconfigdata, which we won't have built yet. In order > + # for _init_posix() to work, if we're on Darwin, just mock up the > + # _sysconfigdata module manually and populate it with the build vars. > + # This is more than sufficient for ensuring the subsequent call to > + # get_platform() succeeds. > + name = '_sysconfigdata' > + if 'darwin' in sys.platform: > + import imp > + module = imp.new_module(name) > + module.build_time_vars = vars > + sys.modules[name] = module > + > + pybuilddir = 'build/lib.%s-%s' % (get_platform(), sys.version[:3]) > + if hasattr(sys, "gettotalrefcount"): > + pybuilddir += '-pydebug' > + try: > + os.makedirs(pybuilddir) > + except OSError: > + pass > + destfile = os.path.join(pybuilddir, name + '.py') > + > + with open(destfile, 'wb') as f: > + f.write('# system configuration generated and used by' > + ' the sysconfig module\n') > + f.write('build_time_vars = ') > + pprint.pprint(vars, stream=f) > + > + # Create file used for sys.path fixup -- see Modules/getpath.c > + with open('pybuilddir.txt', 'w') as f: > + f.write(pybuilddir) > + > +def _init_posix(vars): > + """Initialize the module as appropriate for POSIX systems.""" > + # _sysconfigdata is generated at build time, see _generate_posix_vars() > + from _sysconfigdata import build_time_vars > + vars.update(build_time_vars) > + > def _init_non_posix(vars): > """Initialize the module as appropriate for NT""" > # set basic install directories > @@ -565,3 +609,28 @@ > > def get_python_version(): > return _PY_VERSION_SHORT > + > + > +def _print_dict(title, data): > + for index, (key, value) in enumerate(sorted(data.items())): > + if index == 0: > + print '%s: ' % (title) > + print '\t%s = "%s"' % (key, value) > + > + > +def _main(): > + """Display all information sysconfig detains.""" > + if '--generate-posix-vars' in sys.argv: > + _generate_posix_vars() > + return > + print 'Platform: "%s"' % get_platform() > + print 'Python version: "%s"' % get_python_version() > + print 'Current installation scheme: "%s"' % _get_default_scheme() > + print > + _print_dict('Paths', get_paths()) > + print > + _print_dict('Variables', get_config_vars()) > + > + > +if __name__ == '__main__': > + _main() > diff --git a/Makefile.pre.in b/Makefile.pre.in > --- a/Makefile.pre.in > +++ b/Makefile.pre.in > @@ -437,15 +437,20 @@ > Modules/python.o \ > $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) > > -platform: $(BUILDPYTHON) > +platform: $(BUILDPYTHON) pybuilddir.txt > $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform > > +# Create build directory and generate the sysconfig build-time data there. > +# pybuilddir.txt contains the name of the build dir and is used for > +# sys.path fixup -- see Modules/getpath.c. > +pybuilddir.txt: $(BUILDPYTHON) > + $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars > > # Build the shared modules > # Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for > # -s, --silent or --quiet is always the first char. > # Under BSD make, MAKEFLAGS might be " -s -v x=y". > -sharedmods: $(BUILDPYTHON) > +sharedmods: $(BUILDPYTHON) pybuilddir.txt > @case "$$MAKEFLAGS" in \ > *\ -s*|s*) quiet="-q";; \ > *) quiet="";; \ > @@ -955,7 +960,7 @@ > else true; \ > fi; \ > done > - @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \ > + @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \ > do \ > if test -x $$i; then \ > $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \ > @@ -1133,6 +1138,7 @@ > --install-scripts=$(BINDIR) \ > --install-platlib=$(DESTSHARED) \ > --root=$(DESTDIR)/ > + -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py* > > # Here are a couple of targets for MacOSX again, to install a full > # framework-based Python. frameworkinstall installs everything, the > diff --git a/Misc/NEWS b/Misc/NEWS > --- a/Misc/NEWS > +++ b/Misc/NEWS > @@ -216,6 +216,10 @@ > Library > ------- > > +- Issue #13150: sysconfig no longer parses the Makefile and config.h files > + when imported, instead doing it at build time. This makes importing > + sysconfig faster and reduces Python startup time by 20%. > + > - Issue #10212: cStringIO and struct.unpack support new buffer objects. > > - Issue #12098: multiprocessing on Windows now starts child processes > > -- > Repository URL: http://hg.python.org/cpython > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > -- Thanks, Andrew Svetlov From solipsis at pitrou.net Fri Mar 22 05:54:07 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 22 Mar 2013 05:54:07 +0100 Subject: [Python-checkins] Daily reference leaks (472b72a61b0a): sum=1 Message-ID: results for 472b72a61b0a on branch "default" -------------------------------------------- test_support leaked [0, 0, -1] references, sum=-1 test_imaplib leaked [0, 9, -9] references, sum=0 test_imaplib leaked [0, 10, -8] memory blocks, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogvdsXu3', '-x'] From python-checkins at python.org Fri Mar 22 15:17:50 2013 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 22 Mar 2013 15:17:50 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Modernize_unit?= =?utf-8?q?test_example?= Message-ID: <3ZXRly678fz7Ljc@mail.python.org> http://hg.python.org/cpython/rev/d6336b2e4db6 changeset: 82877:d6336b2e4db6 branch: 2.7 parent: 82872:66e30c4870bb user: Raymond Hettinger date: Fri Mar 22 07:17:38 2013 -0700 summary: Modernize unittest example files: Doc/tutorial/stdlib.rst | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/tutorial/stdlib.rst b/Doc/tutorial/stdlib.rst --- a/Doc/tutorial/stdlib.rst +++ b/Doc/tutorial/stdlib.rst @@ -278,8 +278,10 @@ def test_average(self): self.assertEqual(average([20, 30, 70]), 40.0) self.assertEqual(round(average([1, 5, 7]), 1), 4.3) - self.assertRaises(ZeroDivisionError, average, []) - self.assertRaises(TypeError, average, 20, 30, 70) + with self.assertRaises(ZeroDivisionError): + average([]) + with self.assertRaises(TypeError): + average(20, 30, 70) unittest.main() # Calling from the command line invokes all tests -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 22 15:27:31 2013 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 22 Mar 2013 15:27:31 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Modernize_unit?= =?utf-8?q?test_example?= Message-ID: <3ZXRz71mqdzSTv@mail.python.org> http://hg.python.org/cpython/rev/5540ed8c9824 changeset: 82878:5540ed8c9824 branch: 3.3 parent: 82870:14f0c9e595a5 user: Raymond Hettinger date: Fri Mar 22 07:26:18 2013 -0700 summary: Modernize unittest example files: Doc/tutorial/stdlib.rst | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/tutorial/stdlib.rst b/Doc/tutorial/stdlib.rst --- a/Doc/tutorial/stdlib.rst +++ b/Doc/tutorial/stdlib.rst @@ -281,8 +281,10 @@ def test_average(self): self.assertEqual(average([20, 30, 70]), 40.0) self.assertEqual(round(average([1, 5, 7]), 1), 4.3) - self.assertRaises(ZeroDivisionError, average, []) - self.assertRaises(TypeError, average, 20, 30, 70) + with self.assertRaises(ZeroDivisionError): + average([]) + with self.assertRaises(TypeError): + average(20, 30, 70) unittest.main() # Calling from the command line invokes all tests -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 22 15:27:32 2013 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 22 Mar 2013 15:27:32 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZXRz84QPwzSTv@mail.python.org> http://hg.python.org/cpython/rev/6e25e5dbb269 changeset: 82879:6e25e5dbb269 parent: 82876:a2128cb22372 parent: 82878:5540ed8c9824 user: Raymond Hettinger date: Fri Mar 22 07:26:57 2013 -0700 summary: merge files: Doc/tutorial/stdlib.rst | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/tutorial/stdlib.rst b/Doc/tutorial/stdlib.rst --- a/Doc/tutorial/stdlib.rst +++ b/Doc/tutorial/stdlib.rst @@ -281,8 +281,10 @@ def test_average(self): self.assertEqual(average([20, 30, 70]), 40.0) self.assertEqual(round(average([1, 5, 7]), 1), 4.3) - self.assertRaises(ZeroDivisionError, average, []) - self.assertRaises(TypeError, average, 20, 30, 70) + with self.assertRaises(ZeroDivisionError): + average([]) + with self.assertRaises(TypeError): + average(20, 30, 70) unittest.main() # Calling from the command line invokes all tests -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 22 15:37:59 2013 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 22 Mar 2013 15:37:59 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_backout_66e30c?= =?utf-8?q?4870bb_for_breaking_OSX_=28=2313150=29?= Message-ID: <3ZXSCC5rfGzSTV@mail.python.org> http://hg.python.org/cpython/rev/d174cb3f5b9e changeset: 82880:d174cb3f5b9e branch: 2.7 parent: 82877:d6336b2e4db6 user: Benjamin Peterson date: Fri Mar 22 09:37:13 2013 -0500 summary: backout 66e30c4870bb for breaking OSX (#13150) files: Lib/distutils/sysconfig.py | 63 ++++++++++++++++++++- Lib/pprint.py | 5 +- Lib/sysconfig.py | 75 +------------------------ Makefile.pre.in | 12 +--- Misc/NEWS | 4 - 5 files changed, 66 insertions(+), 93 deletions(-) diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -387,11 +387,66 @@ def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" - # _sysconfigdata is generated at build time, see the sysconfig module - from _sysconfigdata import build_time_vars + g = {} + # load the installed Makefile: + try: + filename = get_makefile_filename() + parse_makefile(filename, g) + except IOError, msg: + my_msg = "invalid Python installation: unable to open %s" % filename + if hasattr(msg, "strerror"): + my_msg = my_msg + " (%s)" % msg.strerror + + raise DistutilsPlatformError(my_msg) + + # load the installed pyconfig.h: + try: + filename = get_config_h_filename() + parse_config_h(file(filename), g) + except IOError, msg: + my_msg = "invalid Python installation: unable to open %s" % filename + if hasattr(msg, "strerror"): + my_msg = my_msg + " (%s)" % msg.strerror + + raise DistutilsPlatformError(my_msg) + + # On AIX, there are wrong paths to the linker scripts in the Makefile + # -- these paths are relative to the Python source, but when installed + # the scripts are in another directory. + if python_build: + g['LDSHARED'] = g['BLDSHARED'] + + elif get_python_version() < '2.1': + # The following two branches are for 1.5.2 compatibility. + if sys.platform == 'aix4': # what about AIX 3.x ? + # Linker script is in the config directory, not in Modules as the + # Makefile says. + python_lib = get_python_lib(standard_lib=1) + ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix') + python_exp = os.path.join(python_lib, 'config', 'python.exp') + + g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp) + + elif sys.platform == 'beos': + # Linker script is in the config directory. In the Makefile it is + # relative to the srcdir, which after installation no longer makes + # sense. + python_lib = get_python_lib(standard_lib=1) + linkerscript_path = string.split(g['LDSHARED'])[0] + linkerscript_name = os.path.basename(linkerscript_path) + linkerscript = os.path.join(python_lib, 'config', + linkerscript_name) + + # XXX this isn't the right place to do this: adding the Python + # library to the link, if needed, should be in the "build_ext" + # command. (It's also needed for non-MS compilers on Windows, and + # it's taken care of for them by the 'build_ext.get_libraries()' + # method.) + g['LDSHARED'] = ("%s -L%s/lib -lpython%s" % + (linkerscript, PREFIX, get_python_version())) + global _config_vars - _config_vars = {} - _config_vars.update(build_time_vars) + _config_vars = g def _init_nt(): diff --git a/Lib/pprint.py b/Lib/pprint.py --- a/Lib/pprint.py +++ b/Lib/pprint.py @@ -37,10 +37,7 @@ import sys as _sys import warnings -try: - from cStringIO import StringIO as _StringIO -except ImportError: - from StringIO import StringIO as _StringIO +from cStringIO import StringIO as _StringIO __all__ = ["pprint","pformat","isreadable","isrecursive","saferepr", "PrettyPrinter"] diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -278,10 +278,9 @@ return os.path.join(_PROJECT_BASE, "Makefile") return os.path.join(get_path('platstdlib'), "config", "Makefile") -def _generate_posix_vars(): - """Generate the Python module containing build-time variables.""" - import pprint - vars = {} + +def _init_posix(vars): + """Initialize the module as appropriate for POSIX systems.""" # load the installed Makefile: makefile = _get_makefile_filename() try: @@ -309,49 +308,6 @@ if _PYTHON_BUILD: vars['LDSHARED'] = vars['BLDSHARED'] - # There's a chicken-and-egg situation on OS X with regards to the - # _sysconfigdata module after the changes introduced by #15298: - # get_config_vars() is called by get_platform() as part of the - # `make pybuilddir.txt` target -- which is a precursor to the - # _sysconfigdata.py module being constructed. Unfortunately, - # get_config_vars() eventually calls _init_posix(), which attempts - # to import _sysconfigdata, which we won't have built yet. In order - # for _init_posix() to work, if we're on Darwin, just mock up the - # _sysconfigdata module manually and populate it with the build vars. - # This is more than sufficient for ensuring the subsequent call to - # get_platform() succeeds. - name = '_sysconfigdata' - if 'darwin' in sys.platform: - import imp - module = imp.new_module(name) - module.build_time_vars = vars - sys.modules[name] = module - - pybuilddir = 'build/lib.%s-%s' % (get_platform(), sys.version[:3]) - if hasattr(sys, "gettotalrefcount"): - pybuilddir += '-pydebug' - try: - os.makedirs(pybuilddir) - except OSError: - pass - destfile = os.path.join(pybuilddir, name + '.py') - - with open(destfile, 'wb') as f: - f.write('# system configuration generated and used by' - ' the sysconfig module\n') - f.write('build_time_vars = ') - pprint.pprint(vars, stream=f) - - # Create file used for sys.path fixup -- see Modules/getpath.c - with open('pybuilddir.txt', 'w') as f: - f.write(pybuilddir) - -def _init_posix(vars): - """Initialize the module as appropriate for POSIX systems.""" - # _sysconfigdata is generated at build time, see _generate_posix_vars() - from _sysconfigdata import build_time_vars - vars.update(build_time_vars) - def _init_non_posix(vars): """Initialize the module as appropriate for NT""" # set basic install directories @@ -609,28 +565,3 @@ def get_python_version(): return _PY_VERSION_SHORT - - -def _print_dict(title, data): - for index, (key, value) in enumerate(sorted(data.items())): - if index == 0: - print '%s: ' % (title) - print '\t%s = "%s"' % (key, value) - - -def _main(): - """Display all information sysconfig detains.""" - if '--generate-posix-vars' in sys.argv: - _generate_posix_vars() - return - print 'Platform: "%s"' % get_platform() - print 'Python version: "%s"' % get_python_version() - print 'Current installation scheme: "%s"' % _get_default_scheme() - print - _print_dict('Paths', get_paths()) - print - _print_dict('Variables', get_config_vars()) - - -if __name__ == '__main__': - _main() diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -437,20 +437,15 @@ Modules/python.o \ $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) -platform: $(BUILDPYTHON) pybuilddir.txt +platform: $(BUILDPYTHON) $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform -# Create build directory and generate the sysconfig build-time data there. -# pybuilddir.txt contains the name of the build dir and is used for -# sys.path fixup -- see Modules/getpath.c. -pybuilddir.txt: $(BUILDPYTHON) - $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars # Build the shared modules # Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for # -s, --silent or --quiet is always the first char. # Under BSD make, MAKEFLAGS might be " -s -v x=y". -sharedmods: $(BUILDPYTHON) pybuilddir.txt +sharedmods: $(BUILDPYTHON) @case "$$MAKEFLAGS" in \ *\ -s*|s*) quiet="-q";; \ *) quiet="";; \ @@ -960,7 +955,7 @@ else true; \ fi; \ done - @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \ + @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \ do \ if test -x $$i; then \ $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \ @@ -1138,7 +1133,6 @@ --install-scripts=$(BINDIR) \ --install-platlib=$(DESTSHARED) \ --root=$(DESTDIR)/ - -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py* # Here are a couple of targets for MacOSX again, to install a full # framework-based Python. frameworkinstall installs everything, the diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -216,10 +216,6 @@ Library ------- -- Issue #13150: sysconfig no longer parses the Makefile and config.h files - when imported, instead doing it at build time. This makes importing - sysconfig faster and reduces Python startup time by 20%. - - Issue #10212: cStringIO and struct.unpack support new buffer objects. - Issue #12098: multiprocessing on Windows now starts child processes -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 22 16:28:19 2013 From: python-checkins at python.org (vinay.sajip) Date: Fri, 22 Mar 2013 16:28:19 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3NTA4?= =?utf-8?q?=3A_Handled_out-of-order_handler_configuration_correctly=2E?= Message-ID: <3ZXTKH6dCxzSJs@mail.python.org> http://hg.python.org/cpython/rev/8ae1c28445f8 changeset: 82881:8ae1c28445f8 branch: 2.7 user: Vinay Sajip date: Fri Mar 22 15:19:24 2013 +0000 summary: Issue #17508: Handled out-of-order handler configuration correctly. files: Lib/logging/config.py | 28 +++++++++++++++++-- Lib/test/test_logging.py | 38 ++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/Lib/logging/config.py b/Lib/logging/config.py --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -1,4 +1,4 @@ -# Copyright 2001-2010 by Vinay Sajip. All Rights Reserved. +# Copyright 2001-2013 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, @@ -19,7 +19,7 @@ is based on PEP 282 and comments thereto in comp.lang.python, and influenced by Apache's log4j system. -Copyright (C) 2001-2010 Vinay Sajip. All Rights Reserved. +Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved. To use, simply 'import logging' and log away! """ @@ -565,14 +565,29 @@ # As handlers can refer to other handlers, sort the keys # to allow a deterministic order of configuration handlers = config.get('handlers', EMPTY_DICT) + deferred = [] for name in sorted(handlers): try: handler = self.configure_handler(handlers[name]) handler.name = name handlers[name] = handler except StandardError, e: + if 'target not configured yet' in str(e): + deferred.append(name) + else: + raise ValueError('Unable to configure handler ' + '%r: %s' % (name, e)) + + # Now do any that were deferred + for name in deferred: + try: + handler = self.configure_handler(handlers[name]) + handler.name = name + handlers[name] = handler + except StandardError, e: raise ValueError('Unable to configure handler ' '%r: %s' % (name, e)) + # Next, do loggers - they refer to handlers and filters #we don't want to lose the existing loggers, @@ -695,12 +710,17 @@ c = self.resolve(c) factory = c else: - klass = self.resolve(config.pop('class')) + cname = config.pop('class') + klass = self.resolve(cname) #Special case for handler which refers to another handler if issubclass(klass, logging.handlers.MemoryHandler) and\ 'target' in config: try: - config['target'] = self.config['handlers'][config['target']] + th = self.config['handlers'][config['target']] + if not isinstance(th, logging.Handler): + config['class'] = cname # restore for deferred configuration + raise StandardError('target not configured yet') + config['target'] = th except StandardError, e: raise ValueError('Unable to set target handler ' '%r: %s' % (config['target'], e)) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2001-2012 by Vinay Sajip. All Rights Reserved. +# Copyright 2001-2013 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, @@ -18,7 +18,7 @@ """Test harness for the logging module. Run all tests. -Copyright (C) 2001-2012 Vinay Sajip. All Rights Reserved. +Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved. """ import logging @@ -1585,6 +1585,36 @@ }, } + out_of_order = { + "version": 1, + "formatters": { + "mySimpleFormatter": { + "format": "%(asctime)s (%(name)s) %(levelname)s: %(message)s" + } + }, + "handlers": { + "fileGlobal": { + "class": "logging.StreamHandler", + "level": "DEBUG", + "formatter": "mySimpleFormatter" + }, + "bufferGlobal": { + "class": "logging.handlers.MemoryHandler", + "capacity": 5, + "formatter": "mySimpleFormatter", + "target": "fileGlobal", + "level": "DEBUG" + } + }, + "loggers": { + "mymodule": { + "level": "DEBUG", + "handlers": ["bufferGlobal"], + "propagate": "true" + } + } + } + def apply_config(self, conf): logging.config.dictConfig(conf) @@ -1839,6 +1869,10 @@ # Original logger output is empty. self.assert_log_lines([]) + def test_out_of_order(self): + self.apply_config(self.out_of_order) + handler = logging.getLogger('mymodule').handlers[0] + self.assertIsInstance(handler.target, logging.Handler) class ManagerTest(BaseTest): def test_manager_loggerclass(self): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 22 16:28:21 2013 From: python-checkins at python.org (vinay.sajip) Date: Fri, 22 Mar 2013 16:28:21 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3NTA4?= =?utf-8?q?=3A_Handled_out-of-order_handler_configuration_correctly=2E?= Message-ID: <3ZXTKK3sQ9z7Ljh@mail.python.org> http://hg.python.org/cpython/rev/ea00ae184d60 changeset: 82882:ea00ae184d60 branch: 3.2 parent: 82869:8f91014c8f00 user: Vinay Sajip date: Fri Mar 22 15:19:54 2013 +0000 summary: Issue #17508: Handled out-of-order handler configuration correctly. files: Lib/logging/config.py | 28 +++++++++++++++++-- Lib/test/test_logging.py | 38 ++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/Lib/logging/config.py b/Lib/logging/config.py --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -1,4 +1,4 @@ -# Copyright 2001-2010 by Vinay Sajip. All Rights Reserved. +# Copyright 2001-2013 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, @@ -19,7 +19,7 @@ is based on PEP 282 and comments thereto in comp.lang.python, and influenced by Apache's log4j system. -Copyright (C) 2001-2010 Vinay Sajip. All Rights Reserved. +Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved. To use, simply 'import logging' and log away! """ @@ -564,14 +564,29 @@ # As handlers can refer to other handlers, sort the keys # to allow a deterministic order of configuration handlers = config.get('handlers', EMPTY_DICT) + deferred = [] for name in sorted(handlers): try: handler = self.configure_handler(handlers[name]) handler.name = name handlers[name] = handler except Exception as e: + if 'target not configured yet' in str(e): + deferred.append(name) + else: + raise ValueError('Unable to configure handler ' + '%r: %s' % (name, e)) + + # Now do any that were deferred + for name in deferred: + try: + handler = self.configure_handler(handlers[name]) + handler.name = name + handlers[name] = handler + except Exception as e: raise ValueError('Unable to configure handler ' '%r: %s' % (name, e)) + # Next, do loggers - they refer to handlers and filters #we don't want to lose the existing loggers, @@ -694,12 +709,17 @@ c = self.resolve(c) factory = c else: - klass = self.resolve(config.pop('class')) + cname = config.pop('class') + klass = self.resolve(cname) #Special case for handler which refers to another handler if issubclass(klass, logging.handlers.MemoryHandler) and\ 'target' in config: try: - config['target'] = self.config['handlers'][config['target']] + th = self.config['handlers'][config['target']] + if not isinstance(th, logging.Handler): + config['class'] = cname # restore for deferred configuration + raise TypeError('target not configured yet') + config['target'] = th except Exception as e: raise ValueError('Unable to set target handler ' '%r: %s' % (config['target'], e)) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2001-2012 by Vinay Sajip. All Rights Reserved. +# Copyright 2001-2013 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, @@ -18,7 +18,7 @@ """Test harness for the logging module. Run all tests. -Copyright (C) 2001-2012 Vinay Sajip. All Rights Reserved. +Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved. """ import logging @@ -1696,6 +1696,36 @@ }, } + out_of_order = { + "version": 1, + "formatters": { + "mySimpleFormatter": { + "format": "%(asctime)s (%(name)s) %(levelname)s: %(message)s" + } + }, + "handlers": { + "fileGlobal": { + "class": "logging.StreamHandler", + "level": "DEBUG", + "formatter": "mySimpleFormatter" + }, + "bufferGlobal": { + "class": "logging.handlers.MemoryHandler", + "capacity": 5, + "formatter": "mySimpleFormatter", + "target": "fileGlobal", + "level": "DEBUG" + } + }, + "loggers": { + "mymodule": { + "level": "DEBUG", + "handlers": ["bufferGlobal"], + "propagate": "true" + } + } + } + def apply_config(self, conf): logging.config.dictConfig(conf) @@ -1994,6 +2024,10 @@ # Original logger output is empty. self.assert_log_lines([]) + def test_out_of_order(self): + self.apply_config(self.out_of_order) + handler = logging.getLogger('mymodule').handlers[0] + self.assertIsInstance(handler.target, logging.Handler) class ManagerTest(BaseTest): def test_manager_loggerclass(self): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 22 16:28:23 2013 From: python-checkins at python.org (vinay.sajip) Date: Fri, 22 Mar 2013 16:28:23 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Issue_=2317508=3A_Merged_fix_from_3=2E2=2E?= Message-ID: <3ZXTKM0sNDz7Ljy@mail.python.org> http://hg.python.org/cpython/rev/d674bbbed333 changeset: 82883:d674bbbed333 branch: 3.3 parent: 82878:5540ed8c9824 parent: 82882:ea00ae184d60 user: Vinay Sajip date: Fri Mar 22 15:23:13 2013 +0000 summary: Issue #17508: Merged fix from 3.2. files: Lib/logging/config.py | 28 +++++++++++++++++-- Lib/test/test_logging.py | 39 ++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/Lib/logging/config.py b/Lib/logging/config.py --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -1,4 +1,4 @@ -# Copyright 2001-2010 by Vinay Sajip. All Rights Reserved. +# Copyright 2001-2013 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, @@ -19,7 +19,7 @@ is based on PEP 282 and comments thereto in comp.lang.python, and influenced by Apache's log4j system. -Copyright (C) 2001-2010 Vinay Sajip. All Rights Reserved. +Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved. To use, simply 'import logging' and log away! """ @@ -561,14 +561,29 @@ # As handlers can refer to other handlers, sort the keys # to allow a deterministic order of configuration handlers = config.get('handlers', EMPTY_DICT) + deferred = [] for name in sorted(handlers): try: handler = self.configure_handler(handlers[name]) handler.name = name handlers[name] = handler except Exception as e: + if 'target not configured yet' in str(e): + deferred.append(name) + else: + raise ValueError('Unable to configure handler ' + '%r: %s' % (name, e)) + + # Now do any that were deferred + for name in deferred: + try: + handler = self.configure_handler(handlers[name]) + handler.name = name + handlers[name] = handler + except Exception as e: raise ValueError('Unable to configure handler ' '%r: %s' % (name, e)) + # Next, do loggers - they refer to handlers and filters #we don't want to lose the existing loggers, @@ -691,12 +706,17 @@ c = self.resolve(c) factory = c else: - klass = self.resolve(config.pop('class')) + cname = config.pop('class') + klass = self.resolve(cname) #Special case for handler which refers to another handler if issubclass(klass, logging.handlers.MemoryHandler) and\ 'target' in config: try: - config['target'] = self.config['handlers'][config['target']] + th = self.config['handlers'][config['target']] + if not isinstance(th, logging.Handler): + config['class'] = cname # restore for deferred configuration + raise TypeError('target not configured yet') + config['target'] = th except Exception as e: raise ValueError('Unable to set target handler ' '%r: %s' % (config['target'], e)) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2001-2012 by Vinay Sajip. All Rights Reserved. +# Copyright 2001-2013 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, @@ -18,7 +18,7 @@ """Test harness for the logging module. Run all tests. -Copyright (C) 2001-2012 Vinay Sajip. All Rights Reserved. +Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved. """ import logging @@ -2364,6 +2364,36 @@ }, } + out_of_order = { + "version": 1, + "formatters": { + "mySimpleFormatter": { + "format": "%(asctime)s (%(name)s) %(levelname)s: %(message)s" + } + }, + "handlers": { + "fileGlobal": { + "class": "logging.StreamHandler", + "level": "DEBUG", + "formatter": "mySimpleFormatter" + }, + "bufferGlobal": { + "class": "logging.handlers.MemoryHandler", + "capacity": 5, + "formatter": "mySimpleFormatter", + "target": "fileGlobal", + "level": "DEBUG" + } + }, + "loggers": { + "mymodule": { + "level": "DEBUG", + "handlers": ["bufferGlobal"], + "propagate": "true" + } + } + } + def apply_config(self, conf): logging.config.dictConfig(conf) @@ -2664,6 +2694,11 @@ # Original logger output is empty. self.assert_log_lines([]) + def test_out_of_order(self): + self.apply_config(self.out_of_order) + handler = logging.getLogger('mymodule').handlers[0] + self.assertIsInstance(handler.target, logging.Handler) + def test_baseconfig(self): d = { 'atuple': (1, 2, 3), -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 22 16:28:24 2013 From: python-checkins at python.org (vinay.sajip) Date: Fri, 22 Mar 2013 16:28:24 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Closes_=2317508=3A_Merged_fix_from_3=2E3=2E?= Message-ID: <3ZXTKN4wvqz7Lk5@mail.python.org> http://hg.python.org/cpython/rev/b916efe30d77 changeset: 82884:b916efe30d77 parent: 82879:6e25e5dbb269 parent: 82883:d674bbbed333 user: Vinay Sajip date: Fri Mar 22 15:27:52 2013 +0000 summary: Closes #17508: Merged fix from 3.3. files: Lib/logging/config.py | 28 +++++++++++++++++-- Lib/test/test_logging.py | 39 ++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/Lib/logging/config.py b/Lib/logging/config.py --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -1,4 +1,4 @@ -# Copyright 2001-2012 by Vinay Sajip. All Rights Reserved. +# Copyright 2001-2013 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, @@ -19,7 +19,7 @@ is based on PEP 282 and comments thereto in comp.lang.python, and influenced by Apache's log4j system. -Copyright (C) 2001-2012 Vinay Sajip. All Rights Reserved. +Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved. To use, simply 'import logging' and log away! """ @@ -564,14 +564,29 @@ # As handlers can refer to other handlers, sort the keys # to allow a deterministic order of configuration handlers = config.get('handlers', EMPTY_DICT) + deferred = [] for name in sorted(handlers): try: handler = self.configure_handler(handlers[name]) handler.name = name handlers[name] = handler except Exception as e: + if 'target not configured yet' in str(e): + deferred.append(name) + else: + raise ValueError('Unable to configure handler ' + '%r: %s' % (name, e)) + + # Now do any that were deferred + for name in deferred: + try: + handler = self.configure_handler(handlers[name]) + handler.name = name + handlers[name] = handler + except Exception as e: raise ValueError('Unable to configure handler ' '%r: %s' % (name, e)) + # Next, do loggers - they refer to handlers and filters #we don't want to lose the existing loggers, @@ -694,12 +709,17 @@ c = self.resolve(c) factory = c else: - klass = self.resolve(config.pop('class')) + cname = config.pop('class') + klass = self.resolve(cname) #Special case for handler which refers to another handler if issubclass(klass, logging.handlers.MemoryHandler) and\ 'target' in config: try: - config['target'] = self.config['handlers'][config['target']] + th = self.config['handlers'][config['target']] + if not isinstance(th, logging.Handler): + config['class'] = cname # restore for deferred configuration + raise TypeError('target not configured yet') + config['target'] = th except Exception as e: raise ValueError('Unable to set target handler ' '%r: %s' % (config['target'], e)) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2001-2012 by Vinay Sajip. All Rights Reserved. +# Copyright 2001-2013 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, @@ -18,7 +18,7 @@ """Test harness for the logging module. Run all tests. -Copyright (C) 2001-2012 Vinay Sajip. All Rights Reserved. +Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved. """ import logging @@ -2415,6 +2415,36 @@ }, } + out_of_order = { + "version": 1, + "formatters": { + "mySimpleFormatter": { + "format": "%(asctime)s (%(name)s) %(levelname)s: %(message)s" + } + }, + "handlers": { + "fileGlobal": { + "class": "logging.StreamHandler", + "level": "DEBUG", + "formatter": "mySimpleFormatter" + }, + "bufferGlobal": { + "class": "logging.handlers.MemoryHandler", + "capacity": 5, + "formatter": "mySimpleFormatter", + "target": "fileGlobal", + "level": "DEBUG" + } + }, + "loggers": { + "mymodule": { + "level": "DEBUG", + "handlers": ["bufferGlobal"], + "propagate": "true" + } + } + } + def apply_config(self, conf): logging.config.dictConfig(conf) @@ -2787,6 +2817,11 @@ ('ERROR', '2'), ], pat=r"^[\w.]+ -> (\w+): (\d+)$") + def test_out_of_order(self): + self.apply_config(self.out_of_order) + handler = logging.getLogger('mymodule').handlers[0] + self.assertIsInstance(handler.target, logging.Handler) + def test_baseconfig(self): d = { 'atuple': (1, 2, 3), -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 22 21:49:58 2013 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 22 Mar 2013 21:49:58 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_Clean_up_refer?= =?utf-8?q?ences_to_the_no_longer_existing_PyString=5F_APIs_in_our_docs=2E?= Message-ID: <3ZXcSQ40bwzSTV@mail.python.org> http://hg.python.org/cpython/rev/0bde86c89294 changeset: 82885:0bde86c89294 branch: 3.2 parent: 82882:ea00ae184d60 user: Gregory P. Smith date: Fri Mar 22 13:43:30 2013 -0700 summary: Clean up references to the no longer existing PyString_ APIs in our docs. files: Doc/c-api/intro.rst | 2 +- Doc/c-api/memory.rst | 6 +++--- Doc/extending/newtypes.rst | 23 +++++++++++------------ Doc/faq/extending.rst | 14 ++++++++------ 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -210,7 +210,7 @@ t = PyTuple_New(3); PyTuple_SetItem(t, 0, PyLong_FromLong(1L)); PyTuple_SetItem(t, 1, PyLong_FromLong(2L)); - PyTuple_SetItem(t, 2, PyString_FromString("three")); + PyTuple_SetItem(t, 2, PyUnicode_FromString("three")); Here, :c:func:`PyLong_FromLong` returns a new reference which is immediately stolen by :c:func:`PyTuple_SetItem`. When you want to keep using an object diff --git a/Doc/c-api/memory.rst b/Doc/c-api/memory.rst --- a/Doc/c-api/memory.rst +++ b/Doc/c-api/memory.rst @@ -61,7 +61,7 @@ if (buf == NULL) return PyErr_NoMemory(); ...Do some I/O operation involving buf... - res = PyString_FromString(buf); + res = PyBytes_FromString(buf); free(buf); /* malloc'ed */ return res; @@ -169,7 +169,7 @@ if (buf == NULL) return PyErr_NoMemory(); /* ...Do some I/O operation involving buf... */ - res = PyString_FromString(buf); + res = PyBytes_FromString(buf); PyMem_Free(buf); /* allocated with PyMem_Malloc */ return res; @@ -181,7 +181,7 @@ if (buf == NULL) return PyErr_NoMemory(); /* ...Do some I/O operation involving buf... */ - res = PyString_FromString(buf); + res = PyBytes_FromString(buf); PyMem_Del(buf); /* allocated with PyMem_New */ return res; diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -287,14 +287,14 @@ self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyString_FromString(""); + self->first = PyUnicode_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyString_FromString(""); + self->last = PyUnicode_FromString(""); if (self->last == NULL) { Py_DECREF(self); @@ -449,7 +449,7 @@ PyObject *args, *result; if (format == NULL) { - format = PyString_FromString("%s %s"); + format = PyUnicode_FromString("%s %s"); if (format == NULL) return NULL; } @@ -468,7 +468,7 @@ if (args == NULL) return NULL; - result = PyString_Format(format, args); + result = PyUnicode_Format(format, args); Py_DECREF(args); return result; @@ -557,9 +557,9 @@ return -1; } - if (! PyString_Check(value)) { + if (! PyUnicode_Check(value)) { PyErr_SetString(PyExc_TypeError, - "The first attribute value must be a string"); + "The first attribute value must be a str"); return -1; } @@ -1022,8 +1022,8 @@ static PyObject * newdatatype_repr(newdatatypeobject * obj) { - return PyString_FromFormat("Repr-ified_newdatatype{{size:\%d}}", - obj->obj_UnderlyingDatatypePtr->size); + return PyUnicode_FromFormat("Repr-ified_newdatatype{{size:\%d}}", + obj->obj_UnderlyingDatatypePtr->size); } If no :attr:`tp_repr` handler is specified, the interpreter will supply a @@ -1042,8 +1042,8 @@ static PyObject * newdatatype_str(newdatatypeobject * obj) { - return PyString_FromFormat("Stringified_newdatatype{{size:\%d}}", - obj->obj_UnderlyingDatatypePtr->size); + return PyUnicode_FromFormat("Stringified_newdatatype{{size:\%d}}", + obj->obj_UnderlyingDatatypePtr->size); } @@ -1364,11 +1364,10 @@ if (!PyArg_ParseTuple(args, "sss:call", &arg1, &arg2, &arg3)) { return NULL; } - result = PyString_FromFormat( + result = PyUnicode_FromFormat( "Returning -- value: [\%d] arg1: [\%s] arg2: [\%s] arg3: [\%s]\n", obj->obj_UnderlyingDatatypePtr->size, arg1, arg2, arg3); - printf("\%s", PyString_AS_STRING(result)); return result; } diff --git a/Doc/faq/extending.rst b/Doc/faq/extending.rst --- a/Doc/faq/extending.rst +++ b/Doc/faq/extending.rst @@ -82,18 +82,20 @@ index. Lists have similar functions, :c:func:`PyListSize` and :c:func:`PyList_GetItem`. -For strings, :c:func:`PyString_Size` returns its length and -:c:func:`PyString_AsString` a pointer to its value. Note that Python strings may -contain null bytes so C's :c:func:`strlen` should not be used. +For bytes, :c:func:`PyBytes_Size` returns its length and +:c:func:`PyBytes_AsStringAndSize` provides a pointer to its value and its +length. Note that Python bytes objects may contain null bytes so C's +:c:func:`strlen` should not be used. To test the type of an object, first make sure it isn't *NULL*, and then use -:c:func:`PyString_Check`, :c:func:`PyTuple_Check`, :c:func:`PyList_Check`, etc. +:c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:`PyList_Check`, etc. There is also a high-level API to Python objects which is provided by the so-called 'abstract' interface -- read ``Include/abstract.h`` for further details. It allows interfacing with any kind of Python sequence using calls -like :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem`, etc.) as well as -many other useful protocols. +like :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem`, etc.) as well +as many other useful protocols such as numbers (:c:func:`PyNumber_Index` et. +al.) and mappings in the PyMapping APIs. How do I use Py_BuildValue() to create a tuple of arbitrary length? -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 22 21:50:00 2013 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 22 Mar 2013 21:50:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_cleanup_references_to_PyString=5F_APIs_from_2=2Ex_in_the_3=2E3?= =?utf-8?q?_docs=2E?= Message-ID: <3ZXcSS11vyz7Ljj@mail.python.org> http://hg.python.org/cpython/rev/6bdf64a5f4d7 changeset: 82886:6bdf64a5f4d7 branch: 3.3 parent: 82883:d674bbbed333 parent: 82885:0bde86c89294 user: Gregory P. Smith date: Fri Mar 22 13:49:26 2013 -0700 summary: cleanup references to PyString_ APIs from 2.x in the 3.3 docs. files: Doc/c-api/intro.rst | 2 +- Doc/c-api/memory.rst | 6 +++--- Doc/extending/newtypes.rst | 19 +++++++++---------- Doc/faq/extending.rst | 14 ++++++++------ 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -210,7 +210,7 @@ t = PyTuple_New(3); PyTuple_SetItem(t, 0, PyLong_FromLong(1L)); PyTuple_SetItem(t, 1, PyLong_FromLong(2L)); - PyTuple_SetItem(t, 2, PyString_FromString("three")); + PyTuple_SetItem(t, 2, PyUnicode_FromString("three")); Here, :c:func:`PyLong_FromLong` returns a new reference which is immediately stolen by :c:func:`PyTuple_SetItem`. When you want to keep using an object diff --git a/Doc/c-api/memory.rst b/Doc/c-api/memory.rst --- a/Doc/c-api/memory.rst +++ b/Doc/c-api/memory.rst @@ -61,7 +61,7 @@ if (buf == NULL) return PyErr_NoMemory(); ...Do some I/O operation involving buf... - res = PyString_FromString(buf); + res = PyBytes_FromString(buf); free(buf); /* malloc'ed */ return res; @@ -169,7 +169,7 @@ if (buf == NULL) return PyErr_NoMemory(); /* ...Do some I/O operation involving buf... */ - res = PyString_FromString(buf); + res = PyBytes_FromString(buf); PyMem_Free(buf); /* allocated with PyMem_Malloc */ return res; @@ -181,7 +181,7 @@ if (buf == NULL) return PyErr_NoMemory(); /* ...Do some I/O operation involving buf... */ - res = PyString_FromString(buf); + res = PyBytes_FromString(buf); PyMem_Del(buf); /* allocated with PyMem_New */ return res; diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -288,13 +288,13 @@ self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyString_FromString(""); + self->first = PyUnicode_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyString_FromString(""); + self->last = PyUnicode_FromString(""); if (self->last == NULL) { Py_DECREF(self); return NULL; @@ -540,9 +540,9 @@ return -1; } - if (! PyString_Check(value)) { + if (! PyUnicode_Check(value)) { PyErr_SetString(PyExc_TypeError, - "The first attribute value must be a string"); + "The first attribute value must be a str"); return -1; } @@ -1005,8 +1005,8 @@ static PyObject * newdatatype_repr(newdatatypeobject * obj) { - return PyString_FromFormat("Repr-ified_newdatatype{{size:\%d}}", - obj->obj_UnderlyingDatatypePtr->size); + return PyUnicode_FromFormat("Repr-ified_newdatatype{{size:\%d}}", + obj->obj_UnderlyingDatatypePtr->size); } If no :attr:`tp_repr` handler is specified, the interpreter will supply a @@ -1025,8 +1025,8 @@ static PyObject * newdatatype_str(newdatatypeobject * obj) { - return PyString_FromFormat("Stringified_newdatatype{{size:\%d}}", - obj->obj_UnderlyingDatatypePtr->size); + return PyUnicode_FromFormat("Stringified_newdatatype{{size:\%d}}", + obj->obj_UnderlyingDatatypePtr->size); } @@ -1342,11 +1342,10 @@ if (!PyArg_ParseTuple(args, "sss:call", &arg1, &arg2, &arg3)) { return NULL; } - result = PyString_FromFormat( + result = PyUnicode_FromFormat( "Returning -- value: [\%d] arg1: [\%s] arg2: [\%s] arg3: [\%s]\n", obj->obj_UnderlyingDatatypePtr->size, arg1, arg2, arg3); - printf("\%s", PyString_AS_STRING(result)); return result; } diff --git a/Doc/faq/extending.rst b/Doc/faq/extending.rst --- a/Doc/faq/extending.rst +++ b/Doc/faq/extending.rst @@ -82,18 +82,20 @@ index. Lists have similar functions, :c:func:`PyListSize` and :c:func:`PyList_GetItem`. -For strings, :c:func:`PyString_Size` returns its length and -:c:func:`PyString_AsString` a pointer to its value. Note that Python strings may -contain null bytes so C's :c:func:`strlen` should not be used. +For bytes, :c:func:`PyBytes_Size` returns its length and +:c:func:`PyBytes_AsStringAndSize` provides a pointer to its value and its +length. Note that Python bytes objects may contain null bytes so C's +:c:func:`strlen` should not be used. To test the type of an object, first make sure it isn't *NULL*, and then use -:c:func:`PyString_Check`, :c:func:`PyTuple_Check`, :c:func:`PyList_Check`, etc. +:c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:`PyList_Check`, etc. There is also a high-level API to Python objects which is provided by the so-called 'abstract' interface -- read ``Include/abstract.h`` for further details. It allows interfacing with any kind of Python sequence using calls -like :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem`, etc.) as well as -many other useful protocols. +like :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem`, etc.) as well +as many other useful protocols such as numbers (:c:func:`PyNumber_Index` et. +al.) and mappings in the PyMapping APIs. How do I use Py_BuildValue() to create a tuple of arbitrary length? -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 22 21:50:01 2013 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 22 Mar 2013 21:50:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_cleanup_references_to_PyString=5F_APIs_in_the_3=2Ex_docs?= =?utf-8?q?=2E?= Message-ID: <3ZXcST4qJQz7Ljj@mail.python.org> http://hg.python.org/cpython/rev/81083f8841fe changeset: 82887:81083f8841fe parent: 82884:b916efe30d77 parent: 82886:6bdf64a5f4d7 user: Gregory P. Smith date: Fri Mar 22 13:49:53 2013 -0700 summary: cleanup references to PyString_ APIs in the 3.x docs. files: Doc/c-api/intro.rst | 2 +- Doc/c-api/memory.rst | 6 +++--- Doc/extending/newtypes.rst | 19 +++++++++---------- Doc/faq/extending.rst | 14 ++++++++------ 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -210,7 +210,7 @@ t = PyTuple_New(3); PyTuple_SetItem(t, 0, PyLong_FromLong(1L)); PyTuple_SetItem(t, 1, PyLong_FromLong(2L)); - PyTuple_SetItem(t, 2, PyString_FromString("three")); + PyTuple_SetItem(t, 2, PyUnicode_FromString("three")); Here, :c:func:`PyLong_FromLong` returns a new reference which is immediately stolen by :c:func:`PyTuple_SetItem`. When you want to keep using an object diff --git a/Doc/c-api/memory.rst b/Doc/c-api/memory.rst --- a/Doc/c-api/memory.rst +++ b/Doc/c-api/memory.rst @@ -61,7 +61,7 @@ if (buf == NULL) return PyErr_NoMemory(); ...Do some I/O operation involving buf... - res = PyString_FromString(buf); + res = PyBytes_FromString(buf); free(buf); /* malloc'ed */ return res; @@ -169,7 +169,7 @@ if (buf == NULL) return PyErr_NoMemory(); /* ...Do some I/O operation involving buf... */ - res = PyString_FromString(buf); + res = PyBytes_FromString(buf); PyMem_Free(buf); /* allocated with PyMem_Malloc */ return res; @@ -181,7 +181,7 @@ if (buf == NULL) return PyErr_NoMemory(); /* ...Do some I/O operation involving buf... */ - res = PyString_FromString(buf); + res = PyBytes_FromString(buf); PyMem_Del(buf); /* allocated with PyMem_New */ return res; diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -288,13 +288,13 @@ self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyString_FromString(""); + self->first = PyUnicode_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyString_FromString(""); + self->last = PyUnicode_FromString(""); if (self->last == NULL) { Py_DECREF(self); return NULL; @@ -540,9 +540,9 @@ return -1; } - if (! PyString_Check(value)) { + if (! PyUnicode_Check(value)) { PyErr_SetString(PyExc_TypeError, - "The first attribute value must be a string"); + "The first attribute value must be a str"); return -1; } @@ -1005,8 +1005,8 @@ static PyObject * newdatatype_repr(newdatatypeobject * obj) { - return PyString_FromFormat("Repr-ified_newdatatype{{size:\%d}}", - obj->obj_UnderlyingDatatypePtr->size); + return PyUnicode_FromFormat("Repr-ified_newdatatype{{size:\%d}}", + obj->obj_UnderlyingDatatypePtr->size); } If no :attr:`tp_repr` handler is specified, the interpreter will supply a @@ -1025,8 +1025,8 @@ static PyObject * newdatatype_str(newdatatypeobject * obj) { - return PyString_FromFormat("Stringified_newdatatype{{size:\%d}}", - obj->obj_UnderlyingDatatypePtr->size); + return PyUnicode_FromFormat("Stringified_newdatatype{{size:\%d}}", + obj->obj_UnderlyingDatatypePtr->size); } @@ -1342,11 +1342,10 @@ if (!PyArg_ParseTuple(args, "sss:call", &arg1, &arg2, &arg3)) { return NULL; } - result = PyString_FromFormat( + result = PyUnicode_FromFormat( "Returning -- value: [\%d] arg1: [\%s] arg2: [\%s] arg3: [\%s]\n", obj->obj_UnderlyingDatatypePtr->size, arg1, arg2, arg3); - printf("\%s", PyString_AS_STRING(result)); return result; } diff --git a/Doc/faq/extending.rst b/Doc/faq/extending.rst --- a/Doc/faq/extending.rst +++ b/Doc/faq/extending.rst @@ -82,18 +82,20 @@ index. Lists have similar functions, :c:func:`PyListSize` and :c:func:`PyList_GetItem`. -For strings, :c:func:`PyString_Size` returns its length and -:c:func:`PyString_AsString` a pointer to its value. Note that Python strings may -contain null bytes so C's :c:func:`strlen` should not be used. +For bytes, :c:func:`PyBytes_Size` returns its length and +:c:func:`PyBytes_AsStringAndSize` provides a pointer to its value and its +length. Note that Python bytes objects may contain null bytes so C's +:c:func:`strlen` should not be used. To test the type of an object, first make sure it isn't *NULL*, and then use -:c:func:`PyString_Check`, :c:func:`PyTuple_Check`, :c:func:`PyList_Check`, etc. +:c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:`PyList_Check`, etc. There is also a high-level API to Python objects which is provided by the so-called 'abstract' interface -- read ``Include/abstract.h`` for further details. It allows interfacing with any kind of Python sequence using calls -like :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem`, etc.) as well as -many other useful protocols. +like :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem`, etc.) as well +as many other useful protocols such as numbers (:c:func:`PyNumber_Index` et. +al.) and mappings in the PyMapping APIs. How do I use Py_BuildValue() to create a tuple of arbitrary length? -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 22 22:02:11 2013 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 22 Mar 2013 22:02:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3NDI1?= =?utf-8?q?=3A_Build_against_openssl_0=2E9=2E8y_on_Windows=2E?= Message-ID: <3ZXckW4bYSz7Lk3@mail.python.org> http://hg.python.org/cpython/rev/3d76dbbbb0cc changeset: 82888:3d76dbbbb0cc branch: 2.7 parent: 82881:8ae1c28445f8 user: Martin v. Loewis date: Fri Mar 22 22:01:56 2013 +0100 summary: Issue #17425: Build against openssl 0.9.8y on Windows. files: Misc/NEWS | 2 ++ PC/VS8.0/pyproject.vsprops | 2 +- PCbuild/pyproject.vsprops | 2 +- PCbuild/readme.txt | 2 +- Tools/buildbot/external-common.bat | 4 ++-- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -908,6 +908,8 @@ Build ----- +- Issue #17425: Build against openssl 0.9.8y on Windows. + - Issue #16004: Add `make touch`. - Issue #5033: Fix building of the sqlite3 extension module when the diff --git a/PC/VS8.0/pyproject.vsprops b/PC/VS8.0/pyproject.vsprops --- a/PC/VS8.0/pyproject.vsprops +++ b/PC/VS8.0/pyproject.vsprops @@ -82,7 +82,7 @@ /> results for 81083f8841fe on branch "default" -------------------------------------------- test_imaplib leaked [3, 0, 3] references, sum=6 test_imaplib leaked [3, -2, 5] memory blocks, sum=6 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogzVCF3I', '-x'] From python-checkins at python.org Sat Mar 23 11:48:37 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Sat, 23 Mar 2013 11:48:37 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317522=3A_Add_the_?= =?utf-8?q?PyGILState=5FCheck=28=29_API=2E?= Message-ID: <3ZXz456wXjz7LlP@mail.python.org> http://hg.python.org/cpython/rev/2e92d1567ad7 changeset: 82889:2e92d1567ad7 parent: 82887:81083f8841fe user: Kristj?n Valur J?nsson date: Sat Mar 23 03:36:16 2013 -0700 summary: Issue #17522: Add the PyGILState_Check() API. files: Doc/c-api/init.rst | 12 ++++++++++++ Include/pystate.h | 5 +++++ Misc/NEWS | 2 ++ Python/pystate.c | 9 +++++++++ 4 files changed, 28 insertions(+), 0 deletions(-) diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -654,6 +654,18 @@ made on the main thread. This is mainly a helper/diagnostic function. +.. c:function:: int PyGILState_Check() + + Return 1 if the current thread is holding the GIL and 0 otherwise. + This function can be called from any thread at any time. + Only if it has had its Python thread state initialized and currently is + holding the GIL will it return 1. + This is mainly a helper/diagnostic function. It can be useful + for example in callback contexts or memory allocation functions when + knowing that the GIL is locked can allow the caller to perform sensitive + actions or otherwise behave differently. + + The following macros are normally used without a trailing semicolon; look for example usage in the Python source distribution. diff --git a/Include/pystate.h b/Include/pystate.h --- a/Include/pystate.h +++ b/Include/pystate.h @@ -212,6 +212,11 @@ */ PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void); +/* Helper/diagnostic function - return 1 if the current thread + * currently holds the GIL, 0 otherwise + */ +PyAPI_FUNC(int) PyGILState_Check(void); + #endif /* #ifdef WITH_THREAD */ /* The implementation of sys._current_frames() Returns a dict mapping diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #17522: Add the PyGILState_Check() API. + - Issue #16475: Support object instancing, recursion and interned strings in marshal diff --git a/Python/pystate.c b/Python/pystate.c --- a/Python/pystate.c +++ b/Python/pystate.c @@ -697,6 +697,15 @@ return (PyThreadState *)PyThread_get_key_value(autoTLSkey); } +int +PyGILState_Check(void) +{ + /* can't use PyThreadState_Get() since it will assert that it has the GIL */ + PyThreadState *tstate = (PyThreadState*)_Py_atomic_load_relaxed( + &_PyThreadState_Current); + return tstate && (tstate == PyGILState_GetThisThreadState()); +} + PyGILState_STATE PyGILState_Ensure(void) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 11:56:49 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Sat, 23 Mar 2013 11:56:49 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317522=3A_Minor_do?= =?utf-8?q?cumentation_fix?= Message-ID: <3ZXzFY6CrKz7LlP@mail.python.org> http://hg.python.org/cpython/rev/772d57aac162 changeset: 82890:772d57aac162 user: Kristj?n Valur J?nsson date: Sat Mar 23 03:56:16 2013 -0700 summary: Issue #17522: Minor documentation fix files: Doc/c-api/init.rst | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -665,6 +665,8 @@ knowing that the GIL is locked can allow the caller to perform sensitive actions or otherwise behave differently. + .. versionadded:: 3.4 + The following macros are normally used without a trailing semicolon; look for example usage in the Python source distribution. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 12:01:52 2013 From: python-checkins at python.org (vinay.sajip) Date: Sat, 23 Mar 2013 12:01:52 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Updated_Misc/N?= =?utf-8?q?EWS_with_=2317508=2E?= Message-ID: <3ZXzMN6Pxwz7Lm3@mail.python.org> http://hg.python.org/cpython/rev/5f6747a0ffc4 changeset: 82891:5f6747a0ffc4 branch: 2.7 parent: 82888:3d76dbbbb0cc user: Vinay Sajip date: Sat Mar 23 10:56:39 2013 +0000 summary: Updated Misc/NEWS with #17508. files: Misc/NEWS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -216,6 +216,9 @@ Library ------- +- Issue #17508: Corrected MemoryHandler configuration in dictConfig() where + the target handler wasn't configured first. + - Issue #10212: cStringIO and struct.unpack support new buffer objects. - Issue #12098: multiprocessing on Windows now starts child processes -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 12:01:54 2013 From: python-checkins at python.org (vinay.sajip) Date: Sat, 23 Mar 2013 12:01:54 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_Updated_Misc/N?= =?utf-8?q?EWS_with_=2317508=2E?= Message-ID: <3ZXzMQ1zj1z7Lm0@mail.python.org> http://hg.python.org/cpython/rev/5f7185cae787 changeset: 82892:5f7185cae787 branch: 3.2 parent: 82885:0bde86c89294 user: Vinay Sajip date: Sat Mar 23 10:57:47 2013 +0000 summary: Updated Misc/NEWS with #17508. files: Misc/NEWS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,6 +233,9 @@ Library ------- +- Issue #17508: Corrected MemoryHandler configuration in dictConfig() where + the target handler wasn't configured first. + - Issue #5713: smtplib now handles 421 (closing connection) error codes when sending mail by closing the socket and reporting the 421 error code via the exception appropriate to the command that received the error response. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 12:01:55 2013 From: python-checkins at python.org (vinay.sajip) Date: Sat, 23 Mar 2013 12:01:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merged_Misc/NEWS_update_for_=2317508=2E?= Message-ID: <3ZXzMR4bv1z7LmC@mail.python.org> http://hg.python.org/cpython/rev/bef32463ecd2 changeset: 82893:bef32463ecd2 branch: 3.3 parent: 82886:6bdf64a5f4d7 parent: 82892:5f7185cae787 user: Vinay Sajip date: Sat Mar 23 10:59:49 2013 +0000 summary: Merged Misc/NEWS update for #17508. files: Misc/NEWS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -196,6 +196,9 @@ Library ------- +- Issue #17508: Corrected MemoryHandler configuration in dictConfig() where + the target handler wasn't configured first. + - Issue #17209: curses.window.get_wch() now handles correctly KeyboardInterrupt (CTRL+c). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 12:01:57 2013 From: python-checkins at python.org (vinay.sajip) Date: Sat, 23 Mar 2013 12:01:57 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merged_Misc/NEWS_update_for_=2317508=2E?= Message-ID: <3ZXzMT0HzCz7LmR@mail.python.org> http://hg.python.org/cpython/rev/6dc72bd91de1 changeset: 82894:6dc72bd91de1 parent: 82889:2e92d1567ad7 parent: 82893:bef32463ecd2 user: Vinay Sajip date: Sat Mar 23 11:00:28 2013 +0000 summary: Merged Misc/NEWS update for #17508. files: Misc/NEWS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -294,6 +294,9 @@ Library ------- +- Issue #17508: Corrected MemoryHandler configuration in dictConfig() where + the target handler wasn't configured first. + - Issue #17209: curses.window.get_wch() now handles correctly KeyboardInterrupt (CTRL+c). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 12:01:58 2013 From: python-checkins at python.org (vinay.sajip) Date: Sat, 23 Mar 2013 12:01:58 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_Merged_upstream_changes=2E?= Message-ID: <3ZXzMV2w7sz7LmR@mail.python.org> http://hg.python.org/cpython/rev/dd59d1d2a826 changeset: 82895:dd59d1d2a826 parent: 82894:6dc72bd91de1 parent: 82890:772d57aac162 user: Vinay Sajip date: Sat Mar 23 11:01:36 2013 +0000 summary: Merged upstream changes. files: Doc/c-api/init.rst | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -665,6 +665,8 @@ knowing that the GIL is locked can allow the caller to perform sensitive actions or otherwise behave differently. + .. versionadded:: 3.4 + The following macros are normally used without a trailing semicolon; look for example usage in the Python source distribution. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 12:23:28 2013 From: python-checkins at python.org (vinay.sajip) Date: Sat, 23 Mar 2013 12:23:28 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3NTIx?= =?utf-8?q?=3A_Corrected_non-enabling_of_logger_following_two_calls_to?= Message-ID: <3ZXzrJ292Zz7Lkk@mail.python.org> http://hg.python.org/cpython/rev/533b4a1d2b23 changeset: 82896:533b4a1d2b23 branch: 2.7 parent: 82891:5f6747a0ffc4 user: Vinay Sajip date: Sat Mar 23 11:18:10 2013 +0000 summary: Issue #17521: Corrected non-enabling of logger following two calls to fileConfig(). files: Lib/logging/config.py | 4 +- Lib/test/test_logging.py | 34 ++++++++++++++++++++++++++- Misc/NEWS | 3 ++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/Lib/logging/config.py b/Lib/logging/config.py --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -260,8 +260,8 @@ logger.level = logging.NOTSET logger.handlers = [] logger.propagate = 1 - elif disable_existing_loggers: - logger.disabled = 1 + else: + logger.disabled = disable_existing_loggers diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -714,9 +714,30 @@ datefmt= """ - def apply_config(self, conf): + disable_test = """ + [loggers] + keys=root + + [handlers] + keys=screen + + [formatters] + keys= + + [logger_root] + level=DEBUG + handlers=screen + + [handler_screen] + level=DEBUG + class=StreamHandler + args=(sys.stdout,) + formatter= + """ + + def apply_config(self, conf, **kwargs): file = cStringIO.StringIO(textwrap.dedent(conf)) - logging.config.fileConfig(file) + logging.config.fileConfig(file, **kwargs) def test_config0_ok(self): # A simple config file which overrides the default settings. @@ -820,6 +841,15 @@ # Original logger output is empty. self.assert_log_lines([]) + def test_logger_disabling(self): + self.apply_config(self.disable_test) + logger = logging.getLogger('foo') + self.assertFalse(logger.disabled) + self.apply_config(self.disable_test) + self.assertTrue(logger.disabled) + self.apply_config(self.disable_test, disable_existing_loggers=False) + self.assertFalse(logger.disabled) + class LogRecordStreamHandler(StreamRequestHandler): """Handler for a streaming logging request. It saves the log message in the diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -216,6 +216,9 @@ Library ------- +- Issue #17521: Corrected non-enabling of logger following two calls to + fileConfig(). + - Issue #17508: Corrected MemoryHandler configuration in dictConfig() where the target handler wasn't configured first. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 12:23:29 2013 From: python-checkins at python.org (vinay.sajip) Date: Sat, 23 Mar 2013 12:23:29 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3NTIx?= =?utf-8?q?=3A_Corrected_non-enabling_of_logger_following_two_calls_to?= Message-ID: <3ZXzrK4sshz7Llp@mail.python.org> http://hg.python.org/cpython/rev/49d54e4d95df changeset: 82897:49d54e4d95df branch: 3.2 parent: 82892:5f7185cae787 user: Vinay Sajip date: Sat Mar 23 11:18:45 2013 +0000 summary: Issue #17521: Corrected non-enabling of logger following two calls to fileConfig(). files: Lib/logging/config.py | 4 +- Lib/test/test_logging.py | 34 ++++++++++++++++++++++++++- Misc/NEWS | 3 ++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/Lib/logging/config.py b/Lib/logging/config.py --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -175,8 +175,8 @@ logger.level = logging.NOTSET logger.handlers = [] logger.propagate = True - elif disable_existing: - logger.disabled = True + else: + logger.disabled = disable_existing def _install_loggers(cp, handlers, disable_existing): """Create and install loggers""" diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -764,9 +764,30 @@ datefmt= """ - def apply_config(self, conf): + disable_test = """ + [loggers] + keys=root + + [handlers] + keys=screen + + [formatters] + keys= + + [logger_root] + level=DEBUG + handlers=screen + + [handler_screen] + level=DEBUG + class=StreamHandler + args=(sys.stdout,) + formatter= + """ + + def apply_config(self, conf, **kwargs): file = io.StringIO(textwrap.dedent(conf)) - logging.config.fileConfig(file) + logging.config.fileConfig(file, **kwargs) def test_config0_ok(self): # A simple config file which overrides the default settings. @@ -870,6 +891,15 @@ # Original logger output is empty. self.assert_log_lines([]) + def test_logger_disabling(self): + self.apply_config(self.disable_test) + logger = logging.getLogger('foo') + self.assertFalse(logger.disabled) + self.apply_config(self.disable_test) + self.assertTrue(logger.disabled) + self.apply_config(self.disable_test, disable_existing_loggers=False) + self.assertFalse(logger.disabled) + class LogRecordStreamHandler(StreamRequestHandler): """Handler for a streaming logging request. It saves the log message in the diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,6 +233,9 @@ Library ------- +- Issue #17521: Corrected non-enabling of logger following two calls to + fileConfig(). + - Issue #17508: Corrected MemoryHandler configuration in dictConfig() where the target handler wasn't configured first. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 12:23:31 2013 From: python-checkins at python.org (vinay.sajip) Date: Sat, 23 Mar 2013 12:23:31 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Issue_=2317521=3A_Merged_fix_from_3=2E2=2E?= Message-ID: <3ZXzrM0T8Pz7Llv@mail.python.org> http://hg.python.org/cpython/rev/1f6cda549b85 changeset: 82898:1f6cda549b85 branch: 3.3 parent: 82893:bef32463ecd2 parent: 82897:49d54e4d95df user: Vinay Sajip date: Sat Mar 23 11:22:00 2013 +0000 summary: Issue #17521: Merged fix from 3.2. files: Lib/logging/config.py | 4 +- Lib/test/test_logging.py | 34 ++++++++++++++++++++++++++- Misc/NEWS | 3 ++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/Lib/logging/config.py b/Lib/logging/config.py --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -172,8 +172,8 @@ logger.level = logging.NOTSET logger.handlers = [] logger.propagate = True - elif disable_existing: - logger.disabled = True + else: + logger.disabled = disable_existing def _install_loggers(cp, handlers, disable_existing): """Create and install loggers""" diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -1257,9 +1257,30 @@ datefmt= """ - def apply_config(self, conf): + disable_test = """ + [loggers] + keys=root + + [handlers] + keys=screen + + [formatters] + keys= + + [logger_root] + level=DEBUG + handlers=screen + + [handler_screen] + level=DEBUG + class=StreamHandler + args=(sys.stdout,) + formatter= + """ + + def apply_config(self, conf, **kwargs): file = io.StringIO(textwrap.dedent(conf)) - logging.config.fileConfig(file) + logging.config.fileConfig(file, **kwargs) def test_config0_ok(self): # A simple config file which overrides the default settings. @@ -1363,6 +1384,15 @@ # Original logger output is empty. self.assert_log_lines([]) + def test_logger_disabling(self): + self.apply_config(self.disable_test) + logger = logging.getLogger('foo') + self.assertFalse(logger.disabled) + self.apply_config(self.disable_test) + self.assertTrue(logger.disabled) + self.apply_config(self.disable_test, disable_existing_loggers=False) + self.assertFalse(logger.disabled) + @unittest.skipUnless(threading, 'Threading required for this test.') class SocketHandlerTest(BaseTest): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -196,6 +196,9 @@ Library ------- +- Issue #17521: Corrected non-enabling of logger following two calls to + fileConfig(). + - Issue #17508: Corrected MemoryHandler configuration in dictConfig() where the target handler wasn't configured first. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 12:23:32 2013 From: python-checkins at python.org (vinay.sajip) Date: Sat, 23 Mar 2013 12:23:32 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Closes_=2317521=3A_Merged_fix_from_3=2E3=2E?= Message-ID: <3ZXzrN3LKdz7Lm0@mail.python.org> http://hg.python.org/cpython/rev/aa01eb949636 changeset: 82899:aa01eb949636 parent: 82895:dd59d1d2a826 parent: 82898:1f6cda549b85 user: Vinay Sajip date: Sat Mar 23 11:23:05 2013 +0000 summary: Closes #17521: Merged fix from 3.3. files: Lib/logging/config.py | 4 +- Lib/test/test_logging.py | 34 ++++++++++++++++++++++++++- Misc/NEWS | 3 ++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/Lib/logging/config.py b/Lib/logging/config.py --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -175,8 +175,8 @@ logger.level = logging.NOTSET logger.handlers = [] logger.propagate = True - elif disable_existing: - logger.disabled = True + else: + logger.disabled = disable_existing def _install_loggers(cp, handlers, disable_existing): """Create and install loggers""" diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -1261,9 +1261,30 @@ datefmt= """ - def apply_config(self, conf): + disable_test = """ + [loggers] + keys=root + + [handlers] + keys=screen + + [formatters] + keys= + + [logger_root] + level=DEBUG + handlers=screen + + [handler_screen] + level=DEBUG + class=StreamHandler + args=(sys.stdout,) + formatter= + """ + + def apply_config(self, conf, **kwargs): file = io.StringIO(textwrap.dedent(conf)) - logging.config.fileConfig(file) + logging.config.fileConfig(file, **kwargs) def test_config0_ok(self): # A simple config file which overrides the default settings. @@ -1385,6 +1406,15 @@ # Original logger output is empty. self.assert_log_lines([]) + def test_logger_disabling(self): + self.apply_config(self.disable_test) + logger = logging.getLogger('foo') + self.assertFalse(logger.disabled) + self.apply_config(self.disable_test) + self.assertTrue(logger.disabled) + self.apply_config(self.disable_test, disable_existing_loggers=False) + self.assertFalse(logger.disabled) + @unittest.skipUnless(threading, 'Threading required for this test.') class SocketHandlerTest(BaseTest): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -294,6 +294,9 @@ Library ------- +- Issue #17521: Corrected non-enabling of logger following two calls to + fileConfig(). + - Issue #17508: Corrected MemoryHandler configuration in dictConfig() where the target handler wasn't configured first. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 13:28:06 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 23 Mar 2013 13:28:06 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Hold_key_refer?= =?utf-8?q?ence_until_the_links_have_updated=2E?= Message-ID: <3ZY1Gt6PZqz7LlZ@mail.python.org> http://hg.python.org/cpython/rev/008abf6ec987 changeset: 82900:008abf6ec987 branch: 2.7 parent: 82896:533b4a1d2b23 user: Raymond Hettinger date: Sat Mar 23 05:27:51 2013 -0700 summary: Hold key reference until the links have updated. files: Lib/collections.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/collections.py b/Lib/collections.py --- a/Lib/collections.py +++ b/Lib/collections.py @@ -66,7 +66,7 @@ # Deleting an existing item uses self.__map to find the link which gets # removed by updating the links in the predecessor and successor nodes. dict_delitem(self, key) - link_prev, link_next, key = self.__map.pop(key) + link_prev, link_next, _ = self.__map.pop(key) link_prev[1] = link_next # update link_prev[NEXT] link_next[0] = link_prev # update link_next[PREV] -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 14:36:04 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 23 Mar 2013 14:36:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Backport_impro?= =?utf-8?q?ved_dict_comparison_logic?= Message-ID: <3ZY2nJ0SSwz7LmZ@mail.python.org> http://hg.python.org/cpython/rev/459ce02c4823 changeset: 82901:459ce02c4823 branch: 3.3 parent: 82898:1f6cda549b85 user: Raymond Hettinger date: Sat Mar 23 06:34:19 2013 -0700 summary: Backport improved dict comparison logic files: Lib/collections/__init__.py | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -228,8 +228,7 @@ ''' if isinstance(other, OrderedDict): - return len(self)==len(other) and \ - all(map(_eq, self.items(), other.items())) + return dict.__eq__(self, other) and all(map(_eq, self, other)) return dict.__eq__(self, other) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 14:36:05 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 23 Mar 2013 14:36:05 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZY2nK2zs8z7LmM@mail.python.org> http://hg.python.org/cpython/rev/4682d18e8143 changeset: 82902:4682d18e8143 parent: 82899:aa01eb949636 parent: 82901:459ce02c4823 user: Raymond Hettinger date: Sat Mar 23 06:35:22 2013 -0700 summary: merge files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 15:37:16 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 23 Mar 2013 15:37:16 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzE3NDc5OiB0ZXN0?= =?utf-8?q?=5Fio_now_works_with_unittest_test_discovery=2E__Patch_by_Zacha?= =?utf-8?q?ry_Ware=2E?= Message-ID: <3ZY47w1nx7z7Ln0@mail.python.org> http://hg.python.org/cpython/rev/fa9e189e30ad changeset: 82903:fa9e189e30ad branch: 3.3 parent: 82901:459ce02c4823 user: Ezio Melotti date: Sat Mar 23 16:30:16 2013 +0200 summary: #17479: test_io now works with unittest test discovery. Patch by Zachary Ware. files: Lib/test/test_io.py | 7 ++++--- Misc/NEWS | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -3226,7 +3226,7 @@ test_reentrant_write_text = None -def test_main(): +def load_tests(*args): tests = (CIOTest, PyIOTest, CBufferedReaderTest, PyBufferedReaderTest, CBufferedWriterTest, PyBufferedWriterTest, @@ -3259,7 +3259,8 @@ for name, obj in py_io_ns.items(): setattr(test, name, obj) - support.run_unittest(*tests) + suite = unittest.TestSuite([unittest.makeSuite(test) for test in tests]) + return suite if __name__ == "__main__": - test_main() + unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -714,6 +714,9 @@ - Issue #15539: Added regression tests for Tools/scripts/pindent.py. +- Issue #17479: test_io now works with unittest test discovery. + Patch by Zachary Ware. + - Issue #17066: test_robotparser now works with unittest test discovery. Patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 15:37:17 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 23 Mar 2013 15:37:17 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3NDc5OiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZY47x4ZVbz7Lmv@mail.python.org> http://hg.python.org/cpython/rev/99a81681237d changeset: 82904:99a81681237d parent: 82902:4682d18e8143 parent: 82903:fa9e189e30ad user: Ezio Melotti date: Sat Mar 23 16:36:58 2013 +0200 summary: #17479: merge with 3.3. files: Lib/test/test_io.py | 7 ++++--- Misc/NEWS | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -3234,7 +3234,7 @@ test_reentrant_write_text = None -def test_main(): +def load_tests(*args): tests = (CIOTest, PyIOTest, CBufferedReaderTest, PyBufferedReaderTest, CBufferedWriterTest, PyBufferedWriterTest, @@ -3267,7 +3267,8 @@ for name, obj in py_io_ns.items(): setattr(test, name, obj) - support.run_unittest(*tests) + suite = unittest.TestSuite([unittest.makeSuite(test) for test in tests]) + return suite if __name__ == "__main__": - test_main() + unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1035,6 +1035,9 @@ - Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host. +- Issue #17479: test_io now works with unittest test discovery. + Patch by Zachary Ware. + - Issue #17066: test_robotparser now works with unittest test discovery. Patch by Zachary Ware. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 15:46:43 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 23 Mar 2013 15:46:43 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_=2317510=3A_avoid_using_de?= =?utf-8?q?precated_assertEquals_method_in_test=5Fprogram=2E__Patch_by?= Message-ID: <3ZY4Lq0JLCz7Lmh@mail.python.org> http://hg.python.org/cpython/rev/fd7f99e662b7 changeset: 82905:fd7f99e662b7 user: Ezio Melotti date: Sat Mar 23 16:46:23 2013 +0200 summary: #17510: avoid using deprecated assertEquals method in test_program. Patch by Daniel Black. files: Lib/unittest/test/test_program.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/unittest/test/test_program.py b/Lib/unittest/test/test_program.py --- a/Lib/unittest/test/test_program.py +++ b/Lib/unittest/test/test_program.py @@ -81,7 +81,7 @@ defaultTest='unittest.test', testLoader=self.FooBarLoader()) sys.argv = old_argv - self.assertEquals(('unittest.test',), program.testNames) + self.assertEqual(('unittest.test',), program.testNames) def test_defaultTest_with_iterable(self): class FakeRunner(object): @@ -97,7 +97,7 @@ defaultTest=['unittest.test', 'unittest.test2'], testLoader=self.FooBarLoader()) sys.argv = old_argv - self.assertEquals(['unittest.test', 'unittest.test2'], + self.assertEqual(['unittest.test', 'unittest.test2'], program.testNames) def test_NonExit(self): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 16:20:30 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 16:20:30 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_nonlocal_isn?= =?utf-8?q?=27t_a_2=2Ex_topic?= Message-ID: <3ZY55p6v4Pz7LkF@mail.python.org> http://hg.python.org/cpython/rev/f32c03c73c54 changeset: 82906:f32c03c73c54 branch: 2.7 parent: 82900:008abf6ec987 user: Benjamin Peterson date: Sat Mar 23 10:09:24 2013 -0500 summary: nonlocal isn't a 2.x topic files: Doc/tools/sphinxext/pyspecific.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/tools/sphinxext/pyspecific.py b/Doc/tools/sphinxext/pyspecific.py --- a/Doc/tools/sphinxext/pyspecific.py +++ b/Doc/tools/sphinxext/pyspecific.py @@ -186,7 +186,7 @@ 'del', 'dict', 'dynamic-features', 'else', 'exceptions', 'execmodel', 'exprlists', 'floating', 'for', 'formatstrings', 'function', 'global', 'id-classes', 'identifiers', 'if', 'imaginary', 'import', 'in', 'integers', - 'lambda', 'lists', 'naming', 'nonlocal', 'numbers', 'numeric-types', + 'lambda', 'lists', 'naming', 'numbers', 'numeric-types', 'objects', 'operator-summary', 'pass', 'power', 'raise', 'return', 'sequence-types', 'shifting', 'slicings', 'specialattrs', 'specialnames', 'string-methods', 'strings', 'subscriptions', 'truth', 'try', 'types', -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 16:20:35 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 16:20:35 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_update_pydoc_t?= =?utf-8?q?opics?= Message-ID: <3ZY55v16lxz7LmL@mail.python.org> http://hg.python.org/cpython/rev/02580215c6e2 changeset: 82907:02580215c6e2 branch: 2.7 user: Benjamin Peterson date: Sat Mar 23 10:15:25 2013 -0500 summary: update pydoc topics files: Lib/pydoc_data/topics.py | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,4 +1,4 @@ -# Autogenerated by Sphinx on Thu Feb 23 15:17:35 2012 +# Autogenerated by Sphinx on Sat Mar 23 10:09:08 2013 topics = {'assert': '\nThe ``assert`` statement\n************************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, ``assert expression``, is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, ``assert expression1, expression2``, is equivalent\nto\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that ``__debug__`` and ``AssertionError``\nrefer to the built-in variables with those names. In the current\nimplementation, the built-in variable ``__debug__`` is ``True`` under\nnormal circumstances, ``False`` when optimization is requested\n(command line option -O). The current code generator emits no code\nfor an assert statement when optimization is requested at compile\ntime. Note that it is unnecessary to include the source code for the\nexpression that failed in the error message; it will be displayed as\npart of the stack trace.\n\nAssignments to ``__debug__`` are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', 'assignment': '\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" target_list "]"\n | attributeref\n | subscription\n | slicing\n\n(See section *Primaries* for the syntax definitions for the last three\nsymbols.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section *The standard type\nhierarchy*).\n\nAssignment of an object to a target list is recursively defined as\nfollows.\n\n* If the target list is a single target: The object is assigned to\n that target.\n\n* If the target list is a comma-separated list of targets: The object\n must be an iterable with the same number of items as there are\n targets in the target list, and the items are assigned, from left to\n right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a ``global`` statement in the\n current code block: the name is bound to the object in the current\n local namespace.\n\n * Otherwise: the name is bound to the object in the current global\n namespace.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is a target list enclosed in parentheses or in square\n brackets: The object must be an iterable with the same number of\n items as there are targets in the target list, and its items are\n assigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, ``TypeError`` is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily ``AttributeError``).\n\n Note: If the object is a class instance and the attribute reference\n occurs on both sides of the assignment operator, the RHS expression,\n ``a.x`` can access either an instance attribute or (if no instance\n attribute exists) a class attribute. The LHS target ``a.x`` is\n always set as an instance attribute, creating it if necessary.\n Thus, the two occurrences of ``a.x`` do not necessarily refer to the\n same attribute: if the RHS expression refers to a class attribute,\n the LHS creates a new instance attribute as the target of the\n assignment:\n\n class Cls:\n x = 3 # class variable\n inst = Cls()\n inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3\n\n This description does not necessarily apply to descriptor\n attributes, such as properties created with ``property()``.\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield a plain integer. If it is negative, the\n sequence\'s length is added to it. The resulting value must be a\n nonnegative integer less than the sequence\'s length, and the\n sequence is asked to assign the assigned object to its item with\n that index. If the index is out of range, ``IndexError`` is raised\n (assignment to a subscripted sequence cannot add new items to a\n list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n* If the target is a slicing: The primary expression in the reference\n is evaluated. It should yield a mutable sequence object (such as a\n list). The assigned object should be a sequence object of the same\n type. Next, the lower and upper bound expressions are evaluated,\n insofar they are present; defaults are zero and the sequence\'s\n length. The bounds should evaluate to (small) integers. If either\n bound is negative, the sequence\'s length is added to it. The\n resulting bounds are clipped to lie between zero and the sequence\'s\n length, inclusive. Finally, the sequence object is asked to replace\n the slice with the items of the assigned sequence. The length of\n the slice may be different from the length of the assigned sequence,\n thus changing the length of the target sequence, if the object\n allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nWARNING: Although the definition of assignment implies that overlaps\nbetween the left-hand side and the right-hand side are \'safe\' (for\nexample ``a, b = b, a`` swaps two variables), overlaps *within* the\ncollection of assigned-to variables are not safe! For instance, the\nfollowing program prints ``[0, 2]``:\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2\n print x\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like ``x += 1`` can be rewritten as\n``x = x + 1`` to achieve a similar, but not exactly equal effect. In\nthe augmented version, ``x`` is only evaluated once. Also, when\npossible, the actual operation is performed *in-place*, meaning that\nrather than creating a new object and assigning that to the target,\nthe old object is modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same *caveat about\nclass and instance attributes* applies as for regular assignments.\n', 'atom-identifiers': '\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section\n*Identifiers and keywords* for lexical definition and section *Naming\nand binding* for documentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a ``NameError`` exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name in front of the name, with leading underscores removed, and\na single underscore inserted in front of the class name. For example,\nthe identifier ``__spam`` occurring in a class named ``Ham`` will be\ntransformed to ``_Ham__spam``. This transformation is independent of\nthe syntactical context in which the identifier is used. If the\ntransformed name is extremely long (longer than 255 characters),\nimplementation defined truncation may happen. If the class name\nconsists only of underscores, no transformation is done.\n', @@ -15,10 +15,10 @@ 'booleans': '\nBoolean operations\n******************\n\n or_test ::= and_test | or_test "or" and_test\n and_test ::= not_test | and_test "and" not_test\n not_test ::= comparison | "not" not_test\n\nIn the context of Boolean operations, and also when expressions are\nused by control flow statements, the following values are interpreted\nas false: ``False``, ``None``, numeric zero of all types, and empty\nstrings and containers (including strings, tuples, lists,\ndictionaries, sets and frozensets). All other values are interpreted\nas true. (See the ``__nonzero__()`` special method for a way to\nchange this.)\n\nThe operator ``not`` yields ``True`` if its argument is false,\n``False`` otherwise.\n\nThe expression ``x and y`` first evaluates *x*; if *x* is false, its\nvalue is returned; otherwise, *y* is evaluated and the resulting value\nis returned.\n\nThe expression ``x or y`` first evaluates *x*; if *x* is true, its\nvalue is returned; otherwise, *y* is evaluated and the resulting value\nis returned.\n\n(Note that neither ``and`` nor ``or`` restrict the value and type they\nreturn to ``False`` and ``True``, but rather return the last evaluated\nargument. This is sometimes useful, e.g., if ``s`` is a string that\nshould be replaced by a default value if it is empty, the expression\n``s or \'foo\'`` yields the desired value. Because ``not`` has to\ninvent a value anyway, it does not bother to return a value of the\nsame type as its argument, so e.g., ``not \'foo\'`` yields ``False``,\nnot ``\'\'``.)\n', 'break': '\nThe ``break`` statement\n***********************\n\n break_stmt ::= "break"\n\n``break`` may only occur syntactically nested in a ``for`` or\n``while`` loop, but not nested in a function or class definition\nwithin that loop.\n\nIt terminates the nearest enclosing loop, skipping the optional\n``else`` clause if the loop has one.\n\nIf a ``for`` loop is terminated by ``break``, the loop control target\nkeeps its current value.\n\nWhen ``break`` passes control out of a ``try`` statement with a\n``finally`` clause, that ``finally`` clause is executed before really\nleaving the loop.\n', 'callable-types': '\nEmulating callable objects\n**************************\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, ``x(arg1, arg2, ...)`` is a shorthand for\n ``x.__call__(arg1, arg2, ...)``.\n', - 'calls': '\nCalls\n*****\n\nA call calls a callable object (e.g., a function) with a possibly\nempty series of arguments:\n\n call ::= primary "(" [argument_list [","]\n | expression genexpr_for] ")"\n argument_list ::= positional_arguments ["," keyword_arguments]\n ["," "*" expression] ["," keyword_arguments]\n ["," "**" expression]\n | keyword_arguments ["," "*" expression]\n ["," "**" expression]\n | "*" expression ["," "*" expression] ["," "**" expression]\n | "**" expression\n positional_arguments ::= expression ("," expression)*\n keyword_arguments ::= keyword_item ("," keyword_item)*\n keyword_item ::= identifier "=" expression\n\nA trailing comma may be present after the positional and keyword\narguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and certain class instances\nthemselves are callable; extensions may define additional callable\nobject types). All argument expressions are evaluated before the call\nis attempted. Please refer to section *Function definitions* for the\nsyntax of formal parameter lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows. First, a list of unfilled slots is\ncreated for the formal parameters. If there are N positional\narguments, they are placed in the first N slots. Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on). If the slot is\nalready filled, a ``TypeError`` exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is ``None``, it fills the slot). When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition. (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.) If there are any\nunfilled slots for which no default value is specified, a\n``TypeError`` exception is raised. Otherwise, the list of filled\nslots is used as the argument list for the call.\n\n**CPython implementation detail:** An implementation may provide\nbuilt-in functions whose positional parameters do not have names, even\nif they are \'named\' for the purpose of documentation, and which\ntherefore cannot be supplied by keyword. In CPython, this is the case\nfor functions implemented in C that use ``PyArg_ParseTuple()`` to\nparse their arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a ``TypeError`` exception is raised, unless a formal parameter\nusing the syntax ``*identifier`` is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a ``TypeError`` exception is raised, unless a formal parameter\nusing the syntax ``**identifier`` is present; in this case, that\nformal parameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax ``*expression`` appears in the function call,\n``expression`` must evaluate to an iterable. Elements from this\niterable are treated as if they were additional positional arguments;\nif there are positional arguments *x1*, ..., *xN*, and ``expression``\nevaluates to a sequence *y1*, ..., *yM*, this is equivalent to a call\nwith M+N positional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n\nA consequence of this is that although the ``*expression`` syntax may\nappear *after* some keyword arguments, it is processed *before* the\nkeyword arguments (and the ``**expression`` argument, if any -- see\nbelow). So:\n\n >>> def f(a, b):\n ... print a, b\n ...\n >>> f(b=1, *(2,))\n 2 1\n >>> f(a=1, *(2,))\n Traceback (most recent call last):\n File "", line 1, in ?\n TypeError: f() got multiple values for keyword argument \'a\'\n >>> f(1, *(2,))\n 1 2\n\nIt is unusual for both keyword arguments and the ``*expression``\nsyntax to be used in the same call, so in practice this confusion does\nnot arise.\n\nIf the syntax ``**expression`` appears in the function call,\n``expression`` must evaluate to a mapping, the contents of which are\ntreated as additional keyword arguments. In the case of a keyword\nappearing in both ``expression`` and as an explicit keyword argument,\na ``TypeError`` exception is raised.\n\nFormal parameters using the syntax ``*identifier`` or ``**identifier``\ncannot be used as positional argument slots or as keyword argument\nnames. Formal parameters using the syntax ``(sublist)`` cannot be\nused as keyword argument names; the outermost sublist corresponds to a\nsingle unnamed argument slot, and the argument value is assigned to\nthe sublist using the usual tuple assignment rules after all other\nparameter processing is done.\n\nA call always returns some value, possibly ``None``, unless it raises\nan exception. How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\n The code block for the function is executed, passing it the\n argument list. The first thing the code block will do is bind the\n formal parameters to the arguments; this is described in section\n *Function definitions*. When the code block executes a ``return``\n statement, this specifies the return value of the function call.\n\na built-in function or method:\n The result is up to the interpreter; see *Built-in Functions* for\n the descriptions of built-in functions and methods.\n\na class object:\n A new instance of that class is returned.\n\na class instance method:\n The corresponding user-defined function is called, with an argument\n list that is one longer than the argument list of the call: the\n instance becomes the first argument.\n\na class instance:\n The class must define a ``__call__()`` method; the effect is then\n the same as if that method was called.\n', + 'calls': '\nCalls\n*****\n\nA call calls a callable object (e.g., a *function*) with a possibly\nempty series of *arguments*:\n\n call ::= primary "(" [argument_list [","]\n | expression genexpr_for] ")"\n argument_list ::= positional_arguments ["," keyword_arguments]\n ["," "*" expression] ["," keyword_arguments]\n ["," "**" expression]\n | keyword_arguments ["," "*" expression]\n ["," "**" expression]\n | "*" expression ["," "*" expression] ["," "**" expression]\n | "**" expression\n positional_arguments ::= expression ("," expression)*\n keyword_arguments ::= keyword_item ("," keyword_item)*\n keyword_item ::= identifier "=" expression\n\nA trailing comma may be present after the positional and keyword\narguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and certain class instances\nthemselves are callable; extensions may define additional callable\nobject types). All argument expressions are evaluated before the call\nis attempted. Please refer to section *Function definitions* for the\nsyntax of formal *parameter* lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows. First, a list of unfilled slots is\ncreated for the formal parameters. If there are N positional\narguments, they are placed in the first N slots. Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on). If the slot is\nalready filled, a ``TypeError`` exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is ``None``, it fills the slot). When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition. (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.) If there are any\nunfilled slots for which no default value is specified, a\n``TypeError`` exception is raised. Otherwise, the list of filled\nslots is used as the argument list for the call.\n\n**CPython implementation detail:** An implementation may provide\nbuilt-in functions whose positional parameters do not have names, even\nif they are \'named\' for the purpose of documentation, and which\ntherefore cannot be supplied by keyword. In CPython, this is the case\nfor functions implemented in C that use ``PyArg_ParseTuple()`` to\nparse their arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a ``TypeError`` exception is raised, unless a formal parameter\nusing the syntax ``*identifier`` is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a ``TypeError`` exception is raised, unless a formal parameter\nusing the syntax ``**identifier`` is present; in this case, that\nformal parameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax ``*expression`` appears in the function call,\n``expression`` must evaluate to an iterable. Elements from this\niterable are treated as if they were additional positional arguments;\nif there are positional arguments *x1*, ..., *xN*, and ``expression``\nevaluates to a sequence *y1*, ..., *yM*, this is equivalent to a call\nwith M+N positional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n\nA consequence of this is that although the ``*expression`` syntax may\nappear *after* some keyword arguments, it is processed *before* the\nkeyword arguments (and the ``**expression`` argument, if any -- see\nbelow). So:\n\n >>> def f(a, b):\n ... print a, b\n ...\n >>> f(b=1, *(2,))\n 2 1\n >>> f(a=1, *(2,))\n Traceback (most recent call last):\n File "", line 1, in ?\n TypeError: f() got multiple values for keyword argument \'a\'\n >>> f(1, *(2,))\n 1 2\n\nIt is unusual for both keyword arguments and the ``*expression``\nsyntax to be used in the same call, so in practice this confusion does\nnot arise.\n\nIf the syntax ``**expression`` appears in the function call,\n``expression`` must evaluate to a mapping, the contents of which are\ntreated as additional keyword arguments. In the case of a keyword\nappearing in both ``expression`` and as an explicit keyword argument,\na ``TypeError`` exception is raised.\n\nFormal parameters using the syntax ``*identifier`` or ``**identifier``\ncannot be used as positional argument slots or as keyword argument\nnames. Formal parameters using the syntax ``(sublist)`` cannot be\nused as keyword argument names; the outermost sublist corresponds to a\nsingle unnamed argument slot, and the argument value is assigned to\nthe sublist using the usual tuple assignment rules after all other\nparameter processing is done.\n\nA call always returns some value, possibly ``None``, unless it raises\nan exception. How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\n The code block for the function is executed, passing it the\n argument list. The first thing the code block will do is bind the\n formal parameters to the arguments; this is described in section\n *Function definitions*. When the code block executes a ``return``\n statement, this specifies the return value of the function call.\n\na built-in function or method:\n The result is up to the interpreter; see *Built-in Functions* for\n the descriptions of built-in functions and methods.\n\na class object:\n A new instance of that class is returned.\n\na class instance method:\n The corresponding user-defined function is called, with an argument\n list that is one longer than the argument list of the call: the\n instance becomes the first argument.\n\na class instance:\n The class must define a ``__call__()`` method; the effect is then\n the same as if that method was called.\n', 'class': '\nClass definitions\n*****************\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= "class" classname [inheritance] ":" suite\n inheritance ::= "(" [expression_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section *Naming and binding*), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by all instances. To create instance\nvariables, they can be set in a method with ``self.name = value``.\nBoth class and instance variables are accessible through the notation\n"``self.name``", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. For *new-style class*es, descriptors can\nbe used to create instance variables with different implementation\ndetails.\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless there\n is a ``finally`` clause which happens to raise another exception.\n That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n\n[3] A string literal appearing as the first statement in the function\n body is transformed into the function\'s ``__doc__`` attribute and\n therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s ``__doc__`` item and\n therefore the class\'s *docstring*.\n', 'comparisons': '\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like ``a < b < c`` have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: ``True`` or ``False``.\n\nComparisons can be chained arbitrarily, e.g., ``x < y <= z`` is\nequivalent to ``x < y and y <= z``, except that ``y`` is evaluated\nonly once (but in both cases ``z`` is not evaluated at all when ``x <\ny`` is found to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y\nopN z`` is equivalent to ``a op1 b and b op2 c and ... y opN z``,\nexcept that each expression is evaluated at most once.\n\nNote that ``a op1 b op2 c`` doesn\'t imply any kind of comparison\nbetween *a* and *c*, so that, e.g., ``x < y > z`` is perfectly legal\n(though perhaps not pretty).\n\nThe forms ``<>`` and ``!=`` are equivalent; for consistency with C,\n``!=`` is preferred; where ``!=`` is mentioned below ``<>`` is also\naccepted. The ``<>`` spelling is considered obsolescent.\n\nThe operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare\nthe values of two objects. The objects need not have the same type.\nIf both are numbers, they are converted to a common type. Otherwise,\nobjects of different types *always* compare unequal, and are ordered\nconsistently but arbitrarily. You can control comparison behavior of\nobjects of non-built-in types by defining a ``__cmp__`` method or rich\ncomparison methods like ``__gt__``, described in section *Special\nmethod names*.\n\n(This unusual definition of comparison was used to simplify the\ndefinition of operations like sorting and the ``in`` and ``not in``\noperators. In the future, the comparison rules for objects of\ndifferent types are likely to change.)\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* Strings are compared lexicographically using the numeric equivalents\n (the result of the built-in function ``ord()``) of their characters.\n Unicode and 8-bit strings are fully interoperable in this behavior.\n [4]\n\n* Tuples and lists are compared lexicographically using comparison of\n corresponding elements. This means that to compare equal, each\n element must compare equal and the two sequences must be of the same\n type and have the same length.\n\n If not equal, the sequences are ordered the same as their first\n differing elements. For example, ``cmp([1,2,x], [1,2,y])`` returns\n the same as ``cmp(x,y)``. If the corresponding element does not\n exist, the shorter sequence is ordered first (for example, ``[1,2] <\n [1,2,3]``).\n\n* Mappings (dictionaries) compare equal if and only if their sorted\n (key, value) lists compare equal. [5] Outcomes other than equality\n are resolved consistently, but are not otherwise defined. [6]\n\n* Most other objects of built-in types compare unequal unless they are\n the same object; the choice whether one object is considered smaller\n or larger than another one is made arbitrarily but consistently\n within one execution of a program.\n\nThe operators ``in`` and ``not in`` test for collection membership.\n``x in s`` evaluates to true if *x* is a member of the collection *s*,\nand false otherwise. ``x not in s`` returns the negation of ``x in\ns``. The collection membership test has traditionally been bound to\nsequences; an object is a member of a collection if the collection is\na sequence and contains an element equal to that object. However, it\nmake sense for many other object types to support membership tests\nwithout being a sequence. In particular, dictionaries (for keys) and\nsets support membership testing.\n\nFor the list and tuple types, ``x in y`` is true if and only if there\nexists an index *i* such that ``x == y[i]`` is true.\n\nFor the Unicode and string types, ``x in y`` is true if and only if\n*x* is a substring of *y*. An equivalent test is ``y.find(x) != -1``.\nNote, *x* and *y* need not be the same type; consequently, ``u\'ab\' in\n\'abc\'`` will return ``True``. Empty strings are always considered to\nbe a substring of any other string, so ``"" in "abc"`` will return\n``True``.\n\nChanged in version 2.3: Previously, *x* was required to be a string of\nlength ``1``.\n\nFor user-defined classes which define the ``__contains__()`` method,\n``x in y`` is true if and only if ``y.__contains__(x)`` is true.\n\nFor user-defined classes which do not define ``__contains__()`` but do\ndefine ``__iter__()``, ``x in y`` is true if some value ``z`` with ``x\n== z`` is produced while iterating over ``y``. If an exception is\nraised during the iteration, it is as if ``in`` raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n``__getitem__()``, ``x in y`` is true if and only if there is a non-\nnegative integer index *i* such that ``x == y[i]``, and all lower\ninteger indices do not raise ``IndexError`` exception. (If any other\nexception is raised, it is as if ``in`` raised that exception).\n\nThe operator ``not in`` is defined to have the inverse true value of\n``in``.\n\nThe operators ``is`` and ``is not`` test for object identity: ``x is\ny`` is true if and only if *x* and *y* are the same object. ``x is\nnot y`` yields the inverse truth value. [7]\n', - 'compound': '\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe ``if``, ``while`` and ``for`` statements implement traditional\ncontrol flow constructs. ``try`` specifies exception handlers and/or\ncleanup code for a group of statements. Function and class\ndefinitions are also syntactically compound statements.\n\nCompound statements consist of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which ``if`` clause a following ``else`` clause would belong:\n\n if test1: if test2: print x\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n``print`` statements are executed:\n\n if x < y < z: print x; print y; print z\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n | decorated\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a ``NEWLINE`` possibly followed by\na ``DEDENT``. Also note that optional continuation clauses always\nbegin with a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling ``else``\' problem is solved in Python by\nrequiring nested ``if`` statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe ``if`` statement\n====================\n\nThe ``if`` statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the ``if`` statement is executed or evaluated).\nIf all expressions are false, the suite of the ``else`` clause, if\npresent, is executed.\n\n\nThe ``while`` statement\n=======================\n\nThe ``while`` statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the ``else`` clause, if present, is\nexecuted and the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ngoes back to testing the expression.\n\n\nThe ``for`` statement\n=====================\n\nThe ``for`` statement is used to iterate over the elements of a\nsequence (such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n``expression_list``. The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments, and then the suite is executed. When the items are\nexhausted (which is immediately when the sequence is empty), the suite\nin the ``else`` clause, if present, is executed, and the loop\nterminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ncontinues with the next item, or with the ``else`` clause if there was\nno next item.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nThe target list is not deleted when the loop is finished, but if the\nsequence is empty, it will not have been assigned to at all by the\nloop. Hint: the built-in function ``range()`` returns a sequence of\nintegers suitable to emulate the effect of Pascal\'s ``for i := a to b\ndo``; e.g., ``range(3)`` returns the list ``[0, 1, 2]``.\n\nNote: There is a subtlety when the sequence is being modified by the loop\n (this can only occur for mutable sequences, i.e. lists). An internal\n counter is used to keep track of which item is used next, and this\n is incremented on each iteration. When this counter has reached the\n length of the sequence the loop terminates. This means that if the\n suite deletes the current (or a previous) item from the sequence,\n the next item will be skipped (since it gets the index of the\n current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe ``try`` statement\n=====================\n\nThe ``try`` statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression [("as" | ",") target]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n``try``...``except``...``finally`` did not work. ``try``...``except``\nhad to be nested in ``try``...``finally``.\n\nThe ``except`` clause(s) specify one or more exception handlers. When\nno exception occurs in the ``try`` clause, no exception handler is\nexecuted. When an exception occurs in the ``try`` suite, a search for\nan exception handler is started. This search inspects the except\nclauses in turn until one is found that matches the exception. An\nexpression-less except clause, if present, must be last; it matches\nany exception. For an except clause with an expression, that\nexpression is evaluated, and the clause matches the exception if the\nresulting object is "compatible" with the exception. An object is\ncompatible with an exception if it is the class or a base class of the\nexception object, a tuple containing an item compatible with the\nexception, or, in the (deprecated) case of string exceptions, is the\nraised string itself (note that the object identities must match, i.e.\nit must be the same string object, not just a string with the same\nvalue).\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire ``try`` statement\nraised the exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed. All except clauses must have an\nexecutable block. When the end of this block is reached, execution\ncontinues normally after the entire try statement. (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the ``sys`` module:\n``sys.exc_type`` receives the object identifying the exception;\n``sys.exc_value`` receives the exception\'s parameter;\n``sys.exc_traceback`` receives a traceback object (see section *The\nstandard type hierarchy*) identifying the point in the program where\nthe exception occurred. These details are also available through the\n``sys.exc_info()`` function, which returns a tuple ``(exc_type,\nexc_value, exc_traceback)``. Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program. As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional ``else`` clause is executed if and when control flows off\nthe end of the ``try`` clause. [2] Exceptions in the ``else`` clause\nare not handled by the preceding ``except`` clauses.\n\nIf ``finally`` is present, it specifies a \'cleanup\' handler. The\n``try`` clause is executed, including any ``except`` and ``else``\nclauses. If an exception occurs in any of the clauses and is not\nhandled, the exception is temporarily saved. The ``finally`` clause is\nexecuted. If there is a saved exception, it is re-raised at the end\nof the ``finally`` clause. If the ``finally`` clause raises another\nexception or executes a ``return`` or ``break`` statement, the saved\nexception is lost. The exception information is not available to the\nprogram during execution of the ``finally`` clause.\n\nWhen a ``return``, ``break`` or ``continue`` statement is executed in\nthe ``try`` suite of a ``try``...``finally`` statement, the\n``finally`` clause is also executed \'on the way out.\' A ``continue``\nstatement is illegal in the ``finally`` clause. (The reason is a\nproblem with the current implementation --- this restriction may be\nlifted in the future).\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the ``raise`` statement to\ngenerate exceptions may be found in section *The raise statement*.\n\n\nThe ``with`` statement\n======================\n\nNew in version 2.5.\n\nThe ``with`` statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common\n``try``...``except``...``finally`` usage patterns to be encapsulated\nfor convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the ``with`` statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the ``with_item``)\n is evaluated to obtain a context manager.\n\n2. The context manager\'s ``__exit__()`` is loaded for later use.\n\n3. The context manager\'s ``__enter__()`` method is invoked.\n\n4. If a target was included in the ``with`` statement, the return\n value from ``__enter__()`` is assigned to it.\n\n Note: The ``with`` statement guarantees that if the ``__enter__()``\n method returns without an error, then ``__exit__()`` will always\n be called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s ``__exit__()`` method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to ``__exit__()``. Otherwise,\n three ``None`` arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the ``__exit__()`` method was false, the exception is\n reraised. If the return value was true, the exception is\n suppressed, and execution continues with the statement following\n the ``with`` statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from ``__exit__()`` is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple ``with`` statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nNote: In Python 2.5, the ``with`` statement is only allowed when the\n ``with_statement`` feature has been enabled. It is always enabled\n in Python 2.6.\n\nChanged in version 2.7: Support for multiple context expressions.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n decorated ::= decorators (classdef | funcdef)\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n funcdef ::= "def" funcname "(" [parameter_list] ")" ":" suite\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" identifier [, "**" identifier]\n | "**" identifier\n | defparameter [","] )\n defparameter ::= parameter ["=" expression]\n sublist ::= parameter ("," parameter)* [","]\n parameter ::= identifier | "(" sublist ")"\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to:\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more top-level parameters have the form *parameter* ``=``\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding argument may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters must also have a default value --- this is a syntactic\nrestriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that the same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use ``None`` as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n"``*identifier``" is present, it is initialized to a tuple receiving\nany excess positional parameters, defaulting to the empty tuple. If\nthe form "``**identifier``" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda forms,\ndescribed in section *Lambdas*. Note that the lambda form is merely a\nshorthand for a simplified function definition; a function defined in\na "``def``" statement can be passed around or assigned to another name\njust like a function defined by a lambda form. The "``def``" form is\nactually more powerful since it allows the execution of multiple\nstatements.\n\n**Programmer\'s note:** Functions are first-class objects. A "``def``"\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= "class" classname [inheritance] ":" suite\n inheritance ::= "(" [expression_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section *Naming and binding*), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by all instances. To create instance\nvariables, they can be set in a method with ``self.name = value``.\nBoth class and instance variables are accessible through the notation\n"``self.name``", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. For *new-style class*es, descriptors can\nbe used to create instance variables with different implementation\ndetails.\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless there\n is a ``finally`` clause which happens to raise another exception.\n That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n\n[3] A string literal appearing as the first statement in the function\n body is transformed into the function\'s ``__doc__`` attribute and\n therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s ``__doc__`` item and\n therefore the class\'s *docstring*.\n', + 'compound': '\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe ``if``, ``while`` and ``for`` statements implement traditional\ncontrol flow constructs. ``try`` specifies exception handlers and/or\ncleanup code for a group of statements. Function and class\ndefinitions are also syntactically compound statements.\n\nCompound statements consist of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which ``if`` clause a following ``else`` clause would belong:\n\n if test1: if test2: print x\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n``print`` statements are executed:\n\n if x < y < z: print x; print y; print z\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n | decorated\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a ``NEWLINE`` possibly followed by\na ``DEDENT``. Also note that optional continuation clauses always\nbegin with a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling ``else``\' problem is solved in Python by\nrequiring nested ``if`` statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe ``if`` statement\n====================\n\nThe ``if`` statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the ``if`` statement is executed or evaluated).\nIf all expressions are false, the suite of the ``else`` clause, if\npresent, is executed.\n\n\nThe ``while`` statement\n=======================\n\nThe ``while`` statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the ``else`` clause, if present, is\nexecuted and the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ngoes back to testing the expression.\n\n\nThe ``for`` statement\n=====================\n\nThe ``for`` statement is used to iterate over the elements of a\nsequence (such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n``expression_list``. The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments, and then the suite is executed. When the items are\nexhausted (which is immediately when the sequence is empty), the suite\nin the ``else`` clause, if present, is executed, and the loop\nterminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ncontinues with the next item, or with the ``else`` clause if there was\nno next item.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nThe target list is not deleted when the loop is finished, but if the\nsequence is empty, it will not have been assigned to at all by the\nloop. Hint: the built-in function ``range()`` returns a sequence of\nintegers suitable to emulate the effect of Pascal\'s ``for i := a to b\ndo``; e.g., ``range(3)`` returns the list ``[0, 1, 2]``.\n\nNote: There is a subtlety when the sequence is being modified by the loop\n (this can only occur for mutable sequences, i.e. lists). An internal\n counter is used to keep track of which item is used next, and this\n is incremented on each iteration. When this counter has reached the\n length of the sequence the loop terminates. This means that if the\n suite deletes the current (or a previous) item from the sequence,\n the next item will be skipped (since it gets the index of the\n current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe ``try`` statement\n=====================\n\nThe ``try`` statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression [("as" | ",") target]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n``try``...``except``...``finally`` did not work. ``try``...``except``\nhad to be nested in ``try``...``finally``.\n\nThe ``except`` clause(s) specify one or more exception handlers. When\nno exception occurs in the ``try`` clause, no exception handler is\nexecuted. When an exception occurs in the ``try`` suite, a search for\nan exception handler is started. This search inspects the except\nclauses in turn until one is found that matches the exception. An\nexpression-less except clause, if present, must be last; it matches\nany exception. For an except clause with an expression, that\nexpression is evaluated, and the clause matches the exception if the\nresulting object is "compatible" with the exception. An object is\ncompatible with an exception if it is the class or a base class of the\nexception object, or a tuple containing an item compatible with the\nexception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire ``try`` statement\nraised the exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed. All except clauses must have an\nexecutable block. When the end of this block is reached, execution\ncontinues normally after the entire try statement. (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the ``sys`` module:\n``sys.exc_type`` receives the object identifying the exception;\n``sys.exc_value`` receives the exception\'s parameter;\n``sys.exc_traceback`` receives a traceback object (see section *The\nstandard type hierarchy*) identifying the point in the program where\nthe exception occurred. These details are also available through the\n``sys.exc_info()`` function, which returns a tuple ``(exc_type,\nexc_value, exc_traceback)``. Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program. As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional ``else`` clause is executed if and when control flows off\nthe end of the ``try`` clause. [2] Exceptions in the ``else`` clause\nare not handled by the preceding ``except`` clauses.\n\nIf ``finally`` is present, it specifies a \'cleanup\' handler. The\n``try`` clause is executed, including any ``except`` and ``else``\nclauses. If an exception occurs in any of the clauses and is not\nhandled, the exception is temporarily saved. The ``finally`` clause is\nexecuted. If there is a saved exception, it is re-raised at the end\nof the ``finally`` clause. If the ``finally`` clause raises another\nexception or executes a ``return`` or ``break`` statement, the saved\nexception is discarded:\n\n def f():\n try:\n 1/0\n finally:\n return 42\n\n >>> f()\n 42\n\nThe exception information is not available to the program during\nexecution of the ``finally`` clause.\n\nWhen a ``return``, ``break`` or ``continue`` statement is executed in\nthe ``try`` suite of a ``try``...``finally`` statement, the\n``finally`` clause is also executed \'on the way out.\' A ``continue``\nstatement is illegal in the ``finally`` clause. (The reason is a\nproblem with the current implementation --- this restriction may be\nlifted in the future).\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the ``raise`` statement to\ngenerate exceptions may be found in section *The raise statement*.\n\n\nThe ``with`` statement\n======================\n\nNew in version 2.5.\n\nThe ``with`` statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common\n``try``...``except``...``finally`` usage patterns to be encapsulated\nfor convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the ``with`` statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the ``with_item``)\n is evaluated to obtain a context manager.\n\n2. The context manager\'s ``__exit__()`` is loaded for later use.\n\n3. The context manager\'s ``__enter__()`` method is invoked.\n\n4. If a target was included in the ``with`` statement, the return\n value from ``__enter__()`` is assigned to it.\n\n Note: The ``with`` statement guarantees that if the ``__enter__()``\n method returns without an error, then ``__exit__()`` will always\n be called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s ``__exit__()`` method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to ``__exit__()``. Otherwise,\n three ``None`` arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the ``__exit__()`` method was false, the exception is\n reraised. If the return value was true, the exception is\n suppressed, and execution continues with the statement following\n the ``with`` statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from ``__exit__()`` is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple ``with`` statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nNote: In Python 2.5, the ``with`` statement is only allowed when the\n ``with_statement`` feature has been enabled. It is always enabled\n in Python 2.6.\n\nChanged in version 2.7: Support for multiple context expressions.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n decorated ::= decorators (classdef | funcdef)\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n funcdef ::= "def" funcname "(" [parameter_list] ")" ":" suite\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" identifier ["," "**" identifier]\n | "**" identifier\n | defparameter [","] )\n defparameter ::= parameter ["=" expression]\n sublist ::= parameter ("," parameter)* [","]\n parameter ::= identifier | "(" sublist ")"\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to:\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more top-level *parameters* have the form *parameter*\n``=`` *expression*, the function is said to have "default parameter\nvalues." For a parameter with a default value, the corresponding\n*argument* may be omitted from a call, in which case the parameter\'s\ndefault value is substituted. If a parameter has a default value, all\nfollowing parameters must also have a default value --- this is a\nsyntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that the same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use ``None`` as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n"``*identifier``" is present, it is initialized to a tuple receiving\nany excess positional parameters, defaulting to the empty tuple. If\nthe form "``**identifier``" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda forms,\ndescribed in section *Lambdas*. Note that the lambda form is merely a\nshorthand for a simplified function definition; a function defined in\na "``def``" statement can be passed around or assigned to another name\njust like a function defined by a lambda form. The "``def``" form is\nactually more powerful since it allows the execution of multiple\nstatements.\n\n**Programmer\'s note:** Functions are first-class objects. A "``def``"\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= "class" classname [inheritance] ":" suite\n inheritance ::= "(" [expression_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section *Naming and binding*), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by all instances. To create instance\nvariables, they can be set in a method with ``self.name = value``.\nBoth class and instance variables are accessible through the notation\n"``self.name``", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. For *new-style class*es, descriptors can\nbe used to create instance variables with different implementation\ndetails.\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless there\n is a ``finally`` clause which happens to raise another exception.\n That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n\n[3] A string literal appearing as the first statement in the function\n body is transformed into the function\'s ``__doc__`` attribute and\n therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s ``__doc__`` item and\n therefore the class\'s *docstring*.\n', 'context-managers': '\nWith Statement Context Managers\n*******************************\n\nNew in version 2.5.\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a ``with`` statement. The context\nmanager handles the entry into, and the exit from, the desired runtime\ncontext for the execution of the block of code. Context managers are\nnormally invoked using the ``with`` statement (described in section\n*The with statement*), but can also be used by directly invoking their\nmethods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The ``with``\n statement will bind this method\'s return value to the target(s)\n specified in the ``as`` clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be ``None``.\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that ``__exit__()`` methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n', 'continue': '\nThe ``continue`` statement\n**************************\n\n continue_stmt ::= "continue"\n\n``continue`` may only occur syntactically nested in a ``for`` or\n``while`` loop, but not nested in a function or class definition or\n``finally`` clause within that loop. It continues with the next cycle\nof the nearest enclosing loop.\n\nWhen ``continue`` passes control out of a ``try`` statement with a\n``finally`` clause, that ``finally`` clause is executed before really\nstarting the next loop cycle.\n', 'conversions': '\nArithmetic conversions\n**********************\n\nWhen a description of an arithmetic operator below uses the phrase\n"the numeric arguments are converted to a common type," the arguments\nare coerced using the coercion rules listed at *Coercion rules*. If\nboth arguments are standard numeric types, the following coercions are\napplied:\n\n* If either argument is a complex number, the other is converted to\n complex;\n\n* otherwise, if either argument is a floating point number, the other\n is converted to floating point;\n\n* otherwise, if either argument is a long integer, the other is\n converted to long integer;\n\n* otherwise, both must be plain integers and no conversion is\n necessary.\n\nSome additional rules apply for certain operators (e.g., a string left\nargument to the \'%\' operator). Extensions can define their own\ncoercions.\n', @@ -33,8 +33,8 @@ 'exprlists': '\nExpression lists\n****************\n\n expression_list ::= expression ( "," expression )* [","]\n\nAn expression list containing at least one comma yields a tuple. The\nlength of the tuple is the number of expressions in the list. The\nexpressions are evaluated from left to right.\n\nThe trailing comma is required only to create a single tuple (a.k.a. a\n*singleton*); it is optional in all other cases. A single expression\nwithout a trailing comma doesn\'t create a tuple, but rather yields the\nvalue of that expression. (To create an empty tuple, use an empty pair\nof parentheses: ``()``.)\n', 'floating': '\nFloating point literals\n***********************\n\nFloating point literals are described by the following lexical\ndefinitions:\n\n floatnumber ::= pointfloat | exponentfloat\n pointfloat ::= [intpart] fraction | intpart "."\n exponentfloat ::= (intpart | pointfloat) exponent\n intpart ::= digit+\n fraction ::= "." digit+\n exponent ::= ("e" | "E") ["+" | "-"] digit+\n\nNote that the integer and exponent parts of floating point numbers can\nlook like octal integers, but are interpreted using radix 10. For\nexample, ``077e010`` is legal, and denotes the same number as\n``77e10``. The allowed range of floating point literals is\nimplementation-dependent. Some examples of floating point literals:\n\n 3.14 10. .001 1e100 3.14e-10 0e0\n\nNote that numeric literals do not include a sign; a phrase like ``-1``\nis actually an expression composed of the unary operator ``-`` and the\nliteral ``1``.\n', 'for': '\nThe ``for`` statement\n*********************\n\nThe ``for`` statement is used to iterate over the elements of a\nsequence (such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n``expression_list``. The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments, and then the suite is executed. When the items are\nexhausted (which is immediately when the sequence is empty), the suite\nin the ``else`` clause, if present, is executed, and the loop\nterminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ncontinues with the next item, or with the ``else`` clause if there was\nno next item.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nThe target list is not deleted when the loop is finished, but if the\nsequence is empty, it will not have been assigned to at all by the\nloop. Hint: the built-in function ``range()`` returns a sequence of\nintegers suitable to emulate the effect of Pascal\'s ``for i := a to b\ndo``; e.g., ``range(3)`` returns the list ``[0, 1, 2]``.\n\nNote: There is a subtlety when the sequence is being modified by the loop\n (this can only occur for mutable sequences, i.e. lists). An internal\n counter is used to keep track of which item is used next, and this\n is incremented on each iteration. When this counter has reached the\n length of the sequence the loop terminates. This means that if the\n suite deletes the current (or a previous) item from the sequence,\n the next item will be skipped (since it gets the index of the\n current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n', - 'formatstrings': '\nFormat String Syntax\n********************\n\nThe ``str.format()`` method and the ``Formatter`` class share the same\nsyntax for format strings (although in the case of ``Formatter``,\nsubclasses can define their own format string syntax).\n\nFormat strings contain "replacement fields" surrounded by curly braces\n``{}``. Anything that is not contained in braces is considered literal\ntext, which is copied unchanged to the output. If you need to include\na brace character in the literal text, it can be escaped by doubling:\n``{{`` and ``}}``.\n\nThe grammar for a replacement field is as follows:\n\n replacement_field ::= "{" [field_name] ["!" conversion] [":" format_spec] "}"\n field_name ::= arg_name ("." attribute_name | "[" element_index "]")*\n arg_name ::= [identifier | integer]\n attribute_name ::= identifier\n element_index ::= integer | index_string\n index_string ::= +\n conversion ::= "r" | "s"\n format_spec ::= \n\nIn less formal terms, the replacement field can start with a\n*field_name* that specifies the object whose value is to be formatted\nand inserted into the output instead of the replacement field. The\n*field_name* is optionally followed by a *conversion* field, which is\npreceded by an exclamation point ``\'!\'``, and a *format_spec*, which\nis preceded by a colon ``\':\'``. These specify a non-default format\nfor the replacement value.\n\nSee also the *Format Specification Mini-Language* section.\n\nThe *field_name* itself begins with an *arg_name* that is either a\nnumber or a keyword. If it\'s a number, it refers to a positional\nargument, and if it\'s a keyword, it refers to a named keyword\nargument. If the numerical arg_names in a format string are 0, 1, 2,\n... in sequence, they can all be omitted (not just some) and the\nnumbers 0, 1, 2, ... will be automatically inserted in that order.\nBecause *arg_name* is not quote-delimited, it is not possible to\nspecify arbitrary dictionary keys (e.g., the strings ``\'10\'`` or\n``\':-]\'``) within a format string. The *arg_name* can be followed by\nany number of index or attribute expressions. An expression of the\nform ``\'.name\'`` selects the named attribute using ``getattr()``,\nwhile an expression of the form ``\'[index]\'`` does an index lookup\nusing ``__getitem__()``.\n\nChanged in version 2.7: The positional argument specifiers can be\nomitted, so ``\'{} {}\'`` is equivalent to ``\'{0} {1}\'``.\n\nSome simple format string examples:\n\n "First, thou shalt count to {0}" # References first positional argument\n "Bring me a {}" # Implicitly references the first positional argument\n "From {} to {}" # Same as "From {0} to {1}"\n "My quest is {name}" # References keyword argument \'name\'\n "Weight in tons {0.weight}" # \'weight\' attribute of first positional arg\n "Units destroyed: {players[0]}" # First element of keyword argument \'players\'.\n\nThe *conversion* field causes a type coercion before formatting.\nNormally, the job of formatting a value is done by the\n``__format__()`` method of the value itself. However, in some cases\nit is desirable to force a type to be formatted as a string,\noverriding its own definition of formatting. By converting the value\nto a string before calling ``__format__()``, the normal formatting\nlogic is bypassed.\n\nTwo conversion flags are currently supported: ``\'!s\'`` which calls\n``str()`` on the value, and ``\'!r\'`` which calls ``repr()``.\n\nSome examples:\n\n "Harold\'s a clever {0!s}" # Calls str() on the argument first\n "Bring out the holy {name!r}" # Calls repr() on the argument first\n\nThe *format_spec* field contains a specification of how the value\nshould be presented, including such details as field width, alignment,\npadding, decimal precision and so on. Each value type can define its\nown "formatting mini-language" or interpretation of the *format_spec*.\n\nMost built-in types support a common formatting mini-language, which\nis described in the next section.\n\nA *format_spec* field can also include nested replacement fields\nwithin it. These nested replacement fields can contain only a field\nname; conversion flags and format specifications are not allowed. The\nreplacement fields within the format_spec are substituted before the\n*format_spec* string is interpreted. This allows the formatting of a\nvalue to be dynamically specified.\n\nSee the *Format examples* section for some examples.\n\n\nFormat Specification Mini-Language\n==================================\n\n"Format specifications" are used within replacement fields contained\nwithin a format string to define how individual values are presented\n(see *Format String Syntax*). They can also be passed directly to the\nbuilt-in ``format()`` function. Each formattable type may define how\nthe format specification is to be interpreted.\n\nMost built-in types implement the following options for format\nspecifications, although some of the formatting options are only\nsupported by the numeric types.\n\nA general convention is that an empty format string (``""``) produces\nthe same result as if you had called ``str()`` on the value. A non-\nempty format string typically modifies the result.\n\nThe general form of a *standard format specifier* is:\n\n format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]\n fill ::= \n align ::= "<" | ">" | "=" | "^"\n sign ::= "+" | "-" | " "\n width ::= integer\n precision ::= integer\n type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n\nThe *fill* character can be any character other than \'{\' or \'}\'. The\npresence of a fill character is signaled by the character following\nit, which must be one of the alignment options. If the second\ncharacter of *format_spec* is not a valid alignment option, then it is\nassumed that both the fill character and the alignment option are\nabsent.\n\nThe meaning of the various alignment options is as follows:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | ``\'<\'`` | Forces the field to be left-aligned within the available |\n | | space (this is the default for most objects). |\n +-----------+------------------------------------------------------------+\n | ``\'>\'`` | Forces the field to be right-aligned within the available |\n | | space (this is the default for numbers). |\n +-----------+------------------------------------------------------------+\n | ``\'=\'`` | Forces the padding to be placed after the sign (if any) |\n | | but before the digits. This is used for printing fields |\n | | in the form \'+000000120\'. This alignment option is only |\n | | valid for numeric types. |\n +-----------+------------------------------------------------------------+\n | ``\'^\'`` | Forces the field to be centered within the available |\n | | space. |\n +-----------+------------------------------------------------------------+\n\nNote that unless a minimum field width is defined, the field width\nwill always be the same size as the data to fill it, so that the\nalignment option has no meaning in this case.\n\nThe *sign* option is only valid for number types, and can be one of\nthe following:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | ``\'+\'`` | indicates that a sign should be used for both positive as |\n | | well as negative numbers. |\n +-----------+------------------------------------------------------------+\n | ``\'-\'`` | indicates that a sign should be used only for negative |\n | | numbers (this is the default behavior). |\n +-----------+------------------------------------------------------------+\n | space | indicates that a leading space should be used on positive |\n | | numbers, and a minus sign on negative numbers. |\n +-----------+------------------------------------------------------------+\n\nThe ``\'#\'`` option is only valid for integers, and only for binary,\noctal, or hexadecimal output. If present, it specifies that the\noutput will be prefixed by ``\'0b\'``, ``\'0o\'``, or ``\'0x\'``,\nrespectively.\n\nThe ``\',\'`` option signals the use of a comma for a thousands\nseparator. For a locale aware separator, use the ``\'n\'`` integer\npresentation type instead.\n\nChanged in version 2.7: Added the ``\',\'`` option (see also **PEP\n378**).\n\n*width* is a decimal integer defining the minimum field width. If not\nspecified, then the field width will be determined by the content.\n\nIf the *width* field is preceded by a zero (``\'0\'``) character, this\nenables zero-padding. This is equivalent to an *alignment* type of\n``\'=\'`` and a *fill* character of ``\'0\'``.\n\nThe *precision* is a decimal number indicating how many digits should\nbe displayed after the decimal point for a floating point value\nformatted with ``\'f\'`` and ``\'F\'``, or before and after the decimal\npoint for a floating point value formatted with ``\'g\'`` or ``\'G\'``.\nFor non-number types the field indicates the maximum field size - in\nother words, how many characters will be used from the field content.\nThe *precision* is not allowed for integer values.\n\nFinally, the *type* determines how the data should be presented.\n\nThe available string presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | ``\'s\'`` | String format. This is the default type for strings and |\n | | may be omitted. |\n +-----------+------------------------------------------------------------+\n | None | The same as ``\'s\'``. |\n +-----------+------------------------------------------------------------+\n\nThe available integer presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | ``\'b\'`` | Binary format. Outputs the number in base 2. |\n +-----------+------------------------------------------------------------+\n | ``\'c\'`` | Character. Converts the integer to the corresponding |\n | | unicode character before printing. |\n +-----------+------------------------------------------------------------+\n | ``\'d\'`` | Decimal Integer. Outputs the number in base 10. |\n +-----------+------------------------------------------------------------+\n | ``\'o\'`` | Octal format. Outputs the number in base 8. |\n +-----------+------------------------------------------------------------+\n | ``\'x\'`` | Hex format. Outputs the number in base 16, using lower- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | ``\'X\'`` | Hex format. Outputs the number in base 16, using upper- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | ``\'n\'`` | Number. This is the same as ``\'d\'``, except that it uses |\n | | the current locale setting to insert the appropriate |\n | | number separator characters. |\n +-----------+------------------------------------------------------------+\n | None | The same as ``\'d\'``. |\n +-----------+------------------------------------------------------------+\n\nIn addition to the above presentation types, integers can be formatted\nwith the floating point presentation types listed below (except\n``\'n\'`` and None). When doing so, ``float()`` is used to convert the\ninteger to a floating point number before formatting.\n\nThe available presentation types for floating point and decimal values\nare:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | ``\'e\'`` | Exponent notation. Prints the number in scientific |\n | | notation using the letter \'e\' to indicate the exponent. |\n +-----------+------------------------------------------------------------+\n | ``\'E\'`` | Exponent notation. Same as ``\'e\'`` except it uses an upper |\n | | case \'E\' as the separator character. |\n +-----------+------------------------------------------------------------+\n | ``\'f\'`` | Fixed point. Displays the number as a fixed-point number. |\n +-----------+------------------------------------------------------------+\n | ``\'F\'`` | Fixed point. Same as ``\'f\'``. |\n +-----------+------------------------------------------------------------+\n | ``\'g\'`` | General format. For a given precision ``p >= 1``, this |\n | | rounds the number to ``p`` significant digits and then |\n | | formats the result in either fixed-point format or in |\n | | scientific notation, depending on its magnitude. The |\n | | precise rules are as follows: suppose that the result |\n | | formatted with presentation type ``\'e\'`` and precision |\n | | ``p-1`` would have exponent ``exp``. Then if ``-4 <= exp |\n | | < p``, the number is formatted with presentation type |\n | | ``\'f\'`` and precision ``p-1-exp``. Otherwise, the number |\n | | is formatted with presentation type ``\'e\'`` and precision |\n | | ``p-1``. In both cases insignificant trailing zeros are |\n | | removed from the significand, and the decimal point is |\n | | also removed if there are no remaining digits following |\n | | it. Positive and negative infinity, positive and negative |\n | | zero, and nans, are formatted as ``inf``, ``-inf``, ``0``, |\n | | ``-0`` and ``nan`` respectively, regardless of the |\n | | precision. A precision of ``0`` is treated as equivalent |\n | | to a precision of ``1``. |\n +-----------+------------------------------------------------------------+\n | ``\'G\'`` | General format. Same as ``\'g\'`` except switches to ``\'E\'`` |\n | | if the number gets too large. The representations of |\n | | infinity and NaN are uppercased, too. |\n +-----------+------------------------------------------------------------+\n | ``\'n\'`` | Number. This is the same as ``\'g\'``, except that it uses |\n | | the current locale setting to insert the appropriate |\n | | number separator characters. |\n +-----------+------------------------------------------------------------+\n | ``\'%\'`` | Percentage. Multiplies the number by 100 and displays in |\n | | fixed (``\'f\'``) format, followed by a percent sign. |\n +-----------+------------------------------------------------------------+\n | None | The same as ``\'g\'``. |\n +-----------+------------------------------------------------------------+\n\n\nFormat examples\n===============\n\nThis section contains examples of the new format syntax and comparison\nwith the old ``%``-formatting.\n\nIn most of the cases the syntax is similar to the old\n``%``-formatting, with the addition of the ``{}`` and with ``:`` used\ninstead of ``%``. For example, ``\'%03.2f\'`` can be translated to\n``\'{:03.2f}\'``.\n\nThe new format syntax also supports new and different options, shown\nin the follow examples.\n\nAccessing arguments by position:\n\n >>> \'{0}, {1}, {2}\'.format(\'a\', \'b\', \'c\')\n \'a, b, c\'\n >>> \'{}, {}, {}\'.format(\'a\', \'b\', \'c\') # 2.7+ only\n \'a, b, c\'\n >>> \'{2}, {1}, {0}\'.format(\'a\', \'b\', \'c\')\n \'c, b, a\'\n >>> \'{2}, {1}, {0}\'.format(*\'abc\') # unpacking argument sequence\n \'c, b, a\'\n >>> \'{0}{1}{0}\'.format(\'abra\', \'cad\') # arguments\' indices can be repeated\n \'abracadabra\'\n\nAccessing arguments by name:\n\n >>> \'Coordinates: {latitude}, {longitude}\'.format(latitude=\'37.24N\', longitude=\'-115.81W\')\n \'Coordinates: 37.24N, -115.81W\'\n >>> coord = {\'latitude\': \'37.24N\', \'longitude\': \'-115.81W\'}\n >>> \'Coordinates: {latitude}, {longitude}\'.format(**coord)\n \'Coordinates: 37.24N, -115.81W\'\n\nAccessing arguments\' attributes:\n\n >>> c = 3-5j\n >>> (\'The complex number {0} is formed from the real part {0.real} \'\n ... \'and the imaginary part {0.imag}.\').format(c)\n \'The complex number (3-5j) is formed from the real part 3.0 and the imaginary part -5.0.\'\n >>> class Point(object):\n ... def __init__(self, x, y):\n ... self.x, self.y = x, y\n ... def __str__(self):\n ... return \'Point({self.x}, {self.y})\'.format(self=self)\n ...\n >>> str(Point(4, 2))\n \'Point(4, 2)\'\n\nAccessing arguments\' items:\n\n >>> coord = (3, 5)\n >>> \'X: {0[0]}; Y: {0[1]}\'.format(coord)\n \'X: 3; Y: 5\'\n\nReplacing ``%s`` and ``%r``:\n\n >>> "repr() shows quotes: {!r}; str() doesn\'t: {!s}".format(\'test1\', \'test2\')\n "repr() shows quotes: \'test1\'; str() doesn\'t: test2"\n\nAligning the text and specifying a width:\n\n >>> \'{:<30}\'.format(\'left aligned\')\n \'left aligned \'\n >>> \'{:>30}\'.format(\'right aligned\')\n \' right aligned\'\n >>> \'{:^30}\'.format(\'centered\')\n \' centered \'\n >>> \'{:*^30}\'.format(\'centered\') # use \'*\' as a fill char\n \'***********centered***********\'\n\nReplacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign:\n\n >>> \'{:+f}; {:+f}\'.format(3.14, -3.14) # show it always\n \'+3.140000; -3.140000\'\n >>> \'{: f}; {: f}\'.format(3.14, -3.14) # show a space for positive numbers\n \' 3.140000; -3.140000\'\n >>> \'{:-f}; {:-f}\'.format(3.14, -3.14) # show only the minus -- same as \'{:f}; {:f}\'\n \'3.140000; -3.140000\'\n\nReplacing ``%x`` and ``%o`` and converting the value to different\nbases:\n\n >>> # format also supports binary numbers\n >>> "int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}".format(42)\n \'int: 42; hex: 2a; oct: 52; bin: 101010\'\n >>> # with 0x, 0o, or 0b as prefix:\n >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}".format(42)\n \'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010\'\n\nUsing the comma as a thousands separator:\n\n >>> \'{:,}\'.format(1234567890)\n \'1,234,567,890\'\n\nExpressing a percentage:\n\n >>> points = 19.5\n >>> total = 22\n >>> \'Correct answers: {:.2%}\'.format(points/total)\n \'Correct answers: 88.64%\'\n\nUsing type-specific formatting:\n\n >>> import datetime\n >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n >>> \'{:%Y-%m-%d %H:%M:%S}\'.format(d)\n \'2010-07-04 12:15:58\'\n\nNesting arguments and more complex examples:\n\n >>> for align, text in zip(\'<^>\', [\'left\', \'center\', \'right\']):\n ... \'{0:{fill}{align}16}\'.format(text, fill=align, align=align)\n ...\n \'left<<<<<<<<<<<<\'\n \'^^^^^center^^^^^\'\n \'>>>>>>>>>>>right\'\n >>>\n >>> octets = [192, 168, 0, 1]\n >>> \'{:02X}{:02X}{:02X}{:02X}\'.format(*octets)\n \'C0A80001\'\n >>> int(_, 16)\n 3232235521\n >>>\n >>> width = 5\n >>> for num in range(5,12):\n ... for base in \'dXob\':\n ... print \'{0:{width}{base}}\'.format(num, base=base, width=width),\n ... print\n ...\n 5 5 5 101\n 6 6 6 110\n 7 7 7 111\n 8 8 10 1000\n 9 9 11 1001\n 10 A 12 1010\n 11 B 13 1011\n', - 'function': '\nFunction definitions\n********************\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n decorated ::= decorators (classdef | funcdef)\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n funcdef ::= "def" funcname "(" [parameter_list] ")" ":" suite\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" identifier [, "**" identifier]\n | "**" identifier\n | defparameter [","] )\n defparameter ::= parameter ["=" expression]\n sublist ::= parameter ("," parameter)* [","]\n parameter ::= identifier | "(" sublist ")"\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to:\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more top-level parameters have the form *parameter* ``=``\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding argument may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters must also have a default value --- this is a syntactic\nrestriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that the same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use ``None`` as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n"``*identifier``" is present, it is initialized to a tuple receiving\nany excess positional parameters, defaulting to the empty tuple. If\nthe form "``**identifier``" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda forms,\ndescribed in section *Lambdas*. Note that the lambda form is merely a\nshorthand for a simplified function definition; a function defined in\na "``def``" statement can be passed around or assigned to another name\njust like a function defined by a lambda form. The "``def``" form is\nactually more powerful since it allows the execution of multiple\nstatements.\n\n**Programmer\'s note:** Functions are first-class objects. A "``def``"\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n', + 'formatstrings': '\nFormat String Syntax\n********************\n\nThe ``str.format()`` method and the ``Formatter`` class share the same\nsyntax for format strings (although in the case of ``Formatter``,\nsubclasses can define their own format string syntax).\n\nFormat strings contain "replacement fields" surrounded by curly braces\n``{}``. Anything that is not contained in braces is considered literal\ntext, which is copied unchanged to the output. If you need to include\na brace character in the literal text, it can be escaped by doubling:\n``{{`` and ``}}``.\n\nThe grammar for a replacement field is as follows:\n\n replacement_field ::= "{" [field_name] ["!" conversion] [":" format_spec] "}"\n field_name ::= arg_name ("." attribute_name | "[" element_index "]")*\n arg_name ::= [identifier | integer]\n attribute_name ::= identifier\n element_index ::= integer | index_string\n index_string ::= +\n conversion ::= "r" | "s"\n format_spec ::= \n\nIn less formal terms, the replacement field can start with a\n*field_name* that specifies the object whose value is to be formatted\nand inserted into the output instead of the replacement field. The\n*field_name* is optionally followed by a *conversion* field, which is\npreceded by an exclamation point ``\'!\'``, and a *format_spec*, which\nis preceded by a colon ``\':\'``. These specify a non-default format\nfor the replacement value.\n\nSee also the *Format Specification Mini-Language* section.\n\nThe *field_name* itself begins with an *arg_name* that is either a\nnumber or a keyword. If it\'s a number, it refers to a positional\nargument, and if it\'s a keyword, it refers to a named keyword\nargument. If the numerical arg_names in a format string are 0, 1, 2,\n... in sequence, they can all be omitted (not just some) and the\nnumbers 0, 1, 2, ... will be automatically inserted in that order.\nBecause *arg_name* is not quote-delimited, it is not possible to\nspecify arbitrary dictionary keys (e.g., the strings ``\'10\'`` or\n``\':-]\'``) within a format string. The *arg_name* can be followed by\nany number of index or attribute expressions. An expression of the\nform ``\'.name\'`` selects the named attribute using ``getattr()``,\nwhile an expression of the form ``\'[index]\'`` does an index lookup\nusing ``__getitem__()``.\n\nChanged in version 2.7: The positional argument specifiers can be\nomitted, so ``\'{} {}\'`` is equivalent to ``\'{0} {1}\'``.\n\nSome simple format string examples:\n\n "First, thou shalt count to {0}" # References first positional argument\n "Bring me a {}" # Implicitly references the first positional argument\n "From {} to {}" # Same as "From {0} to {1}"\n "My quest is {name}" # References keyword argument \'name\'\n "Weight in tons {0.weight}" # \'weight\' attribute of first positional arg\n "Units destroyed: {players[0]}" # First element of keyword argument \'players\'.\n\nThe *conversion* field causes a type coercion before formatting.\nNormally, the job of formatting a value is done by the\n``__format__()`` method of the value itself. However, in some cases\nit is desirable to force a type to be formatted as a string,\noverriding its own definition of formatting. By converting the value\nto a string before calling ``__format__()``, the normal formatting\nlogic is bypassed.\n\nTwo conversion flags are currently supported: ``\'!s\'`` which calls\n``str()`` on the value, and ``\'!r\'`` which calls ``repr()``.\n\nSome examples:\n\n "Harold\'s a clever {0!s}" # Calls str() on the argument first\n "Bring out the holy {name!r}" # Calls repr() on the argument first\n\nThe *format_spec* field contains a specification of how the value\nshould be presented, including such details as field width, alignment,\npadding, decimal precision and so on. Each value type can define its\nown "formatting mini-language" or interpretation of the *format_spec*.\n\nMost built-in types support a common formatting mini-language, which\nis described in the next section.\n\nA *format_spec* field can also include nested replacement fields\nwithin it. These nested replacement fields can contain only a field\nname; conversion flags and format specifications are not allowed. The\nreplacement fields within the format_spec are substituted before the\n*format_spec* string is interpreted. This allows the formatting of a\nvalue to be dynamically specified.\n\nSee the *Format examples* section for some examples.\n\n\nFormat Specification Mini-Language\n==================================\n\n"Format specifications" are used within replacement fields contained\nwithin a format string to define how individual values are presented\n(see *Format String Syntax*). They can also be passed directly to the\nbuilt-in ``format()`` function. Each formattable type may define how\nthe format specification is to be interpreted.\n\nMost built-in types implement the following options for format\nspecifications, although some of the formatting options are only\nsupported by the numeric types.\n\nA general convention is that an empty format string (``""``) produces\nthe same result as if you had called ``str()`` on the value. A non-\nempty format string typically modifies the result.\n\nThe general form of a *standard format specifier* is:\n\n format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]\n fill ::= \n align ::= "<" | ">" | "=" | "^"\n sign ::= "+" | "-" | " "\n width ::= integer\n precision ::= integer\n type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n\nThe *fill* character can be any character other than \'{\' or \'}\'. The\npresence of a fill character is signaled by the character following\nit, which must be one of the alignment options. If the second\ncharacter of *format_spec* is not a valid alignment option, then it is\nassumed that both the fill character and the alignment option are\nabsent.\n\nThe meaning of the various alignment options is as follows:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | ``\'<\'`` | Forces the field to be left-aligned within the available |\n | | space (this is the default for most objects). |\n +-----------+------------------------------------------------------------+\n | ``\'>\'`` | Forces the field to be right-aligned within the available |\n | | space (this is the default for numbers). |\n +-----------+------------------------------------------------------------+\n | ``\'=\'`` | Forces the padding to be placed after the sign (if any) |\n | | but before the digits. This is used for printing fields |\n | | in the form \'+000000120\'. This alignment option is only |\n | | valid for numeric types. |\n +-----------+------------------------------------------------------------+\n | ``\'^\'`` | Forces the field to be centered within the available |\n | | space. |\n +-----------+------------------------------------------------------------+\n\nNote that unless a minimum field width is defined, the field width\nwill always be the same size as the data to fill it, so that the\nalignment option has no meaning in this case.\n\nThe *sign* option is only valid for number types, and can be one of\nthe following:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | ``\'+\'`` | indicates that a sign should be used for both positive as |\n | | well as negative numbers. |\n +-----------+------------------------------------------------------------+\n | ``\'-\'`` | indicates that a sign should be used only for negative |\n | | numbers (this is the default behavior). |\n +-----------+------------------------------------------------------------+\n | space | indicates that a leading space should be used on positive |\n | | numbers, and a minus sign on negative numbers. |\n +-----------+------------------------------------------------------------+\n\nThe ``\'#\'`` option is only valid for integers, and only for binary,\noctal, or hexadecimal output. If present, it specifies that the\noutput will be prefixed by ``\'0b\'``, ``\'0o\'``, or ``\'0x\'``,\nrespectively.\n\nThe ``\',\'`` option signals the use of a comma for a thousands\nseparator. For a locale aware separator, use the ``\'n\'`` integer\npresentation type instead.\n\nChanged in version 2.7: Added the ``\',\'`` option (see also **PEP\n378**).\n\n*width* is a decimal integer defining the minimum field width. If not\nspecified, then the field width will be determined by the content.\n\nPreceding the *width* field by a zero (``\'0\'``) character enables\nsign-aware zero-padding for numeric types. This is equivalent to a\n*fill* character of ``\'0\'`` with an *alignment* type of ``\'=\'``.\n\nThe *precision* is a decimal number indicating how many digits should\nbe displayed after the decimal point for a floating point value\nformatted with ``\'f\'`` and ``\'F\'``, or before and after the decimal\npoint for a floating point value formatted with ``\'g\'`` or ``\'G\'``.\nFor non-number types the field indicates the maximum field size - in\nother words, how many characters will be used from the field content.\nThe *precision* is not allowed for integer values.\n\nFinally, the *type* determines how the data should be presented.\n\nThe available string presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | ``\'s\'`` | String format. This is the default type for strings and |\n | | may be omitted. |\n +-----------+------------------------------------------------------------+\n | None | The same as ``\'s\'``. |\n +-----------+------------------------------------------------------------+\n\nThe available integer presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | ``\'b\'`` | Binary format. Outputs the number in base 2. |\n +-----------+------------------------------------------------------------+\n | ``\'c\'`` | Character. Converts the integer to the corresponding |\n | | unicode character before printing. |\n +-----------+------------------------------------------------------------+\n | ``\'d\'`` | Decimal Integer. Outputs the number in base 10. |\n +-----------+------------------------------------------------------------+\n | ``\'o\'`` | Octal format. Outputs the number in base 8. |\n +-----------+------------------------------------------------------------+\n | ``\'x\'`` | Hex format. Outputs the number in base 16, using lower- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | ``\'X\'`` | Hex format. Outputs the number in base 16, using upper- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | ``\'n\'`` | Number. This is the same as ``\'d\'``, except that it uses |\n | | the current locale setting to insert the appropriate |\n | | number separator characters. |\n +-----------+------------------------------------------------------------+\n | None | The same as ``\'d\'``. |\n +-----------+------------------------------------------------------------+\n\nIn addition to the above presentation types, integers can be formatted\nwith the floating point presentation types listed below (except\n``\'n\'`` and None). When doing so, ``float()`` is used to convert the\ninteger to a floating point number before formatting.\n\nThe available presentation types for floating point and decimal values\nare:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | ``\'e\'`` | Exponent notation. Prints the number in scientific |\n | | notation using the letter \'e\' to indicate the exponent. |\n +-----------+------------------------------------------------------------+\n | ``\'E\'`` | Exponent notation. Same as ``\'e\'`` except it uses an upper |\n | | case \'E\' as the separator character. |\n +-----------+------------------------------------------------------------+\n | ``\'f\'`` | Fixed point. Displays the number as a fixed-point number. |\n +-----------+------------------------------------------------------------+\n | ``\'F\'`` | Fixed point. Same as ``\'f\'``. |\n +-----------+------------------------------------------------------------+\n | ``\'g\'`` | General format. For a given precision ``p >= 1``, this |\n | | rounds the number to ``p`` significant digits and then |\n | | formats the result in either fixed-point format or in |\n | | scientific notation, depending on its magnitude. The |\n | | precise rules are as follows: suppose that the result |\n | | formatted with presentation type ``\'e\'`` and precision |\n | | ``p-1`` would have exponent ``exp``. Then if ``-4 <= exp |\n | | < p``, the number is formatted with presentation type |\n | | ``\'f\'`` and precision ``p-1-exp``. Otherwise, the number |\n | | is formatted with presentation type ``\'e\'`` and precision |\n | | ``p-1``. In both cases insignificant trailing zeros are |\n | | removed from the significand, and the decimal point is |\n | | also removed if there are no remaining digits following |\n | | it. Positive and negative infinity, positive and negative |\n | | zero, and nans, are formatted as ``inf``, ``-inf``, ``0``, |\n | | ``-0`` and ``nan`` respectively, regardless of the |\n | | precision. A precision of ``0`` is treated as equivalent |\n | | to a precision of ``1``. |\n +-----------+------------------------------------------------------------+\n | ``\'G\'`` | General format. Same as ``\'g\'`` except switches to ``\'E\'`` |\n | | if the number gets too large. The representations of |\n | | infinity and NaN are uppercased, too. |\n +-----------+------------------------------------------------------------+\n | ``\'n\'`` | Number. This is the same as ``\'g\'``, except that it uses |\n | | the current locale setting to insert the appropriate |\n | | number separator characters. |\n +-----------+------------------------------------------------------------+\n | ``\'%\'`` | Percentage. Multiplies the number by 100 and displays in |\n | | fixed (``\'f\'``) format, followed by a percent sign. |\n +-----------+------------------------------------------------------------+\n | None | The same as ``\'g\'``. |\n +-----------+------------------------------------------------------------+\n\n\nFormat examples\n===============\n\nThis section contains examples of the new format syntax and comparison\nwith the old ``%``-formatting.\n\nIn most of the cases the syntax is similar to the old\n``%``-formatting, with the addition of the ``{}`` and with ``:`` used\ninstead of ``%``. For example, ``\'%03.2f\'`` can be translated to\n``\'{:03.2f}\'``.\n\nThe new format syntax also supports new and different options, shown\nin the follow examples.\n\nAccessing arguments by position:\n\n >>> \'{0}, {1}, {2}\'.format(\'a\', \'b\', \'c\')\n \'a, b, c\'\n >>> \'{}, {}, {}\'.format(\'a\', \'b\', \'c\') # 2.7+ only\n \'a, b, c\'\n >>> \'{2}, {1}, {0}\'.format(\'a\', \'b\', \'c\')\n \'c, b, a\'\n >>> \'{2}, {1}, {0}\'.format(*\'abc\') # unpacking argument sequence\n \'c, b, a\'\n >>> \'{0}{1}{0}\'.format(\'abra\', \'cad\') # arguments\' indices can be repeated\n \'abracadabra\'\n\nAccessing arguments by name:\n\n >>> \'Coordinates: {latitude}, {longitude}\'.format(latitude=\'37.24N\', longitude=\'-115.81W\')\n \'Coordinates: 37.24N, -115.81W\'\n >>> coord = {\'latitude\': \'37.24N\', \'longitude\': \'-115.81W\'}\n >>> \'Coordinates: {latitude}, {longitude}\'.format(**coord)\n \'Coordinates: 37.24N, -115.81W\'\n\nAccessing arguments\' attributes:\n\n >>> c = 3-5j\n >>> (\'The complex number {0} is formed from the real part {0.real} \'\n ... \'and the imaginary part {0.imag}.\').format(c)\n \'The complex number (3-5j) is formed from the real part 3.0 and the imaginary part -5.0.\'\n >>> class Point(object):\n ... def __init__(self, x, y):\n ... self.x, self.y = x, y\n ... def __str__(self):\n ... return \'Point({self.x}, {self.y})\'.format(self=self)\n ...\n >>> str(Point(4, 2))\n \'Point(4, 2)\'\n\nAccessing arguments\' items:\n\n >>> coord = (3, 5)\n >>> \'X: {0[0]}; Y: {0[1]}\'.format(coord)\n \'X: 3; Y: 5\'\n\nReplacing ``%s`` and ``%r``:\n\n >>> "repr() shows quotes: {!r}; str() doesn\'t: {!s}".format(\'test1\', \'test2\')\n "repr() shows quotes: \'test1\'; str() doesn\'t: test2"\n\nAligning the text and specifying a width:\n\n >>> \'{:<30}\'.format(\'left aligned\')\n \'left aligned \'\n >>> \'{:>30}\'.format(\'right aligned\')\n \' right aligned\'\n >>> \'{:^30}\'.format(\'centered\')\n \' centered \'\n >>> \'{:*^30}\'.format(\'centered\') # use \'*\' as a fill char\n \'***********centered***********\'\n\nReplacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign:\n\n >>> \'{:+f}; {:+f}\'.format(3.14, -3.14) # show it always\n \'+3.140000; -3.140000\'\n >>> \'{: f}; {: f}\'.format(3.14, -3.14) # show a space for positive numbers\n \' 3.140000; -3.140000\'\n >>> \'{:-f}; {:-f}\'.format(3.14, -3.14) # show only the minus -- same as \'{:f}; {:f}\'\n \'3.140000; -3.140000\'\n\nReplacing ``%x`` and ``%o`` and converting the value to different\nbases:\n\n >>> # format also supports binary numbers\n >>> "int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}".format(42)\n \'int: 42; hex: 2a; oct: 52; bin: 101010\'\n >>> # with 0x, 0o, or 0b as prefix:\n >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}".format(42)\n \'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010\'\n\nUsing the comma as a thousands separator:\n\n >>> \'{:,}\'.format(1234567890)\n \'1,234,567,890\'\n\nExpressing a percentage:\n\n >>> points = 19.5\n >>> total = 22\n >>> \'Correct answers: {:.2%}\'.format(points/total)\n \'Correct answers: 88.64%\'\n\nUsing type-specific formatting:\n\n >>> import datetime\n >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n >>> \'{:%Y-%m-%d %H:%M:%S}\'.format(d)\n \'2010-07-04 12:15:58\'\n\nNesting arguments and more complex examples:\n\n >>> for align, text in zip(\'<^>\', [\'left\', \'center\', \'right\']):\n ... \'{0:{fill}{align}16}\'.format(text, fill=align, align=align)\n ...\n \'left<<<<<<<<<<<<\'\n \'^^^^^center^^^^^\'\n \'>>>>>>>>>>>right\'\n >>>\n >>> octets = [192, 168, 0, 1]\n >>> \'{:02X}{:02X}{:02X}{:02X}\'.format(*octets)\n \'C0A80001\'\n >>> int(_, 16)\n 3232235521\n >>>\n >>> width = 5\n >>> for num in range(5,12):\n ... for base in \'dXob\':\n ... print \'{0:{width}{base}}\'.format(num, base=base, width=width),\n ... print\n ...\n 5 5 5 101\n 6 6 6 110\n 7 7 7 111\n 8 8 10 1000\n 9 9 11 1001\n 10 A 12 1010\n 11 B 13 1011\n', + 'function': '\nFunction definitions\n********************\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n decorated ::= decorators (classdef | funcdef)\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n funcdef ::= "def" funcname "(" [parameter_list] ")" ":" suite\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" identifier ["," "**" identifier]\n | "**" identifier\n | defparameter [","] )\n defparameter ::= parameter ["=" expression]\n sublist ::= parameter ("," parameter)* [","]\n parameter ::= identifier | "(" sublist ")"\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to:\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more top-level *parameters* have the form *parameter*\n``=`` *expression*, the function is said to have "default parameter\nvalues." For a parameter with a default value, the corresponding\n*argument* may be omitted from a call, in which case the parameter\'s\ndefault value is substituted. If a parameter has a default value, all\nfollowing parameters must also have a default value --- this is a\nsyntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that the same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use ``None`` as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n"``*identifier``" is present, it is initialized to a tuple receiving\nany excess positional parameters, defaulting to the empty tuple. If\nthe form "``**identifier``" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda forms,\ndescribed in section *Lambdas*. Note that the lambda form is merely a\nshorthand for a simplified function definition; a function defined in\na "``def``" statement can be passed around or assigned to another name\njust like a function defined by a lambda form. The "``def``" form is\nactually more powerful since it allows the execution of multiple\nstatements.\n\n**Programmer\'s note:** Functions are first-class objects. A "``def``"\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n', 'global': '\nThe ``global`` statement\n************************\n\n global_stmt ::= "global" identifier ("," identifier)*\n\nThe ``global`` statement is a declaration which holds for the entire\ncurrent code block. It means that the listed identifiers are to be\ninterpreted as globals. It would be impossible to assign to a global\nvariable without ``global``, although free variables may refer to\nglobals without being declared global.\n\nNames listed in a ``global`` statement must not be used in the same\ncode block textually preceding that ``global`` statement.\n\nNames listed in a ``global`` statement must not be defined as formal\nparameters or in a ``for`` loop control target, ``class`` definition,\nfunction definition, or ``import`` statement.\n\n**CPython implementation detail:** The current implementation does not\nenforce the latter two restrictions, but programs should not abuse\nthis freedom, as future implementations may enforce them or silently\nchange the meaning of the program.\n\n**Programmer\'s note:** the ``global`` is a directive to the parser.\nIt applies only to code parsed at the same time as the ``global``\nstatement. In particular, a ``global`` statement contained in an\n``exec`` statement does not affect the code block *containing* the\n``exec`` statement, and code contained in an ``exec`` statement is\nunaffected by ``global`` statements in the code containing the\n``exec`` statement. The same applies to the ``eval()``,\n``execfile()`` and ``compile()`` functions.\n', 'id-classes': '\nReserved classes of identifiers\n*******************************\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n``_*``\n Not imported by ``from module import *``. The special identifier\n ``_`` is used in the interactive interpreter to store the result of\n the last evaluation; it is stored in the ``__builtin__`` module.\n When not in interactive mode, ``_`` has no special meaning and is\n not defined. See section *The import statement*.\n\n Note: The name ``_`` is often used in conjunction with\n internationalization; refer to the documentation for the\n ``gettext`` module for more information on this convention.\n\n``__*__``\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library). Current\n system names are discussed in the *Special method names* section\n and elsewhere. More will likely be defined in future versions of\n Python. *Any* use of ``__*__`` names, in any context, that does\n not follow explicitly documented use, is subject to breakage\n without warning.\n\n``__*``\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section *Identifiers (Names)*.\n', 'identifiers': '\nIdentifiers and keywords\n************************\n\nIdentifiers (also referred to as *names*) are described by the\nfollowing lexical definitions:\n\n identifier ::= (letter|"_") (letter | digit | "_")*\n letter ::= lowercase | uppercase\n lowercase ::= "a"..."z"\n uppercase ::= "A"..."Z"\n digit ::= "0"..."9"\n\nIdentifiers are unlimited in length. Case is significant.\n\n\nKeywords\n========\n\nThe following identifiers are used as reserved words, or *keywords* of\nthe language, and cannot be used as ordinary identifiers. They must\nbe spelled exactly as written here:\n\n and del from not while\n as elif global or with\n assert else if pass yield\n break except import print\n class exec in raise\n continue finally is return\n def for lambda try\n\nChanged in version 2.4: ``None`` became a constant and is now\nrecognized by the compiler as a name for the built-in object ``None``.\nAlthough it is not a keyword, you cannot assign a different object to\nit.\n\nChanged in version 2.5: Using ``as`` and ``with`` as identifiers\ntriggers a warning. To use them as keywords, enable the\n``with_statement`` future feature .\n\nChanged in version 2.6: ``as`` and ``with`` are full keywords.\n\n\nReserved classes of identifiers\n===============================\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n``_*``\n Not imported by ``from module import *``. The special identifier\n ``_`` is used in the interactive interpreter to store the result of\n the last evaluation; it is stored in the ``__builtin__`` module.\n When not in interactive mode, ``_`` has no special meaning and is\n not defined. See section *The import statement*.\n\n Note: The name ``_`` is often used in conjunction with\n internationalization; refer to the documentation for the\n ``gettext`` module for more information on this convention.\n\n``__*__``\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library). Current\n system names are discussed in the *Special method names* section\n and elsewhere. More will likely be defined in future versions of\n Python. *Any* use of ``__*__`` names, in any context, that does\n not follow explicitly documented use, is subject to breakage\n without warning.\n\n``__*``\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section *Identifiers (Names)*.\n', @@ -49,7 +49,7 @@ 'numbers': "\nNumeric literals\n****************\n\nThere are four types of numeric literals: plain integers, long\nintegers, floating point numbers, and imaginary numbers. There are no\ncomplex literals (complex numbers can be formed by adding a real\nnumber and an imaginary number).\n\nNote that numeric literals do not include a sign; a phrase like ``-1``\nis actually an expression composed of the unary operator '``-``' and\nthe literal ``1``.\n", 'numeric-types': '\nEmulating numeric types\n***********************\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations (``+``, ``-``, ``*``, ``//``, ``%``, ``divmod()``,\n ``pow()``, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``). For\n instance, to evaluate the expression ``x + y``, where *x* is an\n instance of a class that has an ``__add__()`` method,\n ``x.__add__(y)`` is called. The ``__divmod__()`` method should be\n the equivalent to using ``__floordiv__()`` and ``__mod__()``; it\n should not be related to ``__truediv__()`` (described below). Note\n that ``__pow__()`` should be defined to accept an optional third\n argument if the ternary version of the built-in ``pow()`` function\n is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return ``NotImplemented``.\n\nobject.__div__(self, other)\nobject.__truediv__(self, other)\n\n The division operator (``/``) is implemented by these methods. The\n ``__truediv__()`` method is used when ``__future__.division`` is in\n effect, otherwise ``__div__()`` is used. If only one of these two\n methods is defined, the object will not support division in the\n alternate context; ``TypeError`` will be raised instead.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rdiv__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations (``+``, ``-``, ``*``, ``/``, ``%``, ``divmod()``,\n ``pow()``, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``) with\n reflected (swapped) operands. These functions are only called if\n the left operand does not support the corresponding operation and\n the operands are of different types. [2] For instance, to evaluate\n the expression ``x - y``, where *y* is an instance of a class that\n has an ``__rsub__()`` method, ``y.__rsub__(x)`` is called if\n ``x.__sub__(y)`` returns *NotImplemented*.\n\n Note that ternary ``pow()`` will not try calling ``__rpow__()``\n (the coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left operand\'s\n type and that subclass provides the reflected method for the\n operation, this method will be called before the left operand\'s\n non-reflected method. This behavior allows subclasses to\n override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__idiv__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments (``+=``, ``-=``, ``*=``, ``/=``, ``//=``, ``%=``,\n ``**=``, ``<<=``, ``>>=``, ``&=``, ``^=``, ``|=``). These methods\n should attempt to do the operation in-place (modifying *self*) and\n return the result (which could be, but does not have to be,\n *self*). If a specific method is not defined, the augmented\n assignment falls back to the normal methods. For instance, to\n execute the statement ``x += y``, where *x* is an instance of a\n class that has an ``__iadd__()`` method, ``x.__iadd__(y)`` is\n called. If *x* is an instance of a class that does not define a\n ``__iadd__()`` method, ``x.__add__(y)`` and ``y.__radd__(x)`` are\n considered, as with the evaluation of ``x + y``.\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations (``-``, ``+``,\n ``abs()`` and ``~``).\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__long__(self)\nobject.__float__(self)\n\n Called to implement the built-in functions ``complex()``,\n ``int()``, ``long()``, and ``float()``. Should return a value of\n the appropriate type.\n\nobject.__oct__(self)\nobject.__hex__(self)\n\n Called to implement the built-in functions ``oct()`` and ``hex()``.\n Should return a string value.\n\nobject.__index__(self)\n\n Called to implement ``operator.index()``. Also called whenever\n Python needs an integer object (such as in slicing). Must return\n an integer (int or long).\n\n New in version 2.5.\n\nobject.__coerce__(self, other)\n\n Called to implement "mixed-mode" numeric arithmetic. Should either\n return a 2-tuple containing *self* and *other* converted to a\n common numeric type, or ``None`` if conversion is impossible. When\n the common type would be the type of ``other``, it is sufficient to\n return ``None``, since the interpreter will also ask the other\n object to attempt a coercion (but sometimes, if the implementation\n of the other type cannot be changed, it is useful to do the\n conversion to the other type here). A return value of\n ``NotImplemented`` is equivalent to returning ``None``.\n', 'objects': '\nObjects, values and types\n*************************\n\n*Objects* are Python\'s abstraction for data. All data in a Python\nprogram is represented by objects or by relations between objects. (In\na sense, and in conformance to Von Neumann\'s model of a "stored\nprogram computer," code is also represented by objects.)\n\nEvery object has an identity, a type and a value. An object\'s\n*identity* never changes once it has been created; you may think of it\nas the object\'s address in memory. The \'``is``\' operator compares the\nidentity of two objects; the ``id()`` function returns an integer\nrepresenting its identity (currently implemented as its address). An\nobject\'s *type* is also unchangeable. [1] An object\'s type determines\nthe operations that the object supports (e.g., "does it have a\nlength?") and also defines the possible values for objects of that\ntype. The ``type()`` function returns an object\'s type (which is an\nobject itself). The *value* of some objects can change. Objects\nwhose value can change are said to be *mutable*; objects whose value\nis unchangeable once they are created are called *immutable*. (The\nvalue of an immutable container object that contains a reference to a\nmutable object can change when the latter\'s value is changed; however\nthe container is still considered immutable, because the collection of\nobjects it contains cannot be changed. So, immutability is not\nstrictly the same as having an unchangeable value, it is more subtle.)\nAn object\'s mutability is determined by its type; for instance,\nnumbers, strings and tuples are immutable, while dictionaries and\nlists are mutable.\n\nObjects are never explicitly destroyed; however, when they become\nunreachable they may be garbage-collected. An implementation is\nallowed to postpone garbage collection or omit it altogether --- it is\na matter of implementation quality how garbage collection is\nimplemented, as long as no objects are collected that are still\nreachable.\n\n**CPython implementation detail:** CPython currently uses a reference-\ncounting scheme with (optional) delayed detection of cyclically linked\ngarbage, which collects most objects as soon as they become\nunreachable, but is not guaranteed to collect garbage containing\ncircular references. See the documentation of the ``gc`` module for\ninformation on controlling the collection of cyclic garbage. Other\nimplementations act differently and CPython may change. Do not depend\non immediate finalization of objects when they become unreachable (ex:\nalways close files).\n\nNote that the use of the implementation\'s tracing or debugging\nfacilities may keep objects alive that would normally be collectable.\nAlso note that catching an exception with a \'``try``...``except``\'\nstatement may keep objects alive.\n\nSome objects contain references to "external" resources such as open\nfiles or windows. It is understood that these resources are freed\nwhen the object is garbage-collected, but since garbage collection is\nnot guaranteed to happen, such objects also provide an explicit way to\nrelease the external resource, usually a ``close()`` method. Programs\nare strongly recommended to explicitly close such objects. The\n\'``try``...``finally``\' statement provides a convenient way to do\nthis.\n\nSome objects contain references to other objects; these are called\n*containers*. Examples of containers are tuples, lists and\ndictionaries. The references are part of a container\'s value. In\nmost cases, when we talk about the value of a container, we imply the\nvalues, not the identities of the contained objects; however, when we\ntalk about the mutability of a container, only the identities of the\nimmediately contained objects are implied. So, if an immutable\ncontainer (like a tuple) contains a reference to a mutable object, its\nvalue changes if that mutable object is changed.\n\nTypes affect almost all aspects of object behavior. Even the\nimportance of object identity is affected in some sense: for immutable\ntypes, operations that compute new values may actually return a\nreference to any existing object with the same type and value, while\nfor mutable objects this is not allowed. E.g., after ``a = 1; b =\n1``, ``a`` and ``b`` may or may not refer to the same object with the\nvalue one, depending on the implementation, but after ``c = []; d =\n[]``, ``c`` and ``d`` are guaranteed to refer to two different,\nunique, newly created empty lists. (Note that ``c = d = []`` assigns\nthe same object to both ``c`` and ``d``.)\n', - 'operator-summary': '\nSummary\n*******\n\nThe following table summarizes the operator precedences in Python,\nfrom lowest precedence (least binding) to highest precedence (most\nbinding). Operators in the same box have the same precedence. Unless\nthe syntax is explicitly given, operators are binary. Operators in\nthe same box group left to right (except for comparisons, including\ntests, which all have the same precedence and chain from left to right\n--- see section *Comparisons* --- and exponentiation, which groups\nfrom right to left).\n\n+-------------------------------------------------+---------------------------------------+\n| Operator | Description |\n+=================================================+=======================================+\n| ``lambda`` | Lambda expression |\n+-------------------------------------------------+---------------------------------------+\n| ``if`` -- ``else`` | Conditional expression |\n+-------------------------------------------------+---------------------------------------+\n| ``or`` | Boolean OR |\n+-------------------------------------------------+---------------------------------------+\n| ``and`` | Boolean AND |\n+-------------------------------------------------+---------------------------------------+\n| ``not`` *x* | Boolean NOT |\n+-------------------------------------------------+---------------------------------------+\n| ``in``, ``not`` ``in``, ``is``, ``is not``, | Comparisons, including membership |\n| ``<``, ``<=``, ``>``, ``>=``, ``<>``, ``!=``, | tests and identity tests, |\n| ``==`` | |\n+-------------------------------------------------+---------------------------------------+\n| ``|`` | Bitwise OR |\n+-------------------------------------------------+---------------------------------------+\n| ``^`` | Bitwise XOR |\n+-------------------------------------------------+---------------------------------------+\n| ``&`` | Bitwise AND |\n+-------------------------------------------------+---------------------------------------+\n| ``<<``, ``>>`` | Shifts |\n+-------------------------------------------------+---------------------------------------+\n| ``+``, ``-`` | Addition and subtraction |\n+-------------------------------------------------+---------------------------------------+\n| ``*``, ``/``, ``//``, ``%`` | Multiplication, division, remainder |\n| | [8] |\n+-------------------------------------------------+---------------------------------------+\n| ``+x``, ``-x``, ``~x`` | Positive, negative, bitwise NOT |\n+-------------------------------------------------+---------------------------------------+\n| ``**`` | Exponentiation [9] |\n+-------------------------------------------------+---------------------------------------+\n| ``x[index]``, ``x[index:index]``, | Subscription, slicing, call, |\n| ``x(arguments...)``, ``x.attribute`` | attribute reference |\n+-------------------------------------------------+---------------------------------------+\n| ``(expressions...)``, ``[expressions...]``, | Binding or tuple display, list |\n| ``{key:datum...}``, ```expressions...``` | display, dictionary display, string |\n| | conversion |\n+-------------------------------------------------+---------------------------------------+\n\n-[ Footnotes ]-\n\n[1] In Python 2.3 and later releases, a list comprehension "leaks" the\n control variables of each ``for`` it contains into the containing\n scope. However, this behavior is deprecated, and relying on it\n will not work in Python 3.0\n\n[2] While ``abs(x%y) < abs(y)`` is true mathematically, for floats it\n may not be true numerically due to roundoff. For example, and\n assuming a platform on which a Python float is an IEEE 754 double-\n precision number, in order that ``-1e-100 % 1e100`` have the same\n sign as ``1e100``, the computed result is ``-1e-100 + 1e100``,\n which is numerically exactly equal to ``1e100``. The function\n ``math.fmod()`` returns a result whose sign matches the sign of\n the first argument instead, and so returns ``-1e-100`` in this\n case. Which approach is more appropriate depends on the\n application.\n\n[3] If x is very close to an exact integer multiple of y, it\'s\n possible for ``floor(x/y)`` to be one larger than ``(x-x%y)/y``\n due to rounding. In such cases, Python returns the latter result,\n in order to preserve that ``divmod(x,y)[0] * y + x % y`` be very\n close to ``x``.\n\n[4] While comparisons between unicode strings make sense at the byte\n level, they may be counter-intuitive to users. For example, the\n strings ``u"\\u00C7"`` and ``u"\\u0043\\u0327"`` compare differently,\n even though they both represent the same unicode character (LATIN\n CAPITAL LETTER C WITH CEDILLA). To compare strings in a human\n recognizable way, compare using ``unicodedata.normalize()``.\n\n[5] The implementation computes this efficiently, without constructing\n lists or sorting.\n\n[6] Earlier versions of Python used lexicographic comparison of the\n sorted (key, value) lists, but this was very expensive for the\n common case of comparing for equality. An even earlier version of\n Python compared dictionaries by identity only, but this caused\n surprises because people expected to be able to test a dictionary\n for emptiness by comparing it to ``{}``.\n\n[7] Due to automatic garbage-collection, free lists, and the dynamic\n nature of descriptors, you may notice seemingly unusual behaviour\n in certain uses of the ``is`` operator, like those involving\n comparisons between instance methods, or constants. Check their\n documentation for more info.\n\n[8] The ``%`` operator is also used for string formatting; the same\n precedence applies.\n\n[9] The power operator ``**`` binds less tightly than an arithmetic or\n bitwise unary operator on its right, that is, ``2**-1`` is\n ``0.5``.\n', + 'operator-summary': '\nOperator precedence\n*******************\n\nThe following table summarizes the operator precedences in Python,\nfrom lowest precedence (least binding) to highest precedence (most\nbinding). Operators in the same box have the same precedence. Unless\nthe syntax is explicitly given, operators are binary. Operators in\nthe same box group left to right (except for comparisons, including\ntests, which all have the same precedence and chain from left to right\n--- see section *Comparisons* --- and exponentiation, which groups\nfrom right to left).\n\n+-------------------------------------------------+---------------------------------------+\n| Operator | Description |\n+=================================================+=======================================+\n| ``lambda`` | Lambda expression |\n+-------------------------------------------------+---------------------------------------+\n| ``if`` -- ``else`` | Conditional expression |\n+-------------------------------------------------+---------------------------------------+\n| ``or`` | Boolean OR |\n+-------------------------------------------------+---------------------------------------+\n| ``and`` | Boolean AND |\n+-------------------------------------------------+---------------------------------------+\n| ``not`` ``x`` | Boolean NOT |\n+-------------------------------------------------+---------------------------------------+\n| ``in``, ``not in``, ``is``, ``is not``, ``<``, | Comparisons, including membership |\n| ``<=``, ``>``, ``>=``, ``<>``, ``!=``, ``==`` | tests and identity tests, |\n+-------------------------------------------------+---------------------------------------+\n| ``|`` | Bitwise OR |\n+-------------------------------------------------+---------------------------------------+\n| ``^`` | Bitwise XOR |\n+-------------------------------------------------+---------------------------------------+\n| ``&`` | Bitwise AND |\n+-------------------------------------------------+---------------------------------------+\n| ``<<``, ``>>`` | Shifts |\n+-------------------------------------------------+---------------------------------------+\n| ``+``, ``-`` | Addition and subtraction |\n+-------------------------------------------------+---------------------------------------+\n| ``*``, ``/``, ``//``, ``%`` | Multiplication, division, remainder |\n| | [8] |\n+-------------------------------------------------+---------------------------------------+\n| ``+x``, ``-x``, ``~x`` | Positive, negative, bitwise NOT |\n+-------------------------------------------------+---------------------------------------+\n| ``**`` | Exponentiation [9] |\n+-------------------------------------------------+---------------------------------------+\n| ``x[index]``, ``x[index:index]``, | Subscription, slicing, call, |\n| ``x(arguments...)``, ``x.attribute`` | attribute reference |\n+-------------------------------------------------+---------------------------------------+\n| ``(expressions...)``, ``[expressions...]``, | Binding or tuple display, list |\n| ``{key: value...}``, ```expressions...``` | display, dictionary display, string |\n| | conversion |\n+-------------------------------------------------+---------------------------------------+\n\n-[ Footnotes ]-\n\n[1] In Python 2.3 and later releases, a list comprehension "leaks" the\n control variables of each ``for`` it contains into the containing\n scope. However, this behavior is deprecated, and relying on it\n will not work in Python 3.\n\n[2] While ``abs(x%y) < abs(y)`` is true mathematically, for floats it\n may not be true numerically due to roundoff. For example, and\n assuming a platform on which a Python float is an IEEE 754 double-\n precision number, in order that ``-1e-100 % 1e100`` have the same\n sign as ``1e100``, the computed result is ``-1e-100 + 1e100``,\n which is numerically exactly equal to ``1e100``. The function\n ``math.fmod()`` returns a result whose sign matches the sign of\n the first argument instead, and so returns ``-1e-100`` in this\n case. Which approach is more appropriate depends on the\n application.\n\n[3] If x is very close to an exact integer multiple of y, it\'s\n possible for ``floor(x/y)`` to be one larger than ``(x-x%y)/y``\n due to rounding. In such cases, Python returns the latter result,\n in order to preserve that ``divmod(x,y)[0] * y + x % y`` be very\n close to ``x``.\n\n[4] While comparisons between unicode strings make sense at the byte\n level, they may be counter-intuitive to users. For example, the\n strings ``u"\\u00C7"`` and ``u"\\u0043\\u0327"`` compare differently,\n even though they both represent the same unicode character (LATIN\n CAPITAL LETTER C WITH CEDILLA). To compare strings in a human\n recognizable way, compare using ``unicodedata.normalize()``.\n\n[5] The implementation computes this efficiently, without constructing\n lists or sorting.\n\n[6] Earlier versions of Python used lexicographic comparison of the\n sorted (key, value) lists, but this was very expensive for the\n common case of comparing for equality. An even earlier version of\n Python compared dictionaries by identity only, but this caused\n surprises because people expected to be able to test a dictionary\n for emptiness by comparing it to ``{}``.\n\n[7] Due to automatic garbage-collection, free lists, and the dynamic\n nature of descriptors, you may notice seemingly unusual behaviour\n in certain uses of the ``is`` operator, like those involving\n comparisons between instance methods, or constants. Check their\n documentation for more info.\n\n[8] The ``%`` operator is also used for string formatting; the same\n precedence applies.\n\n[9] The power operator ``**`` binds less tightly than an arithmetic or\n bitwise unary operator on its right, that is, ``2**-1`` is\n ``0.5``.\n', 'pass': '\nThe ``pass`` statement\n**********************\n\n pass_stmt ::= "pass"\n\n``pass`` is a null operation --- when it is executed, nothing happens.\nIt is useful as a placeholder when a statement is required\nsyntactically, but no code needs to be executed, for example:\n\n def f(arg): pass # a function that does nothing (yet)\n\n class C: pass # a class with no methods (yet)\n', 'power': '\nThe power operator\n******************\n\nThe power operator binds more tightly than unary operators on its\nleft; it binds less tightly than unary operators on its right. The\nsyntax is:\n\n power ::= primary ["**" u_expr]\n\nThus, in an unparenthesized sequence of power and unary operators, the\noperators are evaluated from right to left (this does not constrain\nthe evaluation order for the operands): ``-1**2`` results in ``-1``.\n\nThe power operator has the same semantics as the built-in ``pow()``\nfunction, when called with two arguments: it yields its left argument\nraised to the power of its right argument. The numeric arguments are\nfirst converted to a common type. The result type is that of the\narguments after coercion.\n\nWith mixed operand types, the coercion rules for binary arithmetic\noperators apply. For int and long int operands, the result has the\nsame type as the operands (after coercion) unless the second argument\nis negative; in that case, all arguments are converted to float and a\nfloat result is delivered. For example, ``10**2`` returns ``100``, but\n``10**-2`` returns ``0.01``. (This last feature was added in Python\n2.2. In Python 2.1 and before, if both arguments were of integer types\nand the second argument was negative, an exception was raised).\n\nRaising ``0.0`` to a negative power results in a\n``ZeroDivisionError``. Raising a negative number to a fractional power\nresults in a ``ValueError``.\n', 'raise': '\nThe ``raise`` statement\n***********************\n\n raise_stmt ::= "raise" [expression ["," expression ["," expression]]]\n\nIf no expressions are present, ``raise`` re-raises the last exception\nthat was active in the current scope. If no exception is active in\nthe current scope, a ``TypeError`` exception is raised indicating that\nthis is an error (if running under IDLE, a ``Queue.Empty`` exception\nis raised instead).\n\nOtherwise, ``raise`` evaluates the expressions to get three objects,\nusing ``None`` as the value of omitted expressions. The first two\nobjects are used to determine the *type* and *value* of the exception.\n\nIf the first object is an instance, the type of the exception is the\nclass of the instance, the instance itself is the value, and the\nsecond object must be ``None``.\n\nIf the first object is a class, it becomes the type of the exception.\nThe second object is used to determine the exception value: If it is\nan instance of the class, the instance becomes the exception value. If\nthe second object is a tuple, it is used as the argument list for the\nclass constructor; if it is ``None``, an empty argument list is used,\nand any other object is treated as a single argument to the\nconstructor. The instance so created by calling the constructor is\nused as the exception value.\n\nIf a third object is present and not ``None``, it must be a traceback\nobject (see section *The standard type hierarchy*), and it is\nsubstituted instead of the current location as the place where the\nexception occurred. If the third object is present and not a\ntraceback object or ``None``, a ``TypeError`` exception is raised.\nThe three-expression form of ``raise`` is useful to re-raise an\nexception transparently in an except clause, but ``raise`` with no\nexpressions should be preferred if the exception to be re-raised was\nthe most recently active exception in the current scope.\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information about handling exceptions is in section\n*The try statement*.\n', @@ -58,18 +58,18 @@ 'shifting': '\nShifting operations\n*******************\n\nThe shifting operations have lower priority than the arithmetic\noperations:\n\n shift_expr ::= a_expr | shift_expr ( "<<" | ">>" ) a_expr\n\nThese operators accept plain or long integers as arguments. The\narguments are converted to a common type. They shift the first\nargument to the left or right by the number of bits given by the\nsecond argument.\n\nA right shift by *n* bits is defined as division by ``pow(2, n)``. A\nleft shift by *n* bits is defined as multiplication with ``pow(2,\nn)``. Negative shift counts raise a ``ValueError`` exception.\n\nNote: In the current implementation, the right-hand operand is required to\n be at most ``sys.maxsize``. If the right-hand operand is larger\n than ``sys.maxsize`` an ``OverflowError`` exception is raised.\n', 'slicings': '\nSlicings\n********\n\nA slicing selects a range of items in a sequence object (e.g., a\nstring, tuple or list). Slicings may be used as expressions or as\ntargets in assignment or ``del`` statements. The syntax for a\nslicing:\n\n slicing ::= simple_slicing | extended_slicing\n simple_slicing ::= primary "[" short_slice "]"\n extended_slicing ::= primary "[" slice_list "]"\n slice_list ::= slice_item ("," slice_item)* [","]\n slice_item ::= expression | proper_slice | ellipsis\n proper_slice ::= short_slice | long_slice\n short_slice ::= [lower_bound] ":" [upper_bound]\n long_slice ::= short_slice ":" [stride]\n lower_bound ::= expression\n upper_bound ::= expression\n stride ::= expression\n ellipsis ::= "..."\n\nThere is ambiguity in the formal syntax here: anything that looks like\nan expression list also looks like a slice list, so any subscription\ncan be interpreted as a slicing. Rather than further complicating the\nsyntax, this is disambiguated by defining that in this case the\ninterpretation as a subscription takes priority over the\ninterpretation as a slicing (this is the case if the slice list\ncontains no proper slice nor ellipses). Similarly, when the slice\nlist has exactly one short slice and no trailing comma, the\ninterpretation as a simple slicing takes priority over that as an\nextended slicing.\n\nThe semantics for a simple slicing are as follows. The primary must\nevaluate to a sequence object. The lower and upper bound expressions,\nif present, must evaluate to plain integers; defaults are zero and the\n``sys.maxint``, respectively. If either bound is negative, the\nsequence\'s length is added to it. The slicing now selects all items\nwith index *k* such that ``i <= k < j`` where *i* and *j* are the\nspecified lower and upper bounds. This may be an empty sequence. It\nis not an error if *i* or *j* lie outside the range of valid indexes\n(such items don\'t exist so they aren\'t selected).\n\nThe semantics for an extended slicing are as follows. The primary\nmust evaluate to a mapping object, and it is indexed with a key that\nis constructed from the slice list, as follows. If the slice list\ncontains at least one comma, the key is a tuple containing the\nconversion of the slice items; otherwise, the conversion of the lone\nslice item is the key. The conversion of a slice item that is an\nexpression is that expression. The conversion of an ellipsis slice\nitem is the built-in ``Ellipsis`` object. The conversion of a proper\nslice is a slice object (see section *The standard type hierarchy*)\nwhose ``start``, ``stop`` and ``step`` attributes are the values of\nthe expressions given as lower bound, upper bound and stride,\nrespectively, substituting ``None`` for missing expressions.\n', 'specialattrs': '\nSpecial Attributes\n******************\n\nThe implementation adds a few special read-only attributes to several\nobject types, where they are relevant. Some of these are not reported\nby the ``dir()`` built-in function.\n\nobject.__dict__\n\n A dictionary or other mapping object used to store an object\'s\n (writable) attributes.\n\nobject.__methods__\n\n Deprecated since version 2.2: Use the built-in function ``dir()``\n to get a list of an object\'s attributes. This attribute is no\n longer available.\n\nobject.__members__\n\n Deprecated since version 2.2: Use the built-in function ``dir()``\n to get a list of an object\'s attributes. This attribute is no\n longer available.\n\ninstance.__class__\n\n The class to which a class instance belongs.\n\nclass.__bases__\n\n The tuple of base classes of a class object.\n\nclass.__name__\n\n The name of the class or type.\n\nThe following attributes are only supported by *new-style class*es.\n\nclass.__mro__\n\n This attribute is a tuple of classes that are considered when\n looking for base classes during method resolution.\n\nclass.mro()\n\n This method can be overridden by a metaclass to customize the\n method resolution order for its instances. It is called at class\n instantiation, and its result is stored in ``__mro__``.\n\nclass.__subclasses__()\n\n Each new-style class keeps a list of weak references to its\n immediate subclasses. This method returns a list of all those\n references still alive. Example:\n\n >>> int.__subclasses__()\n []\n\n-[ Footnotes ]-\n\n[1] Additional information on these special methods may be found in\n the Python Reference Manual (*Basic customization*).\n\n[2] As a consequence, the list ``[1, 2]`` is considered equal to\n ``[1.0, 2.0]``, and similarly for tuples.\n\n[3] They must have since the parser can\'t tell the type of the\n operands.\n\n[4] Cased characters are those with general category property being\n one of "Lu" (Letter, uppercase), "Ll" (Letter, lowercase), or "Lt"\n (Letter, titlecase).\n\n[5] To format only a tuple you should therefore provide a singleton\n tuple whose only element is the tuple to be formatted.\n\n[6] The advantage of leaving the newline on is that returning an empty\n string is then an unambiguous EOF indication. It is also possible\n (in cases where it might matter, for example, if you want to make\n an exact copy of a file while scanning its lines) to tell whether\n the last line of a file ended in a newline or not (yes this\n happens!).\n', - 'specialnames': '\nSpecial method names\n********************\n\nA class can implement certain operations that are invoked by special\nsyntax (such as arithmetic operations or subscripting and slicing) by\ndefining methods with special names. This is Python\'s approach to\n*operator overloading*, allowing classes to define their own behavior\nwith respect to language operators. For instance, if a class defines\na method named ``__getitem__()``, and ``x`` is an instance of this\nclass, then ``x[i]`` is roughly equivalent to ``x.__getitem__(i)`` for\nold-style classes and ``type(x).__getitem__(x, i)`` for new-style\nclasses. Except where mentioned, attempts to execute an operation\nraise an exception when no appropriate method is defined (typically\n``AttributeError`` or ``TypeError``).\n\nWhen implementing a class that emulates any built-in type, it is\nimportant that the emulation only be implemented to the degree that it\nmakes sense for the object being modelled. For example, some\nsequences may work well with retrieval of individual elements, but\nextracting a slice may not make sense. (One example of this is the\n``NodeList`` interface in the W3C\'s Document Object Model.)\n\n\nBasic customization\n===================\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. ``__new__()`` is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of ``__new__()`` should be the new object instance (usually\n an instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s ``__new__()`` method using\n ``super(currentclass, cls).__new__(cls[, ...])`` with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If ``__new__()`` returns an instance of *cls*, then the new\n instance\'s ``__init__()`` method will be invoked like\n ``__init__(self[, ...])``, where *self* is the new instance and the\n remaining arguments are the same as were passed to ``__new__()``.\n\n If ``__new__()`` does not return an instance of *cls*, then the new\n instance\'s ``__init__()`` method will not be invoked.\n\n ``__new__()`` is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called when the instance is created. The arguments are those\n passed to the class constructor expression. If a base class has an\n ``__init__()`` method, the derived class\'s ``__init__()`` method,\n if any, must explicitly call it to ensure proper initialization of\n the base class part of the instance; for example:\n ``BaseClass.__init__(self, [args...])``. As a special constraint\n on constructors, no value may be returned; doing so will cause a\n ``TypeError`` to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a ``__del__()`` method,\n the derived class\'s ``__del__()`` method, if any, must explicitly\n call it to ensure proper deletion of the base class part of the\n instance. Note that it is possible (though not recommended!) for\n the ``__del__()`` method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n ``__del__()`` methods are called for objects that still exist when\n the interpreter exits.\n\n Note: ``del x`` doesn\'t directly call ``x.__del__()`` --- the former\n decrements the reference count for ``x`` by one, and the latter\n is only called when ``x``\'s reference count reaches zero. Some\n common situations that may prevent the reference count of an\n object from going to zero include: circular references between\n objects (e.g., a doubly-linked list or a tree data structure with\n parent and child pointers); a reference to the object on the\n stack frame of a function that caught an exception (the traceback\n stored in ``sys.exc_traceback`` keeps the stack frame alive); or\n a reference to the object on the stack frame that raised an\n unhandled exception in interactive mode (the traceback stored in\n ``sys.last_traceback`` keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the latter two situations can be resolved by storing ``None`` in\n ``sys.exc_traceback`` or ``sys.last_traceback``. Circular\n references which are garbage are detected when the option cycle\n detector is enabled (it\'s on by default), but can only be cleaned\n up if there are no Python-level ``__del__()`` methods involved.\n Refer to the documentation for the ``gc`` module for more\n information about how ``__del__()`` methods are handled by the\n cycle detector, particularly the description of the ``garbage``\n value.\n\n Warning: Due to the precarious circumstances under which ``__del__()``\n methods are invoked, exceptions that occur during their execution\n are ignored, and a warning is printed to ``sys.stderr`` instead.\n Also, when ``__del__()`` is invoked in response to a module being\n deleted (e.g., when execution of the program is done), other\n globals referenced by the ``__del__()`` method may already have\n been deleted or in the process of being torn down (e.g. the\n import machinery shutting down). For this reason, ``__del__()``\n methods should do the absolute minimum needed to maintain\n external invariants. Starting with version 1.5, Python\n guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the ``__del__()`` method is called.\n\n See also the *-R* command-line option.\n\nobject.__repr__(self)\n\n Called by the ``repr()`` built-in function and by string\n conversions (reverse quotes) to compute the "official" string\n representation of an object. If at all possible, this should look\n like a valid Python expression that could be used to recreate an\n object with the same value (given an appropriate environment). If\n this is not possible, a string of the form ``<...some useful\n description...>`` should be returned. The return value must be a\n string object. If a class defines ``__repr__()`` but not\n ``__str__()``, then ``__repr__()`` is also used when an "informal"\n string representation of instances of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by the ``str()`` built-in function and by the ``print``\n statement to compute the "informal" string representation of an\n object. This differs from ``__repr__()`` in that it does not have\n to be a valid Python expression: a more convenient or concise\n representation may be used instead. The return value must be a\n string object.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n New in version 2.1.\n\n These are the so-called "rich comparison" methods, and are called\n for comparison operators in preference to ``__cmp__()`` below. The\n correspondence between operator symbols and method names is as\n follows: ``xy`` call ``x.__ne__(y)``, ``x>y`` calls ``x.__gt__(y)``, and\n ``x>=y`` calls ``x.__ge__(y)``.\n\n A rich comparison method may return the singleton\n ``NotImplemented`` if it does not implement the operation for a\n given pair of arguments. By convention, ``False`` and ``True`` are\n returned for a successful comparison. However, these methods can\n return any value, so if the comparison operator is used in a\n Boolean context (e.g., in the condition of an ``if`` statement),\n Python will call ``bool()`` on the value to determine if the result\n is true or false.\n\n There are no implied relationships among the comparison operators.\n The truth of ``x==y`` does not imply that ``x!=y`` is false.\n Accordingly, when defining ``__eq__()``, one should also define\n ``__ne__()`` so that the operators will behave as expected. See\n the paragraph on ``__hash__()`` for some important notes on\n creating *hashable* objects which support custom comparison\n operations and are usable as dictionary keys.\n\n There are no swapped-argument versions of these methods (to be used\n when the left argument does not support the operation but the right\n argument does); rather, ``__lt__()`` and ``__gt__()`` are each\n other\'s reflection, ``__le__()`` and ``__ge__()`` are each other\'s\n reflection, and ``__eq__()`` and ``__ne__()`` are their own\n reflection.\n\n Arguments to rich comparison methods are never coerced.\n\n To automatically generate ordering operations from a single root\n operation, see ``functools.total_ordering()``.\n\nobject.__cmp__(self, other)\n\n Called by comparison operations if rich comparison (see above) is\n not defined. Should return a negative integer if ``self < other``,\n zero if ``self == other``, a positive integer if ``self > other``.\n If no ``__cmp__()``, ``__eq__()`` or ``__ne__()`` operation is\n defined, class instances are compared by object identity\n ("address"). See also the description of ``__hash__()`` for some\n important notes on creating *hashable* objects which support custom\n comparison operations and are usable as dictionary keys. (Note: the\n restriction that exceptions are not propagated by ``__cmp__()`` has\n been removed since Python 1.5.)\n\nobject.__rcmp__(self, other)\n\n Changed in version 2.1: No longer supported.\n\nobject.__hash__(self)\n\n Called by built-in function ``hash()`` and for operations on\n members of hashed collections including ``set``, ``frozenset``, and\n ``dict``. ``__hash__()`` should return an integer. The only\n required property is that objects which compare equal have the same\n hash value; it is advised to somehow mix together (e.g. using\n exclusive or) the hash values for the components of the object that\n also play a part in comparison of objects.\n\n If a class does not define a ``__cmp__()`` or ``__eq__()`` method\n it should not define a ``__hash__()`` operation either; if it\n defines ``__cmp__()`` or ``__eq__()`` but not ``__hash__()``, its\n instances will not be usable in hashed collections. If a class\n defines mutable objects and implements a ``__cmp__()`` or\n ``__eq__()`` method, it should not implement ``__hash__()``, since\n hashable collection implementations require that a object\'s hash\n value is immutable (if the object\'s hash value changes, it will be\n in the wrong hash bucket).\n\n User-defined classes have ``__cmp__()`` and ``__hash__()`` methods\n by default; with them, all objects compare unequal (except with\n themselves) and ``x.__hash__()`` returns ``id(x)``.\n\n Classes which inherit a ``__hash__()`` method from a parent class\n but change the meaning of ``__cmp__()`` or ``__eq__()`` such that\n the hash value returned is no longer appropriate (e.g. by switching\n to a value-based concept of equality instead of the default\n identity based equality) can explicitly flag themselves as being\n unhashable by setting ``__hash__ = None`` in the class definition.\n Doing so means that not only will instances of the class raise an\n appropriate ``TypeError`` when a program attempts to retrieve their\n hash value, but they will also be correctly identified as\n unhashable when checking ``isinstance(obj, collections.Hashable)``\n (unlike classes which define their own ``__hash__()`` to explicitly\n raise ``TypeError``).\n\n Changed in version 2.5: ``__hash__()`` may now also return a long\n integer object; the 32-bit integer is then derived from the hash of\n that object.\n\n Changed in version 2.6: ``__hash__`` may now be set to ``None`` to\n explicitly flag instances of a class as unhashable.\n\nobject.__nonzero__(self)\n\n Called to implement truth value testing and the built-in operation\n ``bool()``; should return ``False`` or ``True``, or their integer\n equivalents ``0`` or ``1``. When this method is not defined,\n ``__len__()`` is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither ``__len__()`` nor ``__nonzero__()``, all its instances are\n considered true.\n\nobject.__unicode__(self)\n\n Called to implement ``unicode()`` built-in; should return a Unicode\n object. When this method is not defined, string conversion is\n attempted, and the result of string conversion is converted to\n Unicode using the system default encoding.\n\n\nCustomizing attribute access\n============================\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of ``x.name``)\nfor class instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for ``self``). ``name`` is the attribute name.\n This method should return the (computed) attribute value or raise\n an ``AttributeError`` exception.\n\n Note that if the attribute is found through the normal mechanism,\n ``__getattr__()`` is not called. (This is an intentional asymmetry\n between ``__getattr__()`` and ``__setattr__()``.) This is done both\n for efficiency reasons and because otherwise ``__getattr__()``\n would have no way to access other attributes of the instance. Note\n that at least for instance variables, you can fake total control by\n not inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n ``__getattribute__()`` method below for a way to actually get total\n control in new-style classes.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If ``__setattr__()`` wants to assign to an instance attribute, it\n should not simply execute ``self.name = value`` --- this would\n cause a recursive call to itself. Instead, it should insert the\n value in the dictionary of instance attributes, e.g.,\n ``self.__dict__[name] = value``. For new-style classes, rather\n than accessing the instance dictionary, it should call the base\n class method with the same name, for example,\n ``object.__setattr__(self, name, value)``.\n\nobject.__delattr__(self, name)\n\n Like ``__setattr__()`` but for attribute deletion instead of\n assignment. This should only be implemented if ``del obj.name`` is\n meaningful for the object.\n\n\nMore attribute access for new-style classes\n-------------------------------------------\n\nThe following methods only apply to new-style classes.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines\n ``__getattr__()``, the latter will not be called unless\n ``__getattribute__()`` either calls it explicitly or raises an\n ``AttributeError``. This method should return the (computed)\n attribute value or raise an ``AttributeError`` exception. In order\n to avoid infinite recursion in this method, its implementation\n should always call the base class method with the same name to\n access any attributes it needs, for example,\n ``object.__getattribute__(self, name)``.\n\n Note: This method may still be bypassed when looking up special methods\n as the result of implicit invocation via language syntax or\n built-in functions. See *Special method lookup for new-style\n classes*.\n\n\nImplementing Descriptors\n------------------------\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' ``__dict__``.\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or ``None`` when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an\n ``AttributeError`` exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\n\nInvoking Descriptors\n--------------------\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: ``__get__()``, ``__set__()``, and\n``__delete__()``. If any of those methods are defined for an object,\nit is said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, ``a.x`` has a\nlookup chain starting with ``a.__dict__[\'x\']``, then\n``type(a).__dict__[\'x\']``, and continuing through the base classes of\n``type(a)`` excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called. Note that descriptors are only invoked for new\nstyle objects or classes (ones that subclass ``object()`` or\n``type()``).\n\nThe starting point for descriptor invocation is a binding, ``a.x``.\nHow the arguments are assembled depends on ``a``:\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: ``x.__get__(a)``.\n\nInstance Binding\n If binding to a new-style object instance, ``a.x`` is transformed\n into the call: ``type(a).__dict__[\'x\'].__get__(a, type(a))``.\n\nClass Binding\n If binding to a new-style class, ``A.x`` is transformed into the\n call: ``A.__dict__[\'x\'].__get__(None, A)``.\n\nSuper Binding\n If ``a`` is an instance of ``super``, then the binding ``super(B,\n obj).m()`` searches ``obj.__class__.__mro__`` for the base class\n ``A`` immediately preceding ``B`` and then invokes the descriptor\n with the call: ``A.__dict__[\'m\'].__get__(obj, obj.__class__)``.\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of ``__get__()``, ``__set__()`` and ``__delete__()``.\nIf it does not define ``__get__()``, then accessing the attribute will\nreturn the descriptor object itself unless there is a value in the\nobject\'s instance dictionary. If the descriptor defines ``__set__()``\nand/or ``__delete__()``, it is a data descriptor; if it defines\nneither, it is a non-data descriptor. Normally, data descriptors\ndefine both ``__get__()`` and ``__set__()``, while non-data\ndescriptors have just the ``__get__()`` method. Data descriptors with\n``__set__()`` and ``__get__()`` defined always override a redefinition\nin an instance dictionary. In contrast, non-data descriptors can be\noverridden by instances.\n\nPython methods (including ``staticmethod()`` and ``classmethod()``)\nare implemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe ``property()`` function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n---------\n\nBy default, instances of both old and new-style classes have a\ndictionary for attribute storage. This wastes space for objects\nhaving very few instance variables. The space consumption can become\nacute when creating large numbers of instances.\n\nThe default can be overridden by defining *__slots__* in a new-style\nclass definition. The *__slots__* declaration takes a sequence of\ninstance variables and reserves just enough space in each instance to\nhold a value for each variable. Space is saved because *__dict__* is\nnot created for each instance.\n\n__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. If defined in a\n new-style class, *__slots__* reserves space for the declared\n variables and prevents the automatic creation of *__dict__* and\n *__weakref__* for each instance.\n\n New in version 2.2.\n\nNotes on using *__slots__*\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises ``AttributeError``. If\n dynamic assignment of new variables is desired, then add\n ``\'__dict__\'`` to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding ``\'__dict__\'`` to the\n *__slots__* declaration would not enable the assignment of new\n attributes not specifically listed in the sequence of instance\n variable names.\n\n* Without a *__weakref__* variable for each instance, classes defining\n *__slots__* do not support weak references to its instances. If weak\n reference support is needed, then add ``\'__weakref__\'`` to the\n sequence of strings in the *__slots__* declaration.\n\n Changed in version 2.3: Previously, adding ``\'__weakref__\'`` to the\n *__slots__* declaration would not enable support for weak\n references.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (*Implementing Descriptors*) for each variable name. As\n a result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the instance\n variable defined by the base class slot is inaccessible (except by\n retrieving its descriptor directly from the base class). This\n renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as ``long``, ``str`` and\n ``tuple``.\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings may\n also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n Changed in version 2.6: Previously, *__class__* assignment raised an\n error if either new or old class had *__slots__*.\n\n\nCustomizing class creation\n==========================\n\nBy default, new-style classes are constructed using ``type()``. A\nclass definition is read into a separate namespace and the value of\nclass name is bound to the result of ``type(name, bases, dict)``.\n\nWhen the class definition is read, if *__metaclass__* is defined then\nthe callable assigned to it will be called instead of ``type()``. This\nallows classes or functions to be written which monitor or alter the\nclass creation process:\n\n* Modifying the class dictionary prior to the class being created.\n\n* Returning an instance of another class -- essentially performing the\n role of a factory function.\n\nThese steps will have to be performed in the metaclass\'s ``__new__()``\nmethod -- ``type.__new__()`` can then be called from this method to\ncreate a class with different properties. This example adds a new\nelement to the class dictionary before creating the class:\n\n class metacls(type):\n def __new__(mcs, name, bases, dict):\n dict[\'foo\'] = \'metacls was here\'\n return type.__new__(mcs, name, bases, dict)\n\nYou can of course also override other class methods (or add new\nmethods); for example defining a custom ``__call__()`` method in the\nmetaclass allows custom behavior when the class is called, e.g. not\nalways creating a new instance.\n\n__metaclass__\n\n This variable can be any callable accepting arguments for ``name``,\n ``bases``, and ``dict``. Upon class creation, the callable is used\n instead of the built-in ``type()``.\n\n New in version 2.2.\n\nThe appropriate metaclass is determined by the following precedence\nrules:\n\n* If ``dict[\'__metaclass__\']`` exists, it is used.\n\n* Otherwise, if there is at least one base class, its metaclass is\n used (this looks for a *__class__* attribute first and if not found,\n uses its type).\n\n* Otherwise, if a global variable named __metaclass__ exists, it is\n used.\n\n* Otherwise, the old-style, classic metaclass (types.ClassType) is\n used.\n\nThe potential uses for metaclasses are boundless. Some ideas that have\nbeen explored including logging, interface checking, automatic\ndelegation, automatic property creation, proxies, frameworks, and\nautomatic resource locking/synchronization.\n\n\nCustomizing instance and subclass checks\n========================================\n\nNew in version 2.6.\n\nThe following methods are used to override the default behavior of the\n``isinstance()`` and ``issubclass()`` built-in functions.\n\nIn particular, the metaclass ``abc.ABCMeta`` implements these methods\nin order to allow the addition of Abstract Base Classes (ABCs) as\n"virtual base classes" to any class or type (including built-in\ntypes), including other ABCs.\n\nclass.__instancecheck__(self, instance)\n\n Return true if *instance* should be considered a (direct or\n indirect) instance of *class*. If defined, called to implement\n ``isinstance(instance, class)``.\n\nclass.__subclasscheck__(self, subclass)\n\n Return true if *subclass* should be considered a (direct or\n indirect) subclass of *class*. If defined, called to implement\n ``issubclass(subclass, class)``.\n\nNote that these methods are looked up on the type (metaclass) of a\nclass. They cannot be defined as class methods in the actual class.\nThis is consistent with the lookup of special methods that are called\non instances, only in this case the instance is itself a class.\n\nSee also:\n\n **PEP 3119** - Introducing Abstract Base Classes\n Includes the specification for customizing ``isinstance()`` and\n ``issubclass()`` behavior through ``__instancecheck__()`` and\n ``__subclasscheck__()``, with motivation for this functionality\n in the context of adding Abstract Base Classes (see the ``abc``\n module) to the language.\n\n\nEmulating callable objects\n==========================\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, ``x(arg1, arg2, ...)`` is a shorthand for\n ``x.__call__(arg1, arg2, ...)``.\n\n\nEmulating container types\n=========================\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which ``0 <= k < N``\nwhere *N* is the length of the sequence, or slice objects, which\ndefine a range of items. (For backwards compatibility, the method\n``__getslice__()`` (see below) can also be defined to handle simple,\nbut not extended slices.) It is also recommended that mappings provide\nthe methods ``keys()``, ``values()``, ``items()``, ``has_key()``,\n``get()``, ``clear()``, ``setdefault()``, ``iterkeys()``,\n``itervalues()``, ``iteritems()``, ``pop()``, ``popitem()``,\n``copy()``, and ``update()`` behaving similar to those for Python\'s\nstandard dictionary objects. The ``UserDict`` module provides a\n``DictMixin`` class to help create those methods from a base set of\n``__getitem__()``, ``__setitem__()``, ``__delitem__()``, and\n``keys()``. Mutable sequences should provide methods ``append()``,\n``count()``, ``index()``, ``extend()``, ``insert()``, ``pop()``,\n``remove()``, ``reverse()`` and ``sort()``, like Python standard list\nobjects. Finally, sequence types should implement addition (meaning\nconcatenation) and multiplication (meaning repetition) by defining the\nmethods ``__add__()``, ``__radd__()``, ``__iadd__()``, ``__mul__()``,\n``__rmul__()`` and ``__imul__()`` described below; they should not\ndefine ``__coerce__()`` or other numerical operators. It is\nrecommended that both mappings and sequences implement the\n``__contains__()`` method to allow efficient use of the ``in``\noperator; for mappings, ``in`` should be equivalent of ``has_key()``;\nfor sequences, it should search through the values. It is further\nrecommended that both mappings and sequences implement the\n``__iter__()`` method to allow efficient iteration through the\ncontainer; for mappings, ``__iter__()`` should be the same as\n``iterkeys()``; for sequences, it should iterate through the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function ``len()``. Should return\n the length of the object, an integer ``>=`` 0. Also, an object\n that doesn\'t define a ``__nonzero__()`` method and whose\n ``__len__()`` method returns zero is considered to be false in a\n Boolean context.\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of ``self[key]``. For sequence\n types, the accepted keys should be integers and slice objects.\n Note that the special interpretation of negative indexes (if the\n class wishes to emulate a sequence type) is up to the\n ``__getitem__()`` method. If *key* is of an inappropriate type,\n ``TypeError`` may be raised; if of a value outside the set of\n indexes for the sequence (after any special interpretation of\n negative values), ``IndexError`` should be raised. For mapping\n types, if *key* is missing (not in the container), ``KeyError``\n should be raised.\n\n Note: ``for`` loops expect that an ``IndexError`` will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to ``self[key]``. Same note as for\n ``__getitem__()``. This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the ``__getitem__()`` method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of ``self[key]``. Same note as for\n ``__getitem__()``. This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the ``__getitem__()``\n method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container, and should also be made\n available as the method ``iterkeys()``.\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see *Iterator Types*.\n\nobject.__reversed__(self)\n\n Called (if present) by the ``reversed()`` built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the ``__reversed__()`` method is not provided, the\n ``reversed()`` built-in will fall back to using the sequence\n protocol (``__len__()`` and ``__getitem__()``). Objects that\n support the sequence protocol should only provide\n ``__reversed__()`` if they can provide an implementation that is\n more efficient than the one provided by ``reversed()``.\n\n New in version 2.6.\n\nThe membership test operators (``in`` and ``not in``) are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define ``__contains__()``, the membership\n test first tries iteration via ``__iter__()``, then the old\n sequence iteration protocol via ``__getitem__()``, see *this\n section in the language reference*.\n\n\nAdditional methods for emulation of sequence types\n==================================================\n\nThe following optional methods can be defined to further emulate\nsequence objects. Immutable sequences methods should at most only\ndefine ``__getslice__()``; mutable sequences might define all three\nmethods.\n\nobject.__getslice__(self, i, j)\n\n Deprecated since version 2.0: Support slice objects as parameters\n to the ``__getitem__()`` method. (However, built-in types in\n CPython currently still implement ``__getslice__()``. Therefore,\n you have to override it in derived classes when implementing\n slicing.)\n\n Called to implement evaluation of ``self[i:j]``. The returned\n object should be of the same type as *self*. Note that missing *i*\n or *j* in the slice expression are replaced by zero or\n ``sys.maxint``, respectively. If negative indexes are used in the\n slice, the length of the sequence is added to that index. If the\n instance does not implement the ``__len__()`` method, an\n ``AttributeError`` is raised. No guarantee is made that indexes\n adjusted this way are not still negative. Indexes which are\n greater than the length of the sequence are not modified. If no\n ``__getslice__()`` is found, a slice object is created instead, and\n passed to ``__getitem__()`` instead.\n\nobject.__setslice__(self, i, j, sequence)\n\n Called to implement assignment to ``self[i:j]``. Same notes for *i*\n and *j* as for ``__getslice__()``.\n\n This method is deprecated. If no ``__setslice__()`` is found, or\n for extended slicing of the form ``self[i:j:k]``, a slice object is\n created, and passed to ``__setitem__()``, instead of\n ``__setslice__()`` being called.\n\nobject.__delslice__(self, i, j)\n\n Called to implement deletion of ``self[i:j]``. Same notes for *i*\n and *j* as for ``__getslice__()``. This method is deprecated. If no\n ``__delslice__()`` is found, or for extended slicing of the form\n ``self[i:j:k]``, a slice object is created, and passed to\n ``__delitem__()``, instead of ``__delslice__()`` being called.\n\nNotice that these methods are only invoked when a single slice with a\nsingle colon is used, and the slice method is available. For slice\noperations involving extended slice notation, or in absence of the\nslice methods, ``__getitem__()``, ``__setitem__()`` or\n``__delitem__()`` is called with a slice object as argument.\n\nThe following example demonstrate how to make your program or module\ncompatible with earlier versions of Python (assuming that methods\n``__getitem__()``, ``__setitem__()`` and ``__delitem__()`` support\nslice objects as arguments):\n\n class MyClass:\n ...\n def __getitem__(self, index):\n ...\n def __setitem__(self, index, value):\n ...\n def __delitem__(self, index):\n ...\n\n if sys.version_info < (2, 0):\n # They won\'t be defined if version is at least 2.0 final\n\n def __getslice__(self, i, j):\n return self[max(0, i):max(0, j):]\n def __setslice__(self, i, j, seq):\n self[max(0, i):max(0, j):] = seq\n def __delslice__(self, i, j):\n del self[max(0, i):max(0, j):]\n ...\n\nNote the calls to ``max()``; these are necessary because of the\nhandling of negative indices before the ``__*slice__()`` methods are\ncalled. When negative indexes are used, the ``__*item__()`` methods\nreceive them as provided, but the ``__*slice__()`` methods get a\n"cooked" form of the index values. For each negative index value, the\nlength of the sequence is added to the index before calling the method\n(which may still result in a negative index); this is the customary\nhandling of negative indexes by the built-in sequence types, and the\n``__*item__()`` methods are expected to do this as well. However,\nsince they should already be doing that, negative indexes cannot be\npassed in; they must be constrained to the bounds of the sequence\nbefore being passed to the ``__*item__()`` methods. Calling ``max(0,\ni)`` conveniently returns the proper value.\n\n\nEmulating numeric types\n=======================\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations (``+``, ``-``, ``*``, ``//``, ``%``, ``divmod()``,\n ``pow()``, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``). For\n instance, to evaluate the expression ``x + y``, where *x* is an\n instance of a class that has an ``__add__()`` method,\n ``x.__add__(y)`` is called. The ``__divmod__()`` method should be\n the equivalent to using ``__floordiv__()`` and ``__mod__()``; it\n should not be related to ``__truediv__()`` (described below). Note\n that ``__pow__()`` should be defined to accept an optional third\n argument if the ternary version of the built-in ``pow()`` function\n is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return ``NotImplemented``.\n\nobject.__div__(self, other)\nobject.__truediv__(self, other)\n\n The division operator (``/``) is implemented by these methods. The\n ``__truediv__()`` method is used when ``__future__.division`` is in\n effect, otherwise ``__div__()`` is used. If only one of these two\n methods is defined, the object will not support division in the\n alternate context; ``TypeError`` will be raised instead.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rdiv__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations (``+``, ``-``, ``*``, ``/``, ``%``, ``divmod()``,\n ``pow()``, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``) with\n reflected (swapped) operands. These functions are only called if\n the left operand does not support the corresponding operation and\n the operands are of different types. [2] For instance, to evaluate\n the expression ``x - y``, where *y* is an instance of a class that\n has an ``__rsub__()`` method, ``y.__rsub__(x)`` is called if\n ``x.__sub__(y)`` returns *NotImplemented*.\n\n Note that ternary ``pow()`` will not try calling ``__rpow__()``\n (the coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left operand\'s\n type and that subclass provides the reflected method for the\n operation, this method will be called before the left operand\'s\n non-reflected method. This behavior allows subclasses to\n override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__idiv__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments (``+=``, ``-=``, ``*=``, ``/=``, ``//=``, ``%=``,\n ``**=``, ``<<=``, ``>>=``, ``&=``, ``^=``, ``|=``). These methods\n should attempt to do the operation in-place (modifying *self*) and\n return the result (which could be, but does not have to be,\n *self*). If a specific method is not defined, the augmented\n assignment falls back to the normal methods. For instance, to\n execute the statement ``x += y``, where *x* is an instance of a\n class that has an ``__iadd__()`` method, ``x.__iadd__(y)`` is\n called. If *x* is an instance of a class that does not define a\n ``__iadd__()`` method, ``x.__add__(y)`` and ``y.__radd__(x)`` are\n considered, as with the evaluation of ``x + y``.\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations (``-``, ``+``,\n ``abs()`` and ``~``).\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__long__(self)\nobject.__float__(self)\n\n Called to implement the built-in functions ``complex()``,\n ``int()``, ``long()``, and ``float()``. Should return a value of\n the appropriate type.\n\nobject.__oct__(self)\nobject.__hex__(self)\n\n Called to implement the built-in functions ``oct()`` and ``hex()``.\n Should return a string value.\n\nobject.__index__(self)\n\n Called to implement ``operator.index()``. Also called whenever\n Python needs an integer object (such as in slicing). Must return\n an integer (int or long).\n\n New in version 2.5.\n\nobject.__coerce__(self, other)\n\n Called to implement "mixed-mode" numeric arithmetic. Should either\n return a 2-tuple containing *self* and *other* converted to a\n common numeric type, or ``None`` if conversion is impossible. When\n the common type would be the type of ``other``, it is sufficient to\n return ``None``, since the interpreter will also ask the other\n object to attempt a coercion (but sometimes, if the implementation\n of the other type cannot be changed, it is useful to do the\n conversion to the other type here). A return value of\n ``NotImplemented`` is equivalent to returning ``None``.\n\n\nCoercion rules\n==============\n\nThis section used to document the rules for coercion. As the language\nhas evolved, the coercion rules have become hard to document\nprecisely; documenting what one version of one particular\nimplementation does is undesirable. Instead, here are some informal\nguidelines regarding coercion. In Python 3.0, coercion will not be\nsupported.\n\n* If the left operand of a % operator is a string or Unicode object,\n no coercion takes place and the string formatting operation is\n invoked instead.\n\n* It is no longer recommended to define a coercion operation. Mixed-\n mode operations on types that don\'t define coercion pass the\n original arguments to the operation.\n\n* New-style classes (those derived from ``object``) never invoke the\n ``__coerce__()`` method in response to a binary operator; the only\n time ``__coerce__()`` is invoked is when the built-in function\n ``coerce()`` is called.\n\n* For most intents and purposes, an operator that returns\n ``NotImplemented`` is treated the same as one that is not\n implemented at all.\n\n* Below, ``__op__()`` and ``__rop__()`` are used to signify the\n generic method names corresponding to an operator; ``__iop__()`` is\n used for the corresponding in-place operator. For example, for the\n operator \'``+``\', ``__add__()`` and ``__radd__()`` are used for the\n left and right variant of the binary operator, and ``__iadd__()``\n for the in-place variant.\n\n* For objects *x* and *y*, first ``x.__op__(y)`` is tried. If this is\n not implemented or returns ``NotImplemented``, ``y.__rop__(x)`` is\n tried. If this is also not implemented or returns\n ``NotImplemented``, a ``TypeError`` exception is raised. But see\n the following exception:\n\n* Exception to the previous item: if the left operand is an instance\n of a built-in type or a new-style class, and the right operand is an\n instance of a proper subclass of that type or class and overrides\n the base\'s ``__rop__()`` method, the right operand\'s ``__rop__()``\n method is tried *before* the left operand\'s ``__op__()`` method.\n\n This is done so that a subclass can completely override binary\n operators. Otherwise, the left operand\'s ``__op__()`` method would\n always accept the right operand: when an instance of a given class\n is expected, an instance of a subclass of that class is always\n acceptable.\n\n* When either operand type defines a coercion, this coercion is called\n before that type\'s ``__op__()`` or ``__rop__()`` method is called,\n but no sooner. If the coercion returns an object of a different\n type for the operand whose coercion is invoked, part of the process\n is redone using the new object.\n\n* When an in-place operator (like \'``+=``\') is used, if the left\n operand implements ``__iop__()``, it is invoked without any\n coercion. When the operation falls back to ``__op__()`` and/or\n ``__rop__()``, the normal coercion rules apply.\n\n* In ``x + y``, if *x* is a sequence that implements sequence\n concatenation, sequence concatenation is invoked.\n\n* In ``x * y``, if one operand is a sequence that implements sequence\n repetition, and the other is an integer (``int`` or ``long``),\n sequence repetition is invoked.\n\n* Rich comparisons (implemented by methods ``__eq__()`` and so on)\n never use coercion. Three-way comparison (implemented by\n ``__cmp__()``) does use coercion under the same conditions as other\n binary operations use it.\n\n* In the current implementation, the built-in numeric types ``int``,\n ``long``, ``float``, and ``complex`` do not use coercion. All these\n types implement a ``__coerce__()`` method, for use by the built-in\n ``coerce()`` function.\n\n Changed in version 2.7.\n\n\nWith Statement Context Managers\n===============================\n\nNew in version 2.5.\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a ``with`` statement. The context\nmanager handles the entry into, and the exit from, the desired runtime\ncontext for the execution of the block of code. Context managers are\nnormally invoked using the ``with`` statement (described in section\n*The with statement*), but can also be used by directly invoking their\nmethods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The ``with``\n statement will bind this method\'s return value to the target(s)\n specified in the ``as`` clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be ``None``.\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that ``__exit__()`` methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n\n\nSpecial method lookup for old-style classes\n===========================================\n\nFor old-style classes, special methods are always looked up in exactly\nthe same way as any other method or attribute. This is the case\nregardless of whether the method is being looked up explicitly as in\n``x.__getitem__(i)`` or implicitly as in ``x[i]``.\n\nThis behaviour means that special methods may exhibit different\nbehaviour for different instances of a single old-style class if the\nappropriate special attributes are set differently:\n\n >>> class C:\n ... pass\n ...\n >>> c1 = C()\n >>> c2 = C()\n >>> c1.__len__ = lambda: 5\n >>> c2.__len__ = lambda: 9\n >>> len(c1)\n 5\n >>> len(c2)\n 9\n\n\nSpecial method lookup for new-style classes\n===========================================\n\nFor new-style classes, implicit invocations of special methods are\nonly guaranteed to work correctly if defined on an object\'s type, not\nin the object\'s instance dictionary. That behaviour is the reason why\nthe following code raises an exception (unlike the equivalent example\nwith old-style classes):\n\n >>> class C(object):\n ... pass\n ...\n >>> c = C()\n >>> c.__len__ = lambda: 5\n >>> len(c)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: object of type \'C\' has no len()\n\nThe rationale behind this behaviour lies with a number of special\nmethods such as ``__hash__()`` and ``__repr__()`` that are implemented\nby all objects, including type objects. If the implicit lookup of\nthese methods used the conventional lookup process, they would fail\nwhen invoked on the type object itself:\n\n >>> 1 .__hash__() == hash(1)\n True\n >>> int.__hash__() == hash(int)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: descriptor \'__hash__\' of \'int\' object needs an argument\n\nIncorrectly attempting to invoke an unbound method of a class in this\nway is sometimes referred to as \'metaclass confusion\', and is avoided\nby bypassing the instance when looking up special methods:\n\n >>> type(1).__hash__(1) == hash(1)\n True\n >>> type(int).__hash__(int) == hash(int)\n True\n\nIn addition to bypassing any instance attributes in the interest of\ncorrectness, implicit special method lookup generally also bypasses\nthe ``__getattribute__()`` method even of the object\'s metaclass:\n\n >>> class Meta(type):\n ... def __getattribute__(*args):\n ... print "Metaclass getattribute invoked"\n ... return type.__getattribute__(*args)\n ...\n >>> class C(object):\n ... __metaclass__ = Meta\n ... def __len__(self):\n ... return 10\n ... def __getattribute__(*args):\n ... print "Class getattribute invoked"\n ... return object.__getattribute__(*args)\n ...\n >>> c = C()\n >>> c.__len__() # Explicit lookup via instance\n Class getattribute invoked\n 10\n >>> type(c).__len__(c) # Explicit lookup via type\n Metaclass getattribute invoked\n 10\n >>> len(c) # Implicit lookup\n 10\n\nBypassing the ``__getattribute__()`` machinery in this fashion\nprovides significant scope for speed optimisations within the\ninterpreter, at the cost of some flexibility in the handling of\nspecial methods (the special method *must* be set on the class object\nitself in order to be consistently invoked by the interpreter).\n\n-[ Footnotes ]-\n\n[1] It *is* possible in some cases to change an object\'s type, under\n certain controlled conditions. It generally isn\'t a good idea\n though, since it can lead to some very strange behaviour if it is\n handled incorrectly.\n\n[2] For operands of the same type, it is assumed that if the non-\n reflected method (such as ``__add__()``) fails the operation is\n not supported, which is why the reflected method is not called.\n', - 'string-methods': '\nString Methods\n**************\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support. Some of them are also available on\n``bytearray`` objects.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the *Sequence Types --- str, unicode, list, tuple,\nbytearray, buffer, xrange* section. To output formatted strings use\ntemplate strings or the ``%`` operator described in the *String\nFormatting Operations* section. Also, see the ``re`` module for string\nfunctions based on regular expressions.\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is a space).\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\n Decodes the string using the codec registered for *encoding*.\n *encoding* defaults to the default string encoding. *errors* may\n be given to set a different error handling scheme. The default is\n ``\'strict\'``, meaning that encoding errors raise ``UnicodeError``.\n Other possible values are ``\'ignore\'``, ``\'replace\'`` and any other\n name registered via ``codecs.register_error()``, see section *Codec\n Base Classes*.\n\n New in version 2.2.\n\n Changed in version 2.3: Support for other error handling schemes\n added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.encode([encoding[, errors]])\n\n Return an encoded version of the string. Default encoding is the\n current default string encoding. *errors* may be given to set a\n different error handling scheme. The default for *errors* is\n ``\'strict\'``, meaning that encoding errors raise a\n ``UnicodeError``. Other possible values are ``\'ignore\'``,\n ``\'replace\'``, ``\'xmlcharrefreplace\'``, ``\'backslashreplace\'`` and\n any other name registered via ``codecs.register_error()``, see\n section *Codec Base Classes*. For a list of possible encodings, see\n section *Standard Encodings*.\n\n New in version 2.0.\n\n Changed in version 2.3: Support for ``\'xmlcharrefreplace\'`` and\n ``\'backslashreplace\'`` and other error handling schemes added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return ``True`` if the string ends with the specified *suffix*,\n otherwise return ``False``. *suffix* can also be a tuple of\n suffixes to look for. With optional *start*, test beginning at\n that position. With optional *end*, stop comparing at that\n position.\n\n Changed in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. The column number is reset to zero after each\n newline occurring in the string. If *tabsize* is not given, a tab\n size of ``8`` characters is assumed. This doesn\'t understand other\n non-printing characters or escape sequences.\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found, such that *sub* is contained in the slice ``s[start:end]``.\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return ``-1`` if *sub* is not found.\n\n Note: The ``find()`` method should be used only if you need to know the\n position of *sub*. To check if *sub* is a substring or not, use\n the ``in`` operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces ``{}``. Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See *Format String Syntax* for a description of the various\n formatting options that can be specified in format strings.\n\n This method of string formatting is the new standard in Python 3.0,\n and should be preferred to the ``%`` formatting described in\n *String Formatting Operations* in new code.\n\n New in version 2.6.\n\nstr.index(sub[, start[, end]])\n\n Like ``find()``, but raise ``ValueError`` when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. The separator between elements is the\n string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to ``len(s)``.\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\n New in version 2.5.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within ``s[start:end]``.\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return ``-1`` on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like ``rfind()`` but raises ``ValueError`` when the substring *sub*\n is not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to ``len(s)``.\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\n New in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n ``None``, any whitespace string is a separator. Except for\n splitting from the right, ``rsplit()`` behaves like ``split()``\n which is described in detail below.\n\n New in version 2.4.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most ``maxsplit+1``\n elements). If *maxsplit* is not specified, then there is no limit\n on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n ``\'1,,2\'.split(\',\')`` returns ``[\'1\', \'\', \'2\']``). The *sep*\n argument may consist of multiple characters (for example,\n ``\'1<>2<>3\'.split(\'<>\')`` returns ``[\'1\', \'2\', \'3\']``). Splitting\n an empty string with a specified separator returns ``[\'\']``.\n\n If *sep* is not specified or is ``None``, a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a ``None`` separator returns\n ``[]``.\n\n For example, ``\' 1 2 3 \'.split()`` returns ``[\'1\', \'2\', \'3\']``,\n and ``\' 1 2 3 \'.split(None, 1)`` returns ``[\'1\', \'2 3 \']``.\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\nstr.startswith(prefix[, start[, end]])\n\n Return ``True`` if string starts with the *prefix*, otherwise\n return ``False``. *prefix* can also be a tuple of prefixes to look\n for. With optional *start*, test string beginning at that\n position. With optional *end*, stop comparing string at that\n position.\n\n Changed in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or ``None``, the\n *chars* argument defaults to removing whitespace. The *chars*\n argument is not a prefix or suffix; rather, all combinations of its\n values are stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n lambda mo: mo.group(0)[0].upper() +\n mo.group(0)[1:].lower(),\n s)\n\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\n Return a copy of the string where all characters occurring in the\n optional argument *deletechars* are removed, and the remaining\n characters have been mapped through the given translation table,\n which must be a string of length 256.\n\n You can use the ``maketrans()`` helper function in the ``string``\n module to create a translation table. For string objects, set the\n *table* argument to ``None`` for translations that only delete\n characters:\n\n >>> \'read this short text\'.translate(None, \'aeiou\')\n \'rd ths shrt txt\'\n\n New in version 2.6: Support for a ``None`` *table* argument.\n\n For Unicode objects, the ``translate()`` method does not accept the\n optional *deletechars* argument. Instead, it returns a copy of the\n *s* where all characters have been mapped through the given\n translation table which must be a mapping of Unicode ordinals to\n Unicode ordinals, Unicode strings or ``None``. Unmapped characters\n are left untouched. Characters mapped to ``None`` are deleted.\n Note, a more flexible approach is to create a custom character\n mapping codec using the ``codecs`` module (see ``encodings.cp1251``\n for an example).\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that ``str.upper().isupper()`` might\n be ``False`` if ``s`` contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\n Return the numeric string left filled with zeros in a string of\n length *width*. A sign prefix is handled correctly. The original\n string is returned if *width* is less than or equal to ``len(s)``.\n\n New in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\n Return ``True`` if there are only numeric characters in S,\n ``False`` otherwise. Numeric characters include digit characters,\n and all characters that have the Unicode numeric value property,\n e.g. U+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\n Return ``True`` if there are only decimal characters in S,\n ``False`` otherwise. Decimal characters include digit characters,\n and all characters that can be used to form decimal-radix numbers,\n e.g. U+0660, ARABIC-INDIC DIGIT ZERO.\n', + 'specialnames': '\nSpecial method names\n********************\n\nA class can implement certain operations that are invoked by special\nsyntax (such as arithmetic operations or subscripting and slicing) by\ndefining methods with special names. This is Python\'s approach to\n*operator overloading*, allowing classes to define their own behavior\nwith respect to language operators. For instance, if a class defines\na method named ``__getitem__()``, and ``x`` is an instance of this\nclass, then ``x[i]`` is roughly equivalent to ``x.__getitem__(i)`` for\nold-style classes and ``type(x).__getitem__(x, i)`` for new-style\nclasses. Except where mentioned, attempts to execute an operation\nraise an exception when no appropriate method is defined (typically\n``AttributeError`` or ``TypeError``).\n\nWhen implementing a class that emulates any built-in type, it is\nimportant that the emulation only be implemented to the degree that it\nmakes sense for the object being modelled. For example, some\nsequences may work well with retrieval of individual elements, but\nextracting a slice may not make sense. (One example of this is the\n``NodeList`` interface in the W3C\'s Document Object Model.)\n\n\nBasic customization\n===================\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. ``__new__()`` is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of ``__new__()`` should be the new object instance (usually\n an instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s ``__new__()`` method using\n ``super(currentclass, cls).__new__(cls[, ...])`` with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If ``__new__()`` returns an instance of *cls*, then the new\n instance\'s ``__init__()`` method will be invoked like\n ``__init__(self[, ...])``, where *self* is the new instance and the\n remaining arguments are the same as were passed to ``__new__()``.\n\n If ``__new__()`` does not return an instance of *cls*, then the new\n instance\'s ``__init__()`` method will not be invoked.\n\n ``__new__()`` is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called when the instance is created. The arguments are those\n passed to the class constructor expression. If a base class has an\n ``__init__()`` method, the derived class\'s ``__init__()`` method,\n if any, must explicitly call it to ensure proper initialization of\n the base class part of the instance; for example:\n ``BaseClass.__init__(self, [args...])``. As a special constraint\n on constructors, no value may be returned; doing so will cause a\n ``TypeError`` to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a ``__del__()`` method,\n the derived class\'s ``__del__()`` method, if any, must explicitly\n call it to ensure proper deletion of the base class part of the\n instance. Note that it is possible (though not recommended!) for\n the ``__del__()`` method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n ``__del__()`` methods are called for objects that still exist when\n the interpreter exits.\n\n Note: ``del x`` doesn\'t directly call ``x.__del__()`` --- the former\n decrements the reference count for ``x`` by one, and the latter\n is only called when ``x``\'s reference count reaches zero. Some\n common situations that may prevent the reference count of an\n object from going to zero include: circular references between\n objects (e.g., a doubly-linked list or a tree data structure with\n parent and child pointers); a reference to the object on the\n stack frame of a function that caught an exception (the traceback\n stored in ``sys.exc_traceback`` keeps the stack frame alive); or\n a reference to the object on the stack frame that raised an\n unhandled exception in interactive mode (the traceback stored in\n ``sys.last_traceback`` keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the latter two situations can be resolved by storing ``None`` in\n ``sys.exc_traceback`` or ``sys.last_traceback``. Circular\n references which are garbage are detected when the option cycle\n detector is enabled (it\'s on by default), but can only be cleaned\n up if there are no Python-level ``__del__()`` methods involved.\n Refer to the documentation for the ``gc`` module for more\n information about how ``__del__()`` methods are handled by the\n cycle detector, particularly the description of the ``garbage``\n value.\n\n Warning: Due to the precarious circumstances under which ``__del__()``\n methods are invoked, exceptions that occur during their execution\n are ignored, and a warning is printed to ``sys.stderr`` instead.\n Also, when ``__del__()`` is invoked in response to a module being\n deleted (e.g., when execution of the program is done), other\n globals referenced by the ``__del__()`` method may already have\n been deleted or in the process of being torn down (e.g. the\n import machinery shutting down). For this reason, ``__del__()``\n methods should do the absolute minimum needed to maintain\n external invariants. Starting with version 1.5, Python\n guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the ``__del__()`` method is called.\n\n See also the *-R* command-line option.\n\nobject.__repr__(self)\n\n Called by the ``repr()`` built-in function and by string\n conversions (reverse quotes) to compute the "official" string\n representation of an object. If at all possible, this should look\n like a valid Python expression that could be used to recreate an\n object with the same value (given an appropriate environment). If\n this is not possible, a string of the form ``<...some useful\n description...>`` should be returned. The return value must be a\n string object. If a class defines ``__repr__()`` but not\n ``__str__()``, then ``__repr__()`` is also used when an "informal"\n string representation of instances of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by the ``str()`` built-in function and by the ``print``\n statement to compute the "informal" string representation of an\n object. This differs from ``__repr__()`` in that it does not have\n to be a valid Python expression: a more convenient or concise\n representation may be used instead. The return value must be a\n string object.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n New in version 2.1.\n\n These are the so-called "rich comparison" methods, and are called\n for comparison operators in preference to ``__cmp__()`` below. The\n correspondence between operator symbols and method names is as\n follows: ``xy`` call ``x.__ne__(y)``, ``x>y`` calls ``x.__gt__(y)``, and\n ``x>=y`` calls ``x.__ge__(y)``.\n\n A rich comparison method may return the singleton\n ``NotImplemented`` if it does not implement the operation for a\n given pair of arguments. By convention, ``False`` and ``True`` are\n returned for a successful comparison. However, these methods can\n return any value, so if the comparison operator is used in a\n Boolean context (e.g., in the condition of an ``if`` statement),\n Python will call ``bool()`` on the value to determine if the result\n is true or false.\n\n There are no implied relationships among the comparison operators.\n The truth of ``x==y`` does not imply that ``x!=y`` is false.\n Accordingly, when defining ``__eq__()``, one should also define\n ``__ne__()`` so that the operators will behave as expected. See\n the paragraph on ``__hash__()`` for some important notes on\n creating *hashable* objects which support custom comparison\n operations and are usable as dictionary keys.\n\n There are no swapped-argument versions of these methods (to be used\n when the left argument does not support the operation but the right\n argument does); rather, ``__lt__()`` and ``__gt__()`` are each\n other\'s reflection, ``__le__()`` and ``__ge__()`` are each other\'s\n reflection, and ``__eq__()`` and ``__ne__()`` are their own\n reflection.\n\n Arguments to rich comparison methods are never coerced.\n\n To automatically generate ordering operations from a single root\n operation, see ``functools.total_ordering()``.\n\nobject.__cmp__(self, other)\n\n Called by comparison operations if rich comparison (see above) is\n not defined. Should return a negative integer if ``self < other``,\n zero if ``self == other``, a positive integer if ``self > other``.\n If no ``__cmp__()``, ``__eq__()`` or ``__ne__()`` operation is\n defined, class instances are compared by object identity\n ("address"). See also the description of ``__hash__()`` for some\n important notes on creating *hashable* objects which support custom\n comparison operations and are usable as dictionary keys. (Note: the\n restriction that exceptions are not propagated by ``__cmp__()`` has\n been removed since Python 1.5.)\n\nobject.__rcmp__(self, other)\n\n Changed in version 2.1: No longer supported.\n\nobject.__hash__(self)\n\n Called by built-in function ``hash()`` and for operations on\n members of hashed collections including ``set``, ``frozenset``, and\n ``dict``. ``__hash__()`` should return an integer. The only\n required property is that objects which compare equal have the same\n hash value; it is advised to somehow mix together (e.g. using\n exclusive or) the hash values for the components of the object that\n also play a part in comparison of objects.\n\n If a class does not define a ``__cmp__()`` or ``__eq__()`` method\n it should not define a ``__hash__()`` operation either; if it\n defines ``__cmp__()`` or ``__eq__()`` but not ``__hash__()``, its\n instances will not be usable in hashed collections. If a class\n defines mutable objects and implements a ``__cmp__()`` or\n ``__eq__()`` method, it should not implement ``__hash__()``, since\n hashable collection implementations require that a object\'s hash\n value is immutable (if the object\'s hash value changes, it will be\n in the wrong hash bucket).\n\n User-defined classes have ``__cmp__()`` and ``__hash__()`` methods\n by default; with them, all objects compare unequal (except with\n themselves) and ``x.__hash__()`` returns ``id(x)``.\n\n Classes which inherit a ``__hash__()`` method from a parent class\n but change the meaning of ``__cmp__()`` or ``__eq__()`` such that\n the hash value returned is no longer appropriate (e.g. by switching\n to a value-based concept of equality instead of the default\n identity based equality) can explicitly flag themselves as being\n unhashable by setting ``__hash__ = None`` in the class definition.\n Doing so means that not only will instances of the class raise an\n appropriate ``TypeError`` when a program attempts to retrieve their\n hash value, but they will also be correctly identified as\n unhashable when checking ``isinstance(obj, collections.Hashable)``\n (unlike classes which define their own ``__hash__()`` to explicitly\n raise ``TypeError``).\n\n Changed in version 2.5: ``__hash__()`` may now also return a long\n integer object; the 32-bit integer is then derived from the hash of\n that object.\n\n Changed in version 2.6: ``__hash__`` may now be set to ``None`` to\n explicitly flag instances of a class as unhashable.\n\nobject.__nonzero__(self)\n\n Called to implement truth value testing and the built-in operation\n ``bool()``; should return ``False`` or ``True``, or their integer\n equivalents ``0`` or ``1``. When this method is not defined,\n ``__len__()`` is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither ``__len__()`` nor ``__nonzero__()``, all its instances are\n considered true.\n\nobject.__unicode__(self)\n\n Called to implement ``unicode()`` built-in; should return a Unicode\n object. When this method is not defined, string conversion is\n attempted, and the result of string conversion is converted to\n Unicode using the system default encoding.\n\n\nCustomizing attribute access\n============================\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of ``x.name``)\nfor class instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for ``self``). ``name`` is the attribute name.\n This method should return the (computed) attribute value or raise\n an ``AttributeError`` exception.\n\n Note that if the attribute is found through the normal mechanism,\n ``__getattr__()`` is not called. (This is an intentional asymmetry\n between ``__getattr__()`` and ``__setattr__()``.) This is done both\n for efficiency reasons and because otherwise ``__getattr__()``\n would have no way to access other attributes of the instance. Note\n that at least for instance variables, you can fake total control by\n not inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n ``__getattribute__()`` method below for a way to actually get total\n control in new-style classes.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If ``__setattr__()`` wants to assign to an instance attribute, it\n should not simply execute ``self.name = value`` --- this would\n cause a recursive call to itself. Instead, it should insert the\n value in the dictionary of instance attributes, e.g.,\n ``self.__dict__[name] = value``. For new-style classes, rather\n than accessing the instance dictionary, it should call the base\n class method with the same name, for example,\n ``object.__setattr__(self, name, value)``.\n\nobject.__delattr__(self, name)\n\n Like ``__setattr__()`` but for attribute deletion instead of\n assignment. This should only be implemented if ``del obj.name`` is\n meaningful for the object.\n\n\nMore attribute access for new-style classes\n-------------------------------------------\n\nThe following methods only apply to new-style classes.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines\n ``__getattr__()``, the latter will not be called unless\n ``__getattribute__()`` either calls it explicitly or raises an\n ``AttributeError``. This method should return the (computed)\n attribute value or raise an ``AttributeError`` exception. In order\n to avoid infinite recursion in this method, its implementation\n should always call the base class method with the same name to\n access any attributes it needs, for example,\n ``object.__getattribute__(self, name)``.\n\n Note: This method may still be bypassed when looking up special methods\n as the result of implicit invocation via language syntax or\n built-in functions. See *Special method lookup for new-style\n classes*.\n\n\nImplementing Descriptors\n------------------------\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' ``__dict__``.\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or ``None`` when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an\n ``AttributeError`` exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\n\nInvoking Descriptors\n--------------------\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: ``__get__()``, ``__set__()``, and\n``__delete__()``. If any of those methods are defined for an object,\nit is said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, ``a.x`` has a\nlookup chain starting with ``a.__dict__[\'x\']``, then\n``type(a).__dict__[\'x\']``, and continuing through the base classes of\n``type(a)`` excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called. Note that descriptors are only invoked for new\nstyle objects or classes (ones that subclass ``object()`` or\n``type()``).\n\nThe starting point for descriptor invocation is a binding, ``a.x``.\nHow the arguments are assembled depends on ``a``:\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: ``x.__get__(a)``.\n\nInstance Binding\n If binding to a new-style object instance, ``a.x`` is transformed\n into the call: ``type(a).__dict__[\'x\'].__get__(a, type(a))``.\n\nClass Binding\n If binding to a new-style class, ``A.x`` is transformed into the\n call: ``A.__dict__[\'x\'].__get__(None, A)``.\n\nSuper Binding\n If ``a`` is an instance of ``super``, then the binding ``super(B,\n obj).m()`` searches ``obj.__class__.__mro__`` for the base class\n ``A`` immediately preceding ``B`` and then invokes the descriptor\n with the call: ``A.__dict__[\'m\'].__get__(obj, obj.__class__)``.\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of ``__get__()``, ``__set__()`` and ``__delete__()``.\nIf it does not define ``__get__()``, then accessing the attribute will\nreturn the descriptor object itself unless there is a value in the\nobject\'s instance dictionary. If the descriptor defines ``__set__()``\nand/or ``__delete__()``, it is a data descriptor; if it defines\nneither, it is a non-data descriptor. Normally, data descriptors\ndefine both ``__get__()`` and ``__set__()``, while non-data\ndescriptors have just the ``__get__()`` method. Data descriptors with\n``__set__()`` and ``__get__()`` defined always override a redefinition\nin an instance dictionary. In contrast, non-data descriptors can be\noverridden by instances.\n\nPython methods (including ``staticmethod()`` and ``classmethod()``)\nare implemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe ``property()`` function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n---------\n\nBy default, instances of both old and new-style classes have a\ndictionary for attribute storage. This wastes space for objects\nhaving very few instance variables. The space consumption can become\nacute when creating large numbers of instances.\n\nThe default can be overridden by defining *__slots__* in a new-style\nclass definition. The *__slots__* declaration takes a sequence of\ninstance variables and reserves just enough space in each instance to\nhold a value for each variable. Space is saved because *__dict__* is\nnot created for each instance.\n\n__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. If defined in a\n new-style class, *__slots__* reserves space for the declared\n variables and prevents the automatic creation of *__dict__* and\n *__weakref__* for each instance.\n\n New in version 2.2.\n\nNotes on using *__slots__*\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises ``AttributeError``. If\n dynamic assignment of new variables is desired, then add\n ``\'__dict__\'`` to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding ``\'__dict__\'`` to the\n *__slots__* declaration would not enable the assignment of new\n attributes not specifically listed in the sequence of instance\n variable names.\n\n* Without a *__weakref__* variable for each instance, classes defining\n *__slots__* do not support weak references to its instances. If weak\n reference support is needed, then add ``\'__weakref__\'`` to the\n sequence of strings in the *__slots__* declaration.\n\n Changed in version 2.3: Previously, adding ``\'__weakref__\'`` to the\n *__slots__* declaration would not enable support for weak\n references.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (*Implementing Descriptors*) for each variable name. As\n a result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the instance\n variable defined by the base class slot is inaccessible (except by\n retrieving its descriptor directly from the base class). This\n renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as ``long``, ``str`` and\n ``tuple``.\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings may\n also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n Changed in version 2.6: Previously, *__class__* assignment raised an\n error if either new or old class had *__slots__*.\n\n\nCustomizing class creation\n==========================\n\nBy default, new-style classes are constructed using ``type()``. A\nclass definition is read into a separate namespace and the value of\nclass name is bound to the result of ``type(name, bases, dict)``.\n\nWhen the class definition is read, if *__metaclass__* is defined then\nthe callable assigned to it will be called instead of ``type()``. This\nallows classes or functions to be written which monitor or alter the\nclass creation process:\n\n* Modifying the class dictionary prior to the class being created.\n\n* Returning an instance of another class -- essentially performing the\n role of a factory function.\n\nThese steps will have to be performed in the metaclass\'s ``__new__()``\nmethod -- ``type.__new__()`` can then be called from this method to\ncreate a class with different properties. This example adds a new\nelement to the class dictionary before creating the class:\n\n class metacls(type):\n def __new__(mcs, name, bases, dict):\n dict[\'foo\'] = \'metacls was here\'\n return type.__new__(mcs, name, bases, dict)\n\nYou can of course also override other class methods (or add new\nmethods); for example defining a custom ``__call__()`` method in the\nmetaclass allows custom behavior when the class is called, e.g. not\nalways creating a new instance.\n\n__metaclass__\n\n This variable can be any callable accepting arguments for ``name``,\n ``bases``, and ``dict``. Upon class creation, the callable is used\n instead of the built-in ``type()``.\n\n New in version 2.2.\n\nThe appropriate metaclass is determined by the following precedence\nrules:\n\n* If ``dict[\'__metaclass__\']`` exists, it is used.\n\n* Otherwise, if there is at least one base class, its metaclass is\n used (this looks for a *__class__* attribute first and if not found,\n uses its type).\n\n* Otherwise, if a global variable named __metaclass__ exists, it is\n used.\n\n* Otherwise, the old-style, classic metaclass (types.ClassType) is\n used.\n\nThe potential uses for metaclasses are boundless. Some ideas that have\nbeen explored including logging, interface checking, automatic\ndelegation, automatic property creation, proxies, frameworks, and\nautomatic resource locking/synchronization.\n\n\nCustomizing instance and subclass checks\n========================================\n\nNew in version 2.6.\n\nThe following methods are used to override the default behavior of the\n``isinstance()`` and ``issubclass()`` built-in functions.\n\nIn particular, the metaclass ``abc.ABCMeta`` implements these methods\nin order to allow the addition of Abstract Base Classes (ABCs) as\n"virtual base classes" to any class or type (including built-in\ntypes), including other ABCs.\n\nclass.__instancecheck__(self, instance)\n\n Return true if *instance* should be considered a (direct or\n indirect) instance of *class*. If defined, called to implement\n ``isinstance(instance, class)``.\n\nclass.__subclasscheck__(self, subclass)\n\n Return true if *subclass* should be considered a (direct or\n indirect) subclass of *class*. If defined, called to implement\n ``issubclass(subclass, class)``.\n\nNote that these methods are looked up on the type (metaclass) of a\nclass. They cannot be defined as class methods in the actual class.\nThis is consistent with the lookup of special methods that are called\non instances, only in this case the instance is itself a class.\n\nSee also:\n\n **PEP 3119** - Introducing Abstract Base Classes\n Includes the specification for customizing ``isinstance()`` and\n ``issubclass()`` behavior through ``__instancecheck__()`` and\n ``__subclasscheck__()``, with motivation for this functionality\n in the context of adding Abstract Base Classes (see the ``abc``\n module) to the language.\n\n\nEmulating callable objects\n==========================\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, ``x(arg1, arg2, ...)`` is a shorthand for\n ``x.__call__(arg1, arg2, ...)``.\n\n\nEmulating container types\n=========================\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which ``0 <= k < N``\nwhere *N* is the length of the sequence, or slice objects, which\ndefine a range of items. (For backwards compatibility, the method\n``__getslice__()`` (see below) can also be defined to handle simple,\nbut not extended slices.) It is also recommended that mappings provide\nthe methods ``keys()``, ``values()``, ``items()``, ``has_key()``,\n``get()``, ``clear()``, ``setdefault()``, ``iterkeys()``,\n``itervalues()``, ``iteritems()``, ``pop()``, ``popitem()``,\n``copy()``, and ``update()`` behaving similar to those for Python\'s\nstandard dictionary objects. The ``UserDict`` module provides a\n``DictMixin`` class to help create those methods from a base set of\n``__getitem__()``, ``__setitem__()``, ``__delitem__()``, and\n``keys()``. Mutable sequences should provide methods ``append()``,\n``count()``, ``index()``, ``extend()``, ``insert()``, ``pop()``,\n``remove()``, ``reverse()`` and ``sort()``, like Python standard list\nobjects. Finally, sequence types should implement addition (meaning\nconcatenation) and multiplication (meaning repetition) by defining the\nmethods ``__add__()``, ``__radd__()``, ``__iadd__()``, ``__mul__()``,\n``__rmul__()`` and ``__imul__()`` described below; they should not\ndefine ``__coerce__()`` or other numerical operators. It is\nrecommended that both mappings and sequences implement the\n``__contains__()`` method to allow efficient use of the ``in``\noperator; for mappings, ``in`` should be equivalent of ``has_key()``;\nfor sequences, it should search through the values. It is further\nrecommended that both mappings and sequences implement the\n``__iter__()`` method to allow efficient iteration through the\ncontainer; for mappings, ``__iter__()`` should be the same as\n``iterkeys()``; for sequences, it should iterate through the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function ``len()``. Should return\n the length of the object, an integer ``>=`` 0. Also, an object\n that doesn\'t define a ``__nonzero__()`` method and whose\n ``__len__()`` method returns zero is considered to be false in a\n Boolean context.\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of ``self[key]``. For sequence\n types, the accepted keys should be integers and slice objects.\n Note that the special interpretation of negative indexes (if the\n class wishes to emulate a sequence type) is up to the\n ``__getitem__()`` method. If *key* is of an inappropriate type,\n ``TypeError`` may be raised; if of a value outside the set of\n indexes for the sequence (after any special interpretation of\n negative values), ``IndexError`` should be raised. For mapping\n types, if *key* is missing (not in the container), ``KeyError``\n should be raised.\n\n Note: ``for`` loops expect that an ``IndexError`` will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to ``self[key]``. Same note as for\n ``__getitem__()``. This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the ``__getitem__()`` method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of ``self[key]``. Same note as for\n ``__getitem__()``. This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the ``__getitem__()``\n method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container, and should also be made\n available as the method ``iterkeys()``.\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see *Iterator Types*.\n\nobject.__reversed__(self)\n\n Called (if present) by the ``reversed()`` built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the ``__reversed__()`` method is not provided, the\n ``reversed()`` built-in will fall back to using the sequence\n protocol (``__len__()`` and ``__getitem__()``). Objects that\n support the sequence protocol should only provide\n ``__reversed__()`` if they can provide an implementation that is\n more efficient than the one provided by ``reversed()``.\n\n New in version 2.6.\n\nThe membership test operators (``in`` and ``not in``) are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define ``__contains__()``, the membership\n test first tries iteration via ``__iter__()``, then the old\n sequence iteration protocol via ``__getitem__()``, see *this\n section in the language reference*.\n\n\nAdditional methods for emulation of sequence types\n==================================================\n\nThe following optional methods can be defined to further emulate\nsequence objects. Immutable sequences methods should at most only\ndefine ``__getslice__()``; mutable sequences might define all three\nmethods.\n\nobject.__getslice__(self, i, j)\n\n Deprecated since version 2.0: Support slice objects as parameters\n to the ``__getitem__()`` method. (However, built-in types in\n CPython currently still implement ``__getslice__()``. Therefore,\n you have to override it in derived classes when implementing\n slicing.)\n\n Called to implement evaluation of ``self[i:j]``. The returned\n object should be of the same type as *self*. Note that missing *i*\n or *j* in the slice expression are replaced by zero or\n ``sys.maxint``, respectively. If negative indexes are used in the\n slice, the length of the sequence is added to that index. If the\n instance does not implement the ``__len__()`` method, an\n ``AttributeError`` is raised. No guarantee is made that indexes\n adjusted this way are not still negative. Indexes which are\n greater than the length of the sequence are not modified. If no\n ``__getslice__()`` is found, a slice object is created instead, and\n passed to ``__getitem__()`` instead.\n\nobject.__setslice__(self, i, j, sequence)\n\n Called to implement assignment to ``self[i:j]``. Same notes for *i*\n and *j* as for ``__getslice__()``.\n\n This method is deprecated. If no ``__setslice__()`` is found, or\n for extended slicing of the form ``self[i:j:k]``, a slice object is\n created, and passed to ``__setitem__()``, instead of\n ``__setslice__()`` being called.\n\nobject.__delslice__(self, i, j)\n\n Called to implement deletion of ``self[i:j]``. Same notes for *i*\n and *j* as for ``__getslice__()``. This method is deprecated. If no\n ``__delslice__()`` is found, or for extended slicing of the form\n ``self[i:j:k]``, a slice object is created, and passed to\n ``__delitem__()``, instead of ``__delslice__()`` being called.\n\nNotice that these methods are only invoked when a single slice with a\nsingle colon is used, and the slice method is available. For slice\noperations involving extended slice notation, or in absence of the\nslice methods, ``__getitem__()``, ``__setitem__()`` or\n``__delitem__()`` is called with a slice object as argument.\n\nThe following example demonstrate how to make your program or module\ncompatible with earlier versions of Python (assuming that methods\n``__getitem__()``, ``__setitem__()`` and ``__delitem__()`` support\nslice objects as arguments):\n\n class MyClass:\n ...\n def __getitem__(self, index):\n ...\n def __setitem__(self, index, value):\n ...\n def __delitem__(self, index):\n ...\n\n if sys.version_info < (2, 0):\n # They won\'t be defined if version is at least 2.0 final\n\n def __getslice__(self, i, j):\n return self[max(0, i):max(0, j):]\n def __setslice__(self, i, j, seq):\n self[max(0, i):max(0, j):] = seq\n def __delslice__(self, i, j):\n del self[max(0, i):max(0, j):]\n ...\n\nNote the calls to ``max()``; these are necessary because of the\nhandling of negative indices before the ``__*slice__()`` methods are\ncalled. When negative indexes are used, the ``__*item__()`` methods\nreceive them as provided, but the ``__*slice__()`` methods get a\n"cooked" form of the index values. For each negative index value, the\nlength of the sequence is added to the index before calling the method\n(which may still result in a negative index); this is the customary\nhandling of negative indexes by the built-in sequence types, and the\n``__*item__()`` methods are expected to do this as well. However,\nsince they should already be doing that, negative indexes cannot be\npassed in; they must be constrained to the bounds of the sequence\nbefore being passed to the ``__*item__()`` methods. Calling ``max(0,\ni)`` conveniently returns the proper value.\n\n\nEmulating numeric types\n=======================\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations (``+``, ``-``, ``*``, ``//``, ``%``, ``divmod()``,\n ``pow()``, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``). For\n instance, to evaluate the expression ``x + y``, where *x* is an\n instance of a class that has an ``__add__()`` method,\n ``x.__add__(y)`` is called. The ``__divmod__()`` method should be\n the equivalent to using ``__floordiv__()`` and ``__mod__()``; it\n should not be related to ``__truediv__()`` (described below). Note\n that ``__pow__()`` should be defined to accept an optional third\n argument if the ternary version of the built-in ``pow()`` function\n is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return ``NotImplemented``.\n\nobject.__div__(self, other)\nobject.__truediv__(self, other)\n\n The division operator (``/``) is implemented by these methods. The\n ``__truediv__()`` method is used when ``__future__.division`` is in\n effect, otherwise ``__div__()`` is used. If only one of these two\n methods is defined, the object will not support division in the\n alternate context; ``TypeError`` will be raised instead.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rdiv__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations (``+``, ``-``, ``*``, ``/``, ``%``, ``divmod()``,\n ``pow()``, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``) with\n reflected (swapped) operands. These functions are only called if\n the left operand does not support the corresponding operation and\n the operands are of different types. [2] For instance, to evaluate\n the expression ``x - y``, where *y* is an instance of a class that\n has an ``__rsub__()`` method, ``y.__rsub__(x)`` is called if\n ``x.__sub__(y)`` returns *NotImplemented*.\n\n Note that ternary ``pow()`` will not try calling ``__rpow__()``\n (the coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left operand\'s\n type and that subclass provides the reflected method for the\n operation, this method will be called before the left operand\'s\n non-reflected method. This behavior allows subclasses to\n override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__idiv__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments (``+=``, ``-=``, ``*=``, ``/=``, ``//=``, ``%=``,\n ``**=``, ``<<=``, ``>>=``, ``&=``, ``^=``, ``|=``). These methods\n should attempt to do the operation in-place (modifying *self*) and\n return the result (which could be, but does not have to be,\n *self*). If a specific method is not defined, the augmented\n assignment falls back to the normal methods. For instance, to\n execute the statement ``x += y``, where *x* is an instance of a\n class that has an ``__iadd__()`` method, ``x.__iadd__(y)`` is\n called. If *x* is an instance of a class that does not define a\n ``__iadd__()`` method, ``x.__add__(y)`` and ``y.__radd__(x)`` are\n considered, as with the evaluation of ``x + y``.\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations (``-``, ``+``,\n ``abs()`` and ``~``).\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__long__(self)\nobject.__float__(self)\n\n Called to implement the built-in functions ``complex()``,\n ``int()``, ``long()``, and ``float()``. Should return a value of\n the appropriate type.\n\nobject.__oct__(self)\nobject.__hex__(self)\n\n Called to implement the built-in functions ``oct()`` and ``hex()``.\n Should return a string value.\n\nobject.__index__(self)\n\n Called to implement ``operator.index()``. Also called whenever\n Python needs an integer object (such as in slicing). Must return\n an integer (int or long).\n\n New in version 2.5.\n\nobject.__coerce__(self, other)\n\n Called to implement "mixed-mode" numeric arithmetic. Should either\n return a 2-tuple containing *self* and *other* converted to a\n common numeric type, or ``None`` if conversion is impossible. When\n the common type would be the type of ``other``, it is sufficient to\n return ``None``, since the interpreter will also ask the other\n object to attempt a coercion (but sometimes, if the implementation\n of the other type cannot be changed, it is useful to do the\n conversion to the other type here). A return value of\n ``NotImplemented`` is equivalent to returning ``None``.\n\n\nCoercion rules\n==============\n\nThis section used to document the rules for coercion. As the language\nhas evolved, the coercion rules have become hard to document\nprecisely; documenting what one version of one particular\nimplementation does is undesirable. Instead, here are some informal\nguidelines regarding coercion. In Python 3, coercion will not be\nsupported.\n\n* If the left operand of a % operator is a string or Unicode object,\n no coercion takes place and the string formatting operation is\n invoked instead.\n\n* It is no longer recommended to define a coercion operation. Mixed-\n mode operations on types that don\'t define coercion pass the\n original arguments to the operation.\n\n* New-style classes (those derived from ``object``) never invoke the\n ``__coerce__()`` method in response to a binary operator; the only\n time ``__coerce__()`` is invoked is when the built-in function\n ``coerce()`` is called.\n\n* For most intents and purposes, an operator that returns\n ``NotImplemented`` is treated the same as one that is not\n implemented at all.\n\n* Below, ``__op__()`` and ``__rop__()`` are used to signify the\n generic method names corresponding to an operator; ``__iop__()`` is\n used for the corresponding in-place operator. For example, for the\n operator \'``+``\', ``__add__()`` and ``__radd__()`` are used for the\n left and right variant of the binary operator, and ``__iadd__()``\n for the in-place variant.\n\n* For objects *x* and *y*, first ``x.__op__(y)`` is tried. If this is\n not implemented or returns ``NotImplemented``, ``y.__rop__(x)`` is\n tried. If this is also not implemented or returns\n ``NotImplemented``, a ``TypeError`` exception is raised. But see\n the following exception:\n\n* Exception to the previous item: if the left operand is an instance\n of a built-in type or a new-style class, and the right operand is an\n instance of a proper subclass of that type or class and overrides\n the base\'s ``__rop__()`` method, the right operand\'s ``__rop__()``\n method is tried *before* the left operand\'s ``__op__()`` method.\n\n This is done so that a subclass can completely override binary\n operators. Otherwise, the left operand\'s ``__op__()`` method would\n always accept the right operand: when an instance of a given class\n is expected, an instance of a subclass of that class is always\n acceptable.\n\n* When either operand type defines a coercion, this coercion is called\n before that type\'s ``__op__()`` or ``__rop__()`` method is called,\n but no sooner. If the coercion returns an object of a different\n type for the operand whose coercion is invoked, part of the process\n is redone using the new object.\n\n* When an in-place operator (like \'``+=``\') is used, if the left\n operand implements ``__iop__()``, it is invoked without any\n coercion. When the operation falls back to ``__op__()`` and/or\n ``__rop__()``, the normal coercion rules apply.\n\n* In ``x + y``, if *x* is a sequence that implements sequence\n concatenation, sequence concatenation is invoked.\n\n* In ``x * y``, if one operand is a sequence that implements sequence\n repetition, and the other is an integer (``int`` or ``long``),\n sequence repetition is invoked.\n\n* Rich comparisons (implemented by methods ``__eq__()`` and so on)\n never use coercion. Three-way comparison (implemented by\n ``__cmp__()``) does use coercion under the same conditions as other\n binary operations use it.\n\n* In the current implementation, the built-in numeric types ``int``,\n ``long``, ``float``, and ``complex`` do not use coercion. All these\n types implement a ``__coerce__()`` method, for use by the built-in\n ``coerce()`` function.\n\n Changed in version 2.7.\n\n\nWith Statement Context Managers\n===============================\n\nNew in version 2.5.\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a ``with`` statement. The context\nmanager handles the entry into, and the exit from, the desired runtime\ncontext for the execution of the block of code. Context managers are\nnormally invoked using the ``with`` statement (described in section\n*The with statement*), but can also be used by directly invoking their\nmethods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The ``with``\n statement will bind this method\'s return value to the target(s)\n specified in the ``as`` clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be ``None``.\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that ``__exit__()`` methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n\n\nSpecial method lookup for old-style classes\n===========================================\n\nFor old-style classes, special methods are always looked up in exactly\nthe same way as any other method or attribute. This is the case\nregardless of whether the method is being looked up explicitly as in\n``x.__getitem__(i)`` or implicitly as in ``x[i]``.\n\nThis behaviour means that special methods may exhibit different\nbehaviour for different instances of a single old-style class if the\nappropriate special attributes are set differently:\n\n >>> class C:\n ... pass\n ...\n >>> c1 = C()\n >>> c2 = C()\n >>> c1.__len__ = lambda: 5\n >>> c2.__len__ = lambda: 9\n >>> len(c1)\n 5\n >>> len(c2)\n 9\n\n\nSpecial method lookup for new-style classes\n===========================================\n\nFor new-style classes, implicit invocations of special methods are\nonly guaranteed to work correctly if defined on an object\'s type, not\nin the object\'s instance dictionary. That behaviour is the reason why\nthe following code raises an exception (unlike the equivalent example\nwith old-style classes):\n\n >>> class C(object):\n ... pass\n ...\n >>> c = C()\n >>> c.__len__ = lambda: 5\n >>> len(c)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: object of type \'C\' has no len()\n\nThe rationale behind this behaviour lies with a number of special\nmethods such as ``__hash__()`` and ``__repr__()`` that are implemented\nby all objects, including type objects. If the implicit lookup of\nthese methods used the conventional lookup process, they would fail\nwhen invoked on the type object itself:\n\n >>> 1 .__hash__() == hash(1)\n True\n >>> int.__hash__() == hash(int)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: descriptor \'__hash__\' of \'int\' object needs an argument\n\nIncorrectly attempting to invoke an unbound method of a class in this\nway is sometimes referred to as \'metaclass confusion\', and is avoided\nby bypassing the instance when looking up special methods:\n\n >>> type(1).__hash__(1) == hash(1)\n True\n >>> type(int).__hash__(int) == hash(int)\n True\n\nIn addition to bypassing any instance attributes in the interest of\ncorrectness, implicit special method lookup generally also bypasses\nthe ``__getattribute__()`` method even of the object\'s metaclass:\n\n >>> class Meta(type):\n ... def __getattribute__(*args):\n ... print "Metaclass getattribute invoked"\n ... return type.__getattribute__(*args)\n ...\n >>> class C(object):\n ... __metaclass__ = Meta\n ... def __len__(self):\n ... return 10\n ... def __getattribute__(*args):\n ... print "Class getattribute invoked"\n ... return object.__getattribute__(*args)\n ...\n >>> c = C()\n >>> c.__len__() # Explicit lookup via instance\n Class getattribute invoked\n 10\n >>> type(c).__len__(c) # Explicit lookup via type\n Metaclass getattribute invoked\n 10\n >>> len(c) # Implicit lookup\n 10\n\nBypassing the ``__getattribute__()`` machinery in this fashion\nprovides significant scope for speed optimisations within the\ninterpreter, at the cost of some flexibility in the handling of\nspecial methods (the special method *must* be set on the class object\nitself in order to be consistently invoked by the interpreter).\n\n-[ Footnotes ]-\n\n[1] It *is* possible in some cases to change an object\'s type, under\n certain controlled conditions. It generally isn\'t a good idea\n though, since it can lead to some very strange behaviour if it is\n handled incorrectly.\n\n[2] For operands of the same type, it is assumed that if the non-\n reflected method (such as ``__add__()``) fails the operation is\n not supported, which is why the reflected method is not called.\n', + 'string-methods': '\nString Methods\n**************\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support. Some of them are also available on\n``bytearray`` objects.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the *Sequence Types --- str, unicode, list, tuple,\nbytearray, buffer, xrange* section. To output formatted strings use\ntemplate strings or the ``%`` operator described in the *String\nFormatting Operations* section. Also, see the ``re`` module for string\nfunctions based on regular expressions.\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is a space).\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\n Decodes the string using the codec registered for *encoding*.\n *encoding* defaults to the default string encoding. *errors* may\n be given to set a different error handling scheme. The default is\n ``\'strict\'``, meaning that encoding errors raise ``UnicodeError``.\n Other possible values are ``\'ignore\'``, ``\'replace\'`` and any other\n name registered via ``codecs.register_error()``, see section *Codec\n Base Classes*.\n\n New in version 2.2.\n\n Changed in version 2.3: Support for other error handling schemes\n added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.encode([encoding[, errors]])\n\n Return an encoded version of the string. Default encoding is the\n current default string encoding. *errors* may be given to set a\n different error handling scheme. The default for *errors* is\n ``\'strict\'``, meaning that encoding errors raise a\n ``UnicodeError``. Other possible values are ``\'ignore\'``,\n ``\'replace\'``, ``\'xmlcharrefreplace\'``, ``\'backslashreplace\'`` and\n any other name registered via ``codecs.register_error()``, see\n section *Codec Base Classes*. For a list of possible encodings, see\n section *Standard Encodings*.\n\n New in version 2.0.\n\n Changed in version 2.3: Support for ``\'xmlcharrefreplace\'`` and\n ``\'backslashreplace\'`` and other error handling schemes added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return ``True`` if the string ends with the specified *suffix*,\n otherwise return ``False``. *suffix* can also be a tuple of\n suffixes to look for. With optional *start*, test beginning at\n that position. With optional *end*, stop comparing at that\n position.\n\n Changed in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. The column number is reset to zero after each\n newline occurring in the string. If *tabsize* is not given, a tab\n size of ``8`` characters is assumed. This doesn\'t understand other\n non-printing characters or escape sequences.\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found, such that *sub* is contained in the slice ``s[start:end]``.\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return ``-1`` if *sub* is not found.\n\n Note: The ``find()`` method should be used only if you need to know the\n position of *sub*. To check if *sub* is a substring or not, use\n the ``in`` operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces ``{}``. Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See *Format String Syntax* for a description of the various\n formatting options that can be specified in format strings.\n\n This method of string formatting is the new standard in Python 3,\n and should be preferred to the ``%`` formatting described in\n *String Formatting Operations* in new code.\n\n New in version 2.6.\n\nstr.index(sub[, start[, end]])\n\n Like ``find()``, but raise ``ValueError`` when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. The separator between elements is the\n string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to ``len(s)``.\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\n New in version 2.5.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within ``s[start:end]``.\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return ``-1`` on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like ``rfind()`` but raises ``ValueError`` when the substring *sub*\n is not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to ``len(s)``.\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\n New in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n ``None``, any whitespace string is a separator. Except for\n splitting from the right, ``rsplit()`` behaves like ``split()``\n which is described in detail below.\n\n New in version 2.4.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most ``maxsplit+1``\n elements). If *maxsplit* is not specified or ``-1``, then there is\n no limit on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n ``\'1,,2\'.split(\',\')`` returns ``[\'1\', \'\', \'2\']``). The *sep*\n argument may consist of multiple characters (for example,\n ``\'1<>2<>3\'.split(\'<>\')`` returns ``[\'1\', \'2\', \'3\']``). Splitting\n an empty string with a specified separator returns ``[\'\']``.\n\n If *sep* is not specified or is ``None``, a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a ``None`` separator returns\n ``[]``.\n\n For example, ``\' 1 2 3 \'.split()`` returns ``[\'1\', \'2\', \'3\']``,\n and ``\' 1 2 3 \'.split(None, 1)`` returns ``[\'1\', \'2 3 \']``.\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. This method uses the *universal newlines* approach to\n splitting lines. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\n For example, ``\'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()`` returns\n ``[\'ab c\', \'\', \'de fg\', \'kl\']``, while the same call with\n ``splitlines(True)`` returns ``[\'ab c\\n\', \'\\n\', \'de fg\\r\',\n \'kl\\r\\n\']``.\n\n Unlike ``split()`` when a delimiter string *sep* is given, this\n method returns an empty list for the empty string, and a terminal\n line break does not result in an extra line.\n\nstr.startswith(prefix[, start[, end]])\n\n Return ``True`` if string starts with the *prefix*, otherwise\n return ``False``. *prefix* can also be a tuple of prefixes to look\n for. With optional *start*, test string beginning at that\n position. With optional *end*, stop comparing string at that\n position.\n\n Changed in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or ``None``, the\n *chars* argument defaults to removing whitespace. The *chars*\n argument is not a prefix or suffix; rather, all combinations of its\n values are stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n ... lambda mo: mo.group(0)[0].upper() +\n ... mo.group(0)[1:].lower(),\n ... s)\n ...\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\n Return a copy of the string where all characters occurring in the\n optional argument *deletechars* are removed, and the remaining\n characters have been mapped through the given translation table,\n which must be a string of length 256.\n\n You can use the ``maketrans()`` helper function in the ``string``\n module to create a translation table. For string objects, set the\n *table* argument to ``None`` for translations that only delete\n characters:\n\n >>> \'read this short text\'.translate(None, \'aeiou\')\n \'rd ths shrt txt\'\n\n New in version 2.6: Support for a ``None`` *table* argument.\n\n For Unicode objects, the ``translate()`` method does not accept the\n optional *deletechars* argument. Instead, it returns a copy of the\n *s* where all characters have been mapped through the given\n translation table which must be a mapping of Unicode ordinals to\n Unicode ordinals, Unicode strings or ``None``. Unmapped characters\n are left untouched. Characters mapped to ``None`` are deleted.\n Note, a more flexible approach is to create a custom character\n mapping codec using the ``codecs`` module (see ``encodings.cp1251``\n for an example).\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that ``str.upper().isupper()`` might\n be ``False`` if ``s`` contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\n Return the numeric string left filled with zeros in a string of\n length *width*. A sign prefix is handled correctly. The original\n string is returned if *width* is less than or equal to ``len(s)``.\n\n New in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\n Return ``True`` if there are only numeric characters in S,\n ``False`` otherwise. Numeric characters include digit characters,\n and all characters that have the Unicode numeric value property,\n e.g. U+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\n Return ``True`` if there are only decimal characters in S,\n ``False`` otherwise. Decimal characters include digit characters,\n and all characters that can be used to form decimal-radix numbers,\n e.g. U+0660, ARABIC-INDIC DIGIT ZERO.\n', 'strings': '\nString literals\n***************\n\nString literals are described by the following lexical definitions:\n\n stringliteral ::= [stringprefix](shortstring | longstring)\n stringprefix ::= "r" | "u" | "ur" | "R" | "U" | "UR" | "Ur" | "uR"\n | "b" | "B" | "br" | "Br" | "bR" | "BR"\n shortstring ::= "\'" shortstringitem* "\'" | \'"\' shortstringitem* \'"\'\n longstring ::= "\'\'\'" longstringitem* "\'\'\'"\n | \'"""\' longstringitem* \'"""\'\n shortstringitem ::= shortstringchar | escapeseq\n longstringitem ::= longstringchar | escapeseq\n shortstringchar ::= \n longstringchar ::= \n escapeseq ::= "\\" \n\nOne syntactic restriction not indicated by these productions is that\nwhitespace is not allowed between the ``stringprefix`` and the rest of\nthe string literal. The source character set is defined by the\nencoding declaration; it is ASCII if no encoding declaration is given\nin the source file; see section *Encoding declarations*.\n\nIn plain English: String literals can be enclosed in matching single\nquotes (``\'``) or double quotes (``"``). They can also be enclosed in\nmatching groups of three single or double quotes (these are generally\nreferred to as *triple-quoted strings*). The backslash (``\\``)\ncharacter is used to escape characters that otherwise have a special\nmeaning, such as newline, backslash itself, or the quote character.\nString literals may optionally be prefixed with a letter ``\'r\'`` or\n``\'R\'``; such strings are called *raw strings* and use different rules\nfor interpreting backslash escape sequences. A prefix of ``\'u\'`` or\n``\'U\'`` makes the string a Unicode string. Unicode strings use the\nUnicode character set as defined by the Unicode Consortium and ISO\n10646. Some additional escape sequences, described below, are\navailable in Unicode strings. A prefix of ``\'b\'`` or ``\'B\'`` is\nignored in Python 2; it indicates that the literal should become a\nbytes literal in Python 3 (e.g. when code is automatically converted\nwith 2to3). A ``\'u\'`` or ``\'b\'`` prefix may be followed by an ``\'r\'``\nprefix.\n\nIn triple-quoted strings, unescaped newlines and quotes are allowed\n(and are retained), except that three unescaped quotes in a row\nterminate the string. (A "quote" is the character used to open the\nstring, i.e. either ``\'`` or ``"``.)\n\nUnless an ``\'r\'`` or ``\'R\'`` prefix is present, escape sequences in\nstrings are interpreted according to rules similar to those used by\nStandard C. The recognized escape sequences are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| ``\\newline`` | Ignored | |\n+-------------------+-----------------------------------+---------+\n| ``\\\\`` | Backslash (``\\``) | |\n+-------------------+-----------------------------------+---------+\n| ``\\\'`` | Single quote (``\'``) | |\n+-------------------+-----------------------------------+---------+\n| ``\\"`` | Double quote (``"``) | |\n+-------------------+-----------------------------------+---------+\n| ``\\a`` | ASCII Bell (BEL) | |\n+-------------------+-----------------------------------+---------+\n| ``\\b`` | ASCII Backspace (BS) | |\n+-------------------+-----------------------------------+---------+\n| ``\\f`` | ASCII Formfeed (FF) | |\n+-------------------+-----------------------------------+---------+\n| ``\\n`` | ASCII Linefeed (LF) | |\n+-------------------+-----------------------------------+---------+\n| ``\\N{name}`` | Character named *name* in the | |\n| | Unicode database (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| ``\\r`` | ASCII Carriage Return (CR) | |\n+-------------------+-----------------------------------+---------+\n| ``\\t`` | ASCII Horizontal Tab (TAB) | |\n+-------------------+-----------------------------------+---------+\n| ``\\uxxxx`` | Character with 16-bit hex value | (1) |\n| | *xxxx* (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| ``\\Uxxxxxxxx`` | Character with 32-bit hex value | (2) |\n| | *xxxxxxxx* (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| ``\\v`` | ASCII Vertical Tab (VT) | |\n+-------------------+-----------------------------------+---------+\n| ``\\ooo`` | Character with octal value *ooo* | (3,5) |\n+-------------------+-----------------------------------+---------+\n| ``\\xhh`` | Character with hex value *hh* | (4,5) |\n+-------------------+-----------------------------------+---------+\n\nNotes:\n\n1. Individual code units which form parts of a surrogate pair can be\n encoded using this escape sequence.\n\n2. Any Unicode character can be encoded this way, but characters\n outside the Basic Multilingual Plane (BMP) will be encoded using a\n surrogate pair if Python is compiled to use 16-bit code units (the\n default). Individual code units which form parts of a surrogate\n pair can be encoded using this escape sequence.\n\n3. As in Standard C, up to three octal digits are accepted.\n\n4. Unlike in Standard C, exactly two hex digits are required.\n\n5. In a string literal, hexadecimal and octal escapes denote the byte\n with the given value; it is not necessary that the byte encodes a\n character in the source character set. In a Unicode literal, these\n escapes denote a Unicode character with the given value.\n\nUnlike Standard C, all unrecognized escape sequences are left in the\nstring unchanged, i.e., *the backslash is left in the string*. (This\nbehavior is useful when debugging: if an escape sequence is mistyped,\nthe resulting output is more easily recognized as broken.) It is also\nimportant to note that the escape sequences marked as "(Unicode only)"\nin the table above fall into the category of unrecognized escapes for\nnon-Unicode string literals.\n\nWhen an ``\'r\'`` or ``\'R\'`` prefix is present, a character following a\nbackslash is included in the string without change, and *all\nbackslashes are left in the string*. For example, the string literal\n``r"\\n"`` consists of two characters: a backslash and a lowercase\n``\'n\'``. String quotes can be escaped with a backslash, but the\nbackslash remains in the string; for example, ``r"\\""`` is a valid\nstring literal consisting of two characters: a backslash and a double\nquote; ``r"\\"`` is not a valid string literal (even a raw string\ncannot end in an odd number of backslashes). Specifically, *a raw\nstring cannot end in a single backslash* (since the backslash would\nescape the following quote character). Note also that a single\nbackslash followed by a newline is interpreted as those two characters\nas part of the string, *not* as a line continuation.\n\nWhen an ``\'r\'`` or ``\'R\'`` prefix is used in conjunction with a\n``\'u\'`` or ``\'U\'`` prefix, then the ``\\uXXXX`` and ``\\UXXXXXXXX``\nescape sequences are processed while *all other backslashes are left\nin the string*. For example, the string literal ``ur"\\u0062\\n"``\nconsists of three Unicode characters: \'LATIN SMALL LETTER B\', \'REVERSE\nSOLIDUS\', and \'LATIN SMALL LETTER N\'. Backslashes can be escaped with\na preceding backslash; however, both remain in the string. As a\nresult, ``\\uXXXX`` escape sequences are only recognized when there are\nan odd number of backslashes.\n', 'subscriptions': '\nSubscriptions\n*************\n\nA subscription selects an item of a sequence (string, tuple or list)\nor mapping (dictionary) object:\n\n subscription ::= primary "[" expression_list "]"\n\nThe primary must evaluate to an object of a sequence or mapping type.\n\nIf the primary is a mapping, the expression list must evaluate to an\nobject whose value is one of the keys of the mapping, and the\nsubscription selects the value in the mapping that corresponds to that\nkey. (The expression list is a tuple except if it has exactly one\nitem.)\n\nIf the primary is a sequence, the expression (list) must evaluate to a\nplain integer. If this value is negative, the length of the sequence\nis added to it (so that, e.g., ``x[-1]`` selects the last item of\n``x``.) The resulting value must be a nonnegative integer less than\nthe number of items in the sequence, and the subscription selects the\nitem whose index is that value (counting from zero).\n\nA string\'s items are characters. A character is not a separate data\ntype but a string of exactly one character.\n', 'truth': "\nTruth Value Testing\n*******************\n\nAny object can be tested for truth value, for use in an ``if`` or\n``while`` condition or as operand of the Boolean operations below. The\nfollowing values are considered false:\n\n* ``None``\n\n* ``False``\n\n* zero of any numeric type, for example, ``0``, ``0L``, ``0.0``,\n ``0j``.\n\n* any empty sequence, for example, ``''``, ``()``, ``[]``.\n\n* any empty mapping, for example, ``{}``.\n\n* instances of user-defined classes, if the class defines a\n ``__nonzero__()`` or ``__len__()`` method, when that method returns\n the integer zero or ``bool`` value ``False``. [1]\n\nAll other values are considered true --- so objects of many types are\nalways true.\n\nOperations and built-in functions that have a Boolean result always\nreturn ``0`` or ``False`` for false and ``1`` or ``True`` for true,\nunless otherwise stated. (Important exception: the Boolean operations\n``or`` and ``and`` always return one of their operands.)\n", - 'try': '\nThe ``try`` statement\n*********************\n\nThe ``try`` statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression [("as" | ",") target]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n``try``...``except``...``finally`` did not work. ``try``...``except``\nhad to be nested in ``try``...``finally``.\n\nThe ``except`` clause(s) specify one or more exception handlers. When\nno exception occurs in the ``try`` clause, no exception handler is\nexecuted. When an exception occurs in the ``try`` suite, a search for\nan exception handler is started. This search inspects the except\nclauses in turn until one is found that matches the exception. An\nexpression-less except clause, if present, must be last; it matches\nany exception. For an except clause with an expression, that\nexpression is evaluated, and the clause matches the exception if the\nresulting object is "compatible" with the exception. An object is\ncompatible with an exception if it is the class or a base class of the\nexception object, a tuple containing an item compatible with the\nexception, or, in the (deprecated) case of string exceptions, is the\nraised string itself (note that the object identities must match, i.e.\nit must be the same string object, not just a string with the same\nvalue).\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire ``try`` statement\nraised the exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed. All except clauses must have an\nexecutable block. When the end of this block is reached, execution\ncontinues normally after the entire try statement. (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the ``sys`` module:\n``sys.exc_type`` receives the object identifying the exception;\n``sys.exc_value`` receives the exception\'s parameter;\n``sys.exc_traceback`` receives a traceback object (see section *The\nstandard type hierarchy*) identifying the point in the program where\nthe exception occurred. These details are also available through the\n``sys.exc_info()`` function, which returns a tuple ``(exc_type,\nexc_value, exc_traceback)``. Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program. As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional ``else`` clause is executed if and when control flows off\nthe end of the ``try`` clause. [2] Exceptions in the ``else`` clause\nare not handled by the preceding ``except`` clauses.\n\nIf ``finally`` is present, it specifies a \'cleanup\' handler. The\n``try`` clause is executed, including any ``except`` and ``else``\nclauses. If an exception occurs in any of the clauses and is not\nhandled, the exception is temporarily saved. The ``finally`` clause is\nexecuted. If there is a saved exception, it is re-raised at the end\nof the ``finally`` clause. If the ``finally`` clause raises another\nexception or executes a ``return`` or ``break`` statement, the saved\nexception is lost. The exception information is not available to the\nprogram during execution of the ``finally`` clause.\n\nWhen a ``return``, ``break`` or ``continue`` statement is executed in\nthe ``try`` suite of a ``try``...``finally`` statement, the\n``finally`` clause is also executed \'on the way out.\' A ``continue``\nstatement is illegal in the ``finally`` clause. (The reason is a\nproblem with the current implementation --- this restriction may be\nlifted in the future).\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the ``raise`` statement to\ngenerate exceptions may be found in section *The raise statement*.\n', - 'types': '\nThe standard type hierarchy\n***************************\n\nBelow is a list of the types that are built into Python. Extension\nmodules (written in C, Java, or other languages, depending on the\nimplementation) can define additional types. Future versions of\nPython may add types to the type hierarchy (e.g., rational numbers,\nefficiently stored arrays of integers, etc.).\n\nSome of the type descriptions below contain a paragraph listing\n\'special attributes.\' These are attributes that provide access to the\nimplementation and are not intended for general use. Their definition\nmay change in the future.\n\nNone\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name ``None``.\n It is used to signify the absence of a value in many situations,\n e.g., it is returned from functions that don\'t explicitly return\n anything. Its truth value is false.\n\nNotImplemented\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name\n ``NotImplemented``. Numeric methods and rich comparison methods may\n return this value if they do not implement the operation for the\n operands provided. (The interpreter will then try the reflected\n operation, or some other fallback, depending on the operator.) Its\n truth value is true.\n\nEllipsis\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name\n ``Ellipsis``. It is used to indicate the presence of the ``...``\n syntax in a slice. Its truth value is true.\n\n``numbers.Number``\n These are created by numeric literals and returned as results by\n arithmetic operators and arithmetic built-in functions. Numeric\n objects are immutable; once created their value never changes.\n Python numbers are of course strongly related to mathematical\n numbers, but subject to the limitations of numerical representation\n in computers.\n\n Python distinguishes between integers, floating point numbers, and\n complex numbers:\n\n ``numbers.Integral``\n These represent elements from the mathematical set of integers\n (positive and negative).\n\n There are three types of integers:\n\n Plain integers\n These represent numbers in the range -2147483648 through\n 2147483647. (The range may be larger on machines with a\n larger natural word size, but not smaller.) When the result\n of an operation would fall outside this range, the result is\n normally returned as a long integer (in some cases, the\n exception ``OverflowError`` is raised instead). For the\n purpose of shift and mask operations, integers are assumed to\n have a binary, 2\'s complement notation using 32 or more bits,\n and hiding no bits from the user (i.e., all 4294967296\n different bit patterns correspond to different values).\n\n Long integers\n These represent numbers in an unlimited range, subject to\n available (virtual) memory only. For the purpose of shift\n and mask operations, a binary representation is assumed, and\n negative numbers are represented in a variant of 2\'s\n complement which gives the illusion of an infinite string of\n sign bits extending to the left.\n\n Booleans\n These represent the truth values False and True. The two\n objects representing the values False and True are the only\n Boolean objects. The Boolean type is a subtype of plain\n integers, and Boolean values behave like the values 0 and 1,\n respectively, in almost all contexts, the exception being\n that when converted to a string, the strings ``"False"`` or\n ``"True"`` are returned, respectively.\n\n The rules for integer representation are intended to give the\n most meaningful interpretation of shift and mask operations\n involving negative integers and the least surprises when\n switching between the plain and long integer domains. Any\n operation, if it yields a result in the plain integer domain,\n will yield the same result in the long integer domain or when\n using mixed operands. The switch between domains is transparent\n to the programmer.\n\n ``numbers.Real`` (``float``)\n These represent machine-level double precision floating point\n numbers. You are at the mercy of the underlying machine\n architecture (and C or Java implementation) for the accepted\n range and handling of overflow. Python does not support single-\n precision floating point numbers; the savings in processor and\n memory usage that are usually the reason for using these is\n dwarfed by the overhead of using objects in Python, so there is\n no reason to complicate the language with two kinds of floating\n point numbers.\n\n ``numbers.Complex``\n These represent complex numbers as a pair of machine-level\n double precision floating point numbers. The same caveats apply\n as for floating point numbers. The real and imaginary parts of a\n complex number ``z`` can be retrieved through the read-only\n attributes ``z.real`` and ``z.imag``.\n\nSequences\n These represent finite ordered sets indexed by non-negative\n numbers. The built-in function ``len()`` returns the number of\n items of a sequence. When the length of a sequence is *n*, the\n index set contains the numbers 0, 1, ..., *n*-1. Item *i* of\n sequence *a* is selected by ``a[i]``.\n\n Sequences also support slicing: ``a[i:j]`` selects all items with\n index *k* such that *i* ``<=`` *k* ``<`` *j*. When used as an\n expression, a slice is a sequence of the same type. This implies\n that the index set is renumbered so that it starts at 0.\n\n Some sequences also support "extended slicing" with a third "step"\n parameter: ``a[i:j:k]`` selects all items of *a* with index *x*\n where ``x = i + n*k``, *n* ``>=`` ``0`` and *i* ``<=`` *x* ``<``\n *j*.\n\n Sequences are distinguished according to their mutability:\n\n Immutable sequences\n An object of an immutable sequence type cannot change once it is\n created. (If the object contains references to other objects,\n these other objects may be mutable and may be changed; however,\n the collection of objects directly referenced by an immutable\n object cannot change.)\n\n The following types are immutable sequences:\n\n Strings\n The items of a string are characters. There is no separate\n character type; a character is represented by a string of one\n item. Characters represent (at least) 8-bit bytes. The\n built-in functions ``chr()`` and ``ord()`` convert between\n characters and nonnegative integers representing the byte\n values. Bytes with the values 0-127 usually represent the\n corresponding ASCII values, but the interpretation of values\n is up to the program. The string data type is also used to\n represent arrays of bytes, e.g., to hold data read from a\n file.\n\n (On systems whose native character set is not ASCII, strings\n may use EBCDIC in their internal representation, provided the\n functions ``chr()`` and ``ord()`` implement a mapping between\n ASCII and EBCDIC, and string comparison preserves the ASCII\n order. Or perhaps someone can propose a better rule?)\n\n Unicode\n The items of a Unicode object are Unicode code units. A\n Unicode code unit is represented by a Unicode object of one\n item and can hold either a 16-bit or 32-bit value\n representing a Unicode ordinal (the maximum value for the\n ordinal is given in ``sys.maxunicode``, and depends on how\n Python is configured at compile time). Surrogate pairs may\n be present in the Unicode object, and will be reported as two\n separate items. The built-in functions ``unichr()`` and\n ``ord()`` convert between code units and nonnegative integers\n representing the Unicode ordinals as defined in the Unicode\n Standard 3.0. Conversion from and to other encodings are\n possible through the Unicode method ``encode()`` and the\n built-in function ``unicode()``.\n\n Tuples\n The items of a tuple are arbitrary Python objects. Tuples of\n two or more items are formed by comma-separated lists of\n expressions. A tuple of one item (a \'singleton\') can be\n formed by affixing a comma to an expression (an expression by\n itself does not create a tuple, since parentheses must be\n usable for grouping of expressions). An empty tuple can be\n formed by an empty pair of parentheses.\n\n Mutable sequences\n Mutable sequences can be changed after they are created. The\n subscription and slicing notations can be used as the target of\n assignment and ``del`` (delete) statements.\n\n There are currently two intrinsic mutable sequence types:\n\n Lists\n The items of a list are arbitrary Python objects. Lists are\n formed by placing a comma-separated list of expressions in\n square brackets. (Note that there are no special cases needed\n to form lists of length 0 or 1.)\n\n Byte Arrays\n A bytearray object is a mutable array. They are created by\n the built-in ``bytearray()`` constructor. Aside from being\n mutable (and hence unhashable), byte arrays otherwise provide\n the same interface and functionality as immutable bytes\n objects.\n\n The extension module ``array`` provides an additional example of\n a mutable sequence type.\n\nSet types\n These represent unordered, finite sets of unique, immutable\n objects. As such, they cannot be indexed by any subscript. However,\n they can be iterated over, and the built-in function ``len()``\n returns the number of items in a set. Common uses for sets are fast\n membership testing, removing duplicates from a sequence, and\n computing mathematical operations such as intersection, union,\n difference, and symmetric difference.\n\n For set elements, the same immutability rules apply as for\n dictionary keys. Note that numeric types obey the normal rules for\n numeric comparison: if two numbers compare equal (e.g., ``1`` and\n ``1.0``), only one of them can be contained in a set.\n\n There are currently two intrinsic set types:\n\n Sets\n These represent a mutable set. They are created by the built-in\n ``set()`` constructor and can be modified afterwards by several\n methods, such as ``add()``.\n\n Frozen sets\n These represent an immutable set. They are created by the\n built-in ``frozenset()`` constructor. As a frozenset is\n immutable and *hashable*, it can be used again as an element of\n another set, or as a dictionary key.\n\nMappings\n These represent finite sets of objects indexed by arbitrary index\n sets. The subscript notation ``a[k]`` selects the item indexed by\n ``k`` from the mapping ``a``; this can be used in expressions and\n as the target of assignments or ``del`` statements. The built-in\n function ``len()`` returns the number of items in a mapping.\n\n There is currently a single intrinsic mapping type:\n\n Dictionaries\n These represent finite sets of objects indexed by nearly\n arbitrary values. The only types of values not acceptable as\n keys are values containing lists or dictionaries or other\n mutable types that are compared by value rather than by object\n identity, the reason being that the efficient implementation of\n dictionaries requires a key\'s hash value to remain constant.\n Numeric types used for keys obey the normal rules for numeric\n comparison: if two numbers compare equal (e.g., ``1`` and\n ``1.0``) then they can be used interchangeably to index the same\n dictionary entry.\n\n Dictionaries are mutable; they can be created by the ``{...}``\n notation (see section *Dictionary displays*).\n\n The extension modules ``dbm``, ``gdbm``, and ``bsddb`` provide\n additional examples of mapping types.\n\nCallable types\n These are the types to which the function call operation (see\n section *Calls*) can be applied:\n\n User-defined functions\n A user-defined function object is created by a function\n definition (see section *Function definitions*). It should be\n called with an argument list containing the same number of items\n as the function\'s formal parameter list.\n\n Special attributes:\n\n +-------------------------+---------------------------------+-------------+\n | Attribute | Meaning | |\n +=========================+=================================+=============+\n | ``func_doc`` | The function\'s documentation | Writable |\n | | string, or ``None`` if | |\n | | unavailable | |\n +-------------------------+---------------------------------+-------------+\n | ``__doc__`` | Another way of spelling | Writable |\n | | ``func_doc`` | |\n +-------------------------+---------------------------------+-------------+\n | ``func_name`` | The function\'s name | Writable |\n +-------------------------+---------------------------------+-------------+\n | ``__name__`` | Another way of spelling | Writable |\n | | ``func_name`` | |\n +-------------------------+---------------------------------+-------------+\n | ``__module__`` | The name of the module the | Writable |\n | | function was defined in, or | |\n | | ``None`` if unavailable. | |\n +-------------------------+---------------------------------+-------------+\n | ``func_defaults`` | A tuple containing default | Writable |\n | | argument values for those | |\n | | arguments that have defaults, | |\n | | or ``None`` if no arguments | |\n | | have a default value | |\n +-------------------------+---------------------------------+-------------+\n | ``func_code`` | The code object representing | Writable |\n | | the compiled function body. | |\n +-------------------------+---------------------------------+-------------+\n | ``func_globals`` | A reference to the dictionary | Read-only |\n | | that holds the function\'s | |\n | | global variables --- the global | |\n | | namespace of the module in | |\n | | which the function was defined. | |\n +-------------------------+---------------------------------+-------------+\n | ``func_dict`` | The namespace supporting | Writable |\n | | arbitrary function attributes. | |\n +-------------------------+---------------------------------+-------------+\n | ``func_closure`` | ``None`` or a tuple of cells | Read-only |\n | | that contain bindings for the | |\n | | function\'s free variables. | |\n +-------------------------+---------------------------------+-------------+\n\n Most of the attributes labelled "Writable" check the type of the\n assigned value.\n\n Changed in version 2.4: ``func_name`` is now writable.\n\n Function objects also support getting and setting arbitrary\n attributes, which can be used, for example, to attach metadata\n to functions. Regular attribute dot-notation is used to get and\n set such attributes. *Note that the current implementation only\n supports function attributes on user-defined functions. Function\n attributes on built-in functions may be supported in the\n future.*\n\n Additional information about a function\'s definition can be\n retrieved from its code object; see the description of internal\n types below.\n\n User-defined methods\n A user-defined method object combines a class, a class instance\n (or ``None``) and any callable object (normally a user-defined\n function).\n\n Special read-only attributes: ``im_self`` is the class instance\n object, ``im_func`` is the function object; ``im_class`` is the\n class of ``im_self`` for bound methods or the class that asked\n for the method for unbound methods; ``__doc__`` is the method\'s\n documentation (same as ``im_func.__doc__``); ``__name__`` is the\n method name (same as ``im_func.__name__``); ``__module__`` is\n the name of the module the method was defined in, or ``None`` if\n unavailable.\n\n Changed in version 2.2: ``im_self`` used to refer to the class\n that defined the method.\n\n Changed in version 2.6: For 3.0 forward-compatibility,\n ``im_func`` is also available as ``__func__``, and ``im_self``\n as ``__self__``.\n\n Methods also support accessing (but not setting) the arbitrary\n function attributes on the underlying function object.\n\n User-defined method objects may be created when getting an\n attribute of a class (perhaps via an instance of that class), if\n that attribute is a user-defined function object, an unbound\n user-defined method object, or a class method object. When the\n attribute is a user-defined method object, a new method object\n is only created if the class from which it is being retrieved is\n the same as, or a derived class of, the class stored in the\n original method object; otherwise, the original method object is\n used as it is.\n\n When a user-defined method object is created by retrieving a\n user-defined function object from a class, its ``im_self``\n attribute is ``None`` and the method object is said to be\n unbound. When one is created by retrieving a user-defined\n function object from a class via one of its instances, its\n ``im_self`` attribute is the instance, and the method object is\n said to be bound. In either case, the new method\'s ``im_class``\n attribute is the class from which the retrieval takes place, and\n its ``im_func`` attribute is the original function object.\n\n When a user-defined method object is created by retrieving\n another method object from a class or instance, the behaviour is\n the same as for a function object, except that the ``im_func``\n attribute of the new instance is not the original method object\n but its ``im_func`` attribute.\n\n When a user-defined method object is created by retrieving a\n class method object from a class or instance, its ``im_self``\n attribute is the class itself (the same as the ``im_class``\n attribute), and its ``im_func`` attribute is the function object\n underlying the class method.\n\n When an unbound user-defined method object is called, the\n underlying function (``im_func``) is called, with the\n restriction that the first argument must be an instance of the\n proper class (``im_class``) or of a derived class thereof.\n\n When a bound user-defined method object is called, the\n underlying function (``im_func``) is called, inserting the class\n instance (``im_self``) in front of the argument list. For\n instance, when ``C`` is a class which contains a definition for\n a function ``f()``, and ``x`` is an instance of ``C``, calling\n ``x.f(1)`` is equivalent to calling ``C.f(x, 1)``.\n\n When a user-defined method object is derived from a class method\n object, the "class instance" stored in ``im_self`` will actually\n be the class itself, so that calling either ``x.f(1)`` or\n ``C.f(1)`` is equivalent to calling ``f(C,1)`` where ``f`` is\n the underlying function.\n\n Note that the transformation from function object to (unbound or\n bound) method object happens each time the attribute is\n retrieved from the class or instance. In some cases, a fruitful\n optimization is to assign the attribute to a local variable and\n call that local variable. Also notice that this transformation\n only happens for user-defined functions; other callable objects\n (and all non-callable objects) are retrieved without\n transformation. It is also important to note that user-defined\n functions which are attributes of a class instance are not\n converted to bound methods; this *only* happens when the\n function is an attribute of the class.\n\n Generator functions\n A function or method which uses the ``yield`` statement (see\n section *The yield statement*) is called a *generator function*.\n Such a function, when called, always returns an iterator object\n which can be used to execute the body of the function: calling\n the iterator\'s ``next()`` method will cause the function to\n execute until it provides a value using the ``yield`` statement.\n When the function executes a ``return`` statement or falls off\n the end, a ``StopIteration`` exception is raised and the\n iterator will have reached the end of the set of values to be\n returned.\n\n Built-in functions\n A built-in function object is a wrapper around a C function.\n Examples of built-in functions are ``len()`` and ``math.sin()``\n (``math`` is a standard built-in module). The number and type of\n the arguments are determined by the C function. Special read-\n only attributes: ``__doc__`` is the function\'s documentation\n string, or ``None`` if unavailable; ``__name__`` is the\n function\'s name; ``__self__`` is set to ``None`` (but see the\n next item); ``__module__`` is the name of the module the\n function was defined in or ``None`` if unavailable.\n\n Built-in methods\n This is really a different disguise of a built-in function, this\n time containing an object passed to the C function as an\n implicit extra argument. An example of a built-in method is\n ``alist.append()``, assuming *alist* is a list object. In this\n case, the special read-only attribute ``__self__`` is set to the\n object denoted by *alist*.\n\n Class Types\n Class types, or "new-style classes," are callable. These\n objects normally act as factories for new instances of\n themselves, but variations are possible for class types that\n override ``__new__()``. The arguments of the call are passed to\n ``__new__()`` and, in the typical case, to ``__init__()`` to\n initialize the new instance.\n\n Classic Classes\n Class objects are described below. When a class object is\n called, a new class instance (also described below) is created\n and returned. This implies a call to the class\'s ``__init__()``\n method if it has one. Any arguments are passed on to the\n ``__init__()`` method. If there is no ``__init__()`` method,\n the class must be called without arguments.\n\n Class instances\n Class instances are described below. Class instances are\n callable only when the class has a ``__call__()`` method;\n ``x(arguments)`` is a shorthand for ``x.__call__(arguments)``.\n\nModules\n Modules are imported by the ``import`` statement (see section *The\n import statement*). A module object has a namespace implemented by\n a dictionary object (this is the dictionary referenced by the\n func_globals attribute of functions defined in the module).\n Attribute references are translated to lookups in this dictionary,\n e.g., ``m.x`` is equivalent to ``m.__dict__["x"]``. A module object\n does not contain the code object used to initialize the module\n (since it isn\'t needed once the initialization is done).\n\n Attribute assignment updates the module\'s namespace dictionary,\n e.g., ``m.x = 1`` is equivalent to ``m.__dict__["x"] = 1``.\n\n Special read-only attribute: ``__dict__`` is the module\'s namespace\n as a dictionary object.\n\n **CPython implementation detail:** Because of the way CPython\n clears module dictionaries, the module dictionary will be cleared\n when the module falls out of scope even if the dictionary still has\n live references. To avoid this, copy the dictionary or keep the\n module around while using its dictionary directly.\n\n Predefined (writable) attributes: ``__name__`` is the module\'s\n name; ``__doc__`` is the module\'s documentation string, or ``None``\n if unavailable; ``__file__`` is the pathname of the file from which\n the module was loaded, if it was loaded from a file. The\n ``__file__`` attribute is not present for C modules that are\n statically linked into the interpreter; for extension modules\n loaded dynamically from a shared library, it is the pathname of the\n shared library file.\n\nClasses\n Both class types (new-style classes) and class objects (old-\n style/classic classes) are typically created by class definitions\n (see section *Class definitions*). A class has a namespace\n implemented by a dictionary object. Class attribute references are\n translated to lookups in this dictionary, e.g., ``C.x`` is\n translated to ``C.__dict__["x"]`` (although for new-style classes\n in particular there are a number of hooks which allow for other\n means of locating attributes). When the attribute name is not found\n there, the attribute search continues in the base classes. For\n old-style classes, the search is depth-first, left-to-right in the\n order of occurrence in the base class list. New-style classes use\n the more complex C3 method resolution order which behaves correctly\n even in the presence of \'diamond\' inheritance structures where\n there are multiple inheritance paths leading back to a common\n ancestor. Additional details on the C3 MRO used by new-style\n classes can be found in the documentation accompanying the 2.3\n release at http://www.python.org/download/releases/2.3/mro/.\n\n When a class attribute reference (for class ``C``, say) would yield\n a user-defined function object or an unbound user-defined method\n object whose associated class is either ``C`` or one of its base\n classes, it is transformed into an unbound user-defined method\n object whose ``im_class`` attribute is ``C``. When it would yield a\n class method object, it is transformed into a bound user-defined\n method object whose ``im_class`` and ``im_self`` attributes are\n both ``C``. When it would yield a static method object, it is\n transformed into the object wrapped by the static method object.\n See section *Implementing Descriptors* for another way in which\n attributes retrieved from a class may differ from those actually\n contained in its ``__dict__`` (note that only new-style classes\n support descriptors).\n\n Class attribute assignments update the class\'s dictionary, never\n the dictionary of a base class.\n\n A class object can be called (see above) to yield a class instance\n (see below).\n\n Special attributes: ``__name__`` is the class name; ``__module__``\n is the module name in which the class was defined; ``__dict__`` is\n the dictionary containing the class\'s namespace; ``__bases__`` is a\n tuple (possibly empty or a singleton) containing the base classes,\n in the order of their occurrence in the base class list;\n ``__doc__`` is the class\'s documentation string, or None if\n undefined.\n\nClass instances\n A class instance is created by calling a class object (see above).\n A class instance has a namespace implemented as a dictionary which\n is the first place in which attribute references are searched.\n When an attribute is not found there, and the instance\'s class has\n an attribute by that name, the search continues with the class\n attributes. If a class attribute is found that is a user-defined\n function object or an unbound user-defined method object whose\n associated class is the class (call it ``C``) of the instance for\n which the attribute reference was initiated or one of its bases, it\n is transformed into a bound user-defined method object whose\n ``im_class`` attribute is ``C`` and whose ``im_self`` attribute is\n the instance. Static method and class method objects are also\n transformed, as if they had been retrieved from class ``C``; see\n above under "Classes". See section *Implementing Descriptors* for\n another way in which attributes of a class retrieved via its\n instances may differ from the objects actually stored in the\n class\'s ``__dict__``. If no class attribute is found, and the\n object\'s class has a ``__getattr__()`` method, that is called to\n satisfy the lookup.\n\n Attribute assignments and deletions update the instance\'s\n dictionary, never a class\'s dictionary. If the class has a\n ``__setattr__()`` or ``__delattr__()`` method, this is called\n instead of updating the instance dictionary directly.\n\n Class instances can pretend to be numbers, sequences, or mappings\n if they have methods with certain special names. See section\n *Special method names*.\n\n Special attributes: ``__dict__`` is the attribute dictionary;\n ``__class__`` is the instance\'s class.\n\nFiles\n A file object represents an open file. File objects are created by\n the ``open()`` built-in function, and also by ``os.popen()``,\n ``os.fdopen()``, and the ``makefile()`` method of socket objects\n (and perhaps by other functions or methods provided by extension\n modules). The objects ``sys.stdin``, ``sys.stdout`` and\n ``sys.stderr`` are initialized to file objects corresponding to the\n interpreter\'s standard input, output and error streams. See *File\n Objects* for complete documentation of file objects.\n\nInternal types\n A few types used internally by the interpreter are exposed to the\n user. Their definitions may change with future versions of the\n interpreter, but they are mentioned here for completeness.\n\n Code objects\n Code objects represent *byte-compiled* executable Python code,\n or *bytecode*. The difference between a code object and a\n function object is that the function object contains an explicit\n reference to the function\'s globals (the module in which it was\n defined), while a code object contains no context; also the\n default argument values are stored in the function object, not\n in the code object (because they represent values calculated at\n run-time). Unlike function objects, code objects are immutable\n and contain no references (directly or indirectly) to mutable\n objects.\n\n Special read-only attributes: ``co_name`` gives the function\n name; ``co_argcount`` is the number of positional arguments\n (including arguments with default values); ``co_nlocals`` is the\n number of local variables used by the function (including\n arguments); ``co_varnames`` is a tuple containing the names of\n the local variables (starting with the argument names);\n ``co_cellvars`` is a tuple containing the names of local\n variables that are referenced by nested functions;\n ``co_freevars`` is a tuple containing the names of free\n variables; ``co_code`` is a string representing the sequence of\n bytecode instructions; ``co_consts`` is a tuple containing the\n literals used by the bytecode; ``co_names`` is a tuple\n containing the names used by the bytecode; ``co_filename`` is\n the filename from which the code was compiled;\n ``co_firstlineno`` is the first line number of the function;\n ``co_lnotab`` is a string encoding the mapping from bytecode\n offsets to line numbers (for details see the source code of the\n interpreter); ``co_stacksize`` is the required stack size\n (including local variables); ``co_flags`` is an integer encoding\n a number of flags for the interpreter.\n\n The following flag bits are defined for ``co_flags``: bit\n ``0x04`` is set if the function uses the ``*arguments`` syntax\n to accept an arbitrary number of positional arguments; bit\n ``0x08`` is set if the function uses the ``**keywords`` syntax\n to accept arbitrary keyword arguments; bit ``0x20`` is set if\n the function is a generator.\n\n Future feature declarations (``from __future__ import\n division``) also use bits in ``co_flags`` to indicate whether a\n code object was compiled with a particular feature enabled: bit\n ``0x2000`` is set if the function was compiled with future\n division enabled; bits ``0x10`` and ``0x1000`` were used in\n earlier versions of Python.\n\n Other bits in ``co_flags`` are reserved for internal use.\n\n If a code object represents a function, the first item in\n ``co_consts`` is the documentation string of the function, or\n ``None`` if undefined.\n\n Frame objects\n Frame objects represent execution frames. They may occur in\n traceback objects (see below).\n\n Special read-only attributes: ``f_back`` is to the previous\n stack frame (towards the caller), or ``None`` if this is the\n bottom stack frame; ``f_code`` is the code object being executed\n in this frame; ``f_locals`` is the dictionary used to look up\n local variables; ``f_globals`` is used for global variables;\n ``f_builtins`` is used for built-in (intrinsic) names;\n ``f_restricted`` is a flag indicating whether the function is\n executing in restricted execution mode; ``f_lasti`` gives the\n precise instruction (this is an index into the bytecode string\n of the code object).\n\n Special writable attributes: ``f_trace``, if not ``None``, is a\n function called at the start of each source code line (this is\n used by the debugger); ``f_exc_type``, ``f_exc_value``,\n ``f_exc_traceback`` represent the last exception raised in the\n parent frame provided another exception was ever raised in the\n current frame (in all other cases they are None); ``f_lineno``\n is the current line number of the frame --- writing to this from\n within a trace function jumps to the given line (only for the\n bottom-most frame). A debugger can implement a Jump command\n (aka Set Next Statement) by writing to f_lineno.\n\n Traceback objects\n Traceback objects represent a stack trace of an exception. A\n traceback object is created when an exception occurs. When the\n search for an exception handler unwinds the execution stack, at\n each unwound level a traceback object is inserted in front of\n the current traceback. When an exception handler is entered,\n the stack trace is made available to the program. (See section\n *The try statement*.) It is accessible as ``sys.exc_traceback``,\n and also as the third item of the tuple returned by\n ``sys.exc_info()``. The latter is the preferred interface,\n since it works correctly when the program is using multiple\n threads. When the program contains no suitable handler, the\n stack trace is written (nicely formatted) to the standard error\n stream; if the interpreter is interactive, it is also made\n available to the user as ``sys.last_traceback``.\n\n Special read-only attributes: ``tb_next`` is the next level in\n the stack trace (towards the frame where the exception\n occurred), or ``None`` if there is no next level; ``tb_frame``\n points to the execution frame of the current level;\n ``tb_lineno`` gives the line number where the exception\n occurred; ``tb_lasti`` indicates the precise instruction. The\n line number and last instruction in the traceback may differ\n from the line number of its frame object if the exception\n occurred in a ``try`` statement with no matching except clause\n or with a finally clause.\n\n Slice objects\n Slice objects are used to represent slices when *extended slice\n syntax* is used. This is a slice using two colons, or multiple\n slices or ellipses separated by commas, e.g., ``a[i:j:step]``,\n ``a[i:j, k:l]``, or ``a[..., i:j]``. They are also created by\n the built-in ``slice()`` function.\n\n Special read-only attributes: ``start`` is the lower bound;\n ``stop`` is the upper bound; ``step`` is the step value; each is\n ``None`` if omitted. These attributes can have any type.\n\n Slice objects support one method:\n\n slice.indices(self, length)\n\n This method takes a single integer argument *length* and\n computes information about the extended slice that the slice\n object would describe if applied to a sequence of *length*\n items. It returns a tuple of three integers; respectively\n these are the *start* and *stop* indices and the *step* or\n stride length of the slice. Missing or out-of-bounds indices\n are handled in a manner consistent with regular slices.\n\n New in version 2.3.\n\n Static method objects\n Static method objects provide a way of defeating the\n transformation of function objects to method objects described\n above. A static method object is a wrapper around any other\n object, usually a user-defined method object. When a static\n method object is retrieved from a class or a class instance, the\n object actually returned is the wrapped object, which is not\n subject to any further transformation. Static method objects are\n not themselves callable, although the objects they wrap usually\n are. Static method objects are created by the built-in\n ``staticmethod()`` constructor.\n\n Class method objects\n A class method object, like a static method object, is a wrapper\n around another object that alters the way in which that object\n is retrieved from classes and class instances. The behaviour of\n class method objects upon such retrieval is described above,\n under "User-defined methods". Class method objects are created\n by the built-in ``classmethod()`` constructor.\n', + 'try': '\nThe ``try`` statement\n*********************\n\nThe ``try`` statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression [("as" | ",") target]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n``try``...``except``...``finally`` did not work. ``try``...``except``\nhad to be nested in ``try``...``finally``.\n\nThe ``except`` clause(s) specify one or more exception handlers. When\nno exception occurs in the ``try`` clause, no exception handler is\nexecuted. When an exception occurs in the ``try`` suite, a search for\nan exception handler is started. This search inspects the except\nclauses in turn until one is found that matches the exception. An\nexpression-less except clause, if present, must be last; it matches\nany exception. For an except clause with an expression, that\nexpression is evaluated, and the clause matches the exception if the\nresulting object is "compatible" with the exception. An object is\ncompatible with an exception if it is the class or a base class of the\nexception object, or a tuple containing an item compatible with the\nexception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire ``try`` statement\nraised the exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed. All except clauses must have an\nexecutable block. When the end of this block is reached, execution\ncontinues normally after the entire try statement. (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the ``sys`` module:\n``sys.exc_type`` receives the object identifying the exception;\n``sys.exc_value`` receives the exception\'s parameter;\n``sys.exc_traceback`` receives a traceback object (see section *The\nstandard type hierarchy*) identifying the point in the program where\nthe exception occurred. These details are also available through the\n``sys.exc_info()`` function, which returns a tuple ``(exc_type,\nexc_value, exc_traceback)``. Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program. As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional ``else`` clause is executed if and when control flows off\nthe end of the ``try`` clause. [2] Exceptions in the ``else`` clause\nare not handled by the preceding ``except`` clauses.\n\nIf ``finally`` is present, it specifies a \'cleanup\' handler. The\n``try`` clause is executed, including any ``except`` and ``else``\nclauses. If an exception occurs in any of the clauses and is not\nhandled, the exception is temporarily saved. The ``finally`` clause is\nexecuted. If there is a saved exception, it is re-raised at the end\nof the ``finally`` clause. If the ``finally`` clause raises another\nexception or executes a ``return`` or ``break`` statement, the saved\nexception is discarded:\n\n def f():\n try:\n 1/0\n finally:\n return 42\n\n >>> f()\n 42\n\nThe exception information is not available to the program during\nexecution of the ``finally`` clause.\n\nWhen a ``return``, ``break`` or ``continue`` statement is executed in\nthe ``try`` suite of a ``try``...``finally`` statement, the\n``finally`` clause is also executed \'on the way out.\' A ``continue``\nstatement is illegal in the ``finally`` clause. (The reason is a\nproblem with the current implementation --- this restriction may be\nlifted in the future).\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the ``raise`` statement to\ngenerate exceptions may be found in section *The raise statement*.\n', + 'types': '\nThe standard type hierarchy\n***************************\n\nBelow is a list of the types that are built into Python. Extension\nmodules (written in C, Java, or other languages, depending on the\nimplementation) can define additional types. Future versions of\nPython may add types to the type hierarchy (e.g., rational numbers,\nefficiently stored arrays of integers, etc.).\n\nSome of the type descriptions below contain a paragraph listing\n\'special attributes.\' These are attributes that provide access to the\nimplementation and are not intended for general use. Their definition\nmay change in the future.\n\nNone\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name ``None``.\n It is used to signify the absence of a value in many situations,\n e.g., it is returned from functions that don\'t explicitly return\n anything. Its truth value is false.\n\nNotImplemented\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name\n ``NotImplemented``. Numeric methods and rich comparison methods may\n return this value if they do not implement the operation for the\n operands provided. (The interpreter will then try the reflected\n operation, or some other fallback, depending on the operator.) Its\n truth value is true.\n\nEllipsis\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name\n ``Ellipsis``. It is used to indicate the presence of the ``...``\n syntax in a slice. Its truth value is true.\n\n``numbers.Number``\n These are created by numeric literals and returned as results by\n arithmetic operators and arithmetic built-in functions. Numeric\n objects are immutable; once created their value never changes.\n Python numbers are of course strongly related to mathematical\n numbers, but subject to the limitations of numerical representation\n in computers.\n\n Python distinguishes between integers, floating point numbers, and\n complex numbers:\n\n ``numbers.Integral``\n These represent elements from the mathematical set of integers\n (positive and negative).\n\n There are three types of integers:\n\n Plain integers\n These represent numbers in the range -2147483648 through\n 2147483647. (The range may be larger on machines with a\n larger natural word size, but not smaller.) When the result\n of an operation would fall outside this range, the result is\n normally returned as a long integer (in some cases, the\n exception ``OverflowError`` is raised instead). For the\n purpose of shift and mask operations, integers are assumed to\n have a binary, 2\'s complement notation using 32 or more bits,\n and hiding no bits from the user (i.e., all 4294967296\n different bit patterns correspond to different values).\n\n Long integers\n These represent numbers in an unlimited range, subject to\n available (virtual) memory only. For the purpose of shift\n and mask operations, a binary representation is assumed, and\n negative numbers are represented in a variant of 2\'s\n complement which gives the illusion of an infinite string of\n sign bits extending to the left.\n\n Booleans\n These represent the truth values False and True. The two\n objects representing the values False and True are the only\n Boolean objects. The Boolean type is a subtype of plain\n integers, and Boolean values behave like the values 0 and 1,\n respectively, in almost all contexts, the exception being\n that when converted to a string, the strings ``"False"`` or\n ``"True"`` are returned, respectively.\n\n The rules for integer representation are intended to give the\n most meaningful interpretation of shift and mask operations\n involving negative integers and the least surprises when\n switching between the plain and long integer domains. Any\n operation, if it yields a result in the plain integer domain,\n will yield the same result in the long integer domain or when\n using mixed operands. The switch between domains is transparent\n to the programmer.\n\n ``numbers.Real`` (``float``)\n These represent machine-level double precision floating point\n numbers. You are at the mercy of the underlying machine\n architecture (and C or Java implementation) for the accepted\n range and handling of overflow. Python does not support single-\n precision floating point numbers; the savings in processor and\n memory usage that are usually the reason for using these is\n dwarfed by the overhead of using objects in Python, so there is\n no reason to complicate the language with two kinds of floating\n point numbers.\n\n ``numbers.Complex``\n These represent complex numbers as a pair of machine-level\n double precision floating point numbers. The same caveats apply\n as for floating point numbers. The real and imaginary parts of a\n complex number ``z`` can be retrieved through the read-only\n attributes ``z.real`` and ``z.imag``.\n\nSequences\n These represent finite ordered sets indexed by non-negative\n numbers. The built-in function ``len()`` returns the number of\n items of a sequence. When the length of a sequence is *n*, the\n index set contains the numbers 0, 1, ..., *n*-1. Item *i* of\n sequence *a* is selected by ``a[i]``.\n\n Sequences also support slicing: ``a[i:j]`` selects all items with\n index *k* such that *i* ``<=`` *k* ``<`` *j*. When used as an\n expression, a slice is a sequence of the same type. This implies\n that the index set is renumbered so that it starts at 0.\n\n Some sequences also support "extended slicing" with a third "step"\n parameter: ``a[i:j:k]`` selects all items of *a* with index *x*\n where ``x = i + n*k``, *n* ``>=`` ``0`` and *i* ``<=`` *x* ``<``\n *j*.\n\n Sequences are distinguished according to their mutability:\n\n Immutable sequences\n An object of an immutable sequence type cannot change once it is\n created. (If the object contains references to other objects,\n these other objects may be mutable and may be changed; however,\n the collection of objects directly referenced by an immutable\n object cannot change.)\n\n The following types are immutable sequences:\n\n Strings\n The items of a string are characters. There is no separate\n character type; a character is represented by a string of one\n item. Characters represent (at least) 8-bit bytes. The\n built-in functions ``chr()`` and ``ord()`` convert between\n characters and nonnegative integers representing the byte\n values. Bytes with the values 0-127 usually represent the\n corresponding ASCII values, but the interpretation of values\n is up to the program. The string data type is also used to\n represent arrays of bytes, e.g., to hold data read from a\n file.\n\n (On systems whose native character set is not ASCII, strings\n may use EBCDIC in their internal representation, provided the\n functions ``chr()`` and ``ord()`` implement a mapping between\n ASCII and EBCDIC, and string comparison preserves the ASCII\n order. Or perhaps someone can propose a better rule?)\n\n Unicode\n The items of a Unicode object are Unicode code units. A\n Unicode code unit is represented by a Unicode object of one\n item and can hold either a 16-bit or 32-bit value\n representing a Unicode ordinal (the maximum value for the\n ordinal is given in ``sys.maxunicode``, and depends on how\n Python is configured at compile time). Surrogate pairs may\n be present in the Unicode object, and will be reported as two\n separate items. The built-in functions ``unichr()`` and\n ``ord()`` convert between code units and nonnegative integers\n representing the Unicode ordinals as defined in the Unicode\n Standard 3.0. Conversion from and to other encodings are\n possible through the Unicode method ``encode()`` and the\n built-in function ``unicode()``.\n\n Tuples\n The items of a tuple are arbitrary Python objects. Tuples of\n two or more items are formed by comma-separated lists of\n expressions. A tuple of one item (a \'singleton\') can be\n formed by affixing a comma to an expression (an expression by\n itself does not create a tuple, since parentheses must be\n usable for grouping of expressions). An empty tuple can be\n formed by an empty pair of parentheses.\n\n Mutable sequences\n Mutable sequences can be changed after they are created. The\n subscription and slicing notations can be used as the target of\n assignment and ``del`` (delete) statements.\n\n There are currently two intrinsic mutable sequence types:\n\n Lists\n The items of a list are arbitrary Python objects. Lists are\n formed by placing a comma-separated list of expressions in\n square brackets. (Note that there are no special cases needed\n to form lists of length 0 or 1.)\n\n Byte Arrays\n A bytearray object is a mutable array. They are created by\n the built-in ``bytearray()`` constructor. Aside from being\n mutable (and hence unhashable), byte arrays otherwise provide\n the same interface and functionality as immutable bytes\n objects.\n\n The extension module ``array`` provides an additional example of\n a mutable sequence type.\n\nSet types\n These represent unordered, finite sets of unique, immutable\n objects. As such, they cannot be indexed by any subscript. However,\n they can be iterated over, and the built-in function ``len()``\n returns the number of items in a set. Common uses for sets are fast\n membership testing, removing duplicates from a sequence, and\n computing mathematical operations such as intersection, union,\n difference, and symmetric difference.\n\n For set elements, the same immutability rules apply as for\n dictionary keys. Note that numeric types obey the normal rules for\n numeric comparison: if two numbers compare equal (e.g., ``1`` and\n ``1.0``), only one of them can be contained in a set.\n\n There are currently two intrinsic set types:\n\n Sets\n These represent a mutable set. They are created by the built-in\n ``set()`` constructor and can be modified afterwards by several\n methods, such as ``add()``.\n\n Frozen sets\n These represent an immutable set. They are created by the\n built-in ``frozenset()`` constructor. As a frozenset is\n immutable and *hashable*, it can be used again as an element of\n another set, or as a dictionary key.\n\nMappings\n These represent finite sets of objects indexed by arbitrary index\n sets. The subscript notation ``a[k]`` selects the item indexed by\n ``k`` from the mapping ``a``; this can be used in expressions and\n as the target of assignments or ``del`` statements. The built-in\n function ``len()`` returns the number of items in a mapping.\n\n There is currently a single intrinsic mapping type:\n\n Dictionaries\n These represent finite sets of objects indexed by nearly\n arbitrary values. The only types of values not acceptable as\n keys are values containing lists or dictionaries or other\n mutable types that are compared by value rather than by object\n identity, the reason being that the efficient implementation of\n dictionaries requires a key\'s hash value to remain constant.\n Numeric types used for keys obey the normal rules for numeric\n comparison: if two numbers compare equal (e.g., ``1`` and\n ``1.0``) then they can be used interchangeably to index the same\n dictionary entry.\n\n Dictionaries are mutable; they can be created by the ``{...}``\n notation (see section *Dictionary displays*).\n\n The extension modules ``dbm``, ``gdbm``, and ``bsddb`` provide\n additional examples of mapping types.\n\nCallable types\n These are the types to which the function call operation (see\n section *Calls*) can be applied:\n\n User-defined functions\n A user-defined function object is created by a function\n definition (see section *Function definitions*). It should be\n called with an argument list containing the same number of items\n as the function\'s formal parameter list.\n\n Special attributes:\n\n +-------------------------+---------------------------------+-------------+\n | Attribute | Meaning | |\n +=========================+=================================+=============+\n | ``func_doc`` | The function\'s documentation | Writable |\n | | string, or ``None`` if | |\n | | unavailable | |\n +-------------------------+---------------------------------+-------------+\n | ``__doc__`` | Another way of spelling | Writable |\n | | ``func_doc`` | |\n +-------------------------+---------------------------------+-------------+\n | ``func_name`` | The function\'s name | Writable |\n +-------------------------+---------------------------------+-------------+\n | ``__name__`` | Another way of spelling | Writable |\n | | ``func_name`` | |\n +-------------------------+---------------------------------+-------------+\n | ``__module__`` | The name of the module the | Writable |\n | | function was defined in, or | |\n | | ``None`` if unavailable. | |\n +-------------------------+---------------------------------+-------------+\n | ``func_defaults`` | A tuple containing default | Writable |\n | | argument values for those | |\n | | arguments that have defaults, | |\n | | or ``None`` if no arguments | |\n | | have a default value | |\n +-------------------------+---------------------------------+-------------+\n | ``func_code`` | The code object representing | Writable |\n | | the compiled function body. | |\n +-------------------------+---------------------------------+-------------+\n | ``func_globals`` | A reference to the dictionary | Read-only |\n | | that holds the function\'s | |\n | | global variables --- the global | |\n | | namespace of the module in | |\n | | which the function was defined. | |\n +-------------------------+---------------------------------+-------------+\n | ``func_dict`` | The namespace supporting | Writable |\n | | arbitrary function attributes. | |\n +-------------------------+---------------------------------+-------------+\n | ``func_closure`` | ``None`` or a tuple of cells | Read-only |\n | | that contain bindings for the | |\n | | function\'s free variables. | |\n +-------------------------+---------------------------------+-------------+\n\n Most of the attributes labelled "Writable" check the type of the\n assigned value.\n\n Changed in version 2.4: ``func_name`` is now writable.\n\n Function objects also support getting and setting arbitrary\n attributes, which can be used, for example, to attach metadata\n to functions. Regular attribute dot-notation is used to get and\n set such attributes. *Note that the current implementation only\n supports function attributes on user-defined functions. Function\n attributes on built-in functions may be supported in the\n future.*\n\n Additional information about a function\'s definition can be\n retrieved from its code object; see the description of internal\n types below.\n\n User-defined methods\n A user-defined method object combines a class, a class instance\n (or ``None``) and any callable object (normally a user-defined\n function).\n\n Special read-only attributes: ``im_self`` is the class instance\n object, ``im_func`` is the function object; ``im_class`` is the\n class of ``im_self`` for bound methods or the class that asked\n for the method for unbound methods; ``__doc__`` is the method\'s\n documentation (same as ``im_func.__doc__``); ``__name__`` is the\n method name (same as ``im_func.__name__``); ``__module__`` is\n the name of the module the method was defined in, or ``None`` if\n unavailable.\n\n Changed in version 2.2: ``im_self`` used to refer to the class\n that defined the method.\n\n Changed in version 2.6: For Python 3 forward-compatibility,\n ``im_func`` is also available as ``__func__``, and ``im_self``\n as ``__self__``.\n\n Methods also support accessing (but not setting) the arbitrary\n function attributes on the underlying function object.\n\n User-defined method objects may be created when getting an\n attribute of a class (perhaps via an instance of that class), if\n that attribute is a user-defined function object, an unbound\n user-defined method object, or a class method object. When the\n attribute is a user-defined method object, a new method object\n is only created if the class from which it is being retrieved is\n the same as, or a derived class of, the class stored in the\n original method object; otherwise, the original method object is\n used as it is.\n\n When a user-defined method object is created by retrieving a\n user-defined function object from a class, its ``im_self``\n attribute is ``None`` and the method object is said to be\n unbound. When one is created by retrieving a user-defined\n function object from a class via one of its instances, its\n ``im_self`` attribute is the instance, and the method object is\n said to be bound. In either case, the new method\'s ``im_class``\n attribute is the class from which the retrieval takes place, and\n its ``im_func`` attribute is the original function object.\n\n When a user-defined method object is created by retrieving\n another method object from a class or instance, the behaviour is\n the same as for a function object, except that the ``im_func``\n attribute of the new instance is not the original method object\n but its ``im_func`` attribute.\n\n When a user-defined method object is created by retrieving a\n class method object from a class or instance, its ``im_self``\n attribute is the class itself (the same as the ``im_class``\n attribute), and its ``im_func`` attribute is the function object\n underlying the class method.\n\n When an unbound user-defined method object is called, the\n underlying function (``im_func``) is called, with the\n restriction that the first argument must be an instance of the\n proper class (``im_class``) or of a derived class thereof.\n\n When a bound user-defined method object is called, the\n underlying function (``im_func``) is called, inserting the class\n instance (``im_self``) in front of the argument list. For\n instance, when ``C`` is a class which contains a definition for\n a function ``f()``, and ``x`` is an instance of ``C``, calling\n ``x.f(1)`` is equivalent to calling ``C.f(x, 1)``.\n\n When a user-defined method object is derived from a class method\n object, the "class instance" stored in ``im_self`` will actually\n be the class itself, so that calling either ``x.f(1)`` or\n ``C.f(1)`` is equivalent to calling ``f(C,1)`` where ``f`` is\n the underlying function.\n\n Note that the transformation from function object to (unbound or\n bound) method object happens each time the attribute is\n retrieved from the class or instance. In some cases, a fruitful\n optimization is to assign the attribute to a local variable and\n call that local variable. Also notice that this transformation\n only happens for user-defined functions; other callable objects\n (and all non-callable objects) are retrieved without\n transformation. It is also important to note that user-defined\n functions which are attributes of a class instance are not\n converted to bound methods; this *only* happens when the\n function is an attribute of the class.\n\n Generator functions\n A function or method which uses the ``yield`` statement (see\n section *The yield statement*) is called a *generator function*.\n Such a function, when called, always returns an iterator object\n which can be used to execute the body of the function: calling\n the iterator\'s ``next()`` method will cause the function to\n execute until it provides a value using the ``yield`` statement.\n When the function executes a ``return`` statement or falls off\n the end, a ``StopIteration`` exception is raised and the\n iterator will have reached the end of the set of values to be\n returned.\n\n Built-in functions\n A built-in function object is a wrapper around a C function.\n Examples of built-in functions are ``len()`` and ``math.sin()``\n (``math`` is a standard built-in module). The number and type of\n the arguments are determined by the C function. Special read-\n only attributes: ``__doc__`` is the function\'s documentation\n string, or ``None`` if unavailable; ``__name__`` is the\n function\'s name; ``__self__`` is set to ``None`` (but see the\n next item); ``__module__`` is the name of the module the\n function was defined in or ``None`` if unavailable.\n\n Built-in methods\n This is really a different disguise of a built-in function, this\n time containing an object passed to the C function as an\n implicit extra argument. An example of a built-in method is\n ``alist.append()``, assuming *alist* is a list object. In this\n case, the special read-only attribute ``__self__`` is set to the\n object denoted by *alist*.\n\n Class Types\n Class types, or "new-style classes," are callable. These\n objects normally act as factories for new instances of\n themselves, but variations are possible for class types that\n override ``__new__()``. The arguments of the call are passed to\n ``__new__()`` and, in the typical case, to ``__init__()`` to\n initialize the new instance.\n\n Classic Classes\n Class objects are described below. When a class object is\n called, a new class instance (also described below) is created\n and returned. This implies a call to the class\'s ``__init__()``\n method if it has one. Any arguments are passed on to the\n ``__init__()`` method. If there is no ``__init__()`` method,\n the class must be called without arguments.\n\n Class instances\n Class instances are described below. Class instances are\n callable only when the class has a ``__call__()`` method;\n ``x(arguments)`` is a shorthand for ``x.__call__(arguments)``.\n\nModules\n Modules are imported by the ``import`` statement (see section *The\n import statement*). A module object has a namespace implemented by\n a dictionary object (this is the dictionary referenced by the\n func_globals attribute of functions defined in the module).\n Attribute references are translated to lookups in this dictionary,\n e.g., ``m.x`` is equivalent to ``m.__dict__["x"]``. A module object\n does not contain the code object used to initialize the module\n (since it isn\'t needed once the initialization is done).\n\n Attribute assignment updates the module\'s namespace dictionary,\n e.g., ``m.x = 1`` is equivalent to ``m.__dict__["x"] = 1``.\n\n Special read-only attribute: ``__dict__`` is the module\'s namespace\n as a dictionary object.\n\n **CPython implementation detail:** Because of the way CPython\n clears module dictionaries, the module dictionary will be cleared\n when the module falls out of scope even if the dictionary still has\n live references. To avoid this, copy the dictionary or keep the\n module around while using its dictionary directly.\n\n Predefined (writable) attributes: ``__name__`` is the module\'s\n name; ``__doc__`` is the module\'s documentation string, or ``None``\n if unavailable; ``__file__`` is the pathname of the file from which\n the module was loaded, if it was loaded from a file. The\n ``__file__`` attribute is not present for C modules that are\n statically linked into the interpreter; for extension modules\n loaded dynamically from a shared library, it is the pathname of the\n shared library file.\n\nClasses\n Both class types (new-style classes) and class objects (old-\n style/classic classes) are typically created by class definitions\n (see section *Class definitions*). A class has a namespace\n implemented by a dictionary object. Class attribute references are\n translated to lookups in this dictionary, e.g., ``C.x`` is\n translated to ``C.__dict__["x"]`` (although for new-style classes\n in particular there are a number of hooks which allow for other\n means of locating attributes). When the attribute name is not found\n there, the attribute search continues in the base classes. For\n old-style classes, the search is depth-first, left-to-right in the\n order of occurrence in the base class list. New-style classes use\n the more complex C3 method resolution order which behaves correctly\n even in the presence of \'diamond\' inheritance structures where\n there are multiple inheritance paths leading back to a common\n ancestor. Additional details on the C3 MRO used by new-style\n classes can be found in the documentation accompanying the 2.3\n release at http://www.python.org/download/releases/2.3/mro/.\n\n When a class attribute reference (for class ``C``, say) would yield\n a user-defined function object or an unbound user-defined method\n object whose associated class is either ``C`` or one of its base\n classes, it is transformed into an unbound user-defined method\n object whose ``im_class`` attribute is ``C``. When it would yield a\n class method object, it is transformed into a bound user-defined\n method object whose ``im_class`` and ``im_self`` attributes are\n both ``C``. When it would yield a static method object, it is\n transformed into the object wrapped by the static method object.\n See section *Implementing Descriptors* for another way in which\n attributes retrieved from a class may differ from those actually\n contained in its ``__dict__`` (note that only new-style classes\n support descriptors).\n\n Class attribute assignments update the class\'s dictionary, never\n the dictionary of a base class.\n\n A class object can be called (see above) to yield a class instance\n (see below).\n\n Special attributes: ``__name__`` is the class name; ``__module__``\n is the module name in which the class was defined; ``__dict__`` is\n the dictionary containing the class\'s namespace; ``__bases__`` is a\n tuple (possibly empty or a singleton) containing the base classes,\n in the order of their occurrence in the base class list;\n ``__doc__`` is the class\'s documentation string, or None if\n undefined.\n\nClass instances\n A class instance is created by calling a class object (see above).\n A class instance has a namespace implemented as a dictionary which\n is the first place in which attribute references are searched.\n When an attribute is not found there, and the instance\'s class has\n an attribute by that name, the search continues with the class\n attributes. If a class attribute is found that is a user-defined\n function object or an unbound user-defined method object whose\n associated class is the class (call it ``C``) of the instance for\n which the attribute reference was initiated or one of its bases, it\n is transformed into a bound user-defined method object whose\n ``im_class`` attribute is ``C`` and whose ``im_self`` attribute is\n the instance. Static method and class method objects are also\n transformed, as if they had been retrieved from class ``C``; see\n above under "Classes". See section *Implementing Descriptors* for\n another way in which attributes of a class retrieved via its\n instances may differ from the objects actually stored in the\n class\'s ``__dict__``. If no class attribute is found, and the\n object\'s class has a ``__getattr__()`` method, that is called to\n satisfy the lookup.\n\n Attribute assignments and deletions update the instance\'s\n dictionary, never a class\'s dictionary. If the class has a\n ``__setattr__()`` or ``__delattr__()`` method, this is called\n instead of updating the instance dictionary directly.\n\n Class instances can pretend to be numbers, sequences, or mappings\n if they have methods with certain special names. See section\n *Special method names*.\n\n Special attributes: ``__dict__`` is the attribute dictionary;\n ``__class__`` is the instance\'s class.\n\nFiles\n A file object represents an open file. File objects are created by\n the ``open()`` built-in function, and also by ``os.popen()``,\n ``os.fdopen()``, and the ``makefile()`` method of socket objects\n (and perhaps by other functions or methods provided by extension\n modules). The objects ``sys.stdin``, ``sys.stdout`` and\n ``sys.stderr`` are initialized to file objects corresponding to the\n interpreter\'s standard input, output and error streams. See *File\n Objects* for complete documentation of file objects.\n\nInternal types\n A few types used internally by the interpreter are exposed to the\n user. Their definitions may change with future versions of the\n interpreter, but they are mentioned here for completeness.\n\n Code objects\n Code objects represent *byte-compiled* executable Python code,\n or *bytecode*. The difference between a code object and a\n function object is that the function object contains an explicit\n reference to the function\'s globals (the module in which it was\n defined), while a code object contains no context; also the\n default argument values are stored in the function object, not\n in the code object (because they represent values calculated at\n run-time). Unlike function objects, code objects are immutable\n and contain no references (directly or indirectly) to mutable\n objects.\n\n Special read-only attributes: ``co_name`` gives the function\n name; ``co_argcount`` is the number of positional arguments\n (including arguments with default values); ``co_nlocals`` is the\n number of local variables used by the function (including\n arguments); ``co_varnames`` is a tuple containing the names of\n the local variables (starting with the argument names);\n ``co_cellvars`` is a tuple containing the names of local\n variables that are referenced by nested functions;\n ``co_freevars`` is a tuple containing the names of free\n variables; ``co_code`` is a string representing the sequence of\n bytecode instructions; ``co_consts`` is a tuple containing the\n literals used by the bytecode; ``co_names`` is a tuple\n containing the names used by the bytecode; ``co_filename`` is\n the filename from which the code was compiled;\n ``co_firstlineno`` is the first line number of the function;\n ``co_lnotab`` is a string encoding the mapping from bytecode\n offsets to line numbers (for details see the source code of the\n interpreter); ``co_stacksize`` is the required stack size\n (including local variables); ``co_flags`` is an integer encoding\n a number of flags for the interpreter.\n\n The following flag bits are defined for ``co_flags``: bit\n ``0x04`` is set if the function uses the ``*arguments`` syntax\n to accept an arbitrary number of positional arguments; bit\n ``0x08`` is set if the function uses the ``**keywords`` syntax\n to accept arbitrary keyword arguments; bit ``0x20`` is set if\n the function is a generator.\n\n Future feature declarations (``from __future__ import\n division``) also use bits in ``co_flags`` to indicate whether a\n code object was compiled with a particular feature enabled: bit\n ``0x2000`` is set if the function was compiled with future\n division enabled; bits ``0x10`` and ``0x1000`` were used in\n earlier versions of Python.\n\n Other bits in ``co_flags`` are reserved for internal use.\n\n If a code object represents a function, the first item in\n ``co_consts`` is the documentation string of the function, or\n ``None`` if undefined.\n\n Frame objects\n Frame objects represent execution frames. They may occur in\n traceback objects (see below).\n\n Special read-only attributes: ``f_back`` is to the previous\n stack frame (towards the caller), or ``None`` if this is the\n bottom stack frame; ``f_code`` is the code object being executed\n in this frame; ``f_locals`` is the dictionary used to look up\n local variables; ``f_globals`` is used for global variables;\n ``f_builtins`` is used for built-in (intrinsic) names;\n ``f_restricted`` is a flag indicating whether the function is\n executing in restricted execution mode; ``f_lasti`` gives the\n precise instruction (this is an index into the bytecode string\n of the code object).\n\n Special writable attributes: ``f_trace``, if not ``None``, is a\n function called at the start of each source code line (this is\n used by the debugger); ``f_exc_type``, ``f_exc_value``,\n ``f_exc_traceback`` represent the last exception raised in the\n parent frame provided another exception was ever raised in the\n current frame (in all other cases they are None); ``f_lineno``\n is the current line number of the frame --- writing to this from\n within a trace function jumps to the given line (only for the\n bottom-most frame). A debugger can implement a Jump command\n (aka Set Next Statement) by writing to f_lineno.\n\n Traceback objects\n Traceback objects represent a stack trace of an exception. A\n traceback object is created when an exception occurs. When the\n search for an exception handler unwinds the execution stack, at\n each unwound level a traceback object is inserted in front of\n the current traceback. When an exception handler is entered,\n the stack trace is made available to the program. (See section\n *The try statement*.) It is accessible as ``sys.exc_traceback``,\n and also as the third item of the tuple returned by\n ``sys.exc_info()``. The latter is the preferred interface,\n since it works correctly when the program is using multiple\n threads. When the program contains no suitable handler, the\n stack trace is written (nicely formatted) to the standard error\n stream; if the interpreter is interactive, it is also made\n available to the user as ``sys.last_traceback``.\n\n Special read-only attributes: ``tb_next`` is the next level in\n the stack trace (towards the frame where the exception\n occurred), or ``None`` if there is no next level; ``tb_frame``\n points to the execution frame of the current level;\n ``tb_lineno`` gives the line number where the exception\n occurred; ``tb_lasti`` indicates the precise instruction. The\n line number and last instruction in the traceback may differ\n from the line number of its frame object if the exception\n occurred in a ``try`` statement with no matching except clause\n or with a finally clause.\n\n Slice objects\n Slice objects are used to represent slices when *extended slice\n syntax* is used. This is a slice using two colons, or multiple\n slices or ellipses separated by commas, e.g., ``a[i:j:step]``,\n ``a[i:j, k:l]``, or ``a[..., i:j]``. They are also created by\n the built-in ``slice()`` function.\n\n Special read-only attributes: ``start`` is the lower bound;\n ``stop`` is the upper bound; ``step`` is the step value; each is\n ``None`` if omitted. These attributes can have any type.\n\n Slice objects support one method:\n\n slice.indices(self, length)\n\n This method takes a single integer argument *length* and\n computes information about the extended slice that the slice\n object would describe if applied to a sequence of *length*\n items. It returns a tuple of three integers; respectively\n these are the *start* and *stop* indices and the *step* or\n stride length of the slice. Missing or out-of-bounds indices\n are handled in a manner consistent with regular slices.\n\n New in version 2.3.\n\n Static method objects\n Static method objects provide a way of defeating the\n transformation of function objects to method objects described\n above. A static method object is a wrapper around any other\n object, usually a user-defined method object. When a static\n method object is retrieved from a class or a class instance, the\n object actually returned is the wrapped object, which is not\n subject to any further transformation. Static method objects are\n not themselves callable, although the objects they wrap usually\n are. Static method objects are created by the built-in\n ``staticmethod()`` constructor.\n\n Class method objects\n A class method object, like a static method object, is a wrapper\n around another object that alters the way in which that object\n is retrieved from classes and class instances. The behaviour of\n class method objects upon such retrieval is described above,\n under "User-defined methods". Class method objects are created\n by the built-in ``classmethod()`` constructor.\n', 'typesfunctions': '\nFunctions\n*********\n\nFunction objects are created by function definitions. The only\noperation on a function object is to call it: ``func(argument-list)``.\n\nThere are really two flavors of function objects: built-in functions\nand user-defined functions. Both support the same operation (to call\nthe function), but the implementation is different, hence the\ndifferent object types.\n\nSee *Function definitions* for more information.\n', - 'typesmapping': '\nMapping Types --- ``dict``\n**************************\n\nA *mapping* object maps *hashable* values to arbitrary objects.\nMappings are mutable objects. There is currently only one standard\nmapping type, the *dictionary*. (For other containers see the built\nin ``list``, ``set``, and ``tuple`` classes, and the ``collections``\nmodule.)\n\nA dictionary\'s keys are *almost* arbitrary values. Values that are\nnot *hashable*, that is, values containing lists, dictionaries or\nother mutable types (that are compared by value rather than by object\nidentity) may not be used as keys. Numeric types used for keys obey\nthe normal rules for numeric comparison: if two numbers compare equal\n(such as ``1`` and ``1.0``) then they can be used interchangeably to\nindex the same dictionary entry. (Note however, that since computers\nstore floating-point numbers as approximations it is usually unwise to\nuse them as dictionary keys.)\n\nDictionaries can be created by placing a comma-separated list of\n``key: value`` pairs within braces, for example: ``{\'jack\': 4098,\n\'sjoerd\': 4127}`` or ``{4098: \'jack\', 4127: \'sjoerd\'}``, or by the\n``dict`` constructor.\n\nclass class dict([arg])\n\n Return a new dictionary initialized from an optional positional\n argument or from a set of keyword arguments. If no arguments are\n given, return a new empty dictionary. If the positional argument\n *arg* is a mapping object, return a dictionary mapping the same\n keys to the same values as does the mapping object. Otherwise the\n positional argument must be a sequence, a container that supports\n iteration, or an iterator object. The elements of the argument\n must each also be of one of those kinds, and each must in turn\n contain exactly two objects. The first is used as a key in the new\n dictionary, and the second as the key\'s value. If a given key is\n seen more than once, the last value associated with it is retained\n in the new dictionary.\n\n If keyword arguments are given, the keywords themselves with their\n associated values are added as items to the dictionary. If a key is\n specified both in the positional argument and as a keyword\n argument, the value associated with the keyword is retained in the\n dictionary. For example, these all return a dictionary equal to\n ``{"one": 1, "two": 2}``:\n\n * ``dict(one=1, two=2)``\n\n * ``dict({\'one\': 1, \'two\': 2})``\n\n * ``dict(zip((\'one\', \'two\'), (1, 2)))``\n\n * ``dict([[\'two\', 2], [\'one\', 1]])``\n\n The first example only works for keys that are valid Python\n identifiers; the others work with any valid keys.\n\n New in version 2.2.\n\n Changed in version 2.3: Support for building a dictionary from\n keyword arguments added.\n\n These are the operations that dictionaries support (and therefore,\n custom mapping types should support too):\n\n len(d)\n\n Return the number of items in the dictionary *d*.\n\n d[key]\n\n Return the item of *d* with key *key*. Raises a ``KeyError`` if\n *key* is not in the map.\n\n New in version 2.5: If a subclass of dict defines a method\n ``__missing__()``, if the key *key* is not present, the\n ``d[key]`` operation calls that method with the key *key* as\n argument. The ``d[key]`` operation then returns or raises\n whatever is returned or raised by the ``__missing__(key)`` call\n if the key is not present. No other operations or methods invoke\n ``__missing__()``. If ``__missing__()`` is not defined,\n ``KeyError`` is raised. ``__missing__()`` must be a method; it\n cannot be an instance variable. For an example, see\n ``collections.defaultdict``.\n\n d[key] = value\n\n Set ``d[key]`` to *value*.\n\n del d[key]\n\n Remove ``d[key]`` from *d*. Raises a ``KeyError`` if *key* is\n not in the map.\n\n key in d\n\n Return ``True`` if *d* has a key *key*, else ``False``.\n\n New in version 2.2.\n\n key not in d\n\n Equivalent to ``not key in d``.\n\n New in version 2.2.\n\n iter(d)\n\n Return an iterator over the keys of the dictionary. This is a\n shortcut for ``iterkeys()``.\n\n clear()\n\n Remove all items from the dictionary.\n\n copy()\n\n Return a shallow copy of the dictionary.\n\n fromkeys(seq[, value])\n\n Create a new dictionary with keys from *seq* and values set to\n *value*.\n\n ``fromkeys()`` is a class method that returns a new dictionary.\n *value* defaults to ``None``.\n\n New in version 2.3.\n\n get(key[, default])\n\n Return the value for *key* if *key* is in the dictionary, else\n *default*. If *default* is not given, it defaults to ``None``,\n so that this method never raises a ``KeyError``.\n\n has_key(key)\n\n Test for the presence of *key* in the dictionary. ``has_key()``\n is deprecated in favor of ``key in d``.\n\n items()\n\n Return a copy of the dictionary\'s list of ``(key, value)``\n pairs.\n\n **CPython implementation detail:** Keys and values are listed in\n an arbitrary order which is non-random, varies across Python\n implementations, and depends on the dictionary\'s history of\n insertions and deletions.\n\n If ``items()``, ``keys()``, ``values()``, ``iteritems()``,\n ``iterkeys()``, and ``itervalues()`` are called with no\n intervening modifications to the dictionary, the lists will\n directly correspond. This allows the creation of ``(value,\n key)`` pairs using ``zip()``: ``pairs = zip(d.values(),\n d.keys())``. The same relationship holds for the ``iterkeys()``\n and ``itervalues()`` methods: ``pairs = zip(d.itervalues(),\n d.iterkeys())`` provides the same value for ``pairs``. Another\n way to create the same list is ``pairs = [(v, k) for (k, v) in\n d.iteritems()]``.\n\n iteritems()\n\n Return an iterator over the dictionary\'s ``(key, value)`` pairs.\n See the note for ``dict.items()``.\n\n Using ``iteritems()`` while adding or deleting entries in the\n dictionary may raise a ``RuntimeError`` or fail to iterate over\n all entries.\n\n New in version 2.2.\n\n iterkeys()\n\n Return an iterator over the dictionary\'s keys. See the note for\n ``dict.items()``.\n\n Using ``iterkeys()`` while adding or deleting entries in the\n dictionary may raise a ``RuntimeError`` or fail to iterate over\n all entries.\n\n New in version 2.2.\n\n itervalues()\n\n Return an iterator over the dictionary\'s values. See the note\n for ``dict.items()``.\n\n Using ``itervalues()`` while adding or deleting entries in the\n dictionary may raise a ``RuntimeError`` or fail to iterate over\n all entries.\n\n New in version 2.2.\n\n keys()\n\n Return a copy of the dictionary\'s list of keys. See the note\n for ``dict.items()``.\n\n pop(key[, default])\n\n If *key* is in the dictionary, remove it and return its value,\n else return *default*. If *default* is not given and *key* is\n not in the dictionary, a ``KeyError`` is raised.\n\n New in version 2.3.\n\n popitem()\n\n Remove and return an arbitrary ``(key, value)`` pair from the\n dictionary.\n\n ``popitem()`` is useful to destructively iterate over a\n dictionary, as often used in set algorithms. If the dictionary\n is empty, calling ``popitem()`` raises a ``KeyError``.\n\n setdefault(key[, default])\n\n If *key* is in the dictionary, return its value. If not, insert\n *key* with a value of *default* and return *default*. *default*\n defaults to ``None``.\n\n update([other])\n\n Update the dictionary with the key/value pairs from *other*,\n overwriting existing keys. Return ``None``.\n\n ``update()`` accepts either another dictionary object or an\n iterable of key/value pairs (as tuples or other iterables of\n length two). If keyword arguments are specified, the dictionary\n is then updated with those key/value pairs: ``d.update(red=1,\n blue=2)``.\n\n Changed in version 2.4: Allowed the argument to be an iterable\n of key/value pairs and allowed keyword arguments.\n\n values()\n\n Return a copy of the dictionary\'s list of values. See the note\n for ``dict.items()``.\n\n viewitems()\n\n Return a new view of the dictionary\'s items (``(key, value)``\n pairs). See below for documentation of view objects.\n\n New in version 2.7.\n\n viewkeys()\n\n Return a new view of the dictionary\'s keys. See below for\n documentation of view objects.\n\n New in version 2.7.\n\n viewvalues()\n\n Return a new view of the dictionary\'s values. See below for\n documentation of view objects.\n\n New in version 2.7.\n\n\nDictionary view objects\n=======================\n\nThe objects returned by ``dict.viewkeys()``, ``dict.viewvalues()`` and\n``dict.viewitems()`` are *view objects*. They provide a dynamic view\non the dictionary\'s entries, which means that when the dictionary\nchanges, the view reflects these changes.\n\nDictionary views can be iterated over to yield their respective data,\nand support membership tests:\n\nlen(dictview)\n\n Return the number of entries in the dictionary.\n\niter(dictview)\n\n Return an iterator over the keys, values or items (represented as\n tuples of ``(key, value)``) in the dictionary.\n\n Keys and values are iterated over in an arbitrary order which is\n non-random, varies across Python implementations, and depends on\n the dictionary\'s history of insertions and deletions. If keys,\n values and items views are iterated over with no intervening\n modifications to the dictionary, the order of items will directly\n correspond. This allows the creation of ``(value, key)`` pairs\n using ``zip()``: ``pairs = zip(d.values(), d.keys())``. Another\n way to create the same list is ``pairs = [(v, k) for (k, v) in\n d.items()]``.\n\n Iterating views while adding or deleting entries in the dictionary\n may raise a ``RuntimeError`` or fail to iterate over all entries.\n\nx in dictview\n\n Return ``True`` if *x* is in the underlying dictionary\'s keys,\n values or items (in the latter case, *x* should be a ``(key,\n value)`` tuple).\n\nKeys views are set-like since their entries are unique and hashable.\nIf all values are hashable, so that (key, value) pairs are unique and\nhashable, then the items view is also set-like. (Values views are not\ntreated as set-like since the entries are generally not unique.) Then\nthese set operations are available ("other" refers either to another\nview or a set):\n\ndictview & other\n\n Return the intersection of the dictview and the other object as a\n new set.\n\ndictview | other\n\n Return the union of the dictview and the other object as a new set.\n\ndictview - other\n\n Return the difference between the dictview and the other object\n (all elements in *dictview* that aren\'t in *other*) as a new set.\n\ndictview ^ other\n\n Return the symmetric difference (all elements either in *dictview*\n or *other*, but not in both) of the dictview and the other object\n as a new set.\n\nAn example of dictionary view usage:\n\n >>> dishes = {\'eggs\': 2, \'sausage\': 1, \'bacon\': 1, \'spam\': 500}\n >>> keys = dishes.viewkeys()\n >>> values = dishes.viewvalues()\n\n >>> # iteration\n >>> n = 0\n >>> for val in values:\n ... n += val\n >>> print(n)\n 504\n\n >>> # keys and values are iterated over in the same order\n >>> list(keys)\n [\'eggs\', \'bacon\', \'sausage\', \'spam\']\n >>> list(values)\n [2, 1, 1, 500]\n\n >>> # view objects are dynamic and reflect dict changes\n >>> del dishes[\'eggs\']\n >>> del dishes[\'sausage\']\n >>> list(keys)\n [\'spam\', \'bacon\']\n\n >>> # set operations\n >>> keys & {\'eggs\', \'bacon\', \'salad\'}\n {\'bacon\'}\n', - 'typesmethods': "\nMethods\n*******\n\nMethods are functions that are called using the attribute notation.\nThere are two flavors: built-in methods (such as ``append()`` on\nlists) and class instance methods. Built-in methods are described\nwith the types that support them.\n\nThe implementation adds two special read-only attributes to class\ninstance methods: ``m.im_self`` is the object on which the method\noperates, and ``m.im_func`` is the function implementing the method.\nCalling ``m(arg-1, arg-2, ..., arg-n)`` is completely equivalent to\ncalling ``m.im_func(m.im_self, arg-1, arg-2, ..., arg-n)``.\n\nClass instance methods are either *bound* or *unbound*, referring to\nwhether the method was accessed through an instance or a class,\nrespectively. When a method is unbound, its ``im_self`` attribute\nwill be ``None`` and if called, an explicit ``self`` object must be\npassed as the first argument. In this case, ``self`` must be an\ninstance of the unbound method's class (or a subclass of that class),\notherwise a ``TypeError`` is raised.\n\nLike function objects, methods objects support getting arbitrary\nattributes. However, since method attributes are actually stored on\nthe underlying function object (``meth.im_func``), setting method\nattributes on either bound or unbound methods is disallowed.\nAttempting to set a method attribute results in a ``TypeError`` being\nraised. In order to set a method attribute, you need to explicitly\nset it on the underlying function object:\n\n class C:\n def method(self):\n pass\n\n c = C()\n c.method.im_func.whoami = 'my name is c'\n\nSee *The standard type hierarchy* for more information.\n", + 'typesmapping': '\nMapping Types --- ``dict``\n**************************\n\nA *mapping* object maps *hashable* values to arbitrary objects.\nMappings are mutable objects. There is currently only one standard\nmapping type, the *dictionary*. (For other containers see the built\nin ``list``, ``set``, and ``tuple`` classes, and the ``collections``\nmodule.)\n\nA dictionary\'s keys are *almost* arbitrary values. Values that are\nnot *hashable*, that is, values containing lists, dictionaries or\nother mutable types (that are compared by value rather than by object\nidentity) may not be used as keys. Numeric types used for keys obey\nthe normal rules for numeric comparison: if two numbers compare equal\n(such as ``1`` and ``1.0``) then they can be used interchangeably to\nindex the same dictionary entry. (Note however, that since computers\nstore floating-point numbers as approximations it is usually unwise to\nuse them as dictionary keys.)\n\nDictionaries can be created by placing a comma-separated list of\n``key: value`` pairs within braces, for example: ``{\'jack\': 4098,\n\'sjoerd\': 4127}`` or ``{4098: \'jack\', 4127: \'sjoerd\'}``, or by the\n``dict`` constructor.\n\nclass class dict(**kwarg)\nclass class dict(mapping, **kwarg)\nclass class dict(iterable, **kwarg)\n\n Return a new dictionary initialized from an optional positional\n argument and a possibly empty set of keyword arguments.\n\n If no positional argument is given, an empty dictionary is created.\n If a positional argument is given and it is a mapping object, a\n dictionary is created with the same key-value pairs as the mapping\n object. Otherwise, the positional argument must be an *iterator*\n object. Each item in the iterable must itself be an iterator with\n exactly two objects. The first object of each item becomes a key\n in the new dictionary, and the second object the corresponding\n value. If a key occurs more than once, the last value for that key\n becomes the corresponding value in the new dictionary.\n\n If keyword arguments are given, the keyword arguments and their\n values are added to the dictionary created from the positional\n argument. If a key being added is already present, the value from\n the keyword argument replaces the value from the positional\n argument.\n\n To illustrate, the following examples all return a dictionary equal\n to ``{"one": 1, "two": 2, "three": 3}``:\n\n >>> a = dict(one=1, two=2, three=3)\n >>> b = {\'one\': 1, \'two\': 2, \'three\': 3}\n >>> c = dict(zip([\'one\', \'two\', \'three\'], [1, 2, 3]))\n >>> d = dict([(\'two\', 2), (\'one\', 1), (\'three\', 3)])\n >>> e = dict({\'three\': 3, \'one\': 1, \'two\': 2})\n >>> a == b == c == d == e\n True\n\n Providing keyword arguments as in the first example only works for\n keys that are valid Python identifiers. Otherwise, any valid keys\n can be used.\n\n New in version 2.2.\n\n Changed in version 2.3: Support for building a dictionary from\n keyword arguments added.\n\n These are the operations that dictionaries support (and therefore,\n custom mapping types should support too):\n\n len(d)\n\n Return the number of items in the dictionary *d*.\n\n d[key]\n\n Return the item of *d* with key *key*. Raises a ``KeyError`` if\n *key* is not in the map.\n\n New in version 2.5: If a subclass of dict defines a method\n ``__missing__()``, if the key *key* is not present, the\n ``d[key]`` operation calls that method with the key *key* as\n argument. The ``d[key]`` operation then returns or raises\n whatever is returned or raised by the ``__missing__(key)`` call\n if the key is not present. No other operations or methods invoke\n ``__missing__()``. If ``__missing__()`` is not defined,\n ``KeyError`` is raised. ``__missing__()`` must be a method; it\n cannot be an instance variable. For an example, see\n ``collections.defaultdict``.\n\n d[key] = value\n\n Set ``d[key]`` to *value*.\n\n del d[key]\n\n Remove ``d[key]`` from *d*. Raises a ``KeyError`` if *key* is\n not in the map.\n\n key in d\n\n Return ``True`` if *d* has a key *key*, else ``False``.\n\n New in version 2.2.\n\n key not in d\n\n Equivalent to ``not key in d``.\n\n New in version 2.2.\n\n iter(d)\n\n Return an iterator over the keys of the dictionary. This is a\n shortcut for ``iterkeys()``.\n\n clear()\n\n Remove all items from the dictionary.\n\n copy()\n\n Return a shallow copy of the dictionary.\n\n fromkeys(seq[, value])\n\n Create a new dictionary with keys from *seq* and values set to\n *value*.\n\n ``fromkeys()`` is a class method that returns a new dictionary.\n *value* defaults to ``None``.\n\n New in version 2.3.\n\n get(key[, default])\n\n Return the value for *key* if *key* is in the dictionary, else\n *default*. If *default* is not given, it defaults to ``None``,\n so that this method never raises a ``KeyError``.\n\n has_key(key)\n\n Test for the presence of *key* in the dictionary. ``has_key()``\n is deprecated in favor of ``key in d``.\n\n items()\n\n Return a copy of the dictionary\'s list of ``(key, value)``\n pairs.\n\n **CPython implementation detail:** Keys and values are listed in\n an arbitrary order which is non-random, varies across Python\n implementations, and depends on the dictionary\'s history of\n insertions and deletions.\n\n If ``items()``, ``keys()``, ``values()``, ``iteritems()``,\n ``iterkeys()``, and ``itervalues()`` are called with no\n intervening modifications to the dictionary, the lists will\n directly correspond. This allows the creation of ``(value,\n key)`` pairs using ``zip()``: ``pairs = zip(d.values(),\n d.keys())``. The same relationship holds for the ``iterkeys()``\n and ``itervalues()`` methods: ``pairs = zip(d.itervalues(),\n d.iterkeys())`` provides the same value for ``pairs``. Another\n way to create the same list is ``pairs = [(v, k) for (k, v) in\n d.iteritems()]``.\n\n iteritems()\n\n Return an iterator over the dictionary\'s ``(key, value)`` pairs.\n See the note for ``dict.items()``.\n\n Using ``iteritems()`` while adding or deleting entries in the\n dictionary may raise a ``RuntimeError`` or fail to iterate over\n all entries.\n\n New in version 2.2.\n\n iterkeys()\n\n Return an iterator over the dictionary\'s keys. See the note for\n ``dict.items()``.\n\n Using ``iterkeys()`` while adding or deleting entries in the\n dictionary may raise a ``RuntimeError`` or fail to iterate over\n all entries.\n\n New in version 2.2.\n\n itervalues()\n\n Return an iterator over the dictionary\'s values. See the note\n for ``dict.items()``.\n\n Using ``itervalues()`` while adding or deleting entries in the\n dictionary may raise a ``RuntimeError`` or fail to iterate over\n all entries.\n\n New in version 2.2.\n\n keys()\n\n Return a copy of the dictionary\'s list of keys. See the note\n for ``dict.items()``.\n\n pop(key[, default])\n\n If *key* is in the dictionary, remove it and return its value,\n else return *default*. If *default* is not given and *key* is\n not in the dictionary, a ``KeyError`` is raised.\n\n New in version 2.3.\n\n popitem()\n\n Remove and return an arbitrary ``(key, value)`` pair from the\n dictionary.\n\n ``popitem()`` is useful to destructively iterate over a\n dictionary, as often used in set algorithms. If the dictionary\n is empty, calling ``popitem()`` raises a ``KeyError``.\n\n setdefault(key[, default])\n\n If *key* is in the dictionary, return its value. If not, insert\n *key* with a value of *default* and return *default*. *default*\n defaults to ``None``.\n\n update([other])\n\n Update the dictionary with the key/value pairs from *other*,\n overwriting existing keys. Return ``None``.\n\n ``update()`` accepts either another dictionary object or an\n iterable of key/value pairs (as tuples or other iterables of\n length two). If keyword arguments are specified, the dictionary\n is then updated with those key/value pairs: ``d.update(red=1,\n blue=2)``.\n\n Changed in version 2.4: Allowed the argument to be an iterable\n of key/value pairs and allowed keyword arguments.\n\n values()\n\n Return a copy of the dictionary\'s list of values. See the note\n for ``dict.items()``.\n\n viewitems()\n\n Return a new view of the dictionary\'s items (``(key, value)``\n pairs). See below for documentation of view objects.\n\n New in version 2.7.\n\n viewkeys()\n\n Return a new view of the dictionary\'s keys. See below for\n documentation of view objects.\n\n New in version 2.7.\n\n viewvalues()\n\n Return a new view of the dictionary\'s values. See below for\n documentation of view objects.\n\n New in version 2.7.\n\n\nDictionary view objects\n=======================\n\nThe objects returned by ``dict.viewkeys()``, ``dict.viewvalues()`` and\n``dict.viewitems()`` are *view objects*. They provide a dynamic view\non the dictionary\'s entries, which means that when the dictionary\nchanges, the view reflects these changes.\n\nDictionary views can be iterated over to yield their respective data,\nand support membership tests:\n\nlen(dictview)\n\n Return the number of entries in the dictionary.\n\niter(dictview)\n\n Return an iterator over the keys, values or items (represented as\n tuples of ``(key, value)``) in the dictionary.\n\n Keys and values are iterated over in an arbitrary order which is\n non-random, varies across Python implementations, and depends on\n the dictionary\'s history of insertions and deletions. If keys,\n values and items views are iterated over with no intervening\n modifications to the dictionary, the order of items will directly\n correspond. This allows the creation of ``(value, key)`` pairs\n using ``zip()``: ``pairs = zip(d.values(), d.keys())``. Another\n way to create the same list is ``pairs = [(v, k) for (k, v) in\n d.items()]``.\n\n Iterating views while adding or deleting entries in the dictionary\n may raise a ``RuntimeError`` or fail to iterate over all entries.\n\nx in dictview\n\n Return ``True`` if *x* is in the underlying dictionary\'s keys,\n values or items (in the latter case, *x* should be a ``(key,\n value)`` tuple).\n\nKeys views are set-like since their entries are unique and hashable.\nIf all values are hashable, so that (key, value) pairs are unique and\nhashable, then the items view is also set-like. (Values views are not\ntreated as set-like since the entries are generally not unique.) Then\nthese set operations are available ("other" refers either to another\nview or a set):\n\ndictview & other\n\n Return the intersection of the dictview and the other object as a\n new set.\n\ndictview | other\n\n Return the union of the dictview and the other object as a new set.\n\ndictview - other\n\n Return the difference between the dictview and the other object\n (all elements in *dictview* that aren\'t in *other*) as a new set.\n\ndictview ^ other\n\n Return the symmetric difference (all elements either in *dictview*\n or *other*, but not in both) of the dictview and the other object\n as a new set.\n\nAn example of dictionary view usage:\n\n >>> dishes = {\'eggs\': 2, \'sausage\': 1, \'bacon\': 1, \'spam\': 500}\n >>> keys = dishes.viewkeys()\n >>> values = dishes.viewvalues()\n\n >>> # iteration\n >>> n = 0\n >>> for val in values:\n ... n += val\n >>> print(n)\n 504\n\n >>> # keys and values are iterated over in the same order\n >>> list(keys)\n [\'eggs\', \'bacon\', \'sausage\', \'spam\']\n >>> list(values)\n [2, 1, 1, 500]\n\n >>> # view objects are dynamic and reflect dict changes\n >>> del dishes[\'eggs\']\n >>> del dishes[\'sausage\']\n >>> list(keys)\n [\'spam\', \'bacon\']\n\n >>> # set operations\n >>> keys & {\'eggs\', \'bacon\', \'salad\'}\n {\'bacon\'}\n', + 'typesmethods': '\nMethods\n*******\n\nMethods are functions that are called using the attribute notation.\nThere are two flavors: built-in methods (such as ``append()`` on\nlists) and class instance methods. Built-in methods are described\nwith the types that support them.\n\nThe implementation adds two special read-only attributes to class\ninstance methods: ``m.im_self`` is the object on which the method\noperates, and ``m.im_func`` is the function implementing the method.\nCalling ``m(arg-1, arg-2, ..., arg-n)`` is completely equivalent to\ncalling ``m.im_func(m.im_self, arg-1, arg-2, ..., arg-n)``.\n\nClass instance methods are either *bound* or *unbound*, referring to\nwhether the method was accessed through an instance or a class,\nrespectively. When a method is unbound, its ``im_self`` attribute\nwill be ``None`` and if called, an explicit ``self`` object must be\npassed as the first argument. In this case, ``self`` must be an\ninstance of the unbound method\'s class (or a subclass of that class),\notherwise a ``TypeError`` is raised.\n\nLike function objects, methods objects support getting arbitrary\nattributes. However, since method attributes are actually stored on\nthe underlying function object (``meth.im_func``), setting method\nattributes on either bound or unbound methods is disallowed.\nAttempting to set an attribute on a method results in an\n``AttributeError`` being raised. In order to set a method attribute,\nyou need to explicitly set it on the underlying function object:\n\n >>> class C:\n ... def method(self):\n ... pass\n ...\n >>> c = C()\n >>> c.method.whoami = \'my name is method\' # can\'t set on the method\n Traceback (most recent call last):\n File "", line 1, in \n AttributeError: \'instancemethod\' object has no attribute \'whoami\'\n >>> c.method.im_func.whoami = \'my name is method\'\n >>> c.method.whoami\n \'my name is method\'\n\nSee *The standard type hierarchy* for more information.\n', 'typesmodules': "\nModules\n*******\n\nThe only special operation on a module is attribute access:\n``m.name``, where *m* is a module and *name* accesses a name defined\nin *m*'s symbol table. Module attributes can be assigned to. (Note\nthat the ``import`` statement is not, strictly speaking, an operation\non a module object; ``import foo`` does not require a module object\nnamed *foo* to exist, rather it requires an (external) *definition*\nfor a module named *foo* somewhere.)\n\nA special attribute of every module is ``__dict__``. This is the\ndictionary containing the module's symbol table. Modifying this\ndictionary will actually change the module's symbol table, but direct\nassignment to the ``__dict__`` attribute is not possible (you can\nwrite ``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but\nyou can't write ``m.__dict__ = {}``). Modifying ``__dict__`` directly\nis not recommended.\n\nModules built into the interpreter are written like this: ````. If loaded from a file, they are written as\n````.\n", - 'typesseq': '\nSequence Types --- ``str``, ``unicode``, ``list``, ``tuple``, ``bytearray``, ``buffer``, ``xrange``\n***************************************************************************************************\n\nThere are seven sequence types: strings, Unicode strings, lists,\ntuples, bytearrays, buffers, and xrange objects.\n\nFor other containers see the built in ``dict`` and ``set`` classes,\nand the ``collections`` module.\n\nString literals are written in single or double quotes: ``\'xyzzy\'``,\n``"frobozz"``. See *String literals* for more about string literals.\nUnicode strings are much like strings, but are specified in the syntax\nusing a preceding ``\'u\'`` character: ``u\'abc\'``, ``u"def"``. In\naddition to the functionality described here, there are also string-\nspecific methods described in the *String Methods* section. Lists are\nconstructed with square brackets, separating items with commas: ``[a,\nb, c]``. Tuples are constructed by the comma operator (not within\nsquare brackets), with or without enclosing parentheses, but an empty\ntuple must have the enclosing parentheses, such as ``a, b, c`` or\n``()``. A single item tuple must have a trailing comma, such as\n``(d,)``.\n\nBytearray objects are created with the built-in function\n``bytearray()``.\n\nBuffer objects are not directly supported by Python syntax, but can be\ncreated by calling the built-in function ``buffer()``. They don\'t\nsupport concatenation or repetition.\n\nObjects of type xrange are similar to buffers in that there is no\nspecific syntax to create them, but they are created using the\n``xrange()`` function. They don\'t support slicing, concatenation or\nrepetition, and using ``in``, ``not in``, ``min()`` or ``max()`` on\nthem is inefficient.\n\nMost sequence types support the following operations. The ``in`` and\n``not in`` operations have the same priorities as the comparison\noperations. The ``+`` and ``*`` operations have the same priority as\nthe corresponding numeric operations. [3] Additional methods are\nprovided for *Mutable Sequence Types*.\n\nThis table lists the sequence operations sorted in ascending priority\n(operations in the same box have the same priority). In the table,\n*s* and *t* are sequences of the same type; *n*, *i* and *j* are\nintegers:\n\n+--------------------+----------------------------------+------------+\n| Operation | Result | Notes |\n+====================+==================================+============+\n| ``x in s`` | ``True`` if an item of *s* is | (1) |\n| | equal to *x*, else ``False`` | |\n+--------------------+----------------------------------+------------+\n| ``x not in s`` | ``False`` if an item of *s* is | (1) |\n| | equal to *x*, else ``True`` | |\n+--------------------+----------------------------------+------------+\n| ``s + t`` | the concatenation of *s* and *t* | (6) |\n+--------------------+----------------------------------+------------+\n| ``s * n, n * s`` | *n* shallow copies of *s* | (2) |\n| | concatenated | |\n+--------------------+----------------------------------+------------+\n| ``s[i]`` | *i*th item of *s*, origin 0 | (3) |\n+--------------------+----------------------------------+------------+\n| ``s[i:j]`` | slice of *s* from *i* to *j* | (3)(4) |\n+--------------------+----------------------------------+------------+\n| ``s[i:j:k]`` | slice of *s* from *i* to *j* | (3)(5) |\n| | with step *k* | |\n+--------------------+----------------------------------+------------+\n| ``len(s)`` | length of *s* | |\n+--------------------+----------------------------------+------------+\n| ``min(s)`` | smallest item of *s* | |\n+--------------------+----------------------------------+------------+\n| ``max(s)`` | largest item of *s* | |\n+--------------------+----------------------------------+------------+\n| ``s.index(i)`` | index of the first occurence of | |\n| | *i* in *s* | |\n+--------------------+----------------------------------+------------+\n| ``s.count(i)`` | total number of occurences of | |\n| | *i* in *s* | |\n+--------------------+----------------------------------+------------+\n\nSequence types also support comparisons. In particular, tuples and\nlists are compared lexicographically by comparing corresponding\nelements. This means that to compare equal, every element must compare\nequal and the two sequences must be of the same type and have the same\nlength. (For full details see *Comparisons* in the language\nreference.)\n\nNotes:\n\n1. When *s* is a string or Unicode string object the ``in`` and ``not\n in`` operations act like a substring test. In Python versions\n before 2.3, *x* had to be a string of length 1. In Python 2.3 and\n beyond, *x* may be a string of any length.\n\n2. Values of *n* less than ``0`` are treated as ``0`` (which yields an\n empty sequence of the same type as *s*). Note also that the copies\n are shallow; nested structures are not copied. This often haunts\n new Python programmers; consider:\n\n >>> lists = [[]] * 3\n >>> lists\n [[], [], []]\n >>> lists[0].append(3)\n >>> lists\n [[3], [3], [3]]\n\n What has happened is that ``[[]]`` is a one-element list containing\n an empty list, so all three elements of ``[[]] * 3`` are (pointers\n to) this single empty list. Modifying any of the elements of\n ``lists`` modifies this single list. You can create a list of\n different lists this way:\n\n >>> lists = [[] for i in range(3)]\n >>> lists[0].append(3)\n >>> lists[1].append(5)\n >>> lists[2].append(7)\n >>> lists\n [[3], [5], [7]]\n\n3. If *i* or *j* is negative, the index is relative to the end of the\n string: ``len(s) + i`` or ``len(s) + j`` is substituted. But note\n that ``-0`` is still ``0``.\n\n4. The slice of *s* from *i* to *j* is defined as the sequence of\n items with index *k* such that ``i <= k < j``. If *i* or *j* is\n greater than ``len(s)``, use ``len(s)``. If *i* is omitted or\n ``None``, use ``0``. If *j* is omitted or ``None``, use\n ``len(s)``. If *i* is greater than or equal to *j*, the slice is\n empty.\n\n5. The slice of *s* from *i* to *j* with step *k* is defined as the\n sequence of items with index ``x = i + n*k`` such that ``0 <= n <\n (j-i)/k``. In other words, the indices are ``i``, ``i+k``,\n ``i+2*k``, ``i+3*k`` and so on, stopping when *j* is reached (but\n never including *j*). If *i* or *j* is greater than ``len(s)``,\n use ``len(s)``. If *i* or *j* are omitted or ``None``, they become\n "end" values (which end depends on the sign of *k*). Note, *k*\n cannot be zero. If *k* is ``None``, it is treated like ``1``.\n\n6. **CPython implementation detail:** If *s* and *t* are both strings,\n some Python implementations such as CPython can usually perform an\n in-place optimization for assignments of the form ``s = s + t`` or\n ``s += t``. When applicable, this optimization makes quadratic\n run-time much less likely. This optimization is both version and\n implementation dependent. For performance sensitive code, it is\n preferable to use the ``str.join()`` method which assures\n consistent linear concatenation performance across versions and\n implementations.\n\n Changed in version 2.4: Formerly, string concatenation never\n occurred in-place.\n\n\nString Methods\n==============\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support. Some of them are also available on\n``bytearray`` objects.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the *Sequence Types --- str, unicode, list, tuple,\nbytearray, buffer, xrange* section. To output formatted strings use\ntemplate strings or the ``%`` operator described in the *String\nFormatting Operations* section. Also, see the ``re`` module for string\nfunctions based on regular expressions.\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is a space).\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\n Decodes the string using the codec registered for *encoding*.\n *encoding* defaults to the default string encoding. *errors* may\n be given to set a different error handling scheme. The default is\n ``\'strict\'``, meaning that encoding errors raise ``UnicodeError``.\n Other possible values are ``\'ignore\'``, ``\'replace\'`` and any other\n name registered via ``codecs.register_error()``, see section *Codec\n Base Classes*.\n\n New in version 2.2.\n\n Changed in version 2.3: Support for other error handling schemes\n added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.encode([encoding[, errors]])\n\n Return an encoded version of the string. Default encoding is the\n current default string encoding. *errors* may be given to set a\n different error handling scheme. The default for *errors* is\n ``\'strict\'``, meaning that encoding errors raise a\n ``UnicodeError``. Other possible values are ``\'ignore\'``,\n ``\'replace\'``, ``\'xmlcharrefreplace\'``, ``\'backslashreplace\'`` and\n any other name registered via ``codecs.register_error()``, see\n section *Codec Base Classes*. For a list of possible encodings, see\n section *Standard Encodings*.\n\n New in version 2.0.\n\n Changed in version 2.3: Support for ``\'xmlcharrefreplace\'`` and\n ``\'backslashreplace\'`` and other error handling schemes added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return ``True`` if the string ends with the specified *suffix*,\n otherwise return ``False``. *suffix* can also be a tuple of\n suffixes to look for. With optional *start*, test beginning at\n that position. With optional *end*, stop comparing at that\n position.\n\n Changed in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. The column number is reset to zero after each\n newline occurring in the string. If *tabsize* is not given, a tab\n size of ``8`` characters is assumed. This doesn\'t understand other\n non-printing characters or escape sequences.\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found, such that *sub* is contained in the slice ``s[start:end]``.\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return ``-1`` if *sub* is not found.\n\n Note: The ``find()`` method should be used only if you need to know the\n position of *sub*. To check if *sub* is a substring or not, use\n the ``in`` operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces ``{}``. Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See *Format String Syntax* for a description of the various\n formatting options that can be specified in format strings.\n\n This method of string formatting is the new standard in Python 3.0,\n and should be preferred to the ``%`` formatting described in\n *String Formatting Operations* in new code.\n\n New in version 2.6.\n\nstr.index(sub[, start[, end]])\n\n Like ``find()``, but raise ``ValueError`` when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. The separator between elements is the\n string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to ``len(s)``.\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\n New in version 2.5.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within ``s[start:end]``.\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return ``-1`` on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like ``rfind()`` but raises ``ValueError`` when the substring *sub*\n is not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to ``len(s)``.\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\n New in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n ``None``, any whitespace string is a separator. Except for\n splitting from the right, ``rsplit()`` behaves like ``split()``\n which is described in detail below.\n\n New in version 2.4.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most ``maxsplit+1``\n elements). If *maxsplit* is not specified, then there is no limit\n on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n ``\'1,,2\'.split(\',\')`` returns ``[\'1\', \'\', \'2\']``). The *sep*\n argument may consist of multiple characters (for example,\n ``\'1<>2<>3\'.split(\'<>\')`` returns ``[\'1\', \'2\', \'3\']``). Splitting\n an empty string with a specified separator returns ``[\'\']``.\n\n If *sep* is not specified or is ``None``, a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a ``None`` separator returns\n ``[]``.\n\n For example, ``\' 1 2 3 \'.split()`` returns ``[\'1\', \'2\', \'3\']``,\n and ``\' 1 2 3 \'.split(None, 1)`` returns ``[\'1\', \'2 3 \']``.\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\nstr.startswith(prefix[, start[, end]])\n\n Return ``True`` if string starts with the *prefix*, otherwise\n return ``False``. *prefix* can also be a tuple of prefixes to look\n for. With optional *start*, test string beginning at that\n position. With optional *end*, stop comparing string at that\n position.\n\n Changed in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or ``None``, the\n *chars* argument defaults to removing whitespace. The *chars*\n argument is not a prefix or suffix; rather, all combinations of its\n values are stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n lambda mo: mo.group(0)[0].upper() +\n mo.group(0)[1:].lower(),\n s)\n\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\n Return a copy of the string where all characters occurring in the\n optional argument *deletechars* are removed, and the remaining\n characters have been mapped through the given translation table,\n which must be a string of length 256.\n\n You can use the ``maketrans()`` helper function in the ``string``\n module to create a translation table. For string objects, set the\n *table* argument to ``None`` for translations that only delete\n characters:\n\n >>> \'read this short text\'.translate(None, \'aeiou\')\n \'rd ths shrt txt\'\n\n New in version 2.6: Support for a ``None`` *table* argument.\n\n For Unicode objects, the ``translate()`` method does not accept the\n optional *deletechars* argument. Instead, it returns a copy of the\n *s* where all characters have been mapped through the given\n translation table which must be a mapping of Unicode ordinals to\n Unicode ordinals, Unicode strings or ``None``. Unmapped characters\n are left untouched. Characters mapped to ``None`` are deleted.\n Note, a more flexible approach is to create a custom character\n mapping codec using the ``codecs`` module (see ``encodings.cp1251``\n for an example).\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that ``str.upper().isupper()`` might\n be ``False`` if ``s`` contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\n Return the numeric string left filled with zeros in a string of\n length *width*. A sign prefix is handled correctly. The original\n string is returned if *width* is less than or equal to ``len(s)``.\n\n New in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\n Return ``True`` if there are only numeric characters in S,\n ``False`` otherwise. Numeric characters include digit characters,\n and all characters that have the Unicode numeric value property,\n e.g. U+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\n Return ``True`` if there are only decimal characters in S,\n ``False`` otherwise. Decimal characters include digit characters,\n and all characters that can be used to form decimal-radix numbers,\n e.g. U+0660, ARABIC-INDIC DIGIT ZERO.\n\n\nString Formatting Operations\n============================\n\nString and Unicode objects have one unique built-in operation: the\n``%`` operator (modulo). This is also known as the string\n*formatting* or *interpolation* operator. Given ``format % values``\n(where *format* is a string or Unicode object), ``%`` conversion\nspecifications in *format* are replaced with zero or more elements of\n*values*. The effect is similar to the using ``sprintf()`` in the C\nlanguage. If *format* is a Unicode object, or if any of the objects\nbeing converted using the ``%s`` conversion are Unicode objects, the\nresult will also be a Unicode object.\n\nIf *format* requires a single argument, *values* may be a single non-\ntuple object. [5] Otherwise, *values* must be a tuple with exactly\nthe number of items specified by the format string, or a single\nmapping object (for example, a dictionary).\n\nA conversion specifier contains two or more characters and has the\nfollowing components, which must occur in this order:\n\n1. The ``\'%\'`` character, which marks the start of the specifier.\n\n2. Mapping key (optional), consisting of a parenthesised sequence of\n characters (for example, ``(somename)``).\n\n3. Conversion flags (optional), which affect the result of some\n conversion types.\n\n4. Minimum field width (optional). If specified as an ``\'*\'``\n (asterisk), the actual width is read from the next element of the\n tuple in *values*, and the object to convert comes after the\n minimum field width and optional precision.\n\n5. Precision (optional), given as a ``\'.\'`` (dot) followed by the\n precision. If specified as ``\'*\'`` (an asterisk), the actual width\n is read from the next element of the tuple in *values*, and the\n value to convert comes after the precision.\n\n6. Length modifier (optional).\n\n7. Conversion type.\n\nWhen the right argument is a dictionary (or other mapping type), then\nthe formats in the string *must* include a parenthesised mapping key\ninto that dictionary inserted immediately after the ``\'%\'`` character.\nThe mapping key selects the value to be formatted from the mapping.\nFor example:\n\n>>> print \'%(language)s has %(number)03d quote types.\' % \\\n... {"language": "Python", "number": 2}\nPython has 002 quote types.\n\nIn this case no ``*`` specifiers may occur in a format (since they\nrequire a sequential parameter list).\n\nThe conversion flag characters are:\n\n+-----------+-----------------------------------------------------------------------+\n| Flag | Meaning |\n+===========+=======================================================================+\n| ``\'#\'`` | The value conversion will use the "alternate form" (where defined |\n| | below). |\n+-----------+-----------------------------------------------------------------------+\n| ``\'0\'`` | The conversion will be zero padded for numeric values. |\n+-----------+-----------------------------------------------------------------------+\n| ``\'-\'`` | The converted value is left adjusted (overrides the ``\'0\'`` |\n| | conversion if both are given). |\n+-----------+-----------------------------------------------------------------------+\n| ``\' \'`` | (a space) A blank should be left before a positive number (or empty |\n| | string) produced by a signed conversion. |\n+-----------+-----------------------------------------------------------------------+\n| ``\'+\'`` | A sign character (``\'+\'`` or ``\'-\'``) will precede the conversion |\n| | (overrides a "space" flag). |\n+-----------+-----------------------------------------------------------------------+\n\nA length modifier (``h``, ``l``, or ``L``) may be present, but is\nignored as it is not necessary for Python -- so e.g. ``%ld`` is\nidentical to ``%d``.\n\nThe conversion types are:\n\n+--------------+-------------------------------------------------------+---------+\n| Conversion | Meaning | Notes |\n+==============+=======================================================+=========+\n| ``\'d\'`` | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'i\'`` | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'o\'`` | Signed octal value. | (1) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'u\'`` | Obsolete type -- it is identical to ``\'d\'``. | (7) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'x\'`` | Signed hexadecimal (lowercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'X\'`` | Signed hexadecimal (uppercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'e\'`` | Floating point exponential format (lowercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'E\'`` | Floating point exponential format (uppercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'f\'`` | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'F\'`` | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'g\'`` | Floating point format. Uses lowercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'G\'`` | Floating point format. Uses uppercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'c\'`` | Single character (accepts integer or single character | |\n| | string). | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'r\'`` | String (converts any Python object using ``repr()``). | (5) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'s\'`` | String (converts any Python object using ``str()``). | (6) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'%\'`` | No argument is converted, results in a ``\'%\'`` | |\n| | character in the result. | |\n+--------------+-------------------------------------------------------+---------+\n\nNotes:\n\n1. The alternate form causes a leading zero (``\'0\'``) to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n2. The alternate form causes a leading ``\'0x\'`` or ``\'0X\'`` (depending\n on whether the ``\'x\'`` or ``\'X\'`` format was used) to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n3. The alternate form causes the result to always contain a decimal\n point, even if no digits follow it.\n\n The precision determines the number of digits after the decimal\n point and defaults to 6.\n\n4. The alternate form causes the result to always contain a decimal\n point, and trailing zeroes are not removed as they would otherwise\n be.\n\n The precision determines the number of significant digits before\n and after the decimal point and defaults to 6.\n\n5. The ``%r`` conversion was added in Python 2.0.\n\n The precision determines the maximal number of characters used.\n\n6. If the object or format provided is a ``unicode`` string, the\n resulting string will also be ``unicode``.\n\n The precision determines the maximal number of characters used.\n\n7. See **PEP 237**.\n\nSince Python strings have an explicit length, ``%s`` conversions do\nnot assume that ``\'\\0\'`` is the end of the string.\n\nChanged in version 2.7: ``%f`` conversions for numbers whose absolute\nvalue is over 1e50 are no longer replaced by ``%g`` conversions.\n\nAdditional string operations are defined in standard modules\n``string`` and ``re``.\n\n\nXRange Type\n===========\n\nThe ``xrange`` type is an immutable sequence which is commonly used\nfor looping. The advantage of the ``xrange`` type is that an\n``xrange`` object will always take the same amount of memory, no\nmatter the size of the range it represents. There are no consistent\nperformance advantages.\n\nXRange objects have very little behavior: they only support indexing,\niteration, and the ``len()`` function.\n\n\nMutable Sequence Types\n======================\n\nList and ``bytearray`` objects support additional operations that\nallow in-place modification of the object. Other mutable sequence\ntypes (when added to the language) should also support these\noperations. Strings and tuples are immutable sequence types: such\nobjects cannot be modified once created. The following operations are\ndefined on mutable sequence types (where *x* is an arbitrary object):\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| ``s[i] = x`` | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j] = t`` | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j]`` | same as ``s[i:j] = []`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j:k] = t`` | the elements of ``s[i:j:k]`` are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j:k]`` | removes the elements of | |\n| | ``s[i:j:k]`` from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.append(x)`` | same as ``s[len(s):len(s)] = | (2) |\n| | [x]`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.extend(x)`` | same as ``s[len(s):len(s)] = x`` | (3) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.count(x)`` | return number of *i*\'s for which | |\n| | ``s[i] == x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.index(x[, i[, j]])`` | return smallest *k* such that | (4) |\n| | ``s[k] == x`` and ``i <= k < j`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.insert(i, x)`` | same as ``s[i:i] = [x]`` | (5) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.pop([i])`` | same as ``x = s[i]; del s[i]; | (6) |\n| | return x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.remove(x)`` | same as ``del s[s.index(x)]`` | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.reverse()`` | reverses the items of *s* in | (7) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.sort([cmp[, key[, | sort the items of *s* in place | (7)(8)(9)(10) |\n| reverse]]])`` | | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The C implementation of Python has historically accepted multiple\n parameters and implicitly joined them into a tuple; this no longer\n works in Python 2.0. Use of this misfeature has been deprecated\n since Python 1.4.\n\n3. *x* can be any iterable object.\n\n4. Raises ``ValueError`` when *x* is not found in *s*. When a negative\n index is passed as the second or third parameter to the ``index()``\n method, the list length is added, as for slice indices. If it is\n still negative, it is truncated to zero, as for slice indices.\n\n Changed in version 2.3: Previously, ``index()`` didn\'t have\n arguments for specifying start and stop positions.\n\n5. When a negative index is passed as the first parameter to the\n ``insert()`` method, the list length is added, as for slice\n indices. If it is still negative, it is truncated to zero, as for\n slice indices.\n\n Changed in version 2.3: Previously, all negative indices were\n truncated to zero.\n\n6. The ``pop()`` method is only supported by the list and array types.\n The optional argument *i* defaults to ``-1``, so that by default\n the last item is removed and returned.\n\n7. The ``sort()`` and ``reverse()`` methods modify the list in place\n for economy of space when sorting or reversing a large list. To\n remind you that they operate by side effect, they don\'t return the\n sorted or reversed list.\n\n8. The ``sort()`` method takes optional arguments for controlling the\n comparisons.\n\n *cmp* specifies a custom comparison function of two arguments (list\n items) which should return a negative, zero or positive number\n depending on whether the first argument is considered smaller than,\n equal to, or larger than the second argument: ``cmp=lambda x,y:\n cmp(x.lower(), y.lower())``. The default value is ``None``.\n\n *key* specifies a function of one argument that is used to extract\n a comparison key from each list element: ``key=str.lower``. The\n default value is ``None``.\n\n *reverse* is a boolean value. If set to ``True``, then the list\n elements are sorted as if each comparison were reversed.\n\n In general, the *key* and *reverse* conversion processes are much\n faster than specifying an equivalent *cmp* function. This is\n because *cmp* is called multiple times for each list element while\n *key* and *reverse* touch each element only once. Use\n ``functools.cmp_to_key()`` to convert an old-style *cmp* function\n to a *key* function.\n\n Changed in version 2.3: Support for ``None`` as an equivalent to\n omitting *cmp* was added.\n\n Changed in version 2.4: Support for *key* and *reverse* was added.\n\n9. Starting with Python 2.3, the ``sort()`` method is guaranteed to be\n stable. A sort is stable if it guarantees not to change the\n relative order of elements that compare equal --- this is helpful\n for sorting in multiple passes (for example, sort by department,\n then by salary grade).\n\n10. **CPython implementation detail:** While a list is being sorted,\n the effect of attempting to mutate, or even inspect, the list is\n undefined. The C implementation of Python 2.3 and newer makes the\n list appear empty for the duration, and raises ``ValueError`` if\n it can detect that the list has been mutated during a sort.\n', + 'typesseq': '\nSequence Types --- ``str``, ``unicode``, ``list``, ``tuple``, ``bytearray``, ``buffer``, ``xrange``\n***************************************************************************************************\n\nThere are seven sequence types: strings, Unicode strings, lists,\ntuples, bytearrays, buffers, and xrange objects.\n\nFor other containers see the built in ``dict`` and ``set`` classes,\nand the ``collections`` module.\n\nString literals are written in single or double quotes: ``\'xyzzy\'``,\n``"frobozz"``. See *String literals* for more about string literals.\nUnicode strings are much like strings, but are specified in the syntax\nusing a preceding ``\'u\'`` character: ``u\'abc\'``, ``u"def"``. In\naddition to the functionality described here, there are also string-\nspecific methods described in the *String Methods* section. Lists are\nconstructed with square brackets, separating items with commas: ``[a,\nb, c]``. Tuples are constructed by the comma operator (not within\nsquare brackets), with or without enclosing parentheses, but an empty\ntuple must have the enclosing parentheses, such as ``a, b, c`` or\n``()``. A single item tuple must have a trailing comma, such as\n``(d,)``.\n\nBytearray objects are created with the built-in function\n``bytearray()``.\n\nBuffer objects are not directly supported by Python syntax, but can be\ncreated by calling the built-in function ``buffer()``. They don\'t\nsupport concatenation or repetition.\n\nObjects of type xrange are similar to buffers in that there is no\nspecific syntax to create them, but they are created using the\n``xrange()`` function. They don\'t support slicing, concatenation or\nrepetition, and using ``in``, ``not in``, ``min()`` or ``max()`` on\nthem is inefficient.\n\nMost sequence types support the following operations. The ``in`` and\n``not in`` operations have the same priorities as the comparison\noperations. The ``+`` and ``*`` operations have the same priority as\nthe corresponding numeric operations. [3] Additional methods are\nprovided for *Mutable Sequence Types*.\n\nThis table lists the sequence operations sorted in ascending priority\n(operations in the same box have the same priority). In the table,\n*s* and *t* are sequences of the same type; *n*, *i* and *j* are\nintegers:\n\n+--------------------+----------------------------------+------------+\n| Operation | Result | Notes |\n+====================+==================================+============+\n| ``x in s`` | ``True`` if an item of *s* is | (1) |\n| | equal to *x*, else ``False`` | |\n+--------------------+----------------------------------+------------+\n| ``x not in s`` | ``False`` if an item of *s* is | (1) |\n| | equal to *x*, else ``True`` | |\n+--------------------+----------------------------------+------------+\n| ``s + t`` | the concatenation of *s* and *t* | (6) |\n+--------------------+----------------------------------+------------+\n| ``s * n, n * s`` | *n* shallow copies of *s* | (2) |\n| | concatenated | |\n+--------------------+----------------------------------+------------+\n| ``s[i]`` | *i*th item of *s*, origin 0 | (3) |\n+--------------------+----------------------------------+------------+\n| ``s[i:j]`` | slice of *s* from *i* to *j* | (3)(4) |\n+--------------------+----------------------------------+------------+\n| ``s[i:j:k]`` | slice of *s* from *i* to *j* | (3)(5) |\n| | with step *k* | |\n+--------------------+----------------------------------+------------+\n| ``len(s)`` | length of *s* | |\n+--------------------+----------------------------------+------------+\n| ``min(s)`` | smallest item of *s* | |\n+--------------------+----------------------------------+------------+\n| ``max(s)`` | largest item of *s* | |\n+--------------------+----------------------------------+------------+\n| ``s.index(i)`` | index of the first occurence of | |\n| | *i* in *s* | |\n+--------------------+----------------------------------+------------+\n| ``s.count(i)`` | total number of occurences of | |\n| | *i* in *s* | |\n+--------------------+----------------------------------+------------+\n\nSequence types also support comparisons. In particular, tuples and\nlists are compared lexicographically by comparing corresponding\nelements. This means that to compare equal, every element must compare\nequal and the two sequences must be of the same type and have the same\nlength. (For full details see *Comparisons* in the language\nreference.)\n\nNotes:\n\n1. When *s* is a string or Unicode string object the ``in`` and ``not\n in`` operations act like a substring test. In Python versions\n before 2.3, *x* had to be a string of length 1. In Python 2.3 and\n beyond, *x* may be a string of any length.\n\n2. Values of *n* less than ``0`` are treated as ``0`` (which yields an\n empty sequence of the same type as *s*). Note also that the copies\n are shallow; nested structures are not copied. This often haunts\n new Python programmers; consider:\n\n >>> lists = [[]] * 3\n >>> lists\n [[], [], []]\n >>> lists[0].append(3)\n >>> lists\n [[3], [3], [3]]\n\n What has happened is that ``[[]]`` is a one-element list containing\n an empty list, so all three elements of ``[[]] * 3`` are (pointers\n to) this single empty list. Modifying any of the elements of\n ``lists`` modifies this single list. You can create a list of\n different lists this way:\n\n >>> lists = [[] for i in range(3)]\n >>> lists[0].append(3)\n >>> lists[1].append(5)\n >>> lists[2].append(7)\n >>> lists\n [[3], [5], [7]]\n\n3. If *i* or *j* is negative, the index is relative to the end of the\n string: ``len(s) + i`` or ``len(s) + j`` is substituted. But note\n that ``-0`` is still ``0``.\n\n4. The slice of *s* from *i* to *j* is defined as the sequence of\n items with index *k* such that ``i <= k < j``. If *i* or *j* is\n greater than ``len(s)``, use ``len(s)``. If *i* is omitted or\n ``None``, use ``0``. If *j* is omitted or ``None``, use\n ``len(s)``. If *i* is greater than or equal to *j*, the slice is\n empty.\n\n5. The slice of *s* from *i* to *j* with step *k* is defined as the\n sequence of items with index ``x = i + n*k`` such that ``0 <= n <\n (j-i)/k``. In other words, the indices are ``i``, ``i+k``,\n ``i+2*k``, ``i+3*k`` and so on, stopping when *j* is reached (but\n never including *j*). If *i* or *j* is greater than ``len(s)``,\n use ``len(s)``. If *i* or *j* are omitted or ``None``, they become\n "end" values (which end depends on the sign of *k*). Note, *k*\n cannot be zero. If *k* is ``None``, it is treated like ``1``.\n\n6. **CPython implementation detail:** If *s* and *t* are both strings,\n some Python implementations such as CPython can usually perform an\n in-place optimization for assignments of the form ``s = s + t`` or\n ``s += t``. When applicable, this optimization makes quadratic\n run-time much less likely. This optimization is both version and\n implementation dependent. For performance sensitive code, it is\n preferable to use the ``str.join()`` method which assures\n consistent linear concatenation performance across versions and\n implementations.\n\n Changed in version 2.4: Formerly, string concatenation never\n occurred in-place.\n\n\nString Methods\n==============\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support. Some of them are also available on\n``bytearray`` objects.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the *Sequence Types --- str, unicode, list, tuple,\nbytearray, buffer, xrange* section. To output formatted strings use\ntemplate strings or the ``%`` operator described in the *String\nFormatting Operations* section. Also, see the ``re`` module for string\nfunctions based on regular expressions.\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is a space).\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\n Decodes the string using the codec registered for *encoding*.\n *encoding* defaults to the default string encoding. *errors* may\n be given to set a different error handling scheme. The default is\n ``\'strict\'``, meaning that encoding errors raise ``UnicodeError``.\n Other possible values are ``\'ignore\'``, ``\'replace\'`` and any other\n name registered via ``codecs.register_error()``, see section *Codec\n Base Classes*.\n\n New in version 2.2.\n\n Changed in version 2.3: Support for other error handling schemes\n added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.encode([encoding[, errors]])\n\n Return an encoded version of the string. Default encoding is the\n current default string encoding. *errors* may be given to set a\n different error handling scheme. The default for *errors* is\n ``\'strict\'``, meaning that encoding errors raise a\n ``UnicodeError``. Other possible values are ``\'ignore\'``,\n ``\'replace\'``, ``\'xmlcharrefreplace\'``, ``\'backslashreplace\'`` and\n any other name registered via ``codecs.register_error()``, see\n section *Codec Base Classes*. For a list of possible encodings, see\n section *Standard Encodings*.\n\n New in version 2.0.\n\n Changed in version 2.3: Support for ``\'xmlcharrefreplace\'`` and\n ``\'backslashreplace\'`` and other error handling schemes added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return ``True`` if the string ends with the specified *suffix*,\n otherwise return ``False``. *suffix* can also be a tuple of\n suffixes to look for. With optional *start*, test beginning at\n that position. With optional *end*, stop comparing at that\n position.\n\n Changed in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. The column number is reset to zero after each\n newline occurring in the string. If *tabsize* is not given, a tab\n size of ``8`` characters is assumed. This doesn\'t understand other\n non-printing characters or escape sequences.\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found, such that *sub* is contained in the slice ``s[start:end]``.\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return ``-1`` if *sub* is not found.\n\n Note: The ``find()`` method should be used only if you need to know the\n position of *sub*. To check if *sub* is a substring or not, use\n the ``in`` operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces ``{}``. Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See *Format String Syntax* for a description of the various\n formatting options that can be specified in format strings.\n\n This method of string formatting is the new standard in Python 3,\n and should be preferred to the ``%`` formatting described in\n *String Formatting Operations* in new code.\n\n New in version 2.6.\n\nstr.index(sub[, start[, end]])\n\n Like ``find()``, but raise ``ValueError`` when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. The separator between elements is the\n string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to ``len(s)``.\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\n New in version 2.5.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within ``s[start:end]``.\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return ``-1`` on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like ``rfind()`` but raises ``ValueError`` when the substring *sub*\n is not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to ``len(s)``.\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\n New in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n ``None``, any whitespace string is a separator. Except for\n splitting from the right, ``rsplit()`` behaves like ``split()``\n which is described in detail below.\n\n New in version 2.4.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most ``maxsplit+1``\n elements). If *maxsplit* is not specified or ``-1``, then there is\n no limit on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n ``\'1,,2\'.split(\',\')`` returns ``[\'1\', \'\', \'2\']``). The *sep*\n argument may consist of multiple characters (for example,\n ``\'1<>2<>3\'.split(\'<>\')`` returns ``[\'1\', \'2\', \'3\']``). Splitting\n an empty string with a specified separator returns ``[\'\']``.\n\n If *sep* is not specified or is ``None``, a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a ``None`` separator returns\n ``[]``.\n\n For example, ``\' 1 2 3 \'.split()`` returns ``[\'1\', \'2\', \'3\']``,\n and ``\' 1 2 3 \'.split(None, 1)`` returns ``[\'1\', \'2 3 \']``.\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. This method uses the *universal newlines* approach to\n splitting lines. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\n For example, ``\'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()`` returns\n ``[\'ab c\', \'\', \'de fg\', \'kl\']``, while the same call with\n ``splitlines(True)`` returns ``[\'ab c\\n\', \'\\n\', \'de fg\\r\',\n \'kl\\r\\n\']``.\n\n Unlike ``split()`` when a delimiter string *sep* is given, this\n method returns an empty list for the empty string, and a terminal\n line break does not result in an extra line.\n\nstr.startswith(prefix[, start[, end]])\n\n Return ``True`` if string starts with the *prefix*, otherwise\n return ``False``. *prefix* can also be a tuple of prefixes to look\n for. With optional *start*, test string beginning at that\n position. With optional *end*, stop comparing string at that\n position.\n\n Changed in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or ``None``, the\n *chars* argument defaults to removing whitespace. The *chars*\n argument is not a prefix or suffix; rather, all combinations of its\n values are stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n ... lambda mo: mo.group(0)[0].upper() +\n ... mo.group(0)[1:].lower(),\n ... s)\n ...\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\n Return a copy of the string where all characters occurring in the\n optional argument *deletechars* are removed, and the remaining\n characters have been mapped through the given translation table,\n which must be a string of length 256.\n\n You can use the ``maketrans()`` helper function in the ``string``\n module to create a translation table. For string objects, set the\n *table* argument to ``None`` for translations that only delete\n characters:\n\n >>> \'read this short text\'.translate(None, \'aeiou\')\n \'rd ths shrt txt\'\n\n New in version 2.6: Support for a ``None`` *table* argument.\n\n For Unicode objects, the ``translate()`` method does not accept the\n optional *deletechars* argument. Instead, it returns a copy of the\n *s* where all characters have been mapped through the given\n translation table which must be a mapping of Unicode ordinals to\n Unicode ordinals, Unicode strings or ``None``. Unmapped characters\n are left untouched. Characters mapped to ``None`` are deleted.\n Note, a more flexible approach is to create a custom character\n mapping codec using the ``codecs`` module (see ``encodings.cp1251``\n for an example).\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that ``str.upper().isupper()`` might\n be ``False`` if ``s`` contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\n Return the numeric string left filled with zeros in a string of\n length *width*. A sign prefix is handled correctly. The original\n string is returned if *width* is less than or equal to ``len(s)``.\n\n New in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\n Return ``True`` if there are only numeric characters in S,\n ``False`` otherwise. Numeric characters include digit characters,\n and all characters that have the Unicode numeric value property,\n e.g. U+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\n Return ``True`` if there are only decimal characters in S,\n ``False`` otherwise. Decimal characters include digit characters,\n and all characters that can be used to form decimal-radix numbers,\n e.g. U+0660, ARABIC-INDIC DIGIT ZERO.\n\n\nString Formatting Operations\n============================\n\nString and Unicode objects have one unique built-in operation: the\n``%`` operator (modulo). This is also known as the string\n*formatting* or *interpolation* operator. Given ``format % values``\n(where *format* is a string or Unicode object), ``%`` conversion\nspecifications in *format* are replaced with zero or more elements of\n*values*. The effect is similar to the using ``sprintf()`` in the C\nlanguage. If *format* is a Unicode object, or if any of the objects\nbeing converted using the ``%s`` conversion are Unicode objects, the\nresult will also be a Unicode object.\n\nIf *format* requires a single argument, *values* may be a single non-\ntuple object. [5] Otherwise, *values* must be a tuple with exactly\nthe number of items specified by the format string, or a single\nmapping object (for example, a dictionary).\n\nA conversion specifier contains two or more characters and has the\nfollowing components, which must occur in this order:\n\n1. The ``\'%\'`` character, which marks the start of the specifier.\n\n2. Mapping key (optional), consisting of a parenthesised sequence of\n characters (for example, ``(somename)``).\n\n3. Conversion flags (optional), which affect the result of some\n conversion types.\n\n4. Minimum field width (optional). If specified as an ``\'*\'``\n (asterisk), the actual width is read from the next element of the\n tuple in *values*, and the object to convert comes after the\n minimum field width and optional precision.\n\n5. Precision (optional), given as a ``\'.\'`` (dot) followed by the\n precision. If specified as ``\'*\'`` (an asterisk), the actual width\n is read from the next element of the tuple in *values*, and the\n value to convert comes after the precision.\n\n6. Length modifier (optional).\n\n7. Conversion type.\n\nWhen the right argument is a dictionary (or other mapping type), then\nthe formats in the string *must* include a parenthesised mapping key\ninto that dictionary inserted immediately after the ``\'%\'`` character.\nThe mapping key selects the value to be formatted from the mapping.\nFor example:\n\n>>> print \'%(language)s has %(number)03d quote types.\' % \\\n... {"language": "Python", "number": 2}\nPython has 002 quote types.\n\nIn this case no ``*`` specifiers may occur in a format (since they\nrequire a sequential parameter list).\n\nThe conversion flag characters are:\n\n+-----------+-----------------------------------------------------------------------+\n| Flag | Meaning |\n+===========+=======================================================================+\n| ``\'#\'`` | The value conversion will use the "alternate form" (where defined |\n| | below). |\n+-----------+-----------------------------------------------------------------------+\n| ``\'0\'`` | The conversion will be zero padded for numeric values. |\n+-----------+-----------------------------------------------------------------------+\n| ``\'-\'`` | The converted value is left adjusted (overrides the ``\'0\'`` |\n| | conversion if both are given). |\n+-----------+-----------------------------------------------------------------------+\n| ``\' \'`` | (a space) A blank should be left before a positive number (or empty |\n| | string) produced by a signed conversion. |\n+-----------+-----------------------------------------------------------------------+\n| ``\'+\'`` | A sign character (``\'+\'`` or ``\'-\'``) will precede the conversion |\n| | (overrides a "space" flag). |\n+-----------+-----------------------------------------------------------------------+\n\nA length modifier (``h``, ``l``, or ``L``) may be present, but is\nignored as it is not necessary for Python -- so e.g. ``%ld`` is\nidentical to ``%d``.\n\nThe conversion types are:\n\n+--------------+-------------------------------------------------------+---------+\n| Conversion | Meaning | Notes |\n+==============+=======================================================+=========+\n| ``\'d\'`` | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'i\'`` | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'o\'`` | Signed octal value. | (1) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'u\'`` | Obsolete type -- it is identical to ``\'d\'``. | (7) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'x\'`` | Signed hexadecimal (lowercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'X\'`` | Signed hexadecimal (uppercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'e\'`` | Floating point exponential format (lowercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'E\'`` | Floating point exponential format (uppercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'f\'`` | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'F\'`` | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'g\'`` | Floating point format. Uses lowercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'G\'`` | Floating point format. Uses uppercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'c\'`` | Single character (accepts integer or single character | |\n| | string). | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'r\'`` | String (converts any Python object using ``repr()``). | (5) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'s\'`` | String (converts any Python object using ``str()``). | (6) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'%\'`` | No argument is converted, results in a ``\'%\'`` | |\n| | character in the result. | |\n+--------------+-------------------------------------------------------+---------+\n\nNotes:\n\n1. The alternate form causes a leading zero (``\'0\'``) to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n2. The alternate form causes a leading ``\'0x\'`` or ``\'0X\'`` (depending\n on whether the ``\'x\'`` or ``\'X\'`` format was used) to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n3. The alternate form causes the result to always contain a decimal\n point, even if no digits follow it.\n\n The precision determines the number of digits after the decimal\n point and defaults to 6.\n\n4. The alternate form causes the result to always contain a decimal\n point, and trailing zeroes are not removed as they would otherwise\n be.\n\n The precision determines the number of significant digits before\n and after the decimal point and defaults to 6.\n\n5. The ``%r`` conversion was added in Python 2.0.\n\n The precision determines the maximal number of characters used.\n\n6. If the object or format provided is a ``unicode`` string, the\n resulting string will also be ``unicode``.\n\n The precision determines the maximal number of characters used.\n\n7. See **PEP 237**.\n\nSince Python strings have an explicit length, ``%s`` conversions do\nnot assume that ``\'\\0\'`` is the end of the string.\n\nChanged in version 2.7: ``%f`` conversions for numbers whose absolute\nvalue is over 1e50 are no longer replaced by ``%g`` conversions.\n\nAdditional string operations are defined in standard modules\n``string`` and ``re``.\n\n\nXRange Type\n===========\n\nThe ``xrange`` type is an immutable sequence which is commonly used\nfor looping. The advantage of the ``xrange`` type is that an\n``xrange`` object will always take the same amount of memory, no\nmatter the size of the range it represents. There are no consistent\nperformance advantages.\n\nXRange objects have very little behavior: they only support indexing,\niteration, and the ``len()`` function.\n\n\nMutable Sequence Types\n======================\n\nList and ``bytearray`` objects support additional operations that\nallow in-place modification of the object. Other mutable sequence\ntypes (when added to the language) should also support these\noperations. Strings and tuples are immutable sequence types: such\nobjects cannot be modified once created. The following operations are\ndefined on mutable sequence types (where *x* is an arbitrary object):\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| ``s[i] = x`` | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j] = t`` | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j]`` | same as ``s[i:j] = []`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j:k] = t`` | the elements of ``s[i:j:k]`` are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j:k]`` | removes the elements of | |\n| | ``s[i:j:k]`` from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.append(x)`` | same as ``s[len(s):len(s)] = | (2) |\n| | [x]`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.extend(x)`` | same as ``s[len(s):len(s)] = x`` | (3) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.count(x)`` | return number of *i*\'s for which | |\n| | ``s[i] == x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.index(x[, i[, j]])`` | return smallest *k* such that | (4) |\n| | ``s[k] == x`` and ``i <= k < j`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.insert(i, x)`` | same as ``s[i:i] = [x]`` | (5) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.pop([i])`` | same as ``x = s[i]; del s[i]; | (6) |\n| | return x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.remove(x)`` | same as ``del s[s.index(x)]`` | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.reverse()`` | reverses the items of *s* in | (7) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.sort([cmp[, key[, | sort the items of *s* in place | (7)(8)(9)(10) |\n| reverse]]])`` | | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The C implementation of Python has historically accepted multiple\n parameters and implicitly joined them into a tuple; this no longer\n works in Python 2.0. Use of this misfeature has been deprecated\n since Python 1.4.\n\n3. *x* can be any iterable object.\n\n4. Raises ``ValueError`` when *x* is not found in *s*. When a negative\n index is passed as the second or third parameter to the ``index()``\n method, the list length is added, as for slice indices. If it is\n still negative, it is truncated to zero, as for slice indices.\n\n Changed in version 2.3: Previously, ``index()`` didn\'t have\n arguments for specifying start and stop positions.\n\n5. When a negative index is passed as the first parameter to the\n ``insert()`` method, the list length is added, as for slice\n indices. If it is still negative, it is truncated to zero, as for\n slice indices.\n\n Changed in version 2.3: Previously, all negative indices were\n truncated to zero.\n\n6. The ``pop()`` method is only supported by the list and array types.\n The optional argument *i* defaults to ``-1``, so that by default\n the last item is removed and returned.\n\n7. The ``sort()`` and ``reverse()`` methods modify the list in place\n for economy of space when sorting or reversing a large list. To\n remind you that they operate by side effect, they don\'t return the\n sorted or reversed list.\n\n8. The ``sort()`` method takes optional arguments for controlling the\n comparisons.\n\n *cmp* specifies a custom comparison function of two arguments (list\n items) which should return a negative, zero or positive number\n depending on whether the first argument is considered smaller than,\n equal to, or larger than the second argument: ``cmp=lambda x,y:\n cmp(x.lower(), y.lower())``. The default value is ``None``.\n\n *key* specifies a function of one argument that is used to extract\n a comparison key from each list element: ``key=str.lower``. The\n default value is ``None``.\n\n *reverse* is a boolean value. If set to ``True``, then the list\n elements are sorted as if each comparison were reversed.\n\n In general, the *key* and *reverse* conversion processes are much\n faster than specifying an equivalent *cmp* function. This is\n because *cmp* is called multiple times for each list element while\n *key* and *reverse* touch each element only once. Use\n ``functools.cmp_to_key()`` to convert an old-style *cmp* function\n to a *key* function.\n\n Changed in version 2.3: Support for ``None`` as an equivalent to\n omitting *cmp* was added.\n\n Changed in version 2.4: Support for *key* and *reverse* was added.\n\n9. Starting with Python 2.3, the ``sort()`` method is guaranteed to be\n stable. A sort is stable if it guarantees not to change the\n relative order of elements that compare equal --- this is helpful\n for sorting in multiple passes (for example, sort by department,\n then by salary grade).\n\n10. **CPython implementation detail:** While a list is being sorted,\n the effect of attempting to mutate, or even inspect, the list is\n undefined. The C implementation of Python 2.3 and newer makes the\n list appear empty for the duration, and raises ``ValueError`` if\n it can detect that the list has been mutated during a sort.\n', 'typesseq-mutable': "\nMutable Sequence Types\n**********************\n\nList and ``bytearray`` objects support additional operations that\nallow in-place modification of the object. Other mutable sequence\ntypes (when added to the language) should also support these\noperations. Strings and tuples are immutable sequence types: such\nobjects cannot be modified once created. The following operations are\ndefined on mutable sequence types (where *x* is an arbitrary object):\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| ``s[i] = x`` | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j] = t`` | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j]`` | same as ``s[i:j] = []`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j:k] = t`` | the elements of ``s[i:j:k]`` are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j:k]`` | removes the elements of | |\n| | ``s[i:j:k]`` from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.append(x)`` | same as ``s[len(s):len(s)] = | (2) |\n| | [x]`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.extend(x)`` | same as ``s[len(s):len(s)] = x`` | (3) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.count(x)`` | return number of *i*'s for which | |\n| | ``s[i] == x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.index(x[, i[, j]])`` | return smallest *k* such that | (4) |\n| | ``s[k] == x`` and ``i <= k < j`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.insert(i, x)`` | same as ``s[i:i] = [x]`` | (5) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.pop([i])`` | same as ``x = s[i]; del s[i]; | (6) |\n| | return x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.remove(x)`` | same as ``del s[s.index(x)]`` | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.reverse()`` | reverses the items of *s* in | (7) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.sort([cmp[, key[, | sort the items of *s* in place | (7)(8)(9)(10) |\n| reverse]]])`` | | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The C implementation of Python has historically accepted multiple\n parameters and implicitly joined them into a tuple; this no longer\n works in Python 2.0. Use of this misfeature has been deprecated\n since Python 1.4.\n\n3. *x* can be any iterable object.\n\n4. Raises ``ValueError`` when *x* is not found in *s*. When a negative\n index is passed as the second or third parameter to the ``index()``\n method, the list length is added, as for slice indices. If it is\n still negative, it is truncated to zero, as for slice indices.\n\n Changed in version 2.3: Previously, ``index()`` didn't have\n arguments for specifying start and stop positions.\n\n5. When a negative index is passed as the first parameter to the\n ``insert()`` method, the list length is added, as for slice\n indices. If it is still negative, it is truncated to zero, as for\n slice indices.\n\n Changed in version 2.3: Previously, all negative indices were\n truncated to zero.\n\n6. The ``pop()`` method is only supported by the list and array types.\n The optional argument *i* defaults to ``-1``, so that by default\n the last item is removed and returned.\n\n7. The ``sort()`` and ``reverse()`` methods modify the list in place\n for economy of space when sorting or reversing a large list. To\n remind you that they operate by side effect, they don't return the\n sorted or reversed list.\n\n8. The ``sort()`` method takes optional arguments for controlling the\n comparisons.\n\n *cmp* specifies a custom comparison function of two arguments (list\n items) which should return a negative, zero or positive number\n depending on whether the first argument is considered smaller than,\n equal to, or larger than the second argument: ``cmp=lambda x,y:\n cmp(x.lower(), y.lower())``. The default value is ``None``.\n\n *key* specifies a function of one argument that is used to extract\n a comparison key from each list element: ``key=str.lower``. The\n default value is ``None``.\n\n *reverse* is a boolean value. If set to ``True``, then the list\n elements are sorted as if each comparison were reversed.\n\n In general, the *key* and *reverse* conversion processes are much\n faster than specifying an equivalent *cmp* function. This is\n because *cmp* is called multiple times for each list element while\n *key* and *reverse* touch each element only once. Use\n ``functools.cmp_to_key()`` to convert an old-style *cmp* function\n to a *key* function.\n\n Changed in version 2.3: Support for ``None`` as an equivalent to\n omitting *cmp* was added.\n\n Changed in version 2.4: Support for *key* and *reverse* was added.\n\n9. Starting with Python 2.3, the ``sort()`` method is guaranteed to be\n stable. A sort is stable if it guarantees not to change the\n relative order of elements that compare equal --- this is helpful\n for sorting in multiple passes (for example, sort by department,\n then by salary grade).\n\n10. **CPython implementation detail:** While a list is being sorted,\n the effect of attempting to mutate, or even inspect, the list is\n undefined. The C implementation of Python 2.3 and newer makes the\n list appear empty for the duration, and raises ``ValueError`` if\n it can detect that the list has been mutated during a sort.\n", 'unary': '\nUnary arithmetic and bitwise operations\n***************************************\n\nAll unary arithmetic and bitwise operations have the same priority:\n\n u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n\nThe unary ``-`` (minus) operator yields the negation of its numeric\nargument.\n\nThe unary ``+`` (plus) operator yields its numeric argument unchanged.\n\nThe unary ``~`` (invert) operator yields the bitwise inversion of its\nplain or long integer argument. The bitwise inversion of ``x`` is\ndefined as ``-(x+1)``. It only applies to integral numbers.\n\nIn all three cases, if the argument does not have the proper type, a\n``TypeError`` exception is raised.\n', 'while': '\nThe ``while`` statement\n***********************\n\nThe ``while`` statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the ``else`` clause, if present, is\nexecuted and the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ngoes back to testing the expression.\n', -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 16:20:36 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 16:20:36 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_version_to_2?= =?utf-8?q?=2E7=2E4rc1?= Message-ID: <3ZY55w48Jxz7Lmn@mail.python.org> http://hg.python.org/cpython/rev/a8d18780bc2b changeset: 82908:a8d18780bc2b branch: 2.7 tag: v2.7.4rc1 user: Benjamin Peterson date: Sat Mar 23 10:17:29 2013 -0500 summary: version to 2.7.4rc1 files: Include/patchlevel.h | 8 ++++---- Lib/distutils/__init__.py | 2 +- Lib/idlelib/idlever.py | 2 +- Misc/NEWS | 8 ++++---- Misc/RPM/python-2.7.spec | 2 +- README | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -22,12 +22,12 @@ /*--start constants--*/ #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 7 -#define PY_MICRO_VERSION 3 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL -#define PY_RELEASE_SERIAL 0 +#define PY_MICRO_VERSION 4 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA +#define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "2.7.3+" +#define PY_VERSION "2.7.4rc1" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Lib/distutils/__init__.py b/Lib/distutils/__init__.py --- a/Lib/distutils/__init__.py +++ b/Lib/distutils/__init__.py @@ -15,5 +15,5 @@ # Updated automatically by the Python release process. # #--start constants-- -__version__ = "2.7.3" +__version__ = "2.7.4rc1" #--end constants-- diff --git a/Lib/idlelib/idlever.py b/Lib/idlelib/idlever.py --- a/Lib/idlelib/idlever.py +++ b/Lib/idlelib/idlever.py @@ -1,1 +1,1 @@ -IDLE_VERSION = "2.7.3" +IDLE_VERSION = "2.7.4rc1" diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1,10 +1,10 @@ Python News +++++++++++ -What's New in Python 2.7.4 -========================== - -*Release date: XXXX-XX-XX* +What's New in Python 2.7.4 release candidate 1 +============================================== + +*Release date: 2013-03-23* Core and Builtins ----------------- diff --git a/Misc/RPM/python-2.7.spec b/Misc/RPM/python-2.7.spec --- a/Misc/RPM/python-2.7.spec +++ b/Misc/RPM/python-2.7.spec @@ -39,7 +39,7 @@ %define name python #--start constants-- -%define version 2.7.3 +%define version 2.7.4rc1 %define libvers 2.7 #--end constants-- %define release 1pydotorg diff --git a/README b/README --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is Python version 2.7.3 +This is Python version 2.7.4 ============================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 16:20:37 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 16:20:37 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Added_tag_v2?= =?utf-8?q?=2E7=2E4rc1_for_changeset_a8d18780bc2b?= Message-ID: <3ZY55x71H6z7LmL@mail.python.org> http://hg.python.org/cpython/rev/cd63c8928528 changeset: 82909:cd63c8928528 branch: 2.7 user: Benjamin Peterson date: Sat Mar 23 10:18:05 2013 -0500 summary: Added tag v2.7.4rc1 for changeset a8d18780bc2b files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -156,3 +156,4 @@ b2c6aff96e1251a4f03cf866e7e75fb8232869f2 v2.7.3rc1 d46c1973d3c407ecaa6a8ee16d3fad3ef506b51f v2.7.3rc2 70274d53c1ddc60c5f9a2b8a422a49884021447c v2.7.3 +a8d18780bc2bccf16bf580587e1e3c934a98f6a7 v2.7.4rc1 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 16:20:39 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 16:20:39 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogYWZ0ZXIgMi43LjRy?= =?utf-8?q?c1_bump?= Message-ID: <3ZY55z2jChz7Lmn@mail.python.org> http://hg.python.org/cpython/rev/9f714c8ce025 changeset: 82910:9f714c8ce025 branch: 2.7 user: Benjamin Peterson date: Sat Mar 23 10:19:40 2013 -0500 summary: after 2.7.4rc1 bump files: Include/patchlevel.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -27,7 +27,7 @@ #define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "2.7.4rc1" +#define PY_VERSION "2.7.4rc1+" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 16:22:20 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 23 Mar 2013 16:22:20 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgMTc0NDc6?= =?utf-8?q?__Clarify_that_str=2Eisidentifier_doesn=27t_check_for_reserved_?= =?utf-8?q?keywords=2E?= Message-ID: <3ZY57w3Cy2z7LmF@mail.python.org> http://hg.python.org/cpython/rev/a7fe48dfbfe9 changeset: 82911:a7fe48dfbfe9 branch: 3.3 parent: 82903:fa9e189e30ad user: Raymond Hettinger date: Sat Mar 23 08:21:12 2013 -0700 summary: Issue 17447: Clarify that str.isidentifier doesn't check for reserved keywords. files: Doc/library/stdtypes.rst | 2 ++ Objects/unicodeobject.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1627,6 +1627,8 @@ Return true if the string is a valid identifier according to the language definition, section :ref:`identifiers`. + Use :func:`keyword.iskeyword` to test for reserved identifiers such as + :keyword:`def` and :keyword:`class`. .. method:: str.islower() diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -11493,7 +11493,10 @@ "S.isidentifier() -> bool\n\ \n\ Return True if S is a valid identifier according\n\ -to the language definition."); +to the language definition.\n\ +\n\ +Use keyword.iskeyword() to test for reserved identifiers\n\ +such as \"def\" and \"class\".\n"); static PyObject* unicode_isidentifier(PyObject *self) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 16:22:21 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 23 Mar 2013 16:22:21 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZY57x68HVz7Lmv@mail.python.org> http://hg.python.org/cpython/rev/f97a9bdef27a changeset: 82912:f97a9bdef27a parent: 82905:fd7f99e662b7 parent: 82911:a7fe48dfbfe9 user: Raymond Hettinger date: Sat Mar 23 08:21:52 2013 -0700 summary: merge files: Doc/library/stdtypes.rst | 2 ++ Objects/unicodeobject.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1627,6 +1627,8 @@ Return true if the string is a valid identifier according to the language definition, section :ref:`identifiers`. + Use :func:`keyword.iskeyword` to test for reserved identifiers such as + :keyword:`def` and :keyword:`class`. .. method:: str.islower() diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -11369,7 +11369,10 @@ "S.isidentifier() -> bool\n\ \n\ Return True if S is a valid identifier according\n\ -to the language definition."); +to the language definition.\n\ +\n\ +Use keyword.iskeyword() to test for reserved identifiers\n\ +such as \"def\" and \"class\".\n"); static PyObject* unicode_isidentifier(PyObject *self) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 16:57:10 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 23 Mar 2013 16:57:10 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Update_collect?= =?utf-8?q?ions_ABC_table_to_match_the_=5F=5Fabstractmethods=5F=5F_attribu?= =?utf-8?q?te_for?= Message-ID: <3ZY5w617DmzLq9@mail.python.org> http://hg.python.org/cpython/rev/6668a2302107 changeset: 82913:6668a2302107 branch: 2.7 parent: 82910:9f714c8ce025 user: Raymond Hettinger date: Sat Mar 23 08:57:00 2013 -0700 summary: Update collections ABC table to match the __abstractmethods__ attribute for each container. files: Doc/library/collections.rst | 40 ++++++++++++++---------- 1 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -895,29 +895,35 @@ :class:`Sized` ``__len__`` :class:`Callable` ``__call__`` -:class:`Sequence` :class:`Sized`, ``__getitem__`` ``__contains__``, ``__iter__``, ``__reversed__``, - :class:`Iterable`, ``index``, and ``count`` +:class:`Sequence` :class:`Sized`, ``__getitem__``, ``__contains__``, ``__iter__``, ``__reversed__``, + :class:`Iterable`, ``__len__`` ``index``, and ``count`` :class:`Container` -:class:`MutableSequence` :class:`Sequence` ``__setitem__``, Inherited :class:`Sequence` methods and - ``__delitem__``, ``append``, ``reverse``, ``extend``, ``pop``, - ``insert`` ``remove``, and ``__iadd__`` +:class:`MutableSequence` :class:`Sequence` ``__getitem__``, Inherited :class:`Sequence` methods and + ``__setitem__``, ``append``, ``reverse``, ``extend``, ``pop``, + ``__delitem__``, ``remove``, and ``__iadd__`` + ``__len__``, + ``insert`` -:class:`Set` :class:`Sized`, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, - :class:`Iterable`, ``__gt__``, ``__ge__``, ``__and__``, ``__or__``, - :class:`Container` ``__sub__``, ``__xor__``, and ``isdisjoint`` +:class:`Set` :class:`Sized`, ``__contains__``, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, + :class:`Iterable`, ``__iter__``, ``__gt__``, ``__ge__``, ``__and__``, ``__or__``, + :class:`Container` ``__len__`` ``__sub__``, ``__xor__``, and ``isdisjoint`` -:class:`MutableSet` :class:`Set` ``add``, Inherited :class:`Set` methods and - ``discard`` ``clear``, ``pop``, ``remove``, ``__ior__``, - ``__iand__``, ``__ixor__``, and ``__isub__`` +:class:`MutableSet` :class:`Set` ``__contains__``, Inherited :class:`Set` methods and + ``__iter__``, ``clear``, ``pop``, ``remove``, ``__ior__``, + ``__len__``, ``__iand__``, ``__ixor__``, and ``__isub__`` + ``add``, + ``discard`` -:class:`Mapping` :class:`Sized`, ``__getitem__`` ``__contains__``, ``keys``, ``items``, ``values``, - :class:`Iterable`, ``get``, ``__eq__``, and ``__ne__`` - :class:`Container` +:class:`Mapping` :class:`Sized`, ``__getitem__``, ``__contains__``, ``keys``, ``items``, ``values``, + :class:`Iterable`, ``__iter__``, ``get``, ``__eq__``, and ``__ne__`` + :class:`Container` ``__len__`` -:class:`MutableMapping` :class:`Mapping` ``__setitem__``, Inherited :class:`Mapping` methods and - ``__delitem__`` ``pop``, ``popitem``, ``clear``, ``update``, - and ``setdefault`` +:class:`MutableMapping` :class:`Mapping` ``__getitem__``, Inherited :class:`Mapping` methods and + ``__setitem__``, ``pop``, ``popitem``, ``clear``, ``update``, + ``__delitem__``, and ``setdefault`` + ``__iter__``, + ``__len__`` :class:`MappingView` :class:`Sized` ``__len__`` -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 17:08:36 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 23 Mar 2013 17:08:36 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Update_collect?= =?utf-8?q?ions_ABC_table_to_match_the_=5F=5Fabstractmethods=5F=5F_attribu?= =?utf-8?q?te_for?= Message-ID: <3ZY69J6LSQz7LlB@mail.python.org> http://hg.python.org/cpython/rev/52f59c3390a5 changeset: 82914:52f59c3390a5 branch: 3.3 parent: 82911:a7fe48dfbfe9 user: Raymond Hettinger date: Sat Mar 23 09:07:36 2013 -0700 summary: Update collections ABC table to match the __abstractmethods__ attribute for each container. files: Doc/library/collections.abc.rst | 40 ++++++++++++-------- 1 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Doc/library/collections.abc.rst b/Doc/library/collections.abc.rst --- a/Doc/library/collections.abc.rst +++ b/Doc/library/collections.abc.rst @@ -41,29 +41,35 @@ :class:`Sized` ``__len__`` :class:`Callable` ``__call__`` -:class:`Sequence` :class:`Sized`, ``__getitem__`` ``__contains__``, ``__iter__``, ``__reversed__``, - :class:`Iterable`, ``index``, and ``count`` +:class:`Sequence` :class:`Sized`, ``__getitem__``, ``__contains__``, ``__iter__``, ``__reversed__``, + :class:`Iterable`, ``__len__`` ``index``, and ``count`` :class:`Container` -:class:`MutableSequence` :class:`Sequence` ``__setitem__``, Inherited :class:`Sequence` methods and - ``__delitem__``, ``append``, ``reverse``, ``extend``, ``pop``, - ``insert`` ``remove``, ``clear``, and ``__iadd__`` +:class:`MutableSequence` :class:`Sequence` ``__getitem__``, Inherited :class:`Sequence` methods and + ``__setitem__``, ``append``, ``reverse``, ``extend``, ``pop``, + ``__delitem__``, ``remove``, and ``__iadd__`` + ``__len__``, + ``insert`` -:class:`Set` :class:`Sized`, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, - :class:`Iterable`, ``__gt__``, ``__ge__``, ``__and__``, ``__or__``, - :class:`Container` ``__sub__``, ``__xor__``, and ``isdisjoint`` +:class:`Set` :class:`Sized`, ``__contains__``, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, + :class:`Iterable`, ``__iter__``, ``__gt__``, ``__ge__``, ``__and__``, ``__or__``, + :class:`Container` ``__len__`` ``__sub__``, ``__xor__``, and ``isdisjoint`` -:class:`MutableSet` :class:`Set` ``add``, Inherited :class:`Set` methods and - ``discard`` ``clear``, ``pop``, ``remove``, ``__ior__``, - ``__iand__``, ``__ixor__``, and ``__isub__`` +:class:`MutableSet` :class:`Set` ``__contains__``, Inherited :class:`Set` methods and + ``__iter__``, ``clear``, ``pop``, ``remove``, ``__ior__``, + ``__len__``, ``__iand__``, ``__ixor__``, and ``__isub__`` + ``add``, + ``discard`` -:class:`Mapping` :class:`Sized`, ``__getitem__`` ``__contains__``, ``keys``, ``items``, ``values``, - :class:`Iterable`, ``get``, ``__eq__``, and ``__ne__`` - :class:`Container` +:class:`Mapping` :class:`Sized`, ``__getitem__``, ``__contains__``, ``keys``, ``items``, ``values``, + :class:`Iterable`, ``__iter__``, ``get``, ``__eq__``, and ``__ne__`` + :class:`Container` ``__len__`` -:class:`MutableMapping` :class:`Mapping` ``__setitem__``, Inherited :class:`Mapping` methods and - ``__delitem__`` ``pop``, ``popitem``, ``clear``, ``update``, - and ``setdefault`` +:class:`MutableMapping` :class:`Mapping` ``__getitem__``, Inherited :class:`Mapping` methods and + ``__setitem__``, ``pop``, ``popitem``, ``clear``, ``update``, + ``__delitem__``, and ``setdefault`` + ``__iter__``, + ``__len__`` :class:`MappingView` :class:`Sized` ``__len__`` -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 17:08:38 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 23 Mar 2013 17:08:38 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZY69L31CRzSTK@mail.python.org> http://hg.python.org/cpython/rev/60ec59b5d717 changeset: 82915:60ec59b5d717 parent: 82912:f97a9bdef27a parent: 82914:52f59c3390a5 user: Raymond Hettinger date: Sat Mar 23 09:08:18 2013 -0700 summary: merge files: Doc/library/collections.abc.rst | 40 ++++++++++++-------- 1 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Doc/library/collections.abc.rst b/Doc/library/collections.abc.rst --- a/Doc/library/collections.abc.rst +++ b/Doc/library/collections.abc.rst @@ -41,29 +41,35 @@ :class:`Sized` ``__len__`` :class:`Callable` ``__call__`` -:class:`Sequence` :class:`Sized`, ``__getitem__`` ``__contains__``, ``__iter__``, ``__reversed__``, - :class:`Iterable`, ``index``, and ``count`` +:class:`Sequence` :class:`Sized`, ``__getitem__``, ``__contains__``, ``__iter__``, ``__reversed__``, + :class:`Iterable`, ``__len__`` ``index``, and ``count`` :class:`Container` -:class:`MutableSequence` :class:`Sequence` ``__setitem__``, Inherited :class:`Sequence` methods and - ``__delitem__``, ``append``, ``reverse``, ``extend``, ``pop``, - ``insert`` ``remove``, ``clear``, and ``__iadd__`` +:class:`MutableSequence` :class:`Sequence` ``__getitem__``, Inherited :class:`Sequence` methods and + ``__setitem__``, ``append``, ``reverse``, ``extend``, ``pop``, + ``__delitem__``, ``remove``, and ``__iadd__`` + ``__len__``, + ``insert`` -:class:`Set` :class:`Sized`, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, - :class:`Iterable`, ``__gt__``, ``__ge__``, ``__and__``, ``__or__``, - :class:`Container` ``__sub__``, ``__xor__``, and ``isdisjoint`` +:class:`Set` :class:`Sized`, ``__contains__``, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, + :class:`Iterable`, ``__iter__``, ``__gt__``, ``__ge__``, ``__and__``, ``__or__``, + :class:`Container` ``__len__`` ``__sub__``, ``__xor__``, and ``isdisjoint`` -:class:`MutableSet` :class:`Set` ``add``, Inherited :class:`Set` methods and - ``discard`` ``clear``, ``pop``, ``remove``, ``__ior__``, - ``__iand__``, ``__ixor__``, and ``__isub__`` +:class:`MutableSet` :class:`Set` ``__contains__``, Inherited :class:`Set` methods and + ``__iter__``, ``clear``, ``pop``, ``remove``, ``__ior__``, + ``__len__``, ``__iand__``, ``__ixor__``, and ``__isub__`` + ``add``, + ``discard`` -:class:`Mapping` :class:`Sized`, ``__getitem__`` ``__contains__``, ``keys``, ``items``, ``values``, - :class:`Iterable`, ``get``, ``__eq__``, and ``__ne__`` - :class:`Container` +:class:`Mapping` :class:`Sized`, ``__getitem__``, ``__contains__``, ``keys``, ``items``, ``values``, + :class:`Iterable`, ``__iter__``, ``get``, ``__eq__``, and ``__ne__`` + :class:`Container` ``__len__`` -:class:`MutableMapping` :class:`Mapping` ``__setitem__``, Inherited :class:`Mapping` methods and - ``__delitem__`` ``pop``, ``popitem``, ``clear``, ``update``, - and ``setdefault`` +:class:`MutableMapping` :class:`Mapping` ``__getitem__``, Inherited :class:`Mapping` methods and + ``__setitem__``, ``pop``, ``popitem``, ``clear``, ``update``, + ``__delitem__``, and ``setdefault`` + ``__iter__``, + ``__len__`` :class:`MappingView` :class:`Sized` ``__len__`` -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 20:00:46 2013 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 23 Mar 2013 20:00:46 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_Fixes_issue_?= =?utf-8?q?=2317488=3A_Change_the_subprocess=2EPopen_bufsize_parameter_def?= =?utf-8?q?ault_value?= Message-ID: <3ZY9zy2WXNz7LmS@mail.python.org> http://hg.python.org/cpython/rev/3ecf709dfe69 changeset: 82916:3ecf709dfe69 branch: 3.2 parent: 82897:49d54e4d95df user: Gregory P. Smith date: Sat Mar 23 11:44:25 2013 -0700 summary: Fixes issue #17488: Change the subprocess.Popen bufsize parameter default value from unbuffered (0) to buffering (-1) to match the behavior existing code expects and match the behavior of the subprocess module in Python 2 to avoid introducing hard to track down bugs. files: Doc/library/subprocess.rst | 23 +++++++++++++---------- Lib/subprocess.py | 18 +++++++++--------- Lib/test/test_subprocess.py | 22 ++++++++++++++++++++++ Misc/NEWS | 5 +++++ 4 files changed, 49 insertions(+), 19 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -284,7 +284,7 @@ functions. -.. class:: Popen(args, bufsize=0, executable=None, stdin=None, stdout=None, \ +.. class:: Popen(args, bufsize=-1, executable=None, stdin=None, stdout=None, \ stderr=None, preexec_fn=None, close_fds=True, shell=False, \ cwd=None, env=None, universal_newlines=False, \ startupinfo=None, creationflags=0, restore_signals=True, \ @@ -356,17 +356,20 @@ untrusted input. See the warning under :ref:`frequently-used-arguments` for details. - *bufsize*, if given, has the same meaning as the corresponding argument to the - built-in open() function: :const:`0` means unbuffered, :const:`1` means line - buffered, any other positive value means use a buffer of (approximately) that - size. A negative *bufsize* means to use the system default, which usually means - fully buffered. The default value for *bufsize* is :const:`0` (unbuffered). + *bufsize* will be supplied as the corresponding argument to the :meth:`io.open` + function when creating the stdin/stdout/stderr pipe file objects: + :const:`0` means unbuffered (read and write are one system call and can return short), + :const:`1` means line buffered, any other positive value means use a buffer of + approximately that size. A negative bufsize (the default) means + the system default of io.DEFAULT_BUFFER_SIZE will be used. - .. note:: + .. versionchanged:: 3.2.4 - If you experience performance issues, it is recommended that you try to - enable buffering by setting *bufsize* to either -1 or a large enough - positive value (such as 4096). + *bufsize* now defaults to -1 to enable buffering by default to match the + behavior that most code expects. In 3.2.0 through 3.2.3 it incorrectly + defaulted to :const:`0` which was unbuffered and allowed short reads. + This was unintentional and did not match the behavior of Python 2 as + most code expected. The *executable* argument specifies a replacement program to execute. It is very seldom needed. When ``shell=False``, *executable* replaces the diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -25,7 +25,7 @@ =========================== This module defines one class called Popen: -class Popen(args, bufsize=0, executable=None, +class Popen(args, bufsize=-1, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=True, shell=False, cwd=None, env=None, universal_newlines=False, @@ -56,12 +56,12 @@ way: The list2cmdline is designed for applications using the same rules as the MS C runtime. -bufsize, if given, has the same meaning as the corresponding argument -to the built-in open() function: 0 means unbuffered, 1 means line -buffered, any other positive value means use a buffer of -(approximately) that size. A negative bufsize means to use the system -default, which usually means fully buffered. The default value for -bufsize is 0 (unbuffered). +bufsize will be supplied as the corresponding argument to the io.open() +function when creating the stdin/stdout/stderr pipe file objects: +0 means unbuffered (read & write are one system call and can return short), +1 means line buffered, any other positive value means use a buffer of +approximately that size. A negative bufsize, the default, means the system +default of io.DEFAULT_BUFFER_SIZE will be used. stdin, stdout and stderr specify the executed programs' standard input, standard output and standard error file handles, respectively. @@ -638,7 +638,7 @@ class Popen(object): - def __init__(self, args, bufsize=0, executable=None, + def __init__(self, args, bufsize=-1, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=_PLATFORM_DEFAULT_CLOSE_FDS, shell=False, cwd=None, env=None, universal_newlines=False, @@ -650,7 +650,7 @@ self._child_created = False if bufsize is None: - bufsize = 0 # Restore default + bufsize = -1 # Restore default if not isinstance(bufsize, int): raise TypeError("bufsize must be an integer") diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -79,6 +79,28 @@ class ProcessTestCase(BaseTestCase): + def test_io_buffered_by_default(self): + p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + try: + self.assertIsInstance(p.stdin, io.BufferedIOBase) + self.assertIsInstance(p.stdout, io.BufferedIOBase) + self.assertIsInstance(p.stderr, io.BufferedIOBase) + finally: + p.wait() + + def test_io_unbuffered_works(self): + p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, bufsize=0) + try: + self.assertIsInstance(p.stdin, io.RawIOBase) + self.assertIsInstance(p.stdout, io.RawIOBase) + self.assertIsInstance(p.stderr, io.RawIOBase) + finally: + p.wait() + def test_call_seq(self): # call() function with sequence argument rc = subprocess.call([sys.executable, "-c", diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -233,6 +233,11 @@ Library ------- +- Issue #17488: Change the subprocess.Popen bufsize parameter default value + from unbuffered (0) to buffering (-1) to match the behavior existing code + expects and match the behavior of the subprocess module in Python 2 to avoid + introducing hard to track down bugs. + - Issue #17521: Corrected non-enabling of logger following two calls to fileConfig(). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 20:00:47 2013 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 23 Mar 2013 20:00:47 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Fixes_issue_=2317488=3A_Change_the_subprocess=2EPopen_bufsize_?= =?utf-8?q?parameter_default_value?= Message-ID: <3ZY9zz6skBz7Lmn@mail.python.org> http://hg.python.org/cpython/rev/4c2fc172afcc changeset: 82917:4c2fc172afcc branch: 3.3 parent: 82914:52f59c3390a5 parent: 82916:3ecf709dfe69 user: Gregory P. Smith date: Sat Mar 23 11:54:22 2013 -0700 summary: Fixes issue #17488: Change the subprocess.Popen bufsize parameter default value from unbuffered (0) to buffering (-1) to match the behavior existing code expects and match the behavior of the subprocess module in Python 2 to avoid introducing hard to track down bugs. files: Doc/library/subprocess.rst | 23 +++++++++++-------- Lib/subprocess.py | 18 ++++++++-------- Lib/test/test_subprocess.py | 28 +++++++++++++++++++++++++ Misc/NEWS | 5 ++++ 4 files changed, 55 insertions(+), 19 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -356,7 +356,7 @@ functions. -.. class:: Popen(args, bufsize=0, executable=None, stdin=None, stdout=None, \ +.. class:: Popen(args, bufsize=-1, executable=None, stdin=None, stdout=None, \ stderr=None, preexec_fn=None, close_fds=True, shell=False, \ cwd=None, env=None, universal_newlines=False, \ startupinfo=None, creationflags=0, restore_signals=True, \ @@ -428,17 +428,20 @@ untrusted input. See the warning under :ref:`frequently-used-arguments` for details. - *bufsize*, if given, has the same meaning as the corresponding argument to the - built-in open() function: :const:`0` means unbuffered, :const:`1` means line - buffered, any other positive value means use a buffer of (approximately) that - size. A negative *bufsize* means to use the system default, which usually means - fully buffered. The default value for *bufsize* is :const:`0` (unbuffered). + *bufsize* will be supplied as the corresponding argument to the :meth:`io.open` + function when creating the stdin/stdout/stderr pipe file objects: + :const:`0` means unbuffered (read and write are one system call and can return short), + :const:`1` means line buffered, any other positive value means use a buffer of + approximately that size. A negative bufsize (the default) means + the system default of io.DEFAULT_BUFFER_SIZE will be used. - .. note:: + .. versionchanged:: 3.2.4, 3.3.1 - If you experience performance issues, it is recommended that you try to - enable buffering by setting *bufsize* to either -1 or a large enough - positive value (such as 4096). + *bufsize* now defaults to -1 to enable buffering by default to match the + behavior that most code expects. In 3.2.0 through 3.2.3 and 3.3.0 it + incorrectly defaulted to :const:`0` which was unbuffered and allowed + short reads. This was unintentional and did not match the behavior of + Python 2 as most code expected. The *executable* argument specifies a replacement program to execute. It is very seldom needed. When ``shell=False``, *executable* replaces the diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -25,7 +25,7 @@ =========================== This module defines one class called Popen: -class Popen(args, bufsize=0, executable=None, +class Popen(args, bufsize=-1, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=True, shell=False, cwd=None, env=None, universal_newlines=False, @@ -56,12 +56,12 @@ way: The list2cmdline is designed for applications using the same rules as the MS C runtime. -bufsize, if given, has the same meaning as the corresponding argument -to the built-in open() function: 0 means unbuffered, 1 means line -buffered, any other positive value means use a buffer of -(approximately) that size. A negative bufsize means to use the system -default, which usually means fully buffered. The default value for -bufsize is 0 (unbuffered). +bufsize will be supplied as the corresponding argument to the io.open() +function when creating the stdin/stdout/stderr pipe file objects: +0 means unbuffered (read & write are one system call and can return short), +1 means line buffered, any other positive value means use a buffer of +approximately that size. A negative bufsize, the default, means the system +default of io.DEFAULT_BUFFER_SIZE will be used. stdin, stdout and stderr specify the executed programs' standard input, standard output and standard error file handles, respectively. @@ -711,7 +711,7 @@ class Popen(object): - def __init__(self, args, bufsize=0, executable=None, + def __init__(self, args, bufsize=-1, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=_PLATFORM_DEFAULT_CLOSE_FDS, shell=False, cwd=None, env=None, universal_newlines=False, @@ -725,7 +725,7 @@ self._input = None self._communication_started = False if bufsize is None: - bufsize = 0 # Restore default + bufsize = -1 # Restore default if not isinstance(bufsize, int): raise TypeError("bufsize must be an integer") diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -82,6 +82,34 @@ class ProcessTestCase(BaseTestCase): + def test_io_buffered_by_default(self): + p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + try: + self.assertIsInstance(p.stdin, io.BufferedIOBase) + self.assertIsInstance(p.stdout, io.BufferedIOBase) + self.assertIsInstance(p.stderr, io.BufferedIOBase) + finally: + p.stdin.close() + p.stdout.close() + p.stderr.close() + p.wait() + + def test_io_unbuffered_works(self): + p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, bufsize=0) + try: + self.assertIsInstance(p.stdin, io.RawIOBase) + self.assertIsInstance(p.stdout, io.RawIOBase) + self.assertIsInstance(p.stderr, io.RawIOBase) + finally: + p.stdin.close() + p.stdout.close() + p.stderr.close() + p.wait() + def test_call_seq(self): # call() function with sequence argument rc = subprocess.call([sys.executable, "-c", diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -196,6 +196,11 @@ Library ------- +- Issue #17488: Change the subprocess.Popen bufsize parameter default value + from unbuffered (0) to buffering (-1) to match the behavior existing code + expects and match the behavior of the subprocess module in Python 2 to avoid + introducing hard to track down bugs. + - Issue #17521: Corrected non-enabling of logger following two calls to fileConfig(). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 20:00:49 2013 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 23 Mar 2013 20:00:49 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Fixes_issue_=2317488=3A_Change_the_subprocess=2EPopen_bu?= =?utf-8?q?fsize_parameter_default_value?= Message-ID: <3ZYB013vNHz7Lmc@mail.python.org> http://hg.python.org/cpython/rev/3031d69f94ef changeset: 82918:3031d69f94ef parent: 82915:60ec59b5d717 parent: 82917:4c2fc172afcc user: Gregory P. Smith date: Sat Mar 23 12:00:00 2013 -0700 summary: Fixes issue #17488: Change the subprocess.Popen bufsize parameter default value from unbuffered (0) to buffering (-1) to match the behavior existing code expects and match the behavior of the subprocess module in Python 2 to avoid introducing hard to track down bugs. files: Doc/library/subprocess.rst | 23 +++++++++++-------- Lib/subprocess.py | 18 ++++++++-------- Lib/test/test_subprocess.py | 28 +++++++++++++++++++++++++ Misc/NEWS | 5 ++++ 4 files changed, 55 insertions(+), 19 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -356,7 +356,7 @@ functions. -.. class:: Popen(args, bufsize=0, executable=None, stdin=None, stdout=None, \ +.. class:: Popen(args, bufsize=-1, executable=None, stdin=None, stdout=None, \ stderr=None, preexec_fn=None, close_fds=True, shell=False, \ cwd=None, env=None, universal_newlines=False, \ startupinfo=None, creationflags=0, restore_signals=True, \ @@ -428,17 +428,20 @@ untrusted input. See the warning under :ref:`frequently-used-arguments` for details. - *bufsize*, if given, has the same meaning as the corresponding argument to the - built-in open() function: :const:`0` means unbuffered, :const:`1` means line - buffered, any other positive value means use a buffer of (approximately) that - size. A negative *bufsize* means to use the system default, which usually means - fully buffered. The default value for *bufsize* is :const:`0` (unbuffered). + *bufsize* will be supplied as the corresponding argument to the :meth:`io.open` + function when creating the stdin/stdout/stderr pipe file objects: + :const:`0` means unbuffered (read and write are one system call and can return short), + :const:`1` means line buffered, any other positive value means use a buffer of + approximately that size. A negative bufsize (the default) means + the system default of io.DEFAULT_BUFFER_SIZE will be used. - .. note:: + .. versionchanged:: 3.2.4, 3.3.1 - If you experience performance issues, it is recommended that you try to - enable buffering by setting *bufsize* to either -1 or a large enough - positive value (such as 4096). + *bufsize* now defaults to -1 to enable buffering by default to match the + behavior that most code expects. In 3.2.0 through 3.2.3 and 3.3.0 it + incorrectly defaulted to :const:`0` which was unbuffered and allowed + short reads. This was unintentional and did not match the behavior of + Python 2 as most code expected. The *executable* argument specifies a replacement program to execute. It is very seldom needed. When ``shell=False``, *executable* replaces the diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -25,7 +25,7 @@ =========================== This module defines one class called Popen: -class Popen(args, bufsize=0, executable=None, +class Popen(args, bufsize=-1, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=True, shell=False, cwd=None, env=None, universal_newlines=False, @@ -56,12 +56,12 @@ way: The list2cmdline is designed for applications using the same rules as the MS C runtime. -bufsize, if given, has the same meaning as the corresponding argument -to the built-in open() function: 0 means unbuffered, 1 means line -buffered, any other positive value means use a buffer of -(approximately) that size. A negative bufsize means to use the system -default, which usually means fully buffered. The default value for -bufsize is 0 (unbuffered). +bufsize will be supplied as the corresponding argument to the io.open() +function when creating the stdin/stdout/stderr pipe file objects: +0 means unbuffered (read & write are one system call and can return short), +1 means line buffered, any other positive value means use a buffer of +approximately that size. A negative bufsize, the default, means the system +default of io.DEFAULT_BUFFER_SIZE will be used. stdin, stdout and stderr specify the executed programs' standard input, standard output and standard error file handles, respectively. @@ -709,7 +709,7 @@ class Popen(object): - def __init__(self, args, bufsize=0, executable=None, + def __init__(self, args, bufsize=-1, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=_PLATFORM_DEFAULT_CLOSE_FDS, shell=False, cwd=None, env=None, universal_newlines=False, @@ -723,7 +723,7 @@ self._input = None self._communication_started = False if bufsize is None: - bufsize = 0 # Restore default + bufsize = -1 # Restore default if not isinstance(bufsize, int): raise TypeError("bufsize must be an integer") diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -82,6 +82,34 @@ class ProcessTestCase(BaseTestCase): + def test_io_buffered_by_default(self): + p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + try: + self.assertIsInstance(p.stdin, io.BufferedIOBase) + self.assertIsInstance(p.stdout, io.BufferedIOBase) + self.assertIsInstance(p.stderr, io.BufferedIOBase) + finally: + p.stdin.close() + p.stdout.close() + p.stderr.close() + p.wait() + + def test_io_unbuffered_works(self): + p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, bufsize=0) + try: + self.assertIsInstance(p.stdin, io.RawIOBase) + self.assertIsInstance(p.stdout, io.RawIOBase) + self.assertIsInstance(p.stderr, io.RawIOBase) + finally: + p.stdin.close() + p.stdout.close() + p.stderr.close() + p.wait() + def test_call_seq(self): # call() function with sequence argument rc = subprocess.call([sys.executable, "-c", diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -294,6 +294,11 @@ Library ------- +- Issue #17488: Change the subprocess.Popen bufsize parameter default value + from unbuffered (0) to buffering (-1) to match the behavior existing code + expects and match the behavior of the subprocess module in Python 2 to avoid + introducing hard to track down bugs. + - Issue #17521: Corrected non-enabling of logger following two calls to fileConfig(). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 20:35:02 2013 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 23 Mar 2013 20:35:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317150=3A_pprint_n?= =?utf-8?q?ow_uses_line_continuations_to_wrap_long_string_literals=2E?= Message-ID: <3ZYBlV1QlNz7LmD@mail.python.org> http://hg.python.org/cpython/rev/5a2296093645 changeset: 82919:5a2296093645 user: Antoine Pitrou date: Sat Mar 23 20:30:39 2013 +0100 summary: Issue #17150: pprint now uses line continuations to wrap long string literals. files: Doc/library/pprint.rst | 210 ++++++++++++++++----------- Lib/pprint.py | 39 ++++- Lib/test/test_pprint.py | 38 +++++ Misc/NEWS | 3 + 4 files changed, 200 insertions(+), 90 deletions(-) diff --git a/Doc/library/pprint.rst b/Doc/library/pprint.rst --- a/Doc/library/pprint.rst +++ b/Doc/library/pprint.rst @@ -14,8 +14,8 @@ Python data structures in a form which can be used as input to the interpreter. If the formatted structures include objects which are not fundamental Python types, the representation may not be loadable. This may be the case if objects -such as files, sockets, classes, or instances are included, as well as many -other built-in objects which are not representable as Python constants. +such as files, sockets or classes are included, as well as many other +objects which are not representable as Python literals. The formatted representation keeps objects on a single line if it can, and breaks them onto multiple lines if they don't fit within the allowed width. @@ -65,7 +65,7 @@ ('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead', (...))))))) -The :class:`PrettyPrinter` class supports several derivative functions: +The :mod:`pprint` module also provides several shortcut functions: .. function:: pformat(object, indent=1, width=80, depth=None) @@ -193,101 +193,141 @@ ------- To demonstrate several uses of the :func:`pprint` function and its parameters, -let's fetch information about a project from PyPI:: +let's fetch information about a project from `PyPI `_:: >>> import json >>> import pprint >>> from urllib.request import urlopen - >>> with urlopen('http://pypi.python.org/pypi/configparser/json') as url: + >>> with urlopen('http://pypi.python.org/pypi/Twisted/json') as url: ... http_info = url.info() ... raw_data = url.read().decode(http_info.get_content_charset()) >>> project_info = json.loads(raw_data) - >>> result = {'headers': http_info.items(), 'body': project_info} In its basic form, :func:`pprint` shows the whole object:: - >>> pprint.pprint(result) - {'body': {'info': {'_pypi_hidden': False, - '_pypi_ordering': 12, - 'classifiers': ['Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Natural Language :: English', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Topic :: Software Development :: Libraries', - 'Topic :: Software Development :: Libraries :: Python Modules'], - 'download_url': 'UNKNOWN', - 'home_page': 'http://docs.python.org/py3k/library/configparser.html', - 'keywords': 'configparser ini parsing conf cfg configuration file', - 'license': 'MIT', - 'name': 'configparser', - 'package_url': 'http://pypi.python.org/pypi/configparser', - 'platform': 'any', - 'release_url': 'http://pypi.python.org/pypi/configparser/3.2.0r3', - 'requires_python': None, - 'stable_version': None, - 'summary': 'This library brings the updated configparser from Python 3.2+ to Python 2.6-2.7.', - 'version': '3.2.0r3'}, - 'urls': [{'comment_text': '', - 'downloads': 47, - 'filename': 'configparser-3.2.0r3.tar.gz', - 'has_sig': False, - 'md5_digest': '8500fd87c61ac0de328fc996fce69b96', - 'packagetype': 'sdist', - 'python_version': 'source', - 'size': 32281, - 'upload_time': '2011-05-10T16:28:50', - 'url': 'http://pypi.python.org/packages/source/c/configparser/configparser-3.2.0r3.tar.gz'}]}, - 'headers': [('Date', 'Sat, 14 May 2011 12:48:52 GMT'), - ('Server', 'Apache/2.2.16 (Debian)'), - ('Content-Disposition', 'inline'), - ('Connection', 'close'), - ('Transfer-Encoding', 'chunked'), - ('Content-Type', 'application/json; charset="UTF-8"')]} + >>> pprint.pprint(project_info) + {'info': {'_pypi_hidden': False, + '_pypi_ordering': 125, + 'author': 'Glyph Lefkowitz', + 'author_email': 'glyph at twistedmatrix.com', + 'bugtrack_url': '', + 'cheesecake_code_kwalitee_id': None, + 'cheesecake_documentation_id': None, + 'cheesecake_installability_id': None, + 'classifiers': ['Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 2 :: Only'], + 'description': 'An extensible framework for Python programming, ' + 'with special focus\r\n' + 'on event-based network programming and ' + 'multiprotocol integration.', + 'docs_url': '', + 'download_url': 'UNKNOWN', + 'home_page': 'http://twistedmatrix.com/', + 'keywords': '', + 'license': 'MIT', + 'maintainer': '', + 'maintainer_email': '', + 'name': 'Twisted', + 'package_url': 'http://pypi.python.org/pypi/Twisted', + 'platform': 'UNKNOWN', + 'release_url': 'http://pypi.python.org/pypi/Twisted/12.3.0', + 'requires_python': None, + 'stable_version': None, + 'summary': 'An asynchronous networking framework written in Python', + 'version': '12.3.0'}, + 'urls': [{'comment_text': '', + 'downloads': 71844, + 'filename': 'Twisted-12.3.0.tar.bz2', + 'has_sig': False, + 'md5_digest': '6e289825f3bf5591cfd670874cc0862d', + 'packagetype': 'sdist', + 'python_version': 'source', + 'size': 2615733, + 'upload_time': '2012-12-26T12:47:03', + 'url': 'https://pypi.python.org/packages/source/T/Twisted/Twisted-12.3.0.tar.bz2'}, + {'comment_text': '', + 'downloads': 5224, + 'filename': 'Twisted-12.3.0.win32-py2.7.msi', + 'has_sig': False, + 'md5_digest': '6b778f5201b622a5519a2aca1a2fe512', + 'packagetype': 'bdist_msi', + 'python_version': '2.7', + 'size': 2916352, + 'upload_time': '2012-12-26T12:48:15', + 'url': 'https://pypi.python.org/packages/2.7/T/Twisted/Twisted-12.3.0.win32-py2.7.msi'}]} The result can be limited to a certain *depth* (ellipsis is used for deeper contents):: - >>> pprint.pprint(result, depth=3) - {'body': {'info': {'_pypi_hidden': False, - '_pypi_ordering': 12, - 'classifiers': [...], - 'download_url': 'UNKNOWN', - 'home_page': 'http://docs.python.org/py3k/library/configparser.html', - 'keywords': 'configparser ini parsing conf cfg configuration file', - 'license': 'MIT', - 'name': 'configparser', - 'package_url': 'http://pypi.python.org/pypi/configparser', - 'platform': 'any', - 'release_url': 'http://pypi.python.org/pypi/configparser/3.2.0r3', - 'requires_python': None, - 'stable_version': None, - 'summary': 'This library brings the updated configparser from Python 3.2+ to Python 2.6-2.7.', - 'version': '3.2.0r3'}, - 'urls': [{...}]}, - 'headers': [('Date', 'Sat, 14 May 2011 12:48:52 GMT'), - ('Server', 'Apache/2.2.16 (Debian)'), - ('Content-Disposition', 'inline'), - ('Connection', 'close'), - ('Transfer-Encoding', 'chunked'), - ('Content-Type', 'application/json; charset="UTF-8"')]} + >>> pprint.pprint(project_info, depth=2) + {'info': {'_pypi_hidden': False, + '_pypi_ordering': 125, + 'author': 'Glyph Lefkowitz', + 'author_email': 'glyph at twistedmatrix.com', + 'bugtrack_url': '', + 'cheesecake_code_kwalitee_id': None, + 'cheesecake_documentation_id': None, + 'cheesecake_installability_id': None, + 'classifiers': [...], + 'description': 'An extensible framework for Python programming, ' + 'with special focus\r\n' + 'on event-based network programming and ' + 'multiprotocol integration.', + 'docs_url': '', + 'download_url': 'UNKNOWN', + 'home_page': 'http://twistedmatrix.com/', + 'keywords': '', + 'license': 'MIT', + 'maintainer': '', + 'maintainer_email': '', + 'name': 'Twisted', + 'package_url': 'http://pypi.python.org/pypi/Twisted', + 'platform': 'UNKNOWN', + 'release_url': 'http://pypi.python.org/pypi/Twisted/12.3.0', + 'requires_python': None, + 'stable_version': None, + 'summary': 'An asynchronous networking framework written in Python', + 'version': '12.3.0'}, + 'urls': [{...}, {...}]} -Additionally, maximum *width* can be suggested. If a long object cannot be -split, the specified width will be exceeded:: +Additionally, maximum character *width* can be suggested. If a long object +cannot be split, the specified width will be exceeded:: - >>> pprint.pprint(result['headers'], width=30) - [('Date', - 'Sat, 14 May 2011 12:48:52 GMT'), - ('Server', - 'Apache/2.2.16 (Debian)'), - ('Content-Disposition', - 'inline'), - ('Connection', 'close'), - ('Transfer-Encoding', - 'chunked'), - ('Content-Type', - 'application/json; charset="UTF-8"')] + >>> pprint.pprint(project_info, depth=2, width=50) + {'info': {'_pypi_hidden': False, + '_pypi_ordering': 125, + 'author': 'Glyph Lefkowitz', + 'author_email': 'glyph at twistedmatrix.com', + 'bugtrack_url': '', + 'cheesecake_code_kwalitee_id': None, + 'cheesecake_documentation_id': None, + 'cheesecake_installability_id': None, + 'classifiers': [...], + 'description': 'An extensible ' + 'framework for ' + 'Python programming, ' + 'with special ' + 'focus\r\n' + 'on event-based ' + 'network programming ' + 'and multiprotocol ' + 'integration.', + 'docs_url': '', + 'download_url': 'UNKNOWN', + 'home_page': 'http://twistedmatrix.com/', + 'keywords': '', + 'license': 'MIT', + 'maintainer': '', + 'maintainer_email': '', + 'name': 'Twisted', + 'package_url': 'http://pypi.python.org/pypi/Twisted', + 'platform': 'UNKNOWN', + 'release_url': 'http://pypi.python.org/pypi/Twisted/12.3.0', + 'requires_python': None, + 'stable_version': None, + 'summary': 'An asynchronous ' + 'networking framework ' + 'written in Python', + 'version': '12.3.0'}, + 'urls': [{...}, {...}]} diff --git a/Lib/pprint.py b/Lib/pprint.py --- a/Lib/pprint.py +++ b/Lib/pprint.py @@ -34,6 +34,7 @@ """ +import re import sys as _sys from collections import OrderedDict as _OrderedDict from io import StringIO as _StringIO @@ -158,13 +159,10 @@ return rep = self._repr(object, context, level - 1) typ = _type(object) - sepLines = _len(rep) > (self._width - 1 - indent - allowance) + max_width = self._width - 1 - indent - allowance + sepLines = _len(rep) > max_width write = stream.write - if self._depth and level > self._depth: - write(rep) - return - if sepLines: r = getattr(typ, "__repr__", None) if issubclass(typ, dict): @@ -242,6 +240,37 @@ write(endchar) return + if issubclass(typ, str) and len(object) > 0 and r is str.__repr__: + def _str_parts(s): + """ + Return a list of string literals comprising the repr() + of the given string using literal concatenation. + """ + lines = s.splitlines(True) + for i, line in enumerate(lines): + rep = repr(line) + if _len(rep) <= max_width: + yield rep + else: + # A list of alternating (non-space, space) strings + parts = re.split(r'(\s+)', line) + [''] + current = '' + for i in range(0, len(parts), 2): + part = parts[i] + parts[i+1] + candidate = current + part + if len(repr(candidate)) > max_width: + if current: + yield repr(current) + current = part + else: + current = candidate + if current: + yield repr(current) + for i, rep in enumerate(_str_parts(object)): + if i > 0: + write('\n' + ' '*indent) + write(rep) + return write(rep) def _repr(self, object, context, level): diff --git a/Lib/test/test_pprint.py b/Lib/test/test_pprint.py --- a/Lib/test/test_pprint.py +++ b/Lib/test/test_pprint.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + import pprint import test.support import unittest @@ -475,6 +477,42 @@ self.assertEqual(pprint.pformat(dict.fromkeys(keys, 0)), '{%r: 0, %r: 0}' % tuple(sorted(keys, key=id))) + def test_str_wrap(self): + # pprint tries to wrap strings intelligently + fox = 'the quick brown fox jumped over a lazy dog' + self.assertEqual(pprint.pformat(fox, width=20), """\ +'the quick brown ' +'fox jumped over ' +'a lazy dog'""") + self.assertEqual(pprint.pformat({'a': 1, 'b': fox, 'c': 2}, + width=26), """\ +{'a': 1, + 'b': 'the quick brown ' + 'fox jumped over ' + 'a lazy dog', + 'c': 2}""") + # With some special characters + # - \n always triggers a new line in the pprint + # - \t and \n are escaped + # - non-ASCII is allowed + # - an apostrophe doesn't disrupt the pprint + special = "Portons dix bons \"whiskys\"\n? l'avocat goujat\t qui fumait au zoo" + self.assertEqual(pprint.pformat(special, width=20), """\ +'Portons dix bons ' +'"whiskys"\\n' +"? l'avocat " +'goujat\\t qui ' +'fumait au zoo'""") + # An unwrappable string is formatted as its repr + unwrappable = "x" * 100 + self.assertEqual(pprint.pformat(unwrappable, width=80), repr(unwrappable)) + self.assertEqual(pprint.pformat(''), "''") + # Check that the pprint is a usable repr + special *= 10 + for width in range(3, 40): + formatted = pprint.pformat(special, width=width) + self.assertEqual(eval("(" + formatted + ")"), special) + class DottedPrettyPrinter(pprint.PrettyPrinter): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -294,6 +294,9 @@ Library ------- +- Issue #17150: pprint now uses line continuations to wrap long string + literals. + - Issue #17488: Change the subprocess.Popen bufsize parameter default value from unbuffered (0) to buffering (-1) to match the behavior existing code expects and match the behavior of the subprocess module in Python 2 to avoid -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 21:24:43 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 21:24:43 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_return_int_ins?= =?utf-8?q?tead_long_when_possible_=28=2317531=29?= Message-ID: <3ZYCrq6BNlz7Ll1@mail.python.org> http://hg.python.org/cpython/rev/2aa817e0a645 changeset: 82920:2aa817e0a645 branch: 2.7 parent: 82910:9f714c8ce025 user: Benjamin Peterson date: Sat Mar 23 15:22:20 2013 -0500 summary: return int instead long when possible (#17531) files: Misc/NEWS | 11 +++++++++++ Modules/posixmodule.c | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1,6 +1,17 @@ Python News +++++++++++ +What's New in Python 2.7.4? +=========================== + +*Release date: XXXX-XX-XX* + +Library +------- + +- Issue #17531: Return group and user ids as int instead long when possible. + + What's New in Python 2.7.4 release candidate 1 ============================================== diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -357,7 +357,7 @@ { if (uid <= LONG_MAX) return PyInt_FromLong(uid); - return PyLong_FromUnsignedLong(uid); + return PyInt_FromUnsignedLong(uid); } PyObject * @@ -365,7 +365,7 @@ { if (gid <= LONG_MAX) return PyInt_FromLong(gid); - return PyLong_FromUnsignedLong(gid); + return PyInt_FromUnsignedLong(gid); } int -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 21:24:45 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 21:24:45 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_merge_2=2E7=2E4_release_branch?= Message-ID: <3ZYCrs26hwz7Lmp@mail.python.org> http://hg.python.org/cpython/rev/c43cdbae8864 changeset: 82921:c43cdbae8864 branch: 2.7 parent: 82913:6668a2302107 parent: 82920:2aa817e0a645 user: Benjamin Peterson date: Sat Mar 23 15:23:19 2013 -0500 summary: merge 2.7.4 release branch files: Misc/NEWS | 11 +++++++++++ Modules/posixmodule.c | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1,6 +1,17 @@ Python News +++++++++++ +What's New in Python 2.7.4? +=========================== + +*Release date: XXXX-XX-XX* + +Library +------- + +- Issue #17531: Return group and user ids as int instead long when possible. + + What's New in Python 2.7.4 release candidate 1 ============================================== diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -357,7 +357,7 @@ { if (uid <= LONG_MAX) return PyInt_FromLong(uid); - return PyLong_FromUnsignedLong(uid); + return PyInt_FromUnsignedLong(uid); } PyObject * @@ -365,7 +365,7 @@ { if (gid <= LONG_MAX) return PyInt_FromLong(gid); - return PyLong_FromUnsignedLong(gid); + return PyInt_FromUnsignedLong(gid); } int -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 21:24:46 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 21:24:46 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogYWRkIDIuNy41IGhl?= =?utf-8?q?ader?= Message-ID: <3ZYCrt4gn6z7LnD@mail.python.org> http://hg.python.org/cpython/rev/ce71ae8145aa changeset: 82922:ce71ae8145aa branch: 2.7 user: Benjamin Peterson date: Sat Mar 23 15:24:13 2013 -0500 summary: add 2.7.5 header files: Misc/NEWS | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1,6 +1,18 @@ Python News +++++++++++ +What's New in Python 2.7.5? +=========================== + +*Release date: XXXX-XX-XX* + +Core and Builtins +----------------- + +Library +------- + + What's New in Python 2.7.4? =========================== -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 21:36:07 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 21:36:07 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_undo_PyInt_-?= =?utf-8?q?=3E_PyLong_change=3B_that_was_wrong?= Message-ID: <3ZYD5z3W5vz7Ll1@mail.python.org> http://hg.python.org/cpython/rev/cdf560632bea changeset: 82923:cdf560632bea branch: 2.7 parent: 82920:2aa817e0a645 user: Benjamin Peterson date: Sat Mar 23 15:35:24 2013 -0500 summary: undo PyInt -> PyLong change; that was wrong files: Modules/posixmodule.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -357,7 +357,7 @@ { if (uid <= LONG_MAX) return PyInt_FromLong(uid); - return PyInt_FromUnsignedLong(uid); + return PyLong_FromUnsignedLong(uid); } PyObject * @@ -365,7 +365,7 @@ { if (gid <= LONG_MAX) return PyInt_FromLong(gid); - return PyInt_FromUnsignedLong(gid); + return PyLong_FromUnsignedLong(gid); } int -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 21:36:08 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 21:36:08 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_merge_2=2E7=2E4_branch?= Message-ID: <3ZYD606fgHz7Lml@mail.python.org> http://hg.python.org/cpython/rev/f99c8187f08d changeset: 82924:f99c8187f08d branch: 2.7 parent: 82922:ce71ae8145aa parent: 82923:cdf560632bea user: Benjamin Peterson date: Sat Mar 23 15:35:38 2013 -0500 summary: merge 2.7.4 branch files: Modules/posixmodule.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -357,7 +357,7 @@ { if (uid <= LONG_MAX) return PyInt_FromLong(uid); - return PyInt_FromUnsignedLong(uid); + return PyLong_FromUnsignedLong(uid); } PyObject * @@ -365,7 +365,7 @@ { if (gid <= LONG_MAX) return PyInt_FromLong(gid); - return PyInt_FromUnsignedLong(gid); + return PyLong_FromUnsignedLong(gid); } int -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 21:41:24 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 21:41:24 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_group_ids_and_?= =?utf-8?q?user_ids_can_be_longs_now_=28=2317531=29?= Message-ID: <3ZYDD414wnz7Lmp@mail.python.org> http://hg.python.org/cpython/rev/c982393bea4e changeset: 82925:c982393bea4e branch: 2.7 parent: 82923:cdf560632bea user: Benjamin Peterson date: Sat Mar 23 15:40:36 2013 -0500 summary: group ids and user ids can be longs now (#17531) files: Lib/test/test_grp.py | 2 +- Lib/test/test_pwd.py | 4 ++-- Misc/NEWS | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_grp.py b/Lib/test/test_grp.py --- a/Lib/test/test_grp.py +++ b/Lib/test/test_grp.py @@ -16,7 +16,7 @@ self.assertEqual(value[1], value.gr_passwd) self.assertIsInstance(value.gr_passwd, basestring) self.assertEqual(value[2], value.gr_gid) - self.assertIsInstance(value.gr_gid, int) + self.assertIsInstance(value.gr_gid, (long, int)) self.assertEqual(value[3], value.gr_mem) self.assertIsInstance(value.gr_mem, list) diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py --- a/Lib/test/test_pwd.py +++ b/Lib/test/test_pwd.py @@ -18,9 +18,9 @@ self.assertEqual(e[1], e.pw_passwd) self.assertIsInstance(e.pw_passwd, basestring) self.assertEqual(e[2], e.pw_uid) - self.assertIsInstance(e.pw_uid, int) + self.assertIsInstance(e.pw_uid, (int, long)) self.assertEqual(e[3], e.pw_gid) - self.assertIsInstance(e.pw_gid, int) + self.assertIsInstance(e.pw_gid, (int, long)) self.assertEqual(e[4], e.pw_gecos) self.assertIsInstance(e.pw_gecos, basestring) self.assertEqual(e[5], e.pw_dir) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,7 +9,8 @@ Library ------- -- Issue #17531: Return group and user ids as int instead long when possible. +- Issue #17531: Fix tests that thought group and user ids were always the int + type. What's New in Python 2.7.4 release candidate 1 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 21:41:25 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 21:41:25 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_merge_2=2E7=2E4_release_branch?= Message-ID: <3ZYDD53q96z7Lmp@mail.python.org> http://hg.python.org/cpython/rev/9a798f2ee1c5 changeset: 82926:9a798f2ee1c5 branch: 2.7 parent: 82924:f99c8187f08d parent: 82925:c982393bea4e user: Benjamin Peterson date: Sat Mar 23 15:40:48 2013 -0500 summary: merge 2.7.4 release branch files: Lib/test/test_grp.py | 2 +- Lib/test/test_pwd.py | 4 ++-- Misc/NEWS | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_grp.py b/Lib/test/test_grp.py --- a/Lib/test/test_grp.py +++ b/Lib/test/test_grp.py @@ -16,7 +16,7 @@ self.assertEqual(value[1], value.gr_passwd) self.assertIsInstance(value.gr_passwd, basestring) self.assertEqual(value[2], value.gr_gid) - self.assertIsInstance(value.gr_gid, int) + self.assertIsInstance(value.gr_gid, (long, int)) self.assertEqual(value[3], value.gr_mem) self.assertIsInstance(value.gr_mem, list) diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py --- a/Lib/test/test_pwd.py +++ b/Lib/test/test_pwd.py @@ -18,9 +18,9 @@ self.assertEqual(e[1], e.pw_passwd) self.assertIsInstance(e.pw_passwd, basestring) self.assertEqual(e[2], e.pw_uid) - self.assertIsInstance(e.pw_uid, int) + self.assertIsInstance(e.pw_uid, (int, long)) self.assertEqual(e[3], e.pw_gid) - self.assertIsInstance(e.pw_gid, int) + self.assertIsInstance(e.pw_gid, (int, long)) self.assertEqual(e[4], e.pw_gecos) self.assertIsInstance(e.pw_gecos, basestring) self.assertEqual(e[5], e.pw_dir) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -21,7 +21,8 @@ Library ------- -- Issue #17531: Return group and user ids as int instead long when possible. +- Issue #17531: Fix tests that thought group and user ids were always the int + type. What's New in Python 2.7.4 release candidate 1 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 22:19:26 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 22:19:26 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_always_allow_-?= =?utf-8?q?1_as_a_uid?= Message-ID: <3ZYF3y3wmBz7Lkg@mail.python.org> http://hg.python.org/cpython/rev/a4dbe53577cb changeset: 82927:a4dbe53577cb branch: 2.7 parent: 82925:c982393bea4e user: Benjamin Peterson date: Sat Mar 23 16:19:04 2013 -0500 summary: always allow -1 as a uid files: Modules/posixmodule.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -397,8 +397,6 @@ goto OverflowUp; return 0; } - if ((uid_t)uresult == (uid_t)-1) - goto OverflowUp; } else { if (result < 0) goto OverflowDown; @@ -451,8 +449,6 @@ goto OverflowUp; return 0; } - if ((gid_t)uresult == (gid_t)-1) - goto OverflowUp; } else { if (result < 0) goto OverflowDown; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 22:19:27 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 22:19:27 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_merge_2=2E7=2E4_release_branch?= Message-ID: <3ZYF3z75N3z7Ln8@mail.python.org> http://hg.python.org/cpython/rev/febd3218bbc7 changeset: 82928:febd3218bbc7 branch: 2.7 parent: 82926:9a798f2ee1c5 parent: 82927:a4dbe53577cb user: Benjamin Peterson date: Sat Mar 23 16:19:20 2013 -0500 summary: merge 2.7.4 release branch files: Modules/posixmodule.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -397,8 +397,6 @@ goto OverflowUp; return 0; } - if ((uid_t)uresult == (uid_t)-1) - goto OverflowUp; } else { if (result < 0) goto OverflowDown; @@ -451,8 +449,6 @@ goto OverflowUp; return 0; } - if ((gid_t)uresult == (gid_t)-1) - goto OverflowUp; } else { if (result < 0) goto OverflowDown; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 22:36:23 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 22:36:23 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_update_NEWS_fo?= =?utf-8?q?r_=2317531?= Message-ID: <3ZYFRW6yJlz7Lmp@mail.python.org> http://hg.python.org/cpython/rev/87d266988905 changeset: 82929:87d266988905 branch: 2.7 parent: 82927:a4dbe53577cb user: Benjamin Peterson date: Sat Mar 23 16:35:45 2013 -0500 summary: update NEWS for #17531 files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,7 +10,7 @@ ------- - Issue #17531: Fix tests that thought group and user ids were always the int - type. + type. Also, always allow -1 as a valid group and user id. What's New in Python 2.7.4 release candidate 1 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 22:36:25 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Mar 2013 22:36:25 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_merge_2=2E7=2E4_release_branch?= Message-ID: <3ZYFRY3600z7LnH@mail.python.org> http://hg.python.org/cpython/rev/47388fd56b9f changeset: 82930:47388fd56b9f branch: 2.7 parent: 82928:febd3218bbc7 parent: 82929:87d266988905 user: Benjamin Peterson date: Sat Mar 23 16:35:57 2013 -0500 summary: merge 2.7.4 release branch files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -22,7 +22,7 @@ ------- - Issue #17531: Fix tests that thought group and user ids were always the int - type. + type. Also, always allow -1 as a valid group and user id. What's New in Python 2.7.4 release candidate 1 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 22:39:34 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 23 Mar 2013 22:39:34 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_Clean_up_refer?= =?utf-8?q?ences_to_threads_in_test=5Fqueue=2E?= Message-ID: <3ZYFWB6Gmtz7Lmp@mail.python.org> http://hg.python.org/cpython/rev/1c7c692de1ee changeset: 82931:1c7c692de1ee branch: 3.2 parent: 82916:3ecf709dfe69 user: Ezio Melotti date: Sat Mar 23 23:35:06 2013 +0200 summary: Clean up references to threads in test_queue. files: Lib/test/test_queue.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py --- a/Lib/test/test_queue.py +++ b/Lib/test/test_queue.py @@ -46,6 +46,9 @@ class BlockingTestMixin: + def tearDown(self): + self.t = None + def do_blocking_test(self, block_func, block_args, trigger_func, trigger_args): self.t = _TriggerThread(trigger_func, trigger_args) self.t.start() @@ -260,7 +263,7 @@ raise FailingQueueException("You Lose") return queue.Queue._get(self) -class FailingQueueTest(unittest.TestCase, BlockingTestMixin): +class FailingQueueTest(BlockingTestMixin, unittest.TestCase): def failing_queue_test(self, q): if q.qsize(): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 22:39:36 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 23 Mar 2013 22:39:36 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Merge_test=5Fqueue_clean_up_from_3=2E2=2E?= Message-ID: <3ZYFWD21nmz7Ln6@mail.python.org> http://hg.python.org/cpython/rev/263fdce97aa0 changeset: 82932:263fdce97aa0 branch: 3.3 parent: 82917:4c2fc172afcc parent: 82931:1c7c692de1ee user: Ezio Melotti date: Sat Mar 23 23:36:23 2013 +0200 summary: Merge test_queue clean up from 3.2. files: Lib/test/test_queue.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py --- a/Lib/test/test_queue.py +++ b/Lib/test/test_queue.py @@ -46,6 +46,9 @@ class BlockingTestMixin: + def tearDown(self): + self.t = None + def do_blocking_test(self, block_func, block_args, trigger_func, trigger_args): self.t = _TriggerThread(trigger_func, trigger_args) self.t.start() @@ -260,7 +263,7 @@ raise FailingQueueException("You Lose") return queue.Queue._get(self) -class FailingQueueTest(unittest.TestCase, BlockingTestMixin): +class FailingQueueTest(BlockingTestMixin, unittest.TestCase): def failing_queue_test(self, q): if q.qsize(): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 22:39:37 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 23 Mar 2013 22:39:37 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_test=5Fqueue_clean_up_from_3=2E3=2E?= Message-ID: <3ZYFWF4rb3z7LnC@mail.python.org> http://hg.python.org/cpython/rev/1747e50fca55 changeset: 82933:1747e50fca55 parent: 82919:5a2296093645 parent: 82932:263fdce97aa0 user: Ezio Melotti date: Sat Mar 23 23:37:38 2013 +0200 summary: Merge test_queue clean up from 3.3. files: Lib/test/test_queue.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py --- a/Lib/test/test_queue.py +++ b/Lib/test/test_queue.py @@ -46,6 +46,9 @@ class BlockingTestMixin: + def tearDown(self): + self.t = None + def do_blocking_test(self, block_func, block_args, trigger_func, trigger_args): self.t = _TriggerThread(trigger_func, trigger_args) self.t.start() @@ -260,7 +263,7 @@ raise FailingQueueException("You Lose") return queue.Queue._get(self) -class FailingQueueTest(unittest.TestCase, BlockingTestMixin): +class FailingQueueTest(BlockingTestMixin, unittest.TestCase): def failing_queue_test(self, q): if q.qsize(): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 22:39:39 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 23 Mar 2013 22:39:39 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Clean_up_refer?= =?utf-8?q?ences_to_threads_in_test=5Fqueue=2E?= Message-ID: <3ZYFWH0Jdcz7Ln9@mail.python.org> http://hg.python.org/cpython/rev/6e21215acb1e changeset: 82934:6e21215acb1e branch: 2.7 parent: 82928:febd3218bbc7 user: Ezio Melotti date: Sat Mar 23 23:35:06 2013 +0200 summary: Clean up references to threads in test_queue. files: Lib/test/test_queue.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py --- a/Lib/test/test_queue.py +++ b/Lib/test/test_queue.py @@ -43,6 +43,9 @@ class BlockingTestMixin: + def tearDown(self): + self.t = None + def do_blocking_test(self, block_func, block_args, trigger_func, trigger_args): self.t = _TriggerThread(trigger_func, trigger_args) self.t.start() @@ -222,7 +225,7 @@ raise FailingQueueException, "You Lose" return Queue.Queue._get(self) -class FailingQueueTest(unittest.TestCase, BlockingTestMixin): +class FailingQueueTest(BlockingTestMixin, unittest.TestCase): def failing_queue_test(self, q): if not q.empty(): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 23 22:39:40 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 23 Mar 2013 22:39:40 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_Merge_heads=2E?= Message-ID: <3ZYFWJ30m0z7LnB@mail.python.org> http://hg.python.org/cpython/rev/ef762dbe3e42 changeset: 82935:ef762dbe3e42 branch: 2.7 parent: 82930:47388fd56b9f parent: 82934:6e21215acb1e user: Ezio Melotti date: Sat Mar 23 23:39:25 2013 +0200 summary: Merge heads. files: Lib/test/test_queue.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py --- a/Lib/test/test_queue.py +++ b/Lib/test/test_queue.py @@ -43,6 +43,9 @@ class BlockingTestMixin: + def tearDown(self): + self.t = None + def do_blocking_test(self, block_func, block_args, trigger_func, trigger_args): self.t = _TriggerThread(trigger_func, trigger_args) self.t.start() @@ -222,7 +225,7 @@ raise FailingQueueException, "You Lose" return Queue.Queue._get(self) -class FailingQueueTest(unittest.TestCase, BlockingTestMixin): +class FailingQueueTest(BlockingTestMixin, unittest.TestCase): def failing_queue_test(self, q): if not q.empty(): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 24 00:06:16 2013 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 24 Mar 2013 00:06:16 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Fixes_issue465?= =?utf-8?q?3_-_Correctly_specify_the_buffer_size_to_FormatMessageW_and?= Message-ID: <3ZYHRD55Pkz7Lkg@mail.python.org> http://hg.python.org/cpython/rev/4db1b0bb3683 changeset: 82936:4db1b0bb3683 branch: 3.3 parent: 82932:263fdce97aa0 user: Gregory P. Smith date: Sat Mar 23 16:05:36 2013 -0700 summary: Fixes issue4653 - Correctly specify the buffer size to FormatMessageW and correctly check for errors on two CreateFileMapping calls. files: PC/bdist_wininst/extract.c | 2 +- PC/bdist_wininst/install.c | 2 +- Python/dynload_win.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PC/bdist_wininst/extract.c b/PC/bdist_wininst/extract.c --- a/PC/bdist_wininst/extract.c +++ b/PC/bdist_wininst/extract.c @@ -127,7 +127,7 @@ CloseHandle(hFile); - if (hFileMapping == INVALID_HANDLE_VALUE) { + if (hFileMapping == NULL) { if (notify) notify(SYSTEM_ERROR, "CreateFileMapping (%s)", filename); diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c --- a/PC/bdist_wininst/install.c +++ b/PC/bdist_wininst/install.c @@ -1019,7 +1019,7 @@ NULL, PAGE_READONLY, 0, 0, NULL); CloseHandle(hFile); - if (hFileMapping == INVALID_HANDLE_VALUE) + if (hFileMapping == NULL) return NULL; data = MapViewOfFile(hFileMapping, diff --git a/Python/dynload_win.c b/Python/dynload_win.c --- a/Python/dynload_win.c +++ b/Python/dynload_win.c @@ -235,7 +235,7 @@ SUBLANG_DEFAULT), /* Default language */ theInfo, /* the buffer */ - sizeof(theInfo), /* the buffer size */ + sizeof(theInfo) / sizeof(wchar_t), /* size in wchars */ NULL); /* no additional format args. */ /* Problem: could not get the error message. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 24 00:06:18 2013 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 24 Mar 2013 00:06:18 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Fixes_issue4653_-_Correctly_specify_the_buffer_size_to_F?= =?utf-8?q?ormatMessageW_and?= Message-ID: <3ZYHRG0wFlz7Ln5@mail.python.org> http://hg.python.org/cpython/rev/ace52be8da89 changeset: 82937:ace52be8da89 parent: 82933:1747e50fca55 parent: 82936:4db1b0bb3683 user: Gregory P. Smith date: Sat Mar 23 16:06:06 2013 -0700 summary: Fixes issue4653 - Correctly specify the buffer size to FormatMessageW and correctly check for errors on two CreateFileMapping calls. files: PC/bdist_wininst/extract.c | 2 +- PC/bdist_wininst/install.c | 2 +- Python/dynload_win.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PC/bdist_wininst/extract.c b/PC/bdist_wininst/extract.c --- a/PC/bdist_wininst/extract.c +++ b/PC/bdist_wininst/extract.c @@ -127,7 +127,7 @@ CloseHandle(hFile); - if (hFileMapping == INVALID_HANDLE_VALUE) { + if (hFileMapping == NULL) { if (notify) notify(SYSTEM_ERROR, "CreateFileMapping (%s)", filename); diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c --- a/PC/bdist_wininst/install.c +++ b/PC/bdist_wininst/install.c @@ -1019,7 +1019,7 @@ NULL, PAGE_READONLY, 0, 0, NULL); CloseHandle(hFile); - if (hFileMapping == INVALID_HANDLE_VALUE) + if (hFileMapping == NULL) return NULL; data = MapViewOfFile(hFileMapping, diff --git a/Python/dynload_win.c b/Python/dynload_win.c --- a/Python/dynload_win.c +++ b/Python/dynload_win.c @@ -235,7 +235,7 @@ SUBLANG_DEFAULT), /* Default language */ theInfo, /* the buffer */ - sizeof(theInfo), /* the buffer size */ + sizeof(theInfo) / sizeof(wchar_t), /* size in wchars */ NULL); /* no additional format args. */ /* Problem: could not get the error message. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 24 04:37:21 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 24 Mar 2013 04:37:21 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_allow_any_type?= =?utf-8?q?_with_=5F=5Fgetitem=5F=5F_to_be_a_mapping_for_the_purposes_of_?= =?utf-8?b?JSAoIzE1ODAxKQ==?= Message-ID: <3ZYPS17256z7Llb@mail.python.org> http://hg.python.org/cpython/rev/391e3a7db1a3 changeset: 82938:391e3a7db1a3 branch: 2.7 parent: 82929:87d266988905 user: Benjamin Peterson date: Sat Mar 23 22:32:00 2013 -0500 summary: allow any type with __getitem__ to be a mapping for the purposes of % (#15801) files: Lib/test/string_tests.py | 4 ++++ Misc/NEWS | 7 +++++++ Objects/stringobject.c | 4 ++-- Objects/unicodeobject.c | 4 ++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -1130,6 +1130,10 @@ class X(object): pass self.checkraises(TypeError, 'abc', '__mod__', X()) + class X(Exception): + def __getitem__(self, k): + return k + self.checkequal('melon apple', '%(melon)s %(apple)s', '__mod__', X()) def test_floatformatting(self): # float formatting diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -6,6 +6,13 @@ *Release date: XXXX-XX-XX* +Core and Builtins +----------------- + +- Issue #15801 (again): With string % formatting, relax the type check for a + mapping such that any type with a __getitem__ can be used on the right hand + side. + Library ------- diff --git a/Objects/stringobject.c b/Objects/stringobject.c --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -4257,8 +4257,8 @@ arglen = -1; argidx = -2; } - if (PyMapping_Check(args) && !PyTuple_Check(args) && - !PyObject_TypeCheck(args, &PyBaseString_Type)) + if (Py_TYPE(args)->tp_as_mapping && Py_TYPE(args)->tp_as_mapping->mp_subscript && + !PyTuple_Check(args) && !PyObject_TypeCheck(args, &PyBaseString_Type)) dict = args; while (--fmtcnt >= 0) { if (*fmt != '%') { diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -8287,8 +8287,8 @@ arglen = -1; argidx = -2; } - if (PyMapping_Check(args) && !PyTuple_Check(args) && - !PyObject_TypeCheck(args, &PyBaseString_Type)) + if (Py_TYPE(args)->tp_as_mapping && Py_TYPE(args)->tp_as_mapping->mp_subscript && + !PyTuple_Check(args) && !PyObject_TypeCheck(args, &PyBaseString_Type)) dict = args; while (--fmtcnt >= 0) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 24 04:37:23 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 24 Mar 2013 04:37:23 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_merge_2=2E7=2E4_release_branch?= Message-ID: <3ZYPS33Cd5z7LmT@mail.python.org> http://hg.python.org/cpython/rev/5580fa776898 changeset: 82939:5580fa776898 branch: 2.7 parent: 82935:ef762dbe3e42 parent: 82938:391e3a7db1a3 user: Benjamin Peterson date: Sat Mar 23 22:32:34 2013 -0500 summary: merge 2.7.4 release branch files: Lib/test/string_tests.py | 4 ++++ Misc/NEWS | 7 +++++++ Objects/stringobject.c | 4 ++-- Objects/unicodeobject.c | 4 ++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -1130,6 +1130,10 @@ class X(object): pass self.checkraises(TypeError, 'abc', '__mod__', X()) + class X(Exception): + def __getitem__(self, k): + return k + self.checkequal('melon apple', '%(melon)s %(apple)s', '__mod__', X()) def test_floatformatting(self): # float formatting diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -18,6 +18,13 @@ *Release date: XXXX-XX-XX* +Core and Builtins +----------------- + +- Issue #15801 (again): With string % formatting, relax the type check for a + mapping such that any type with a __getitem__ can be used on the right hand + side. + Library ------- diff --git a/Objects/stringobject.c b/Objects/stringobject.c --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -4257,8 +4257,8 @@ arglen = -1; argidx = -2; } - if (PyMapping_Check(args) && !PyTuple_Check(args) && - !PyObject_TypeCheck(args, &PyBaseString_Type)) + if (Py_TYPE(args)->tp_as_mapping && Py_TYPE(args)->tp_as_mapping->mp_subscript && + !PyTuple_Check(args) && !PyObject_TypeCheck(args, &PyBaseString_Type)) dict = args; while (--fmtcnt >= 0) { if (*fmt != '%') { diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -8287,8 +8287,8 @@ arglen = -1; argidx = -2; } - if (PyMapping_Check(args) && !PyTuple_Check(args) && - !PyObject_TypeCheck(args, &PyBaseString_Type)) + if (Py_TYPE(args)->tp_as_mapping && Py_TYPE(args)->tp_as_mapping->mp_subscript && + !PyTuple_Check(args) && !PyObject_TypeCheck(args, &PyBaseString_Type)) dict = args; while (--fmtcnt >= 0) { -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sun Mar 24 05:54:12 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 24 Mar 2013 05:54:12 +0100 Subject: [Python-checkins] Daily reference leaks (ace52be8da89): sum=5 Message-ID: results for ace52be8da89 on branch "default" -------------------------------------------- test_unittest leaked [-1, 2, 0] memory blocks, sum=1 test_imaplib leaked [0, 3, 0] references, sum=3 test_imaplib leaked [0, -1, 2] memory blocks, sum=1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/refloghBKq_t', '-x'] From python-checkins at python.org Sun Mar 24 15:11:04 2013 From: python-checkins at python.org (ezio.melotti) Date: Sun, 24 Mar 2013 15:11:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzE3NTA0OiByZW1v?= =?utf-8?q?ve_duplicated_sentence=2E__Patch_by_Radu_Voicilas=2E?= Message-ID: <3ZYgWD2q00z7Lp9@mail.python.org> http://hg.python.org/cpython/rev/9445505389cf changeset: 82940:9445505389cf branch: 3.3 parent: 82936:4db1b0bb3683 user: Ezio Melotti date: Sun Mar 24 16:10:24 2013 +0200 summary: #17504: remove duplicated sentence. Patch by Radu Voicilas. files: Lib/unittest/mock.py | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -948,9 +948,6 @@ the next value from the iterable. If any of the members of the iterable are exceptions they will be raised instead of returned. - If `side_effect` is an iterable then each call to the mock will return - the next value from the iterable. - * `return_value`: The value returned when the mock is called. By default this is a new Mock (created on first access). See the `return_value` attribute. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 24 15:11:05 2013 From: python-checkins at python.org (ezio.melotti) Date: Sun, 24 Mar 2013 15:11:05 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3NTA0OiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZYgWF5LQ5z7Lps@mail.python.org> http://hg.python.org/cpython/rev/2fc34f3dbc9d changeset: 82941:2fc34f3dbc9d parent: 82937:ace52be8da89 parent: 82940:9445505389cf user: Ezio Melotti date: Sun Mar 24 16:10:51 2013 +0200 summary: #17504: merge with 3.3. files: Lib/unittest/mock.py | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -973,9 +973,6 @@ the next value from the iterable. If any of the members of the iterable are exceptions they will be raised instead of returned. - If `side_effect` is an iterable then each call to the mock will return - the next value from the iterable. - * `return_value`: The value returned when the mock is called. By default this is a new Mock (created on first access). See the `return_value` attribute. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 24 15:24:51 2013 From: python-checkins at python.org (charles-francois.natali) Date: Sun, 24 Mar 2013 15:24:51 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317025=3A_Add_dump?= =?utf-8?q?s=28=29_and_loads=28=29_to_ForkingPickler=2E?= Message-ID: <3ZYgq72vhzz7Lps@mail.python.org> http://hg.python.org/cpython/rev/bedb4cbdd311 changeset: 82942:bedb4cbdd311 user: Charles-Fran?ois Natali date: Sun Mar 24 15:21:49 2013 +0100 summary: Issue #17025: Add dumps() and loads() to ForkingPickler. files: Lib/multiprocessing/connection.py | 7 ++----- Lib/multiprocessing/forking.py | 11 +++++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py --- a/Lib/multiprocessing/connection.py +++ b/Lib/multiprocessing/connection.py @@ -12,7 +12,6 @@ import io import os import sys -import pickle import select import socket import struct @@ -202,9 +201,7 @@ """Send a (picklable) object""" self._check_closed() self._check_writable() - buf = io.BytesIO() - ForkingPickler(buf, pickle.HIGHEST_PROTOCOL).dump(obj) - self._send_bytes(buf.getbuffer()) + self._send_bytes(ForkingPickler.dumps(obj)) def recv_bytes(self, maxlength=None): """ @@ -249,7 +246,7 @@ self._check_closed() self._check_readable() buf = self._recv_bytes() - return pickle.loads(buf.getbuffer()) + return ForkingPickler.loads(buf.getbuffer()) def poll(self, timeout=0.0): """Whether there is any input available to be read""" diff --git a/Lib/multiprocessing/forking.py b/Lib/multiprocessing/forking.py --- a/Lib/multiprocessing/forking.py +++ b/Lib/multiprocessing/forking.py @@ -7,7 +7,9 @@ # Licensed to PSF under a Contributor Agreement. # +import io import os +import pickle import sys import signal import errno @@ -44,6 +46,15 @@ def register(cls, type, reduce): cls._extra_reducers[type] = reduce + @staticmethod + def dumps(obj): + buf = io.BytesIO() + ForkingPickler(buf, pickle.HIGHEST_PROTOCOL).dump(obj) + return buf.getbuffer() + + loads = pickle.loads + + def _reduce_method(m): if m.__self__ is None: return getattr, (m.__class__, m.__func__.__name__) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 24 18:50:36 2013 From: python-checkins at python.org (matthias.klose) Date: Sun, 24 Mar 2013 18:50:36 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogLSBJc3N1ZSAjMTc1?= =?utf-8?q?36=3A_Add_to_webbrowser=27s_browser_list=3A_www-browser=2C_x-ww?= =?utf-8?q?w-browser=2C?= Message-ID: <3ZYmNX5KK4z7Lp0@mail.python.org> http://hg.python.org/cpython/rev/206522d9134e changeset: 82943:206522d9134e branch: 3.3 parent: 82940:9445505389cf user: doko at ubuntu.com date: Sun Mar 24 18:46:49 2013 +0100 summary: - Issue #17536: Add to webbrowser's browser list: www-browser, x-www-browser, iceweasel, iceape. files: Lib/webbrowser.py | 6 ++++++ Misc/NEWS | 3 +++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -468,9 +468,13 @@ if "KDE_FULL_SESSION" in os.environ and _iscommand("kfmclient"): register("kfmclient", Konqueror, Konqueror("kfmclient")) + if _iscommand("x-www-browser"): + register("x-www-browser", None, BackgroundBrowser("x-www-browser")) + # The Mozilla/Netscape browsers for browser in ("mozilla-firefox", "firefox", "mozilla-firebird", "firebird", + "iceweasel", "iceape", "seamonkey", "mozilla", "netscape"): if _iscommand(browser): register(browser, None, Mozilla(browser)) @@ -513,6 +517,8 @@ # Also try console browsers if os.environ.get("TERM"): + if _iscommand("www-browser"): + register("www-browser", None, GenericBrowser("www-browser")) # The Links/elinks browsers if _iscommand("links"): register("links", None, GenericBrowser("links")) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -196,6 +196,9 @@ Library ------- +- Issue #17536: Add to webbrowser's browser list: www-browser, x-www-browser, + iceweasel, iceape. + - Issue #17488: Change the subprocess.Popen bufsize parameter default value from unbuffered (0) to buffering (-1) to match the behavior existing code expects and match the behavior of the subprocess module in Python 2 to avoid -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 24 18:50:38 2013 From: python-checkins at python.org (matthias.klose) Date: Sun, 24 Mar 2013 18:50:38 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_-_Issue_=2317536=3A_Add_to_webbrowser=27s_browser_list?= =?utf-8?q?=3A_www-browser=2C_x-www-browser=2C?= Message-ID: <3ZYmNZ0yv9z7Lp0@mail.python.org> http://hg.python.org/cpython/rev/34648809d777 changeset: 82944:34648809d777 parent: 82942:bedb4cbdd311 parent: 82943:206522d9134e user: doko at ubuntu.com date: Sun Mar 24 18:50:23 2013 +0100 summary: - Issue #17536: Add to webbrowser's browser list: www-browser, x-www-browser, iceweasel, iceape. files: Lib/webbrowser.py | 6 ++++++ Misc/NEWS | 3 +++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -437,9 +437,13 @@ if "KDE_FULL_SESSION" in os.environ and shutil.which("kfmclient"): register("kfmclient", Konqueror, Konqueror("kfmclient")) + if shutil.which("x-www-browser"): + register("x-www-browser", None, BackgroundBrowser("x-www-browser")) + # The Mozilla/Netscape browsers for browser in ("mozilla-firefox", "firefox", "mozilla-firebird", "firebird", + "iceweasel", "iceape", "seamonkey", "mozilla", "netscape"): if shutil.which(browser): register(browser, None, Mozilla(browser)) @@ -482,6 +486,8 @@ # Also try console browsers if os.environ.get("TERM"): + if shutil.which("www-browser"): + register("www-browser", None, GenericBrowser("www-browser")) # The Links/elinks browsers if shutil.which("links"): register("links", None, GenericBrowser("links")) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -294,6 +294,9 @@ Library ------- +- Issue #17536: Add to webbrowser's browser list: www-browser, x-www-browser, + iceweasel, iceape. + - Issue #17150: pprint now uses line continuations to wrap long string literals. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 24 21:35:13 2013 From: python-checkins at python.org (guido.van.rossum) Date: Sun, 24 Mar 2013 21:35:13 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Refactor_run*=28=29_family=2C?= =?utf-8?q?_rename_Handler-=3EHandle=2C_updated_intros=2E?= Message-ID: <3ZYr2T4L9cz7Lp5@mail.python.org> http://hg.python.org/peps/rev/26a98d94bb4c changeset: 4820:26a98d94bb4c user: Guido van Rossum date: Sun Mar 24 13:34:39 2013 -0700 summary: Refactor run*() family, rename Handler->Handle, updated intros. files: pep-3156.txt | 145 ++++++++++++++++---------------------- 1 files changed, 61 insertions(+), 84 deletions(-) diff --git a/pep-3156.txt b/pep-3156.txt --- a/pep-3156.txt +++ b/pep-3156.txt @@ -17,8 +17,8 @@ PEP 3153. The proposal includes a pluggable event loop API, transport and protocol abstractions similar to those in Twisted, and a higher-level scheduler based on ``yield from`` (PEP 380). A reference -implementation is in the works under the code name Tulip (the Tulip -repo is linked from the References section at the end). +implementation is in the works under the code name Tulip. The Tulip +repo is linked from the References section at the end. Introduction @@ -26,24 +26,33 @@ The event loop is the place where most interoperability occurs. It should be easy for (Python 3.3 ports of) frameworks like Twisted, -Tornado, or ZeroMQ to either adapt the default event loop +Tornado, or even gevents to either adapt the default event loop implementation to their needs using a lightweight wrapper or proxy, or to replace the default event loop implementation with an adaptation of their own event loop implementation. (Some frameworks, like Twisted, have multiple event loop implementations. This should not be a problem since these all have the same interface.) -It should even be possible for two different third-party frameworks to -interoperate, either by sharing the default event loop implementation -(each using its own adapter), or by sharing the event loop -implementation of either framework. In the latter case two levels of -adaptation would occur (from framework A's event loop to the standard -event loop interface, and from there to framework B's event loop). -Which event loop implementation is used should be under control of the -main program (though a default policy for event loop selection is -provided). +In most cases it should be possible for two different third-party +frameworks to interoperate, either by sharing the default event loop +implementation (each using its own adapter), or by sharing the event +loop implementation of either framework. In the latter case two +levels of adaptation would occur (from framework A's event loop to the +standard event loop interface, and from there to framework B's event +loop). Which event loop implementation is used should be under +control of the main program (though a default policy for event loop +selection is provided). -Thus, two separate APIs are defined: +For this interoperability to be effective, the preferred direction of +adaptation in third party frameworks is to keep the default event loop +and adapt it to the framework's API. Ideally all third party +frameworks would give up their own event loop implementation in favor +of the standard implementation. But not all frameworks may be +satisfied with the functionality provided by the standard +implementation. + +In order to support both directions of adaptation, two separate APIs +are defined: - getting and setting the current event loop object - the interface of a conforming event loop and its minimum guarantees @@ -118,13 +127,6 @@ later. -Non-goals -========= - -Interoperability with systems like Stackless Python or -greenlets/gevent is not a goal of this PEP. - - Specification ============= @@ -195,35 +197,18 @@ accuracy and precision of the clock are up to the implementation; the default implementation uses ``time.monotonic()``. -A note about callbacks and Handlers: any function that takes a +A note about callbacks and Handles: any function that takes a callback and a variable number of arguments for it can also be given a -Handler object instead of the callback. Then no arguments should be -given, and the Handler should represent an immediate callback (as +Handle object instead of the callback. Then no arguments should be +given, and the Handle should represent an immediate callback (as returned from ``call_soon()``), not a delayed callback (as returned -from ``call_later()``). If the Handler is already cancelled, the +from ``call_later()``). If the Handle is already cancelled, the call is a no-op. A conforming event loop object has the following methods: -- ``run()``. Runs the event loop until there is nothing left to do. - This means, in particular: - - - No more calls scheduled with ``call_later()``, - ``call_repeatedly()``, ``call_soon()``, or - ``call_soon_threadsafe()``, except for cancelled calls. - - - No more registered file descriptors. It is up to the registering - party to unregister a file descriptor when it is closed. - - Note: ``run()`` blocks until the termination condition is met, - or until ``stop()`` is called. - - Note: if you schedule a call with ``call_repeatedly()``, ``run()`` - will not exit until you cancel it. - - TBD: How many variants of this do we really need? - -- ``run_forever()``. Runs the event loop until ``stop()`` is called. +- ``run()``. Runs the event loop until ``stop()`` is called. This + cannot be called when the event loop is already running. - ``run_until_complete(future, timeout=None)``. Runs the event loop until the Future is done. If a timeout is given, it waits at most @@ -232,28 +217,12 @@ done, or if ``stop()`` is called, ``TimeoutError`` is raised (but the Future is not cancelled). This cannot be called when the event loop is already running. - - Note: This API is most useful for tests and the like. It should not - be used as a substitute for ``yield from future`` or other ways to - wait for a Future (e.g. registering a done callback). - -- ``run_once(timeout=None)``. Run the event loop for a little while. - If a timeout is given, an I/O poll made will block at most that - long; otherwise, an I/O poll is not constrained in time. - - Note: Exactlly how much work this does is up to the implementation. - One constraint: if a callback immediately schedules itself using - ``call_soon()``, causing an infinite loop, ``run_once()`` should - still return. - ``stop()``. Stops the event loop as soon as it is convenient. It - is fine to restart the loop with ``run()`` (or one of its variants) - subsequently. + is fine to restart the loop with ``run()`` or ``run_until_complete()`` + subsequently; no scheduled callbacks will be lost if this happens. - Note: How soon exactly is up to the implementation. All immediate - callbacks that were already scheduled to run before ``stop()`` is - called must still be run, but callbacks scheduled after it is called - (or scheduled to be run later) will not be run. + Note: How soon the event loop stops is up to the implementation. - ``close()``. Closes the event loop, releasing any resources it may hold, such as the file descriptor used by ``epoll()`` or @@ -263,16 +232,23 @@ - ``call_later(delay, callback, *args)``. Arrange for ``callback(*args)`` to be called approximately ``delay`` seconds in the future, once, unless cancelled. Returns - a ``Handler`` object representing the callback, whose + a ``Handle`` object representing the callback, whose ``cancel()`` method can be used to cancel the callback. + If ``delay`` is <= 0, this acts like ``call_soon()`` instead. + Otherwise, callbacks scheduled for exactly the same time will be + called in an undefined order. -- ``call_repeatedly(interval, callback, **args)``. Like ``call_later()`` - but calls the callback repeatedly, every ``interval`` seconds, - until the ``Handler`` returned is cancelled. The first call is in - ``interval`` seconds. +- ``call_repeatedly(interval, callback, **args)``. Like + ``call_later()`` but calls the callback repeatedly, every (approximately) + ``interval`` seconds, until the ``Handle`` returned is cancelled or + the callback raises an exception. The first call is in + approximately ``interval`` seconds. If for whatever reason the + callback happens later than scheduled, subsequent callbacks will be + delayed for (at least) the same amount. The ``interval`` must be > 0. -- ``call_soon(callback, *args)``. Equivalent to ``call_later(0, - callback, *args)``. +- ``call_soon(callback, *args)``. This schedules a callback to be + called as soon as possible. It guarantees that callbacks are called + in the order in which they were scheduled. - ``call_soon_threadsafe(callback, *args)``. Like ``call_soon(callback, *args)``, but when called from another thread @@ -286,8 +262,8 @@ - ``add_signal_handler(sig, callback, *args). Whenever signal ``sig`` is received, arrange for ``callback(*args)`` to be called. Returns - a ``Handler`` which can be used to cancel the signal callback. - (Cancelling the handler causes ``remove_signal_handler()`` to be + a ``Handle`` which can be used to cancel the signal callback. + (Cancelling the handle causes ``remove_signal_handler()`` to be called the next time the signal arrives. Explicitly calling ``remove_signal_handler()`` is preferred.) Specifying another callback for the same signal replaces the @@ -298,13 +274,13 @@ signale (e.g. ``SIGKILL``), ``RuntimeError`` if this particular event loop instance cannot handle signals (since signals are global per process, only an event loop associated with the main thread can - handle signals). + handle signals). (TBD: Rename to ``set_signal_handler()``?) - ``remove_signal_handler(sig)``. Removes the handler for signal ``sig``, if one is set. Raises the same exceptions as ``add_signal_handler()`` (except that it may return ``False`` instead raising ``RuntimeError`` for uncatchable signals). Returns - ``True``e\ if a handler was removed successfully, ``False`` if no + ``True`` if a handler was removed successfully, ``False`` if no handler was set. Some methods in the standard conforming interface return Futures: @@ -417,25 +393,26 @@ - ``add_reader(fd, callback, *args)``. Arrange for ``callback(*args)`` to be called whenever file descriptor ``fd`` is - ready for reading. Returns a ``Handler`` object which can be + ready for reading. Returns a ``Handle`` object which can be used to cancel the callback. Note that, unlike ``call_later()``, the callback may be called many times. Calling ``add_reader()`` again for the same file descriptor implicitly cancels the previous - callback for that file descriptor. Note: cancelling the handler - may be delayed until the handler would be called. If you plan to + callback for that file descriptor. Note: cancelling the handle + may be delayed until the handle would be called. If you plan to close ``fd``, you should use ``remove_reader(fd)`` instead. - (TBD: Change this to raise an exception if a handler - is already set.) + (TBD: Change this to raise an exception if a handle + is already set.) (TBD: Rename to ``set_reader()``?) - ``add_writer(fd, callback, *args)``. Like ``add_reader()``, but registers the callback for writing instead of for reading. + (TBD: Rename to ``set_reader()``?) - ``remove_reader(fd)``. Cancels the current read callback for file descriptor ``fd``, if one is set. A no-op if no callback is currently set for the file descriptor. (The reason for providing this alternate interface is that it is often more convenient to - remember the file descriptor than to remember the ``Handler`` - object.) Returns ``True`` if a handler was removed, ``False`` + remember the file descriptor than to remember the ``Handle`` + object.) Returns ``True`` if a callback was removed, ``False`` if not. - ``remove_writer(fd)``. This is to ``add_writer()`` as @@ -522,13 +499,13 @@ and ``SystemExit``; it is usually unwise to treat these the same as most other exceptions.) -The Handler Class ------------------ +The Handle Class +---------------- The various methods for registering callbacks (e.g. ``call_later()``) all return an object representing the registration that can be used to cancel the callback. For want of a better name this object is called -a ``Handler``, although the user never needs to instantiate +a ``Handle``, although the user never needs to instantiate instances of this class. There is one public method: - ``cancel()``. Attempt to cancel the callback. @@ -597,7 +574,7 @@ ``call_soon()``. Note that the callback (unlike all other callbacks defined in this PEP, and ignoring the convention from the section "Callback Style" below) is always called with a single argument, the - Future object, and should not be a Handler object. + Future object, and should not be a Handle object. - ``set_result(result)``. The Future must not be done (nor cancelled) already. This makes the Future done and schedules the callbacks. -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sun Mar 24 22:12:41 2013 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 24 Mar 2013 22:12:41 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE3NDI1?= =?utf-8?q?=3A_Build_with_openssl_1=2E0=2E0k_on_Windows=2E?= Message-ID: <3ZYrsj2xnGz7LrQ@mail.python.org> http://hg.python.org/cpython/rev/0fb7db2f9b5e changeset: 82945:0fb7db2f9b5e branch: 3.2 parent: 82931:1c7c692de1ee user: Martin v. Loewis date: Sun Mar 24 22:03:30 2013 +0100 summary: Issue #17425: Build with openssl 1.0.0k on Windows. files: Misc/NEWS | 2 ++ PC/VC6/readme.txt | 4 ++-- PC/VS8.0/pyproject.vsprops | 2 +- PCbuild/pyproject.vsprops | 2 +- PCbuild/readme.txt | 2 +- Tools/buildbot/external-common.bat | 4 ++-- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1084,6 +1084,8 @@ Build ----- +- Issue #17425: Build with openssl 1.0.0k on Windows. + - Issue #16754: Fix the incorrect shared library extension on linux. Introduce two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. diff --git a/PC/VC6/readme.txt b/PC/VC6/readme.txt --- a/PC/VC6/readme.txt +++ b/PC/VC6/readme.txt @@ -153,9 +153,9 @@ Unpack into the "dist" directory, retaining the folder name from the archive - for example, the latest stable OpenSSL will install as - dist/openssl-1.0.0j + dist/openssl-1.0.0k - You need to use version 1.0.0j of OpenSSL. + You need to use version 1.0.0k of OpenSSL. You can install the NASM assembler from http://www.nasm.us/ diff --git a/PC/VS8.0/pyproject.vsprops b/PC/VS8.0/pyproject.vsprops --- a/PC/VS8.0/pyproject.vsprops +++ b/PC/VS8.0/pyproject.vsprops @@ -58,7 +58,7 @@ /> http://hg.python.org/cpython/rev/8051e6ff97e2 changeset: 82946:8051e6ff97e2 branch: 3.3 parent: 82943:206522d9134e parent: 82945:0fb7db2f9b5e user: Martin v. Loewis date: Sun Mar 24 22:10:20 2013 +0100 summary: #17425: null merge 3.2 files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 24 22:12:44 2013 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 24 Mar 2013 22:12:44 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy4z?= Message-ID: <3ZYrsm1LStz7LpC@mail.python.org> http://hg.python.org/cpython/rev/173f57717601 changeset: 82947:173f57717601 parent: 82944:34648809d777 parent: 82946:8051e6ff97e2 user: Martin v. Loewis date: Sun Mar 24 22:12:19 2013 +0100 summary: merge 3.3 files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 24 22:53:12 2013 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 24 Mar 2013 22:53:12 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE3NDI1?= =?utf-8?q?=3A_Build_with_openssl_1=2E0=2E1d_on_Windows=2E?= Message-ID: <3ZYsmS4tRBz7LpR@mail.python.org> http://hg.python.org/cpython/rev/840a90e8cefd changeset: 82948:840a90e8cefd branch: 3.3 parent: 82946:8051e6ff97e2 user: Martin v. L?wis date: Sun Mar 24 22:45:50 2013 +0100 summary: Issue #17425: Build with openssl 1.0.1d on Windows. files: Misc/NEWS | 2 ++ PC/VC6/readme.txt | 4 ++-- PC/VS8.0/pyproject.vsprops | 2 +- PC/VS9.0/pyproject.vsprops | 2 +- PCbuild/pyproject.props | 2 +- PCbuild/readme.txt | 2 +- Tools/buildbot/external-common.bat | 8 ++++---- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -811,6 +811,8 @@ Build ----- +- Issue #17425: Build with openssl 1.0.1d on Windows. + - Issue #16754: Fix the incorrect shared library extension on linux. Introduce two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. diff --git a/PC/VC6/readme.txt b/PC/VC6/readme.txt --- a/PC/VC6/readme.txt +++ b/PC/VC6/readme.txt @@ -153,9 +153,9 @@ Unpack into the "dist" directory, retaining the folder name from the archive - for example, the latest stable OpenSSL will install as - dist/openssl-1.0.1c + dist/openssl-1.0.1d - You need to use version 1.0.1c of OpenSSL. + You need to use version 1.0.1d of OpenSSL. You can install the NASM assembler from http://www.nasm.us/ diff --git a/PC/VS8.0/pyproject.vsprops b/PC/VS8.0/pyproject.vsprops --- a/PC/VS8.0/pyproject.vsprops +++ b/PC/VS8.0/pyproject.vsprops @@ -58,7 +58,7 @@ /> $(externalsDir)\sqlite-3.7.12 $(externalsDir)\bzip2-1.0.6 $(externalsDir)\xz-5.0.3 - $(externalsDir)\openssl-1.0.1c + $(externalsDir)\openssl-1.0.1d $(externalsDir)\tcltk $(externalsDir)\tcltk64 $(tcltkDir)\lib\tcl85.lib;$(tcltkDir)\lib\tk85.lib diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt --- a/PCbuild/readme.txt +++ b/PCbuild/readme.txt @@ -142,7 +142,7 @@ Get the source code through - svn export http://svn.python.org/projects/external/openssl-1.0.1c + svn export http://svn.python.org/projects/external/openssl-1.0.1d ** NOTE: if you use the Tools\buildbot\external(-amd64).bat approach for obtaining external sources then you don't need to manually get the source diff --git a/Tools/buildbot/external-common.bat b/Tools/buildbot/external-common.bat --- a/Tools/buildbot/external-common.bat +++ b/Tools/buildbot/external-common.bat @@ -14,7 +14,7 @@ @rem if exist tk8.4.16 rd /s/q tk8.4.16 @rem if exist tk-8.4.18.1 rd /s/q tk-8.4.18.1 @rem if exist db-4.4.20 rd /s/q db-4.4.20 - at rem if exist openssl-1.0.1c rd /s/q openssl-1.0.1c + at rem if exist openssl-1.0.1d rd /s/q openssl-1.0.1d @rem if exist sqlite-3.7.12 rd /s/q sqlite-3.7.12 @rem bzip @@ -24,9 +24,9 @@ ) @rem OpenSSL -if not exist openssl-1.0.1c ( - rd /s/q openssl-1.0.0j - svn export http://svn.python.org/projects/external/openssl-1.0.1c +if not exist openssl-1.0.1d ( + rd /s/q openssl-1.0.1c + svn export http://svn.python.org/projects/external/openssl-1.0.1d ) @rem tcl/tk -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 24 22:53:14 2013 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 24 Mar 2013 22:53:14 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Fix_typo?= Message-ID: <3ZYsmV09dcz7LrG@mail.python.org> http://hg.python.org/cpython/rev/ca2589243478 changeset: 82949:ca2589243478 branch: 3.3 user: Martin v. L?wis date: Sun Mar 24 22:52:14 2013 +0100 summary: Fix typo files: PC/VS9.0/pyproject.vsprops | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/PC/VS9.0/pyproject.vsprops b/PC/VS9.0/pyproject.vsprops --- a/PC/VS9.0/pyproject.vsprops +++ b/PC/VS9.0/pyproject.vsprops @@ -62,7 +62,7 @@ /> http://hg.python.org/cpython/rev/a626a32bd42d changeset: 82950:a626a32bd42d parent: 82947:173f57717601 parent: 82949:ca2589243478 user: Martin v. L?wis date: Sun Mar 24 22:53:04 2013 +0100 summary: #17425: merge 3.3 files: Misc/NEWS | 2 ++ PC/VS9.0/pyproject.vsprops | 2 +- PCbuild/pyproject.props | 2 +- PCbuild/readme.txt | 2 +- Tools/buildbot/external-common.bat | 8 ++++---- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1143,6 +1143,8 @@ Build ----- +- Issue #17425: Build with openssl 1.0.1d on Windows. + - Issue #16754: Fix the incorrect shared library extension on linux. Introduce two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. diff --git a/PC/VS9.0/pyproject.vsprops b/PC/VS9.0/pyproject.vsprops --- a/PC/VS9.0/pyproject.vsprops +++ b/PC/VS9.0/pyproject.vsprops @@ -62,7 +62,7 @@ /> $(externalsDir)\sqlite-3.7.12 $(externalsDir)\bzip2-1.0.6 $(externalsDir)\xz-5.0.3 - $(externalsDir)\openssl-1.0.1c + $(externalsDir)\openssl-1.0.1d $(externalsDir)\tcltk $(externalsDir)\tcltk64 $(tcltkDir)\lib\tcl85.lib;$(tcltkDir)\lib\tk85.lib diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt --- a/PCbuild/readme.txt +++ b/PCbuild/readme.txt @@ -142,7 +142,7 @@ Get the source code through - svn export http://svn.python.org/projects/external/openssl-1.0.1c + svn export http://svn.python.org/projects/external/openssl-1.0.1d ** NOTE: if you use the Tools\buildbot\external(-amd64).bat approach for obtaining external sources then you don't need to manually get the source diff --git a/Tools/buildbot/external-common.bat b/Tools/buildbot/external-common.bat --- a/Tools/buildbot/external-common.bat +++ b/Tools/buildbot/external-common.bat @@ -14,7 +14,7 @@ @rem if exist tk8.4.16 rd /s/q tk8.4.16 @rem if exist tk-8.4.18.1 rd /s/q tk-8.4.18.1 @rem if exist db-4.4.20 rd /s/q db-4.4.20 - at rem if exist openssl-1.0.1c rd /s/q openssl-1.0.1c + at rem if exist openssl-1.0.1d rd /s/q openssl-1.0.1d @rem if exist sqlite-3.7.12 rd /s/q sqlite-3.7.12 @rem bzip @@ -24,9 +24,9 @@ ) @rem OpenSSL -if not exist openssl-1.0.1c ( - rd /s/q openssl-1.0.0j - svn export http://svn.python.org/projects/external/openssl-1.0.1c +if not exist openssl-1.0.1d ( + rd /s/q openssl-1.0.1c + svn export http://svn.python.org/projects/external/openssl-1.0.1d ) @rem tcl/tk -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 24 22:54:53 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 24 Mar 2013 22:54:53 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Add_missing_do?= =?utf-8?q?cstrings_to_the_collections_ABCs?= Message-ID: <3ZYspP0BLFz7Lp5@mail.python.org> http://hg.python.org/cpython/rev/6fc9103d55f0 changeset: 82951:6fc9103d55f0 branch: 2.7 parent: 82939:5580fa776898 user: Raymond Hettinger date: Sun Mar 24 14:54:25 2013 -0700 summary: Add missing docstrings to the collections ABCs files: Lib/_abcoll.py | 70 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 70 insertions(+), 0 deletions(-) diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py --- a/Lib/_abcoll.py +++ b/Lib/_abcoll.py @@ -74,6 +74,7 @@ @abstractmethod def next(self): + 'Return the next item from the iterator. When exhausted, raise StopIteration' raise StopIteration def __iter__(self): @@ -194,6 +195,7 @@ return self._from_iterable(value for value in other if value in self) def isdisjoint(self, other): + 'Return True if two sets have a null intersection.' for value in other: if value in self: return False @@ -259,6 +261,16 @@ class MutableSet(Set): + """A mutable set is a finite, iterable container. + + This class provides concrete generic implementations of all + methods except for __contains__, __iter__, __len__, + add(), and discard(). + + To override the comparisons (presumably for speed, as the + semantics are fixed), all you have to do is redefine __le__ and + then the other operations will automatically follow suit. + """ @abstractmethod def add(self, value): @@ -333,11 +345,20 @@ class Mapping(Sized, Iterable, Container): + """A Mapping is a generic container for associating key/value + pairs. + + This class provides concrete generic implementations of all + methods except for __getitem__, __iter__, and __len__. + + """ + @abstractmethod def __getitem__(self, key): raise KeyError def get(self, key, default=None): + 'D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.' try: return self[key] except KeyError: @@ -352,23 +373,29 @@ return True def iterkeys(self): + 'D.iterkeys() -> an iterator over the keys of D' return iter(self) def itervalues(self): + 'D.itervalues() -> an iterator over the values of D' for key in self: yield self[key] def iteritems(self): + 'D.iteritems() -> an iterator over the (key, value) items of D' for key in self: yield (key, self[key]) def keys(self): + "D.keys() -> list of D's keys" return list(self) def items(self): + "D.items() -> list of D's (key, value) pairs, as 2-tuples" return [(key, self[key]) for key in self] def values(self): + "D.values() -> list of D's values" return [self[key] for key in self] # Mappings are not hashable by default, but subclasses can change this @@ -443,6 +470,15 @@ class MutableMapping(Mapping): + """A MutableMapping is a generic container for associating + key/value pairs. + + This class provides concrete generic implementations of all + methods except for __getitem__, __setitem__, __delitem__, + __iter__, and __len__. + + """ + @abstractmethod def __setitem__(self, key, value): raise KeyError @@ -454,6 +490,9 @@ __marker = object() def pop(self, key, default=__marker): + '''D.pop(k[,d]) -> v, remove specified key and return the corresponding value. + If key is not found, d is returned if given, otherwise KeyError is raised. + ''' try: value = self[key] except KeyError: @@ -465,6 +504,9 @@ return value def popitem(self): + '''D.popitem() -> (k, v), remove and return some (key, value) pair + as a 2-tuple; but raise KeyError if D is empty. + ''' try: key = next(iter(self)) except StopIteration: @@ -474,6 +516,7 @@ return key, value def clear(self): + 'D.clear() -> None. Remove all items from D.' try: while True: self.popitem() @@ -481,6 +524,11 @@ pass def update(*args, **kwds): + ''' D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. + If E present and has a .keys() method, does: for k in E: D[k] = E[k] + If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v + In either case, this is followed by: for k, v in F.items(): D[k] = v + ''' if len(args) > 2: raise TypeError("update() takes at most 2 positional " "arguments ({} given)".format(len(args))) @@ -502,6 +550,7 @@ self[key] = value def setdefault(self, key, default=None): + 'D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D' try: return self[key] except KeyError: @@ -546,12 +595,16 @@ yield self[i] def index(self, value): + '''S.index(value) -> integer -- return first index of value. + Raises ValueError if the value is not present. + ''' for i, v in enumerate(self): if v == value: return i raise ValueError def count(self, value): + 'S.count(value) -> integer -- return number of occurrences of value' return sum(1 for v in self if v == value) Sequence.register(tuple) @@ -562,6 +615,13 @@ class MutableSequence(Sequence): + """All the operations on a read-only sequence. + + Concrete subclasses must provide __new__ or __init__, + __getitem__, __setitem__, __delitem__, __len__, and insert(). + + """ + @abstractmethod def __setitem__(self, index, value): raise IndexError @@ -572,26 +632,36 @@ @abstractmethod def insert(self, index, value): + 'S.insert(index, object) -- insert object before index' raise IndexError def append(self, value): + 'S.append(object) -- append object to the end of the sequence' self.insert(len(self), value) def reverse(self): + 'S.reverse() -- reverse *IN PLACE*' n = len(self) for i in range(n//2): self[i], self[n-i-1] = self[n-i-1], self[i] def extend(self, values): + 'S.extend(iterable) -- extend sequence by appending elements from the iterable' for v in values: self.append(v) def pop(self, index=-1): + '''S.pop([index]) -> item -- remove and return item at index (default last). + Raise IndexError if list is empty or index is out of range. + ''' v = self[index] del self[index] return v def remove(self, value): + '''S.remove(value) -- remove first occurrence of value. + Raise ValueError if the value is not present. + ''' del self[self.index(value)] def __iadd__(self, values): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 24 23:22:10 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 24 Mar 2013 23:22:10 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Add_missing_do?= =?utf-8?q?cstrings_to_the_collections_ABCs?= Message-ID: <3ZYtPt4Kg3z7Lrw@mail.python.org> http://hg.python.org/cpython/rev/c28b0b4e872b changeset: 82952:c28b0b4e872b branch: 3.3 parent: 82949:ca2589243478 user: Raymond Hettinger date: Sun Mar 24 15:20:29 2013 -0700 summary: Add missing docstrings to the collections ABCs files: Lib/collections/abc.py | 68 ++++++++++++++++++++++++++++++ 1 files changed, 68 insertions(+), 0 deletions(-) diff --git a/Lib/collections/abc.py b/Lib/collections/abc.py --- a/Lib/collections/abc.py +++ b/Lib/collections/abc.py @@ -90,6 +90,7 @@ @abstractmethod def __next__(self): + 'Return the next item from the iterator. When exhausted, raise StopIteration' raise StopIteration def __iter__(self): @@ -230,6 +231,7 @@ return self._from_iterable(value for value in other if value in self) def isdisjoint(self, other): + 'Return True if two sets have a null intersection.' for value in other: if value in self: return False @@ -292,6 +294,16 @@ class MutableSet(Set): + """A mutable set is a finite, iterable container. + + This class provides concrete generic implementations of all + methods except for __contains__, __iter__, __len__, + add(), and discard(). + + To override the comparisons (presumably for speed, as the + semantics are fixed), all you have to do is redefine __le__ and + then the other operations will automatically follow suit. + """ __slots__ = () @@ -370,11 +382,20 @@ __slots__ = () + """A Mapping is a generic container for associating key/value + pairs. + + This class provides concrete generic implementations of all + methods except for __getitem__, __iter__, and __len__. + + """ + @abstractmethod def __getitem__(self, key): raise KeyError def get(self, key, default=None): + 'D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.' try: return self[key] except KeyError: @@ -389,12 +410,15 @@ return True def keys(self): + "D.keys() -> a set-like object providing a view on D's keys" return KeysView(self) def items(self): + "D.items() -> a set-like object providing a view on D's items" return ItemsView(self) def values(self): + "D.values() -> an object providing a view on D's values" return ValuesView(self) def __eq__(self, other): @@ -477,6 +501,15 @@ __slots__ = () + """A MutableMapping is a generic container for associating + key/value pairs. + + This class provides concrete generic implementations of all + methods except for __getitem__, __setitem__, __delitem__, + __iter__, and __len__. + + """ + @abstractmethod def __setitem__(self, key, value): raise KeyError @@ -488,6 +521,9 @@ __marker = object() def pop(self, key, default=__marker): + '''D.pop(k[,d]) -> v, remove specified key and return the corresponding value. + If key is not found, d is returned if given, otherwise KeyError is raised. + ''' try: value = self[key] except KeyError: @@ -499,6 +535,9 @@ return value def popitem(self): + '''D.popitem() -> (k, v), remove and return some (key, value) pair + as a 2-tuple; but raise KeyError if D is empty. + ''' try: key = next(iter(self)) except StopIteration: @@ -508,6 +547,7 @@ return key, value def clear(self): + 'D.clear() -> None. Remove all items from D.' try: while True: self.popitem() @@ -515,6 +555,11 @@ pass def update(*args, **kwds): + ''' D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. + If E present and has a .keys() method, does: for k in E: D[k] = E[k] + If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v + In either case, this is followed by: for k, v in F.items(): D[k] = v + ''' if len(args) > 2: raise TypeError("update() takes at most 2 positional " "arguments ({} given)".format(len(args))) @@ -536,6 +581,7 @@ self[key] = value def setdefault(self, key, default=None): + 'D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D' try: return self[key] except KeyError: @@ -583,12 +629,16 @@ yield self[i] def index(self, value): + '''S.index(value) -> integer -- return first index of value. + Raises ValueError if the value is not present. + ''' for i, v in enumerate(self): if v == value: return i raise ValueError def count(self, value): + 'S.count(value) -> integer -- return number of occurrences of value' return sum(1 for v in self if v == value) Sequence.register(tuple) @@ -613,6 +663,13 @@ __slots__ = () + """All the operations on a read-only sequence. + + Concrete subclasses must provide __new__ or __init__, + __getitem__, __setitem__, __delitem__, __len__, and insert(). + + """ + @abstractmethod def __setitem__(self, index, value): raise IndexError @@ -623,12 +680,15 @@ @abstractmethod def insert(self, index, value): + 'S.insert(index, value) -- insert value before index' raise IndexError def append(self, value): + 'S.append(value) -- append value to the end of the sequence' self.insert(len(self), value) def clear(self): + 'S.clear() -> None -- remove all items from S' try: while True: self.pop() @@ -636,20 +696,28 @@ pass def reverse(self): + 'S.reverse() -- reverse *IN PLACE*' n = len(self) for i in range(n//2): self[i], self[n-i-1] = self[n-i-1], self[i] def extend(self, values): + 'S.extend(iterable) -- extend sequence by appending elements from the iterable' for v in values: self.append(v) def pop(self, index=-1): + '''S.pop([index]) -> item -- remove and return item at index (default last). + Raise IndexError if list is empty or index is out of range. + ''' v = self[index] del self[index] return v def remove(self, value): + '''S.remove(value) -- remove first occurrence of value. + Raise ValueError if the value is not present. + ''' del self[self.index(value)] def __iadd__(self, values): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 24 23:22:12 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 24 Mar 2013 23:22:12 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <3ZYtPw1Md9z7Lrw@mail.python.org> http://hg.python.org/cpython/rev/c9c877086d8b changeset: 82953:c9c877086d8b parent: 82950:a626a32bd42d parent: 82952:c28b0b4e872b user: Raymond Hettinger date: Sun Mar 24 15:21:57 2013 -0700 summary: merge files: Lib/collections/abc.py | 68 ++++++++++++++++++++++++++++++ 1 files changed, 68 insertions(+), 0 deletions(-) diff --git a/Lib/collections/abc.py b/Lib/collections/abc.py --- a/Lib/collections/abc.py +++ b/Lib/collections/abc.py @@ -90,6 +90,7 @@ @abstractmethod def __next__(self): + 'Return the next item from the iterator. When exhausted, raise StopIteration' raise StopIteration def __iter__(self): @@ -230,6 +231,7 @@ return self._from_iterable(value for value in other if value in self) def isdisjoint(self, other): + 'Return True if two sets have a null intersection.' for value in other: if value in self: return False @@ -292,6 +294,16 @@ class MutableSet(Set): + """A mutable set is a finite, iterable container. + + This class provides concrete generic implementations of all + methods except for __contains__, __iter__, __len__, + add(), and discard(). + + To override the comparisons (presumably for speed, as the + semantics are fixed), all you have to do is redefine __le__ and + then the other operations will automatically follow suit. + """ __slots__ = () @@ -370,11 +382,20 @@ __slots__ = () + """A Mapping is a generic container for associating key/value + pairs. + + This class provides concrete generic implementations of all + methods except for __getitem__, __iter__, and __len__. + + """ + @abstractmethod def __getitem__(self, key): raise KeyError def get(self, key, default=None): + 'D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.' try: return self[key] except KeyError: @@ -389,12 +410,15 @@ return True def keys(self): + "D.keys() -> a set-like object providing a view on D's keys" return KeysView(self) def items(self): + "D.items() -> a set-like object providing a view on D's items" return ItemsView(self) def values(self): + "D.values() -> an object providing a view on D's values" return ValuesView(self) def __eq__(self, other): @@ -476,6 +500,15 @@ __slots__ = () + """A MutableMapping is a generic container for associating + key/value pairs. + + This class provides concrete generic implementations of all + methods except for __getitem__, __setitem__, __delitem__, + __iter__, and __len__. + + """ + @abstractmethod def __setitem__(self, key, value): raise KeyError @@ -487,6 +520,9 @@ __marker = object() def pop(self, key, default=__marker): + '''D.pop(k[,d]) -> v, remove specified key and return the corresponding value. + If key is not found, d is returned if given, otherwise KeyError is raised. + ''' try: value = self[key] except KeyError: @@ -498,6 +534,9 @@ return value def popitem(self): + '''D.popitem() -> (k, v), remove and return some (key, value) pair + as a 2-tuple; but raise KeyError if D is empty. + ''' try: key = next(iter(self)) except StopIteration: @@ -507,6 +546,7 @@ return key, value def clear(self): + 'D.clear() -> None. Remove all items from D.' try: while True: self.popitem() @@ -514,6 +554,11 @@ pass def update(*args, **kwds): + ''' D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. + If E present and has a .keys() method, does: for k in E: D[k] = E[k] + If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v + In either case, this is followed by: for k, v in F.items(): D[k] = v + ''' if len(args) > 2: raise TypeError("update() takes at most 2 positional " "arguments ({} given)".format(len(args))) @@ -535,6 +580,7 @@ self[key] = value def setdefault(self, key, default=None): + 'D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D' try: return self[key] except KeyError: @@ -582,12 +628,16 @@ yield self[i] def index(self, value): + '''S.index(value) -> integer -- return first index of value. + Raises ValueError if the value is not present. + ''' for i, v in enumerate(self): if v == value: return i raise ValueError def count(self, value): + 'S.count(value) -> integer -- return number of occurrences of value' return sum(1 for v in self if v == value) Sequence.register(tuple) @@ -612,6 +662,13 @@ __slots__ = () + """All the operations on a read-only sequence. + + Concrete subclasses must provide __new__ or __init__, + __getitem__, __setitem__, __delitem__, __len__, and insert(). + + """ + @abstractmethod def __setitem__(self, index, value): raise IndexError @@ -622,12 +679,15 @@ @abstractmethod def insert(self, index, value): + 'S.insert(index, value) -- insert value before index' raise IndexError def append(self, value): + 'S.append(value) -- append value to the end of the sequence' self.insert(len(self), value) def clear(self): + 'S.clear() -> None -- remove all items from S' try: while True: self.pop() @@ -635,20 +695,28 @@ pass def reverse(self): + 'S.reverse() -- reverse *IN PLACE*' n = len(self) for i in range(n//2): self[i], self[n-i-1] = self[n-i-1], self[i] def extend(self, values): + 'S.extend(iterable) -- extend sequence by appending elements from the iterable' for v in values: self.append(v) def pop(self, index=-1): + '''S.pop([index]) -> item -- remove and return item at index (default last). + Raise IndexError if list is empty or index is out of range. + ''' v = self[index] del self[index] return v def remove(self, value): + '''S.remove(value) -- remove first occurrence of value. + Raise ValueError if the value is not present. + ''' del self[self.index(value)] def __iadd__(self, values): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 25 01:48:07 2013 From: python-checkins at python.org (guido.van.rossum) Date: Mon, 25 Mar 2013 01:48:07 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Clarify_exactly_how_vague_the?= =?utf-8?q?_spec_for_stop=28=29_really_is=2E?= Message-ID: <3ZYxfH282Pz7Lny@mail.python.org> http://hg.python.org/peps/rev/98eb80da3c9f changeset: 4821:98eb80da3c9f user: Guido van Rossum date: Sun Mar 24 17:48:02 2013 -0700 summary: Clarify exactly how vague the spec for stop() really is. files: pep-3156.txt | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pep-3156.txt b/pep-3156.txt --- a/pep-3156.txt +++ b/pep-3156.txt @@ -221,8 +221,13 @@ - ``stop()``. Stops the event loop as soon as it is convenient. It is fine to restart the loop with ``run()`` or ``run_until_complete()`` subsequently; no scheduled callbacks will be lost if this happens. - - Note: How soon the event loop stops is up to the implementation. + Note: ``stop()`` returns normally and the current callback is + allowed to continue. How soon after this point the event loop stops + is up to the implementation, but the intention is to stop short of + polling for I/O, and not to run any callbacks scheduled in the + future; the major freedom an implementation has is how much of the + "ready queue" (callbacks already scheduled with ``call_soon()``) it + processes before stopping. - ``close()``. Closes the event loop, releasing any resources it may hold, such as the file descriptor used by ``epoll()`` or -- Repository URL: http://hg.python.org/peps From solipsis at pitrou.net Mon Mar 25 05:51:59 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 25 Mar 2013 05:51:59 +0100 Subject: [Python-checkins] Daily reference leaks (c9c877086d8b): sum=12 Message-ID: results for c9c877086d8b on branch "default" -------------------------------------------- test_concurrent_futures leaked [2, 1, 1] memory blocks, sum=4 test_imaplib leaked [0, 0, 3] references, sum=3 test_imaplib leaked [0, 4, 1] memory blocks, sum=5 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogpvTu7V', '-x'] From python-checkins at python.org Mon Mar 25 18:21:20 2013 From: python-checkins at python.org (charles-francois.natali) Date: Mon, 25 Mar 2013 18:21:20 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317025=3A_multipro?= =?utf-8?q?cessing=3A_Reduce_Queue_and_SimpleQueue_contention=2E?= Message-ID: <3ZZMhJ17nGzNx2@mail.python.org> http://hg.python.org/cpython/rev/5022ee7e13a2 changeset: 82954:5022ee7e13a2 user: Charles-Fran?ois Natali date: Mon Mar 25 18:20:40 2013 +0100 summary: Issue #17025: multiprocessing: Reduce Queue and SimpleQueue contention. files: Lib/multiprocessing/queues.py | 69 ++++++++-------------- Misc/NEWS | 2 + 2 files changed, 28 insertions(+), 43 deletions(-) diff --git a/Lib/multiprocessing/queues.py b/Lib/multiprocessing/queues.py --- a/Lib/multiprocessing/queues.py +++ b/Lib/multiprocessing/queues.py @@ -22,7 +22,7 @@ from multiprocessing.connection import Pipe from multiprocessing.synchronize import Lock, BoundedSemaphore, Semaphore, Condition from multiprocessing.util import debug, info, Finalize, register_after_fork -from multiprocessing.forking import assert_spawning +from multiprocessing.forking import assert_spawning, ForkingPickler # # Queue type using a pipe, buffer and thread @@ -69,8 +69,8 @@ self._joincancelled = False self._closed = False self._close = None - self._send = self._writer.send - self._recv = self._reader.recv + self._send_bytes = self._writer.send_bytes + self._recv_bytes = self._reader.recv_bytes self._poll = self._reader.poll def put(self, obj, block=True, timeout=None): @@ -89,14 +89,9 @@ def get(self, block=True, timeout=None): if block and timeout is None: - self._rlock.acquire() - try: - res = self._recv() - self._sem.release() - return res - finally: - self._rlock.release() - + with self._rlock: + res = self._recv_bytes() + self._sem.release() else: if block: deadline = time.time() + timeout @@ -109,11 +104,12 @@ raise Empty elif not self._poll(): raise Empty - res = self._recv() + res = self._recv_bytes() self._sem.release() - return res finally: self._rlock.release() + # unserialize the data after having released the lock + return ForkingPickler.loads(res) def qsize(self): # Raises NotImplementedError on Mac OSX because of broken sem_getvalue() @@ -158,7 +154,7 @@ self._buffer.clear() self._thread = threading.Thread( target=Queue._feed, - args=(self._buffer, self._notempty, self._send, + args=(self._buffer, self._notempty, self._send_bytes, self._wlock, self._writer.close, self._ignore_epipe), name='QueueFeederThread' ) @@ -210,7 +206,7 @@ notempty.release() @staticmethod - def _feed(buffer, notempty, send, writelock, close, ignore_epipe): + def _feed(buffer, notempty, send_bytes, writelock, close, ignore_epipe): debug('starting thread to feed data to pipe') from .util import is_exiting @@ -241,16 +237,14 @@ close() return + # serialize the data before acquiring the lock + obj = ForkingPickler.dumps(obj) if wacquire is None: - send(obj) - # Delete references to object. See issue16284 - del obj + send_bytes(obj) else: wacquire() try: - send(obj) - # Delete references to object. See issue16284 - del obj + send_bytes(obj) finally: wrelease() except IndexError: @@ -344,7 +338,6 @@ self._wlock = None else: self._wlock = Lock() - self._make_methods() def empty(self): return not self._poll() @@ -355,29 +348,19 @@ def __setstate__(self, state): (self._reader, self._writer, self._rlock, self._wlock) = state - self._make_methods() - def _make_methods(self): - recv = self._reader.recv - racquire, rrelease = self._rlock.acquire, self._rlock.release - def get(): - racquire() - try: - return recv() - finally: - rrelease() - self.get = get + def get(self): + with self._rlock: + res = self._reader.recv_bytes() + # unserialize the data after having released the lock + return ForkingPickler.loads(res) + def put(self, obj): + # serialize the data before acquiring the lock + obj = ForkingPickler.dumps(obj) if self._wlock is None: # writes to a message oriented win32 pipe are atomic - self.put = self._writer.send + self._writer.send_bytes(obj) else: - send = self._writer.send - wacquire, wrelease = self._wlock.acquire, self._wlock.release - def put(obj): - wacquire() - try: - return send(obj) - finally: - wrelease() - self.put = put + with self._wlock: + self._writer.send_bytes(obj) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -294,6 +294,8 @@ Library ------- +- Issue #17025: multiprocessing: Reduce Queue and SimpleQueue contention. + - Issue #17536: Add to webbrowser's browser list: www-browser, x-www-browser, iceweasel, iceape. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Mar 25 22:27:18 2013 From: python-checkins at python.org (brett.cannon) Date: Mon, 25 Mar 2013 22:27:18 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Fix_typo_as_submitted_by_Etha?= =?utf-8?q?n_Furman?= Message-ID: <3ZZT862C6WzP2P@mail.python.org> http://hg.python.org/peps/rev/b570a13d756d changeset: 4822:b570a13d756d user: Brett Cannon date: Mon Mar 25 17:27:15 2013 -0400 summary: Fix typo as submitted by Ethan Furman files: pep-0409.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0409.txt b/pep-0409.txt --- a/pep-0409.txt +++ b/pep-0409.txt @@ -72,7 +72,7 @@ Proposal ======== -I proprose going with the second option:: +I propose going with the second option:: raise NewException from None -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Mon Mar 25 22:29:32 2013 From: python-checkins at python.org (brett.cannon) Date: Mon, 25 Mar 2013 22:29:32 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?benchmarks=3A_Issue_=2317317=3A_Have_?= =?utf-8?q?the_benchmark_count_from_-h_properly_reflect_the?= Message-ID: <3ZZTBh1y1bzP2P@mail.python.org> http://hg.python.org/benchmarks/rev/3be9e07a2df4 changeset: 194:3be9e07a2df4 user: Brett Cannon date: Mon Mar 25 17:29:26 2013 -0400 summary: Issue #17317: Have the benchmark count from -h properly reflect the total benchmarks per target. Initial patch by Anuj Gupta. files: perf.py | 20 ++++++++++++++++---- test_perf.py | 35 ++++++++++++++++++++++++----------- 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/perf.py b/perf.py --- a/perf.py +++ b/perf.py @@ -2109,7 +2109,7 @@ "regex", "richards", "spectral_norm", "startup_nosite", "telco", "threading", "unpack_sequence"], # After 2to3-conversion - "py3k": ["2to3", "2n3", "chameleon", "mako_v2"] + "py3k": ["2to3", "2n3", "chameleon", "mako_v2"], } SLOW_BENCHMARKS = ["hexiom2"] @@ -2138,6 +2138,7 @@ Args: benchmarks_opt: the string passed to the -b option on the command line. + bench_groups: the collection of benchmark groups to pull from Returns: A set() of the names of the benchmarks to run. @@ -2215,19 +2216,30 @@ parser.values.output_style = value -def main(argv, bench_funcs=BENCH_FUNCS, bench_groups=BENCH_GROUPS): +def CreateBenchGroups(bench_funcs=BENCH_FUNCS, bench_groups=BENCH_GROUPS): bench_groups = bench_groups.copy() all_benchmarks = bench_funcs.keys() bench_groups["all"] = all_benchmarks + return bench_groups + + +def main(argv, bench_funcs=BENCH_FUNCS, bench_groups=BENCH_GROUPS): + bench_groups = CreateBenchGroups(bench_funcs, bench_groups) + + # Calculate the lengths of expanded benchmark names for all groups + bench_counts = {} + for name in bench_groups: + bench_counts[name] = sum(1 for _ in + _ExpandBenchmarkName(name, bench_groups)) # Prettify the displayed benchmark list: first the benchmark groups by # decreasing number of benches, then individual benchmarks by # lexicographic order. pretty_benchmarks = ["%s(%d)" % (name, nbenchs) for nbenchs, name in sorted( - ((len(v), k) for (k, v) in bench_groups.items()), + ((v, k) for (k, v) in bench_counts.items()), reverse=True)] - pretty_benchmarks.extend(sorted(all_benchmarks)) + pretty_benchmarks.extend(sorted(bench_groups["all"])) parser = optparse.OptionParser( usage="%prog [options] baseline_python changed_python", diff --git a/test_perf.py b/test_perf.py --- a/test_perf.py +++ b/test_perf.py @@ -112,36 +112,49 @@ def testParseBenchmarksOption(self): # perf.py, no -b option. - should_run = perf.ParseBenchmarksOption("") - self.assertEqual(should_run, set(["2to3", "django", "slowpickle", - "slowspitfire", "slowunpickle"])) + bench_groups = perf.CreateBenchGroups() + should_run = perf.ParseBenchmarksOption("", bench_groups) + self.assertEqual(should_run, set(["2to3", "django", "nbody", + "slowpickle", "slowspitfire", + "slowunpickle", "spambayes"])) # perf.py -b 2to3 - should_run = perf.ParseBenchmarksOption("2to3") + should_run = perf.ParseBenchmarksOption("2to3", bench_groups) self.assertEqual(should_run, set(["2to3"])) # perf.py -b 2to3,pybench - should_run = perf.ParseBenchmarksOption("2to3,pybench") + should_run = perf.ParseBenchmarksOption("2to3,pybench", bench_groups) self.assertEqual(should_run, set(["2to3", "pybench"])) # perf.py -b -2to3 - should_run = perf.ParseBenchmarksOption("-2to3") - self.assertEqual(should_run, set(["django", "slowspitfire", - "slowpickle", "slowunpickle"])) + should_run = perf.ParseBenchmarksOption("-2to3", bench_groups) + self.assertEqual(should_run, set(["django", "nbody", "slowspitfire", + "slowpickle", "slowunpickle", + "spambayes"])) # perf.py -b all - should_run = perf.ParseBenchmarksOption("all") + should_run = perf.ParseBenchmarksOption("all", bench_groups) self.assertTrue("django" in should_run, should_run) self.assertTrue("pybench" in should_run, should_run) # perf.py -b -2to3,all - should_run = perf.ParseBenchmarksOption("-2to3,all") + should_run = perf.ParseBenchmarksOption("-2to3,all", bench_groups) self.assertTrue("django" in should_run, should_run) self.assertTrue("pybench" in should_run, should_run) self.assertFalse("2to3" in should_run, should_run) # Error conditions - self.assertRaises(ValueError, perf.ParseBenchmarksOption, "-all") + self.assertRaises(ValueError, perf.ParseBenchmarksOption, "-all", + bench_groups) + + + def testBenchmarkCounts(self): + bench_groups = {"top": ["middle1", "middle2"], + "middle1": ["bottom1", "bottom2"], + "middle2": ["bottom3"]} + found = list(perf._ExpandBenchmarkName("top", bench_groups)) + self.assertEqual(["bottom1", "bottom2", "bottom3"], found) + if __name__ == "__main__": unittest.main() -- Repository URL: http://hg.python.org/benchmarks From python-checkins at python.org Mon Mar 25 22:51:12 2013 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 25 Mar 2013 22:51:12 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_fix_indentation?= Message-ID: <3ZZTgh0zm0zPDQ@mail.python.org> http://hg.python.org/peps/rev/cff144873bf3 changeset: 4823:cff144873bf3 user: Benjamin Peterson date: Mon Mar 25 17:51:06 2013 -0400 summary: fix indentation files: pep-0434.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0434.txt b/pep-0434.txt --- a/pep-0434.txt +++ b/pep-0434.txt @@ -164,7 +164,7 @@ (http://bugs.python.org/issue10405) .. [4] IDLE: calltips mishandle raw strings and other examples, - Reedy, Terry + Reedy, Terry (http://bugs.python.org/issue12510) .. [5] IDLE: replace ending with '\' causes crash, Reedy, Terry -- Repository URL: http://hg.python.org/peps From brett at python.org Mon Mar 25 23:00:25 2013 From: brett at python.org (Brett Cannon) Date: Mon, 25 Mar 2013 18:00:25 -0400 Subject: [Python-checkins] Django 1.5 now in the benchmark suite Message-ID: Named django_v2. Another benchmark that runs on Python 2 & 3! BCC'ing python-checkins because the commit was so large that the post-commit hook rejected sending an email about it. -------------- next part -------------- An HTML attachment was scrubbed... URL: From python-checkins at python.org Tue Mar 26 00:38:44 2013 From: python-checkins at python.org (vinay.sajip) Date: Tue, 26 Mar 2013 00:38:44 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyNzE4?= =?utf-8?q?=3A_Set_importer_on_instance_if_Python_function=2C_to_avoid_bad?= Message-ID: <3ZZX3m3HCTzNlv@mail.python.org> http://hg.python.org/cpython/rev/e35eafc872cd changeset: 82955:e35eafc872cd branch: 2.7 parent: 82951:6fc9103d55f0 user: Vinay Sajip date: Mon Mar 25 23:37:41 2013 +0000 summary: Issue #12718: Set importer on instance if Python function, to avoid bad interaction with winpdb. files: Lib/logging/config.py | 6 ++++++ Misc/NEWS | 3 +++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/Lib/logging/config.py b/Lib/logging/config.py --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -379,6 +379,12 @@ def __init__(self, config): self.config = ConvertingDict(config) self.config.configurator = self + # Issue 12718: winpdb replaces __import__ with a Python function, which + # ends up being treated as a bound method. To avoid problems, we + # set the importer on the instance, but leave it defined in the class + # so existing code doesn't break + if type(__import__) == types.FunctionType: + self.importer = __import__ def resolve(self, s): """ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -247,6 +247,9 @@ Library ------- +- Issue #12718: Fix interaction with winpdb overriding __import__ by setting + importer attribute on BaseConfigurator instance. + - Issue #17521: Corrected non-enabling of logger following two calls to fileConfig(). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 01:00:10 2013 From: python-checkins at python.org (ezio.melotti) Date: Tue, 26 Mar 2013 01:00:10 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbjogIzE3MzIzOiBUaGUgIltYIHJl?= =?utf-8?q?fs=2C_Y_blocks=5D=22_printed_by_debug_builds_has_been_disabled_?= =?utf-8?q?by?= Message-ID: <3ZZXXV0xZJzPP1@mail.python.org> http://hg.python.org/cpython/rev/367167f93c30 changeset: 82956:367167f93c30 parent: 82954:5022ee7e13a2 user: Ezio Melotti date: Tue Mar 26 01:59:56 2013 +0200 summary: #17323: The "[X refs, Y blocks]" printed by debug builds has been disabled by default. It can be re-enabled with the `-X showrefcount` option. files: Doc/using/cmdline.rst | 14 ++++++++++-- Lib/test/test_cmd_line.py | 28 +++++++++++++++++++++++++++ Misc/NEWS | 3 ++ Python/pythonrun.c | 24 +++++++++++++++++++--- 4 files changed, 62 insertions(+), 7 deletions(-) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -358,13 +358,21 @@ .. cmdoption:: -X Reserved for various implementation-specific options. CPython currently - defines just one, you can use ``-X faulthander`` to enable - :data:`faulthandler`. It also allows to pass arbitrary values and retrieve - them through the :data:`sys._xoptions` dictionary. + defines two possible values: + + * ``-X faulthander`` to enable :mod:`faulthandler`; + * ``-X showrefcount`` to enable the output of the total reference count + and memory blocks (only works on debug builds); + + It also allows to pass arbitrary values and retrieve them through the + :data:`sys._xoptions` dictionary. .. versionchanged:: 3.2 It is now allowed to pass :option:`-X` with CPython. + .. versionadded:: 3.4 + The ``-X showrefcount`` option. + Options you shouldn't use ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -62,6 +62,34 @@ opts = eval(out.splitlines()[0]) self.assertEqual(opts, {'a': True, 'b': 'c,d=e'}) + def test_showrefcount(self): + def run_python(*args): + # this is similar to assert_python_ok but doesn't strip + # the refcount from stderr. It can be replaced once + # assert_python_ok stops doing that. + cmd = [sys.executable] + cmd.extend(args) + PIPE = subprocess.PIPE + p = subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE) + out, err = p.communicate() + p.stdout.close() + p.stderr.close() + rc = p.returncode + self.assertEqual(rc, 0) + return rc, out, err + code = 'import sys; print(sys._xoptions)' + # normally the refcount is hidden + rc, out, err = run_python('-c', code) + self.assertEqual(out.rstrip(), b'{}') + self.assertEqual(err, b'') + # "-X showrefcount" shows the refcount, but only in debug builds + rc, out, err = run_python('-X', 'showrefcount', '-c', code) + self.assertEqual(out.rstrip(), b"{'showrefcount': True}") + if hasattr(sys, 'gettotalrefcount'): # debug build + self.assertRegex(err, br'^\[\d+ refs, \d+ blocks\]') + else: + self.assertEqual(err, b'') + def test_run_module(self): # Test expected operation of the '-m' switch # Switch needs an argument diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #17323: The "[X refs, Y blocks]" printed by debug builds has been + disabled by default. It can be re-enabled with the `-X showrefcount` option. + - Issue #17522: Add the PyGILState_Check() API. - Issue #16475: Support object instancing, recursion and interned strings diff --git a/Python/pythonrun.c b/Python/pythonrun.c --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -35,13 +35,29 @@ #define PATH_MAX MAXPATHLEN #endif +#ifdef Py_REF_DEBUG +void _print_total_refs() { + PyObject *xoptions, *key, *value; + xoptions = PySys_GetXOptions(); + if (xoptions == NULL) + return; + key = PyUnicode_FromString("showrefcount"); + if (key == NULL) + return; + value = PyDict_GetItem(xoptions, key); + Py_DECREF(key); + if (value == Py_True) + fprintf(stderr, + "[%" PY_FORMAT_SIZE_T "d refs, " + "%" PY_FORMAT_SIZE_T "d blocks]\n", + _Py_GetRefTotal(), _Py_GetAllocatedBlocks()); +} +#endif + #ifndef Py_REF_DEBUG #define PRINT_TOTAL_REFS() #else /* Py_REF_DEBUG */ -#define PRINT_TOTAL_REFS() fprintf(stderr, \ - "[%" PY_FORMAT_SIZE_T "d refs, " \ - "%" PY_FORMAT_SIZE_T "d blocks]\n", \ - _Py_GetRefTotal(), _Py_GetAllocatedBlocks()) +#define PRINT_TOTAL_REFS() _print_total_refs() #endif #ifdef __cplusplus -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 01:16:01 2013 From: python-checkins at python.org (victor.stinner) Date: Tue, 26 Mar 2013 01:16:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317516=3A_use_comm?= =?utf-8?q?ent_syntax_for_comments=2C_instead_of_multiline_string?= Message-ID: <3ZZXtn5JbWzPSZ@mail.python.org> http://hg.python.org/cpython/rev/313bcff51900 changeset: 82957:313bcff51900 user: Victor Stinner date: Tue Mar 26 01:11:54 2013 +0100 summary: Issue #17516: use comment syntax for comments, instead of multiline string files: Lib/ctypes/__init__.py | 20 +- Lib/ctypes/test/test_internals.py | 19 +- Lib/ctypes/test/test_macholib.py | 56 +- Lib/datetime.py | 390 +++++++++--------- Lib/email/_header_value_parser.py | 34 +- Lib/importlib/_bootstrap.py | 187 ++++---- Lib/logging/handlers.py | 7 +- Lib/pickletools.py | 223 +++++----- Lib/test/test_getargs2.py | 60 +- Lib/xml/etree/ElementTree.py | 2 +- Tools/scripts/reindent.py | 2 +- 11 files changed, 493 insertions(+), 507 deletions(-) diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py --- a/Lib/ctypes/__init__.py +++ b/Lib/ctypes/__init__.py @@ -34,17 +34,15 @@ FUNCFLAG_USE_ERRNO as _FUNCFLAG_USE_ERRNO, \ FUNCFLAG_USE_LASTERROR as _FUNCFLAG_USE_LASTERROR -""" -WINOLEAPI -> HRESULT -WINOLEAPI_(type) - -STDMETHODCALLTYPE - -STDMETHOD(name) -STDMETHOD_(type, name) - -STDAPICALLTYPE -""" +# WINOLEAPI -> HRESULT +# WINOLEAPI_(type) +# +# STDMETHODCALLTYPE +# +# STDMETHOD(name) +# STDMETHOD_(type, name) +# +# STDAPICALLTYPE def create_string_buffer(init, size=None): """create_string_buffer(aBytes) -> character array diff --git a/Lib/ctypes/test/test_internals.py b/Lib/ctypes/test/test_internals.py --- a/Lib/ctypes/test/test_internals.py +++ b/Lib/ctypes/test/test_internals.py @@ -5,17 +5,14 @@ # XXX This test must be reviewed for correctness!!! -""" -ctypes' types are container types. - -They have an internal memory block, which only consists of some bytes, -but it has to keep references to other objects as well. This is not -really needed for trivial C types like int or char, but it is important -for aggregate types like strings or pointers in particular. - -What about pointers? - -""" +# ctypes' types are container types. +# +# They have an internal memory block, which only consists of some bytes, +# but it has to keep references to other objects as well. This is not +# really needed for trivial C types like int or char, but it is important +# for aggregate types like strings or pointers in particular. +# +# What about pointers? class ObjectsTestCase(unittest.TestCase): def assertSame(self, a, b): diff --git a/Lib/ctypes/test/test_macholib.py b/Lib/ctypes/test/test_macholib.py --- a/Lib/ctypes/test/test_macholib.py +++ b/Lib/ctypes/test/test_macholib.py @@ -3,35 +3,33 @@ import unittest # Bob Ippolito: -""" -Ok.. the code to find the filename for __getattr__ should look -something like: - -import os -from macholib.dyld import dyld_find - -def find_lib(name): - possible = ['lib'+name+'.dylib', name+'.dylib', - name+'.framework/'+name] - for dylib in possible: - try: - return os.path.realpath(dyld_find(dylib)) - except ValueError: - pass - raise ValueError, "%s not found" % (name,) - -It'll have output like this: - - >>> find_lib('pthread') -'/usr/lib/libSystem.B.dylib' - >>> find_lib('z') -'/usr/lib/libz.1.dylib' - >>> find_lib('IOKit') -'/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit' - --bob - -""" +# +# Ok.. the code to find the filename for __getattr__ should look +# something like: +# +# import os +# from macholib.dyld import dyld_find +# +# def find_lib(name): +# possible = ['lib'+name+'.dylib', name+'.dylib', +# name+'.framework/'+name] +# for dylib in possible: +# try: +# return os.path.realpath(dyld_find(dylib)) +# except ValueError: +# pass +# raise ValueError, "%s not found" % (name,) +# +# It'll have output like this: +# +# >>> find_lib('pthread') +# '/usr/lib/libSystem.B.dylib' +# >>> find_lib('z') +# '/usr/lib/libz.1.dylib' +# >>> find_lib('IOKit') +# '/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit' +# +# -bob from ctypes.macholib.dyld import dyld_find diff --git a/Lib/datetime.py b/Lib/datetime.py --- a/Lib/datetime.py +++ b/Lib/datetime.py @@ -1929,203 +1929,203 @@ timezone.min = timezone._create(timezone._minoffset) timezone.max = timezone._create(timezone._maxoffset) _EPOCH = datetime(1970, 1, 1, tzinfo=timezone.utc) -""" -Some time zone algebra. For a datetime x, let - x.n = x stripped of its timezone -- its naive time. - x.o = x.utcoffset(), and assuming that doesn't raise an exception or - return None - x.d = x.dst(), and assuming that doesn't raise an exception or - return None - x.s = x's standard offset, x.o - x.d -Now some derived rules, where k is a duration (timedelta). +# Some time zone algebra. For a datetime x, let +# x.n = x stripped of its timezone -- its naive time. +# x.o = x.utcoffset(), and assuming that doesn't raise an exception or +# return None +# x.d = x.dst(), and assuming that doesn't raise an exception or +# return None +# x.s = x's standard offset, x.o - x.d +# +# Now some derived rules, where k is a duration (timedelta). +# +# 1. x.o = x.s + x.d +# This follows from the definition of x.s. +# +# 2. If x and y have the same tzinfo member, x.s = y.s. +# This is actually a requirement, an assumption we need to make about +# sane tzinfo classes. +# +# 3. The naive UTC time corresponding to x is x.n - x.o. +# This is again a requirement for a sane tzinfo class. +# +# 4. (x+k).s = x.s +# This follows from #2, and that datimetimetz+timedelta preserves tzinfo. +# +# 5. (x+k).n = x.n + k +# Again follows from how arithmetic is defined. +# +# Now we can explain tz.fromutc(x). Let's assume it's an interesting case +# (meaning that the various tzinfo methods exist, and don't blow up or return +# None when called). +# +# The function wants to return a datetime y with timezone tz, equivalent to x. +# x is already in UTC. +# +# By #3, we want +# +# y.n - y.o = x.n [1] +# +# The algorithm starts by attaching tz to x.n, and calling that y. So +# x.n = y.n at the start. Then it wants to add a duration k to y, so that [1] +# becomes true; in effect, we want to solve [2] for k: +# +# (y+k).n - (y+k).o = x.n [2] +# +# By #1, this is the same as +# +# (y+k).n - ((y+k).s + (y+k).d) = x.n [3] +# +# By #5, (y+k).n = y.n + k, which equals x.n + k because x.n=y.n at the start. +# Substituting that into [3], +# +# x.n + k - (y+k).s - (y+k).d = x.n; the x.n terms cancel, leaving +# k - (y+k).s - (y+k).d = 0; rearranging, +# k = (y+k).s - (y+k).d; by #4, (y+k).s == y.s, so +# k = y.s - (y+k).d +# +# On the RHS, (y+k).d can't be computed directly, but y.s can be, and we +# approximate k by ignoring the (y+k).d term at first. Note that k can't be +# very large, since all offset-returning methods return a duration of magnitude +# less than 24 hours. For that reason, if y is firmly in std time, (y+k).d must +# be 0, so ignoring it has no consequence then. +# +# In any case, the new value is +# +# z = y + y.s [4] +# +# It's helpful to step back at look at [4] from a higher level: it's simply +# mapping from UTC to tz's standard time. +# +# At this point, if +# +# z.n - z.o = x.n [5] +# +# we have an equivalent time, and are almost done. The insecurity here is +# at the start of daylight time. Picture US Eastern for concreteness. The wall +# time jumps from 1:59 to 3:00, and wall hours of the form 2:MM don't make good +# sense then. The docs ask that an Eastern tzinfo class consider such a time to +# be EDT (because it's "after 2"), which is a redundant spelling of 1:MM EST +# on the day DST starts. We want to return the 1:MM EST spelling because that's +# the only spelling that makes sense on the local wall clock. +# +# In fact, if [5] holds at this point, we do have the standard-time spelling, +# but that takes a bit of proof. We first prove a stronger result. What's the +# difference between the LHS and RHS of [5]? Let +# +# diff = x.n - (z.n - z.o) [6] +# +# Now +# z.n = by [4] +# (y + y.s).n = by #5 +# y.n + y.s = since y.n = x.n +# x.n + y.s = since z and y are have the same tzinfo member, +# y.s = z.s by #2 +# x.n + z.s +# +# Plugging that back into [6] gives +# +# diff = +# x.n - ((x.n + z.s) - z.o) = expanding +# x.n - x.n - z.s + z.o = cancelling +# - z.s + z.o = by #2 +# z.d +# +# So diff = z.d. +# +# If [5] is true now, diff = 0, so z.d = 0 too, and we have the standard-time +# spelling we wanted in the endcase described above. We're done. Contrarily, +# if z.d = 0, then we have a UTC equivalent, and are also done. +# +# If [5] is not true now, diff = z.d != 0, and z.d is the offset we need to +# add to z (in effect, z is in tz's standard time, and we need to shift the +# local clock into tz's daylight time). +# +# Let +# +# z' = z + z.d = z + diff [7] +# +# and we can again ask whether +# +# z'.n - z'.o = x.n [8] +# +# If so, we're done. If not, the tzinfo class is insane, according to the +# assumptions we've made. This also requires a bit of proof. As before, let's +# compute the difference between the LHS and RHS of [8] (and skipping some of +# the justifications for the kinds of substitutions we've done several times +# already): +# +# diff' = x.n - (z'.n - z'.o) = replacing z'.n via [7] +# x.n - (z.n + diff - z'.o) = replacing diff via [6] +# x.n - (z.n + x.n - (z.n - z.o) - z'.o) = +# x.n - z.n - x.n + z.n - z.o + z'.o = cancel x.n +# - z.n + z.n - z.o + z'.o = cancel z.n +# - z.o + z'.o = #1 twice +# -z.s - z.d + z'.s + z'.d = z and z' have same tzinfo +# z'.d - z.d +# +# So z' is UTC-equivalent to x iff z'.d = z.d at this point. If they are equal, +# we've found the UTC-equivalent so are done. In fact, we stop with [7] and +# return z', not bothering to compute z'.d. +# +# How could z.d and z'd differ? z' = z + z.d [7], so merely moving z' by +# a dst() offset, and starting *from* a time already in DST (we know z.d != 0), +# would have to change the result dst() returns: we start in DST, and moving +# a little further into it takes us out of DST. +# +# There isn't a sane case where this can happen. The closest it gets is at +# the end of DST, where there's an hour in UTC with no spelling in a hybrid +# tzinfo class. In US Eastern, that's 5:MM UTC = 0:MM EST = 1:MM EDT. During +# that hour, on an Eastern clock 1:MM is taken as being in standard time (6:MM +# UTC) because the docs insist on that, but 0:MM is taken as being in daylight +# time (4:MM UTC). There is no local time mapping to 5:MM UTC. The local +# clock jumps from 1:59 back to 1:00 again, and repeats the 1:MM hour in +# standard time. Since that's what the local clock *does*, we want to map both +# UTC hours 5:MM and 6:MM to 1:MM Eastern. The result is ambiguous +# in local time, but so it goes -- it's the way the local clock works. +# +# When x = 5:MM UTC is the input to this algorithm, x.o=0, y.o=-5 and y.d=0, +# so z=0:MM. z.d=60 (minutes) then, so [5] doesn't hold and we keep going. +# z' = z + z.d = 1:MM then, and z'.d=0, and z'.d - z.d = -60 != 0 so [8] +# (correctly) concludes that z' is not UTC-equivalent to x. +# +# Because we know z.d said z was in daylight time (else [5] would have held and +# we would have stopped then), and we know z.d != z'.d (else [8] would have held +# and we have stopped then), and there are only 2 possible values dst() can +# return in Eastern, it follows that z'.d must be 0 (which it is in the example, +# but the reasoning doesn't depend on the example -- it depends on there being +# two possible dst() outcomes, one zero and the other non-zero). Therefore +# z' must be in standard time, and is the spelling we want in this case. +# +# Note again that z' is not UTC-equivalent as far as the hybrid tzinfo class is +# concerned (because it takes z' as being in standard time rather than the +# daylight time we intend here), but returning it gives the real-life "local +# clock repeats an hour" behavior when mapping the "unspellable" UTC hour into +# tz. +# +# When the input is 6:MM, z=1:MM and z.d=0, and we stop at once, again with +# the 1:MM standard time spelling we want. +# +# So how can this break? One of the assumptions must be violated. Two +# possibilities: +# +# 1) [2] effectively says that y.s is invariant across all y belong to a given +# time zone. This isn't true if, for political reasons or continental drift, +# a region decides to change its base offset from UTC. +# +# 2) There may be versions of "double daylight" time where the tail end of +# the analysis gives up a step too early. I haven't thought about that +# enough to say. +# +# In any case, it's clear that the default fromutc() is strong enough to handle +# "almost all" time zones: so long as the standard offset is invariant, it +# doesn't matter if daylight time transition points change from year to year, or +# if daylight time is skipped in some years; it doesn't matter how large or +# small dst() may get within its bounds; and it doesn't even matter if some +# perverse time zone returns a negative dst()). So a breaking case must be +# pretty bizarre, and a tzinfo subclass can override fromutc() if it is. -1. x.o = x.s + x.d - This follows from the definition of x.s. - -2. If x and y have the same tzinfo member, x.s = y.s. - This is actually a requirement, an assumption we need to make about - sane tzinfo classes. - -3. The naive UTC time corresponding to x is x.n - x.o. - This is again a requirement for a sane tzinfo class. - -4. (x+k).s = x.s - This follows from #2, and that datimetimetz+timedelta preserves tzinfo. - -5. (x+k).n = x.n + k - Again follows from how arithmetic is defined. - -Now we can explain tz.fromutc(x). Let's assume it's an interesting case -(meaning that the various tzinfo methods exist, and don't blow up or return -None when called). - -The function wants to return a datetime y with timezone tz, equivalent to x. -x is already in UTC. - -By #3, we want - - y.n - y.o = x.n [1] - -The algorithm starts by attaching tz to x.n, and calling that y. So -x.n = y.n at the start. Then it wants to add a duration k to y, so that [1] -becomes true; in effect, we want to solve [2] for k: - - (y+k).n - (y+k).o = x.n [2] - -By #1, this is the same as - - (y+k).n - ((y+k).s + (y+k).d) = x.n [3] - -By #5, (y+k).n = y.n + k, which equals x.n + k because x.n=y.n at the start. -Substituting that into [3], - - x.n + k - (y+k).s - (y+k).d = x.n; the x.n terms cancel, leaving - k - (y+k).s - (y+k).d = 0; rearranging, - k = (y+k).s - (y+k).d; by #4, (y+k).s == y.s, so - k = y.s - (y+k).d - -On the RHS, (y+k).d can't be computed directly, but y.s can be, and we -approximate k by ignoring the (y+k).d term at first. Note that k can't be -very large, since all offset-returning methods return a duration of magnitude -less than 24 hours. For that reason, if y is firmly in std time, (y+k).d must -be 0, so ignoring it has no consequence then. - -In any case, the new value is - - z = y + y.s [4] - -It's helpful to step back at look at [4] from a higher level: it's simply -mapping from UTC to tz's standard time. - -At this point, if - - z.n - z.o = x.n [5] - -we have an equivalent time, and are almost done. The insecurity here is -at the start of daylight time. Picture US Eastern for concreteness. The wall -time jumps from 1:59 to 3:00, and wall hours of the form 2:MM don't make good -sense then. The docs ask that an Eastern tzinfo class consider such a time to -be EDT (because it's "after 2"), which is a redundant spelling of 1:MM EST -on the day DST starts. We want to return the 1:MM EST spelling because that's -the only spelling that makes sense on the local wall clock. - -In fact, if [5] holds at this point, we do have the standard-time spelling, -but that takes a bit of proof. We first prove a stronger result. What's the -difference between the LHS and RHS of [5]? Let - - diff = x.n - (z.n - z.o) [6] - -Now - z.n = by [4] - (y + y.s).n = by #5 - y.n + y.s = since y.n = x.n - x.n + y.s = since z and y are have the same tzinfo member, - y.s = z.s by #2 - x.n + z.s - -Plugging that back into [6] gives - - diff = - x.n - ((x.n + z.s) - z.o) = expanding - x.n - x.n - z.s + z.o = cancelling - - z.s + z.o = by #2 - z.d - -So diff = z.d. - -If [5] is true now, diff = 0, so z.d = 0 too, and we have the standard-time -spelling we wanted in the endcase described above. We're done. Contrarily, -if z.d = 0, then we have a UTC equivalent, and are also done. - -If [5] is not true now, diff = z.d != 0, and z.d is the offset we need to -add to z (in effect, z is in tz's standard time, and we need to shift the -local clock into tz's daylight time). - -Let - - z' = z + z.d = z + diff [7] - -and we can again ask whether - - z'.n - z'.o = x.n [8] - -If so, we're done. If not, the tzinfo class is insane, according to the -assumptions we've made. This also requires a bit of proof. As before, let's -compute the difference between the LHS and RHS of [8] (and skipping some of -the justifications for the kinds of substitutions we've done several times -already): - - diff' = x.n - (z'.n - z'.o) = replacing z'.n via [7] - x.n - (z.n + diff - z'.o) = replacing diff via [6] - x.n - (z.n + x.n - (z.n - z.o) - z'.o) = - x.n - z.n - x.n + z.n - z.o + z'.o = cancel x.n - - z.n + z.n - z.o + z'.o = cancel z.n - - z.o + z'.o = #1 twice - -z.s - z.d + z'.s + z'.d = z and z' have same tzinfo - z'.d - z.d - -So z' is UTC-equivalent to x iff z'.d = z.d at this point. If they are equal, -we've found the UTC-equivalent so are done. In fact, we stop with [7] and -return z', not bothering to compute z'.d. - -How could z.d and z'd differ? z' = z + z.d [7], so merely moving z' by -a dst() offset, and starting *from* a time already in DST (we know z.d != 0), -would have to change the result dst() returns: we start in DST, and moving -a little further into it takes us out of DST. - -There isn't a sane case where this can happen. The closest it gets is at -the end of DST, where there's an hour in UTC with no spelling in a hybrid -tzinfo class. In US Eastern, that's 5:MM UTC = 0:MM EST = 1:MM EDT. During -that hour, on an Eastern clock 1:MM is taken as being in standard time (6:MM -UTC) because the docs insist on that, but 0:MM is taken as being in daylight -time (4:MM UTC). There is no local time mapping to 5:MM UTC. The local -clock jumps from 1:59 back to 1:00 again, and repeats the 1:MM hour in -standard time. Since that's what the local clock *does*, we want to map both -UTC hours 5:MM and 6:MM to 1:MM Eastern. The result is ambiguous -in local time, but so it goes -- it's the way the local clock works. - -When x = 5:MM UTC is the input to this algorithm, x.o=0, y.o=-5 and y.d=0, -so z=0:MM. z.d=60 (minutes) then, so [5] doesn't hold and we keep going. -z' = z + z.d = 1:MM then, and z'.d=0, and z'.d - z.d = -60 != 0 so [8] -(correctly) concludes that z' is not UTC-equivalent to x. - -Because we know z.d said z was in daylight time (else [5] would have held and -we would have stopped then), and we know z.d != z'.d (else [8] would have held -and we have stopped then), and there are only 2 possible values dst() can -return in Eastern, it follows that z'.d must be 0 (which it is in the example, -but the reasoning doesn't depend on the example -- it depends on there being -two possible dst() outcomes, one zero and the other non-zero). Therefore -z' must be in standard time, and is the spelling we want in this case. - -Note again that z' is not UTC-equivalent as far as the hybrid tzinfo class is -concerned (because it takes z' as being in standard time rather than the -daylight time we intend here), but returning it gives the real-life "local -clock repeats an hour" behavior when mapping the "unspellable" UTC hour into -tz. - -When the input is 6:MM, z=1:MM and z.d=0, and we stop at once, again with -the 1:MM standard time spelling we want. - -So how can this break? One of the assumptions must be violated. Two -possibilities: - -1) [2] effectively says that y.s is invariant across all y belong to a given - time zone. This isn't true if, for political reasons or continental drift, - a region decides to change its base offset from UTC. - -2) There may be versions of "double daylight" time where the tail end of - the analysis gives up a step too early. I haven't thought about that - enough to say. - -In any case, it's clear that the default fromutc() is strong enough to handle -"almost all" time zones: so long as the standard offset is invariant, it -doesn't matter if daylight time transition points change from year to year, or -if daylight time is skipped in some years; it doesn't matter how large or -small dst() may get within its bounds; and it doesn't even matter if some -perverse time zone returns a negative dst()). So a breaking case must be -pretty bizarre, and a tzinfo subclass can override fromutc() if it is. -""" try: from _datetime import * except ImportError: diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py --- a/Lib/email/_header_value_parser.py +++ b/Lib/email/_header_value_parser.py @@ -1317,24 +1317,22 @@ # Parser # -"""Parse strings according to RFC822/2047/2822/5322 rules. - -This is a stateless parser. Each get_XXX function accepts a string and -returns either a Terminal or a TokenList representing the RFC object named -by the method and a string containing the remaining unparsed characters -from the input. Thus a parser method consumes the next syntactic construct -of a given type and returns a token representing the construct plus the -unparsed remainder of the input string. - -For example, if the first element of a structured header is a 'phrase', -then: - - phrase, value = get_phrase(value) - -returns the complete phrase from the start of the string value, plus any -characters left in the string after the phrase is removed. - -""" +# Parse strings according to RFC822/2047/2822/5322 rules. +# +# This is a stateless parser. Each get_XXX function accepts a string and +# returns either a Terminal or a TokenList representing the RFC object named +# by the method and a string containing the remaining unparsed characters +# from the input. Thus a parser method consumes the next syntactic construct +# of a given type and returns a token representing the construct plus the +# unparsed remainder of the input string. +# +# For example, if the first element of a structured header is a 'phrase', +# then: +# +# phrase, value = get_phrase(value) +# +# returns the complete phrase from the start of the string value, plus any +# characters left in the string after the phrase is removed. _wsp_splitter = re.compile(r'([{}]+)'.format(''.join(WSP))).split _non_atom_end_matcher = re.compile(r"[^{}]+".format( diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -299,101 +299,100 @@ # Finder/loader utility code ############################################### -"""Magic word to reject .pyc files generated by other Python versions. -It should change for each incompatible change to the bytecode. +# Magic word to reject .pyc files generated by other Python versions. +# It should change for each incompatible change to the bytecode. +# +# The value of CR and LF is incorporated so if you ever read or write +# a .pyc file in text mode the magic number will be wrong; also, the +# Apple MPW compiler swaps their values, botching string constants. +# +# The magic numbers must be spaced apart at least 2 values, as the +# -U interpeter flag will cause MAGIC+1 being used. They have been +# odd numbers for some time now. +# +# There were a variety of old schemes for setting the magic number. +# The current working scheme is to increment the previous value by +# 10. +# +# Starting with the adoption of PEP 3147 in Python 3.2, every bump in magic +# number also includes a new "magic tag", i.e. a human readable string used +# to represent the magic number in __pycache__ directories. When you change +# the magic number, you must also set a new unique magic tag. Generally this +# can be named after the Python major version of the magic number bump, but +# it can really be anything, as long as it's different than anything else +# that's come before. The tags are included in the following table, starting +# with Python 3.2a0. +# +# Known values: +# Python 1.5: 20121 +# Python 1.5.1: 20121 +# Python 1.5.2: 20121 +# Python 1.6: 50428 +# Python 2.0: 50823 +# Python 2.0.1: 50823 +# Python 2.1: 60202 +# Python 2.1.1: 60202 +# Python 2.1.2: 60202 +# Python 2.2: 60717 +# Python 2.3a0: 62011 +# Python 2.3a0: 62021 +# Python 2.3a0: 62011 (!) +# Python 2.4a0: 62041 +# Python 2.4a3: 62051 +# Python 2.4b1: 62061 +# Python 2.5a0: 62071 +# Python 2.5a0: 62081 (ast-branch) +# Python 2.5a0: 62091 (with) +# Python 2.5a0: 62092 (changed WITH_CLEANUP opcode) +# Python 2.5b3: 62101 (fix wrong code: for x, in ...) +# Python 2.5b3: 62111 (fix wrong code: x += yield) +# Python 2.5c1: 62121 (fix wrong lnotab with for loops and +# storing constants that should have been removed) +# Python 2.5c2: 62131 (fix wrong code: for x, in ... in listcomp/genexp) +# Python 2.6a0: 62151 (peephole optimizations and STORE_MAP opcode) +# Python 2.6a1: 62161 (WITH_CLEANUP optimization) +# Python 2.7a0: 62171 (optimize list comprehensions/change LIST_APPEND) +# Python 2.7a0: 62181 (optimize conditional branches: +# introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE) +# Python 2.7a0 62191 (introduce SETUP_WITH) +# Python 2.7a0 62201 (introduce BUILD_SET) +# Python 2.7a0 62211 (introduce MAP_ADD and SET_ADD) +# Python 3000: 3000 +# 3010 (removed UNARY_CONVERT) +# 3020 (added BUILD_SET) +# 3030 (added keyword-only parameters) +# 3040 (added signature annotations) +# 3050 (print becomes a function) +# 3060 (PEP 3115 metaclass syntax) +# 3061 (string literals become unicode) +# 3071 (PEP 3109 raise changes) +# 3081 (PEP 3137 make __file__ and __name__ unicode) +# 3091 (kill str8 interning) +# 3101 (merge from 2.6a0, see 62151) +# 3103 (__file__ points to source file) +# Python 3.0a4: 3111 (WITH_CLEANUP optimization). +# Python 3.0a5: 3131 (lexical exception stacking, including POP_EXCEPT) +# Python 3.1a0: 3141 (optimize list, set and dict comprehensions: +# change LIST_APPEND and SET_ADD, add MAP_ADD) +# Python 3.1a0: 3151 (optimize conditional branches: +# introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE) +# Python 3.2a0: 3160 (add SETUP_WITH) +# tag: cpython-32 +# Python 3.2a1: 3170 (add DUP_TOP_TWO, remove DUP_TOPX and ROT_FOUR) +# tag: cpython-32 +# Python 3.2a2 3180 (add DELETE_DEREF) +# Python 3.3a0 3190 __class__ super closure changed +# Python 3.3a0 3200 (__qualname__ added) +# 3210 (added size modulo 2**32 to the pyc header) +# Python 3.3a1 3220 (changed PEP 380 implementation) +# Python 3.3a4 3230 (revert changes to implicit __class__ closure) +# Python 3.4a1 3250 (evaluate positional default arguments before +# keyword-only defaults) +# +# MAGIC must change whenever the bytecode emitted by the compiler may no +# longer be understood by older implementations of the eval loop (usually +# due to the addition of new opcodes). -The value of CR and LF is incorporated so if you ever read or write -a .pyc file in text mode the magic number will be wrong; also, the -Apple MPW compiler swaps their values, botching string constants. - -The magic numbers must be spaced apart at least 2 values, as the --U interpeter flag will cause MAGIC+1 being used. They have been -odd numbers for some time now. - -There were a variety of old schemes for setting the magic number. -The current working scheme is to increment the previous value by -10. - -Starting with the adoption of PEP 3147 in Python 3.2, every bump in magic -number also includes a new "magic tag", i.e. a human readable string used -to represent the magic number in __pycache__ directories. When you change -the magic number, you must also set a new unique magic tag. Generally this -can be named after the Python major version of the magic number bump, but -it can really be anything, as long as it's different than anything else -that's come before. The tags are included in the following table, starting -with Python 3.2a0. - -Known values: - Python 1.5: 20121 - Python 1.5.1: 20121 - Python 1.5.2: 20121 - Python 1.6: 50428 - Python 2.0: 50823 - Python 2.0.1: 50823 - Python 2.1: 60202 - Python 2.1.1: 60202 - Python 2.1.2: 60202 - Python 2.2: 60717 - Python 2.3a0: 62011 - Python 2.3a0: 62021 - Python 2.3a0: 62011 (!) - Python 2.4a0: 62041 - Python 2.4a3: 62051 - Python 2.4b1: 62061 - Python 2.5a0: 62071 - Python 2.5a0: 62081 (ast-branch) - Python 2.5a0: 62091 (with) - Python 2.5a0: 62092 (changed WITH_CLEANUP opcode) - Python 2.5b3: 62101 (fix wrong code: for x, in ...) - Python 2.5b3: 62111 (fix wrong code: x += yield) - Python 2.5c1: 62121 (fix wrong lnotab with for loops and - storing constants that should have been removed) - Python 2.5c2: 62131 (fix wrong code: for x, in ... in listcomp/genexp) - Python 2.6a0: 62151 (peephole optimizations and STORE_MAP opcode) - Python 2.6a1: 62161 (WITH_CLEANUP optimization) - Python 2.7a0: 62171 (optimize list comprehensions/change LIST_APPEND) - Python 2.7a0: 62181 (optimize conditional branches: - introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE) - Python 2.7a0 62191 (introduce SETUP_WITH) - Python 2.7a0 62201 (introduce BUILD_SET) - Python 2.7a0 62211 (introduce MAP_ADD and SET_ADD) - Python 3000: 3000 - 3010 (removed UNARY_CONVERT) - 3020 (added BUILD_SET) - 3030 (added keyword-only parameters) - 3040 (added signature annotations) - 3050 (print becomes a function) - 3060 (PEP 3115 metaclass syntax) - 3061 (string literals become unicode) - 3071 (PEP 3109 raise changes) - 3081 (PEP 3137 make __file__ and __name__ unicode) - 3091 (kill str8 interning) - 3101 (merge from 2.6a0, see 62151) - 3103 (__file__ points to source file) - Python 3.0a4: 3111 (WITH_CLEANUP optimization). - Python 3.0a5: 3131 (lexical exception stacking, including POP_EXCEPT) - Python 3.1a0: 3141 (optimize list, set and dict comprehensions: - change LIST_APPEND and SET_ADD, add MAP_ADD) - Python 3.1a0: 3151 (optimize conditional branches: - introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE) - Python 3.2a0: 3160 (add SETUP_WITH) - tag: cpython-32 - Python 3.2a1: 3170 (add DUP_TOP_TWO, remove DUP_TOPX and ROT_FOUR) - tag: cpython-32 - Python 3.2a2 3180 (add DELETE_DEREF) - Python 3.3a0 3190 __class__ super closure changed - Python 3.3a0 3200 (__qualname__ added) - 3210 (added size modulo 2**32 to the pyc header) - Python 3.3a1 3220 (changed PEP 380 implementation) - Python 3.3a4 3230 (revert changes to implicit __class__ closure) - Python 3.4a1 3250 (evaluate positional default arguments before - keyword-only defaults) - -MAGIC must change whenever the bytecode emitted by the compiler may no -longer be understood by older implementations of the eval loop (usually -due to the addition of new opcodes). - -""" _MAGIC_BYTES = (3250).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(_MAGIC_BYTES, 'little') diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -825,10 +825,9 @@ msg = self.ident + msg if self.append_nul: msg += '\000' - """ - We need to convert record level to lowercase, maybe this will - change in the future. - """ + + # We need to convert record level to lowercase, maybe this will + # change in the future. prio = '<%d>' % self.encodePriority(self.facility, self.mapPriority(record.levelname)) prio = prio.encode('utf-8') diff --git a/Lib/pickletools.py b/Lib/pickletools.py --- a/Lib/pickletools.py +++ b/Lib/pickletools.py @@ -33,119 +33,118 @@ # by a later GET. -""" -"A pickle" is a program for a virtual pickle machine (PM, but more accurately -called an unpickling machine). It's a sequence of opcodes, interpreted by the -PM, building an arbitrarily complex Python object. +# "A pickle" is a program for a virtual pickle machine (PM, but more accurately +# called an unpickling machine). It's a sequence of opcodes, interpreted by the +# PM, building an arbitrarily complex Python object. +# +# For the most part, the PM is very simple: there are no looping, testing, or +# conditional instructions, no arithmetic and no function calls. Opcodes are +# executed once each, from first to last, until a STOP opcode is reached. +# +# The PM has two data areas, "the stack" and "the memo". +# +# Many opcodes push Python objects onto the stack; e.g., INT pushes a Python +# integer object on the stack, whose value is gotten from a decimal string +# literal immediately following the INT opcode in the pickle bytestream. Other +# opcodes take Python objects off the stack. The result of unpickling is +# whatever object is left on the stack when the final STOP opcode is executed. +# +# The memo is simply an array of objects, or it can be implemented as a dict +# mapping little integers to objects. The memo serves as the PM's "long term +# memory", and the little integers indexing the memo are akin to variable +# names. Some opcodes pop a stack object into the memo at a given index, +# and others push a memo object at a given index onto the stack again. +# +# At heart, that's all the PM has. Subtleties arise for these reasons: +# +# + Object identity. Objects can be arbitrarily complex, and subobjects +# may be shared (for example, the list [a, a] refers to the same object a +# twice). It can be vital that unpickling recreate an isomorphic object +# graph, faithfully reproducing sharing. +# +# + Recursive objects. For example, after "L = []; L.append(L)", L is a +# list, and L[0] is the same list. This is related to the object identity +# point, and some sequences of pickle opcodes are subtle in order to +# get the right result in all cases. +# +# + Things pickle doesn't know everything about. Examples of things pickle +# does know everything about are Python's builtin scalar and container +# types, like ints and tuples. They generally have opcodes dedicated to +# them. For things like module references and instances of user-defined +# classes, pickle's knowledge is limited. Historically, many enhancements +# have been made to the pickle protocol in order to do a better (faster, +# and/or more compact) job on those. +# +# + Backward compatibility and micro-optimization. As explained below, +# pickle opcodes never go away, not even when better ways to do a thing +# get invented. The repertoire of the PM just keeps growing over time. +# For example, protocol 0 had two opcodes for building Python integers (INT +# and LONG), protocol 1 added three more for more-efficient pickling of short +# integers, and protocol 2 added two more for more-efficient pickling of +# long integers (before protocol 2, the only ways to pickle a Python long +# took time quadratic in the number of digits, for both pickling and +# unpickling). "Opcode bloat" isn't so much a subtlety as a source of +# wearying complication. +# +# +# Pickle protocols: +# +# For compatibility, the meaning of a pickle opcode never changes. Instead new +# pickle opcodes get added, and each version's unpickler can handle all the +# pickle opcodes in all protocol versions to date. So old pickles continue to +# be readable forever. The pickler can generally be told to restrict itself to +# the subset of opcodes available under previous protocol versions too, so that +# users can create pickles under the current version readable by older +# versions. However, a pickle does not contain its version number embedded +# within it. If an older unpickler tries to read a pickle using a later +# protocol, the result is most likely an exception due to seeing an unknown (in +# the older unpickler) opcode. +# +# The original pickle used what's now called "protocol 0", and what was called +# "text mode" before Python 2.3. The entire pickle bytestream is made up of +# printable 7-bit ASCII characters, plus the newline character, in protocol 0. +# That's why it was called text mode. Protocol 0 is small and elegant, but +# sometimes painfully inefficient. +# +# The second major set of additions is now called "protocol 1", and was called +# "binary mode" before Python 2.3. This added many opcodes with arguments +# consisting of arbitrary bytes, including NUL bytes and unprintable "high bit" +# bytes. Binary mode pickles can be substantially smaller than equivalent +# text mode pickles, and sometimes faster too; e.g., BININT represents a 4-byte +# int as 4 bytes following the opcode, which is cheaper to unpickle than the +# (perhaps) 11-character decimal string attached to INT. Protocol 1 also added +# a number of opcodes that operate on many stack elements at once (like APPENDS +# and SETITEMS), and "shortcut" opcodes (like EMPTY_DICT and EMPTY_TUPLE). +# +# The third major set of additions came in Python 2.3, and is called "protocol +# 2". This added: +# +# - A better way to pickle instances of new-style classes (NEWOBJ). +# +# - A way for a pickle to identify its protocol (PROTO). +# +# - Time- and space- efficient pickling of long ints (LONG{1,4}). +# +# - Shortcuts for small tuples (TUPLE{1,2,3}}. +# +# - Dedicated opcodes for bools (NEWTRUE, NEWFALSE). +# +# - The "extension registry", a vector of popular objects that can be pushed +# efficiently by index (EXT{1,2,4}). This is akin to the memo and GET, but +# the registry contents are predefined (there's nothing akin to the memo's +# PUT). +# +# Another independent change with Python 2.3 is the abandonment of any +# pretense that it might be safe to load pickles received from untrusted +# parties -- no sufficient security analysis has been done to guarantee +# this and there isn't a use case that warrants the expense of such an +# analysis. +# +# To this end, all tests for __safe_for_unpickling__ or for +# copyreg.safe_constructors are removed from the unpickling code. +# References to these variables in the descriptions below are to be seen +# as describing unpickling in Python 2.2 and before. -For the most part, the PM is very simple: there are no looping, testing, or -conditional instructions, no arithmetic and no function calls. Opcodes are -executed once each, from first to last, until a STOP opcode is reached. - -The PM has two data areas, "the stack" and "the memo". - -Many opcodes push Python objects onto the stack; e.g., INT pushes a Python -integer object on the stack, whose value is gotten from a decimal string -literal immediately following the INT opcode in the pickle bytestream. Other -opcodes take Python objects off the stack. The result of unpickling is -whatever object is left on the stack when the final STOP opcode is executed. - -The memo is simply an array of objects, or it can be implemented as a dict -mapping little integers to objects. The memo serves as the PM's "long term -memory", and the little integers indexing the memo are akin to variable -names. Some opcodes pop a stack object into the memo at a given index, -and others push a memo object at a given index onto the stack again. - -At heart, that's all the PM has. Subtleties arise for these reasons: - -+ Object identity. Objects can be arbitrarily complex, and subobjects - may be shared (for example, the list [a, a] refers to the same object a - twice). It can be vital that unpickling recreate an isomorphic object - graph, faithfully reproducing sharing. - -+ Recursive objects. For example, after "L = []; L.append(L)", L is a - list, and L[0] is the same list. This is related to the object identity - point, and some sequences of pickle opcodes are subtle in order to - get the right result in all cases. - -+ Things pickle doesn't know everything about. Examples of things pickle - does know everything about are Python's builtin scalar and container - types, like ints and tuples. They generally have opcodes dedicated to - them. For things like module references and instances of user-defined - classes, pickle's knowledge is limited. Historically, many enhancements - have been made to the pickle protocol in order to do a better (faster, - and/or more compact) job on those. - -+ Backward compatibility and micro-optimization. As explained below, - pickle opcodes never go away, not even when better ways to do a thing - get invented. The repertoire of the PM just keeps growing over time. - For example, protocol 0 had two opcodes for building Python integers (INT - and LONG), protocol 1 added three more for more-efficient pickling of short - integers, and protocol 2 added two more for more-efficient pickling of - long integers (before protocol 2, the only ways to pickle a Python long - took time quadratic in the number of digits, for both pickling and - unpickling). "Opcode bloat" isn't so much a subtlety as a source of - wearying complication. - - -Pickle protocols: - -For compatibility, the meaning of a pickle opcode never changes. Instead new -pickle opcodes get added, and each version's unpickler can handle all the -pickle opcodes in all protocol versions to date. So old pickles continue to -be readable forever. The pickler can generally be told to restrict itself to -the subset of opcodes available under previous protocol versions too, so that -users can create pickles under the current version readable by older -versions. However, a pickle does not contain its version number embedded -within it. If an older unpickler tries to read a pickle using a later -protocol, the result is most likely an exception due to seeing an unknown (in -the older unpickler) opcode. - -The original pickle used what's now called "protocol 0", and what was called -"text mode" before Python 2.3. The entire pickle bytestream is made up of -printable 7-bit ASCII characters, plus the newline character, in protocol 0. -That's why it was called text mode. Protocol 0 is small and elegant, but -sometimes painfully inefficient. - -The second major set of additions is now called "protocol 1", and was called -"binary mode" before Python 2.3. This added many opcodes with arguments -consisting of arbitrary bytes, including NUL bytes and unprintable "high bit" -bytes. Binary mode pickles can be substantially smaller than equivalent -text mode pickles, and sometimes faster too; e.g., BININT represents a 4-byte -int as 4 bytes following the opcode, which is cheaper to unpickle than the -(perhaps) 11-character decimal string attached to INT. Protocol 1 also added -a number of opcodes that operate on many stack elements at once (like APPENDS -and SETITEMS), and "shortcut" opcodes (like EMPTY_DICT and EMPTY_TUPLE). - -The third major set of additions came in Python 2.3, and is called "protocol -2". This added: - -- A better way to pickle instances of new-style classes (NEWOBJ). - -- A way for a pickle to identify its protocol (PROTO). - -- Time- and space- efficient pickling of long ints (LONG{1,4}). - -- Shortcuts for small tuples (TUPLE{1,2,3}}. - -- Dedicated opcodes for bools (NEWTRUE, NEWFALSE). - -- The "extension registry", a vector of popular objects that can be pushed - efficiently by index (EXT{1,2,4}). This is akin to the memo and GET, but - the registry contents are predefined (there's nothing akin to the memo's - PUT). - -Another independent change with Python 2.3 is the abandonment of any -pretense that it might be safe to load pickles received from untrusted -parties -- no sufficient security analysis has been done to guarantee -this and there isn't a use case that warrants the expense of such an -analysis. - -To this end, all tests for __safe_for_unpickling__ or for -copyreg.safe_constructors are removed from the unpickling code. -References to these variables in the descriptions below are to be seen -as describing unpickling in Python 2.2 and before. -""" # Meta-rule: Descriptions are stored in instances of descriptor objects, # with plain constructors. No meta-language is defined from which diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py --- a/Lib/test/test_getargs2.py +++ b/Lib/test/test_getargs2.py @@ -2,37 +2,35 @@ from test import support from _testcapi import getargs_keywords, getargs_keyword_only -""" -> How about the following counterproposal. This also changes some of -> the other format codes to be a little more regular. -> -> Code C type Range check -> -> b unsigned char 0..UCHAR_MAX -> h signed short SHRT_MIN..SHRT_MAX -> B unsigned char none ** -> H unsigned short none ** -> k * unsigned long none -> I * unsigned int 0..UINT_MAX - - -> i int INT_MIN..INT_MAX -> l long LONG_MIN..LONG_MAX - -> K * unsigned long long none -> L long long LLONG_MIN..LLONG_MAX - -> Notes: -> -> * New format codes. -> -> ** Changed from previous "range-and-a-half" to "none"; the -> range-and-a-half checking wasn't particularly useful. - -Plus a C API or two, e.g. PyInt_AsLongMask() -> -unsigned long and PyInt_AsLongLongMask() -> unsigned -long long (if that exists). -""" +# > How about the following counterproposal. This also changes some of +# > the other format codes to be a little more regular. +# > +# > Code C type Range check +# > +# > b unsigned char 0..UCHAR_MAX +# > h signed short SHRT_MIN..SHRT_MAX +# > B unsigned char none ** +# > H unsigned short none ** +# > k * unsigned long none +# > I * unsigned int 0..UINT_MAX +# +# +# > i int INT_MIN..INT_MAX +# > l long LONG_MIN..LONG_MAX +# +# > K * unsigned long long none +# > L long long LLONG_MIN..LLONG_MAX +# +# > Notes: +# > +# > * New format codes. +# > +# > ** Changed from previous "range-and-a-half" to "none"; the +# > range-and-a-half checking wasn't particularly useful. +# +# Plus a C API or two, e.g. PyInt_AsLongMask() -> +# unsigned long and PyInt_AsLongLongMask() -> unsigned +# long long (if that exists). LARGE = 0x7FFFFFFF VERY_LARGE = 0xFF0000121212121212121242 diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -1337,8 +1337,8 @@ ids[id] = elem return tree, ids +# Parse XML document from string constant. Alias for XML(). fromstring = XML -"""Parse XML document from string constant. Alias for XML().""" def fromstringlist(sequence, parser=None): """Parse XML document from sequence of string fragments. diff --git a/Tools/scripts/reindent.py b/Tools/scripts/reindent.py --- a/Tools/scripts/reindent.py +++ b/Tools/scripts/reindent.py @@ -52,8 +52,8 @@ recurse = False dryrun = False makebackup = True +# A specified newline to be used in the output (set by --newline option) spec_newline = None -"""A specified newline to be used in the output (set by --newline option)""" def usage(msg=None): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 01:16:03 2013 From: python-checkins at python.org (victor.stinner) Date: Tue, 26 Mar 2013 01:16:03 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317516=3A_do_not_c?= =?utf-8?q?reate_useless_tuple=3A_remove_dummy_commas_in_tests?= Message-ID: <3ZZXtq23NVzPWF@mail.python.org> http://hg.python.org/cpython/rev/33bdd0a985b9 changeset: 82958:33bdd0a985b9 user: Victor Stinner date: Tue Mar 26 01:14:08 2013 +0100 summary: Issue #17516: do not create useless tuple: remove dummy commas in tests files: Lib/test/test_bisect.py | 8 ++++---- Lib/test/test_cmd_line.py | 4 ++-- Lib/test/test_long.py | 2 +- Lib/test/test_optparse.py | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Lib/test/test_bisect.py b/Lib/test/test_bisect.py --- a/Lib/test/test_bisect.py +++ b/Lib/test/test_bisect.py @@ -120,10 +120,10 @@ def test_negative_lo(self): # Issue 3301 mod = self.module - self.assertRaises(ValueError, mod.bisect_left, [1, 2, 3], 5, -1, 3), - self.assertRaises(ValueError, mod.bisect_right, [1, 2, 3], 5, -1, 3), - self.assertRaises(ValueError, mod.insort_left, [1, 2, 3], 5, -1, 3), - self.assertRaises(ValueError, mod.insort_right, [1, 2, 3], 5, -1, 3), + self.assertRaises(ValueError, mod.bisect_left, [1, 2, 3], 5, -1, 3) + self.assertRaises(ValueError, mod.bisect_right, [1, 2, 3], 5, -1, 3) + self.assertRaises(ValueError, mod.insort_left, [1, 2, 3], 5, -1, 3) + self.assertRaises(ValueError, mod.insort_right, [1, 2, 3], 5, -1, 3) def test_large_range(self): # Issue 13496 diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -98,9 +98,9 @@ assert_python_failure('-m', 'fnord43520xyz') # Check the runpy module also gives an error for # a nonexistent module - assert_python_failure('-m', 'runpy', 'fnord43520xyz'), + assert_python_failure('-m', 'runpy', 'fnord43520xyz') # All good if module is located and run successfully - assert_python_ok('-m', 'timeit', '-n', '1'), + assert_python_ok('-m', 'timeit', '-n', '1') def test_run_module_bug1764407(self): # -m and -i need to play well together diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py --- a/Lib/test/test_long.py +++ b/Lib/test/test_long.py @@ -1086,7 +1086,7 @@ self.assertRaises(OverflowError, (256).to_bytes, 1, 'big', signed=True) self.assertRaises(OverflowError, (256).to_bytes, 1, 'little', signed=False) self.assertRaises(OverflowError, (256).to_bytes, 1, 'little', signed=True) - self.assertRaises(OverflowError, (-1).to_bytes, 2, 'big', signed=False), + self.assertRaises(OverflowError, (-1).to_bytes, 2, 'big', signed=False) self.assertRaises(OverflowError, (-1).to_bytes, 2, 'little', signed=False) self.assertEqual((0).to_bytes(0, 'big'), b'') self.assertEqual((1).to_bytes(5, 'big'), b'\x00\x00\x00\x00\x01') diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py --- a/Lib/test/test_optparse.py +++ b/Lib/test/test_optparse.py @@ -730,7 +730,7 @@ def test_short_and_long_option_split(self): self.assertParseOK(["-a", "xyz", "--foo", "bar"], {'a': 'xyz', 'boo': None, 'foo': ["bar"]}, - []), + []) def test_short_option_split_long_option_append(self): self.assertParseOK(["--foo=bar", "-b", "123", "--foo", "baz"], @@ -740,15 +740,15 @@ def test_short_option_split_one_positional_arg(self): self.assertParseOK(["-a", "foo", "bar"], {'a': "foo", 'boo': None, 'foo': None}, - ["bar"]), + ["bar"]) def test_short_option_consumes_separator(self): self.assertParseOK(["-a", "--", "foo", "bar"], {'a': "--", 'boo': None, 'foo': None}, - ["foo", "bar"]), + ["foo", "bar"]) self.assertParseOK(["-a", "--", "--foo", "bar"], {'a': "--", 'boo': None, 'foo': ["bar"]}, - []), + []) def test_short_option_joined_and_separator(self): self.assertParseOK(["-ab", "--", "--foo", "bar"], -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 01:16:04 2013 From: python-checkins at python.org (victor.stinner) Date: Tue, 26 Mar 2013 01:16:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317516=3A_remove_d?= =?utf-8?q?ead_code?= Message-ID: <3ZZXtr4YGLzPTQ@mail.python.org> http://hg.python.org/cpython/rev/9dba3bc7c2a6 changeset: 82959:9dba3bc7c2a6 user: Victor Stinner date: Tue Mar 26 01:14:35 2013 +0100 summary: Issue #17516: remove dead code files: Lib/_pyio.py | 1 - Lib/sre_compile.py | 7 ------- Lib/test/test_decimal.py | 1 - 3 files changed, 0 insertions(+), 9 deletions(-) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -2054,7 +2054,6 @@ if not isinstance(initial_value, str): raise TypeError("initial_value must be str or None, not {0}" .format(type(initial_value).__name__)) - initial_value = str(initial_value) self.write(initial_value) self.seek(0) diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py --- a/Lib/sre_compile.py +++ b/Lib/sre_compile.py @@ -65,13 +65,6 @@ elif op in REPEATING_CODES: if flags & SRE_FLAG_TEMPLATE: raise error("internal: unsupported template operator") - emit(OPCODES[REPEAT]) - skip = _len(code); emit(0) - emit(av[0]) - emit(av[1]) - _compile(code, av[2], flags) - emit(OPCODES[SUCCESS]) - code[skip] = _len(code) - skip elif _simple(av) and op is not REPEAT: if op is MAX_REPEAT: emit(OPCODES[REPEAT_ONE]) diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -290,7 +290,6 @@ global skip_expected if skip_expected: raise unittest.SkipTest - return with open(file) as f: for line in f: line = line.replace('\r\n', '').replace('\n', '') -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 01:38:55 2013 From: python-checkins at python.org (ezio.melotti) Date: Tue, 26 Mar 2013 01:38:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Add_versionadd?= =?utf-8?q?ed_for_=60-X_faulthandler=60_=28also_fix_typo_and_markup=29=2E?= Message-ID: <3ZZYPC2fYkzP4x@mail.python.org> http://hg.python.org/cpython/rev/2fa791f36ec5 changeset: 82960:2fa791f36ec5 branch: 3.3 parent: 82952:c28b0b4e872b user: Ezio Melotti date: Tue Mar 26 02:36:28 2013 +0200 summary: Add versionadded for `-X faulthandler` (also fix typo and markup). files: Doc/using/cmdline.rst | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -358,13 +358,16 @@ .. cmdoption:: -X Reserved for various implementation-specific options. CPython currently - defines just one, you can use ``-X faulthander`` to enable - :data:`faulthandler`. It also allows to pass arbitrary values and retrieve + defines just one, you can use ``-X faulthandler`` to enable + :mod:`faulthandler`. It also allows to pass arbitrary values and retrieve them through the :data:`sys._xoptions` dictionary. .. versionchanged:: 3.2 It is now allowed to pass :option:`-X` with CPython. + .. versionadded:: 3.3 + The ``-X faulthandler`` option. + Options you shouldn't use ~~~~~~~~~~~~~~~~~~~~~~~~~ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 01:38:56 2013 From: python-checkins at python.org (ezio.melotti) Date: Tue, 26 Mar 2013 01:38:56 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_versionadded_addition_and_typo_fix_from_3=2E3=2E?= Message-ID: <3ZZYPD5s99zPF3@mail.python.org> http://hg.python.org/cpython/rev/3c437e591499 changeset: 82961:3c437e591499 parent: 82959:9dba3bc7c2a6 parent: 82960:2fa791f36ec5 user: Ezio Melotti date: Tue Mar 26 02:38:40 2013 +0200 summary: Merge versionadded addition and typo fix from 3.3. files: Doc/using/cmdline.rst | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -360,7 +360,7 @@ Reserved for various implementation-specific options. CPython currently defines two possible values: - * ``-X faulthander`` to enable :mod:`faulthandler`; + * ``-X faulthandler`` to enable :mod:`faulthandler`; * ``-X showrefcount`` to enable the output of the total reference count and memory blocks (only works on debug builds); @@ -370,6 +370,9 @@ .. versionchanged:: 3.2 It is now allowed to pass :option:`-X` with CPython. + .. versionadded:: 3.3 + The ``-X faulthandler`` option. + .. versionadded:: 3.4 The ``-X showrefcount`` option. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 04:53:04 2013 From: python-checkins at python.org (richard.jones) Date: Tue, 26 Mar 2013 04:53:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_updates_based_on_discussion_o?= =?utf-8?q?n_distutils-sig=3A?= Message-ID: <3ZZdjD25KfzPVT@mail.python.org> http://hg.python.org/peps/rev/0d57c70eff91 changeset: 4824:0d57c70eff91 user: Richard Jones date: Tue Mar 26 14:52:54 2013 +1100 summary: updates based on discussion on distutils-sig: - add handling of setuptools requirements in package installation - add ref to the pip issue tracking PEP implementation - re-work the structure of the PEP to make it clearer (hopefully) files: pep-0439.txt | 73 +++++++++++++++++++++++++++++++-------- 1 files changed, 58 insertions(+), 15 deletions(-) diff --git a/pep-0439.txt b/pep-0439.txt --- a/pep-0439.txt +++ b/pep-0439.txt @@ -54,7 +54,15 @@ Proposal ======== -Python install includes an executable called "pip" that attempts to +This proposal affects three components of packaging: `the pip bootstrap`_, +`setuptools`_ and, thanks to easier package installation, `modifications to +publishing packages`_. + + +The pip bootstrap +----------------- + +The Python installation includes an executable called "pip" that attempts to import pip machinery. If it can then the pip command proceeds as normal. If it cannot it will bootstrap pip by downloading the pip implementation wheel file. Once installed, the pip command proceeds @@ -72,7 +80,7 @@ the user is inside a virtual environment [1]_ then the pip implementation will be installed into that virtual environment. -The bootstrapping process will proceed as follows: +The bootstrap process will proceed as follows: 1. The user system has Python (3.4+) installed. In the "scripts" directory of the Python installation there is the bootstrap script @@ -114,11 +122,12 @@ saving the file to a cache directory or updating any local database of installed files. -The download of the pip implementation install file should be -performed securely. The transport from pypi.python.org will be done -over HTTPS but the CA certificate check will most likely not be -performed. Therefore we will utilise the embedded signature support -in the wheel format to validate the downloaded file. +The download of the pip implementation install file should be performed +securely. The transport from pypi.python.org will be done over HTTPS but the CA +certificate check will most likely not be performed, and therefore the download +would still be vulnerable to active MITM attacks. To mitigate this risk will +use the embedded signature support in the wheel format to validate the +downloaded file. Beyond those arguments controlling index location and download options, the "pip" boostrap command may support further standard pip @@ -127,7 +136,39 @@ The "--no-install" option to the "pip" command will not affect the bootstrapping process. -An additional new Python package will be proposed, "pypublish", which +setuptools +---------- + +The deprecation of requiring setuptools for installation is an existing goal of +the packaging comminity (TODO ref needed). Currently pip depends upon setuptools +functionality, and it is installed by the current pip boostrap. This PEP does +not propose installing setuptools during the new bootstrap. + +It is intended that before Python 3.4 is shipped the functionlity required by +pip will be present in Python's standard library as the distlib module, and that +pip would be modified to use that functionality when present. TODO PEP reference +for distlib + +Many existing "setup.py" files require setuptools to be installed (because one +of the first things they do is import setuptools). It is intended that pip's +behaviour will be either: + +1. If setuptools is not present it can only install from wheel files and + sdists with 2.0+ metadata, or +2. If setuptools is present it can also install from sdists with legacy + metadata and eggs + +By default, installing setuptools when necessary should be automatic so that +users are not inconvenienced, but advanced users should be able to ask that it +instead be treated as an error if no wheel is available to satisfy an +installation request or dependency (so they don't inadvertently install +setuptools on their production systems if they don't want to). + + +Modifications to publishing packages +------------------------------------ + +An additional new Python package is proposed, "pypublish", which will be a tool for publishing packages to PyPI. It would replace the current "python setup.py register" and "python setup.py upload" distutils commands. Again because of the measured Python release @@ -140,11 +181,15 @@ accompanying keychain, be made installable and upgradeable outside of Python itself. +The existing distutils mechanisms for package registration and upload would +remain, though with a deprecation warning. + Implementation ============== -TBD +The changes to pip required by this PEP are being tracked in that project's +issue tracker [2]_ Risks @@ -156,23 +201,21 @@ hoped that the Fedora community will resolve this issue by renaming the Perl installer. -Currently pip depends upon setuptools functionality. It is intended -that before Python 3.4 is shipped that the required functionlity will -be present in Python's standard library as the distlib module, and -that pip would be modified to use that functionality when present. -TODO PEP reference for distlib - The key that is used to sign the pip implementation download might be compromised and this PEP currently proposes no mechanism for key revocation. + References ========== .. [1] PEP 405, Python Virtual Environments http://www.python.org/dev/peps/pep-0405/ +.. [2] pip issue tracking work needed for this PEP + https://github.com/pypa/pip/issues/863 + Acknowledgments =============== -- Repository URL: http://hg.python.org/peps From solipsis at pitrou.net Tue Mar 26 05:52:37 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 26 Mar 2013 05:52:37 +0100 Subject: [Python-checkins] Daily reference leaks (3c437e591499): sum=-10 Message-ID: results for 3c437e591499 on branch "default" -------------------------------------------- test_imaplib leaked [-6, 0, 0] references, sum=-6 test_imaplib leaked [-7, 2, 1] memory blocks, sum=-4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogpwd8bL', '-x'] From python-checkins at python.org Tue Mar 26 13:58:30 2013 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 26 Mar 2013 13:58:30 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_fix_variable_r?= =?utf-8?q?eference_to_fix_--enable-profiling_=28closes_=2317550=29?= Message-ID: <3ZZspZ3zWZzM61@mail.python.org> http://hg.python.org/cpython/rev/27cb49ede303 changeset: 82962:27cb49ede303 branch: 2.7 parent: 82938:391e3a7db1a3 user: Benjamin Peterson date: Tue Mar 26 08:55:37 2013 -0400 summary: fix variable reference to fix --enable-profiling (closes #17550) files: Misc/NEWS | 5 +++++ configure | 2 +- configure.ac | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -6,6 +6,11 @@ *Release date: XXXX-XX-XX* +Build +----- + +- Issue #17550: Fix the --enable-profiling configure switch. + Core and Builtins ----------------- diff --git a/configure b/configure --- a/configure +++ b/configure @@ -5281,7 +5281,7 @@ if test "x$enable_profiling" = xyes; then ac_save_cc="$CC" - CC="$(CC) -pg" + CC="$CC -pg" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main() { return 0; } diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -833,7 +833,7 @@ AS_HELP_STRING([--enable-profiling], [enable C-level code profiling])) if test "x$enable_profiling" = xyes; then ac_save_cc="$CC" - CC="$(CC) -pg" + CC="$CC -pg" AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])], [], [enable_profiling=no]) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 13:58:32 2013 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 26 Mar 2013 13:58:32 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_merge_2=2E7=2E4_release_branch_=28=2317550=29?= Message-ID: <3ZZspc0dZwzNvy@mail.python.org> http://hg.python.org/cpython/rev/d321885ff8f3 changeset: 82963:d321885ff8f3 branch: 2.7 parent: 82955:e35eafc872cd parent: 82962:27cb49ede303 user: Benjamin Peterson date: Tue Mar 26 08:56:16 2013 -0400 summary: merge 2.7.4 release branch (#17550) files: Misc/NEWS | 5 +++++ configure | 2 +- configure.ac | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -18,6 +18,11 @@ *Release date: XXXX-XX-XX* +Build +----- + +- Issue #17550: Fix the --enable-profiling configure switch. + Core and Builtins ----------------- diff --git a/configure b/configure --- a/configure +++ b/configure @@ -5281,7 +5281,7 @@ if test "x$enable_profiling" = xyes; then ac_save_cc="$CC" - CC="$(CC) -pg" + CC="$CC -pg" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main() { return 0; } diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -833,7 +833,7 @@ AS_HELP_STRING([--enable-profiling], [enable C-level code profiling])) if test "x$enable_profiling" = xyes; then ac_save_cc="$CC" - CC="$(CC) -pg" + CC="$CC -pg" AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])], [], [enable_profiling=no]) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 13:58:33 2013 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 26 Mar 2013 13:58:33 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_fix_variable_r?= =?utf-8?q?eference_to_fix_--enable-profiling_=28closes_=2317550=29?= Message-ID: <3ZZspd3b0WzQ4s@mail.python.org> http://hg.python.org/cpython/rev/0decf2a812df changeset: 82964:0decf2a812df branch: 3.3 parent: 82960:2fa791f36ec5 user: Benjamin Peterson date: Tue Mar 26 08:55:37 2013 -0400 summary: fix variable reference to fix --enable-profiling (closes #17550) files: Misc/NEWS | 5 +++++ configure | 2 +- configure.ac | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,11 @@ .. *Release date: 2013-XX-XX* +Build +----- + +- Issue #17550: Fix the --enable-profiling configure switch. + Core and Builtins ----------------- diff --git a/configure b/configure --- a/configure +++ b/configure @@ -5532,7 +5532,7 @@ if test "x$enable_profiling" = xyes; then ac_save_cc="$CC" - CC="$(CC) -pg" + CC="$CC -pg" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main() { return 0; } diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -883,7 +883,7 @@ AS_HELP_STRING([--enable-profiling], [enable C-level code profiling])) if test "x$enable_profiling" = xyes; then ac_save_cc="$CC" - CC="$(CC) -pg" + CC="$CC -pg" AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])], [], [enable_profiling=no]) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 13:58:34 2013 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 26 Mar 2013 13:58:34 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_move_to_correc?= =?utf-8?q?t_section?= Message-ID: <3ZZspf6RgtzPjq@mail.python.org> http://hg.python.org/cpython/rev/a11ee592af02 changeset: 82965:a11ee592af02 branch: 3.3 user: Benjamin Peterson date: Tue Mar 26 08:57:42 2013 -0400 summary: move to correct section files: Misc/NEWS | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,11 +9,6 @@ .. *Release date: 2013-XX-XX* -Build ------ - -- Issue #17550: Fix the --enable-profiling configure switch. - Core and Builtins ----------------- @@ -816,6 +811,8 @@ Build ----- +- Issue #17550: Fix the --enable-profiling configure switch. + - Issue #17425: Build with openssl 1.0.1d on Windows. - Issue #16754: Fix the incorrect shared library extension on linux. Introduce -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 13:58:36 2013 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 26 Mar 2013 13:58:36 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy4zICgjMTc1NTAp?= Message-ID: <3ZZsph2B85zQ1w@mail.python.org> http://hg.python.org/cpython/rev/81e005a410b7 changeset: 82966:81e005a410b7 parent: 82961:3c437e591499 parent: 82965:a11ee592af02 user: Benjamin Peterson date: Tue Mar 26 08:58:16 2013 -0400 summary: merge 3.3 (#17550) files: Misc/NEWS | 2 ++ configure | 2 +- configure.ac | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1148,6 +1148,8 @@ Build ----- +- Issue #17550: Fix the --enable-profiling configure switch. + - Issue #17425: Build with openssl 1.0.1d on Windows. - Issue #16754: Fix the incorrect shared library extension on linux. Introduce diff --git a/configure b/configure --- a/configure +++ b/configure @@ -5534,7 +5534,7 @@ if test "x$enable_profiling" = xyes; then ac_save_cc="$CC" - CC="$(CC) -pg" + CC="$CC -pg" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main() { return 0; } diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -883,7 +883,7 @@ AS_HELP_STRING([--enable-profiling], [enable C-level code profiling])) if test "x$enable_profiling" = xyes; then ac_save_cc="$CC" - CC="$(CC) -pg" + CC="$CC -pg" AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])], [], [enable_profiling=no]) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 14:10:23 2013 From: python-checkins at python.org (georg.brandl) Date: Tue, 26 Mar 2013 14:10:23 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogTkVXUzogYWRkIG5l?= =?utf-8?q?w_header_for_Python_3=2E3=2E2?= Message-ID: <3ZZt4H2ZjqzQ20@mail.python.org> http://hg.python.org/cpython/rev/801e1c3258d8 changeset: 82967:801e1c3258d8 branch: 3.3 parent: 82965:a11ee592af02 user: Georg Brandl date: Tue Mar 26 14:09:40 2013 +0100 summary: NEWS: add new header for Python 3.3.2 files: Misc/NEWS | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,12 +2,16 @@ Python News +++++++++++ +What's New in Python 3.3.2? +=========================== + +*Not yet released, see sections below for changes released in 3.3.0* + + What's New in Python 3.3.1? =========================== -*Not yet released, see sections below for changes released in 3.3.0* - -.. *Release date: 2013-XX-XX* +*Release date: 07-Apr-2013* Core and Builtins ----------------- -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 14:10:24 2013 From: python-checkins at python.org (georg.brandl) Date: Tue, 26 Mar 2013 14:10:24 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_null_merge_from_3=2E3?= Message-ID: <3ZZt4J5BR3zQ2G@mail.python.org> http://hg.python.org/cpython/rev/4cab02a3212f changeset: 82968:4cab02a3212f parent: 82966:81e005a410b7 parent: 82967:801e1c3258d8 user: Georg Brandl date: Tue Mar 26 14:10:30 2013 +0100 summary: null merge from 3.3 files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 14:58:09 2013 From: python-checkins at python.org (kristjan.jonsson) Date: Tue, 26 Mar 2013 14:58:09 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2316475=3A_Add_a_wh?= =?utf-8?q?atsnew_entry_for_3=2E4?= Message-ID: <3ZZv7P5ssZzPpP@mail.python.org> http://hg.python.org/cpython/rev/84e73ace3d7e changeset: 82969:84e73ace3d7e user: Kristjan Valur Jonsson date: Tue Mar 26 13:56:14 2013 +0000 summary: Issue #16475: Add a whatsnew entry for 3.4 files: Doc/whatsnew/3.4.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst --- a/Doc/whatsnew/3.4.rst +++ b/Doc/whatsnew/3.4.rst @@ -81,7 +81,7 @@ Summary -- Release highlights ============================= -.. This section singles out the most important changes in Python 3.3. +.. This section singles out the most important changes in Python 3.4. Brevity is key. New syntax features: @@ -98,7 +98,7 @@ Implementation improvements: -* None yet. +* A more efficient :mod:`marshal` format . Significantly Improved Library Modules: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 15:37:51 2013 From: python-checkins at python.org (brett.cannon) Date: Tue, 26 Mar 2013 15:37:51 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Minor_grammar_fix?= Message-ID: <3ZZw1C2CY5zQ1H@mail.python.org> http://hg.python.org/peps/rev/926990dd4c2c changeset: 4825:926990dd4c2c user: Brett Cannon date: Tue Mar 26 10:37:44 2013 -0400 summary: Minor grammar fix files: pep-0439.txt | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pep-0439.txt b/pep-0439.txt --- a/pep-0439.txt +++ b/pep-0439.txt @@ -125,9 +125,9 @@ The download of the pip implementation install file should be performed securely. The transport from pypi.python.org will be done over HTTPS but the CA certificate check will most likely not be performed, and therefore the download -would still be vulnerable to active MITM attacks. To mitigate this risk will -use the embedded signature support in the wheel format to validate the -downloaded file. +would still be vulnerable to active MITM attacks. To mitigate this +risk we will use the embedded signature support in the wheel format to validate +the downloaded file. Beyond those arguments controlling index location and download options, the "pip" boostrap command may support further standard pip -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Tue Mar 26 17:53:34 2013 From: python-checkins at python.org (christian.heimes) Date: Tue, 26 Mar 2013 17:53:34 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgMTc1Mzg6?= =?utf-8?q?_Document_XML_vulnerabilties?= Message-ID: <3ZZz1p3bgYzPlF@mail.python.org> http://hg.python.org/cpython/rev/e7795a178b0a changeset: 82970:e7795a178b0a branch: 3.2 parent: 82945:0fb7db2f9b5e user: Christian Heimes date: Tue Mar 26 17:35:55 2013 +0100 summary: Issue 17538: Document XML vulnerabilties files: Doc/library/markup.rst | 1 + Doc/library/pyexpat.rst | 7 + Doc/library/xml.dom.minidom.rst | 8 + Doc/library/xml.dom.pulldom.rst | 8 + Doc/library/xml.etree.elementtree.rst | 8 + Doc/library/xml.rst | 131 ++++++++++++++ Doc/library/xml.sax.rst | 8 + Doc/library/xmlrpc.client.rst | 7 + Doc/library/xmlrpc.server.rst | 7 + Misc/NEWS | 2 + 10 files changed, 187 insertions(+), 0 deletions(-) diff --git a/Doc/library/markup.rst b/Doc/library/markup.rst --- a/Doc/library/markup.rst +++ b/Doc/library/markup.rst @@ -23,6 +23,7 @@ html.rst html.parser.rst html.entities.rst + xml.rst xml.etree.elementtree.rst xml.dom.rst xml.dom.minidom.rst diff --git a/Doc/library/pyexpat.rst b/Doc/library/pyexpat.rst --- a/Doc/library/pyexpat.rst +++ b/Doc/library/pyexpat.rst @@ -14,6 +14,13 @@ references to these attributes should be marked using the :member: role. +.. warning:: + + The :mod:`pyexpat` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + .. index:: single: Expat The :mod:`xml.parsers.expat` module is a Python interface to the Expat diff --git a/Doc/library/xml.dom.minidom.rst b/Doc/library/xml.dom.minidom.rst --- a/Doc/library/xml.dom.minidom.rst +++ b/Doc/library/xml.dom.minidom.rst @@ -17,6 +17,14 @@ not already proficient with the DOM should consider using the :mod:`xml.etree.ElementTree` module for their XML processing instead + +.. warning:: + + The :mod:`xml.dom.minidom` module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data see :ref:`xml-vulnerabilities`. + + DOM applications typically start by parsing some XML into a DOM. With :mod:`xml.dom.minidom`, this is done through the parse functions:: diff --git a/Doc/library/xml.dom.pulldom.rst b/Doc/library/xml.dom.pulldom.rst --- a/Doc/library/xml.dom.pulldom.rst +++ b/Doc/library/xml.dom.pulldom.rst @@ -17,6 +17,14 @@ responsible for explicitly pulling events from the stream, looping over those events until either processing is finished or an error condition occurs. + +.. warning:: + + The :mod:`xml.dom.pulldom` module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data see :ref:`xml-vulnerabilities`. + + Example:: from xml.dom import pulldom diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -13,6 +13,14 @@ hierarchical data structures in memory. The type can be described as a cross between a list and a dictionary. + +.. warning:: + + The :mod:`xml.etree.ElementTree` module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data see :ref:`xml-vulnerabilities`. + + Each element has a number of properties associated with it: * a tag which is a string identifying what kind of data this element represents diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst new file mode 100644 --- /dev/null +++ b/Doc/library/xml.rst @@ -0,0 +1,131 @@ +.. _xml: + +XML Processing Modules +====================== + +.. module:: xml + :synopsis: Package containing XML processing modules +.. sectionauthor:: Christian Heimes +.. sectionauthor:: Georg Brandl + + +Python's interfaces for processing XML are grouped in the ``xml`` package. + +.. warning:: + + The XML modules are not secure against erroneous or maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + +It is important to note that modules in the :mod:`xml` package require that +there be at least one SAX-compliant XML parser available. The Expat parser is +included with Python, so the :mod:`xml.parsers.expat` module will always be +available. + +The documentation for the :mod:`xml.dom` and :mod:`xml.sax` packages are the +definition of the Python bindings for the DOM and SAX interfaces. + +The XML handling submodules are: + +* :mod:`xml.etree.ElementTree`: the ElementTree API, a simple and lightweight + +.. + +* :mod:`xml.dom`: the DOM API definition +* :mod:`xml.dom.minidom`: a lightweight DOM implementation +* :mod:`xml.dom.pulldom`: support for building partial DOM trees + +.. + +* :mod:`xml.sax`: SAX2 base classes and convenience functions +* :mod:`xml.parsers.expat`: the Expat parser binding + + +.. _xml-vulnerabilities: + +XML vulnerabilities +=================== + +The XML processing modules are not secure against maliciously constructed data. +An attacker can abuse vulnerabilities for e.g. denial of service attacks, to +access local files, to generate network connections to other machines, or +to or circumvent firewalls. The attacks on XML abuse unfamiliar features +like inline `DTD`_ (document type definition) with entities. + + +========================= ======== ========= ========= ======== ========= +kind sax etree minidom pulldom xmlrpc +========================= ======== ========= ========= ======== ========= +billion laughs **True** **True** **True** **True** **True** +quadratic blowup **True** **True** **True** **True** **True** +external entity expansion **True** False (1) False (2) **True** False (3) +DTD retrieval **True** False False **True** False +decompression bomb False False False False **True** +========================= ======== ========= ========= ======== ========= + +1. :mod:`xml.etree.ElementTree` doesn't expand external entities and raises a + ParserError when an entity occurs. +2. :mod:`xml.dom.minidom` doesn't expand external entities and simply returns + the unexpanded entity verbatim. +3. :mod:`xmlrpclib` doesn't expand external entities and omits them. + + +billion laughs / exponential entity expansion + The `Billion Laughs`_ attack -- also known as exponential entity expansion -- + uses multiple levels of nested entities. Each entity refers to another entity + several times, the final entity definition contains a small string. Eventually + the small string is expanded to several gigabytes. The exponential expansion + consumes lots of CPU time, too. + +quadratic blowup entity expansion + A quadratic blowup attack is similar to a `Billion Laughs`_ attack; it abuses + entity expansion, too. Instead of nested entities it repeats one large entity + with a couple of thousand chars over and over again. The attack isn't as + efficient as the exponential case but it avoids triggering countermeasures of + parsers against heavily nested entities. + +external entity expansion + Entity declarations can contain more than just text for replacement. They can + also point to external resources by public identifiers or system identifiers. + System identifiers are standard URIs or can refer to local files. The XML + parser retrieves the resource with e.g. HTTP or FTP requests and embeds the + content into the XML document. + +DTD retrieval + Some XML libraries like Python's mod:'xml.dom.pulldom' retrieve document type + definitions from remote or local locations. The feature has similar + implications as the external entity expansion issue. + +decompression bomb + The issue of decompression bombs (aka `ZIP bomb`_) apply to all XML libraries + that can parse compressed XML stream like gzipped HTTP streams or LZMA-ed + files. For an attacker it can reduce the amount of transmitted data by three + magnitudes or more. + +The documentation of `defusedxml`_ on PyPI has further information about +all known attack vectors with examples and references. + +defused packages +---------------- + +`defusedxml`_ is a pure Python package with modified subclasses of all stdlib +XML parsers that prevent any potentially malicious operation. The courses of +action are recommended for any server code that parses untrusted XML data. The +package also ships with example exploits and an extended documentation on more +XML exploits like xpath injection. + +`defusedexpat`_ provides a modified libexpat and patched replacment +:mod:`pyexpat` extension module with countermeasures against entity expansion +DoS attacks. Defusedexpat still allows a sane and configurable amount of entity +expansions. The modifications will be merged into future releases of Python. + +The workarounds and modifications are not included in patch releases as they +break backward compatibility. After all inline DTD and entity expansion are +well-definied XML features. + + +.. _defusedxml: +.. _defusedexpat: +.. _Billion Laughs: http://en.wikipedia.org/wiki/Billion_laughs +.. _ZIP bomb: http://en.wikipedia.org/wiki/Zip_bomb +.. _DTD: http://en.wikipedia.org/wiki/Document_Type_Definition diff --git a/Doc/library/xml.sax.rst b/Doc/library/xml.sax.rst --- a/Doc/library/xml.sax.rst +++ b/Doc/library/xml.sax.rst @@ -13,6 +13,14 @@ SAX exceptions and the convenience functions which will be most used by users of the SAX API. + +.. warning:: + + The :mod:`xml.sax` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + The convenience functions are: diff --git a/Doc/library/xmlrpc.client.rst b/Doc/library/xmlrpc.client.rst --- a/Doc/library/xmlrpc.client.rst +++ b/Doc/library/xmlrpc.client.rst @@ -21,6 +21,13 @@ between conformable Python objects and XML on the wire. +.. warning:: + + The :mod:`xmlrpc.client` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + .. class:: ServerProxy(uri, transport=None, encoding=None, verbose=False, allow_none=False, use_datetime=False) A :class:`ServerProxy` instance is an object that manages communication with a diff --git a/Doc/library/xmlrpc.server.rst b/Doc/library/xmlrpc.server.rst --- a/Doc/library/xmlrpc.server.rst +++ b/Doc/library/xmlrpc.server.rst @@ -16,6 +16,13 @@ :class:`CGIXMLRPCRequestHandler`. +.. warning:: + + The :mod:`xmlrpc.client` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + .. class:: SimpleXMLRPCServer(addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=True, allow_none=False, encoding=None, bind_and_activate=True) Create a new server instance. This class provides methods for registration of diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1156,6 +1156,8 @@ Documentation ------------- +- Issue 17538: Document XML vulnerabilties + - Issue #17047: remove doubled words in docs and docstrings reported by Serhiy Storchaka and Matthew Barnett. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 17:53:36 2013 From: python-checkins at python.org (christian.heimes) Date: Tue, 26 Mar 2013 17:53:36 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Issue_17538=3A_Document_XML_vulnerabilties?= Message-ID: <3ZZz1r13SQzQ9F@mail.python.org> http://hg.python.org/cpython/rev/65e8ac5f073f changeset: 82971:65e8ac5f073f branch: 3.3 parent: 82967:801e1c3258d8 parent: 82970:e7795a178b0a user: Christian Heimes date: Tue Mar 26 17:47:23 2013 +0100 summary: Issue 17538: Document XML vulnerabilties files: Doc/library/pyexpat.rst | 7 + Doc/library/xml.dom.minidom.rst | 8 + Doc/library/xml.dom.pulldom.rst | 8 + Doc/library/xml.etree.elementtree.rst | 7 + Doc/library/xml.rst | 104 ++++++++++++++ Doc/library/xml.sax.rst | 8 + Doc/library/xmlrpc.client.rst | 7 + Doc/library/xmlrpc.server.rst | 7 + Misc/NEWS | 2 + 9 files changed, 158 insertions(+), 0 deletions(-) diff --git a/Doc/library/pyexpat.rst b/Doc/library/pyexpat.rst --- a/Doc/library/pyexpat.rst +++ b/Doc/library/pyexpat.rst @@ -14,6 +14,13 @@ references to these attributes should be marked using the :member: role. +.. warning:: + + The :mod:`pyexpat` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + .. index:: single: Expat The :mod:`xml.parsers.expat` module is a Python interface to the Expat diff --git a/Doc/library/xml.dom.minidom.rst b/Doc/library/xml.dom.minidom.rst --- a/Doc/library/xml.dom.minidom.rst +++ b/Doc/library/xml.dom.minidom.rst @@ -17,6 +17,14 @@ not already proficient with the DOM should consider using the :mod:`xml.etree.ElementTree` module for their XML processing instead + +.. warning:: + + The :mod:`xml.dom.minidom` module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data see :ref:`xml-vulnerabilities`. + + DOM applications typically start by parsing some XML into a DOM. With :mod:`xml.dom.minidom`, this is done through the parse functions:: diff --git a/Doc/library/xml.dom.pulldom.rst b/Doc/library/xml.dom.pulldom.rst --- a/Doc/library/xml.dom.pulldom.rst +++ b/Doc/library/xml.dom.pulldom.rst @@ -17,6 +17,14 @@ responsible for explicitly pulling events from the stream, looping over those events until either processing is finished or an error condition occurs. + +.. warning:: + + The :mod:`xml.dom.pulldom` module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data see :ref:`xml-vulnerabilities`. + + Example:: from xml.dom import pulldom diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -12,6 +12,13 @@ This module will use a fast implementation whenever available. The :mod:`xml.etree.cElementTree` module is deprecated. + +.. warning:: + + The :mod:`xml.etree.ElementTree` module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data see :ref:`xml-vulnerabilities`. + Tutorial -------- diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst --- a/Doc/library/xml.rst +++ b/Doc/library/xml.rst @@ -3,8 +3,21 @@ XML Processing Modules ====================== +.. module:: xml + :synopsis: Package containing XML processing modules +.. sectionauthor:: Christian Heimes +.. sectionauthor:: Georg Brandl + + Python's interfaces for processing XML are grouped in the ``xml`` package. +.. warning:: + + The XML modules are not secure against erroneous or maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + It is important to note that modules in the :mod:`xml` package require that there be at least one SAX-compliant XML parser available. The Expat parser is included with Python, so the :mod:`xml.parsers.expat` module will always be @@ -27,3 +40,94 @@ * :mod:`xml.sax`: SAX2 base classes and convenience functions * :mod:`xml.parsers.expat`: the Expat parser binding + + +.. _xml-vulnerabilities: + +XML vulnerabilities +=================== + +The XML processing modules are not secure against maliciously constructed data. +An attacker can abuse vulnerabilities for e.g. denial of service attacks, to +access local files, to generate network connections to other machines, or +to or circumvent firewalls. The attacks on XML abuse unfamiliar features +like inline `DTD`_ (document type definition) with entities. + + +========================= ======== ========= ========= ======== ========= +kind sax etree minidom pulldom xmlrpc +========================= ======== ========= ========= ======== ========= +billion laughs **True** **True** **True** **True** **True** +quadratic blowup **True** **True** **True** **True** **True** +external entity expansion **True** False (1) False (2) **True** False (3) +DTD retrieval **True** False False **True** False +decompression bomb False False False False **True** +========================= ======== ========= ========= ======== ========= + +1. :mod:`xml.etree.ElementTree` doesn't expand external entities and raises a + ParserError when an entity occurs. +2. :mod:`xml.dom.minidom` doesn't expand external entities and simply returns + the unexpanded entity verbatim. +3. :mod:`xmlrpclib` doesn't expand external entities and omits them. + + +billion laughs / exponential entity expansion + The `Billion Laughs`_ attack -- also known as exponential entity expansion -- + uses multiple levels of nested entities. Each entity refers to another entity + several times, the final entity definition contains a small string. Eventually + the small string is expanded to several gigabytes. The exponential expansion + consumes lots of CPU time, too. + +quadratic blowup entity expansion + A quadratic blowup attack is similar to a `Billion Laughs`_ attack; it abuses + entity expansion, too. Instead of nested entities it repeats one large entity + with a couple of thousand chars over and over again. The attack isn't as + efficient as the exponential case but it avoids triggering countermeasures of + parsers against heavily nested entities. + +external entity expansion + Entity declarations can contain more than just text for replacement. They can + also point to external resources by public identifiers or system identifiers. + System identifiers are standard URIs or can refer to local files. The XML + parser retrieves the resource with e.g. HTTP or FTP requests and embeds the + content into the XML document. + +DTD retrieval + Some XML libraries like Python's mod:'xml.dom.pulldom' retrieve document type + definitions from remote or local locations. The feature has similar + implications as the external entity expansion issue. + +decompression bomb + The issue of decompression bombs (aka `ZIP bomb`_) apply to all XML libraries + that can parse compressed XML stream like gzipped HTTP streams or LZMA-ed + files. For an attacker it can reduce the amount of transmitted data by three + magnitudes or more. + +The documentation of `defusedxml`_ on PyPI has further information about +all known attack vectors with examples and references. + +defused packages +---------------- + +`defusedxml`_ is a pure Python package with modified subclasses of all stdlib +XML parsers that prevent any potentially malicious operation. The courses of +action are recommended for any server code that parses untrusted XML data. The +package also ships with example exploits and an extended documentation on more +XML exploits like xpath injection. + +`defusedexpat`_ provides a modified libexpat and patched replacment +:mod:`pyexpat` extension module with countermeasures against entity expansion +DoS attacks. Defusedexpat still allows a sane and configurable amount of entity +expansions. The modifications will be merged into future releases of Python. + +The workarounds and modifications are not included in patch releases as they +break backward compatibility. After all inline DTD and entity expansion are +well-definied XML features. + + +.. _defusedxml: +.. _defusedexpat: +.. _Billion Laughs: http://en.wikipedia.org/wiki/Billion_laughs +.. _ZIP bomb: http://en.wikipedia.org/wiki/Zip_bomb +.. _DTD: http://en.wikipedia.org/wiki/Document_Type_Definition + diff --git a/Doc/library/xml.sax.rst b/Doc/library/xml.sax.rst --- a/Doc/library/xml.sax.rst +++ b/Doc/library/xml.sax.rst @@ -13,6 +13,14 @@ SAX exceptions and the convenience functions which will be most used by users of the SAX API. + +.. warning:: + + The :mod:`xml.sax` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + The convenience functions are: diff --git a/Doc/library/xmlrpc.client.rst b/Doc/library/xmlrpc.client.rst --- a/Doc/library/xmlrpc.client.rst +++ b/Doc/library/xmlrpc.client.rst @@ -21,6 +21,13 @@ between conformable Python objects and XML on the wire. +.. warning:: + + The :mod:`xmlrpc.client` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + .. class:: ServerProxy(uri, transport=None, encoding=None, verbose=False, \ allow_none=False, use_datetime=False, \ use_builtin_types=False) diff --git a/Doc/library/xmlrpc.server.rst b/Doc/library/xmlrpc.server.rst --- a/Doc/library/xmlrpc.server.rst +++ b/Doc/library/xmlrpc.server.rst @@ -16,6 +16,13 @@ :class:`CGIXMLRPCRequestHandler`. +.. warning:: + + The :mod:`xmlrpc.client` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + .. class:: SimpleXMLRPCServer(addr, requestHandler=SimpleXMLRPCRequestHandler,\ logRequests=True, allow_none=False, encoding=None,\ bind_and_activate=True, use_builtin_types=False) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -882,6 +882,8 @@ Documentation ------------- +- Issue 17538: Document XML vulnerabilties + - Issue #16642: sched.scheduler timefunc initial default is time.monotonic. Patch by Ramchandra Apte -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 17:53:37 2013 From: python-checkins at python.org (christian.heimes) Date: Tue, 26 Mar 2013 17:53:37 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Issue_17538=3A_Document_XML_vulnerabilties?= Message-ID: <3ZZz1s5KTzzPq8@mail.python.org> http://hg.python.org/cpython/rev/1ebefb6ae9a9 changeset: 82972:1ebefb6ae9a9 parent: 82969:84e73ace3d7e parent: 82971:65e8ac5f073f user: Christian Heimes date: Tue Mar 26 17:48:28 2013 +0100 summary: Issue 17538: Document XML vulnerabilties files: Doc/library/pyexpat.rst | 7 + Doc/library/xml.dom.minidom.rst | 8 + Doc/library/xml.dom.pulldom.rst | 8 + Doc/library/xml.etree.elementtree.rst | 7 + Doc/library/xml.rst | 104 ++++++++++++++ Doc/library/xml.sax.rst | 8 + Doc/library/xmlrpc.client.rst | 7 + Doc/library/xmlrpc.server.rst | 7 + Misc/NEWS | 2 + 9 files changed, 158 insertions(+), 0 deletions(-) diff --git a/Doc/library/pyexpat.rst b/Doc/library/pyexpat.rst --- a/Doc/library/pyexpat.rst +++ b/Doc/library/pyexpat.rst @@ -14,6 +14,13 @@ references to these attributes should be marked using the :member: role. +.. warning:: + + The :mod:`pyexpat` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + .. index:: single: Expat The :mod:`xml.parsers.expat` module is a Python interface to the Expat diff --git a/Doc/library/xml.dom.minidom.rst b/Doc/library/xml.dom.minidom.rst --- a/Doc/library/xml.dom.minidom.rst +++ b/Doc/library/xml.dom.minidom.rst @@ -17,6 +17,14 @@ not already proficient with the DOM should consider using the :mod:`xml.etree.ElementTree` module for their XML processing instead + +.. warning:: + + The :mod:`xml.dom.minidom` module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data see :ref:`xml-vulnerabilities`. + + DOM applications typically start by parsing some XML into a DOM. With :mod:`xml.dom.minidom`, this is done through the parse functions:: diff --git a/Doc/library/xml.dom.pulldom.rst b/Doc/library/xml.dom.pulldom.rst --- a/Doc/library/xml.dom.pulldom.rst +++ b/Doc/library/xml.dom.pulldom.rst @@ -17,6 +17,14 @@ responsible for explicitly pulling events from the stream, looping over those events until either processing is finished or an error condition occurs. + +.. warning:: + + The :mod:`xml.dom.pulldom` module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data see :ref:`xml-vulnerabilities`. + + Example:: from xml.dom import pulldom diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -12,6 +12,13 @@ This module will use a fast implementation whenever available. The :mod:`xml.etree.cElementTree` module is deprecated. + +.. warning:: + + The :mod:`xml.etree.ElementTree` module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data see :ref:`xml-vulnerabilities`. + Tutorial -------- diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst --- a/Doc/library/xml.rst +++ b/Doc/library/xml.rst @@ -3,8 +3,21 @@ XML Processing Modules ====================== +.. module:: xml + :synopsis: Package containing XML processing modules +.. sectionauthor:: Christian Heimes +.. sectionauthor:: Georg Brandl + + Python's interfaces for processing XML are grouped in the ``xml`` package. +.. warning:: + + The XML modules are not secure against erroneous or maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + It is important to note that modules in the :mod:`xml` package require that there be at least one SAX-compliant XML parser available. The Expat parser is included with Python, so the :mod:`xml.parsers.expat` module will always be @@ -27,3 +40,94 @@ * :mod:`xml.sax`: SAX2 base classes and convenience functions * :mod:`xml.parsers.expat`: the Expat parser binding + + +.. _xml-vulnerabilities: + +XML vulnerabilities +=================== + +The XML processing modules are not secure against maliciously constructed data. +An attacker can abuse vulnerabilities for e.g. denial of service attacks, to +access local files, to generate network connections to other machines, or +to or circumvent firewalls. The attacks on XML abuse unfamiliar features +like inline `DTD`_ (document type definition) with entities. + + +========================= ======== ========= ========= ======== ========= +kind sax etree minidom pulldom xmlrpc +========================= ======== ========= ========= ======== ========= +billion laughs **True** **True** **True** **True** **True** +quadratic blowup **True** **True** **True** **True** **True** +external entity expansion **True** False (1) False (2) **True** False (3) +DTD retrieval **True** False False **True** False +decompression bomb False False False False **True** +========================= ======== ========= ========= ======== ========= + +1. :mod:`xml.etree.ElementTree` doesn't expand external entities and raises a + ParserError when an entity occurs. +2. :mod:`xml.dom.minidom` doesn't expand external entities and simply returns + the unexpanded entity verbatim. +3. :mod:`xmlrpclib` doesn't expand external entities and omits them. + + +billion laughs / exponential entity expansion + The `Billion Laughs`_ attack -- also known as exponential entity expansion -- + uses multiple levels of nested entities. Each entity refers to another entity + several times, the final entity definition contains a small string. Eventually + the small string is expanded to several gigabytes. The exponential expansion + consumes lots of CPU time, too. + +quadratic blowup entity expansion + A quadratic blowup attack is similar to a `Billion Laughs`_ attack; it abuses + entity expansion, too. Instead of nested entities it repeats one large entity + with a couple of thousand chars over and over again. The attack isn't as + efficient as the exponential case but it avoids triggering countermeasures of + parsers against heavily nested entities. + +external entity expansion + Entity declarations can contain more than just text for replacement. They can + also point to external resources by public identifiers or system identifiers. + System identifiers are standard URIs or can refer to local files. The XML + parser retrieves the resource with e.g. HTTP or FTP requests and embeds the + content into the XML document. + +DTD retrieval + Some XML libraries like Python's mod:'xml.dom.pulldom' retrieve document type + definitions from remote or local locations. The feature has similar + implications as the external entity expansion issue. + +decompression bomb + The issue of decompression bombs (aka `ZIP bomb`_) apply to all XML libraries + that can parse compressed XML stream like gzipped HTTP streams or LZMA-ed + files. For an attacker it can reduce the amount of transmitted data by three + magnitudes or more. + +The documentation of `defusedxml`_ on PyPI has further information about +all known attack vectors with examples and references. + +defused packages +---------------- + +`defusedxml`_ is a pure Python package with modified subclasses of all stdlib +XML parsers that prevent any potentially malicious operation. The courses of +action are recommended for any server code that parses untrusted XML data. The +package also ships with example exploits and an extended documentation on more +XML exploits like xpath injection. + +`defusedexpat`_ provides a modified libexpat and patched replacment +:mod:`pyexpat` extension module with countermeasures against entity expansion +DoS attacks. Defusedexpat still allows a sane and configurable amount of entity +expansions. The modifications will be merged into future releases of Python. + +The workarounds and modifications are not included in patch releases as they +break backward compatibility. After all inline DTD and entity expansion are +well-definied XML features. + + +.. _defusedxml: +.. _defusedexpat: +.. _Billion Laughs: http://en.wikipedia.org/wiki/Billion_laughs +.. _ZIP bomb: http://en.wikipedia.org/wiki/Zip_bomb +.. _DTD: http://en.wikipedia.org/wiki/Document_Type_Definition + diff --git a/Doc/library/xml.sax.rst b/Doc/library/xml.sax.rst --- a/Doc/library/xml.sax.rst +++ b/Doc/library/xml.sax.rst @@ -13,6 +13,14 @@ SAX exceptions and the convenience functions which will be most used by users of the SAX API. + +.. warning:: + + The :mod:`xml.sax` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + The convenience functions are: diff --git a/Doc/library/xmlrpc.client.rst b/Doc/library/xmlrpc.client.rst --- a/Doc/library/xmlrpc.client.rst +++ b/Doc/library/xmlrpc.client.rst @@ -21,6 +21,13 @@ between conformable Python objects and XML on the wire. +.. warning:: + + The :mod:`xmlrpc.client` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + .. class:: ServerProxy(uri, transport=None, encoding=None, verbose=False, \ allow_none=False, use_datetime=False, \ use_builtin_types=False) diff --git a/Doc/library/xmlrpc.server.rst b/Doc/library/xmlrpc.server.rst --- a/Doc/library/xmlrpc.server.rst +++ b/Doc/library/xmlrpc.server.rst @@ -16,6 +16,13 @@ :class:`CGIXMLRPCRequestHandler`. +.. warning:: + + The :mod:`xmlrpc.client` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + .. class:: SimpleXMLRPCServer(addr, requestHandler=SimpleXMLRPCRequestHandler,\ logRequests=True, allow_none=False, encoding=None,\ bind_and_activate=True, use_builtin_types=False) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1217,6 +1217,8 @@ Documentation ------------- +- Issue 17538: Document XML vulnerabilties + - Issue #16642: sched.scheduler timefunc initial default is time.monotonic. Patch by Ramchandra Apte -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Mar 26 17:53:39 2013 From: python-checkins at python.org (christian.heimes) Date: Tue, 26 Mar 2013 17:53:39 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgMTc1Mzg6?= =?utf-8?q?_Document_XML_vulnerabilties?= Message-ID: <3ZZz1v2N95zQBT@mail.python.org> http://hg.python.org/cpython/rev/e87364449954 changeset: 82973:e87364449954 branch: 2.7 parent: 82963:d321885ff8f3 user: Christian Heimes date: Tue Mar 26 17:53:05 2013 +0100 summary: Issue 17538: Document XML vulnerabilties files: Doc/library/markup.rst | 1 + Doc/library/pyexpat.rst | 8 + Doc/library/xml.dom.minidom.rst | 8 + Doc/library/xml.dom.pulldom.rst | 7 + Doc/library/xml.etree.elementtree.rst | 8 + Doc/library/xml.rst | 131 ++++++++++++++ Doc/library/xml.sax.rst | 8 + Doc/library/xmlrpclib.rst | 7 + Misc/NEWS | 5 + 9 files changed, 183 insertions(+), 0 deletions(-) diff --git a/Doc/library/markup.rst b/Doc/library/markup.rst --- a/Doc/library/markup.rst +++ b/Doc/library/markup.rst @@ -25,6 +25,7 @@ htmlparser.rst sgmllib.rst htmllib.rst + xml.rst xml.etree.elementtree.rst xml.dom.rst xml.dom.minidom.rst diff --git a/Doc/library/pyexpat.rst b/Doc/library/pyexpat.rst --- a/Doc/library/pyexpat.rst +++ b/Doc/library/pyexpat.rst @@ -14,6 +14,14 @@ directive. Since they are attributes which are set by client code, in-text references to these attributes should be marked using the :member: role. + +.. warning:: + + The :mod:`pyexpat` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + .. versionadded:: 2.0 .. index:: single: Expat diff --git a/Doc/library/xml.dom.minidom.rst b/Doc/library/xml.dom.minidom.rst --- a/Doc/library/xml.dom.minidom.rst +++ b/Doc/library/xml.dom.minidom.rst @@ -20,6 +20,14 @@ not already proficient with the DOM should consider using the :mod:`xml.etree.ElementTree` module for their XML processing instead + +.. warning:: + + The :mod:`xml.dom.minidom` module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data see :ref:`xml-vulnerabilities`. + + DOM applications typically start by parsing some XML into a DOM. With :mod:`xml.dom.minidom`, this is done through the parse functions:: diff --git a/Doc/library/xml.dom.pulldom.rst b/Doc/library/xml.dom.pulldom.rst --- a/Doc/library/xml.dom.pulldom.rst +++ b/Doc/library/xml.dom.pulldom.rst @@ -16,6 +16,13 @@ Object Model representation of a document from SAX events. +.. warning:: + + The :mod:`xml.dom.pulldom` module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data see :ref:`xml-vulnerabilities`. + + .. class:: PullDOM([documentFactory]) :class:`xml.sax.handler.ContentHandler` implementation that ... diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -16,6 +16,14 @@ hierarchical data structures in memory. The type can be described as a cross between a list and a dictionary. + +.. warning:: + + The :mod:`xml.etree.ElementTree` module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data see :ref:`xml-vulnerabilities`. + + Each element has a number of properties associated with it: * a tag which is a string identifying what kind of data this element represents diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst new file mode 100644 --- /dev/null +++ b/Doc/library/xml.rst @@ -0,0 +1,131 @@ +.. _xml: + +XML Processing Modules +====================== + +.. module:: xml + :synopsis: Package containing XML processing modules +.. sectionauthor:: Christian Heimes +.. sectionauthor:: Georg Brandl + + +Python's interfaces for processing XML are grouped in the ``xml`` package. + +.. warning:: + + The XML modules are not secure against erroneous or maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + +It is important to note that modules in the :mod:`xml` package require that +there be at least one SAX-compliant XML parser available. The Expat parser is +included with Python, so the :mod:`xml.parsers.expat` module will always be +available. + +The documentation for the :mod:`xml.dom` and :mod:`xml.sax` packages are the +definition of the Python bindings for the DOM and SAX interfaces. + +The XML handling submodules are: + +* :mod:`xml.etree.ElementTree`: the ElementTree API, a simple and lightweight + +.. + +* :mod:`xml.dom`: the DOM API definition +* :mod:`xml.dom.minidom`: a lightweight DOM implementation +* :mod:`xml.dom.pulldom`: support for building partial DOM trees + +.. + +* :mod:`xml.sax`: SAX2 base classes and convenience functions +* :mod:`xml.parsers.expat`: the Expat parser binding + + +.. _xml-vulnerabilities: + +XML vulnerabilities +=================== + +The XML processing modules are not secure against maliciously constructed data. +An attacker can abuse vulnerabilities for e.g. denial of service attacks, to +access local files, to generate network connections to other machines, or +to or circumvent firewalls. The attacks on XML abuse unfamiliar features +like inline `DTD`_ (document type definition) with entities. + + +========================= ======== ========= ========= ======== ========= +kind sax etree minidom pulldom xmlrpc +========================= ======== ========= ========= ======== ========= +billion laughs **True** **True** **True** **True** **True** +quadratic blowup **True** **True** **True** **True** **True** +external entity expansion **True** False (1) False (2) **True** False (3) +DTD retrieval **True** False False **True** False +decompression bomb False False False False **True** +========================= ======== ========= ========= ======== ========= + +1. :mod:`xml.etree.ElementTree` doesn't expand external entities and raises a + ParserError when an entity occurs. +2. :mod:`xml.dom.minidom` doesn't expand external entities and simply returns + the unexpanded entity verbatim. +3. :mod:`xmlrpclib` doesn't expand external entities and omits them. + + +billion laughs / exponential entity expansion + The `Billion Laughs`_ attack -- also known as exponential entity expansion -- + uses multiple levels of nested entities. Each entity refers to another entity + several times, the final entity definition contains a small string. Eventually + the small string is expanded to several gigabytes. The exponential expansion + consumes lots of CPU time, too. + +quadratic blowup entity expansion + A quadratic blowup attack is similar to a `Billion Laughs`_ attack; it abuses + entity expansion, too. Instead of nested entities it repeats one large entity + with a couple of thousand chars over and over again. The attack isn't as + efficient as the exponential case but it avoids triggering countermeasures of + parsers against heavily nested entities. + +external entity expansion + Entity declarations can contain more than just text for replacement. They can + also point to external resources by public identifiers or system identifiers. + System identifiers are standard URIs or can refer to local files. The XML + parser retrieves the resource with e.g. HTTP or FTP requests and embeds the + content into the XML document. + +DTD retrieval + Some XML libraries like Python's mod:'xml.dom.pulldom' retrieve document type + definitions from remote or local locations. The feature has similar + implications as the external entity expansion issue. + +decompression bomb + The issue of decompression bombs (aka `ZIP bomb`_) apply to all XML libraries + that can parse compressed XML stream like gzipped HTTP streams or LZMA-ed + files. For an attacker it can reduce the amount of transmitted data by three + magnitudes or more. + +The documentation of `defusedxml`_ on PyPI has further information about +all known attack vectors with examples and references. + +defused packages +---------------- + +`defusedxml`_ is a pure Python package with modified subclasses of all stdlib +XML parsers that prevent any potentially malicious operation. The courses of +action are recommended for any server code that parses untrusted XML data. The +package also ships with example exploits and an extended documentation on more +XML exploits like xpath injection. + +`defusedexpat`_ provides a modified libexpat and patched replacment +:mod:`pyexpat` extension module with countermeasures against entity expansion +DoS attacks. Defusedexpat still allows a sane and configurable amount of entity +expansions. The modifications will be merged into future releases of Python. + +The workarounds and modifications are not included in patch releases as they +break backward compatibility. After all inline DTD and entity expansion are +well-definied XML features. + + +.. _defusedxml: +.. _defusedexpat: +.. _Billion Laughs: http://en.wikipedia.org/wiki/Billion_laughs +.. _ZIP bomb: http://en.wikipedia.org/wiki/Zip_bomb +.. _DTD: http://en.wikipedia.org/wiki/Document_Type_Definition diff --git a/Doc/library/xml.sax.rst b/Doc/library/xml.sax.rst --- a/Doc/library/xml.sax.rst +++ b/Doc/library/xml.sax.rst @@ -16,6 +16,14 @@ SAX exceptions and the convenience functions which will be most used by users of the SAX API. + +.. warning:: + + The :mod:`xml.sax` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + The convenience functions are: diff --git a/Doc/library/xmlrpclib.rst b/Doc/library/xmlrpclib.rst --- a/Doc/library/xmlrpclib.rst +++ b/Doc/library/xmlrpclib.rst @@ -28,6 +28,13 @@ between conformable Python objects and XML on the wire. +.. warning:: + + The :mod:`xmlrpclib` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + .. class:: ServerProxy(uri[, transport[, encoding[, verbose[, allow_none[, use_datetime]]]]]) A :class:`ServerProxy` instance is an object that manages communication with a diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -36,6 +36,11 @@ - Issue #17531: Fix tests that thought group and user ids were always the int type. Also, always allow -1 as a valid group and user id. +Documentation +------------- + +- Issue 17538: Document XML vulnerabilties + What's New in Python 2.7.4 release candidate 1 ============================================== -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Wed Mar 27 05:52:43 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 27 Mar 2013 05:52:43 +0100 Subject: [Python-checkins] Daily reference leaks (1ebefb6ae9a9): sum=0 Message-ID: results for 1ebefb6ae9a9 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogaeMcE3', '-x'] From python-checkins at python.org Wed Mar 27 19:16:47 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 27 Mar 2013 19:16:47 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4yKTogIzE3MzI5OiBkb2N1?= =?utf-8?q?ment_unittest=2ESkipTest=2E__Initial_patch_by_Zachary_Ware=2E?= Message-ID: <3ZbcqM6Rp8zNgy@mail.python.org> http://hg.python.org/cpython/rev/cd5c23583fa5 changeset: 82974:cd5c23583fa5 branch: 3.2 parent: 82970:e7795a178b0a user: Ezio Melotti date: Wed Mar 27 20:11:55 2013 +0200 summary: #17329: document unittest.SkipTest. Initial patch by Zachary Ware. files: Doc/library/unittest.rst | 13 ++++++++++--- Lib/unittest/case.py | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -663,7 +663,7 @@ def skipUnlessHasattr(obj, attr): if hasattr(obj, attr): return lambda func: func - return unittest.skip("{0!r} doesn't have {1!r}".format(obj, attr)) + return unittest.skip("{!r} doesn't have {!r}".format(obj, attr)) The following decorators implement test skipping and expected failures: @@ -685,6 +685,13 @@ Mark the test as an expected failure. If the test fails when run, the test is not counted as a failure. +.. exception:: SkipTest(reason) + + This exception is raised to skip a test. + + Usually you can use :meth:`TestCase.skipTest` or one of the skipping + decorators instead of raising this directly. + Skipped tests will not have :meth:`setUp` or :meth:`tearDown` run around them. Skipped classes will not have :meth:`setUpClass` or :meth:`tearDownClass` run. @@ -2105,7 +2112,7 @@ If an exception is raised during a ``setUpClass`` then the tests in the class are not run and the ``tearDownClass`` is not run. Skipped classes will not have ``setUpClass`` or ``tearDownClass`` run. If the exception is a -``SkipTest`` exception then the class will be reported as having been skipped +:exc:`SkipTest` exception then the class will be reported as having been skipped instead of as an error. @@ -2122,7 +2129,7 @@ If an exception is raised in a ``setUpModule`` then none of the tests in the module will be run and the ``tearDownModule`` will not be run. If the exception is a -``SkipTest`` exception then the module will be reported as having been skipped +:exc:`SkipTest` exception then the module will be reported as having been skipped instead of as an error. diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -23,7 +23,7 @@ """ Raise this exception in a test to skip it. - Usually you can use TestResult.skip() or one of the skipping decorators + Usually you can use TestCase.skipTest() or one of the skipping decorators instead of raising this directly. """ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 27 19:16:49 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 27 Mar 2013 19:16:49 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_=2317329=3A_merge_with_3=2E2=2E?= Message-ID: <3ZbcqP1yL7zQvC@mail.python.org> http://hg.python.org/cpython/rev/4bf2a53b53b6 changeset: 82975:4bf2a53b53b6 branch: 3.3 parent: 82971:65e8ac5f073f parent: 82974:cd5c23583fa5 user: Ezio Melotti date: Wed Mar 27 20:12:55 2013 +0200 summary: #17329: merge with 3.2. files: Doc/library/unittest.rst | 13 ++++++++++--- Lib/unittest/case.py | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -530,7 +530,7 @@ def skipUnlessHasattr(obj, attr): if hasattr(obj, attr): return lambda func: func - return unittest.skip("{0!r} doesn't have {1!r}".format(obj, attr)) + return unittest.skip("{!r} doesn't have {!r}".format(obj, attr)) The following decorators implement test skipping and expected failures: @@ -552,6 +552,13 @@ Mark the test as an expected failure. If the test fails when run, the test is not counted as a failure. +.. exception:: SkipTest(reason) + + This exception is raised to skip a test. + + Usually you can use :meth:`TestCase.skipTest` or one of the skipping + decorators instead of raising this directly. + Skipped tests will not have :meth:`setUp` or :meth:`tearDown` run around them. Skipped classes will not have :meth:`setUpClass` or :meth:`tearDownClass` run. @@ -1958,7 +1965,7 @@ If an exception is raised during a ``setUpClass`` then the tests in the class are not run and the ``tearDownClass`` is not run. Skipped classes will not have ``setUpClass`` or ``tearDownClass`` run. If the exception is a -``SkipTest`` exception then the class will be reported as having been skipped +:exc:`SkipTest` exception then the class will be reported as having been skipped instead of as an error. @@ -1975,7 +1982,7 @@ If an exception is raised in a ``setUpModule`` then none of the tests in the module will be run and the ``tearDownModule`` will not be run. If the exception is a -``SkipTest`` exception then the module will be reported as having been skipped +:exc:`SkipTest` exception then the module will be reported as having been skipped instead of as an error. diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -22,7 +22,7 @@ """ Raise this exception in a test to skip it. - Usually you can use TestResult.skip() or one of the skipping decorators + Usually you can use TestCase.skipTest() or one of the skipping decorators instead of raising this directly. """ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 27 19:16:50 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 27 Mar 2013 19:16:50 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3MzI5OiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZbcqQ4jKTzQNL@mail.python.org> http://hg.python.org/cpython/rev/53cc3dbb1918 changeset: 82976:53cc3dbb1918 parent: 82972:1ebefb6ae9a9 parent: 82975:4bf2a53b53b6 user: Ezio Melotti date: Wed Mar 27 20:13:59 2013 +0200 summary: #17329: merge with 3.3. files: Doc/library/unittest.rst | 19 +++++++++++++------ Lib/unittest/case.py | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -530,7 +530,7 @@ def skipUnlessHasattr(obj, attr): if hasattr(obj, attr): return lambda func: func - return unittest.skip("{0!r} doesn't have {1!r}".format(obj, attr)) + return unittest.skip("{!r} doesn't have {!r}".format(obj, attr)) The following decorators implement test skipping and expected failures: @@ -552,6 +552,13 @@ Mark the test as an expected failure. If the test fails when run, the test is not counted as a failure. +.. exception:: SkipTest(reason) + + This exception is raised to skip a test. + + Usually you can use :meth:`TestCase.skipTest` or one of the skipping + decorators instead of raising this directly. + Skipped tests will not have :meth:`setUp` or :meth:`tearDown` run around them. Skipped classes will not have :meth:`setUpClass` or :meth:`tearDownClass` run. @@ -1571,7 +1578,7 @@ If importing a module fails, for example due to a syntax error, then this will be recorded as a single error and discovery will continue. If the - import failure is due to ``SkipTest`` being raised, it will be recorded + import failure is due to :exc:`SkipTest` being raised, it will be recorded as a skip instead of an error. If a test package name (directory with :file:`__init__.py`) matches the @@ -1592,8 +1599,8 @@ .. versionadded:: 3.2 .. versionchanged:: 3.4 - Modules that raise ``SkipTest`` on import are recorded as skips, not - errors. + Modules that raise :exc:`SkipTest` on import are recorded as skips, + not errors. .. versionchanged:: 3.4 Paths are sorted before being imported to ensure execution order for a @@ -2066,7 +2073,7 @@ If an exception is raised during a ``setUpClass`` then the tests in the class are not run and the ``tearDownClass`` is not run. Skipped classes will not have ``setUpClass`` or ``tearDownClass`` run. If the exception is a -``SkipTest`` exception then the class will be reported as having been skipped +:exc:`SkipTest` exception then the class will be reported as having been skipped instead of as an error. @@ -2083,7 +2090,7 @@ If an exception is raised in a ``setUpModule`` then none of the tests in the module will be run and the ``tearDownModule`` will not be run. If the exception is a -``SkipTest`` exception then the module will be reported as having been skipped +:exc:`SkipTest` exception then the module will be reported as having been skipped instead of as an error. diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -23,7 +23,7 @@ """ Raise this exception in a test to skip it. - Usually you can use TestResult.skip() or one of the skipping decorators + Usually you can use TestCase.skipTest() or one of the skipping decorators instead of raising this directly. """ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 27 19:16:52 2013 From: python-checkins at python.org (ezio.melotti) Date: Wed, 27 Mar 2013 19:16:52 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzE3MzI5OiBkb2N1?= =?utf-8?q?ment_unittest=2ESkipTest=2E__Initial_patch_by_Zachary_Ware=2E?= Message-ID: <3ZbcqS0fY4zQkT@mail.python.org> http://hg.python.org/cpython/rev/13eb2fd70893 changeset: 82977:13eb2fd70893 branch: 2.7 parent: 82973:e87364449954 user: Ezio Melotti date: Wed Mar 27 20:11:55 2013 +0200 summary: #17329: document unittest.SkipTest. Initial patch by Zachary Ware. files: Doc/library/unittest.rst | 13 ++++++++++--- Lib/unittest/case.py | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -638,7 +638,7 @@ def skipUnlessHasattr(obj, attr): if hasattr(obj, attr): return lambda func: func - return unittest.skip("{0!r} doesn't have {1!r}".format(obj, attr)) + return unittest.skip("{!r} doesn't have {!r}".format(obj, attr)) The following decorators implement test skipping and expected failures: @@ -660,6 +660,13 @@ Mark the test as an expected failure. If the test fails when run, the test is not counted as a failure. +.. exception:: SkipTest(reason) + + This exception is raised to skip a test. + + Usually you can use :meth:`TestCase.skipTest` or one of the skipping + decorators instead of raising this directly. + Skipped tests will not have :meth:`setUp` or :meth:`tearDown` run around them. Skipped classes will not have :meth:`setUpClass` or :meth:`tearDownClass` run. @@ -1956,7 +1963,7 @@ If an exception is raised during a ``setUpClass`` then the tests in the class are not run and the ``tearDownClass`` is not run. Skipped classes will not have ``setUpClass`` or ``tearDownClass`` run. If the exception is a -``SkipTest`` exception then the class will be reported as having been skipped +:exc:`SkipTest` exception then the class will be reported as having been skipped instead of as an error. @@ -1973,7 +1980,7 @@ If an exception is raised in a ``setUpModule`` then none of the tests in the module will be run and the ``tearDownModule`` will not be run. If the exception is a -``SkipTest`` exception then the module will be reported as having been skipped +:exc:`SkipTest` exception then the module will be reported as having been skipped instead of as an error. diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -26,7 +26,7 @@ """ Raise this exception in a test to skip it. - Usually you can use TestResult.skip() or one of the skipping decorators + Usually you can use TestCase.skipTest() or one of the skipping decorators instead of raising this directly. """ pass -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Mar 27 22:53:24 2013 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 27 Mar 2013 22:53:24 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_update_importlib=2Eh?= Message-ID: <3ZbjdJ27QTzQyL@mail.python.org> http://hg.python.org/cpython/rev/fa38ea42e5b8 changeset: 82978:fa38ea42e5b8 parent: 82976:53cc3dbb1918 user: Benjamin Peterson date: Wed Mar 27 17:53:17 2013 -0400 summary: update importlib.h files: Python/importlib.h | 234 ++++++++++++++++---------------- 1 files changed, 117 insertions(+), 117 deletions(-) diff --git a/Python/importlib.h b/Python/importlib.h --- a/Python/importlib.h +++ b/Python/importlib.h [stripped] -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 28 04:12:49 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 28 Mar 2013 04:12:49 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E2=29=3A_Update_suspici?= =?utf-8?q?ous_ignore_file=2E?= Message-ID: <3Zbrjs42mpzMhy@mail.python.org> http://hg.python.org/cpython/rev/eb07feac1a70 changeset: 82979:eb07feac1a70 branch: 3.2 parent: 82974:cd5c23583fa5 user: Ezio Melotti date: Thu Mar 28 04:31:53 2013 +0200 summary: Update suspicious ignore file. files: Doc/faq/library.rst | 2 +- Doc/howto/logging-cookbook.rst | 2 +- Doc/library/sys.rst | 2 +- Doc/tools/sphinxext/susp-ignored.csv | 17 +++++++-------- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Doc/faq/library.rst b/Doc/faq/library.rst --- a/Doc/faq/library.rst +++ b/Doc/faq/library.rst @@ -351,7 +351,7 @@ Worker running with argument 5 ... -Consult the module's documentation for more details; the :class:`~queue.Queue`` +Consult the module's documentation for more details; the :class:`~queue.Queue` class provides a featureful interface. diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1572,7 +1572,7 @@ 'ASCII section\ufeffUnicode section' - The Unicode code point ``'\feff```, when encoded using UTF-8, will be + The Unicode code point ``'\ufeff'``, when encoded using UTF-8, will be encoded as a UTF-8 BOM -- the byte-string ``b'\xef\xbb\xbf'``. #. Replace the ASCII section with whatever placeholders you like, but make sure diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -764,7 +764,7 @@ independent Python files are installed; by default, this is the string ``'/usr/local'``. This can be set at build time with the ``--prefix`` argument to the :program:`configure` script. The main collection of Python - library modules is installed in the directory :file:`{prefix}/lib/python{X.Y}`` + library modules is installed in the directory :file:`{prefix}/lib/python{X.Y}` while the platform independent header files (all except :file:`pyconfig.h`) are stored in :file:`{prefix}/include/python{X.Y}`, where *X.Y* is the version number of Python, for example ``3.2``. diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv --- a/Doc/tools/sphinxext/susp-ignored.csv +++ b/Doc/tools/sphinxext/susp-ignored.csv @@ -88,8 +88,8 @@ library/smtplib,,:port,"as well as a regular host:port server." library/socket,,::,'5aef:2b::8' library/sqlite3,,:memory, -library/sqlite3,,:age,"select name_last, age from people where name_last=:who and age=:age" -library/sqlite3,,:who,"select name_last, age from people where name_last=:who and age=:age" +library/sqlite3,,:who,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})" +library/sqlite3,,:age,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})" library/ssl,,:My,"Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Organization, Inc." library/ssl,,:My,"Organizational Unit Name (eg, section) []:My Group" library/ssl,,:myserver,"Common Name (eg, YOUR name) []:myserver.mygroup.myorganization.com" @@ -112,9 +112,9 @@ library/urllib,,:port,:port library/urllib2,,:password,"""joe:password at python.org""" library/uuid,,:uuid,urn:uuid:12345678-1234-5678-1234-567812345678 -library/xmlrpclib,,:pass,http://user:pass at host:port/path -library/xmlrpclib,,:pass,user:pass -library/xmlrpclib,,:port,http://user:pass at host:port/path +library/xmlrpc.client,,:pass,http://user:pass at host:port/path +library/xmlrpc.client,,:port,http://user:pass at host:port/path +library/xmlrpc.client,,:pass,user:pass license,,`,THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND license,,:zooko,mailto:zooko at zooko.com license,,`,THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND @@ -169,10 +169,12 @@ faq/programming,,:chr,">=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr(" faq/programming,,::,for x in sequence[::-1]: faq/windows,229,:EOF, at setlocal enableextensions & python -x %~f0 %* & goto :EOF +faq/windows,,:bd8afb90ebf2,"Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32" faq/windows,393,:REG,.py :REG_SZ: c:\\python.exe -u %s %s library/bisect,32,:hi,all(val >= x for val in a[i:hi]) library/bisect,42,:hi,all(val > x for val in a[i:hi]) -library/http.client,52,:port,host:port +library/http.client,,:port,host:port +library/http.cookies,,`,!#$%&'*+-.^_`|~ library/nntplib,,:bytes,:bytes library/nntplib,,:lines,:lines library/nntplib,,:lines,"['xref', 'from', ':lines', ':bytes', 'references', 'date', 'message-id', 'subject']" @@ -185,9 +187,6 @@ library/urllib.request,,:close,Connection:close library/urllib.request,,:password,"""joe:password at python.org""" library/urllib.request,,:lang,"xmlns=""http://www.w3.org/1999/xhtml"" xml:lang=""en"" lang=""en"">\n\n\n" -library/xmlrpc.client,103,:pass,http://user:pass at host:port/path -library/xmlrpc.client,103,:port,http://user:pass at host:port/path -library/xmlrpc.client,103,:pass,user:pass license,,`,* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY license,,`,* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND license,,`,"``Software''), to deal in the Software without restriction, including" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 28 04:12:51 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 28 Mar 2013 04:12:51 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMyk6?= =?utf-8?q?_Update_suspicious_ignore_file=2E?= Message-ID: <3Zbrjv0l0bzRBM@mail.python.org> http://hg.python.org/cpython/rev/59c301b67140 changeset: 82980:59c301b67140 branch: 3.3 parent: 82975:4bf2a53b53b6 parent: 82979:eb07feac1a70 user: Ezio Melotti date: Thu Mar 28 04:54:58 2013 +0200 summary: Update suspicious ignore file. files: Doc/howto/logging-cookbook.rst | 2 +- Doc/tools/sphinxext/susp-ignored.csv | 21 ++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletions(-) diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1599,7 +1599,7 @@ 'ASCII section\ufeffUnicode section' - The Unicode code point ``'\feff'``, when encoded using UTF-8, will be + The Unicode code point ``'\ufeff'``, when encoded using UTF-8, will be encoded as a UTF-8 BOM -- the byte-string ``b'\xef\xbb\xbf'``. #. Replace the ASCII section with whatever placeholders you like, but make sure diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv --- a/Doc/tools/sphinxext/susp-ignored.csv +++ b/Doc/tools/sphinxext/susp-ignored.csv @@ -17,6 +17,7 @@ faq/programming,,::,for x in sequence[::-1]: faq/programming,,:reduce,"print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y," faq/programming,,:reduce,"Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro," +faq/windows,,:bd8afb90ebf2,"Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32" faq/windows,229,:EOF, at setlocal enableextensions & python -x %~f0 %* & goto :EOF faq/windows,393,:REG,.py :REG_SZ: c:\\python.exe -u %s %s howto/cporting,,:add,"if (!PyArg_ParseTuple(args, ""ii:add_ints"", &one, &two))" @@ -68,6 +69,13 @@ howto/ipaddress,,::,'2001:db8::' howto/ipaddress,,:db8,'2001:db8::/96' howto/ipaddress,,::,'2001:db8::/96' +howto/ipaddress,,:db8,>>> ipaddress.ip_interface('2001:db8::1/96') +howto/ipaddress,,::,>>> ipaddress.ip_interface('2001:db8::1/96') +howto/ipaddress,,:db8,'2001:db8::1' +howto/ipaddress,,::,'2001:db8::1' +howto/ipaddress,,:db8,IPv6Address('2001:db8::ffff:ffff') +howto/ipaddress,,::,IPv6Address('2001:db8::ffff:ffff') +howto/ipaddress,,:ffff,IPv6Address('2001:db8::ffff:ffff') howto/logging,,:And,"WARNING:And this, too" howto/logging,,:And,"WARNING:root:And this, too" howto/logging,,:Doing,INFO:root:Doing something @@ -99,6 +107,7 @@ library/audioop,,:ipos,"# factor = audioop.findfactor(in_test[ipos*2:ipos*2+len(out_test)]," library/bisect,32,:hi,all(val >= x for val in a[i:hi]) library/bisect,42,:hi,all(val > x for val in a[i:hi]) +library/concurrent.futures,,:url,"future_to_url = {executor.submit(load_url, url, 60):url for url in URLS}" library/configparser,,:home,my_dir: ${Common:home_dir}/twosheds library/configparser,,:option,${section:option} library/configparser,,:path,python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python} @@ -120,6 +129,7 @@ library/doctest,,`,``factorial`` from the ``example`` module: library/doctest,,`,The ``example`` module library/doctest,,`,Using ``factorial`` +library/exceptions,,:err,err.object[err.start:err.end] library/functions,,:step,a[start:stop:step] library/functions,,:stop,"a[start:stop, i]" library/functions,,:stop,a[start:stop:step] @@ -280,6 +290,10 @@ library/urllib.request,,:lang,"xmlns=""http://www.w3.org/1999/xhtml"" xml:lang=""en"" lang=""en"">\n\n\n" library/urllib.request,,:password,"""joe:password at python.org""" library/uuid,,:uuid,urn:uuid:12345678-1234-5678-1234-567812345678 +library/venv,,:param,":param nodist: If True, Distribute is not installed into the created" +library/venv,,:param,":param nopip: If True, pip is not installed into the created" +library/venv,,:param,":param progress: If Distribute or pip are installed, the progress of the" +library/venv,,:param,:param context: The information for the environment creation request library/xmlrpc.client,,:pass,http://user:pass at host:port/path library/xmlrpc.client,,:pass,user:pass library/xmlrpc.client,,:port,http://user:pass at host:port/path @@ -357,6 +371,13 @@ whatsnew/3.2,,:location,zope9-location = ${zope9:location} whatsnew/3.2,,:prefix,... zope-conf = ${custom:prefix}/etc/zope.conf whatsnew/3.2,,:prefix,zope-conf = ${custom:prefix}/etc/zope.conf +whatsnew/changelog,,:platform,:platform: +whatsnew/changelog,,:password,: Unquote before b64encoding user:password during Basic +whatsnew/changelog,,:close,Connection:close header. +whatsnew/changelog,,:PythonCmd,"With Tk < 8.5 _tkinter.c:PythonCmd() raised UnicodeDecodeError, caused" +whatsnew/changelog,,:close,: Connection:close header is sent by requests using URLOpener +whatsnew/changelog,,::,": Fix FTP tests for IPv6, bind to ""::1"" instead of ""localhost""." +whatsnew/changelog,,:test,: test_subprocess:test_leaking_fds_on_error no longer gives a whatsnew/news,,:platform,:platform: whatsnew/news,,:password,: Unquote before b64encoding user:password during Basic whatsnew/news,,:close,Connection:close header. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 28 04:12:52 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 28 Mar 2013 04:12:52 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Update_suspicious_ignore_file=2E?= Message-ID: <3Zbrjw4dPBzRCC@mail.python.org> http://hg.python.org/cpython/rev/5f6064ec2369 changeset: 82981:5f6064ec2369 parent: 82978:fa38ea42e5b8 parent: 82980:59c301b67140 user: Ezio Melotti date: Thu Mar 28 05:12:31 2013 +0200 summary: Update suspicious ignore file. files: Doc/howto/logging-cookbook.rst | 2 +- Doc/tools/sphinxext/susp-ignored.csv | 23 ++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletions(-) diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1597,7 +1597,7 @@ 'ASCII section\ufeffUnicode section' - The Unicode code point ``'\feff'``, when encoded using UTF-8, will be + The Unicode code point ``'\ufeff'``, when encoded using UTF-8, will be encoded as a UTF-8 BOM -- the byte-string ``b'\xef\xbb\xbf'``. #. Replace the ASCII section with whatever placeholders you like, but make sure diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv --- a/Doc/tools/sphinxext/susp-ignored.csv +++ b/Doc/tools/sphinxext/susp-ignored.csv @@ -17,6 +17,7 @@ faq/programming,,::,for x in sequence[::-1]: faq/programming,,:reduce,"print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y," faq/programming,,:reduce,"Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro," +faq/windows,,:bd8afb90ebf2,"Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32" faq/windows,229,:EOF, at setlocal enableextensions & python -x %~f0 %* & goto :EOF faq/windows,393,:REG,.py :REG_SZ: c:\\python.exe -u %s %s howto/cporting,,:add,"if (!PyArg_ParseTuple(args, ""ii:add_ints"", &one, &two))" @@ -68,6 +69,13 @@ howto/ipaddress,,::,'2001:db8::' howto/ipaddress,,:db8,'2001:db8::/96' howto/ipaddress,,::,'2001:db8::/96' +howto/ipaddress,,:db8,>>> ipaddress.ip_interface('2001:db8::1/96') +howto/ipaddress,,::,>>> ipaddress.ip_interface('2001:db8::1/96') +howto/ipaddress,,:db8,'2001:db8::1' +howto/ipaddress,,::,'2001:db8::1' +howto/ipaddress,,:db8,IPv6Address('2001:db8::ffff:ffff') +howto/ipaddress,,::,IPv6Address('2001:db8::ffff:ffff') +howto/ipaddress,,:ffff,IPv6Address('2001:db8::ffff:ffff') howto/logging,,:And,"WARNING:And this, too" howto/logging,,:And,"WARNING:root:And this, too" howto/logging,,:Doing,INFO:root:Doing something @@ -99,6 +107,7 @@ library/audioop,,:ipos,"# factor = audioop.findfactor(in_test[ipos*2:ipos*2+len(out_test)]," library/bisect,32,:hi,all(val >= x for val in a[i:hi]) library/bisect,42,:hi,all(val > x for val in a[i:hi]) +library/concurrent.futures,,:url,"future_to_url = {executor.submit(load_url, url, 60):url for url in URLS}" library/configparser,,:home,my_dir: ${Common:home_dir}/twosheds library/configparser,,:option,${section:option} library/configparser,,:path,python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python} @@ -120,6 +129,7 @@ library/doctest,,`,``factorial`` from the ``example`` module: library/doctest,,`,The ``example`` module library/doctest,,`,Using ``factorial`` +library/exceptions,,:err,err.object[err.start:err.end] library/functions,,:step,a[start:stop:step] library/functions,,:stop,"a[start:stop, i]" library/functions,,:stop,a[start:stop:step] @@ -221,6 +231,7 @@ library/pdb,,:lineno,[filename:lineno | bpnumber [bpnumber ...]] library/pickle,,:memory,"conn = sqlite3.connect("":memory:"")" library/posix,,`,"CFLAGS=""`getconf LFS_CFLAGS`"" OPT=""-g -O2 $CFLAGS""" +library/pprint,,::,"'Programming Language :: Python :: 2 :: Only']," library/pprint,209,::,"'classifiers': ['Development Status :: 4 - Beta'," library/pprint,209,::,"'Intended Audience :: Developers'," library/pprint,209,::,"'License :: OSI Approved :: MIT License'," @@ -248,6 +259,7 @@ library/sqlite3,,:age,"select name_last, age from people where name_last=:who and age=:age" library/sqlite3,,:memory, library/sqlite3,,:who,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})" +library/sqlite3,,:path,"db = sqlite3.connect('file:path/to/database?mode=ro', uri=True)" library/ssl,,:My,"Organizational Unit Name (eg, section) []:My Group" library/ssl,,:My,"Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Organization, Inc." library/ssl,,:myserver,"Common Name (eg, YOUR name) []:myserver.mygroup.myorganization.com" @@ -280,6 +292,10 @@ library/urllib.request,,:lang,"xmlns=""http://www.w3.org/1999/xhtml"" xml:lang=""en"" lang=""en"">\n\n\n" library/urllib.request,,:password,"""joe:password at python.org""" library/uuid,,:uuid,urn:uuid:12345678-1234-5678-1234-567812345678 +library/venv,,:param,":param nodist: If True, Distribute is not installed into the created" +library/venv,,:param,":param nopip: If True, pip is not installed into the created" +library/venv,,:param,":param progress: If Distribute or pip are installed, the progress of the" +library/venv,,:param,:param context: The information for the environment creation request library/xmlrpc.client,,:pass,http://user:pass at host:port/path library/xmlrpc.client,,:pass,user:pass library/xmlrpc.client,,:port,http://user:pass at host:port/path @@ -357,6 +373,13 @@ whatsnew/3.2,,:location,zope9-location = ${zope9:location} whatsnew/3.2,,:prefix,... zope-conf = ${custom:prefix}/etc/zope.conf whatsnew/3.2,,:prefix,zope-conf = ${custom:prefix}/etc/zope.conf +whatsnew/changelog,,:platform,:platform: +whatsnew/changelog,,:password,: Unquote before b64encoding user:password during Basic +whatsnew/changelog,,:close,Connection:close header. +whatsnew/changelog,,:PythonCmd,"With Tk < 8.5 _tkinter.c:PythonCmd() raised UnicodeDecodeError, caused" +whatsnew/changelog,,:close,: Connection:close header is sent by requests using URLOpener +whatsnew/changelog,,::,": Fix FTP tests for IPv6, bind to ""::1"" instead of ""localhost""." +whatsnew/changelog,,:test,: test_subprocess:test_leaking_fds_on_error no longer gives a whatsnew/news,,:platform,:platform: whatsnew/news,,:password,: Unquote before b64encoding user:password during Basic whatsnew/news,,:close,Connection:close header. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 28 04:47:47 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 28 Mar 2013 04:47:47 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Update_suspici?= =?utf-8?q?ous_ignore_file=2E?= Message-ID: <3ZbsVC0cSDzRGC@mail.python.org> http://hg.python.org/cpython/rev/2303165434b4 changeset: 82982:2303165434b4 branch: 2.7 parent: 82977:13eb2fd70893 user: Ezio Melotti date: Thu Mar 28 05:47:31 2013 +0200 summary: Update suspicious ignore file. files: Doc/howto/logging-cookbook.rst | 2 +- Doc/library/socket.rst | 2 +- Doc/library/subprocess.rst | 2 +- Doc/library/sys.rst | 2 +- Doc/reference/simple_stmts.rst | 2 +- Doc/tools/sphinxext/susp-ignored.csv | 36 ++++++++++++++- 6 files changed, 37 insertions(+), 9 deletions(-) diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -773,7 +773,7 @@ u'ASCII section\ufeffUnicode section' - The Unicode code point ``u'\feff```, when encoded using UTF-8, will be + The Unicode code point ``u'\ufeff'``, when encoded using UTF-8, will be encoded as a UTF-8 BOM -- the byte-string ``'\xef\xbb\xbf'``. #. Replace the ASCII section with whatever placeholders you like, but make sure diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -72,7 +72,7 @@ tuple, and the fields depend on the address type. The general tuple form is ``(addr_type, v1, v2, v3 [, scope])``, where: - - *addr_type* is one of :const;`TIPC_ADDR_NAMESEQ`, :const:`TIPC_ADDR_NAME`, + - *addr_type* is one of :const:`TIPC_ADDR_NAMESEQ`, :const:`TIPC_ADDR_NAME`, or :const:`TIPC_ADDR_ID`. - *scope* is one of :const:`TIPC_ZONE_SCOPE`, :const:`TIPC_CLUSTER_SCOPE`, and :const:`TIPC_NODE_SCOPE`. diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -225,7 +225,7 @@ When *stdout* or *stderr* are pipes and *universal_newlines* is ``True`` then all line endings will be converted to ``'\n'`` as described - for the :term:`universal newlines` `'U'`` mode argument to :func:`open`. + for the :term:`universal newlines` ``'U'`` mode argument to :func:`open`. If *shell* is ``True``, the specified command will be executed through the shell. This can be useful if you are using Python primarily for the diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -774,7 +774,7 @@ independent Python files are installed; by default, this is the string ``'/usr/local'``. This can be set at build time with the ``--prefix`` argument to the :program:`configure` script. The main collection of Python - library modules is installed in the directory :file:`{prefix}/lib/python{X.Y}`` + library modules is installed in the directory :file:`{prefix}/lib/python{X.Y}` while the platform independent header files (all except :file:`pyconfig.h`) are stored in :file:`{prefix}/include/python{X.Y}`, where *X.Y* is the version number of Python, for example ``2.7``. diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -737,7 +737,7 @@ stored in :data:`sys.path_importer_cache` to signify that an implicit, file-based finder that handles modules stored as individual files should be used for that path. If the path does not exist then a finder which always -returns `None`` is placed in the cache for the path. +returns ``None`` is placed in the cache for the path. .. index:: single: loader diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv --- a/Doc/tools/sphinxext/susp-ignored.csv +++ b/Doc/tools/sphinxext/susp-ignored.csv @@ -22,11 +22,33 @@ howto/curses,,:red,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and" howto/curses,,:white,"7:white." howto/curses,,:yellow,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and" +howto/logging,,:root,WARNING:root:Watch out! +howto/logging,,:Watch,WARNING:root:Watch out! +howto/logging,,:root,DEBUG:root:This message should go to the log file +howto/logging,,:root,INFO:root:So should this +howto/logging,,:So,INFO:root:So should this +howto/logging,,:root,"WARNING:root:And this, too" +howto/logging,,:And,"WARNING:root:And this, too" +howto/logging,,:root,INFO:root:Started +howto/logging,,:Started,INFO:root:Started +howto/logging,,:root,INFO:root:Doing something +howto/logging,,:Doing,INFO:root:Doing something +howto/logging,,:root,INFO:root:Finished +howto/logging,,:Finished,INFO:root:Finished +howto/logging,,:root,WARNING:root:Look before you leap! +howto/logging,,:Look,WARNING:root:Look before you leap! +howto/logging,,:This,DEBUG:This message should appear on the console +howto/logging,,:So,INFO:So should this +howto/logging,,:And,"WARNING:And this, too" +howto/logging,,:logger,severity:logger name:message +howto/logging,,:message,severity:logger name:message +howto/logging,,:This,DEBUG:root:This message should go to the log file howto/regex,,::, howto/regex,,:foo,(?:foo) howto/urllib2,,:example,"for example ""joe at password:example.com""" howto/webservers,,.. image:,.. image:: http.png library/audioop,,:ipos,"# factor = audioop.findfactor(in_test[ipos*2:ipos*2+len(out_test)]," +library/cookie,,`,!#$%&'*+-.^_`|~ library/datetime,,:MM, library/datetime,,:SS, library/decimal,,:optional,"trailneg:optional trailing minus indicator" @@ -40,13 +62,14 @@ library/doctest,,`,``factorial`` from the ``example`` module: library/doctest,,`,The ``example`` module library/doctest,,`,Using ``factorial`` +library/exceptions,,:err,err.object[err.start:err.end] library/functions,,:step,a[start:stop:step] library/functions,,:stop,"a[start:stop, i]" library/functions,,:stop,a[start:stop:step] library/hotshot,,:lineno,"ncalls tottime percall cumtime percall filename:lineno(function)" library/httplib,,:port,host:port -library/imaplib,,:MM,"""DD-Mmm-YYYY HH:MM:SS +HHMM""" -library/imaplib,,:SS,"""DD-Mmm-YYYY HH:MM:SS +HHMM""" +library/imaplib,,:MM,"""DD-Mmm-YYYY HH:MM:SS" +library/imaplib,,:SS,"""DD-Mmm-YYYY HH:MM:SS" library/itertools,,:stop,elements from seq[start:stop:step] library/itertools,,:step,elements from seq[start:stop:step] library/linecache,,:sys,"sys:x:3:3:sys:/dev:/bin/sh" @@ -56,6 +79,7 @@ library/logging,,:root, library/logging,,:This, library/logging,,:port,host:port +library/logging.handlers,,:port,host:port library/mmap,,:i2,obj[i1:i2] library/multiprocessing,,:queue,">>> QueueManager.register('get_queue', callable=lambda:queue)" library/multiprocessing,,`,">>> l._callmethod('__getitem__', (20,)) # equiv to `l[20]`" @@ -79,6 +103,8 @@ library/optparse,,:len,"del parser.rargs[:len(value)]" library/os.path,,:foo,c:foo library/parser,,`,"""Make a function that raises an argument to the exponent `exp`.""" +library/pdb,,:lineno,filename:lineno +library/pdb,,:lineno,filename:lineno library/posix,,`,"CFLAGS=""`getconf LFS_CFLAGS`"" OPT=""-g -O2 $CFLAGS""" library/profile,,:lineno,ncalls tottime percall cumtime percall filename:lineno(function) library/profile,,:lineno,filename:lineno(function) @@ -88,8 +114,8 @@ library/smtplib,,:port,"as well as a regular host:port server." library/socket,,::,'5aef:2b::8' library/sqlite3,,:memory, -library/sqlite3,,:age,"select name_last, age from people where name_last=:who and age=:age" -library/sqlite3,,:who,"select name_last, age from people where name_last=:who and age=:age" +library/sqlite3,,:who,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})" +library/sqlite3,,:age,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})" library/ssl,,:My,"Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Organization, Inc." library/ssl,,:My,"Organizational Unit Name (eg, section) []:My Group" library/ssl,,:myserver,"Common Name (eg, YOUR name) []:myserver.mygroup.myorganization.com" @@ -123,6 +149,8 @@ reference/expressions,,:index,x[index:index] reference/expressions,,:datum,{key:datum...} reference/expressions,,`,`expressions...` +reference/expressions,,`,"""`""" +reference/expressions,,`,"""`""" reference/grammar,,:output,#diagram:output reference/grammar,,:rules,#diagram:rules reference/grammar,,:token,#diagram:token -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Thu Mar 28 05:51:37 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 28 Mar 2013 05:51:37 +0100 Subject: [Python-checkins] Daily reference leaks (fa38ea42e5b8): sum=2 Message-ID: results for fa38ea42e5b8 on branch "default" -------------------------------------------- test_unittest leaked [-1, 2, 1] memory blocks, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogznoKSQ', '-x'] From python-checkins at python.org Thu Mar 28 09:11:54 2013 From: python-checkins at python.org (georg.brandl) Date: Thu, 28 Mar 2013 09:11:54 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Fix_XML_vulner?= =?utf-8?q?ability_link_targets=2E?= Message-ID: <3ZbzLy4BnfzRL7@mail.python.org> http://hg.python.org/cpython/rev/7b4e0e1ba2a1 changeset: 82983:7b4e0e1ba2a1 branch: 3.3 parent: 82980:59c301b67140 user: Georg Brandl date: Thu Mar 28 09:11:44 2013 +0100 summary: Fix XML vulnerability link targets. files: Doc/library/xml.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst --- a/Doc/library/xml.rst +++ b/Doc/library/xml.rst @@ -125,8 +125,8 @@ well-definied XML features. -.. _defusedxml: -.. _defusedexpat: +.. _defusedxml: https://pypi.python.org/pypi/defusedxml/ +.. _defusedexpat: https://pypi.python.org/pypi/defusedexpat/ .. _Billion Laughs: http://en.wikipedia.org/wiki/Billion_laughs .. _ZIP bomb: http://en.wikipedia.org/wiki/Zip_bomb .. _DTD: http://en.wikipedia.org/wiki/Document_Type_Definition -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 28 09:11:55 2013 From: python-checkins at python.org (georg.brandl) Date: Thu, 28 Mar 2013 09:11:55 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_merge_with_3=2E3?= Message-ID: <3ZbzLz6pkTzRL7@mail.python.org> http://hg.python.org/cpython/rev/8bcda4f2b3a1 changeset: 82984:8bcda4f2b3a1 parent: 82981:5f6064ec2369 parent: 82983:7b4e0e1ba2a1 user: Georg Brandl date: Thu Mar 28 09:11:59 2013 +0100 summary: merge with 3.3 files: Doc/library/xml.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst --- a/Doc/library/xml.rst +++ b/Doc/library/xml.rst @@ -125,8 +125,8 @@ well-definied XML features. -.. _defusedxml: -.. _defusedexpat: +.. _defusedxml: https://pypi.python.org/pypi/defusedxml/ +.. _defusedexpat: https://pypi.python.org/pypi/defusedexpat/ .. _Billion Laughs: http://en.wikipedia.org/wiki/Billion_laughs .. _ZIP bomb: http://en.wikipedia.org/wiki/Zip_bomb .. _DTD: http://en.wikipedia.org/wiki/Document_Type_Definition -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 28 11:43:01 2013 From: python-checkins at python.org (christian.heimes) Date: Thu, 28 Mar 2013 11:43:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fix_XML_vulner?= =?utf-8?q?ability_link_targets=2E?= Message-ID: <3Zc2jK3BmvzQvj@mail.python.org> http://hg.python.org/cpython/rev/5fddf795de2c changeset: 82985:5fddf795de2c branch: 2.7 parent: 82982:2303165434b4 user: Christian Heimes date: Thu Mar 28 11:42:49 2013 +0100 summary: Fix XML vulnerability link targets. files: Doc/library/xml.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst --- a/Doc/library/xml.rst +++ b/Doc/library/xml.rst @@ -124,8 +124,8 @@ well-definied XML features. -.. _defusedxml: -.. _defusedexpat: +.. _defusedxml: https://pypi.python.org/pypi/defusedxml/ +.. _defusedexpat: https://pypi.python.org/pypi/defusedexpat/ .. _Billion Laughs: http://en.wikipedia.org/wiki/Billion_laughs .. _ZIP bomb: http://en.wikipedia.org/wiki/Zip_bomb .. _DTD: http://en.wikipedia.org/wiki/Document_Type_Definition -- Repository URL: http://hg.python.org/cpython From root at python.org Thu Mar 28 12:20:23 2013 From: root at python.org (Cron Daemon) Date: Thu, 28 Mar 2013 12:20:23 +0100 Subject: [Python-checkins] Cron /home/docs/build-devguide Message-ID: abort: error: Connection timed out From root at python.org Thu Mar 28 12:30:22 2013 From: root at python.org (Cron Daemon) Date: Thu, 28 Mar 2013 12:30:22 +0100 Subject: [Python-checkins] Cron /home/docs/build-devguide Message-ID: abort: error: Connection timed out From python-checkins at python.org Thu Mar 28 13:28:49 2013 From: python-checkins at python.org (georg.brandl) Date: Thu, 28 Mar 2013 13:28:49 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogQ2xvc2VzICM0MTU5?= =?utf-8?q?=3A_add_LaTeX_tabular_column_specifications_to_tables_that_othe?= =?utf-8?q?rwise?= Message-ID: <3Zc53P5YT4zRCN@mail.python.org> http://hg.python.org/cpython/rev/3ae74b361f53 changeset: 82986:3ae74b361f53 branch: 3.3 parent: 82983:7b4e0e1ba2a1 user: Georg Brandl date: Thu Mar 28 13:28:44 2013 +0100 summary: Closes #4159: add LaTeX tabular column specifications to tables that otherwise are cut off or have overlapping text. files: Doc/c-api/buffer.rst | 5 +- Doc/c-api/bytes.rst | 2 + Doc/c-api/unicode.rst | 2 + Doc/distutils/apiref.rst | 8 ++ Doc/faq/extending.rst | 4 +- Doc/faq/general.rst | 5 +- Doc/faq/gui.rst | 4 +- Doc/faq/library.rst | 4 +- Doc/faq/programming.rst | 4 +- Doc/faq/windows.rst | 4 +- Doc/howto/logging.rst | 2 + Doc/install/index.rst | 2 + Doc/library/codecs.rst | 10 ++ Doc/library/collections.abc.rst | 4 +- Doc/library/concurrent.futures.rst | 2 + Doc/library/email.policy.rst | 2 + Doc/library/functions.rst | 2 +- Doc/library/inspect.rst | 2 + Doc/library/io.rst | 2 + Doc/library/locale.rst | 2 + Doc/library/logging.rst | 2 + Doc/library/subprocess.rst | 2 + Doc/library/sys.rst | 6 + Doc/library/tkinter.ttk.rst | 56 ++++++++++---- Doc/library/turtle.rst | 4 +- Doc/library/warnings.rst | 2 + Doc/library/xml.etree.elementtree.rst | 2 + Doc/library/xmlrpc.client.rst | 2 + Doc/reference/datamodel.rst | 2 + Doc/reference/expressions.rst | 2 +- Doc/reference/import.rst | 3 +- Doc/whatsnew/3.3.rst | 4 + 32 files changed, 129 insertions(+), 30 deletions(-) diff --git a/Doc/c-api/buffer.rst b/Doc/c-api/buffer.rst --- a/Doc/c-api/buffer.rst +++ b/Doc/c-api/buffer.rst @@ -263,6 +263,7 @@ in decreasing order of complexity. Note that each flag contains all bits of the flags below it. +.. tabularcolumns:: |p{0.35\linewidth}|l|l|l| +-----------------------------+-------+---------+------------+ | Request | shape | strides | suboffsets | @@ -283,6 +284,8 @@ C or Fortran contiguity can be explicitly requested, with and without stride information. Without stride information, the buffer must be C-contiguous. +.. tabularcolumns:: |p{0.35\linewidth}|l|l|l|l| + +-----------------------------------+-------+---------+------------+--------+ | Request | shape | strides | suboffsets | contig | +===================================+=======+=========+============+========+ @@ -306,7 +309,7 @@ In the following table *U* stands for undefined contiguity. The consumer would have to call :c:func:`PyBuffer_IsContiguous` to determine contiguity. - +.. tabularcolumns:: |p{0.35\linewidth}|l|l|l|l|l|l| +-------------------------------+-------+---------+------------+--------+----------+--------+ | Request | shape | strides | suboffsets | contig | readonly | format | diff --git a/Doc/c-api/bytes.rst b/Doc/c-api/bytes.rst --- a/Doc/c-api/bytes.rst +++ b/Doc/c-api/bytes.rst @@ -62,6 +62,8 @@ .. % because not all compilers support the %z width modifier -- we fake it .. % when necessary via interpolating PY_FORMAT_SIZE_T. + .. tabularcolumns:: |l|l|L| + +-------------------+---------------+--------------------------------+ | Format Characters | Type | Comment | +===================+===============+================================+ diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -439,6 +439,8 @@ .. % Similar comments apply to the %ll width modifier and .. % PY_FORMAT_LONG_LONG. + .. tabularcolumns:: |l|l|L| + +-------------------+---------------------+--------------------------------+ | Format Characters | Type | Comment | +===================+=====================+================================+ diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst --- a/Doc/distutils/apiref.rst +++ b/Doc/distutils/apiref.rst @@ -26,6 +26,8 @@ The setup function takes a large number of arguments. These are laid out in the following table. + .. tabularcolumns:: |l|L|L| + +--------------------+--------------------------------+-------------------------------------------------------------+ | argument name | value | type | +====================+================================+=============================================================+ @@ -125,6 +127,8 @@ *stop_after* tells :func:`setup` when to stop processing; possible values: + .. tabularcolumns:: |l|L| + +---------------+---------------------------------------------+ | value | description | +===============+=============================================+ @@ -165,6 +169,8 @@ The Extension class describes a single C or C++extension module in a setup script. It accepts the following keyword arguments in its constructor: + .. tabularcolumns:: |l|L|l| + +------------------------+--------------------------------+---------------------------+ | argument name | value | type | +========================+================================+===========================+ @@ -1562,6 +1568,8 @@ The options are all boolean, and affect the values returned by :meth:`readline` + .. tabularcolumns:: |l|L|l| + +------------------+--------------------------------+---------+ | option name | description | default | +==================+================================+=========+ diff --git a/Doc/faq/extending.rst b/Doc/faq/extending.rst --- a/Doc/faq/extending.rst +++ b/Doc/faq/extending.rst @@ -2,7 +2,9 @@ Extending/Embedding FAQ ======================= -.. contents:: +.. only:: html + + .. contents:: .. highlight:: c diff --git a/Doc/faq/general.rst b/Doc/faq/general.rst --- a/Doc/faq/general.rst +++ b/Doc/faq/general.rst @@ -4,7 +4,10 @@ General Python FAQ ================== -.. contents:: +.. only:: html + + .. contents:: + General Information =================== diff --git a/Doc/faq/gui.rst b/Doc/faq/gui.rst --- a/Doc/faq/gui.rst +++ b/Doc/faq/gui.rst @@ -4,7 +4,9 @@ Graphic User Interface FAQ ========================== -.. contents:: +.. only:: html + + .. contents:: .. XXX need review for Python 3. diff --git a/Doc/faq/library.rst b/Doc/faq/library.rst --- a/Doc/faq/library.rst +++ b/Doc/faq/library.rst @@ -4,7 +4,9 @@ Library and Extension FAQ ========================= -.. contents:: +.. only:: html + + .. contents:: General Library Questions ========================= diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -4,7 +4,9 @@ Programming FAQ =============== -.. contents:: +.. only:: html + + .. contents:: General Questions ================= diff --git a/Doc/faq/windows.rst b/Doc/faq/windows.rst --- a/Doc/faq/windows.rst +++ b/Doc/faq/windows.rst @@ -6,7 +6,9 @@ Python on Windows FAQ ===================== -.. contents:: +.. only:: html + + .. contents:: .. XXX need review for Python 3. XXX need review for Windows Vista/Seven? diff --git a/Doc/howto/logging.rst b/Doc/howto/logging.rst --- a/Doc/howto/logging.rst +++ b/Doc/howto/logging.rst @@ -63,6 +63,8 @@ they are used to track. The standard levels and their applicability are described below (in increasing order of severity): +.. tabularcolumns:: |l|L| + +--------------+---------------------------------------------+ | Level | When it's used | +==============+=============================================+ diff --git a/Doc/install/index.rst b/Doc/install/index.rst --- a/Doc/install/index.rst +++ b/Doc/install/index.rst @@ -235,6 +235,8 @@ Unix-based), it also depends on whether the module distribution being installed is pure Python or contains extensions ("non-pure"): +.. tabularcolumns:: |l|l|l|l| + +-----------------+-----------------------------------------------------+--------------------------------------------------+-------+ | Platform | Standard installation location | Default value | Notes | +=================+=====================================================+==================================================+=======+ diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -315,6 +315,8 @@ providing the *errors* string argument. The following string values are defined and implemented by all standard Python codecs: +.. tabularcolumns:: |l|L| + +-------------------------+-----------------------------------------------+ | Value | Meaning | +=========================+===============================================+ @@ -926,6 +928,8 @@ * an IBM PC code page, which is ASCII compatible +.. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}| + +-----------------+--------------------------------+--------------------------------+ | Codec | Aliases | Languages | +=================+================================+================================+ @@ -1140,6 +1144,8 @@ .. XXX fix here, should be in above table +.. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}| + +--------------------+---------+---------------------------+ | Codec | Aliases | Purpose | +====================+=========+===========================+ @@ -1182,6 +1188,8 @@ The following codecs provide bytes-to-bytes mappings. +.. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}| + +--------------------+---------------------------+---------------------------+ | Codec | Aliases | Purpose | +====================+===========================+===========================+ @@ -1208,6 +1216,8 @@ The following codecs provide string-to-string mappings. +.. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}| + +--------------------+---------------------------+---------------------------+ | Codec | Aliases | Purpose | +====================+===========================+===========================+ diff --git a/Doc/library/collections.abc.rst b/Doc/library/collections.abc.rst --- a/Doc/library/collections.abc.rst +++ b/Doc/library/collections.abc.rst @@ -31,6 +31,8 @@ The collections module offers the following :term:`ABCs `: +.. tabularcolumns:: |l|L|L|L| + ========================= ===================== ====================== ==================================================== ABC Inherits from Abstract Methods Mixin Methods ========================= ===================== ====================== ==================================================== @@ -134,7 +136,7 @@ the full :class:`Set` API, it only necessary to supply the three underlying abstract methods: :meth:`__contains__`, :meth:`__iter__`, and :meth:`__len__`. The ABC supplies the remaining methods such as :meth:`__and__` and -:meth:`isdisjoint` :: +:meth:`isdisjoint`:: class ListBasedSet(collections.Set): ''' Alternate set implementation favoring space over speed diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst --- a/Doc/library/concurrent.futures.rst +++ b/Doc/library/concurrent.futures.rst @@ -346,6 +346,8 @@ *return_when* indicates when this function should return. It must be one of the following constants: + .. tabularcolumns:: |l|L| + +-----------------------------+----------------------------------------+ | Constant | Description | +=============================+========================================+ diff --git a/Doc/library/email.policy.rst b/Doc/library/email.policy.rst --- a/Doc/library/email.policy.rst +++ b/Doc/library/email.policy.rst @@ -139,6 +139,8 @@ Controls the type of Content Transfer Encodings that may be or are required to be used. The possible values are: + .. tabularcolumns:: |l|L| + ======== =============================================================== ``7bit`` all data must be "7 bit clean" (ASCII-only). This means that where necessary data will be encoded using either diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -843,7 +843,7 @@ ========= =============================================================== Character Meaning - --------- --------------------------------------------------------------- + ========= =============================================================== ``'r'`` open for reading (default) ``'w'`` open for writing, truncating the file first ``'x'`` open for exclusive creation, failing if the file already exists diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -520,6 +520,8 @@ Describes how argument values are bound to the parameter. Possible values (accessible via :class:`Parameter`, like ``Parameter.KEYWORD_ONLY``): + .. tabularcolumns:: |l|L| + +------------------------+----------------------------------------------+ | Name | Meaning | +========================+==============================================+ diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -187,6 +187,8 @@ The following table summarizes the ABCs provided by the :mod:`io` module: +.. tabularcolumns:: |l|l|L|L| + ========================= ================== ======================== ================================================== ABC Inherits Stub Methods Mixin Methods and Properties ========================= ================== ======================== ================================================== diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst --- a/Doc/library/locale.rst +++ b/Doc/library/locale.rst @@ -55,6 +55,8 @@ Returns the database of the local conventions as a dictionary. This dictionary has the following strings as keys: + .. tabularcolumns:: |l|l|L| + +----------------------+-------------------------------------+--------------------------------+ | Category | Key | Meaning | +======================+=====================================+================================+ diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -1037,6 +1037,8 @@ The following keyword arguments are supported. + .. tabularcolumns:: |l|L| + +--------------+---------------------------------------------+ | Format | Description | +==============+=============================================+ diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -169,6 +169,8 @@ .. versionadded:: 3.1 + .. + .. warning:: Invoking the system shell with ``shell=True`` can be a security hazard diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -307,6 +307,8 @@ programming language; see section 5.2.4.2.2 of the 1999 ISO/IEC C standard [C99]_, 'Characteristics of floating types', for details. + .. tabularcolumns:: |l|l|L| + +---------------------+----------------+--------------------------------------------------+ | attribute | float.h macro | explanation | +=====================+================+==================================================+ @@ -646,6 +648,8 @@ A :term:`struct sequence` that holds information about Python's internal representation of integers. The attributes are read only. + .. tabularcolumns:: |l|L| + +-------------------------+----------------------------------------------+ | Attribute | Explanation | +=========================+==============================================+ @@ -1079,6 +1083,8 @@ A :term:`struct sequence` holding information about the thread implementation. + .. tabularcolumns:: |l|p{0.7\linewidth}| + +------------------+---------------------------------------------------------+ | Attribute | Explanation | +==================+=========================================================+ diff --git a/Doc/library/tkinter.ttk.rst b/Doc/library/tkinter.ttk.rst --- a/Doc/library/tkinter.ttk.rst +++ b/Doc/library/tkinter.ttk.rst @@ -102,6 +102,8 @@ All the :mod:`ttk` Widgets accepts the following options: + .. tabularcolumns:: |l|L| + +-----------+--------------------------------------------------------------+ | Option | Description | +===========+==============================================================+ @@ -134,8 +136,10 @@ The following options are supported by widgets that are controlled by a scrollbar. + .. tabularcolumns:: |l|L| + +----------------+---------------------------------------------------------+ - | option | description | + | Option | Description | +================+=========================================================+ | xscrollcommand | Used to communicate with horizontal scrollbars. | | | | @@ -158,11 +162,10 @@ The following options are supported by labels, buttons and other button-like widgets. -.. tabularcolumns:: |p{0.2\textwidth}|p{0.7\textwidth}| -.. + .. tabularcolumns:: |l|p{0.7\linewidth}| +--------------+-----------------------------------------------------------+ - | option | description | + | Option | Description | +==============+===========================================================+ | text | Specifies a text string to be displayed inside the widget.| +--------------+-----------------------------------------------------------+ @@ -202,8 +205,10 @@ Compatibility Options ^^^^^^^^^^^^^^^^^^^^^ + .. tabularcolumns:: |l|L| + +--------+----------------------------------------------------------------+ - | option | description | + | Option | Description | +========+================================================================+ | state | May be set to "normal" or "disabled" to control the "disabled" | | | state bit. This is a write-only option: setting it changes the | @@ -216,8 +221,10 @@ The widget state is a bitmap of independent state flags. + .. tabularcolumns:: |l|L| + +------------+-------------------------------------------------------------+ - | flag | description | + | Flag | Description | +============+=============================================================+ | active | The mouse cursor is over the widget and pressing a mouse | | | button will cause some action to occur | @@ -301,8 +308,10 @@ This widget accepts the following specific options: + .. tabularcolumns:: |l|L| + +-----------------+--------------------------------------------------------+ - | option | description | + | Option | Description | +=================+========================================================+ | exportselection | Boolean value. If set, the widget selection is linked | | | to the Window Manager selection (which can be returned | @@ -380,8 +389,10 @@ This widget accepts the following specific options: + .. tabularcolumns:: |l|L| + +---------+----------------------------------------------------------------+ - | option | description | + | Option | Description | +=========+================================================================+ | height | If present and greater than zero, specifies the desired height | | | of the pane area (not including internal padding or tabs). | @@ -404,8 +415,10 @@ There are also specific options for tabs: + .. tabularcolumns:: |l|L| + +-----------+--------------------------------------------------------------+ - | option | description | + | Option | Description | +===========+==============================================================+ | state | Either "normal", "disabled" or "hidden". If "disabled", then | | | the tab is not selectable. If "hidden", then the tab is not | @@ -566,8 +579,10 @@ This widget accepts the following specific options: + .. tabularcolumns:: |l|L| + +----------+---------------------------------------------------------------+ - | option | description | + | Option | Description | +==========+===============================================================+ | orient | One of "horizontal" or "vertical". Specifies the orientation | | | of the progress bar. | @@ -635,8 +650,10 @@ This widget accepts the following specific option: + .. tabularcolumns:: |l|L| + +--------+----------------------------------------------------------------+ - | option | description | + | Option | Description | +========+================================================================+ | orient | One of "horizontal" or "vertical". Specifies the orientation of| | | the separator. | @@ -701,11 +718,10 @@ This widget accepts the following specific options: -.. tabularcolumns:: |p{0.2\textwidth}|p{0.7\textwidth}| -.. + .. tabularcolumns:: |l|p{0.7\linewidth}| +----------------+--------------------------------------------------------+ - | option | description | + | Option | Description | +================+========================================================+ | columns | A list of column identifiers, specifying the number of | | | columns and their names. | @@ -753,8 +769,10 @@ The following item options may be specified for items in the insert and item widget commands. + .. tabularcolumns:: |l|L| + +--------+---------------------------------------------------------------+ - | option | description | + | Option | Description | +========+===============================================================+ | text | The textual label to display for the item. | +--------+---------------------------------------------------------------+ @@ -779,8 +797,10 @@ The following options may be specified on tags: + .. tabularcolumns:: |l|L| + +------------+-----------------------------------------------------------+ - | option | description | + | Option | Description | +============+===========================================================+ | foreground | Specifies the text foreground color. | +------------+-----------------------------------------------------------+ @@ -822,8 +842,10 @@ The Treeview widget generates the following virtual events. + .. tabularcolumns:: |l|L| + +--------------------+--------------------------------------------------+ - | event | description | + | Event | Description | +====================+==================================================+ | <> | Generated whenever the selection changes. | +--------------------+--------------------------------------------------+ diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -2301,9 +2301,11 @@ The demo scripts are: +.. tabularcolumns:: |l|L|L| + +----------------+------------------------------+-----------------------+ | Name | Description | Features | -+----------------+------------------------------+-----------------------+ ++================+==============================+=======================+ | bytedesign | complex classical | :func:`tracer`, delay,| | | turtle graphics pattern | :func:`update` | +----------------+------------------------------+-----------------------+ diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -54,6 +54,8 @@ This categorization is useful to be able to filter out groups of warnings. The following warnings category classes are currently defined: +.. tabularcolumns:: |l|p{0.6\linewidth}| + +----------------------------------+-----------------------------------------------+ | Class | Description | +==================================+===============================================+ diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -278,6 +278,8 @@ Supported XPath syntax ^^^^^^^^^^^^^^^^^^^^^^ +.. tabularcolumns:: |l|L| + +-----------------------+------------------------------------------------------+ | Syntax | Meaning | +=======================+======================================================+ diff --git a/Doc/library/xmlrpc.client.rst b/Doc/library/xmlrpc.client.rst --- a/Doc/library/xmlrpc.client.rst +++ b/Doc/library/xmlrpc.client.rst @@ -72,6 +72,8 @@ (e.g. that can be marshalled through XML), include the following (and except where noted, they are unmarshalled as the same Python type): + .. tabularcolumns:: |l|L| + +---------------------------------+---------------------------------------------+ | Name | Meaning | +=================================+=============================================+ diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -448,6 +448,8 @@ Special attributes: + .. tabularcolumns:: |l|L|l| + +-------------------------+-------------------------------+-----------+ | Attribute | Meaning | | +=========================+===============================+===========+ diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -1335,7 +1335,7 @@ | :keyword:`not` ``x`` | Boolean NOT | +-----------------------------------------------+-------------------------------------+ | :keyword:`in`, :keyword:`not in`, | Comparisons, including membership | -| :keyword:`is`, :keyword:`is not`, ``<``, | tests and identity tests, | +| :keyword:`is`, :keyword:`is not`, ``<``, | tests and identity tests | | ``<=``, ``>``, ``>=``, ``!=``, ``==`` | | +-----------------------------------------------+-------------------------------------+ | ``|`` | Bitwise OR | diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst --- a/Doc/reference/import.rst +++ b/Doc/reference/import.rst @@ -685,8 +685,7 @@ :pep:`338` defines executing modules as scripts. -Footnotes -========= +.. rubric:: Footnotes .. [#fnmo] See :class:`types.ModuleType`. diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -1208,6 +1208,8 @@ The minimum set of controls implemented by all ``policy`` objects are: + .. tabularcolumns:: |l|L| + =============== ======================================================= max_line_length The maximum length, excluding the linesep character(s), individual lines may have when a ``Message`` is @@ -1259,6 +1261,8 @@ The new policies are instances of :class:`~email.policy.EmailPolicy`, and add the following additional controls: + .. tabularcolumns:: |l|L| + =============== ======================================================= refold_source Controls whether or not headers parsed by a :mod:`~email.parser` are refolded by the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 28 13:28:51 2013 From: python-checkins at python.org (georg.brandl) Date: Thu, 28 Mar 2013 13:28:51 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogTWVyZ2Ugd2l0aCAzLjMu?= Message-ID: <3Zc53R5rzszQyg@mail.python.org> http://hg.python.org/cpython/rev/c52f10be4efe changeset: 82987:c52f10be4efe parent: 82984:8bcda4f2b3a1 parent: 82986:3ae74b361f53 user: Georg Brandl date: Thu Mar 28 13:28:55 2013 +0100 summary: Merge with 3.3. files: Doc/c-api/buffer.rst | 5 +- Doc/c-api/bytes.rst | 2 + Doc/c-api/unicode.rst | 2 + Doc/distutils/apiref.rst | 8 ++ Doc/faq/extending.rst | 4 +- Doc/faq/general.rst | 5 +- Doc/faq/gui.rst | 4 +- Doc/faq/library.rst | 4 +- Doc/faq/programming.rst | 4 +- Doc/faq/windows.rst | 4 +- Doc/howto/logging.rst | 2 + Doc/install/index.rst | 2 + Doc/library/codecs.rst | 10 ++ Doc/library/collections.abc.rst | 4 +- Doc/library/concurrent.futures.rst | 2 + Doc/library/email.policy.rst | 2 + Doc/library/functions.rst | 2 +- Doc/library/inspect.rst | 2 + Doc/library/io.rst | 2 + Doc/library/locale.rst | 2 + Doc/library/logging.rst | 2 + Doc/library/subprocess.rst | 2 + Doc/library/sys.rst | 6 + Doc/library/tkinter.ttk.rst | 56 ++++++++++---- Doc/library/turtle.rst | 4 +- Doc/library/warnings.rst | 2 + Doc/library/xml.etree.elementtree.rst | 2 + Doc/library/xmlrpc.client.rst | 2 + Doc/reference/datamodel.rst | 2 + Doc/reference/expressions.rst | 2 +- Doc/reference/import.rst | 3 +- Doc/whatsnew/3.3.rst | 4 + 32 files changed, 129 insertions(+), 30 deletions(-) diff --git a/Doc/c-api/buffer.rst b/Doc/c-api/buffer.rst --- a/Doc/c-api/buffer.rst +++ b/Doc/c-api/buffer.rst @@ -263,6 +263,7 @@ in decreasing order of complexity. Note that each flag contains all bits of the flags below it. +.. tabularcolumns:: |p{0.35\linewidth}|l|l|l| +-----------------------------+-------+---------+------------+ | Request | shape | strides | suboffsets | @@ -283,6 +284,8 @@ C or Fortran contiguity can be explicitly requested, with and without stride information. Without stride information, the buffer must be C-contiguous. +.. tabularcolumns:: |p{0.35\linewidth}|l|l|l|l| + +-----------------------------------+-------+---------+------------+--------+ | Request | shape | strides | suboffsets | contig | +===================================+=======+=========+============+========+ @@ -306,7 +309,7 @@ In the following table *U* stands for undefined contiguity. The consumer would have to call :c:func:`PyBuffer_IsContiguous` to determine contiguity. - +.. tabularcolumns:: |p{0.35\linewidth}|l|l|l|l|l|l| +-------------------------------+-------+---------+------------+--------+----------+--------+ | Request | shape | strides | suboffsets | contig | readonly | format | diff --git a/Doc/c-api/bytes.rst b/Doc/c-api/bytes.rst --- a/Doc/c-api/bytes.rst +++ b/Doc/c-api/bytes.rst @@ -62,6 +62,8 @@ .. % because not all compilers support the %z width modifier -- we fake it .. % when necessary via interpolating PY_FORMAT_SIZE_T. + .. tabularcolumns:: |l|l|L| + +-------------------+---------------+--------------------------------+ | Format Characters | Type | Comment | +===================+===============+================================+ diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -439,6 +439,8 @@ .. % Similar comments apply to the %ll width modifier and .. % PY_FORMAT_LONG_LONG. + .. tabularcolumns:: |l|l|L| + +-------------------+---------------------+--------------------------------+ | Format Characters | Type | Comment | +===================+=====================+================================+ diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst --- a/Doc/distutils/apiref.rst +++ b/Doc/distutils/apiref.rst @@ -26,6 +26,8 @@ The setup function takes a large number of arguments. These are laid out in the following table. + .. tabularcolumns:: |l|L|L| + +--------------------+--------------------------------+-------------------------------------------------------------+ | argument name | value | type | +====================+================================+=============================================================+ @@ -125,6 +127,8 @@ *stop_after* tells :func:`setup` when to stop processing; possible values: + .. tabularcolumns:: |l|L| + +---------------+---------------------------------------------+ | value | description | +===============+=============================================+ @@ -165,6 +169,8 @@ The Extension class describes a single C or C++extension module in a setup script. It accepts the following keyword arguments in its constructor: + .. tabularcolumns:: |l|L|l| + +------------------------+--------------------------------+---------------------------+ | argument name | value | type | +========================+================================+===========================+ @@ -1562,6 +1568,8 @@ The options are all boolean, and affect the values returned by :meth:`readline` + .. tabularcolumns:: |l|L|l| + +------------------+--------------------------------+---------+ | option name | description | default | +==================+================================+=========+ diff --git a/Doc/faq/extending.rst b/Doc/faq/extending.rst --- a/Doc/faq/extending.rst +++ b/Doc/faq/extending.rst @@ -2,7 +2,9 @@ Extending/Embedding FAQ ======================= -.. contents:: +.. only:: html + + .. contents:: .. highlight:: c diff --git a/Doc/faq/general.rst b/Doc/faq/general.rst --- a/Doc/faq/general.rst +++ b/Doc/faq/general.rst @@ -4,7 +4,10 @@ General Python FAQ ================== -.. contents:: +.. only:: html + + .. contents:: + General Information =================== diff --git a/Doc/faq/gui.rst b/Doc/faq/gui.rst --- a/Doc/faq/gui.rst +++ b/Doc/faq/gui.rst @@ -4,7 +4,9 @@ Graphic User Interface FAQ ========================== -.. contents:: +.. only:: html + + .. contents:: .. XXX need review for Python 3. diff --git a/Doc/faq/library.rst b/Doc/faq/library.rst --- a/Doc/faq/library.rst +++ b/Doc/faq/library.rst @@ -4,7 +4,9 @@ Library and Extension FAQ ========================= -.. contents:: +.. only:: html + + .. contents:: General Library Questions ========================= diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -4,7 +4,9 @@ Programming FAQ =============== -.. contents:: +.. only:: html + + .. contents:: General Questions ================= diff --git a/Doc/faq/windows.rst b/Doc/faq/windows.rst --- a/Doc/faq/windows.rst +++ b/Doc/faq/windows.rst @@ -6,7 +6,9 @@ Python on Windows FAQ ===================== -.. contents:: +.. only:: html + + .. contents:: .. XXX need review for Python 3. XXX need review for Windows Vista/Seven? diff --git a/Doc/howto/logging.rst b/Doc/howto/logging.rst --- a/Doc/howto/logging.rst +++ b/Doc/howto/logging.rst @@ -63,6 +63,8 @@ they are used to track. The standard levels and their applicability are described below (in increasing order of severity): +.. tabularcolumns:: |l|L| + +--------------+---------------------------------------------+ | Level | When it's used | +==============+=============================================+ diff --git a/Doc/install/index.rst b/Doc/install/index.rst --- a/Doc/install/index.rst +++ b/Doc/install/index.rst @@ -235,6 +235,8 @@ Unix-based), it also depends on whether the module distribution being installed is pure Python or contains extensions ("non-pure"): +.. tabularcolumns:: |l|l|l|l| + +-----------------+-----------------------------------------------------+--------------------------------------------------+-------+ | Platform | Standard installation location | Default value | Notes | +=================+=====================================================+==================================================+=======+ diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -315,6 +315,8 @@ providing the *errors* string argument. The following string values are defined and implemented by all standard Python codecs: +.. tabularcolumns:: |l|L| + +-------------------------+-----------------------------------------------+ | Value | Meaning | +=========================+===============================================+ @@ -926,6 +928,8 @@ * an IBM PC code page, which is ASCII compatible +.. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}| + +-----------------+--------------------------------+--------------------------------+ | Codec | Aliases | Languages | +=================+================================+================================+ @@ -1140,6 +1144,8 @@ .. XXX fix here, should be in above table +.. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}| + +--------------------+---------+---------------------------+ | Codec | Aliases | Purpose | +====================+=========+===========================+ @@ -1182,6 +1188,8 @@ The following codecs provide bytes-to-bytes mappings. +.. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}| + +--------------------+---------------------------+---------------------------+ | Codec | Aliases | Purpose | +====================+===========================+===========================+ @@ -1208,6 +1216,8 @@ The following codecs provide string-to-string mappings. +.. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}| + +--------------------+---------------------------+---------------------------+ | Codec | Aliases | Purpose | +====================+===========================+===========================+ diff --git a/Doc/library/collections.abc.rst b/Doc/library/collections.abc.rst --- a/Doc/library/collections.abc.rst +++ b/Doc/library/collections.abc.rst @@ -31,6 +31,8 @@ The collections module offers the following :term:`ABCs `: +.. tabularcolumns:: |l|L|L|L| + ========================= ===================== ====================== ==================================================== ABC Inherits from Abstract Methods Mixin Methods ========================= ===================== ====================== ==================================================== @@ -134,7 +136,7 @@ the full :class:`Set` API, it only necessary to supply the three underlying abstract methods: :meth:`__contains__`, :meth:`__iter__`, and :meth:`__len__`. The ABC supplies the remaining methods such as :meth:`__and__` and -:meth:`isdisjoint` :: +:meth:`isdisjoint`:: class ListBasedSet(collections.Set): ''' Alternate set implementation favoring space over speed diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst --- a/Doc/library/concurrent.futures.rst +++ b/Doc/library/concurrent.futures.rst @@ -346,6 +346,8 @@ *return_when* indicates when this function should return. It must be one of the following constants: + .. tabularcolumns:: |l|L| + +-----------------------------+----------------------------------------+ | Constant | Description | +=============================+========================================+ diff --git a/Doc/library/email.policy.rst b/Doc/library/email.policy.rst --- a/Doc/library/email.policy.rst +++ b/Doc/library/email.policy.rst @@ -139,6 +139,8 @@ Controls the type of Content Transfer Encodings that may be or are required to be used. The possible values are: + .. tabularcolumns:: |l|L| + ======== =============================================================== ``7bit`` all data must be "7 bit clean" (ASCII-only). This means that where necessary data will be encoded using either diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -853,7 +853,7 @@ ========= =============================================================== Character Meaning - --------- --------------------------------------------------------------- + ========= =============================================================== ``'r'`` open for reading (default) ``'w'`` open for writing, truncating the file first ``'x'`` open for exclusive creation, failing if the file already exists diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -520,6 +520,8 @@ Describes how argument values are bound to the parameter. Possible values (accessible via :class:`Parameter`, like ``Parameter.KEYWORD_ONLY``): + .. tabularcolumns:: |l|L| + +------------------------+----------------------------------------------+ | Name | Meaning | +========================+==============================================+ diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -187,6 +187,8 @@ The following table summarizes the ABCs provided by the :mod:`io` module: +.. tabularcolumns:: |l|l|L|L| + ========================= ================== ======================== ================================================== ABC Inherits Stub Methods Mixin Methods and Properties ========================= ================== ======================== ================================================== diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst --- a/Doc/library/locale.rst +++ b/Doc/library/locale.rst @@ -55,6 +55,8 @@ Returns the database of the local conventions as a dictionary. This dictionary has the following strings as keys: + .. tabularcolumns:: |l|l|L| + +----------------------+-------------------------------------+--------------------------------+ | Category | Key | Meaning | +======================+=====================================+================================+ diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -1037,6 +1037,8 @@ The following keyword arguments are supported. + .. tabularcolumns:: |l|L| + +--------------+---------------------------------------------+ | Format | Description | +==============+=============================================+ diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -169,6 +169,8 @@ .. versionadded:: 3.1 + .. + .. warning:: Invoking the system shell with ``shell=True`` can be a security hazard diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -307,6 +307,8 @@ programming language; see section 5.2.4.2.2 of the 1999 ISO/IEC C standard [C99]_, 'Characteristics of floating types', for details. + .. tabularcolumns:: |l|l|L| + +---------------------+----------------+--------------------------------------------------+ | attribute | float.h macro | explanation | +=====================+================+==================================================+ @@ -661,6 +663,8 @@ A :term:`struct sequence` that holds information about Python's internal representation of integers. The attributes are read only. + .. tabularcolumns:: |l|L| + +-------------------------+----------------------------------------------+ | Attribute | Explanation | +=========================+==============================================+ @@ -1092,6 +1096,8 @@ A :term:`struct sequence` holding information about the thread implementation. + .. tabularcolumns:: |l|p{0.7\linewidth}| + +------------------+---------------------------------------------------------+ | Attribute | Explanation | +==================+=========================================================+ diff --git a/Doc/library/tkinter.ttk.rst b/Doc/library/tkinter.ttk.rst --- a/Doc/library/tkinter.ttk.rst +++ b/Doc/library/tkinter.ttk.rst @@ -102,6 +102,8 @@ All the :mod:`ttk` Widgets accepts the following options: + .. tabularcolumns:: |l|L| + +-----------+--------------------------------------------------------------+ | Option | Description | +===========+==============================================================+ @@ -134,8 +136,10 @@ The following options are supported by widgets that are controlled by a scrollbar. + .. tabularcolumns:: |l|L| + +----------------+---------------------------------------------------------+ - | option | description | + | Option | Description | +================+=========================================================+ | xscrollcommand | Used to communicate with horizontal scrollbars. | | | | @@ -158,11 +162,10 @@ The following options are supported by labels, buttons and other button-like widgets. -.. tabularcolumns:: |p{0.2\textwidth}|p{0.7\textwidth}| -.. + .. tabularcolumns:: |l|p{0.7\linewidth}| +--------------+-----------------------------------------------------------+ - | option | description | + | Option | Description | +==============+===========================================================+ | text | Specifies a text string to be displayed inside the widget.| +--------------+-----------------------------------------------------------+ @@ -202,8 +205,10 @@ Compatibility Options ^^^^^^^^^^^^^^^^^^^^^ + .. tabularcolumns:: |l|L| + +--------+----------------------------------------------------------------+ - | option | description | + | Option | Description | +========+================================================================+ | state | May be set to "normal" or "disabled" to control the "disabled" | | | state bit. This is a write-only option: setting it changes the | @@ -216,8 +221,10 @@ The widget state is a bitmap of independent state flags. + .. tabularcolumns:: |l|L| + +------------+-------------------------------------------------------------+ - | flag | description | + | Flag | Description | +============+=============================================================+ | active | The mouse cursor is over the widget and pressing a mouse | | | button will cause some action to occur | @@ -301,8 +308,10 @@ This widget accepts the following specific options: + .. tabularcolumns:: |l|L| + +-----------------+--------------------------------------------------------+ - | option | description | + | Option | Description | +=================+========================================================+ | exportselection | Boolean value. If set, the widget selection is linked | | | to the Window Manager selection (which can be returned | @@ -380,8 +389,10 @@ This widget accepts the following specific options: + .. tabularcolumns:: |l|L| + +---------+----------------------------------------------------------------+ - | option | description | + | Option | Description | +=========+================================================================+ | height | If present and greater than zero, specifies the desired height | | | of the pane area (not including internal padding or tabs). | @@ -404,8 +415,10 @@ There are also specific options for tabs: + .. tabularcolumns:: |l|L| + +-----------+--------------------------------------------------------------+ - | option | description | + | Option | Description | +===========+==============================================================+ | state | Either "normal", "disabled" or "hidden". If "disabled", then | | | the tab is not selectable. If "hidden", then the tab is not | @@ -566,8 +579,10 @@ This widget accepts the following specific options: + .. tabularcolumns:: |l|L| + +----------+---------------------------------------------------------------+ - | option | description | + | Option | Description | +==========+===============================================================+ | orient | One of "horizontal" or "vertical". Specifies the orientation | | | of the progress bar. | @@ -635,8 +650,10 @@ This widget accepts the following specific option: + .. tabularcolumns:: |l|L| + +--------+----------------------------------------------------------------+ - | option | description | + | Option | Description | +========+================================================================+ | orient | One of "horizontal" or "vertical". Specifies the orientation of| | | the separator. | @@ -701,11 +718,10 @@ This widget accepts the following specific options: -.. tabularcolumns:: |p{0.2\textwidth}|p{0.7\textwidth}| -.. + .. tabularcolumns:: |l|p{0.7\linewidth}| +----------------+--------------------------------------------------------+ - | option | description | + | Option | Description | +================+========================================================+ | columns | A list of column identifiers, specifying the number of | | | columns and their names. | @@ -753,8 +769,10 @@ The following item options may be specified for items in the insert and item widget commands. + .. tabularcolumns:: |l|L| + +--------+---------------------------------------------------------------+ - | option | description | + | Option | Description | +========+===============================================================+ | text | The textual label to display for the item. | +--------+---------------------------------------------------------------+ @@ -779,8 +797,10 @@ The following options may be specified on tags: + .. tabularcolumns:: |l|L| + +------------+-----------------------------------------------------------+ - | option | description | + | Option | Description | +============+===========================================================+ | foreground | Specifies the text foreground color. | +------------+-----------------------------------------------------------+ @@ -822,8 +842,10 @@ The Treeview widget generates the following virtual events. + .. tabularcolumns:: |l|L| + +--------------------+--------------------------------------------------+ - | event | description | + | Event | Description | +====================+==================================================+ | <> | Generated whenever the selection changes. | +--------------------+--------------------------------------------------+ diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -2301,9 +2301,11 @@ The demo scripts are: +.. tabularcolumns:: |l|L|L| + +----------------+------------------------------+-----------------------+ | Name | Description | Features | -+----------------+------------------------------+-----------------------+ ++================+==============================+=======================+ | bytedesign | complex classical | :func:`tracer`, delay,| | | turtle graphics pattern | :func:`update` | +----------------+------------------------------+-----------------------+ diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -54,6 +54,8 @@ This categorization is useful to be able to filter out groups of warnings. The following warnings category classes are currently defined: +.. tabularcolumns:: |l|p{0.6\linewidth}| + +----------------------------------+-----------------------------------------------+ | Class | Description | +==================================+===============================================+ diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -278,6 +278,8 @@ Supported XPath syntax ^^^^^^^^^^^^^^^^^^^^^^ +.. tabularcolumns:: |l|L| + +-----------------------+------------------------------------------------------+ | Syntax | Meaning | +=======================+======================================================+ diff --git a/Doc/library/xmlrpc.client.rst b/Doc/library/xmlrpc.client.rst --- a/Doc/library/xmlrpc.client.rst +++ b/Doc/library/xmlrpc.client.rst @@ -72,6 +72,8 @@ (e.g. that can be marshalled through XML), include the following (and except where noted, they are unmarshalled as the same Python type): + .. tabularcolumns:: |l|L| + +---------------------------------+---------------------------------------------+ | Name | Meaning | +=================================+=============================================+ diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -448,6 +448,8 @@ Special attributes: + .. tabularcolumns:: |l|L|l| + +-------------------------+-------------------------------+-----------+ | Attribute | Meaning | | +=========================+===============================+===========+ diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -1335,7 +1335,7 @@ | :keyword:`not` ``x`` | Boolean NOT | +-----------------------------------------------+-------------------------------------+ | :keyword:`in`, :keyword:`not in`, | Comparisons, including membership | -| :keyword:`is`, :keyword:`is not`, ``<``, | tests and identity tests, | +| :keyword:`is`, :keyword:`is not`, ``<``, | tests and identity tests | | ``<=``, ``>``, ``>=``, ``!=``, ``==`` | | +-----------------------------------------------+-------------------------------------+ | ``|`` | Bitwise OR | diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst --- a/Doc/reference/import.rst +++ b/Doc/reference/import.rst @@ -687,8 +687,7 @@ :pep:`338` defines executing modules as scripts. -Footnotes -========= +.. rubric:: Footnotes .. [#fnmo] See :class:`types.ModuleType`. diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -1208,6 +1208,8 @@ The minimum set of controls implemented by all ``policy`` objects are: + .. tabularcolumns:: |l|L| + =============== ======================================================= max_line_length The maximum length, excluding the linesep character(s), individual lines may have when a ``Message`` is @@ -1259,6 +1261,8 @@ The new policies are instances of :class:`~email.policy.EmailPolicy`, and add the following additional controls: + .. tabularcolumns:: |l|L| + =============== ======================================================= refold_source Controls whether or not headers parsed by a :mod:`~email.parser` are refolded by the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 28 13:35:11 2013 From: python-checkins at python.org (georg.brandl) Date: Thu, 28 Mar 2013 13:35:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy4zIC0+IDIuNyk6?= =?utf-8?q?_Backport_rev=2E_3ae74b361f53_to_2=2E7_branch=2E?= Message-ID: <3Zc5Bl1jP5zQvG@mail.python.org> http://hg.python.org/cpython/rev/75512a165318 changeset: 82988:75512a165318 branch: 2.7 parent: 82985:5fddf795de2c parent: 82986:3ae74b361f53 user: Georg Brandl date: Thu Mar 28 13:35:18 2013 +0100 summary: Backport rev. 3ae74b361f53 to 2.7 branch. files: Doc/c-api/unicode.rst | 2 ++ Doc/distutils/apiref.rst | 8 ++++++++ Doc/faq/extending.rst | 4 +++- Doc/faq/general.rst | 5 ++++- Doc/faq/gui.rst | 4 +++- Doc/faq/library.rst | 4 +++- Doc/faq/programming.rst | 4 +++- Doc/faq/windows.rst | 4 +++- Doc/howto/logging.rst | 2 ++ Doc/install/index.rst | 2 ++ Doc/library/codecs.rst | 6 ++++++ Doc/library/locale.rst | 2 ++ Doc/library/logging.rst | 2 ++ Doc/library/subprocess.rst | 2 ++ Doc/library/sys.rst | 4 ++++ Doc/library/turtle.rst | 4 +++- Doc/library/warnings.rst | 2 ++ Doc/library/xml.etree.elementtree.rst | 2 ++ Doc/reference/datamodel.rst | 2 ++ Doc/reference/expressions.rst | 2 +- 20 files changed, 59 insertions(+), 8 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -252,6 +252,8 @@ .. % because not all compilers support the %z width modifier -- we fake it .. % when necessary via interpolating PY_FORMAT_SIZE_T. + .. tabularcolumns:: |l|l|L| + +-------------------+---------------------+--------------------------------+ | Format Characters | Type | Comment | +===================+=====================+================================+ diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst --- a/Doc/distutils/apiref.rst +++ b/Doc/distutils/apiref.rst @@ -26,6 +26,8 @@ The setup function takes a large number of arguments. These are laid out in the following table. + .. tabularcolumns:: |l|L|L| + +--------------------+--------------------------------+-------------------------------------------------------------+ | argument name | value | type | +====================+================================+=============================================================+ @@ -125,6 +127,8 @@ *stop_after* tells :func:`setup` when to stop processing; possible values: + .. tabularcolumns:: |l|L| + +---------------+---------------------------------------------+ | value | description | +===============+=============================================+ @@ -165,6 +169,8 @@ The Extension class describes a single C or C++extension module in a setup script. It accepts the following keyword arguments in its constructor + .. tabularcolumns:: |l|L|l| + +------------------------+--------------------------------+---------------------------+ | argument name | value | type | +========================+================================+===========================+ @@ -1556,6 +1562,8 @@ The options are all boolean, and affect the values returned by :meth:`readline` + .. tabularcolumns:: |l|L|l| + +------------------+--------------------------------+---------+ | option name | description | default | +==================+================================+=========+ diff --git a/Doc/faq/extending.rst b/Doc/faq/extending.rst --- a/Doc/faq/extending.rst +++ b/Doc/faq/extending.rst @@ -2,7 +2,9 @@ Extending/Embedding FAQ ======================= -.. contents:: +.. only:: html + + .. contents:: .. highlight:: c diff --git a/Doc/faq/general.rst b/Doc/faq/general.rst --- a/Doc/faq/general.rst +++ b/Doc/faq/general.rst @@ -4,7 +4,10 @@ General Python FAQ ================== -.. contents:: +.. only:: html + + .. contents:: + General Information =================== diff --git a/Doc/faq/gui.rst b/Doc/faq/gui.rst --- a/Doc/faq/gui.rst +++ b/Doc/faq/gui.rst @@ -4,7 +4,9 @@ Graphic User Interface FAQ ========================== -.. contents:: +.. only:: html + + .. contents:: What platform-independent GUI toolkits exist for Python? ======================================================== diff --git a/Doc/faq/library.rst b/Doc/faq/library.rst --- a/Doc/faq/library.rst +++ b/Doc/faq/library.rst @@ -4,7 +4,9 @@ Library and Extension FAQ ========================= -.. contents:: +.. only:: html + + .. contents:: General Library Questions ========================= diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -4,7 +4,9 @@ Programming FAQ =============== -.. contents:: +.. only:: html + + .. contents:: General Questions ================= diff --git a/Doc/faq/windows.rst b/Doc/faq/windows.rst --- a/Doc/faq/windows.rst +++ b/Doc/faq/windows.rst @@ -6,7 +6,9 @@ Python on Windows FAQ ===================== -.. contents:: +.. only:: html + + .. contents:: How do I run a Python program under Windows? -------------------------------------------- diff --git a/Doc/howto/logging.rst b/Doc/howto/logging.rst --- a/Doc/howto/logging.rst +++ b/Doc/howto/logging.rst @@ -63,6 +63,8 @@ they are used to track. The standard levels and their applicability are described below (in increasing order of severity): +.. tabularcolumns:: |l|L| + +--------------+---------------------------------------------+ | Level | When it's used | +==============+=============================================+ diff --git a/Doc/install/index.rst b/Doc/install/index.rst --- a/Doc/install/index.rst +++ b/Doc/install/index.rst @@ -235,6 +235,8 @@ Unix-based), it also depends on whether the module distribution being installed is pure Python or contains extensions ("non-pure"): +.. tabularcolumns:: |l|l|l|l| + +-----------------+-----------------------------------------------------+--------------------------------------------------+-------+ | Platform | Standard installation location | Default value | Notes | +=================+=====================================================+==================================================+=======+ diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -320,6 +320,8 @@ providing the *errors* string argument. The following string values are defined and implemented by all standard Python codecs: +.. tabularcolumns:: |l|L| + +-------------------------+-----------------------------------------------+ | Value | Meaning | +=========================+===============================================+ @@ -887,6 +889,8 @@ * an IBM PC code page, which is ASCII compatible +.. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}| + +-----------------+--------------------------------+--------------------------------+ | Codec | Aliases | Languages | +=================+================================+================================+ @@ -1103,6 +1107,8 @@ byte string. The result of the "decoding" direction is listed as operand type in the table. +.. tabularcolumns:: |l|p{0.3\linewidth}|l|p{0.3\linewidth}| + +--------------------+---------------------------+----------------+---------------------------+ | Codec | Aliases | Operand type | Purpose | +====================+===========================+================+===========================+ diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst --- a/Doc/library/locale.rst +++ b/Doc/library/locale.rst @@ -59,6 +59,8 @@ Returns the database of the local conventions as a dictionary. This dictionary has the following strings as keys: + .. tabularcolumns:: |l|l|L| + +----------------------+-------------------------------------+--------------------------------+ | Category | Key | Meaning | +======================+=====================================+================================+ diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -893,6 +893,8 @@ The following keyword arguments are supported. + .. tabularcolumns:: |l|L| + +--------------+---------------------------------------------+ | Format | Description | +==============+=============================================+ diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -145,6 +145,8 @@ .. versionadded:: 2.7 + .. + .. warning:: Invoking the system shell with ``shell=True`` can be a security hazard diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -302,6 +302,8 @@ 5.2.4.2.2 of the 1999 ISO/IEC C standard [C99]_, 'Characteristics of floating types', for details. + .. tabularcolumns:: |l|l|L| + +---------------------+----------------+--------------------------------------------------+ | attribute | float.h macro | explanation | +=====================+================+==================================================+ @@ -599,6 +601,8 @@ A struct sequence that holds information about Python's internal representation of integers. The attributes are read only. + .. tabularcolumns:: |l|L| + +-------------------------+----------------------------------------------+ | Attribute | Explanation | +=========================+==============================================+ diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -2173,9 +2173,11 @@ The demoscripts are: +.. tabularcolumns:: |l|L|L| + +----------------+------------------------------+-----------------------+ | Name | Description | Features | -+----------------+------------------------------+-----------------------+ ++================+==============================+=======================+ | bytedesign | complex classical | :func:`tracer`, delay,| | | turtlegraphics pattern | :func:`update` | +----------------+------------------------------+-----------------------+ diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -57,6 +57,8 @@ This categorization is useful to be able to filter out groups of warnings. The following warnings category classes are currently defined: +.. tabularcolumns:: |l|p{0.6\linewidth}| + +----------------------------------+-----------------------------------------------+ | Class | Description | +==================================+===============================================+ diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -312,6 +312,8 @@ Supported XPath syntax ^^^^^^^^^^^^^^^^^^^^^^ +.. tabularcolumns:: |l|L| + +-----------------------+------------------------------------------------------+ | Syntax | Meaning | +=======================+======================================================+ diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -481,6 +481,8 @@ Special attributes: + .. tabularcolumns:: |l|L|l| + +-----------------------+-------------------------------+-----------+ | Attribute | Meaning | | +=======================+===============================+===========+ diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -1370,7 +1370,7 @@ | :keyword:`not` ``x`` | Boolean NOT | +-----------------------------------------------+-------------------------------------+ | :keyword:`in`, :keyword:`not in`, | Comparisons, including membership | -| :keyword:`is`, :keyword:`is not`, ``<``, | tests and identity tests, | +| :keyword:`is`, :keyword:`is not`, ``<``, | tests and identity tests | | ``<=``, ``>``, ``>=``, ``<>``, ``!=``, ``==`` | | +-----------------------------------------------+-------------------------------------+ | ``|`` | Bitwise OR | -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 28 16:47:05 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 28 Mar 2013 16:47:05 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Update_the_sus?= =?utf-8?q?picious_builder_to_detect_unused_rules=2C_and_remove_currently?= Message-ID: <3Zc9S93HLNzQlx@mail.python.org> http://hg.python.org/cpython/rev/94e4c6f02caa changeset: 82989:94e4c6f02caa branch: 3.3 parent: 82986:3ae74b361f53 user: Ezio Melotti date: Thu Mar 28 17:40:24 2013 +0200 summary: Update the suspicious builder to detect unused rules, and remove currently unusued rules. files: Doc/tools/sphinxext/susp-ignored.csv | 101 --------------- Doc/tools/sphinxext/suspicious.py | 11 + 2 files changed, 11 insertions(+), 101 deletions(-) diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv --- a/Doc/tools/sphinxext/susp-ignored.csv +++ b/Doc/tools/sphinxext/susp-ignored.csv @@ -1,9 +1,7 @@ c-api/arg,,:ref,"PyArg_ParseTuple(args, ""O|O:ref"", &object, &callback)" c-api/list,,:high,list[low:high] -c-api/list,,:high,list[low:high] = itemlist c-api/sequence,,:i2,del o[i1:i2] c-api/sequence,,:i2,o[i1:i2] -c-api/sequence,,:i2,o[i1:i2] = v c-api/unicode,,:end,str[start:end] c-api/unicode,,:start,unicode[start:start+length] distutils/examples,267,`,This is the description of the ``foobar`` package. @@ -18,9 +16,6 @@ faq/programming,,:reduce,"print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y," faq/programming,,:reduce,"Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro," faq/windows,,:bd8afb90ebf2,"Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32" -faq/windows,229,:EOF, at setlocal enableextensions & python -x %~f0 %* & goto :EOF -faq/windows,393,:REG,.py :REG_SZ: c:\\python.exe -u %s %s -howto/cporting,,:add,"if (!PyArg_ParseTuple(args, ""ii:add_ints"", &one, &two))" howto/cporting,,:encode,"if (!PyArg_ParseTuple(args, ""O:encode_object"", &myobj))" howto/cporting,,:say,"if (!PyArg_ParseTuple(args, ""U:say_hello"", &name))" howto/curses,,:black,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and" @@ -35,8 +30,6 @@ howto/ipaddress,,::,>>> ipaddress.ip_address('2001:DB8::1') howto/ipaddress,,:db8,IPv6Address('2001:db8::1') howto/ipaddress,,::,IPv6Address('2001:db8::1') -howto/ipaddress,,:db8,IPv6Address('2001:db8::1') -howto/ipaddress,,::,IPv6Address('2001:db8::1') howto/ipaddress,,::,IPv6Address('::1') howto/ipaddress,,:db8,>>> ipaddress.ip_network('2001:db8::0/96') howto/ipaddress,,::,>>> ipaddress.ip_network('2001:db8::0/96') @@ -44,29 +37,18 @@ howto/ipaddress,,::,IPv6Network('2001:db8::/96') howto/ipaddress,,:db8,IPv6Network('2001:db8::/128') howto/ipaddress,,::,IPv6Network('2001:db8::/128') -howto/ipaddress,,:db8,>>> ipaddress.ip_network('2001:db8::1/96') -howto/ipaddress,,::,>>> ipaddress.ip_network('2001:db8::1/96') howto/ipaddress,,:db8,IPv6Interface('2001:db8::1/96') howto/ipaddress,,::,IPv6Interface('2001:db8::1/96') howto/ipaddress,,:db8,>>> addr6 = ipaddress.ip_address('2001:db8::1') howto/ipaddress,,::,>>> addr6 = ipaddress.ip_address('2001:db8::1') howto/ipaddress,,:db8,>>> host6 = ipaddress.ip_interface('2001:db8::1/96') howto/ipaddress,,::,>>> host6 = ipaddress.ip_interface('2001:db8::1/96') -howto/ipaddress,,:db8,IPv6Network('2001:db8::/96') -howto/ipaddress,,::,IPv6Network('2001:db8::/96') -howto/ipaddress,,:db8,>>> net6 = ipaddress.ip_network('2001:db8::0/96') -howto/ipaddress,,::,>>> net6 = ipaddress.ip_network('2001:db8::0/96') howto/ipaddress,,:db8,>>> net6 = ipaddress.ip_network('2001:db8::0/96') howto/ipaddress,,::,>>> net6 = ipaddress.ip_network('2001:db8::0/96') howto/ipaddress,,:ffff,IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff::') howto/ipaddress,,::,IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff::') howto/ipaddress,,::,IPv6Address('::ffff:ffff') howto/ipaddress,,:ffff,IPv6Address('::ffff:ffff') -howto/ipaddress,,::,IPv6Address('2001::1') -howto/ipaddress,,::,IPv6Address('2001::ffff:ffff') -howto/ipaddress,,:ffff,IPv6Address('2001::ffff:ffff') -howto/ipaddress,,:db8,'2001:db8::' -howto/ipaddress,,::,'2001:db8::' howto/ipaddress,,:db8,'2001:db8::/96' howto/ipaddress,,::,'2001:db8::/96' howto/ipaddress,,:db8,>>> ipaddress.ip_interface('2001:db8::1/96') @@ -103,7 +85,6 @@ howto/regex,,::, howto/regex,,:foo,(?:foo) howto/urllib2,,:example,"for example ""joe at password:example.com""" -howto/webservers,,.. image:,.. image:: http.png library/audioop,,:ipos,"# factor = audioop.findfactor(in_test[ipos*2:ipos*2+len(out_test)]," library/bisect,32,:hi,all(val >= x for val in a[i:hi]) library/bisect,42,:hi,all(val > x for val in a[i:hi]) @@ -112,10 +93,7 @@ library/configparser,,:option,${section:option} library/configparser,,:path,python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python} library/configparser,,:Python,python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python} -library/configparser,,`,# Set the optional `raw` argument of get() to True if you wish to disable library/configparser,,:system,path: ${Common:system_dir}/Library/Frameworks/ -library/configparser,,`,# The optional `fallback` argument can be used to provide a fallback value -library/configparser,,`,# The optional `vars` argument is a dict with members that will take library/datetime,,:MM, library/datetime,,:SS, library/decimal,,:optional,"trailneg:optional trailing minus indicator" @@ -124,8 +102,6 @@ library/difflib,,:i1, library/difflib,,:i2, library/difflib,,:j2, -library/dis,,:TOS, -library/dis,,`,TOS = `TOS` library/doctest,,`,``factorial`` from the ``example`` module: library/doctest,,`,The ``example`` module library/doctest,,`,Using ``factorial`` @@ -133,7 +109,6 @@ library/functions,,:step,a[start:stop:step] library/functions,,:stop,"a[start:stop, i]" library/functions,,:stop,a[start:stop:step] -library/hotshot,,:lineno,"ncalls tottime percall cumtime percall filename:lineno(function)" library/http.client,,:port,host:port library/http.cookies,,`,!#$%&'*+-.^_`|~: library/imaplib,,:MM,"""DD-Mmm-YYYY HH:MM:SS" @@ -149,24 +124,6 @@ library/ipaddress,,::,>>> ipaddress.IPv6Address('2001:db8::1000') library/ipaddress,,:db8,IPv6Address('2001:db8::1000') library/ipaddress,,::,IPv6Address('2001:db8::1000') -library/ipaddress,,:db8,>>> ipaddress.IPv6Interface('2001:db8::1000/96') -library/ipaddress,,::,>>> ipaddress.IPv6Interface('2001:db8::1000/96') -library/ipaddress,,:db8,IPv6Interface('2001:db8::1000/96') -library/ipaddress,,::,IPv6Interface('2001:db8::1000/96') -library/ipaddress,,:db8,>>> ipaddress.IPv6Interface('2001:db8::1000/96').network -library/ipaddress,,::,>>> ipaddress.IPv6Interface('2001:db8::1000/96').network -library/ipaddress,,:db8,IPv6Network('2001:db8::/96') -library/ipaddress,,::,IPv6Network('2001:db8::/96') -library/ipaddress,,:db8,>>> ipaddress.IPv6Network('2001:db8::/96') -library/ipaddress,,::,>>> ipaddress.IPv6Network('2001:db8::/96') -library/ipaddress,,:db8,IPv6Network('2001:db8::/96') -library/ipaddress,,::,IPv6Network('2001:db8::/96') -library/ipaddress,,:db8,>>> ipaddress.IPv6Network('2001:db8::/96').netmask -library/ipaddress,,::,>>> ipaddress.IPv6Network('2001:db8::/96').netmask -library/ipaddress,,:ffff,IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff::') -library/ipaddress,,::,IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff::') -library/ipaddress,,:db8,">>> ipaddress.IPv6Network('2001:db8::1000/96', strict=False)" -library/ipaddress,,::,">>> ipaddress.IPv6Network('2001:db8::1000/96', strict=False)" library/ipaddress,,::,"""::abc:7:def""" library/ipaddress,,:def,"""::abc:7:def""" library/ipaddress,,::,::FFFF/96 @@ -174,41 +131,20 @@ library/ipaddress,,::,2001::/32 library/ipaddress,,::,>>> str(ipaddress.IPv6Address('::1')) library/ipaddress,,::,'::1' -library/ipaddress,,::,>>> int(ipaddress.IPv6Address('::1')) library/ipaddress,,:ff00,ffff:ff00:: library/ipaddress,,:db00,2001:db00::0/24 library/ipaddress,,::,2001:db00::0/24 library/ipaddress,,:db00,2001:db00::0/ffff:ff00:: library/ipaddress,,::,2001:db00::0/ffff:ff00:: -library/ipaddress,,:ff00,2001:db00::0/ffff:ff00:: library/itertools,,:step,elements from seq[start:stop:step] library/itertools,,:stop,elements from seq[start:stop:step] library/linecache,,:sys,"sys:x:3:3:sys:/dev:/bin/sh" -library/logging,,:And, -library/logging,,:Doing,INFO:root:Doing something -library/logging,,:Finished,INFO:root:Finished -library/logging,,:logger,severity:logger name:message -library/logging,,:Look,WARNING:root:Look before you leap! -library/logging,,:message,severity:logger name:message -library/logging,,:package1, -library/logging,,:package2, -library/logging,,:port,host:port -library/logging,,:root, -library/logging,,:So,INFO:root:So should this -library/logging,,:So,INFO:So should this -library/logging,,:Started,INFO:root:Started -library/logging,,:This, -library/logging,,:Watch,WARNING:root:Watch out! library/logging.handlers,,:port,host:port library/mmap,,:i2,obj[i1:i2] library/multiprocessing,,`,# Add more tasks using `put()` library/multiprocessing,,`,# A test file for the `multiprocessing` package library/multiprocessing,,`,# A test of `multiprocessing.Pool` class library/multiprocessing,,`,# `BaseManager`. -library/multiprocessing,,`,`Cluster` is a subclass of `SyncManager` so it allows creation of -library/multiprocessing,,`,# create server for a `HostManager` object -library/multiprocessing,,`,# Depends on `multiprocessing` package -- tested with `processing-0.60` -library/multiprocessing,,`,`hostname` gives the name of the host. If hostname is not library/multiprocessing,,`,# in the original order then consider using `Pool.map()` or library/multiprocessing,,`,">>> l._callmethod('__getitem__', (20,)) # equiv to `l[20]`" library/multiprocessing,,`,">>> l._callmethod('__getslice__', (2, 7)) # equiv to `l[2:7]`" @@ -219,16 +155,11 @@ library/multiprocessing,,`,# register the Foo class; make `f()` and `g()` accessible via proxy library/multiprocessing,,`,# register the Foo class; make `g()` and `_h()` accessible via proxy library/multiprocessing,,`,# register the generator function baz; use `GeneratorProxy` to make proxies -library/multiprocessing,,`,`slots` is used to specify the number of slots for processes on library/nntplib,,:bytes,:bytes -library/nntplib,,:bytes,"['xref', 'from', ':lines', ':bytes', 'references', 'date', 'message-id', 'subject']" library/nntplib,,:lines,:lines -library/nntplib,,:lines,"['xref', 'from', ':lines', ':bytes', 'references', 'date', 'message-id', 'subject']" library/optparse,,:len,"del parser.rargs[:len(value)]" library/os.path,,:foo,c:foo -library/parser,,`,"""Make a function that raises an argument to the exponent `exp`.""" library/pdb,,:lineno,filename:lineno -library/pdb,,:lineno,[filename:lineno | bpnumber [bpnumber ...]] library/pickle,,:memory,"conn = sqlite3.connect("":memory:"")" library/posix,,`,"CFLAGS=""`getconf LFS_CFLAGS`"" OPT=""-g -O2 $CFLAGS""" library/pprint,209,::,"'classifiers': ['Development Status :: 4 - Beta'," @@ -243,19 +174,14 @@ library/pprint,209,::,"'Topic :: Software Development :: Libraries'," library/pprint,209,::,"'Topic :: Software Development :: Libraries :: Python Modules']," library/profile,,:lineno,filename:lineno(function) -library/profile,,:lineno,ncalls tottime percall cumtime percall filename:lineno(function) -library/profile,,:lineno,"(sort by filename:lineno)," library/pyexpat,,:elem1, library/pyexpat,,:py,"xmlns:py = ""http://www.python.org/ns/"">" -library/repr,,`,"return `obj`" -library/smtplib,,:port,"as well as a regular host:port server." library/smtplib,,:port,method must support that as well as a regular host:port library/socket,,::,"(10, 1, 6, '', ('2001:888:2000:d::a2', 80, 0, 0))]" library/socket,,::,'5aef:2b::8' library/socket,,:can,"return (can_id, can_dlc, data[:can_dlc])" library/socket,,:len,fds.fromstring(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds.itemsize)]) library/sqlite3,,:age,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})" -library/sqlite3,,:age,"select name_last, age from people where name_last=:who and age=:age" library/sqlite3,,:memory, library/sqlite3,,:who,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})" library/ssl,,:My,"Organizational Unit Name (eg, section) []:My Group" @@ -272,7 +198,6 @@ library/stdtypes,,:len,s[len(s):len(s)] library/stdtypes,,::,>>> y = m[::2] library/stdtypes,,::,>>> z = y[::-2] -library/string,,:end,s[start:end] library/subprocess,,`,"output=`dmesg | grep hda`" library/subprocess,,`,"output=`mycmd myarg`" library/tarfile,,:bz2, @@ -284,8 +209,6 @@ library/time,,:mm, library/time,,:ss, library/turtle,,::,Example:: -library/urllib2,,:password,"""joe:password at python.org""" -library/urllib,,:port,:port library/urllib.request,,:close,Connection:close library/urllib.request,,:lang,"xmlns=""http://www.w3.org/1999/xhtml"" xml:lang=""en"" lang=""en"">\n\n\n" library/urllib.request,,:password,"""joe:password at python.org""" @@ -304,16 +227,7 @@ license,,`,* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY license,,`,THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND license,,:zooko,mailto:zooko at zooko.com -reference/datamodel,,:max, -reference/datamodel,,:step,a[i:j:step] -reference/expressions,,:datum,{key:datum...} -reference/expressions,,`,`expressions...` reference/expressions,,:index,x[index:index] -reference/grammar,,:output,#diagram:output -reference/grammar,,:rules,#diagram:rules -reference/grammar,,`,'`' testlist1 '`' -reference/grammar,,:token,#diagram:token -reference/lexical_analysis,,`,", : . ` = ;" reference/lexical_analysis,,`,$ ? ` reference/lexical_analysis,,:fileencoding,# vim:fileencoding= tutorial/datastructures,,:value,It is also possible to delete a key:value @@ -361,15 +275,12 @@ whatsnew/3.2,,:cafe,>>> urllib.parse.urlparse('http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]/foo/') whatsnew/3.2,,:deaf,"netloc='[dead:beef:cafe:5417:affe:8FA3:deaf:feed]'," whatsnew/3.2,,:deaf,>>> urllib.parse.urlparse('http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]/foo/') -whatsnew/3.2,,:directory,... ${buildout:directory}/downloads/dist whatsnew/3.2,,:directory,${buildout:directory}/downloads/dist whatsnew/3.2,,::,"$ export PYTHONWARNINGS='ignore::RuntimeWarning::,once::UnicodeWarning::'" whatsnew/3.2,,:feed,"netloc='[dead:beef:cafe:5417:affe:8FA3:deaf:feed]'," whatsnew/3.2,,:feed,>>> urllib.parse.urlparse('http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]/foo/') whatsnew/3.2,,:gz,">>> with tarfile.open(name='myarchive.tar.gz', mode='w:gz') as tf:" -whatsnew/3.2,,:location,... zope9-location = ${zope9:location} whatsnew/3.2,,:location,zope9-location = ${zope9:location} -whatsnew/3.2,,:prefix,... zope-conf = ${custom:prefix}/etc/zope.conf whatsnew/3.2,,:prefix,zope-conf = ${custom:prefix}/etc/zope.conf whatsnew/changelog,,:platform,:platform: whatsnew/changelog,,:password,: Unquote before b64encoding user:password during Basic @@ -378,15 +289,3 @@ whatsnew/changelog,,:close,: Connection:close header is sent by requests using URLOpener whatsnew/changelog,,::,": Fix FTP tests for IPv6, bind to ""::1"" instead of ""localhost""." whatsnew/changelog,,:test,: test_subprocess:test_leaking_fds_on_error no longer gives a -whatsnew/news,,:platform,:platform: -whatsnew/news,,:password,: Unquote before b64encoding user:password during Basic -whatsnew/news,,:close,Connection:close header. -whatsnew/news,,:PythonCmd,"With Tk < 8.5 _tkinter.c:PythonCmd() raised UnicodeDecodeError, caused" -whatsnew/news,,:close,: Connection:close header is sent by requests using URLOpener -whatsnew/news,,::,": Fix FTP tests for IPv6, bind to ""::1"" instead of ""localhost""." -whatsnew/news,,:test,: test_subprocess:test_leaking_fds_on_error no longer gives a -whatsnew/news,,:test,: Fix test_posix:test_getgroups failure under Solaris. Patch -whatsnew/news,,:Olimit,Drop -OPT:Olimit compiler option. -whatsnew/news,,:MAXYEAR,timedelta from date or datetime falls outside of the MINYEAR:MAXYEAR range. -whatsnew/news,,:bz2,with mode 'r' or 'r:bz2' and a fileobj argument that contained no data or -whatsnew/news,,:db2,: Add configure option --with-dbmliborder=db1:db2:... to specify diff --git a/Doc/tools/sphinxext/suspicious.py b/Doc/tools/sphinxext/suspicious.py --- a/Doc/tools/sphinxext/suspicious.py +++ b/Doc/tools/sphinxext/suspicious.py @@ -68,6 +68,10 @@ # None -> don't care self.issue = issue # the markup fragment that triggered this rule self.line = line # text of the container element (single line only) + self.used = False + + def __repr__(self): + return '{0.docname},,{0.issue},{0.line}'.format(self) @@ -107,6 +111,12 @@ doctree.walk(visitor) def finish(self): + unused_rules = [rule for rule in self.rules if not rule.used] + if unused_rules: + self.warn('Found %s/%s unused rules:' % + (len(unused_rules), len(self.rules))) + for rule in unused_rules: + self.info(repr(rule)) return def check_issue(self, line, lineno, issue): @@ -131,6 +141,7 @@ if (rule.lineno is not None) and \ abs(rule.lineno - lineno) > 5: continue # if it came this far, the rule matched + rule.used = True return True return False -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 28 16:47:07 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 28 Mar 2013 16:47:07 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_improvements_to_the_suspicious_builder_and_cleanup?= =?utf-8?q?_from_3=2E3=2E?= Message-ID: <3Zc9SC1gH1zQxV@mail.python.org> http://hg.python.org/cpython/rev/ac0b1603a29f changeset: 82990:ac0b1603a29f parent: 82987:c52f10be4efe parent: 82989:94e4c6f02caa user: Ezio Melotti date: Thu Mar 28 17:46:20 2013 +0200 summary: Merge improvements to the suspicious builder and cleanup from 3.3. files: Doc/tools/sphinxext/susp-ignored.csv | 114 +-------------- Doc/tools/sphinxext/suspicious.py | 11 + 2 files changed, 13 insertions(+), 112 deletions(-) diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv --- a/Doc/tools/sphinxext/susp-ignored.csv +++ b/Doc/tools/sphinxext/susp-ignored.csv @@ -1,9 +1,7 @@ c-api/arg,,:ref,"PyArg_ParseTuple(args, ""O|O:ref"", &object, &callback)" c-api/list,,:high,list[low:high] -c-api/list,,:high,list[low:high] = itemlist c-api/sequence,,:i2,del o[i1:i2] c-api/sequence,,:i2,o[i1:i2] -c-api/sequence,,:i2,o[i1:i2] = v c-api/unicode,,:end,str[start:end] c-api/unicode,,:start,unicode[start:start+length] distutils/examples,267,`,This is the description of the ``foobar`` package. @@ -18,9 +16,6 @@ faq/programming,,:reduce,"print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y," faq/programming,,:reduce,"Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro," faq/windows,,:bd8afb90ebf2,"Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32" -faq/windows,229,:EOF, at setlocal enableextensions & python -x %~f0 %* & goto :EOF -faq/windows,393,:REG,.py :REG_SZ: c:\\python.exe -u %s %s -howto/cporting,,:add,"if (!PyArg_ParseTuple(args, ""ii:add_ints"", &one, &two))" howto/cporting,,:encode,"if (!PyArg_ParseTuple(args, ""O:encode_object"", &myobj))" howto/cporting,,:say,"if (!PyArg_ParseTuple(args, ""U:say_hello"", &name))" howto/curses,,:black,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and" @@ -35,8 +30,6 @@ howto/ipaddress,,::,>>> ipaddress.ip_address('2001:DB8::1') howto/ipaddress,,:db8,IPv6Address('2001:db8::1') howto/ipaddress,,::,IPv6Address('2001:db8::1') -howto/ipaddress,,:db8,IPv6Address('2001:db8::1') -howto/ipaddress,,::,IPv6Address('2001:db8::1') howto/ipaddress,,::,IPv6Address('::1') howto/ipaddress,,:db8,>>> ipaddress.ip_network('2001:db8::0/96') howto/ipaddress,,::,>>> ipaddress.ip_network('2001:db8::0/96') @@ -44,29 +37,18 @@ howto/ipaddress,,::,IPv6Network('2001:db8::/96') howto/ipaddress,,:db8,IPv6Network('2001:db8::/128') howto/ipaddress,,::,IPv6Network('2001:db8::/128') -howto/ipaddress,,:db8,>>> ipaddress.ip_network('2001:db8::1/96') -howto/ipaddress,,::,>>> ipaddress.ip_network('2001:db8::1/96') howto/ipaddress,,:db8,IPv6Interface('2001:db8::1/96') howto/ipaddress,,::,IPv6Interface('2001:db8::1/96') howto/ipaddress,,:db8,>>> addr6 = ipaddress.ip_address('2001:db8::1') howto/ipaddress,,::,>>> addr6 = ipaddress.ip_address('2001:db8::1') howto/ipaddress,,:db8,>>> host6 = ipaddress.ip_interface('2001:db8::1/96') howto/ipaddress,,::,>>> host6 = ipaddress.ip_interface('2001:db8::1/96') -howto/ipaddress,,:db8,IPv6Network('2001:db8::/96') -howto/ipaddress,,::,IPv6Network('2001:db8::/96') -howto/ipaddress,,:db8,>>> net6 = ipaddress.ip_network('2001:db8::0/96') -howto/ipaddress,,::,>>> net6 = ipaddress.ip_network('2001:db8::0/96') howto/ipaddress,,:db8,>>> net6 = ipaddress.ip_network('2001:db8::0/96') howto/ipaddress,,::,>>> net6 = ipaddress.ip_network('2001:db8::0/96') howto/ipaddress,,:ffff,IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff::') howto/ipaddress,,::,IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff::') howto/ipaddress,,::,IPv6Address('::ffff:ffff') howto/ipaddress,,:ffff,IPv6Address('::ffff:ffff') -howto/ipaddress,,::,IPv6Address('2001::1') -howto/ipaddress,,::,IPv6Address('2001::ffff:ffff') -howto/ipaddress,,:ffff,IPv6Address('2001::ffff:ffff') -howto/ipaddress,,:db8,'2001:db8::' -howto/ipaddress,,::,'2001:db8::' howto/ipaddress,,:db8,'2001:db8::/96' howto/ipaddress,,::,'2001:db8::/96' howto/ipaddress,,:db8,>>> ipaddress.ip_interface('2001:db8::1/96') @@ -103,7 +85,6 @@ howto/regex,,::, howto/regex,,:foo,(?:foo) howto/urllib2,,:example,"for example ""joe at password:example.com""" -howto/webservers,,.. image:,.. image:: http.png library/audioop,,:ipos,"# factor = audioop.findfactor(in_test[ipos*2:ipos*2+len(out_test)]," library/bisect,32,:hi,all(val >= x for val in a[i:hi]) library/bisect,42,:hi,all(val > x for val in a[i:hi]) @@ -112,10 +93,7 @@ library/configparser,,:option,${section:option} library/configparser,,:path,python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python} library/configparser,,:Python,python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python} -library/configparser,,`,# Set the optional `raw` argument of get() to True if you wish to disable library/configparser,,:system,path: ${Common:system_dir}/Library/Frameworks/ -library/configparser,,`,# The optional `fallback` argument can be used to provide a fallback value -library/configparser,,`,# The optional `vars` argument is a dict with members that will take library/datetime,,:MM, library/datetime,,:SS, library/decimal,,:optional,"trailneg:optional trailing minus indicator" @@ -124,8 +102,6 @@ library/difflib,,:i1, library/difflib,,:i2, library/difflib,,:j2, -library/dis,,:TOS, -library/dis,,`,TOS = `TOS` library/doctest,,`,``factorial`` from the ``example`` module: library/doctest,,`,The ``example`` module library/doctest,,`,Using ``factorial`` @@ -133,7 +109,6 @@ library/functions,,:step,a[start:stop:step] library/functions,,:stop,"a[start:stop, i]" library/functions,,:stop,a[start:stop:step] -library/hotshot,,:lineno,"ncalls tottime percall cumtime percall filename:lineno(function)" library/http.client,,:port,host:port library/http.cookies,,`,!#$%&'*+-.^_`|~: library/imaplib,,:MM,"""DD-Mmm-YYYY HH:MM:SS" @@ -149,24 +124,6 @@ library/ipaddress,,::,>>> ipaddress.IPv6Address('2001:db8::1000') library/ipaddress,,:db8,IPv6Address('2001:db8::1000') library/ipaddress,,::,IPv6Address('2001:db8::1000') -library/ipaddress,,:db8,>>> ipaddress.IPv6Interface('2001:db8::1000/96') -library/ipaddress,,::,>>> ipaddress.IPv6Interface('2001:db8::1000/96') -library/ipaddress,,:db8,IPv6Interface('2001:db8::1000/96') -library/ipaddress,,::,IPv6Interface('2001:db8::1000/96') -library/ipaddress,,:db8,>>> ipaddress.IPv6Interface('2001:db8::1000/96').network -library/ipaddress,,::,>>> ipaddress.IPv6Interface('2001:db8::1000/96').network -library/ipaddress,,:db8,IPv6Network('2001:db8::/96') -library/ipaddress,,::,IPv6Network('2001:db8::/96') -library/ipaddress,,:db8,>>> ipaddress.IPv6Network('2001:db8::/96') -library/ipaddress,,::,>>> ipaddress.IPv6Network('2001:db8::/96') -library/ipaddress,,:db8,IPv6Network('2001:db8::/96') -library/ipaddress,,::,IPv6Network('2001:db8::/96') -library/ipaddress,,:db8,>>> ipaddress.IPv6Network('2001:db8::/96').netmask -library/ipaddress,,::,>>> ipaddress.IPv6Network('2001:db8::/96').netmask -library/ipaddress,,:ffff,IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff::') -library/ipaddress,,::,IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff::') -library/ipaddress,,:db8,">>> ipaddress.IPv6Network('2001:db8::1000/96', strict=False)" -library/ipaddress,,::,">>> ipaddress.IPv6Network('2001:db8::1000/96', strict=False)" library/ipaddress,,::,"""::abc:7:def""" library/ipaddress,,:def,"""::abc:7:def""" library/ipaddress,,::,::FFFF/96 @@ -174,41 +131,20 @@ library/ipaddress,,::,2001::/32 library/ipaddress,,::,>>> str(ipaddress.IPv6Address('::1')) library/ipaddress,,::,'::1' -library/ipaddress,,::,>>> int(ipaddress.IPv6Address('::1')) library/ipaddress,,:ff00,ffff:ff00:: library/ipaddress,,:db00,2001:db00::0/24 library/ipaddress,,::,2001:db00::0/24 library/ipaddress,,:db00,2001:db00::0/ffff:ff00:: library/ipaddress,,::,2001:db00::0/ffff:ff00:: -library/ipaddress,,:ff00,2001:db00::0/ffff:ff00:: library/itertools,,:step,elements from seq[start:stop:step] library/itertools,,:stop,elements from seq[start:stop:step] library/linecache,,:sys,"sys:x:3:3:sys:/dev:/bin/sh" -library/logging,,:And, -library/logging,,:Doing,INFO:root:Doing something -library/logging,,:Finished,INFO:root:Finished -library/logging,,:logger,severity:logger name:message -library/logging,,:Look,WARNING:root:Look before you leap! -library/logging,,:message,severity:logger name:message -library/logging,,:package1, -library/logging,,:package2, -library/logging,,:port,host:port -library/logging,,:root, -library/logging,,:So,INFO:root:So should this -library/logging,,:So,INFO:So should this -library/logging,,:Started,INFO:root:Started -library/logging,,:This, -library/logging,,:Watch,WARNING:root:Watch out! library/logging.handlers,,:port,host:port library/mmap,,:i2,obj[i1:i2] library/multiprocessing,,`,# Add more tasks using `put()` library/multiprocessing,,`,# A test file for the `multiprocessing` package library/multiprocessing,,`,# A test of `multiprocessing.Pool` class library/multiprocessing,,`,# `BaseManager`. -library/multiprocessing,,`,`Cluster` is a subclass of `SyncManager` so it allows creation of -library/multiprocessing,,`,# create server for a `HostManager` object -library/multiprocessing,,`,# Depends on `multiprocessing` package -- tested with `processing-0.60` -library/multiprocessing,,`,`hostname` gives the name of the host. If hostname is not library/multiprocessing,,`,# in the original order then consider using `Pool.map()` or library/multiprocessing,,`,">>> l._callmethod('__getitem__', (20,)) # equiv to `l[20]`" library/multiprocessing,,`,">>> l._callmethod('__getslice__', (2, 7)) # equiv to `l[2:7]`" @@ -219,44 +155,25 @@ library/multiprocessing,,`,# register the Foo class; make `f()` and `g()` accessible via proxy library/multiprocessing,,`,# register the Foo class; make `g()` and `_h()` accessible via proxy library/multiprocessing,,`,# register the generator function baz; use `GeneratorProxy` to make proxies -library/multiprocessing,,`,`slots` is used to specify the number of slots for processes on library/nntplib,,:bytes,:bytes -library/nntplib,,:bytes,"['xref', 'from', ':lines', ':bytes', 'references', 'date', 'message-id', 'subject']" library/nntplib,,:lines,:lines -library/nntplib,,:lines,"['xref', 'from', ':lines', ':bytes', 'references', 'date', 'message-id', 'subject']" library/optparse,,:len,"del parser.rargs[:len(value)]" library/os.path,,:foo,c:foo -library/parser,,`,"""Make a function that raises an argument to the exponent `exp`.""" library/pdb,,:lineno,filename:lineno -library/pdb,,:lineno,[filename:lineno | bpnumber [bpnumber ...]] library/pickle,,:memory,"conn = sqlite3.connect("":memory:"")" library/posix,,`,"CFLAGS=""`getconf LFS_CFLAGS`"" OPT=""-g -O2 $CFLAGS""" library/pprint,,::,"'Programming Language :: Python :: 2 :: Only']," -library/pprint,209,::,"'classifiers': ['Development Status :: 4 - Beta'," -library/pprint,209,::,"'Intended Audience :: Developers'," -library/pprint,209,::,"'License :: OSI Approved :: MIT License'," -library/pprint,209,::,"'Natural Language :: English'," -library/pprint,209,::,"'Operating System :: OS Independent'," -library/pprint,209,::,"'Programming Language :: Python'," -library/pprint,209,::,"'Programming Language :: Python :: 2'," -library/pprint,209,::,"'Programming Language :: Python :: 2.6'," -library/pprint,209,::,"'Programming Language :: Python :: 2.7'," -library/pprint,209,::,"'Topic :: Software Development :: Libraries'," -library/pprint,209,::,"'Topic :: Software Development :: Libraries :: Python Modules']," +library/pprint,,::,"'Programming Language :: Python :: 2.6'," +library/pprint,,::,"'Programming Language :: Python :: 2.7'," library/profile,,:lineno,filename:lineno(function) -library/profile,,:lineno,ncalls tottime percall cumtime percall filename:lineno(function) -library/profile,,:lineno,"(sort by filename:lineno)," library/pyexpat,,:elem1, library/pyexpat,,:py,"xmlns:py = ""http://www.python.org/ns/"">" -library/repr,,`,"return `obj`" -library/smtplib,,:port,"as well as a regular host:port server." library/smtplib,,:port,method must support that as well as a regular host:port library/socket,,::,"(10, 1, 6, '', ('2001:888:2000:d::a2', 80, 0, 0))]" library/socket,,::,'5aef:2b::8' library/socket,,:can,"return (can_id, can_dlc, data[:can_dlc])" library/socket,,:len,fds.fromstring(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds.itemsize)]) library/sqlite3,,:age,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})" -library/sqlite3,,:age,"select name_last, age from people where name_last=:who and age=:age" library/sqlite3,,:memory, library/sqlite3,,:who,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})" library/sqlite3,,:path,"db = sqlite3.connect('file:path/to/database?mode=ro', uri=True)" @@ -274,7 +191,6 @@ library/stdtypes,,:len,s[len(s):len(s)] library/stdtypes,,::,>>> y = m[::2] library/stdtypes,,::,>>> z = y[::-2] -library/string,,:end,s[start:end] library/subprocess,,`,"output=`dmesg | grep hda`" library/subprocess,,`,"output=`mycmd myarg`" library/tarfile,,:bz2, @@ -286,8 +202,6 @@ library/time,,:mm, library/time,,:ss, library/turtle,,::,Example:: -library/urllib2,,:password,"""joe:password at python.org""" -library/urllib,,:port,:port library/urllib.request,,:close,Connection:close library/urllib.request,,:lang,"xmlns=""http://www.w3.org/1999/xhtml"" xml:lang=""en"" lang=""en"">\n\n\n" library/urllib.request,,:password,"""joe:password at python.org""" @@ -306,16 +220,7 @@ license,,`,* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY license,,`,THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND license,,:zooko,mailto:zooko at zooko.com -reference/datamodel,,:max, -reference/datamodel,,:step,a[i:j:step] -reference/expressions,,:datum,{key:datum...} -reference/expressions,,`,`expressions...` reference/expressions,,:index,x[index:index] -reference/grammar,,:output,#diagram:output -reference/grammar,,:rules,#diagram:rules -reference/grammar,,`,'`' testlist1 '`' -reference/grammar,,:token,#diagram:token -reference/lexical_analysis,,`,", : . ` = ;" reference/lexical_analysis,,`,$ ? ` reference/lexical_analysis,,:fileencoding,# vim:fileencoding= tutorial/datastructures,,:value,It is also possible to delete a key:value @@ -363,15 +268,12 @@ whatsnew/3.2,,:cafe,>>> urllib.parse.urlparse('http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]/foo/') whatsnew/3.2,,:deaf,"netloc='[dead:beef:cafe:5417:affe:8FA3:deaf:feed]'," whatsnew/3.2,,:deaf,>>> urllib.parse.urlparse('http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]/foo/') -whatsnew/3.2,,:directory,... ${buildout:directory}/downloads/dist whatsnew/3.2,,:directory,${buildout:directory}/downloads/dist whatsnew/3.2,,::,"$ export PYTHONWARNINGS='ignore::RuntimeWarning::,once::UnicodeWarning::'" whatsnew/3.2,,:feed,"netloc='[dead:beef:cafe:5417:affe:8FA3:deaf:feed]'," whatsnew/3.2,,:feed,>>> urllib.parse.urlparse('http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]/foo/') whatsnew/3.2,,:gz,">>> with tarfile.open(name='myarchive.tar.gz', mode='w:gz') as tf:" -whatsnew/3.2,,:location,... zope9-location = ${zope9:location} whatsnew/3.2,,:location,zope9-location = ${zope9:location} -whatsnew/3.2,,:prefix,... zope-conf = ${custom:prefix}/etc/zope.conf whatsnew/3.2,,:prefix,zope-conf = ${custom:prefix}/etc/zope.conf whatsnew/changelog,,:platform,:platform: whatsnew/changelog,,:password,: Unquote before b64encoding user:password during Basic @@ -380,15 +282,3 @@ whatsnew/changelog,,:close,: Connection:close header is sent by requests using URLOpener whatsnew/changelog,,::,": Fix FTP tests for IPv6, bind to ""::1"" instead of ""localhost""." whatsnew/changelog,,:test,: test_subprocess:test_leaking_fds_on_error no longer gives a -whatsnew/news,,:platform,:platform: -whatsnew/news,,:password,: Unquote before b64encoding user:password during Basic -whatsnew/news,,:close,Connection:close header. -whatsnew/news,,:PythonCmd,"With Tk < 8.5 _tkinter.c:PythonCmd() raised UnicodeDecodeError, caused" -whatsnew/news,,:close,: Connection:close header is sent by requests using URLOpener -whatsnew/news,,::,": Fix FTP tests for IPv6, bind to ""::1"" instead of ""localhost""." -whatsnew/news,,:test,: test_subprocess:test_leaking_fds_on_error no longer gives a -whatsnew/news,,:test,: Fix test_posix:test_getgroups failure under Solaris. Patch -whatsnew/news,,:Olimit,Drop -OPT:Olimit compiler option. -whatsnew/news,,:MAXYEAR,timedelta from date or datetime falls outside of the MINYEAR:MAXYEAR range. -whatsnew/news,,:bz2,with mode 'r' or 'r:bz2' and a fileobj argument that contained no data or -whatsnew/news,,:db2,: Add configure option --with-dbmliborder=db1:db2:... to specify diff --git a/Doc/tools/sphinxext/suspicious.py b/Doc/tools/sphinxext/suspicious.py --- a/Doc/tools/sphinxext/suspicious.py +++ b/Doc/tools/sphinxext/suspicious.py @@ -68,6 +68,10 @@ # None -> don't care self.issue = issue # the markup fragment that triggered this rule self.line = line # text of the container element (single line only) + self.used = False + + def __repr__(self): + return '{0.docname},,{0.issue},{0.line}'.format(self) @@ -107,6 +111,12 @@ doctree.walk(visitor) def finish(self): + unused_rules = [rule for rule in self.rules if not rule.used] + if unused_rules: + self.warn('Found %s/%s unused rules:' % + (len(unused_rules), len(self.rules))) + for rule in unused_rules: + self.info(repr(rule)) return def check_issue(self, line, lineno, issue): @@ -131,6 +141,7 @@ if (rule.lineno is not None) and \ abs(rule.lineno - lineno) > 5: continue # if it came this far, the rule matched + rule.used = True return True return False -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 28 17:01:27 2013 From: python-checkins at python.org (ezio.melotti) Date: Thu, 28 Mar 2013 17:01:27 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Update_the_sus?= =?utf-8?q?picious_builder_to_detect_unused_rules=2C_and_remove_currently?= Message-ID: <3Zc9ml2TY5zRLw@mail.python.org> http://hg.python.org/cpython/rev/7223b17ebecb changeset: 82991:7223b17ebecb branch: 2.7 parent: 82988:75512a165318 user: Ezio Melotti date: Thu Mar 28 18:01:11 2013 +0200 summary: Update the suspicious builder to detect unused rules, and remove currently unusued rules. files: Doc/tools/sphinxext/susp-ignored.csv | 40 ---------------- Doc/tools/sphinxext/suspicious.py | 11 ++++ 2 files changed, 11 insertions(+), 40 deletions(-) diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv --- a/Doc/tools/sphinxext/susp-ignored.csv +++ b/Doc/tools/sphinxext/susp-ignored.csv @@ -1,9 +1,6 @@ c-api/arg,,:ref,"PyArg_ParseTuple(args, ""O|O:ref"", &object, &callback)" c-api/list,,:high,list[low:high] -c-api/list,,:high,list[low:high] = itemlist c-api/sequence,,:i2,o[i1:i2] -c-api/sequence,,:i2,o[i1:i2] = v -c-api/sequence,,:i2,del o[i1:i2] c-api/unicode,,:end,str[start:end] distutils/setupscript,,::, extending/embedding,,:numargs,"if(!PyArg_ParseTuple(args, "":numargs""))" @@ -11,7 +8,6 @@ extending/extending,,:myfunction,"PyArg_ParseTuple(args, ""D:myfunction"", &c);" extending/newtypes,,:call,"if (!PyArg_ParseTuple(args, ""sss:call"", &arg1, &arg2, &arg3)) {" extending/windows,,:initspam,/export:initspam -howto/cporting,,:add,"if (!PyArg_ParseTuple(args, ""ii:add_ints"", &one, &two))" howto/cporting,,:encode,"if (!PyArg_ParseTuple(args, ""O:encode_object"", &myobj))" howto/cporting,,:say,"if (!PyArg_ParseTuple(args, ""U:say_hello"", &name))" howto/curses,,:black,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and" @@ -46,7 +42,6 @@ howto/regex,,::, howto/regex,,:foo,(?:foo) howto/urllib2,,:example,"for example ""joe at password:example.com""" -howto/webservers,,.. image:,.. image:: http.png library/audioop,,:ipos,"# factor = audioop.findfactor(in_test[ipos*2:ipos*2+len(out_test)]," library/cookie,,`,!#$%&'*+-.^_`|~ library/datetime,,:MM, @@ -73,12 +68,6 @@ library/itertools,,:stop,elements from seq[start:stop:step] library/itertools,,:step,elements from seq[start:stop:step] library/linecache,,:sys,"sys:x:3:3:sys:/dev:/bin/sh" -library/logging,,:And, -library/logging,,:package1, -library/logging,,:package2, -library/logging,,:root, -library/logging,,:This, -library/logging,,:port,host:port library/logging.handlers,,:port,host:port library/mmap,,:i2,obj[i1:i2] library/multiprocessing,,:queue,">>> QueueManager.register('get_queue', callable=lambda:queue)" @@ -89,28 +78,20 @@ library/multiprocessing,,`,# A test file for the `multiprocessing` package library/multiprocessing,,`,# A test of `multiprocessing.Pool` class library/multiprocessing,,`,# Add more tasks using `put()` -library/multiprocessing,,`,# create server for a `HostManager` object -library/multiprocessing,,`,# Depends on `multiprocessing` package -- tested with `processing-0.60` library/multiprocessing,,`,# in the original order then consider using `Pool.map()` or library/multiprocessing,,`,# Not sure if we should synchronize access to `socket.accept()` method by library/multiprocessing,,`,# object. (We import `multiprocessing.reduction` to enable this pickling.) library/multiprocessing,,`,# register the Foo class; make `f()` and `g()` accessible via proxy library/multiprocessing,,`,# register the Foo class; make `g()` and `_h()` accessible via proxy library/multiprocessing,,`,# register the generator function baz; use `GeneratorProxy` to make proxies -library/multiprocessing,,`,`Cluster` is a subclass of `SyncManager` so it allows creation of -library/multiprocessing,,`,`hostname` gives the name of the host. If hostname is not -library/multiprocessing,,`,`slots` is used to specify the number of slots for processes on library/optparse,,:len,"del parser.rargs[:len(value)]" library/os.path,,:foo,c:foo -library/parser,,`,"""Make a function that raises an argument to the exponent `exp`.""" -library/pdb,,:lineno,filename:lineno library/pdb,,:lineno,filename:lineno library/posix,,`,"CFLAGS=""`getconf LFS_CFLAGS`"" OPT=""-g -O2 $CFLAGS""" library/profile,,:lineno,ncalls tottime percall cumtime percall filename:lineno(function) library/profile,,:lineno,filename:lineno(function) library/pyexpat,,:elem1, library/pyexpat,,:py,"xmlns:py = ""http://www.python.org/ns/"">" -library/repr,,`,"return `obj`" library/smtplib,,:port,"as well as a regular host:port server." library/socket,,::,'5aef:2b::8' library/sqlite3,,:memory, @@ -124,8 +105,6 @@ library/ssl,,:Some,"Locality Name (eg, city) []:Some City" library/ssl,,:US,Country Name (2 letter code) [AU]:US library/stdtypes,,:len,s[len(s):len(s)] -library/stdtypes,,:len,s[len(s):len(s)] -library/string,,:end,s[start:end] library/string,,:end,s[start:end] library/subprocess,,`,"output=`mycmd myarg`" library/subprocess,,`,"output=`dmesg | grep hda`" @@ -147,13 +126,8 @@ reference/datamodel,,:step,a[i:j:step] reference/datamodel,,:max, reference/expressions,,:index,x[index:index] -reference/expressions,,:datum,{key:datum...} reference/expressions,,`,`expressions...` reference/expressions,,`,"""`""" -reference/expressions,,`,"""`""" -reference/grammar,,:output,#diagram:output -reference/grammar,,:rules,#diagram:rules -reference/grammar,,:token,#diagram:token reference/grammar,,`,'`' testlist1 '`' reference/lexical_analysis,,:fileencoding,# vim:fileencoding= reference/lexical_analysis,,`,", : . ` = ;" @@ -176,8 +150,6 @@ using/cmdline,,:message,action:message:category:module:line using/cmdline,,:module,action:message:category:module:line using/cmdline,,:errorhandler,:errorhandler -using/windows,162,`,`` this fixes syntax highlighting errors in some editors due to the \\\\ hackery -using/windows,170,`,`` whatsnew/2.0,418,:len, whatsnew/2.3,,::, whatsnew/2.3,,:config, @@ -191,30 +163,18 @@ whatsnew/2.5,,:memory,:memory: whatsnew/2.5,,:step,[start:stop:step] whatsnew/2.5,,:stop,[start:stop:step] -distutils/examples,267,`,This is the description of the ``foobar`` package. faq/programming,,:reduce,"print (lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y," faq/programming,,:reduce,"Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro," faq/programming,,:chr,">=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr(" faq/programming,,::,for x in sequence[::-1]: -faq/windows,229,:EOF, at setlocal enableextensions & python -x %~f0 %* & goto :EOF -faq/windows,393,:REG,.py :REG_SZ: c:\\python.exe -u %s %s library/bisect,,:hi,all(val >= x for val in a[i:hi]) library/bisect,,:hi,all(val > x for val in a[i:hi]) -library/http.client,52,:port,host:port -library/nntplib,,:bytes,:bytes -library/nntplib,,:lines,:lines -library/nntplib,,:lines,"['xref', 'from', ':lines', ':bytes', 'references', 'date', 'message-id', 'subject']" -library/nntplib,,:bytes,"['xref', 'from', ':lines', ':bytes', 'references', 'date', 'message-id', 'subject']" -library/pickle,567,:memory,"conn = sqlite3.connect("":memory:"")" -library/profile,293,:lineno,"(sort by filename:lineno)," library/socket,,::,"(10, 1, 6, '', ('2001:888:2000:d::a2', 80, 0, 0))]" library/stdtypes,,:end,s[start:end] -library/stdtypes,,:end,s[start:end] license,,`,* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY license,,`,* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND license,,`,"``Software''), to deal in the Software without restriction, including" license,,`,"THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND," -reference/lexical_analysis,704,`,$ ? ` whatsnew/2.7,735,:Sunday,'2009:4:Sunday' whatsnew/2.7,862,::,"export PYTHONWARNINGS=all,error:::Cookie:0" whatsnew/2.7,862,:Cookie,"export PYTHONWARNINGS=all,error:::Cookie:0" diff --git a/Doc/tools/sphinxext/suspicious.py b/Doc/tools/sphinxext/suspicious.py --- a/Doc/tools/sphinxext/suspicious.py +++ b/Doc/tools/sphinxext/suspicious.py @@ -66,6 +66,10 @@ # None -> don't care self.issue = issue # the markup fragment that triggered this rule self.line = line # text of the container element (single line only) + self.used = False + + def __repr__(self): + return '{0.docname},,{0.issue},{0.line}'.format(self) @@ -105,6 +109,12 @@ doctree.walk(visitor) def finish(self): + unused_rules = [rule for rule in self.rules if not rule.used] + if unused_rules: + self.warn('Found %s/%s unused rules:' % + (len(unused_rules), len(self.rules))) + for rule in unused_rules: + self.info(repr(rule)) return def check_issue(self, line, lineno, issue): @@ -129,6 +139,7 @@ if (rule.lineno is not None) and \ abs(rule.lineno - lineno) > 5: continue # if it came this far, the rule matched + rule.used = True return True return False -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Mar 28 22:29:15 2013 From: python-checkins at python.org (antoine.pitrou) Date: Thu, 28 Mar 2013 22:29:15 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2316692=3A_The_ssl_?= =?utf-8?q?module_now_supports_TLS_1=2E1_and_TLS_1=2E2=2E__Initial_patch?= Message-ID: <3ZcK2z6FW3zRdD@mail.python.org> http://hg.python.org/cpython/rev/02a89bd646ca changeset: 82992:02a89bd646ca parent: 82990:ac0b1603a29f user: Antoine Pitrou date: Thu Mar 28 22:24:43 2013 +0100 summary: Issue #16692: The ssl module now supports TLS 1.1 and TLS 1.2. Initial patch by Michele Orr?. files: Doc/library/ssl.rst | 55 +++++++++++-- Doc/whatsnew/3.4.rst | 1 + Lib/ssl.py | 13 ++- Lib/test/test_ssl.py | 73 +++++++++++++----- Misc/NEWS | 5 + Modules/_ssl.c | 124 +++++++++++++++++++----------- setup.py | 4 +- 7 files changed, 194 insertions(+), 81 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -26,7 +26,8 @@ Some behavior may be platform dependent, since calls are made to the operating system socket APIs. The installed version of OpenSSL may also - cause variations in behavior. + cause variations in behavior. For example, TLSv1.1 and TLSv1.2 come with + openssl version 1.0.1. This section documents the objects and functions in the ``ssl`` module; for more general information about TLS, SSL, and certificates, the reader is referred to @@ -177,14 +178,16 @@ .. table:: - ======================== ========= ========= ========== ========= - *client* / **server** **SSLv2** **SSLv3** **SSLv23** **TLSv1** - ------------------------ --------- --------- ---------- --------- - *SSLv2* yes no yes no - *SSLv3* no yes yes no - *SSLv23* yes no yes no - *TLSv1* no no yes yes - ======================== ========= ========= ========== ========= + ======================== ========= ========= ========== ========= =========== =========== + *client* / **server** **SSLv2** **SSLv3** **SSLv23** **TLSv1** **TLSv1.1** **TLSv1.2** + ------------------------ --------- --------- ---------- --------- ----------- ----------- + *SSLv2* yes no yes no no no + *SSLv3* no yes yes no no no + *SSLv23* yes no yes no no no + *TLSv1* no no yes yes no no + *TLSv1.1* no no yes no yes no + *TLSv1.2* no no yes no no yes + ======================== ========= ========= ========== ========= =========== =========== .. note:: @@ -401,9 +404,25 @@ .. data:: PROTOCOL_TLSv1 - Selects TLS version 1 as the channel encryption protocol. This is the most + Selects TLS version 1.0 as the channel encryption protocol. + +.. data:: PROTOCOL_TLSv1_1 + + + Selects TLS version 1.1 as the channel encryption protocol. + Available only with openssl version 1.0.1+. + + .. versionadded:: 3.4 + +.. data:: PROTOCOL_TLSv1_2 + + + Selects TLS version 1.2 as the channel encryption protocol. This is the most modern version, and probably the best choice for maximum protection, if both sides can speak it. + Available only with openssl version 1.0.1+. + + .. versionadded:: 3.4 .. data:: OP_ALL @@ -437,6 +456,22 @@ .. versionadded:: 3.2 +.. data:: OP_NO_TLSv1_1 + + Prevents a TLSv1.1 connection. This option is only applicable in conjunction + with :const:`PROTOCOL_SSLv23`. It prevents the peers from choosing TLSv1.1 as + the protocol version. Available only with openssl version 1.0.1+. + + .. versionadded:: 3.4 + +.. data:: OP_NO_TLSv1_2 + + Prevents a TLSv1.2 connection. This option is only applicable in conjunction + with :const:`PROTOCOL_SSLv23`. It prevents the peers from choosing TLSv1.2 as + the protocol version. Available only with openssl version 1.0.1+. + + .. versionadded:: 3.4 + .. data:: OP_CIPHER_SERVER_PREFERENCE Use the server's cipher ordering preference, rather than the client's. diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst --- a/Doc/whatsnew/3.4.rst +++ b/Doc/whatsnew/3.4.rst @@ -103,6 +103,7 @@ Significantly Improved Library Modules: * SHA-3 (Keccak) support for :mod:`hashlib`. +* TLSv1.1 and TLSv1.2 support for :mod:`ssl`. Security improvements: diff --git a/Lib/ssl.py b/Lib/ssl.py --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -52,6 +52,8 @@ PROTOCOL_SSLv3 PROTOCOL_SSLv23 PROTOCOL_TLSv1 +PROTOCOL_TLSv1_1 +PROTOCOL_TLSv1_2 The following constants identify various SSL alert message descriptions as per http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6 @@ -110,8 +112,7 @@ from _ssl import HAS_SNI, HAS_ECDH, HAS_NPN -from _ssl import (PROTOCOL_SSLv3, PROTOCOL_SSLv23, - PROTOCOL_TLSv1) +from _ssl import PROTOCOL_SSLv3, PROTOCOL_SSLv23, PROTOCOL_TLSv1 from _ssl import _OPENSSL_API_VERSION @@ -128,6 +129,14 @@ else: _PROTOCOL_NAMES[PROTOCOL_SSLv2] = "SSLv2" +try: + from _ssl import PROTOCOL_TLSv1_1, PROTOCOL_TLSv1_2 +except ImportError: + pass +else: + _PROTOCOL_NAMES[PROTOCOL_TLSv1_1] = "TLSv1.1" + _PROTOCOL_NAMES[PROTOCOL_TLSv1_2] = "TLSv1.2" + from socket import getnameinfo as _getnameinfo from socket import socket, AF_INET, SOCK_STREAM, create_connection import base64 # for DER-to-PEM translation diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -20,13 +20,7 @@ ssl = support.import_module("ssl") -PROTOCOLS = [ - ssl.PROTOCOL_SSLv3, - ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1 -] -if hasattr(ssl, 'PROTOCOL_SSLv2'): - PROTOCOLS.append(ssl.PROTOCOL_SSLv2) - +PROTOCOLS = sorted(ssl._PROTOCOL_NAMES) HOST = support.HOST data_file = lambda name: os.path.join(os.path.dirname(__file__), name) @@ -101,10 +95,6 @@ class BasicSocketTests(unittest.TestCase): def test_constants(self): - #ssl.PROTOCOL_SSLv2 - ssl.PROTOCOL_SSLv23 - ssl.PROTOCOL_SSLv3 - ssl.PROTOCOL_TLSv1 ssl.CERT_NONE ssl.CERT_OPTIONAL ssl.CERT_REQUIRED @@ -396,11 +386,8 @@ @skip_if_broken_ubuntu_ssl def test_constructor(self): - if hasattr(ssl, 'PROTOCOL_SSLv2'): - ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv2) - ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv3) - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + for protocol in PROTOCOLS: + ssl.SSLContext(protocol) self.assertRaises(TypeError, ssl.SSLContext) self.assertRaises(ValueError, ssl.SSLContext, -1) self.assertRaises(ValueError, ssl.SSLContext, 42) @@ -1360,12 +1347,15 @@ client_context.options = ssl.OP_ALL | client_options server_context = ssl.SSLContext(server_protocol) server_context.options = ssl.OP_ALL | server_options + + # NOTE: we must enable "ALL" ciphers on the client, otherwise an + # SSLv23 client will send an SSLv3 hello (rather than SSLv2) + # starting from OpenSSL 1.0.0 (see issue #8322). + if client_context.protocol == ssl.PROTOCOL_SSLv23: + client_context.set_ciphers("ALL") + for ctx in (client_context, server_context): ctx.verify_mode = certsreqs - # NOTE: we must enable "ALL" ciphers, otherwise an SSLv23 client - # will send an SSLv3 hello (rather than SSLv2) starting from - # OpenSSL 1.0.0 (see issue #8322). - ctx.set_ciphers("ALL") ctx.load_cert_chain(CERTFILE) ctx.load_verify_locations(CERTFILE) try: @@ -1581,6 +1571,49 @@ try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv23, False, client_options=ssl.OP_NO_TLSv1) + @skip_if_broken_ubuntu_ssl + @unittest.skipUnless(hasattr(ssl, "PROTOCOL_TLSv1_1"), + "TLS version 1.1 not supported.") + def test_protocol_tlsv1_1(self): + """Connecting to a TLSv1.1 server with various client options. + Testing against older TLS versions.""" + if support.verbose: + sys.stdout.write("\n") + try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLSv1_1, True) + if hasattr(ssl, 'PROTOCOL_SSLv2'): + try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_SSLv2, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_SSLv3, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_SSLv23, False, + client_options=ssl.OP_NO_TLSv1_1) + + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1_1, True) + try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLSv1, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1_1, False) + + + @skip_if_broken_ubuntu_ssl + @unittest.skipUnless(hasattr(ssl, "PROTOCOL_TLSv1_2"), + "TLS version 1.2 not supported.") + def test_protocol_tlsv1_2(self): + """Connecting to a TLSv1.2 server with various client options. + Testing against older TLS versions.""" + if support.verbose: + sys.stdout.write("\n") + try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLSv1_2, True, + server_options=ssl.OP_NO_SSLv3|ssl.OP_NO_SSLv2, + client_options=ssl.OP_NO_SSLv3|ssl.OP_NO_SSLv2,) + if hasattr(ssl, 'PROTOCOL_SSLv2'): + try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_SSLv2, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_SSLv3, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_SSLv23, False, + client_options=ssl.OP_NO_TLSv1_2) + + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1_2, True) + try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLSv1, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1_2, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLSv1_1, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLSv1_2, False) + def test_starttls(self): """Switching from clear text to encrypted and back again.""" msgs = (b"msg 1", b"MSG 2", b"STARTTLS", b"MSG 3", b"msg 4", b"ENDTLS", b"msg 5", b"msg 6") diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -297,6 +297,9 @@ Library ------- +- Issue #16692: The ssl module now supports TLS 1.1 and TLS 1.2. Initial + patch by Michele Orr?. + - Issue #17025: multiprocessing: Reduce Queue and SimpleQueue contention. - Issue #17536: Add to webbrowser's browser list: www-browser, x-www-browser, @@ -1005,6 +1008,8 @@ - ctypes.call_commethod was removed, since its only usage was in the defunct samples directory. +- Issue #16692: Added TLSv1.1 and TLSv1.2 support for the ssl modules. + Extension Modules ----------------- diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -40,6 +40,61 @@ #endif +/* Include symbols from _socket module */ +#include "socketmodule.h" + +static PySocketModule_APIObject PySocketModule; + +#if defined(HAVE_POLL_H) +#include +#elif defined(HAVE_SYS_POLL_H) +#include +#endif + +/* Include OpenSSL header files */ +#include "openssl/rsa.h" +#include "openssl/crypto.h" +#include "openssl/x509.h" +#include "openssl/x509v3.h" +#include "openssl/pem.h" +#include "openssl/ssl.h" +#include "openssl/err.h" +#include "openssl/rand.h" + +/* SSL error object */ +static PyObject *PySSLErrorObject; +static PyObject *PySSLZeroReturnErrorObject; +static PyObject *PySSLWantReadErrorObject; +static PyObject *PySSLWantWriteErrorObject; +static PyObject *PySSLSyscallErrorObject; +static PyObject *PySSLEOFErrorObject; + +/* Error mappings */ +static PyObject *err_codes_to_names; +static PyObject *err_names_to_codes; +static PyObject *lib_codes_to_names; + +struct py_ssl_error_code { + const char *mnemonic; + int library, reason; +}; +struct py_ssl_library_code { + const char *library; + int code; +}; + +/* Include generated data (error codes) */ +#include "_ssl_data.h" + +/* Openssl comes with TLSv1.1 and TLSv1.2 between 1.0.0h and 1.0.1 + http://www.openssl.org/news/changelog.html + */ +#if OPENSSL_VERSION_NUMBER >= 0x10001000L +# define HAVE_TLSv1_2 1 +#else +# define HAVE_TLSv1_2 0 +#endif + enum py_ssl_error { /* these mirror ssl.h */ PY_SSL_ERROR_NONE, @@ -73,56 +128,15 @@ #endif PY_SSL_VERSION_SSL3=1, PY_SSL_VERSION_SSL23, +#if HAVE_TLSv1_2 + PY_SSL_VERSION_TLS1, + PY_SSL_VERSION_TLS1_1, + PY_SSL_VERSION_TLS1_2 +#else PY_SSL_VERSION_TLS1 +#endif }; -struct py_ssl_error_code { - const char *mnemonic; - int library, reason; -}; - -struct py_ssl_library_code { - const char *library; - int code; -}; - -/* Include symbols from _socket module */ -#include "socketmodule.h" - -static PySocketModule_APIObject PySocketModule; - -#if defined(HAVE_POLL_H) -#include -#elif defined(HAVE_SYS_POLL_H) -#include -#endif - -/* Include OpenSSL header files */ -#include "openssl/rsa.h" -#include "openssl/crypto.h" -#include "openssl/x509.h" -#include "openssl/x509v3.h" -#include "openssl/pem.h" -#include "openssl/ssl.h" -#include "openssl/err.h" -#include "openssl/rand.h" - -/* Include generated data (error codes) */ -#include "_ssl_data.h" - -/* SSL error object */ -static PyObject *PySSLErrorObject; -static PyObject *PySSLZeroReturnErrorObject; -static PyObject *PySSLWantReadErrorObject; -static PyObject *PySSLWantWriteErrorObject; -static PyObject *PySSLSyscallErrorObject; -static PyObject *PySSLEOFErrorObject; - -/* Error mappings */ -static PyObject *err_codes_to_names; -static PyObject *err_names_to_codes; -static PyObject *lib_codes_to_names; - #ifdef WITH_THREAD /* serves as a flag to see whether we've initialized the SSL thread support. */ @@ -1732,6 +1746,12 @@ PySSL_BEGIN_ALLOW_THREADS if (proto_version == PY_SSL_VERSION_TLS1) ctx = SSL_CTX_new(TLSv1_method()); +#if HAVE_TLSv1_2 + else if (proto_version == PY_SSL_VERSION_TLS1_1) + ctx = SSL_CTX_new(TLSv1_1_method()); + else if (proto_version == PY_SSL_VERSION_TLS1_2) + ctx = SSL_CTX_new(TLSv1_2_method()); +#endif else if (proto_version == PY_SSL_VERSION_SSL3) ctx = SSL_CTX_new(SSLv3_method()); #ifndef OPENSSL_NO_SSL2 @@ -3004,6 +3024,12 @@ PY_SSL_VERSION_SSL23); PyModule_AddIntConstant(m, "PROTOCOL_TLSv1", PY_SSL_VERSION_TLS1); +#if HAVE_TLSv1_2 + PyModule_AddIntConstant(m, "PROTOCOL_TLSv1_1", + PY_SSL_VERSION_TLS1_1); + PyModule_AddIntConstant(m, "PROTOCOL_TLSv1_2", + PY_SSL_VERSION_TLS1_2); +#endif /* protocol options */ PyModule_AddIntConstant(m, "OP_ALL", @@ -3011,6 +3037,10 @@ PyModule_AddIntConstant(m, "OP_NO_SSLv2", SSL_OP_NO_SSLv2); PyModule_AddIntConstant(m, "OP_NO_SSLv3", SSL_OP_NO_SSLv3); PyModule_AddIntConstant(m, "OP_NO_TLSv1", SSL_OP_NO_TLSv1); +#if HAVE_TLSv1_2 + PyModule_AddIntConstant(m, "OP_NO_TLSv1_1", SSL_OP_NO_TLSv1_1); + PyModule_AddIntConstant(m, "OP_NO_TLSv1_2", SSL_OP_NO_TLSv1_2); +#endif PyModule_AddIntConstant(m, "OP_CIPHER_SERVER_PREFERENCE", SSL_OP_CIPHER_SERVER_PREFERENCE); PyModule_AddIntConstant(m, "OP_SINGLE_DH_USE", SSL_OP_SINGLE_DH_USE); diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -786,10 +786,10 @@ for line in incfile: m = openssl_ver_re.match(line) if m: - openssl_ver = eval(m.group(1)) + openssl_ver = int(m.group(1), 16) + break except IOError as msg: print("IOError while reading opensshv.h:", msg) - pass #print('openssl_ver = 0x%08x' % openssl_ver) min_openssl_ver = 0x00907000 -- Repository URL: http://hg.python.org/cpython From ezio.melotti at gmail.com Thu Mar 28 23:56:46 2013 From: ezio.melotti at gmail.com (Ezio Melotti) Date: Fri, 29 Mar 2013 00:56:46 +0200 Subject: [Python-checkins] cpython (2.7): Issue 17538: Document XML vulnerabilties In-Reply-To: <3ZZz1v2N95zQBT@mail.python.org> References: <3ZZz1v2N95zQBT@mail.python.org> Message-ID: Hi, On Tue, Mar 26, 2013 at 6:53 PM, christian.heimes wrote: > http://hg.python.org/cpython/rev/e87364449954 > changeset: 82973:e87364449954 > branch: 2.7 > parent: 82963:d321885ff8f3 > user: Christian Heimes > date: Tue Mar 26 17:53:05 2013 +0100 > summary: > Issue 17538: Document XML vulnerabilties > > [...] > > diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst > new file mode 100644 > --- /dev/null > +++ b/Doc/library/xml.rst > @@ -0,0 +1,131 @@ > +.. _xml: > + > +XML Processing Modules > +====================== > + > +.. module:: xml > + :synopsis: Package containing XML processing modules > +.. sectionauthor:: Christian Heimes > +.. sectionauthor:: Georg Brandl > + > + > +Python's interfaces for processing XML are grouped in the ``xml`` package. > + > +.. warning:: > + > + The XML modules are not secure against erroneous or maliciously > + constructed data. If you need to parse untrusted or unauthenticated data see > + :ref:`xml-vulnerabilities`. > + > +It is important to note that modules in the :mod:`xml` package require that > +there be at least one SAX-compliant XML parser available. The Expat parser is > +included with Python, so the :mod:`xml.parsers.expat` module will always be > +available. > + > +The documentation for the :mod:`xml.dom` and :mod:`xml.sax` packages are the > +definition of the Python bindings for the DOM and SAX interfaces. > + > +The XML handling submodules are: > + > +* :mod:`xml.etree.ElementTree`: the ElementTree API, a simple and lightweight Something is missing here ^ > + > +.. > + > +* :mod:`xml.dom`: the DOM API definition > +* :mod:`xml.dom.minidom`: a lightweight DOM implementation > +* :mod:`xml.dom.pulldom`: support for building partial DOM trees > + > +.. > + > +* :mod:`xml.sax`: SAX2 base classes and convenience functions > +* :mod:`xml.parsers.expat`: the Expat parser binding > + > + > +.. _xml-vulnerabilities: > + > [...] > + > +defused packages > +---------------- > + > +`defusedxml`_ is a pure Python package with modified subclasses of all stdlib > +XML parsers that prevent any potentially malicious operation. The courses of > +action are recommended for any server code that parses untrusted XML data. This last sentence doesn't make much sense to me. Is it even correct? > The > +package also ships with example exploits and an extended documentation on more > +XML exploits like xpath injection. > + > +`defusedexpat`_ provides a modified libexpat and patched replacment s/replacment/replacement/ > +:mod:`pyexpat` extension module with countermeasures against entity expansion > +DoS attacks. Defusedexpat still allows a sane and configurable amount of entity > +expansions. The modifications will be merged into future releases of Python. > + > +The workarounds and modifications are not included in patch releases as they > +break backward compatibility. After all inline DTD and entity expansion are > +well-definied XML features. s/definied/defined/ > + > + > +.. _defusedxml: > +.. _defusedexpat: > +.. _Billion Laughs: http://en.wikipedia.org/wiki/Billion_laughs > +.. _ZIP bomb: http://en.wikipedia.org/wiki/Zip_bomb > +.. _DTD: http://en.wikipedia.org/wiki/Document_Type_Definition > [...] Best Regards, Ezio Melotti From python-checkins at python.org Fri Mar 29 02:44:02 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 29 Mar 2013 02:44:02 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzg5MDY6IGRvY3Vt?= =?utf-8?q?ent_failureException=2C_longMessage=2C_and_maxDiff_in_the_class?= Message-ID: <3ZcQhy6hZCzR7F@mail.python.org> http://hg.python.org/cpython/rev/0753a663d27c changeset: 82993:0753a663d27c branch: 2.7 parent: 82991:7223b17ebecb user: Ezio Melotti date: Fri Mar 29 03:42:29 2013 +0200 summary: #8906: document failureException, longMessage, and maxDiff in the class docstring. Patch by Boris Feld. files: Lib/unittest/case.py | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -150,24 +150,23 @@ should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run. + + When subclassing TestCase, you can set these attributes: + * failureException: determines which exception will be raised when + the instance's assertion methods fail; test methods raising this + exception will be deemed to have 'failed' rather than 'errored'. + * longMessage: determines whether long messages (including repr of + objects used in assert methods) will be printed on failure in *addition* + to any explicit message passed. + * maxDiff: sets the maximum length of a diff in failure messages + by assert methods using difflib. It is looked up as an instance + attribute so can be configured by individual tests if required. """ - # This attribute determines which exception will be raised when - # the instance's assertion methods fail; test methods raising this - # exception will be deemed to have 'failed' rather than 'errored' - failureException = AssertionError - # This attribute determines whether long messages (including repr of - # objects used in assert methods) will be printed on failure in *addition* - # to any explicit message passed. - longMessage = False - # This attribute sets the maximum length of a diff in failure messages - # by assert methods using difflib. It is looked up as an instance attribute - # so can be configured by individual tests if required. - maxDiff = 80*8 # If a string is longer than _diffThreshold, use normal comparison instead -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 29 02:44:04 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 29 Mar 2013 02:44:04 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzg5MDY6IGRvY3Vt?= =?utf-8?q?ent_failureException=2C_longMessage=2C_and_maxDiff_in_the_class?= Message-ID: <3ZcQj02jZVzR9j@mail.python.org> http://hg.python.org/cpython/rev/b1c511418b29 changeset: 82994:b1c511418b29 branch: 3.3 parent: 82989:94e4c6f02caa user: Ezio Melotti date: Fri Mar 29 03:42:29 2013 +0200 summary: #8906: document failureException, longMessage, and maxDiff in the class docstring. Patch by Boris Feld. files: Lib/unittest/case.py | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -237,24 +237,23 @@ should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run. + + When subclassing TestCase, you can set these attributes: + * failureException: determines which exception will be raised when + the instance's assertion methods fail; test methods raising this + exception will be deemed to have 'failed' rather than 'errored'. + * longMessage: determines whether long messages (including repr of + objects used in assert methods) will be printed on failure in *addition* + to any explicit message passed. + * maxDiff: sets the maximum length of a diff in failure messages + by assert methods using difflib. It is looked up as an instance + attribute so can be configured by individual tests if required. """ - # This attribute determines which exception will be raised when - # the instance's assertion methods fail; test methods raising this - # exception will be deemed to have 'failed' rather than 'errored' - failureException = AssertionError - # This attribute determines whether long messages (including repr of - # objects used in assert methods) will be printed on failure in *addition* - # to any explicit message passed. - longMessage = True - # This attribute sets the maximum length of a diff in failure messages - # by assert methods using difflib. It is looked up as an instance attribute - # so can be configured by individual tests if required. - maxDiff = 80*8 # If a string is longer than _diffThreshold, use normal comparison instead -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 29 02:44:05 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 29 Mar 2013 02:44:05 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzg5MDY6IG1lcmdlIHdpdGggMy4zLg==?= Message-ID: <3ZcQj15Pf4zRB7@mail.python.org> http://hg.python.org/cpython/rev/49cf8f656e9e changeset: 82995:49cf8f656e9e parent: 82992:02a89bd646ca parent: 82994:b1c511418b29 user: Ezio Melotti date: Fri Mar 29 03:43:38 2013 +0200 summary: #8906: merge with 3.3. files: Lib/unittest/case.py | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -252,24 +252,23 @@ should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run. + + When subclassing TestCase, you can set these attributes: + * failureException: determines which exception will be raised when + the instance's assertion methods fail; test methods raising this + exception will be deemed to have 'failed' rather than 'errored'. + * longMessage: determines whether long messages (including repr of + objects used in assert methods) will be printed on failure in *addition* + to any explicit message passed. + * maxDiff: sets the maximum length of a diff in failure messages + by assert methods using difflib. It is looked up as an instance + attribute so can be configured by individual tests if required. """ - # This attribute determines which exception will be raised when - # the instance's assertion methods fail; test methods raising this - # exception will be deemed to have 'failed' rather than 'errored' - failureException = AssertionError - # This attribute determines whether long messages (including repr of - # objects used in assert methods) will be printed on failure in *addition* - # to any explicit message passed. - longMessage = True - # This attribute sets the maximum length of a diff in failure messages - # by assert methods using difflib. It is looked up as an instance attribute - # so can be configured by individual tests if required. - maxDiff = 80*8 # If a string is longer than _diffThreshold, use normal comparison instead -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 29 03:02:30 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 29 Mar 2013 03:02:30 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzE3NDM4OiBhZGQg?= =?utf-8?q?links_to_the_conversion_tables_in_dump=28s=29/load=28s=29=2E?= Message-ID: <3ZcR6G5XpqzQT2@mail.python.org> http://hg.python.org/cpython/rev/80d7545594ca changeset: 82996:80d7545594ca branch: 2.7 parent: 82993:0753a663d27c user: Ezio Melotti date: Fri Mar 29 03:59:29 2013 +0200 summary: #17438: add links to the conversion tables in dump(s)/load(s). files: Doc/library/json.rst | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -125,7 +125,8 @@ default=None, sort_keys=False, **kw) Serialize *obj* as a JSON formatted stream to *fp* (a ``.write()``-supporting - :term:`file-like object`). + :term:`file-like object`) using this :ref:`conversion table + `. If *skipkeys* is ``True`` (default: ``False``), then dict keys that are not of a basic type (:class:`str`, :class:`unicode`, :class:`int`, :class:`long`, @@ -188,9 +189,10 @@ indent=None, separators=None, encoding="utf-8", \ default=None, sort_keys=False, **kw) - Serialize *obj* to a JSON formatted :class:`str`. If *ensure_ascii* is - ``False``, the result may contain non-ASCII characters and the return value - may be a :class:`unicode` instance. + Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion + table `. If *ensure_ascii* is ``False``, the result may + contain non-ASCII characters and the return value may be a :class:`unicode` + instance. The arguments have the same meaning as in :func:`dump`. @@ -206,7 +208,8 @@ .. function:: load(fp[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, **kw]]]]]]]]) Deserialize *fp* (a ``.read()``-supporting :term:`file-like object` - containing a JSON document) to a Python object. + containing a JSON document) to a Python object using this :ref:`conversion + table `. If the contents of *fp* are encoded with an ASCII based encoding other than UTF-8 (e.g. latin-1), then an appropriate *encoding* name must be specified. @@ -257,7 +260,8 @@ .. function:: loads(s[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, **kw]]]]]]]]) Deserialize *s* (a :class:`str` or :class:`unicode` instance containing a JSON - document) to a Python object. + document) to a Python object using this :ref:`conversion table + `. If *s* is a :class:`str` instance and is encoded with an ASCII based encoding other than UTF-8 (e.g. latin-1), then an appropriate *encoding* name must be @@ -276,6 +280,8 @@ Performs the following translations in decoding by default: + .. _json-to-py-table: + +---------------+-------------------+ | JSON | Python | +===============+===================+ @@ -364,6 +370,8 @@ Supports the following objects and types by default: + .. _py-to-json-table: + +-------------------+---------------+ | Python | JSON | +===================+===============+ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 29 03:02:32 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 29 Mar 2013 03:02:32 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzE3NDM4OiBhZGQg?= =?utf-8?q?links_to_the_conversion_tables_in_dump=28s=29/load=28s=29=2E?= Message-ID: <3ZcR6J15mSzRFf@mail.python.org> http://hg.python.org/cpython/rev/e76952bd4fa5 changeset: 82997:e76952bd4fa5 branch: 3.3 parent: 82994:b1c511418b29 user: Ezio Melotti date: Fri Mar 29 03:59:29 2013 +0200 summary: #17438: add links to the conversion tables in dump(s)/load(s). files: Doc/library/json.rst | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -124,7 +124,8 @@ sort_keys=False, **kw) Serialize *obj* as a JSON formatted stream to *fp* (a ``.write()``-supporting - :term:`file-like object`). + :term:`file-like object`) using this :ref:`conversion table + `. If *skipkeys* is ``True`` (default: ``False``), then dict keys that are not of a basic type (:class:`str`, :class:`int`, :class:`float`, :class:`bool`, @@ -183,8 +184,9 @@ indent=None, separators=None, default=None, \ sort_keys=False, **kw) - Serialize *obj* to a JSON formatted :class:`str`. The arguments have the - same meaning as in :func:`dump`. + Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion + table `. The arguments have the same meaning as in + :func:`dump`. .. note:: @@ -204,7 +206,8 @@ .. function:: load(fp, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) Deserialize *fp* (a ``.read()``-supporting :term:`file-like object` - containing a JSON document) to a Python object. + containing a JSON document) to a Python object using this :ref:`conversion + table `. *object_hook* is an optional function that will be called with the result of any object literal decoded (a :class:`dict`). The return value of @@ -249,7 +252,7 @@ .. function:: loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) Deserialize *s* (a :class:`str` instance containing a JSON document) to a - Python object. + Python object using this :ref:`conversion table `. The other arguments have the same meaning as in :func:`load`, except *encoding* which is ignored and deprecated. @@ -264,6 +267,8 @@ Performs the following translations in decoding by default: + .. _json-to-py-table: + +---------------+-------------------+ | JSON | Python | +===============+===================+ @@ -345,6 +350,8 @@ Supports the following objects and types by default: + .. _py-to-json-table: + +-------------------+---------------+ | Python | JSON | +===================+===============+ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 29 03:02:33 2013 From: python-checkins at python.org (ezio.melotti) Date: Fri, 29 Mar 2013 03:02:33 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3NDM4OiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZcR6K3hpRzR8c@mail.python.org> http://hg.python.org/cpython/rev/5dcd7ee0716a changeset: 82998:5dcd7ee0716a parent: 82995:49cf8f656e9e parent: 82997:e76952bd4fa5 user: Ezio Melotti date: Fri Mar 29 04:02:14 2013 +0200 summary: #17438: merge with 3.3. files: Doc/library/json.rst | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -123,7 +123,8 @@ sort_keys=False, **kw) Serialize *obj* as a JSON formatted stream to *fp* (a ``.write()``-supporting - :term:`file-like object`). + :term:`file-like object`) using this :ref:`conversion table + `. If *skipkeys* is ``True`` (default: ``False``), then dict keys that are not of a basic type (:class:`str`, :class:`int`, :class:`float`, :class:`bool`, @@ -180,8 +181,9 @@ indent=None, separators=None, default=None, \ sort_keys=False, **kw) - Serialize *obj* to a JSON formatted :class:`str`. The arguments have the - same meaning as in :func:`dump`. + Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion + table `. The arguments have the same meaning as in + :func:`dump`. .. note:: @@ -201,7 +203,8 @@ .. function:: load(fp, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) Deserialize *fp* (a ``.read()``-supporting :term:`file-like object` - containing a JSON document) to a Python object. + containing a JSON document) to a Python object using this :ref:`conversion + table `. *object_hook* is an optional function that will be called with the result of any object literal decoded (a :class:`dict`). The return value of @@ -246,7 +249,7 @@ .. function:: loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) Deserialize *s* (a :class:`str` instance containing a JSON document) to a - Python object. + Python object using this :ref:`conversion table `. The other arguments have the same meaning as in :func:`load`, except *encoding* which is ignored and deprecated. @@ -261,6 +264,8 @@ Performs the following translations in decoding by default: + .. _json-to-py-table: + +---------------+-------------------+ | JSON | Python | +===============+===================+ @@ -342,6 +347,8 @@ Supports the following objects and types by default: + .. _py-to-json-table: + +-------------------+---------------+ | Python | JSON | +===================+===============+ -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Fri Mar 29 05:53:35 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 29 Mar 2013 05:53:35 +0100 Subject: [Python-checkins] Daily reference leaks (5dcd7ee0716a): sum=1 Message-ID: results for 5dcd7ee0716a on branch "default" -------------------------------------------- test_unittest leaked [-1, 2, 0] memory blocks, sum=1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog9s_WDH', '-x'] From python-checkins at python.org Fri Mar 29 06:29:01 2013 From: python-checkins at python.org (roger.serwy) Date: Fri, 29 Mar 2013 06:29:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?devguide=3A_Add_self_for_idlelib=2E?= Message-ID: <3ZcWhY1LbpzQ8r@mail.python.org> http://hg.python.org/devguide/rev/c6d2db3eb253 changeset: 614:c6d2db3eb253 user: Roger Serwy date: Fri Mar 29 00:29:31 2013 -0500 summary: Add self for idlelib. files: experts.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/experts.rst b/experts.rst --- a/experts.rst +++ b/experts.rst @@ -123,7 +123,7 @@ hmac html ezio.melotti http -idlelib kbk, terry.reedy +idlelib kbk, terry.reedy, roger.serwy imaplib imghdr imp -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Fri Mar 29 09:10:52 2013 From: python-checkins at python.org (georg.brandl) Date: Fri, 29 Mar 2013 09:10:52 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_PEP_434_update_from_Todd=2E?= Message-ID: <3ZcbHJ6yJnzP98@mail.python.org> http://hg.python.org/peps/rev/8daeacd2fb57 changeset: 4826:8daeacd2fb57 user: Georg Brandl date: Fri Mar 29 09:10:34 2013 +0100 summary: PEP 434 update from Todd. files: pep-0434.txt | 152 +++++++++++++++++++++----------------- 1 files changed, 85 insertions(+), 67 deletions(-) diff --git a/pep-0434.txt b/pep-0434.txt --- a/pep-0434.txt +++ b/pep-0434.txt @@ -11,23 +11,24 @@ Created: 16-Feb-2013 Post-History: 16-Feb-2013 03-Mar-2013 + 21-Mar-2013 Abstract ======== -Most CPython tracker issues are classified as behavior or -enhancement. Most behavior patches are backported to branches for -existing versions. Enhancement patches are restricted to the default -branch that becomes the next Python version. +Most CPython tracker issues are classified as behavior or enhancement. +Most behavior patches are backported to branches for existing +versions. Enhancement patches are restricted to the default branch +that becomes the next Python version. This PEP proposes that the restriction on applying enhancements be relaxed for IDLE code, residing in .../Lib/idlelib/. In practice, this would mean that IDLE developers would not have to classify or -agree on the classification of a patch but could instead focus on -what is best for IDLE users and future IDLE developement. It would -also mean that IDLE patches would not necessarily have to be split -into 'bugfix' changes and enhancement changes. +agree on the classification of a patch but could instead focus on what +is best for IDLE users and future IDLE development. It would also +mean that IDLE patches would not necessarily have to be split into +'bugfix' changes and enhancement changes. The PEP would apply to changes in existing features and addition of small features, such as would require a new menu entry, but not @@ -40,102 +41,115 @@ This PEP was prompted by controversy on both the tracker and pydev list over adding Cut, Copy, and Paste to right-click context menus -(Issue 1207589, opened in 2005 [1]_; pydev thread [2]_). The -features were available as keyboard shortcuts but not on the context -menu. It is standard, at least on Windows, that they should be when -applicable (a read-only window would only have Copy), so users do not -have to shift to the keyboard after selecting text for cutting or -copying or a slice point for pasting. The context menu was not -documented until 10 days before the new options were added (Issue -10405 [3]_). +(Issue 1207589, opened in 2005 [1]_; pydev thread [2]_). The features +were available as keyboard shortcuts but not on the context menu. It +is standard, at least on Windows, that they should be when applicable +(a read-only window would only have Copy), so users do not have to +shift to the keyboard after selecting text for cutting or copying or a +slice point for pasting. The context menu was not documented until 10 +days before the new options were added (Issue 10405 [5]_). Normally, behavior is called a bug if it conflicts with documentation -judged to be correct. But if there is no doc, what is the standard? +judged to be correct. But if there is no doc, what is the standard? If the code is its own documentation, most IDLE issues on the tracker are enhancement issues. If we substitute reasonable user expectation, (which can, of course, be its own subject of disagreement), many more issues are behavior issues. For context menus, people disagreed on the status of the additions -- -bugfix or enhancement. Even people who called it an enhancement +bugfix or enhancement. Even people who called it an enhancement disagreed as to whether the patch should be backported. This PEP proposes to make the status disagreement irrelevant by explicitly allowing more liberal backporting than for other stdlib modules. +Python does have many advanced features yet Python is well known for +being a easy computer language for beginners [3]_. A major Python +philosophy is "batteries included" which is best demonstrated in +Python's standard library with many modules that are not typically +included with other programming languages [4]_. IDLE is a important +"battery" in the Python toolbox because it allows a beginner to get +started quickly without downloading and configuring a third party IDE. +IDLE represents a commitment by the Python community to encouage the +use of Python as a teaching language both inside and outside of formal +educational settings. The recommended teaching experience is to have +a learner start with IDLE. This PEP and the work that it will enable +will allow the Python community to make that learner's experience with +IDLE awesome by making IDLE a simple tool for beginners to get started +with Python. Rationale ========= -People primarily use IDLE by running the gui application, rather than -by directly importing the effectively private (undocumented) -implementation modules in idlelib. Whether they use the shell, the -editor, or both, we believe they will benefit more from consistency -across the latest releases of current Python versions than from -consistency within the bugfix releases for one Python version. This -is especially true when existing behavior is clearly unsatisfactory. +People primarily use IDLE by running the graphical user interface +(GUI) application, rather than by directly importing the effectively +private (undocumented) implementation modules in idlelib. Whether +they use the shell, the editor, or both, we believe they will benefit +more from consistency across the latest releases of current Python +versions than from consistency within the bugfix releases for one +Python version. This is especially true when existing behavior is +clearly unsatisfactory. When people use the standard interpreter, the OS-provided frame works -pretty much the same for all Python versions. If, for instance, -Microsoft were to upgrade the Command Prompt gui, the improvements -would be present regardless of which Python were running within it. -Similarly, if one edits Python code with editor X, behaviors such as -the right-click context menu and the search-replace box do not depend -on the version of Python being edited or even the language being -edited. +the same for all Python versions. If, for instance, Microsoft were to +upgrade the Command Prompt GUI, the improvements would be present +regardless of which Python were running within it. Similarly, if one +edits Python code with editor X, behaviors such as the right-click +context menu and the search-replace box do not depend on the version +of Python being edited or even the language being edited. -The benefit for IDLE developers is mixed. On the one hand, testing +The benefit for IDLE developers is mixed. On the one hand, testing more versions and possibly having to adjust a patch, especially for -2.7, is more work. (There is, of course, the option on not -backporting everything. For issue 12510, some changes to calltips for +2.7, is more work. (There is, of course, the option on not +backporting everything. For issue 12510, some changes to calltips for classes were not included in the 2.7 patch because of issues with -old-style classes [4]_.) On the other hand, bike-shedding can be an -energy drain. If the obvious fix for a bug looks like an enhancement, -writing a separate bugfix-only patch is more work. And making the +old-style classes [6]_.) On the other hand, bike-shedding can be an +energy drain. If the obvious fix for a bug looks like an enhancement, +writing a separate bugfix-only patch is more work. And making the code diverge between versions makes future multi-version patches more difficult. -These issue are illustrated by the search-and-replace dialog box. -It used to raise an exception for certain user entries [5]_. The -uncaught exception caused IDLE to exit. At least on Windows, the -exit was silent (no visible traceback) and looked like a crash if -IDLE was started normally, from an icon. +These issue are illustrated by the search-and-replace dialog box. It +used to raise an exception for certain user entries [7]_. The +uncaught exception caused IDLE to exit. At least on Windows, the exit +was silent (no visible traceback) and looked like a crash if IDLE was +started normally, from an icon. Was this a bug? IDLE Help (on the current Help submenu) just says -"Replace... Open a search-and-replace dialog box", and a box *was* -opened. It is not, in general, a bug for a library method to raise an +"Replace... Open a search-and-replace dialog box", and a box *was* +opened. It is not, in general, a bug for a library method to raise an exception. And it is not, in general, a bug for a library method to -ignore an exception raised by functions it calls. So if we were to -adopt the 'code = doc' philosopy in the absence of detailed docs, one +ignore an exception raised by functions it calls. So if we were to +adopt the 'code = doc' philosophy in the absence of detailed docs, one might say 'No'. However, IDLE exiting when it does not need to is definitely -obnoxious. So four of us agreed that it should be prevented. But +obnoxious. So four of us agreed that it should be prevented. But there was still the question of what to do instead? Catch the exception? Just not raise the exception? Beep? Display an error message box? Or try to do something useful with the user's entry? Would replacing a 'crash' with useful behavior be an enhancement, -limited to future Python releases? Should IDLE developers have to -ask that? +limited to future Python releases? Should IDLE developers have to ask +that? Backwards Compatibility ======================= For IDLE, there are three types of users who might be concerned about -back compatibility. First are people who run IDLE as an application. +back compatibility. First are people who run IDLE as an application. We have already discussed them above. -Second are people who import one of the idlelib modules. As far as -we know, this is only done to start the IDLE application, and we do -not propose breaking such use. Otherwise, the modules are -undocumented and effectively private implementations. If an IDLE -module were defined as public, documented, and perhaps moved to the -tkinter package, it would then follow the normal rules. (Documenting -the private interfaces for the benefit of people working on the IDLE -code is a separate issue.) +Second are people who import one of the idlelib modules. As far as we +know, this is only done to start the IDLE application, and we do not +propose breaking such use. Otherwise, the modules are undocumented +and effectively private implementations. If an IDLE module were +defined as public, documented, and perhaps moved to the tkinter +package, it would then follow the normal rules. (Documenting the +private interfaces for the benefit of people working on the IDLE code +is a separate issue.) -Third are people who write IDLE extensions. The guaranteed extension -interface is given in idlelib/extension.txt. This should be respected +Third are people who write IDLE extensions. The guaranteed extension +interface is given in idlelib/extension.txt. This should be respected at least in existing versions, and not frivolously changed in future versions. But there is a warning that "The extension cannot assume much about this [EditorWindow] argument." This guarantee should @@ -150,7 +164,6 @@ fixes assumption b). It should be applied when it is clear that the first patch will not have to be reverted. - References ========== @@ -160,14 +173,19 @@ .. [2] Cut/Copy/Paste items in IDLE right click context menu (http://mail.python.org/pipermail/python-dev/2012-November/122514.html) -.. [3] IDLE breakpoint facility undocumented, Daily, Ned +.. [3] Getting Started with Python + (http://www.python.org/about/gettingstarted/) + +.. [4] Batteries Included + (http://docs.python.org/2/tutorial/stdlib.html#batteries-included) + +.. [5] IDLE breakpoint facility undocumented, Deily, Ned (http://bugs.python.org/issue10405) -.. [4] IDLE: calltips mishandle raw strings and other examples, - Reedy, Terry - (http://bugs.python.org/issue12510) +.. [6] IDLE: calltips mishandle raw strings and other examples, + Reedy, Terry (http://bugs.python.org/issue12510) -.. [5] IDLE: replace ending with '\' causes crash, Reedy, Terry +.. [7] IDLE: replace ending with '\' causes crash, Reedy, Terry (http://bugs.python.org/issue13052) -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Mar 29 18:00:34 2013 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 29 Mar 2013 18:00:34 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_bug_in_TestResult=2Ead?= =?utf-8?q?dSubTest=28=29?= Message-ID: <3Zcq2V2RGQzMp1@mail.python.org> http://hg.python.org/cpython/rev/34607ccde6f8 changeset: 82999:34607ccde6f8 user: Antoine Pitrou date: Fri Mar 29 17:55:24 2013 +0100 summary: Fix bug in TestResult.addSubTest() files: Lib/unittest/result.py | 2 +- Lib/unittest/test/test_result.py | 34 ++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletions(-) diff --git a/Lib/unittest/result.py b/Lib/unittest/result.py --- a/Lib/unittest/result.py +++ b/Lib/unittest/result.py @@ -134,7 +134,7 @@ errors = self.failures else: errors = self.errors - errors.append((test, self._exc_info_to_string(err, test))) + errors.append((subtest, self._exc_info_to_string(err, test))) self._mirrorOutput = True def addSuccess(self, test): diff --git a/Lib/unittest/test/test_result.py b/Lib/unittest/test/test_result.py --- a/Lib/unittest/test/test_result.py +++ b/Lib/unittest/test/test_result.py @@ -227,6 +227,40 @@ self.assertTrue(test_case is test) self.assertIsInstance(formatted_exc, str) + def test_addSubTest(self): + class Foo(unittest.TestCase): + def test_1(self): + nonlocal subtest + with self.subTest(foo=1): + subtest = self._subtest + try: + 1/0 + except ZeroDivisionError: + exc_info_tuple = sys.exc_info() + # Register an error by hand (to check the API) + result.addSubTest(test, subtest, exc_info_tuple) + # Now trigger a failure + self.fail("some recognizable failure") + + subtest = None + test = Foo('test_1') + result = unittest.TestResult() + + test.run(result) + + self.assertFalse(result.wasSuccessful()) + self.assertEqual(len(result.errors), 1) + self.assertEqual(len(result.failures), 1) + self.assertEqual(result.testsRun, 1) + self.assertEqual(result.shouldStop, False) + + test_case, formatted_exc = result.errors[0] + self.assertIs(test_case, subtest) + self.assertIn("ZeroDivisionError", formatted_exc) + test_case, formatted_exc = result.failures[0] + self.assertIs(test_case, subtest) + self.assertIn("some recognizable failure", formatted_exc) + def testGetDescriptionWithoutDocstring(self): result = unittest.TextTestResult(None, True, 1) self.assertEqual( -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 29 18:00:35 2013 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 29 Mar 2013 18:00:35 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_a_subtest_in_test=5Fss?= =?utf-8?q?l=2Etest=5Fecho?= Message-ID: <3Zcq2W56mDzP4H@mail.python.org> http://hg.python.org/cpython/rev/fbc514304b97 changeset: 83000:fbc514304b97 user: Antoine Pitrou date: Fri Mar 29 17:56:03 2013 +0100 summary: Use a subtest in test_ssl.test_echo files: Lib/test/test_ssl.py | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1385,10 +1385,11 @@ if support.verbose: sys.stdout.write("\n") for protocol in PROTOCOLS: - context = ssl.SSLContext(protocol) - context.load_cert_chain(CERTFILE) - server_params_test(context, context, - chatty=True, connectionchatty=True) + with self.subTest(protocol=ssl._PROTOCOL_NAMES[protocol]): + context = ssl.SSLContext(protocol) + context.load_cert_chain(CERTFILE) + server_params_test(context, context, + chatty=True, connectionchatty=True) def test_getpeercert(self): if support.verbose: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 29 18:13:36 2013 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 29 Mar 2013 18:13:36 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_In_search_of_TLS_1=2E1_bug?= =?utf-8?q?=3A_add_debugging_output_in_verbose_mode?= Message-ID: <3ZcqKX6TK1zNwm@mail.python.org> http://hg.python.org/cpython/rev/e8a6c656b129 changeset: 83001:e8a6c656b129 user: Antoine Pitrou date: Fri Mar 29 18:09:06 2013 +0100 summary: In search of TLS 1.1 bug: add debugging output in verbose mode files: Lib/test/test_ssl.py | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -2188,6 +2188,11 @@ (ssl.OPENSSL_VERSION, ssl.OPENSSL_VERSION_INFO)) print(" under %s" % plat) print(" HAS_SNI = %r" % ssl.HAS_SNI) + print(" OP_ALL = 0x%8x" % ssl.OP_ALL) + try: + print(" OP_NO_TLSv1_1 = 0x%8x" % ssl.OP_NO_TLSv1_1) + except AttributeError: + pass for filename in [ CERTFILE, SVN_PYTHON_ORG_ROOT_CERT, BYTES_CERTFILE, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 29 18:59:40 2013 From: python-checkins at python.org (vinay.sajip) Date: Fri, 29 Mar 2013 18:59:40 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE3NTQw?= =?utf-8?q?=3A_Added_style_to_Formatter_configuration_by_dict=2E?= Message-ID: <3ZcrLh05HHzPjq@mail.python.org> http://hg.python.org/cpython/rev/d6fe31ce789d changeset: 83002:d6fe31ce789d branch: 3.3 parent: 82997:e76952bd4fa5 user: Vinay Sajip date: Fri Mar 29 17:56:54 2013 +0000 summary: Issue #17540: Added style to Formatter configuration by dict. files: Lib/logging/config.py | 6 ++++-- Lib/test/test_logging.py | 5 ++++- Misc/NEWS | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Lib/logging/config.py b/Lib/logging/config.py --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -669,7 +669,8 @@ else: fmt = config.get('format', None) dfmt = config.get('datefmt', None) - result = logging.Formatter(fmt, dfmt) + style = config.get('style', '%') + result = logging.Formatter(fmt, dfmt, style) return result def configure_filter(self, config): @@ -691,6 +692,7 @@ def configure_handler(self, config): """Configure a handler from a dictionary.""" + config_copy = dict(config) # for restoring in case of error formatter = config.pop('formatter', None) if formatter: try: @@ -714,7 +716,7 @@ try: th = self.config['handlers'][config['target']] if not isinstance(th, logging.Handler): - config['class'] = cname # restore for deferred configuration + config.update(config_copy) # restore for deferred cfg raise TypeError('target not configured yet') config['target'] = th except Exception as e: diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -2398,7 +2398,8 @@ "version": 1, "formatters": { "mySimpleFormatter": { - "format": "%(asctime)s (%(name)s) %(levelname)s: %(message)s" + "format": "%(asctime)s (%(name)s) %(levelname)s: %(message)s", + "style": "$" } }, "handlers": { @@ -2728,6 +2729,8 @@ self.apply_config(self.out_of_order) handler = logging.getLogger('mymodule').handlers[0] self.assertIsInstance(handler.target, logging.Handler) + self.assertIsInstance(handler.formatter._style, + logging.StringTemplateStyle) def test_baseconfig(self): d = { diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -200,6 +200,8 @@ Library ------- +- Issue #17540: Added style to formatter configuration by dict. + - Issue #17536: Add to webbrowser's browser list: www-browser, x-www-browser, iceweasel, iceape. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Mar 29 18:59:41 2013 From: python-checkins at python.org (vinay.sajip) Date: Fri, 29 Mar 2013 18:59:41 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Closes_=2317540=3A_Merged_fix_from_3=2E3=2E?= Message-ID: <3ZcrLj2md9zPZb@mail.python.org> http://hg.python.org/cpython/rev/e097fe3a87de changeset: 83003:e097fe3a87de parent: 83001:e8a6c656b129 parent: 83002:d6fe31ce789d user: Vinay Sajip date: Fri Mar 29 17:59:15 2013 +0000 summary: Closes #17540: Merged fix from 3.3. files: Lib/logging/config.py | 6 ++++-- Lib/test/test_logging.py | 5 ++++- Misc/NEWS | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Lib/logging/config.py b/Lib/logging/config.py --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -672,7 +672,8 @@ else: fmt = config.get('format', None) dfmt = config.get('datefmt', None) - result = logging.Formatter(fmt, dfmt) + style = config.get('style', '%') + result = logging.Formatter(fmt, dfmt, style) return result def configure_filter(self, config): @@ -694,6 +695,7 @@ def configure_handler(self, config): """Configure a handler from a dictionary.""" + config_copy = dict(config) # for restoring in case of error formatter = config.pop('formatter', None) if formatter: try: @@ -717,7 +719,7 @@ try: th = self.config['handlers'][config['target']] if not isinstance(th, logging.Handler): - config['class'] = cname # restore for deferred configuration + config.update(config_copy) # restore for deferred cfg raise TypeError('target not configured yet') config['target'] = th except Exception as e: diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -2449,7 +2449,8 @@ "version": 1, "formatters": { "mySimpleFormatter": { - "format": "%(asctime)s (%(name)s) %(levelname)s: %(message)s" + "format": "%(asctime)s (%(name)s) %(levelname)s: %(message)s", + "style": "$" } }, "handlers": { @@ -2851,6 +2852,8 @@ self.apply_config(self.out_of_order) handler = logging.getLogger('mymodule').handlers[0] self.assertIsInstance(handler.target, logging.Handler) + self.assertIsInstance(handler.formatter._style, + logging.StringTemplateStyle) def test_baseconfig(self): d = { diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -297,6 +297,8 @@ Library ------- +- Issue #17540: Added style to formatter configuration by dict. + - Issue #16692: The ssl module now supports TLS 1.1 and TLS 1.2. Initial patch by Michele Orr?. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 00:32:58 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 30 Mar 2013 00:32:58 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzE3NTY0OiBza2lw?= =?utf-8?q?_test=5Fbad=5Faddress_unless_the_tests_are_run_with_-unetwork/-?= =?utf-8?q?uall=2E?= Message-ID: <3ZczlG6xKZzPxW@mail.python.org> http://hg.python.org/cpython/rev/f668d2267303 changeset: 83004:f668d2267303 branch: 3.3 parent: 83002:d6fe31ce789d user: Ezio Melotti date: Sat Mar 30 01:28:40 2013 +0200 summary: #17564: skip test_bad_address unless the tests are run with -unetwork/-uall. files: Lib/test/test_urllib2_localnet.py | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py --- a/Lib/test/test_urllib2_localnet.py +++ b/Lib/test/test_urllib2_localnet.py @@ -524,6 +524,11 @@ def test_bad_address(self): # Make sure proper exception is raised when connecting to a bogus # address. + + # as indicated by the comment below, this might fail with some ISP, + # so we run the test only when -unetwork/-uall is specified to + # mitigate the problem a bit (see #17564) + support.requires('network') self.assertRaises(IOError, # Given that both VeriSign and various ISPs have in # the past or are presently hijacking various invalid -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 00:33:00 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 30 Mar 2013 00:33:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzE3NTY0OiBza2lw?= =?utf-8?q?_test=5Fbad=5Faddress_unless_the_tests_are_run_with_-unetwork/-?= =?utf-8?q?uall=2E?= Message-ID: <3ZczlJ2sMYzQ7h@mail.python.org> http://hg.python.org/cpython/rev/a472fece6f31 changeset: 83005:a472fece6f31 branch: 2.7 parent: 82996:80d7545594ca user: Ezio Melotti date: Sat Mar 30 01:32:45 2013 +0200 summary: #17564: skip test_bad_address unless the tests are run with -unetwork/-uall. files: Lib/test/test_urllib2_localnet.py | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py --- a/Lib/test/test_urllib2_localnet.py +++ b/Lib/test/test_urllib2_localnet.py @@ -489,6 +489,11 @@ def test_bad_address(self): # Make sure proper exception is raised when connecting to a bogus # address. + + # as indicated by the comment below, this might fail with some ISP, + # so we run the test only when -unetwork/-uall is specified to + # mitigate the problem a bit (see #17564) + test_support.requires('network') self.assertRaises(IOError, # Given that both VeriSign and various ISPs have in # the past or are presently hijacking various invalid -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 00:33:59 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 30 Mar 2013 00:33:59 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3NTY0OiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3ZczmR3Y64zPxW@mail.python.org> http://hg.python.org/cpython/rev/ae5c4a9118b8 changeset: 83006:ae5c4a9118b8 parent: 83003:e097fe3a87de parent: 83004:f668d2267303 user: Ezio Melotti date: Sat Mar 30 01:33:46 2013 +0200 summary: #17564: merge with 3.3. files: Lib/test/test_urllib2_localnet.py | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py --- a/Lib/test/test_urllib2_localnet.py +++ b/Lib/test/test_urllib2_localnet.py @@ -546,6 +546,11 @@ def test_bad_address(self): # Make sure proper exception is raised when connecting to a bogus # address. + + # as indicated by the comment below, this might fail with some ISP, + # so we run the test only when -unetwork/-uall is specified to + # mitigate the problem a bit (see #17564) + support.requires('network') self.assertRaises(OSError, # Given that both VeriSign and various ISPs have in # the past or are presently hijacking various invalid -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 02:39:30 2013 From: python-checkins at python.org (nick.coghlan) Date: Sat, 30 Mar 2013 02:39:30 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Accept_PEP_434_and_mark_it_as?= =?utf-8?q?_Active?= Message-ID: <3Zd2YG2bKvzM4Z@mail.python.org> http://hg.python.org/peps/rev/5cd15ca29719 changeset: 4827:5cd15ca29719 user: Nick Coghlan date: Sat Mar 30 11:39:20 2013 +1000 summary: Accept PEP 434 and mark it as Active files: pep-0434.txt | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/pep-0434.txt b/pep-0434.txt --- a/pep-0434.txt +++ b/pep-0434.txt @@ -5,13 +5,15 @@ Author: Todd Rovito , Terry Reedy BDFL-Delegate: Nick Coghlan -Status: Draft +Status: Active Type: Informational Content-Type: text/x-rst Created: 16-Feb-2013 Post-History: 16-Feb-2013 03-Mar-2013 21-Mar-2013 + 30-Mar-2013 +Resolution: http://mail.python.org/pipermail/python-dev/2013-March/125003.html Abstract -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sat Mar 30 04:19:38 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 30 Mar 2013 04:19:38 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzE3NTI2OiBmaXgg?= =?utf-8?q?an_IndexError_raised_while_passing_code_without_filename_to?= Message-ID: <3Zd4mp44XjzMtV@mail.python.org> http://hg.python.org/cpython/rev/bc73223e4c10 changeset: 83007:bc73223e4c10 branch: 2.7 parent: 83005:a472fece6f31 user: Ezio Melotti date: Sat Mar 30 05:10:28 2013 +0200 summary: #17526: fix an IndexError raised while passing code without filename to inspect.findsource(). Initial patch by Tyler Doyle. files: Lib/inspect.py | 2 +- Lib/test/test_inspect.py | 6 ++++++ Misc/NEWS | 3 +++ 3 files changed, 10 insertions(+), 1 deletions(-) diff --git a/Lib/inspect.py b/Lib/inspect.py --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -525,7 +525,7 @@ file = getfile(object) sourcefile = getsourcefile(object) - if not sourcefile and file[0] + file[-1] != '<>': + if not sourcefile and file[:1] + file[-1:] != '<>': raise IOError('source code not available') file = sourcefile if sourcefile else file diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -404,6 +404,12 @@ self.assertEqual(inspect.findsource(co), (lines,0)) self.assertEqual(inspect.getsource(co), lines[0]) + def test_findsource_without_filename(self): + for fname in ['', '']: + co = compile('x=1', fname, "exec") + self.assertRaises(IOError, inspect.findsource, co) + self.assertRaises(IOError, inspect.getsource, co) + class _BrokenDataDescriptor(object): """ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,9 @@ Library ------- +- Issue #17526: fix an IndexError raised while passing code without filename to + inspect.findsource(). Initial patch by Tyler Doyle. + What's New in Python 2.7.4? =========================== -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 04:19:39 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 30 Mar 2013 04:19:39 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzE3NTI2OiBmaXgg?= =?utf-8?q?an_IndexError_raised_while_passing_code_without_filename_to?= Message-ID: <3Zd4mq6qPtzNMG@mail.python.org> http://hg.python.org/cpython/rev/39e103c1577e changeset: 83008:39e103c1577e branch: 3.3 parent: 83004:f668d2267303 user: Ezio Melotti date: Sat Mar 30 05:17:24 2013 +0200 summary: #17526: fix an IndexError raised while passing code without filename to inspect.findsource(). Initial patch by Tyler Doyle. files: Lib/inspect.py | 2 +- Lib/test/test_inspect.py | 6 ++++++ Misc/NEWS | 11 +++++++++++ 3 files changed, 18 insertions(+), 1 deletions(-) diff --git a/Lib/inspect.py b/Lib/inspect.py --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -550,7 +550,7 @@ file = getfile(object) sourcefile = getsourcefile(object) - if not sourcefile and file[0] + file[-1] != '<>': + if not sourcefile and file[:1] + file[-1:] != '<>': raise IOError('source code not available') file = sourcefile if sourcefile else file diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -416,6 +416,12 @@ finally: del linecache.cache[co.co_filename] + def test_findsource_without_filename(self): + for fname in ['', '']: + co = compile('x=1', fname, "exec") + self.assertRaises(IOError, inspect.findsource, co) + self.assertRaises(IOError, inspect.getsource, co) + class TestNoEOL(GetSourceBase): def __init__(self, *args, **kwargs): self.tempdir = TESTFN + '_dir' diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -5,8 +5,19 @@ What's New in Python 3.3.2? =========================== +*Release date: XXXX-XX-XX* + *Not yet released, see sections below for changes released in 3.3.0* +Core and Builtins +----------------- + +Library +------- + +- Issue #17526: fix an IndexError raised while passing code without filename to + inspect.findsource(). Initial patch by Tyler Doyle. + What's New in Python 3.3.1? =========================== -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 04:19:41 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 30 Mar 2013 04:19:41 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3NTI2OiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3Zd4ms2fZwzQ70@mail.python.org> http://hg.python.org/cpython/rev/8362fbb0ef42 changeset: 83009:8362fbb0ef42 parent: 83006:ae5c4a9118b8 parent: 83008:39e103c1577e user: Ezio Melotti date: Sat Mar 30 05:19:06 2013 +0200 summary: #17526: merge with 3.3. files: Lib/inspect.py | 2 +- Lib/test/test_inspect.py | 6 ++++++ Misc/NEWS | 3 +++ 3 files changed, 10 insertions(+), 1 deletions(-) diff --git a/Lib/inspect.py b/Lib/inspect.py --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -550,7 +550,7 @@ file = getfile(object) sourcefile = getsourcefile(object) - if not sourcefile and file[0] + file[-1] != '<>': + if not sourcefile and file[:1] + file[-1:] != '<>': raise OSError('source code not available') file = sourcefile if sourcefile else file diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -416,6 +416,12 @@ finally: del linecache.cache[co.co_filename] + def test_findsource_without_filename(self): + for fname in ['', '']: + co = compile('x=1', fname, "exec") + self.assertRaises(IOError, inspect.findsource, co) + self.assertRaises(IOError, inspect.getsource, co) + class TestNoEOL(GetSourceBase): def __init__(self, *args, **kwargs): self.tempdir = TESTFN + '_dir' diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -297,6 +297,9 @@ Library ------- +- Issue #17526: fix an IndexError raised while passing code without filename to + inspect.findsource(). Initial patch by Tyler Doyle. + - Issue #17540: Added style to formatter configuration by dict. - Issue #16692: The ssl module now supports TLS 1.1 and TLS 1.2. Initial -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 04:56:32 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 30 Mar 2013 04:56:32 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzE3NTM5OiBmaXgg?= =?utf-8?q?MagicMock_example=2E__Patch_by_Berker_Peksag=2E?= Message-ID: <3Zd5bN4ggbzQ9f@mail.python.org> http://hg.python.org/cpython/rev/b0c0a03b8033 changeset: 83010:b0c0a03b8033 branch: 3.3 parent: 83008:39e103c1577e user: Ezio Melotti date: Sat Mar 30 05:55:52 2013 +0200 summary: #17539: fix MagicMock example. Patch by Berker Peksag. files: Doc/library/unittest.mock-examples.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/unittest.mock-examples.rst b/Doc/library/unittest.mock-examples.rst --- a/Doc/library/unittest.mock-examples.rst +++ b/Doc/library/unittest.mock-examples.rst @@ -324,11 +324,11 @@ ... >>> test() -If you are patching a module (including `__builtin__`) then use `patch` +If you are patching a module (including :mod:`builtins`) then use `patch` instead of `patch.object`: - >>> mock = MagicMock(return_value = sentinel.file_handle) - >>> with patch('__builtin__.open', mock): + >>> mock = MagicMock(return_value=sentinel.file_handle) + >>> with patch('builtins.open', mock): ... handle = open('filename', 'r') ... >>> mock.assert_called_with('filename', 'r') -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 04:56:34 2013 From: python-checkins at python.org (ezio.melotti) Date: Sat, 30 Mar 2013 04:56:34 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzE3NTM5OiBtZXJnZSB3aXRoIDMuMy4=?= Message-ID: <3Zd5bQ0BLlzQHG@mail.python.org> http://hg.python.org/cpython/rev/d5d6209745ab changeset: 83011:d5d6209745ab parent: 83009:8362fbb0ef42 parent: 83010:b0c0a03b8033 user: Ezio Melotti date: Sat Mar 30 05:56:21 2013 +0200 summary: #17539: merge with 3.3. files: Doc/library/unittest.mock-examples.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/unittest.mock-examples.rst b/Doc/library/unittest.mock-examples.rst --- a/Doc/library/unittest.mock-examples.rst +++ b/Doc/library/unittest.mock-examples.rst @@ -338,11 +338,11 @@ ... >>> test() -If you are patching a module (including `__builtin__`) then use `patch` +If you are patching a module (including :mod:`builtins`) then use `patch` instead of `patch.object`: - >>> mock = MagicMock(return_value = sentinel.file_handle) - >>> with patch('__builtin__.open', mock): + >>> mock = MagicMock(return_value=sentinel.file_handle) + >>> with patch('builtins.open', mock): ... handle = open('filename', 'r') ... >>> mock.assert_called_with('filename', 'r') -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sat Mar 30 05:56:31 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 30 Mar 2013 05:56:31 +0100 Subject: [Python-checkins] Daily reference leaks (ae5c4a9118b8): sum=2 Message-ID: results for ae5c4a9118b8 on branch "default" -------------------------------------------- test_concurrent_futures leaked [-2, 3, 1] memory blocks, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogaGFhMh', '-x'] From python-checkins at python.org Sat Mar 30 07:15:22 2013 From: python-checkins at python.org (nick.coghlan) Date: Sat, 30 Mar 2013 07:15:22 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Split_the_versioning_standard?= =?utf-8?q?_back_out_of_PEP_426?= Message-ID: <3Zd8gZ0YvrzNqj@mail.python.org> http://hg.python.org/peps/rev/d958e6f63d57 changeset: 4828:d958e6f63d57 user: Nick Coghlan date: Sat Mar 30 16:14:52 2013 +1000 summary: Split the versioning standard back out of PEP 426 files: pep-0426.txt | 15 +- pep-0440.txt | 1079 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 1091 insertions(+), 3 deletions(-) diff --git a/pep-0426.txt b/pep-0426.txt --- a/pep-0426.txt +++ b/pep-0426.txt @@ -6,12 +6,14 @@ Donald Stufft , Nick Coghlan BDFL-Delegate: Nick Coghlan -Discussions-To: Distutils SIG +Discussions-To: Distutils SIG Status: Draft Type: Standards Track Content-Type: text/x-rst +Requires: 440 Created: 30 Aug 2012 Post-History: 14 Nov 2012, 5 Feb 2013, 7 Feb 2013, 9 Feb 2013 +Replaces: 425 Abstract @@ -33,6 +35,13 @@ section. Finally, this version addresses several issues with the previous iteration of the standard version identification scheme. +.. note:: + + Portions of this PEP are in the process of being broken out into a + separate PEP (PEP 440). Old versions of much of that material currently + still exists in this PEP - the duplication will be eliminated in the + next major update. + Metadata files ============== @@ -534,8 +543,8 @@ Extension: Chili Chili/Type: Poblano Chili/Heat: Mild - Chili/json: { - "type" : "Poblano", + Chili/json: { + "type" : "Poblano", "heat" : "Mild" } The special ``{extension name}/json`` permits embedded JSON. It may be diff --git a/pep-0440.txt b/pep-0440.txt new file mode 100644 --- /dev/null +++ b/pep-0440.txt @@ -0,0 +1,1079 @@ +PEP: 440 +Title: Version Identification and Dependency Specification +Version: $Revision$ +Last-Modified: $Date$ +Author: Nick Coghlan +BDFL-Delegate: Nick Coghlan +Discussions-To: Distutils SIG +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 18 Mar 2013 +Post-History: 30 Mar 2013 +Replaces: 386 + + +Abstract +======== + +This PEP describes a scheme for identifying versions of Python software +distributions, and declaring dependencies on particular versions. + +This document addresses several limitations of the previous attempt at a +standardised approach to versioning, as described in PEP 345 and PEP 386. + +.. note:: + + This PEP has been broken out of the metadata 2.0 specification in PEP 426 + and refers to some details that will be in the *next* version of PEP 426. + + +Definitions +=========== + +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", +"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this +document are to be interpreted as described in RFC 2119. + +"Distributions" are deployable software components published through an index +server or otherwise made available for installation. + +"Versions" are uniquely identified snapshots of a distribution. + +"Distribution archives" are the packaged files which are used to publish +and distribute the software. "Source archives" require a build system to +be available on the target system, while "binary archives" only require that +prebuilt files be moved to the correct location on the target system. As +Python is a dynamically bound cross-platform language, many "binary" +archives will contain only pure Python source code. + +"Build tools" are automated tools intended to run on development systems, +producing source and binary distribution archives. Build tools may also be +invoked by installation tools in order to install software distributed as +source archives rather than prebuilt binary archives. + +"Index servers" are active distribution registries which publish version and +dependency metadata and place constraints on the permitted metadata. + +"Publication tools" are automated tools intended to run on development +systems and upload source and binary distribution archives to index servers. + +"Installation tools" are automated tools intended to run on production +systems, consuming source and binary distribution archives from an index +server or other designated location and deploying them to the target system. + +"Automated tools" is a collective term covering build tools, index servers, +publication tools, installation tools and any other software that produces +or consumes distribution version and dependency metadata. + +"Projects" refers to the developers that manage the creation of a particular +distribution. + + +Version scheme +============== + +Distribution versions are identified by both a public version identifier, +which supports all defined version comparison operations, and a build +label, which supports only strict equality comparisons. + +The version scheme is used both to describe the distribution version +provided by a particular distribution archive, as well as to place +constraints on the version of dependencies needed in order to build or +run the software. + + +Public version identifiers +-------------------------- + +Public version identifiers MUST comply with the following scheme:: + + N[.N]+[{a|b|c|rc}N][.postN][.devN] + +Public version identifiers MUST NOT include leading or trailing whitespace. + +Public version identifiers MUST be unique within a given distribution. + +Installation tools SHOULD ignore any public versions which do not comply with +this scheme. Installation tools MAY warn the user when non-compliant +or ambiguous versions are detected. + +Public version identifiers are separated into up to four segments: + +* Release segment: ``N[.N]+`` +* Pre-release segment: ``{a|b|c|rc}N`` +* Post-release segment: ``.postN`` +* Development release segment: ``.devN`` + +Any given version will be a "release", "pre-release", "post-release" or +"developmental release" as defined in the following sections. + +.. note:: + + Some hard to read version identifiers are permitted by this scheme in + order to better accommodate the wide range of versioning practices + across existing public and private Python projects, given the + constraint that the package index is not yet sophisticated enough to + allow the introduction of a simpler, backwards-incompatible scheme. + + Accordingly, some of the versioning practices which are technically + permitted by the PEP are strongly discouraged for new projects. Where + this is the case, the relevant details are noted in the following + sections. + + +Build labels +------------ + +Build labels are text strings with minimal defined semantics. + +To ensure build labels can be readily incorporated in file names and URLs, +they MUST be comprised of only ASCII alphanumerics, plus signs, periods +and hyphens. + +In addition, build labels MUST be unique within a given distribution. + + +Releases +-------- + +A version identifier that consists solely of a release segment is termed +a "release". + +The release segment consists of one or more non-negative integer values, +separated by dots:: + + N[.N]+ + +Releases within a project will typically be numbered in a consistently +increasing fashion. + +Comparison and ordering of release segments considers the numeric value +of each component of the release segment in turn. When comparing release +segments with different numbers of components, the shorter segment is +padded out with additional zeroes as necessary. + +Date based release numbers are technically compatible with this scheme, but +their use is not consistent with the expected API versioning semantics +described below. Accordingly, automated tools SHOULD at least issue a +warning when encountering a leading release component greater than or equal +to ``1980`` and MAY treat this case as an error. + +While any number of additional components after the first are permitted +under this scheme, the most common variants are to use two components +("major.minor") or three components ("major.minor.micro"). + +For example:: + + 0.9 + 0.9.1 + 0.9.2 + ... + 0.9.10 + 0.9.11 + 1.0 + 1.0.1 + 1.1 + 2.0 + 2.0.1 + +A release series is any set of release numbers that start with a common +prefix. For example, ``3.3.1``, ``3.3.5`` and ``3.3.9.45`` are all +part of the ``3.3`` release series. + +.. note:: + + ``X.Y`` and ``X.Y.0`` are not considered distinct release numbers, as + the release segment comparison rules implicit expand the two component + form to ``X.Y.0`` when comparing it to any release segment that includes + three components. + + +Pre-releases +------------ + +Some projects use an "alpha, beta, release candidate" pre-release cycle to +support testing by their users prior to a full release. + +If used as part of a project's development cycle, these pre-releases are +indicated by including a pre-release segment in the version identifier:: + + X.YaN # Alpha release + X.YbN # Beta release + X.YcN # Release candidate (alternative notation: X.YrcN) + X.Y # Full release + +A version identifier that consists solely of a release segment and a +pre-release segment is termed a "pre-release". + +The pre-release segment consists of an alphabetical identifier for the +pre-release phase, along with a non-negative integer value. Pre-releases for +a given release are ordered first by phase (alpha, beta, release candidate) +and then by the numerical component within that phase. + +Build tools, publication tools and index servers SHOULD disallow the creation +of both ``c`` and ``rc`` releases for a common release segment, but this +may need to be tolerated in order to handle some existing legacy +distributions. + +Installation tools SHOULD interpret all ``rc`` versions as coming after all +``c`` versions (that is, ``rc1`` indicates a later version than ``c2``). +Installation tools MAY warn the user when such ambiguous versions are +detected, or even reject them entirely. + + +Post-releases +------------- + +Some projects use post-releases to address minor errors in a release that +do not affect the distributed software (for example, correcting an error +in the release notes). + +If used as part of a project's development cycle, these post-releases are +indicated by including a post-release segment in the version identifier:: + + X.Y.postN # Post-release + +A version identifier that includes a post-release segment without a +developmental release segment is termed a "post-release". + +The post-release segment consists of the string ``.post``, followed by a +non-negative integer value. Post-releases are ordered by their +numerical component, immediately following the corresponding release, +and ahead of any subsequent release. + +.. note:: + + The use of post-releases to publish maintenance releases containing + actual bug fixes is strongly discouraged. In general, it is better + to use a longer release number and increment the final component + for each maintenance release. + +Post-releases are also permitted for pre-releases:: + + X.YaN.postM # Post-release of an alpha release + X.YbN.postM # Post-release of a beta release + X.YcN.postM # Post-release of a release candidate + +.. note:: + + Creating post-releases of pre-releases is strongly discouraged, as + it makes the version identifier difficult to parse for human readers. + In general, it is substantially clearer to simply create a new + pre-release by incrementing the numeric component. + + +Developmental releases +---------------------- + +Some projects make regular developmental releases, and system packagers +(especially for Linux distributions) may wish to create early releases +directly from source control which do not conflict with later project +releases. + +If used as part of a project's development cycle, these developmental +releases are indicated by including a developmental release segment in the +version identifier:: + + X.Y.devN # Developmental release + +A version identifier that includes a developmental release segment is +termed a "developmental release". + +The developmental release segment consists of the string ``.dev``, +followed by a non-negative integer value. Developmental releases are ordered +by their numerical component, immediately before the corresponding release +(and before any pre-releases with the same release segment), and following +any previous release (including any post-releases). + +Developmental releases are also permitted for pre-releases and +post-releases:: + + X.YaN.devM # Developmental release of an alpha release + X.YbN.devM # Developmental release of a beta release + X.YcN.devM # Developmental release of a release candidate + X.Y.postN.devM # Developmental release of a post-release + +.. note:: + + Creating developmental releases of pre-releases is strongly + discouraged, as it makes the version identifier difficult to parse for + human readers. In general, it is substantially clearer to simply create + additional pre-releases by incrementing the numeric component. + + Developmental releases of post-releases are also strongly discouraged, + but they may be appropriate for projects which use the post-release + notation for full maintenance releases which may include code changes. + + +Examples of compliant version schemes +------------------------------------- + +The standard version scheme is designed to encompass a wide range of +identification practices across public and private Python projects. In +practice, a single project attempting to use the full flexibility offered +by the scheme would create a situation where human users had difficulty +figuring out the relative order of versions, even though the rules above +ensure all compliant tools will order them consistently. + +The following examples illustrate a small selection of the different +approaches projects may choose to identify their releases, while still +ensuring that the "latest release" and the "latest stable release" can +be easily determined, both by human users and automated tools. + +Simple "major.minor" versioning:: + + 0.1 + 0.2 + 0.3 + 1.0 + 1.1 + ... + +Simple "major.minor.micro" versioning:: + + 1.1.0 + 1.1.1 + 1.1.2 + 1.2.0 + ... + +"major.minor" versioning with alpha, beta and release candidate +pre-releases:: + + 0.9 + 1.0a1 + 1.0a2 + 1.0b1 + 1.0c1 + 1.0 + 1.1a1 + ... + +"major.minor" versioning with developmental releases, release candidates +and post-releases for minor corrections:: + + 0.9 + 1.0.dev1 + 1.0.dev2 + 1.0.dev3 + 1.0.dev4 + 1.0rc1 + 1.0rc2 + 1.0 + 1.0.post1 + 1.1.dev1 + ... + + +Summary of permitted suffixes and relative ordering +--------------------------------------------------- + +.. note:: + + This section is intended primarily for authors of tools that + automatically process distribution metadata, rather than developers + of Python distributions deciding on a versioning scheme. + +The release segment of version identifiers MUST be sorted in +the same order as Python's tuple sorting when the release segment is +parsed as follows:: + + tuple(map(int, release_segment.split("."))) + +All release segments involved in the comparison MUST be converted to a +consistent length by padding shorter segments with zeroes as needed. + +Within a numeric release (``1.0``, ``2.7.3``), the following suffixes +are permitted and MUST be ordered as shown:: + + .devN, aN, bN, cN, rcN, , .postN + +Note that `rc` will always sort after `c` (regardless of the numeric +component) although they are semantically equivalent. Tools are free to +reject this case as ambiguous and remain in compliance with the PEP. + +Within an alpha (``1.0a1``), beta (``1.0b1``), or release candidate +(``1.0c1``, ``1.0rc1``), the following suffixes are permitted and MUST be +ordered as shown:: + + .devN, , .postN + +Within a post-release (``1.0.post1``), the following suffixes are permitted +and MUST be ordered as shown:: + + .devN, + +Note that ``devN`` and ``postN`` MUST always be preceded by a dot, even +when used immediately following a numeric version (e.g. ``1.0.dev456``, +``1.0.post1``). + +Within a pre-release, post-release or development release segment with a +shared prefix, ordering MUST be by the value of the numeric component. + +The following example covers many of the possible combinations:: + + 1.0.dev456 + 1.0a1 + 1.0a2.dev456 + 1.0a12.dev456 + 1.0a12 + 1.0b1.dev456 + 1.0b2 + 1.0b2.post345.dev456 + 1.0b2.post345 + 1.0c1.dev456 + 1.0c1 + 1.0 + 1.0.post456.dev34 + 1.0.post456 + 1.1.dev1 + + +Version ordering across different metadata versions +--------------------------------------------------- + +Metadata v1.0 (PEP 241) and metadata v1.1 (PEP 314) do not +specify a standard version identification or ordering scheme. This PEP does +not mandate any particular approach to handling such versions, but +acknowledges that the de facto standard for ordering them is +the scheme used by the ``pkg_resources`` component of ``setuptools``. + +Software that automatically processes distribution metadata SHOULD attempt +to normalize non-compliant version identifiers to the standard scheme, and +ignore them if normalization fails. As any normalization scheme will be +implementation specific, this means that projects using non-compliant +version identifiers may not be handled consistently across different +tools, even when correctly publishing the earlier metadata versions. + +For distributions currently using non-compliant version identifiers, these +filtering guidelines mean that it should be enough for the project to +simply switch to the use of compliant version identifiers to ensure +consistent handling by automated tools. + +Distribution users may wish to explicitly remove non-compliant versions from +any private package indexes they control. + +For metadata v1.2 (PEP 345), the version ordering described in this PEP +SHOULD be used in preference to the one defined in PEP 386. + + +Compatibility with other version schemes +---------------------------------------- + +Some projects may choose to use a version scheme which requires +translation in order to comply with the public version scheme defined in +this PEP. In such cases, the build label can be used to +record the project specific version as an arbitrary label, while the +translated public version is published in the version field. + +This allows automated distribution tools to provide consistently correct +ordering of published releases, while still allowing developers to use +the internal versioning scheme they prefer for their projects. + + +Semantic versioning +~~~~~~~~~~~~~~~~~~~ + +`Semantic versioning`_ is a popular version identification scheme that is +more prescriptive than this PEP regarding the significance of different +elements of a release number. Even if a project chooses not to abide by +the details of semantic versioning, the scheme is worth understanding as +it covers many of the issues that can arise when depending on other +distributions, and when publishing a distribution that others rely on. + +The "Major.Minor.Patch" (described in this PEP as "major.minor.micro") +aspects of semantic versioning (clauses 1-9 in the 2.0.0-rc-1 specification) +are fully compatible with the version scheme defined in this PEP, and abiding +by these aspects is encouraged. + +Semantic versions containing a hyphen (pre-releases - clause 10) or a +plus sign (builds - clause 11) are *not* compatible with this PEP +and are not permitted in the public version field. + +One possible mechanism to translate such semantic versioning based build +labels to compatible public versions is to use the ``.devN`` suffix to +specify the appropriate version order. + +.. _Semantic versioning: http://semver.org/ + + +DVCS based version labels +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Many build tools integrate with distributed version control systems like +Git and Mercurial in order to add an identifying hash to the version +identifier. As hashes cannot be ordered reliably such versions are not +permitted in the public version field. + +As with semantic versioning, the public ``.devN`` suffix may be used to +uniquely identify such releases for publication, while the build label is +used to record the original DVCS based version label. + + +Date based versions +~~~~~~~~~~~~~~~~~~~ + +As with other incompatible version schemes, date based versions can be +stored in the build label field. Translating them to a compliant +public version is straightforward: use a leading "0." prefix in the public +version label, with the date based version number as the remaining components +in the release segment. + +This has the dual benefit of allowing subsequent migration to version +numbering based on API compatibility, as well as triggering more appropriate +version comparison semantics. + + +Version specifiers +================== + +A version specifier consists of a series of version clauses, separated by +commas. For example:: + + 0.9, >= 1.0, != 1.3.4.*, < 2.0 + +The comparison operator (or lack thereof) determines the kind of version +clause: + +* No operator: `Compatible release`_ clause +* ``==``: `Version matching`_ clause +* ``!=``: `Version exclusion`_ clause +* ``is``: `Build reference`_ clause +* ``<``, ``>``, ``<=``, ``>=``: `Ordered comparison`_ clause + +The comma (",") is equivalent to a logical **and** operator: a candidate +version must match all given version clauses in order to match the +specifier as a whole. + +Whitespace between a conditional operator and the following version +identifier is optional, as is the whitespace around the commas. + +When multiple candidate versions match a version specifier, the preferred +version SHOULD be the latest version as determined by the consistent +ordering defined by the standard `Version scheme`_. Whether or not +pre-releases are considered as candidate versions SHOULD be handled as +described in `Handling of pre-releases`_. + + +Compatible release +------------------ + +A compatible release clause consists solely of a version identifier without +any comparison operator. It matches any candidate version that is expected +to be compatible with the specified version. + +The specified version identifier must be in the standard format described in +`Version scheme`_. + +For a given release identifier ``V.N``, the compatible release clause is +approximately equivalent to the pair of comparison clauses:: + + >= V.N, == V.* + +For example, the following version clauses are equivalent:: + + 2.2 + >= 2.2, == 2.* + + 1.4.5 + >= 1.4.5, == 1.4.* + +If a pre-release, post-release or developmental release is named in a +compatible release clause as ``V.N.suffix``, then the suffix is ignored +when determining the required prefix match:: + + 2.2.post3 + >= 2.2.post3, == 2.* + + 1.4.5a4 + >= 1.4.5a4, == 1.4.* + +The padding rules for release segment comparisons means that the assumed +degree of forward compatibility in a compatible release clause can be +controlled by appending additional zeroes to the version specifier:: + + 2.2.0 + >= 2.2.0, == 2.2.* + + 1.4.5.0 + >= 1.4.5.0, == 1.4.5.* + + +Version matching +---------------- + +A version matching clause includes the version matching operator ``==`` +and a version identifier. + +The specified version identifier must be in the standard format described in +`Version scheme`_, but a trailing ``.*`` is permitted as described below. + +By default, the version matching operator is based on a strict equality +comparison: the specified version must be exactly the same as the requested +version. The *only* substitution performed is the zero padding of the +release segment to ensure the release segments are compared with the same +length. + +Prefix matching may be requested instead of strict comparison, by appending +a trailing ``.*`` to the version identifier in the version matching clause. +This means that additional trailing segments will be ignored when +determining whether or not a version identifier matches the clause. If the +version includes only a release segment, than trailing components in the +release segment are also ignored. + +For example, given the version ``1.1.post1``, the following clauses would +match or not as shown: + + == 1.1 # Not equal, so 1.1.post1 does not match clause + == 1.1.post1 # Equal, so 1.1.post1 matches clause + == 1.1.* # Same prefix, so 1.1.post1 matches clause + +.. note:: + + The use of ``==`` when defining dependencies for published + distributions is strongly discouraged as it greatly complicates the + deployment of security fixes. The strict version comparison operator + is intended primarily for use when defining dependencies for repeatable + *deployments of applications* while using a shared distribution index. + + +Version exclusion +----------------- + +A version exclusion clause includes the version matching operator ``!=`` +and a version identifier. + +The allowed version identifiers and comparison semantics are the same as +those of the `Version matching`_ operator, except that the sense of any +match is inverted. + +For example, given the version ``1.1.post1``, the following clauses would +match or not as shown: + + != 1.1 # Not equal, so 1.1.post1 matches clause + != 1.1.post1 # Equal, so 1.1.post1 does not match clause + != 1.1.* # Same prefix, so 1.1.post1 does not match clause + + +Build reference +--------------- + +A build reference includes the build label matching operator ``is`` and +a build reference. + +A build reference is a direct URI reference supplied to satisfy a +dependency. The exact kinds of URIs and targets supported will be determined +by the specific installation tool used. + +Publication tools and public index servers SHOULD NOT permit build +references in dependency specifications. + +Installation tools SHOULD support the use of build references to identify +dependencies. + +Automated tools MAY support the use of build labels in build reference +clauses. They can be clearly distinguished from URI references without +ambiguity, as ``:`` and ``/`` are not permitted in build labels. + +Build label matching works solely on strict equality comparisons: the +candidate build label must be exactly the same as the build label in the +version clause. + + +Ordered comparison +------------------ + +An ordered comparison clause includes a comparison operator and a version +identifier, and will match any version where the comparison is correct +based on the relative position of the candidate version and the specified +version given the consistent ordering defined by the standard +`Version scheme`_. + +The supported ordered comparison operators are ``<``, ``>``, ``<=``, ``>=``. + +As with version matching, the release segment is zero padded as necessary to +ensure the release segments are compared with the same length. + +To exclude pre-releases and post-releases correctly, the comparison clauses +``< V`` and ``> V`` MUST be interpreted as also implying the version matching +clause ``!= V.*``. + + +Handling of pre-releases +------------------------ + +Pre-releases of any kind, including developmental releases, are implicitly +excluded from all version specifiers, *unless* a pre-release or developmental +release is explicitly mentioned in one of the clauses. For example, these +specifiers implicitly exclude all pre-releases and development +releases of later versions:: + + 2.2 + >= 1.0 + +While these specifiers would include at least some of them:: + + 2.2.dev0 + 2.2, != 2.3b2 + >= 1.0a1 + >= 1.0c1 + >= 1.0, != 1.0b2 + >= 1.0, < 2.0.dev123 + +Dependency resolution tools SHOULD exclude pre-releases by default, but +SHOULD also allow users to request the following alternative behaviours: + +* accept already installed pre-releases for all version specifiers +* retrieve and install available pre-releases for all version specifiers + +Dependency resolution tools MAY also allow the above behaviour to be +controlled on a per-distribution basis. + +Post-releases and purely numeric releases receive no special treatment - +they are always included unless explicitly excluded. + + +Examples +-------- + +* ``3.1``: version 3.1 or later, but not + version 4.0 or later. Excludes pre-releases and developmental releases. +* ``3.1.2``: version 3.1.2 or later, but not + version 3.2.0 or later. Excludes pre-releases and developmental releases. +* ``3.1a1``: version 3.1a1 or later, but not + version 4.0 or later. Allows pre-releases like 3.2a4 and developmental + releases like 3.2.dev1. +* ``== 3.1``: specifically version 3.1 (or 3.1.0), excludes all pre-releases, + post releases, developmental releases and any 3.1.x maintenance releases. +* ``== 3.1.*``: any version that starts with 3.1, excluding pre-releases and + developmental releases. Equivalent to the ``3.1.0`` compatible release + clause. +* ``3.1.0, != 3.1.3``: version 3.1.0 or later, but not version 3.1.3 and + not version 3.2.0 or later. Excludes pre-releases and developmental + releases. + + +Updating the versioning specification +===================================== + +The versioning specification may be updated with clarifications without +requiring a new PEP or a change to the metadata version. + +Actually changing the version comparison semantics still requires a new +versioning scheme and metadata version defined in new PEPs. + + +Open issues +=========== + +* The new ``is`` operator seems like a reasonable way to cleanly allow + *deployments* to bring in non-published dependencies, while heavily + discouraging the practice for published libraries. However, it's a + first draft of the idea, so feedback is definitely welcome. + +* Currently, the cleanest way to specify that a project runs on Python + 2.6+ and 3.3+ is to use a clause like:: + + Requires-Python: >= 2.6, < 4.0, != 3.0.*, != 3.1.*, != 3.2.* + + It would be better if there was a cleaner way to specify "this OR that" in + a version specifier. Perhaps something like:: + + Requires-Python: (2.6) or (3.3) + + This would be a respectable increase in the complexity of the parsing for + version specifiers though, even if it was only allowed at the top level. + + +Summary of differences from \PEP 386 +==================================== + +* Moved the description of version specifiers into the versioning PEP + +* added the "build label" concept to better handle projects that wish to + use a non-compliant versioning scheme internally, especially those based + on DVCS hashes + +* added the "compatible release" clause + +* added the "build reference" clause + +* separated the two kinds of "version matching" clause (strict and prefix) + +* changed the top level sort position of the ``.devN`` suffix + +* allowed single value version numbers + +* explicit exclusion of leading or trailing whitespace + +* explicit criterion for the exclusion of date based versions + +* implicitly exclude pre-releases unless explicitly requested + +* treat post releases the same way as unqualified releases + +* Discuss ordering and dependencies across metadata versions + +The rationale for major changes is given in the following sections. + + +Adding build labels +------------------- + +The new build label support is intended to make it clearer that the +constraints on public version identifiers are there primarily to aid in +the creation of reliable automated dependency analysis tools. Projects +are free to use whatever versioning scheme they like internally, so long +as they are able to translate it to something the dependency analysis tools +will understand. + + +Changing the version scheme +--------------------------- + +The key change in the version scheme in this PEP relative to that in +PEP 386 is to sort top level developmental releases like ``X.Y.devN`` ahead +of alpha releases like ``X.Ya1``. This is a far more logical sort order, as +projects already using both development releases and alphas/betas/release +candidates do not want their developmental releases sorted in +between their release candidates and their full releases. There is no +rationale for using ``dev`` releases in that position rather than +merely creating additional release candidates. + +The updated sort order also means the sorting of ``dev`` versions is now +consistent between the metadata standard and the pre-existing behaviour +of ``pkg_resources`` (and hence the behaviour of current installation +tools). + +Making this change should make it easier for affected existing projects to +migrate to the latest version of the metadata standard. + +Another change to the version scheme is to allow single number +versions, similar to those used by non-Python projects like Mozilla +Firefox, Google Chrome and the Fedora Linux distribution. This is actually +expected to be more useful for version specifiers (allowing things like +the simple ``Requires-Python: 3`` rather than the more convoluted +``Requires-Python: >= 3.0, < 4``), but it is easier to allow it for both +version specifiers and release numbers, rather than splitting the +two definitions. + +The exclusion of leading and trailing whitespace was made explicit after +a couple of projects with version identifiers differing only in a +trailing ``\n`` character were found on PyPI. + +The exclusion of major release numbers that looks like dates was implied +by the overall text of PEP 386, but not clear in the definition of the +version scheme. This exclusion has been made clear in the definition of +the release component. + +`Appendix A` shows detailed results of an analysis of PyPI distribution +version information, as collected on 19th February, 2013. This analysis +compares the behaviour of the explicitly ordered version schemes defined in +this PEP and PEP 386 with the de facto standard defined by the behaviour +of setuptools. These metrics are useful, as the intent of both PEPs is to +follow existing setuptools behaviour as closely as is feasible, while +still throwing exceptions for unorderable versions (rather than trying +to guess an appropriate order as setuptools does). + +Overall, the percentage of compatible distributions improves from 97.7% +with PEP 386 to 98.7% with this PEP. While the number of projects affected +in practice was small, some of the affected projects are in widespread use +(such as Pinax and selenium). The surprising ordering discrepancy also +concerned developers and acted as an unnecessary barrier to adoption of +the new metadata standard, even for projects that weren't directly affected. + +The data also shows that the pre-release sorting discrepancies are seen +only when analysing *all* versions from PyPI, rather than when analysing +public versions. This is largely due to the fact that PyPI normally reports +only the most recent version for each project (unless maintainers +explicitly configure their project to display additional versions). However, +installers that need to satisfy detailed version constraints often need +to look at all available versions, as they may need to retrieve an older +release. + +Even this PEP doesn't completely eliminate the sorting differences relative +to setuptools: + +* Sorts differently (after translations): 38 / 28194 (0.13 %) +* Sorts differently (no translations): 2 / 28194 (0.01 %) + +The two remaining sort order discrepancies picked up by the analysis are due +to a pair of projects which have PyPI releases ending with a carriage +return, alongside releases with the same version number, only *without* the +trailing carriage return. + +The sorting discrepancies after translation relate mainly to differences +in the handling of pre-releases where the standard mechanism is considered +to be an improvement. For example, the existing pkg_resources scheme will +sort "1.1beta1" *after* "1.1b2", whereas the suggested standard translation +for "1.1beta1" is "1.1b1", which sorts *before* "1.1b2". Similarly, the +pkg_resources scheme will sort "-dev-N" pre-releases differently from +"devN" pre-releases when they occur within the same release, while the +scheme in this PEP requires normalizing both representations to ".devN" and +sorting them by the numeric component. + + +A more opinionated description of the versioning scheme +------------------------------------------------------- + +As in PEP 386, the primary focus is on codifying existing practices to make +them more amenable to automation, rather than demanding that existing +projects make non-trivial changes to their workflow. However, the +standard scheme allows significantly more flexibility than is needed +for the vast majority of simple Python packages (which often don't even +need maintenance releases - many users are happy with needing to upgrade to a +new feature release to get bug fixes). + +For the benefit of novice developers, and for experienced developers +wishing to better understand the various use cases, the specification +now goes into much greater detail on the components of the defined +version scheme, including examples of how each component may be used +in practice. + +The PEP also explicitly guides developers in the direction of +semantic versioning (without requiring it), and discourages the use of +several aspects of the full versioning scheme that have largely been +included in order to cover esoteric corner cases in the practices of +existing projects and in repackaging software for Linux distributions. + + +Describing version specifiers alongside the versioning scheme +------------------------------------------------------------- + +The main reason to even have a standardised version scheme in the first place +is to make it easier to do reliable automated dependency analysis. It makes +more sense to describe the primary use case for version identifiers alongside +their definition. + + +Changing the interpretation of version specifiers +------------------------------------------------- + +The previous interpretation of version specifiers made it very easy to +accidentally download a pre-release version of a dependency. This in +turn made it difficult for developers to publish pre-release versions +of software to the Python Package Index, as even marking the package as +hidden wasn't enough to keep automated tools from downloading it, and also +made it harder for users to obtain the test release manually through the +main PyPI web interface. + +The previous interpretation also excluded post-releases from some version +specifiers for no adequately justified reason. + +The updated interpretation is intended to make it difficult to accidentally +accept a pre-release version as satisfying a dependency, while allowing +pre-release versions to be explicitly requested when needed. + +The "some forward compatibility assumed" default version constraint is +taken directly from the Ruby community's "pessimistic version constraint" +operator [2]_ to allow projects to take a cautious approach to forward +compatibility promises, while still easily setting a minimum required +version for their dependencies. It is made the default behaviour rather +than needing a separate operator in order to explicitly discourage +overspecification of dependencies by library developers. The explicit +comparison operators remain available to cope with dependencies with +unreliable or non-existent backwards compatibility policies, as well +as for legitimate use cases related to deployment of integrated applications. + +The two kinds of version matching (strict and prefix based) were separated +to make it possible to sensibly define the compatible release clauses and the +desired pre-release handling semantics for ``<`` and ``>`` ordered +comparison clauses. + + +References +========== + +The initial attempt at a standardised version scheme, along with the +justifications for needing such a standard can be found in PEP 386. + +.. [1] Version compatibility analysis script: + http://hg.python.org/peps/file/default/pep-0426/pepsort.py + +.. [2] Pessimistic version constraint + http://docs.rubygems.org/read/chapter/16 + + +Appendix A +========== + +Metadata v2.0 guidelines versus setuptools (note that this analysis was +run when this PEP was still embedded as part of PEP 426):: + + $ ./pepsort.py + Comparing PEP 426 version sort to setuptools. + + Analysing release versions + Compatible: 24477 / 28194 (86.82 %) + Compatible with translation: 247 / 28194 (0.88 %) + Compatible with filtering: 84 / 28194 (0.30 %) + No compatible versions: 420 / 28194 (1.49 %) + Sorts differently (after translations): 0 / 28194 (0.00 %) + Sorts differently (no translations): 0 / 28194 (0.00 %) + No applicable versions: 2966 / 28194 (10.52 %) + + Analysing public versions + Compatible: 25600 / 28194 (90.80 %) + Compatible with translation: 1505 / 28194 (5.34 %) + Compatible with filtering: 13 / 28194 (0.05 %) + No compatible versions: 420 / 28194 (1.49 %) + Sorts differently (after translations): 0 / 28194 (0.00 %) + Sorts differently (no translations): 0 / 28194 (0.00 %) + No applicable versions: 656 / 28194 (2.33 %) + + Analysing all versions + Compatible: 24239 / 28194 (85.97 %) + Compatible with translation: 2833 / 28194 (10.05 %) + Compatible with filtering: 513 / 28194 (1.82 %) + No compatible versions: 320 / 28194 (1.13 %) + Sorts differently (after translations): 38 / 28194 (0.13 %) + Sorts differently (no translations): 2 / 28194 (0.01 %) + No applicable versions: 249 / 28194 (0.88 %) + +Metadata v1.2 guidelines versus setuptools:: + + $ ./pepsort.py 386 + Comparing PEP 386 version sort to setuptools. + + Analysing release versions + Compatible: 24244 / 28194 (85.99 %) + Compatible with translation: 247 / 28194 (0.88 %) + Compatible with filtering: 84 / 28194 (0.30 %) + No compatible versions: 648 / 28194 (2.30 %) + Sorts differently (after translations): 0 / 28194 (0.00 %) + Sorts differently (no translations): 0 / 28194 (0.00 %) + No applicable versions: 2971 / 28194 (10.54 %) + + Analysing public versions + Compatible: 25371 / 28194 (89.99 %) + Compatible with translation: 1507 / 28194 (5.35 %) + Compatible with filtering: 12 / 28194 (0.04 %) + No compatible versions: 648 / 28194 (2.30 %) + Sorts differently (after translations): 0 / 28194 (0.00 %) + Sorts differently (no translations): 0 / 28194 (0.00 %) + No applicable versions: 656 / 28194 (2.33 %) + + Analysing all versions + Compatible: 23969 / 28194 (85.01 %) + Compatible with translation: 2789 / 28194 (9.89 %) + Compatible with filtering: 530 / 28194 (1.88 %) + No compatible versions: 547 / 28194 (1.94 %) + Sorts differently (after translations): 96 / 28194 (0.34 %) + Sorts differently (no translations): 14 / 28194 (0.05 %) + No applicable versions: 249 / 28194 (0.88 %) + + +Copyright +========= + +This document has been placed in the public domain. + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + End: -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sat Mar 30 09:39:00 2013 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 30 Mar 2013 09:39:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fix_typos_and_?= =?utf-8?q?clear_up_one_very_odd_bit_of_wording_as_pointed_out_by?= Message-ID: <3ZdCsJ4BKJzPyZ@mail.python.org> http://hg.python.org/cpython/rev/b9de69c715fc changeset: 83012:b9de69c715fc branch: 2.7 parent: 83007:bc73223e4c10 user: Gregory P. Smith date: Sat Mar 30 01:38:38 2013 -0700 summary: Fix typos and clear up one very odd bit of wording as pointed out by Ezio. files: Doc/library/xml.rst | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst --- a/Doc/library/xml.rst +++ b/Doc/library/xml.rst @@ -108,20 +108,22 @@ defused packages ---------------- +These external packages are recommended for any code that parses +untrusted XML data. + `defusedxml`_ is a pure Python package with modified subclasses of all stdlib -XML parsers that prevent any potentially malicious operation. The courses of -action are recommended for any server code that parses untrusted XML data. The -package also ships with example exploits and an extended documentation on more +XML parsers that prevent any potentially malicious operation. The +package also ships with example exploits and extended documentation on more XML exploits like xpath injection. -`defusedexpat`_ provides a modified libexpat and patched replacment +`defusedexpat`_ provides a modified libexpat and patched replacement :mod:`pyexpat` extension module with countermeasures against entity expansion DoS attacks. Defusedexpat still allows a sane and configurable amount of entity expansions. The modifications will be merged into future releases of Python. The workarounds and modifications are not included in patch releases as they break backward compatibility. After all inline DTD and entity expansion are -well-definied XML features. +well-defined XML features. .. _defusedxml: https://pypi.python.org/pypi/defusedxml/ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 12:39:20 2013 From: python-checkins at python.org (nick.coghlan) Date: Sat, 30 Mar 2013 12:39:20 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_Replace_the_right_PEP?= Message-ID: <3ZdHsN1s7czPxW@mail.python.org> http://hg.python.org/peps/rev/3b67372b39ba changeset: 4829:3b67372b39ba user: Nick Coghlan date: Sat Mar 30 21:39:06 2013 +1000 summary: Replace the right PEP files: pep-0426.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0426.txt b/pep-0426.txt --- a/pep-0426.txt +++ b/pep-0426.txt @@ -13,7 +13,7 @@ Requires: 440 Created: 30 Aug 2012 Post-History: 14 Nov 2012, 5 Feb 2013, 7 Feb 2013, 9 Feb 2013 -Replaces: 425 +Replaces: 345 Abstract -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sat Mar 30 12:57:22 2013 From: python-checkins at python.org (vinay.sajip) Date: Sat, 30 Mar 2013 12:57:22 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Updated_loggin?= =?utf-8?q?g_cookbook_with_additional_example_for_output_using_str=2Eforma?= =?utf-8?b?dCgpLg==?= Message-ID: <3ZdJGB5SrJzNPD@mail.python.org> http://hg.python.org/cpython/rev/7fd5d9fe9f71 changeset: 83013:7fd5d9fe9f71 branch: 3.3 parent: 83010:b0c0a03b8033 user: Vinay Sajip date: Sat Mar 30 11:56:18 2013 +0000 summary: Updated logging cookbook with additional example for output using str.format(). files: Doc/howto/logging-cookbook.rst | 34 ++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1096,6 +1096,40 @@ string. That's because the __ notation is just syntax sugar for a constructor call to one of the XXXMessage classes. +If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar effect +to the above, as in the following example:: + + import logging + + class Message(object): + def __init__(self, fmt, args): + self.fmt = fmt + self.args = args + + def __str__(self): + return self.fmt.format(*self.args) + + class StyleAdapter(logging.LoggerAdapter): + def __init__(self, logger, extra=None): + super(StyleAdapter, self).__init__(logger, extra or {}) + + def log(self, level, msg, *args, **kwargs): + if self.isEnabledFor(level): + msg, kwargs = self.process(msg, kwargs) + self.logger._log(level, Message(msg, args), (), **kwargs) + + logger = StyleAdapter(logging.getLogger(__name__)) + + def main(): + logger.debug('Hello, {}', 'world!') + + if __name__ == '__main__': + logging.basicConfig(level=logging.DEBUG) + main() + +The above script should log the message ``Hello, world!`` when run with +Python 3.2 or later. + .. currentmodule:: logging -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 12:57:24 2013 From: python-checkins at python.org (vinay.sajip) Date: Sat, 30 Mar 2013 12:57:24 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merged_documentation_update_from_3=2E3=2E?= Message-ID: <3ZdJGD10RFzNPD@mail.python.org> http://hg.python.org/cpython/rev/efb44458afcd changeset: 83014:efb44458afcd parent: 83011:d5d6209745ab parent: 83013:7fd5d9fe9f71 user: Vinay Sajip date: Sat Mar 30 11:57:09 2013 +0000 summary: Merged documentation update from 3.3. files: Doc/howto/logging-cookbook.rst | 34 ++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1094,6 +1094,40 @@ string. That's because the __ notation is just syntax sugar for a constructor call to one of the XXXMessage classes. +If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar effect +to the above, as in the following example:: + + import logging + + class Message(object): + def __init__(self, fmt, args): + self.fmt = fmt + self.args = args + + def __str__(self): + return self.fmt.format(*self.args) + + class StyleAdapter(logging.LoggerAdapter): + def __init__(self, logger, extra=None): + super(StyleAdapter, self).__init__(logger, extra or {}) + + def log(self, level, msg, *args, **kwargs): + if self.isEnabledFor(level): + msg, kwargs = self.process(msg, kwargs) + self.logger._log(level, Message(msg, args), (), **kwargs) + + logger = StyleAdapter(logging.getLogger(__name__)) + + def main(): + logger.debug('Hello, {}', 'world!') + + if __name__ == '__main__': + logging.basicConfig(level=logging.DEBUG) + main() + +The above script should log the message ``Hello, world!`` when run with +Python 3.2 or later. + .. currentmodule:: logging -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 15:37:34 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 30 Mar 2013 15:37:34 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Update_collect?= =?utf-8?q?ions_ABC_table_to_match_the_=5F=5Fabstractmethods=5F=5F_attribu?= =?utf-8?q?te_for?= Message-ID: <3ZdMq25T6qzNPD@mail.python.org> http://hg.python.org/cpython/rev/db3c5132877c changeset: 83015:db3c5132877c branch: 2.7 parent: 82962:27cb49ede303 user: Raymond Hettinger date: Sat Mar 23 08:57:00 2013 -0700 summary: Update collections ABC table to match the __abstractmethods__ attribute for each container. files: Doc/library/collections.rst | 40 ++++++++++++++---------- 1 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -895,29 +895,35 @@ :class:`Sized` ``__len__`` :class:`Callable` ``__call__`` -:class:`Sequence` :class:`Sized`, ``__getitem__`` ``__contains__``, ``__iter__``, ``__reversed__``, - :class:`Iterable`, ``index``, and ``count`` +:class:`Sequence` :class:`Sized`, ``__getitem__``, ``__contains__``, ``__iter__``, ``__reversed__``, + :class:`Iterable`, ``__len__`` ``index``, and ``count`` :class:`Container` -:class:`MutableSequence` :class:`Sequence` ``__setitem__``, Inherited :class:`Sequence` methods and - ``__delitem__``, ``append``, ``reverse``, ``extend``, ``pop``, - ``insert`` ``remove``, and ``__iadd__`` +:class:`MutableSequence` :class:`Sequence` ``__getitem__``, Inherited :class:`Sequence` methods and + ``__setitem__``, ``append``, ``reverse``, ``extend``, ``pop``, + ``__delitem__``, ``remove``, and ``__iadd__`` + ``__len__``, + ``insert`` -:class:`Set` :class:`Sized`, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, - :class:`Iterable`, ``__gt__``, ``__ge__``, ``__and__``, ``__or__``, - :class:`Container` ``__sub__``, ``__xor__``, and ``isdisjoint`` +:class:`Set` :class:`Sized`, ``__contains__``, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, + :class:`Iterable`, ``__iter__``, ``__gt__``, ``__ge__``, ``__and__``, ``__or__``, + :class:`Container` ``__len__`` ``__sub__``, ``__xor__``, and ``isdisjoint`` -:class:`MutableSet` :class:`Set` ``add``, Inherited :class:`Set` methods and - ``discard`` ``clear``, ``pop``, ``remove``, ``__ior__``, - ``__iand__``, ``__ixor__``, and ``__isub__`` +:class:`MutableSet` :class:`Set` ``__contains__``, Inherited :class:`Set` methods and + ``__iter__``, ``clear``, ``pop``, ``remove``, ``__ior__``, + ``__len__``, ``__iand__``, ``__ixor__``, and ``__isub__`` + ``add``, + ``discard`` -:class:`Mapping` :class:`Sized`, ``__getitem__`` ``__contains__``, ``keys``, ``items``, ``values``, - :class:`Iterable`, ``get``, ``__eq__``, and ``__ne__`` - :class:`Container` +:class:`Mapping` :class:`Sized`, ``__getitem__``, ``__contains__``, ``keys``, ``items``, ``values``, + :class:`Iterable`, ``__iter__``, ``get``, ``__eq__``, and ``__ne__`` + :class:`Container` ``__len__`` -:class:`MutableMapping` :class:`Mapping` ``__setitem__``, Inherited :class:`Mapping` methods and - ``__delitem__`` ``pop``, ``popitem``, ``clear``, ``update``, - and ``setdefault`` +:class:`MutableMapping` :class:`Mapping` ``__getitem__``, Inherited :class:`Mapping` methods and + ``__setitem__``, ``pop``, ``popitem``, ``clear``, ``update``, + ``__delitem__``, and ``setdefault`` + ``__iter__``, + ``__len__`` :class:`MappingView` :class:`Sized` ``__len__`` -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 15:37:36 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 30 Mar 2013 15:37:36 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgMTc1Mzg6?= =?utf-8?q?_Document_XML_vulnerabilties?= Message-ID: <3ZdMq42c3dzNHG@mail.python.org> http://hg.python.org/cpython/rev/91bb6d7ae833 changeset: 83016:91bb6d7ae833 branch: 2.7 user: Christian Heimes date: Tue Mar 26 17:53:05 2013 +0100 summary: Issue 17538: Document XML vulnerabilties files: Doc/library/markup.rst | 1 + Doc/library/pyexpat.rst | 8 + Doc/library/xml.dom.minidom.rst | 8 + Doc/library/xml.dom.pulldom.rst | 7 + Doc/library/xml.etree.elementtree.rst | 8 + Doc/library/xml.rst | 131 ++++++++++++++ Doc/library/xml.sax.rst | 8 + Doc/library/xmlrpclib.rst | 7 + Misc/NEWS | 5 + 9 files changed, 183 insertions(+), 0 deletions(-) diff --git a/Doc/library/markup.rst b/Doc/library/markup.rst --- a/Doc/library/markup.rst +++ b/Doc/library/markup.rst @@ -25,6 +25,7 @@ htmlparser.rst sgmllib.rst htmllib.rst + xml.rst xml.etree.elementtree.rst xml.dom.rst xml.dom.minidom.rst diff --git a/Doc/library/pyexpat.rst b/Doc/library/pyexpat.rst --- a/Doc/library/pyexpat.rst +++ b/Doc/library/pyexpat.rst @@ -14,6 +14,14 @@ directive. Since they are attributes which are set by client code, in-text references to these attributes should be marked using the :member: role. + +.. warning:: + + The :mod:`pyexpat` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + .. versionadded:: 2.0 .. index:: single: Expat diff --git a/Doc/library/xml.dom.minidom.rst b/Doc/library/xml.dom.minidom.rst --- a/Doc/library/xml.dom.minidom.rst +++ b/Doc/library/xml.dom.minidom.rst @@ -20,6 +20,14 @@ not already proficient with the DOM should consider using the :mod:`xml.etree.ElementTree` module for their XML processing instead + +.. warning:: + + The :mod:`xml.dom.minidom` module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data see :ref:`xml-vulnerabilities`. + + DOM applications typically start by parsing some XML into a DOM. With :mod:`xml.dom.minidom`, this is done through the parse functions:: diff --git a/Doc/library/xml.dom.pulldom.rst b/Doc/library/xml.dom.pulldom.rst --- a/Doc/library/xml.dom.pulldom.rst +++ b/Doc/library/xml.dom.pulldom.rst @@ -16,6 +16,13 @@ Object Model representation of a document from SAX events. +.. warning:: + + The :mod:`xml.dom.pulldom` module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data see :ref:`xml-vulnerabilities`. + + .. class:: PullDOM([documentFactory]) :class:`xml.sax.handler.ContentHandler` implementation that ... diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -16,6 +16,14 @@ hierarchical data structures in memory. The type can be described as a cross between a list and a dictionary. + +.. warning:: + + The :mod:`xml.etree.ElementTree` module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data see :ref:`xml-vulnerabilities`. + + Each element has a number of properties associated with it: * a tag which is a string identifying what kind of data this element represents diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst new file mode 100644 --- /dev/null +++ b/Doc/library/xml.rst @@ -0,0 +1,131 @@ +.. _xml: + +XML Processing Modules +====================== + +.. module:: xml + :synopsis: Package containing XML processing modules +.. sectionauthor:: Christian Heimes +.. sectionauthor:: Georg Brandl + + +Python's interfaces for processing XML are grouped in the ``xml`` package. + +.. warning:: + + The XML modules are not secure against erroneous or maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + +It is important to note that modules in the :mod:`xml` package require that +there be at least one SAX-compliant XML parser available. The Expat parser is +included with Python, so the :mod:`xml.parsers.expat` module will always be +available. + +The documentation for the :mod:`xml.dom` and :mod:`xml.sax` packages are the +definition of the Python bindings for the DOM and SAX interfaces. + +The XML handling submodules are: + +* :mod:`xml.etree.ElementTree`: the ElementTree API, a simple and lightweight + +.. + +* :mod:`xml.dom`: the DOM API definition +* :mod:`xml.dom.minidom`: a lightweight DOM implementation +* :mod:`xml.dom.pulldom`: support for building partial DOM trees + +.. + +* :mod:`xml.sax`: SAX2 base classes and convenience functions +* :mod:`xml.parsers.expat`: the Expat parser binding + + +.. _xml-vulnerabilities: + +XML vulnerabilities +=================== + +The XML processing modules are not secure against maliciously constructed data. +An attacker can abuse vulnerabilities for e.g. denial of service attacks, to +access local files, to generate network connections to other machines, or +to or circumvent firewalls. The attacks on XML abuse unfamiliar features +like inline `DTD`_ (document type definition) with entities. + + +========================= ======== ========= ========= ======== ========= +kind sax etree minidom pulldom xmlrpc +========================= ======== ========= ========= ======== ========= +billion laughs **True** **True** **True** **True** **True** +quadratic blowup **True** **True** **True** **True** **True** +external entity expansion **True** False (1) False (2) **True** False (3) +DTD retrieval **True** False False **True** False +decompression bomb False False False False **True** +========================= ======== ========= ========= ======== ========= + +1. :mod:`xml.etree.ElementTree` doesn't expand external entities and raises a + ParserError when an entity occurs. +2. :mod:`xml.dom.minidom` doesn't expand external entities and simply returns + the unexpanded entity verbatim. +3. :mod:`xmlrpclib` doesn't expand external entities and omits them. + + +billion laughs / exponential entity expansion + The `Billion Laughs`_ attack -- also known as exponential entity expansion -- + uses multiple levels of nested entities. Each entity refers to another entity + several times, the final entity definition contains a small string. Eventually + the small string is expanded to several gigabytes. The exponential expansion + consumes lots of CPU time, too. + +quadratic blowup entity expansion + A quadratic blowup attack is similar to a `Billion Laughs`_ attack; it abuses + entity expansion, too. Instead of nested entities it repeats one large entity + with a couple of thousand chars over and over again. The attack isn't as + efficient as the exponential case but it avoids triggering countermeasures of + parsers against heavily nested entities. + +external entity expansion + Entity declarations can contain more than just text for replacement. They can + also point to external resources by public identifiers or system identifiers. + System identifiers are standard URIs or can refer to local files. The XML + parser retrieves the resource with e.g. HTTP or FTP requests and embeds the + content into the XML document. + +DTD retrieval + Some XML libraries like Python's mod:'xml.dom.pulldom' retrieve document type + definitions from remote or local locations. The feature has similar + implications as the external entity expansion issue. + +decompression bomb + The issue of decompression bombs (aka `ZIP bomb`_) apply to all XML libraries + that can parse compressed XML stream like gzipped HTTP streams or LZMA-ed + files. For an attacker it can reduce the amount of transmitted data by three + magnitudes or more. + +The documentation of `defusedxml`_ on PyPI has further information about +all known attack vectors with examples and references. + +defused packages +---------------- + +`defusedxml`_ is a pure Python package with modified subclasses of all stdlib +XML parsers that prevent any potentially malicious operation. The courses of +action are recommended for any server code that parses untrusted XML data. The +package also ships with example exploits and an extended documentation on more +XML exploits like xpath injection. + +`defusedexpat`_ provides a modified libexpat and patched replacment +:mod:`pyexpat` extension module with countermeasures against entity expansion +DoS attacks. Defusedexpat still allows a sane and configurable amount of entity +expansions. The modifications will be merged into future releases of Python. + +The workarounds and modifications are not included in patch releases as they +break backward compatibility. After all inline DTD and entity expansion are +well-definied XML features. + + +.. _defusedxml: +.. _defusedexpat: +.. _Billion Laughs: http://en.wikipedia.org/wiki/Billion_laughs +.. _ZIP bomb: http://en.wikipedia.org/wiki/Zip_bomb +.. _DTD: http://en.wikipedia.org/wiki/Document_Type_Definition diff --git a/Doc/library/xml.sax.rst b/Doc/library/xml.sax.rst --- a/Doc/library/xml.sax.rst +++ b/Doc/library/xml.sax.rst @@ -16,6 +16,14 @@ SAX exceptions and the convenience functions which will be most used by users of the SAX API. + +.. warning:: + + The :mod:`xml.sax` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + The convenience functions are: diff --git a/Doc/library/xmlrpclib.rst b/Doc/library/xmlrpclib.rst --- a/Doc/library/xmlrpclib.rst +++ b/Doc/library/xmlrpclib.rst @@ -28,6 +28,13 @@ between conformable Python objects and XML on the wire. +.. warning:: + + The :mod:`xmlrpclib` module is not secure against maliciously + constructed data. If you need to parse untrusted or unauthenticated data see + :ref:`xml-vulnerabilities`. + + .. class:: ServerProxy(uri[, transport[, encoding[, verbose[, allow_none[, use_datetime]]]]]) A :class:`ServerProxy` instance is an object that manages communication with a diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -24,6 +24,11 @@ - Issue #17531: Fix tests that thought group and user ids were always the int type. Also, always allow -1 as a valid group and user id. +Documentation +------------- + +- Issue 17538: Document XML vulnerabilties + What's New in Python 2.7.4 release candidate 1 ============================================== -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 15:37:37 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 30 Mar 2013 15:37:37 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fix_XML_vulner?= =?utf-8?q?ability_link_targets=2E?= Message-ID: <3ZdMq55MXlzN1J@mail.python.org> http://hg.python.org/cpython/rev/d73d9dbba4d9 changeset: 83017:d73d9dbba4d9 branch: 2.7 user: Christian Heimes date: Thu Mar 28 11:42:49 2013 +0100 summary: Fix XML vulnerability link targets. files: Doc/library/xml.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst --- a/Doc/library/xml.rst +++ b/Doc/library/xml.rst @@ -124,8 +124,8 @@ well-definied XML features. -.. _defusedxml: -.. _defusedexpat: +.. _defusedxml: https://pypi.python.org/pypi/defusedxml/ +.. _defusedexpat: https://pypi.python.org/pypi/defusedexpat/ .. _Billion Laughs: http://en.wikipedia.org/wiki/Billion_laughs .. _ZIP bomb: http://en.wikipedia.org/wiki/Zip_bomb .. _DTD: http://en.wikipedia.org/wiki/Document_Type_Definition -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 15:37:39 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 30 Mar 2013 15:37:39 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fix_typos_and_?= =?utf-8?q?clear_up_one_very_odd_bit_of_wording_as_pointed_out_by?= Message-ID: <3ZdMq70pqzzNPV@mail.python.org> http://hg.python.org/cpython/rev/7b6bff37259e changeset: 83018:7b6bff37259e branch: 2.7 user: Gregory P. Smith date: Sat Mar 30 01:38:38 2013 -0700 summary: Fix typos and clear up one very odd bit of wording as pointed out by Ezio. files: Doc/library/xml.rst | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst --- a/Doc/library/xml.rst +++ b/Doc/library/xml.rst @@ -108,20 +108,22 @@ defused packages ---------------- +These external packages are recommended for any code that parses +untrusted XML data. + `defusedxml`_ is a pure Python package with modified subclasses of all stdlib -XML parsers that prevent any potentially malicious operation. The courses of -action are recommended for any server code that parses untrusted XML data. The -package also ships with example exploits and an extended documentation on more +XML parsers that prevent any potentially malicious operation. The +package also ships with example exploits and extended documentation on more XML exploits like xpath injection. -`defusedexpat`_ provides a modified libexpat and patched replacment +`defusedexpat`_ provides a modified libexpat and patched replacement :mod:`pyexpat` extension module with countermeasures against entity expansion DoS attacks. Defusedexpat still allows a sane and configurable amount of entity expansions. The modifications will be merged into future releases of Python. The workarounds and modifications are not included in patch releases as they break backward compatibility. After all inline DTD and entity expansion are -well-definied XML features. +well-defined XML features. .. _defusedxml: https://pypi.python.org/pypi/defusedxml/ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 15:37:40 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 30 Mar 2013 15:37:40 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_fall_back_when?= =?utf-8?q?_an_old_test=5Fsupport_doesn=27t_have_various_data_and_function?= =?utf-8?q?s?= Message-ID: <3ZdMq83VpYzNQS@mail.python.org> http://hg.python.org/cpython/rev/de48977f9289 changeset: 83019:de48977f9289 branch: 2.7 user: Benjamin Peterson date: Sat Mar 30 10:36:31 2013 -0400 summary: fall back when an old test_support doesn't have various data and functions (closes #17533) files: Lib/test/pickletester.py | 10 ++++++++-- Misc/NEWS | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -6,8 +6,14 @@ import pickletools import copy_reg -from test.test_support import (TestFailed, have_unicode, TESTFN, _2G, _1M, - precisionbigmemtest) +from test.test_support import TestFailed, verbose, have_unicode, TESTFN +try: + from test.test_support import _2G, _1M, precisionbigmemtest +except ImportError: + # this import might fail when run on older Python versions by test_xpickle + _2G = _1G = 0 + def precisionbigmemtest(*args, **kwargs): + return lambda self: None # Tests that try a number of pickle protocols should have a # for proto in protocols: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -24,6 +24,8 @@ - Issue #17531: Fix tests that thought group and user ids were always the int type. Also, always allow -1 as a valid group and user id. +- Issue #17533: Fix test_xpickle with older versions of Python 2.5. + Documentation ------------- -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 15:37:41 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 30 Mar 2013 15:37:41 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_merge_2=2E7=2E4_release_branch?= Message-ID: <3ZdMq96PVvzNWm@mail.python.org> http://hg.python.org/cpython/rev/bf5ff2a58096 changeset: 83020:bf5ff2a58096 branch: 2.7 parent: 83012:b9de69c715fc parent: 83019:de48977f9289 user: Benjamin Peterson date: Sat Mar 30 10:37:25 2013 -0400 summary: merge 2.7.4 release branch files: Lib/test/pickletester.py | 10 ++++++++-- Misc/NEWS | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -6,8 +6,14 @@ import pickletools import copy_reg -from test.test_support import (TestFailed, have_unicode, TESTFN, _2G, _1M, - precisionbigmemtest) +from test.test_support import TestFailed, verbose, have_unicode, TESTFN +try: + from test.test_support import _2G, _1M, precisionbigmemtest +except ImportError: + # this import might fail when run on older Python versions by test_xpickle + _2G = _1G = 0 + def precisionbigmemtest(*args, **kwargs): + return lambda self: None # Tests that try a number of pickle protocols should have a # for proto in protocols: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -39,6 +39,8 @@ - Issue #17531: Fix tests that thought group and user ids were always the int type. Also, always allow -1 as a valid group and user id. +- Issue #17533: Fix test_xpickle with older versions of Python 2.5. + Documentation ------------- -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 16:34:36 2013 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 30 Mar 2013 16:34:36 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317581=3A_try_to_f?= =?utf-8?q?ix_building_on_old_OpenSSL_versions?= Message-ID: <3ZdP4r4B2KzNHP@mail.python.org> http://hg.python.org/cpython/rev/02f9335b7efb changeset: 83021:02f9335b7efb parent: 83006:ae5c4a9118b8 user: Antoine Pitrou date: Sat Mar 30 16:29:32 2013 +0100 summary: Issue #17581: try to fix building on old OpenSSL versions files: Modules/_ssl.c | 34 +++++++++++++++++++++++++++------- 1 files changed, 27 insertions(+), 7 deletions(-) diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -95,6 +95,15 @@ # define HAVE_TLSv1_2 0 #endif +/* SNI support (client- and server-side) appeared in OpenSSL 0.9.8n. + * This includes the SSL_set_SSL_CTX() function. + */ +#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME +# define HAVE_SNI 1 +#else +# define HAVE_SNI 0 +#endif + enum py_ssl_error { /* these mirror ssl.h */ PY_SSL_ERROR_NONE, @@ -485,7 +494,7 @@ SSL_set_mode(self->ssl, SSL_MODE_AUTO_RETRY); #endif -#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME +#if HAVE_SNI if (server_hostname != NULL) SSL_set_tlsext_host_name(self->ssl, server_hostname); #endif @@ -1195,11 +1204,16 @@ void *closure) { if (PyObject_TypeCheck(value, &PySSLContext_Type)) { - +#if !HAVE_SNI + PyErr_SetString(PyExc_NotImplementedError, "setting a socket's " + "context is not supported by your OpenSSL library"); + return NULL; +#else Py_INCREF(value); Py_DECREF(self->ctx); self->ctx = (PySSLContext *) value; SSL_set_SSL_CTX(self->ssl, self->ctx->ctx); +#endif } else { PyErr_SetString(PyExc_TypeError, "The value must be a SSLContext"); return -1; @@ -2307,7 +2321,7 @@ &sock, &server_side, "idna", &hostname)) return NULL; -#ifndef SSL_CTRL_SET_TLSEXT_HOSTNAME +#if !HAVE_SNI PyMem_Free(hostname); PyErr_SetString(PyExc_ValueError, "server_hostname is not supported " "by your OpenSSL library"); @@ -2400,7 +2414,7 @@ } #endif -#ifndef OPENSSL_NO_TLSEXT +#if HAVE_SNI && !defined(OPENSSL_NO_TLSEXT) static int _servername_callback(SSL *s, int *al, void *args) { @@ -2500,7 +2514,7 @@ static PyObject * set_servername_callback(PySSLContext *self, PyObject *args) { -#ifndef OPENSSL_NO_TLSEXT +#if HAVE_SNI && !defined(OPENSSL_NO_TLSEXT) PyObject *cb; if (!PyArg_ParseTuple(args, "O", &cb)) @@ -2997,10 +3011,16 @@ ADD_AD_CONSTANT(INTERNAL_ERROR); ADD_AD_CONSTANT(USER_CANCELLED); ADD_AD_CONSTANT(NO_RENEGOTIATION); + /* Not all constants are in old OpenSSL versions */ +#ifdef SSL_AD_UNSUPPORTED_EXTENSION ADD_AD_CONSTANT(UNSUPPORTED_EXTENSION); +#endif +#ifdef SSL_AD_CERTIFICATE_UNOBTAINABLE ADD_AD_CONSTANT(CERTIFICATE_UNOBTAINABLE); +#endif +#ifdef SSL_AD_UNRECOGNIZED_NAME ADD_AD_CONSTANT(UNRECOGNIZED_NAME); - /* Not all constants are in old OpenSSL versions */ +#endif #ifdef SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE ADD_AD_CONSTANT(BAD_CERTIFICATE_STATUS_RESPONSE); #endif @@ -3052,7 +3072,7 @@ SSL_OP_NO_COMPRESSION); #endif -#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME +#if HAVE_SNI r = Py_True; #else r = Py_False; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 16:34:38 2013 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 30 Mar 2013 16:34:38 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_Merge?= Message-ID: <3ZdP4t1jlNzNJs@mail.python.org> http://hg.python.org/cpython/rev/096a97f3ffc9 changeset: 83022:096a97f3ffc9 parent: 83021:02f9335b7efb parent: 83014:efb44458afcd user: Antoine Pitrou date: Sat Mar 30 16:29:54 2013 +0100 summary: Merge files: Doc/howto/logging-cookbook.rst | 34 ++++++++++++++ Doc/library/unittest.mock-examples.rst | 6 +- Lib/inspect.py | 2 +- Lib/test/test_inspect.py | 6 ++ Misc/NEWS | 3 + 5 files changed, 47 insertions(+), 4 deletions(-) diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1094,6 +1094,40 @@ string. That's because the __ notation is just syntax sugar for a constructor call to one of the XXXMessage classes. +If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar effect +to the above, as in the following example:: + + import logging + + class Message(object): + def __init__(self, fmt, args): + self.fmt = fmt + self.args = args + + def __str__(self): + return self.fmt.format(*self.args) + + class StyleAdapter(logging.LoggerAdapter): + def __init__(self, logger, extra=None): + super(StyleAdapter, self).__init__(logger, extra or {}) + + def log(self, level, msg, *args, **kwargs): + if self.isEnabledFor(level): + msg, kwargs = self.process(msg, kwargs) + self.logger._log(level, Message(msg, args), (), **kwargs) + + logger = StyleAdapter(logging.getLogger(__name__)) + + def main(): + logger.debug('Hello, {}', 'world!') + + if __name__ == '__main__': + logging.basicConfig(level=logging.DEBUG) + main() + +The above script should log the message ``Hello, world!`` when run with +Python 3.2 or later. + .. currentmodule:: logging diff --git a/Doc/library/unittest.mock-examples.rst b/Doc/library/unittest.mock-examples.rst --- a/Doc/library/unittest.mock-examples.rst +++ b/Doc/library/unittest.mock-examples.rst @@ -338,11 +338,11 @@ ... >>> test() -If you are patching a module (including `__builtin__`) then use `patch` +If you are patching a module (including :mod:`builtins`) then use `patch` instead of `patch.object`: - >>> mock = MagicMock(return_value = sentinel.file_handle) - >>> with patch('__builtin__.open', mock): + >>> mock = MagicMock(return_value=sentinel.file_handle) + >>> with patch('builtins.open', mock): ... handle = open('filename', 'r') ... >>> mock.assert_called_with('filename', 'r') diff --git a/Lib/inspect.py b/Lib/inspect.py --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -550,7 +550,7 @@ file = getfile(object) sourcefile = getsourcefile(object) - if not sourcefile and file[0] + file[-1] != '<>': + if not sourcefile and file[:1] + file[-1:] != '<>': raise OSError('source code not available') file = sourcefile if sourcefile else file diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -416,6 +416,12 @@ finally: del linecache.cache[co.co_filename] + def test_findsource_without_filename(self): + for fname in ['', '']: + co = compile('x=1', fname, "exec") + self.assertRaises(IOError, inspect.findsource, co) + self.assertRaises(IOError, inspect.getsource, co) + class TestNoEOL(GetSourceBase): def __init__(self, *args, **kwargs): self.tempdir = TESTFN + '_dir' diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -297,6 +297,9 @@ Library ------- +- Issue #17526: fix an IndexError raised while passing code without filename to + inspect.findsource(). Initial patch by Tyler Doyle. + - Issue #17540: Added style to formatter configuration by dict. - Issue #16692: The ssl module now supports TLS 1.1 and TLS 1.2. Initial -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 16:41:29 2013 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 30 Mar 2013 16:41:29 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Further_compiling_fixes_?= =?utf-8?q?=28issue_=2317581=29?= Message-ID: <3ZdPDn33gbzMnM@mail.python.org> http://hg.python.org/cpython/rev/ad9effdc0ac3 changeset: 83023:ad9effdc0ac3 user: Antoine Pitrou date: Sat Mar 30 16:36:54 2013 +0100 summary: Further compiling fixes (issue #17581) files: Modules/_ssl.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -1207,7 +1207,7 @@ #if !HAVE_SNI PyErr_SetString(PyExc_NotImplementedError, "setting a socket's " "context is not supported by your OpenSSL library"); - return NULL; + return -1; #else Py_INCREF(value); Py_DECREF(self->ctx); @@ -2542,6 +2542,7 @@ "The TLS extension servername callback, " "SSL_CTX_set_tlsext_servername_callback, " "is not in the current OpenSSL library."); + return NULL; #endif } @@ -2574,8 +2575,10 @@ {"set_ecdh_curve", (PyCFunction) set_ecdh_curve, METH_O, NULL}, #endif +#if HAVE_SNI && !defined(OPENSSL_NO_TLSEXT) {"set_servername_callback", (PyCFunction) set_servername_callback, METH_VARARGS, PySSL_set_servername_callback_doc}, +#endif {NULL, NULL} /* sentinel */ }; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 16:45:00 2013 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 30 Mar 2013 16:45:00 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_previous_fix_=28the_ca?= =?utf-8?q?use_was_actually_a_misplaced_=23endif=2C_or_so_it_seems=29?= Message-ID: <3ZdPJr1J83zNHP@mail.python.org> http://hg.python.org/cpython/rev/fc4f68b51ba0 changeset: 83024:fc4f68b51ba0 user: Antoine Pitrou date: Sat Mar 30 16:39:00 2013 +0100 summary: Fix previous fix (the cause was actually a misplaced #endif, or so it seems) files: Modules/_ssl.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2499,6 +2499,7 @@ #endif return ret; } +#endif PyDoc_STRVAR(PySSL_set_servername_callback_doc, "set_servername_callback(method)\n\ @@ -2509,7 +2510,6 @@ If the argument is None then the callback is disabled. The method is called\n\ with the SSLSocket, the server name as a string, and the SSLContext object.\n\ See RFC 6066 for details of the SNI"); -#endif static PyObject * set_servername_callback(PySSLContext *self, PyObject *args) @@ -2575,10 +2575,8 @@ {"set_ecdh_curve", (PyCFunction) set_ecdh_curve, METH_O, NULL}, #endif -#if HAVE_SNI && !defined(OPENSSL_NO_TLSEXT) {"set_servername_callback", (PyCFunction) set_servername_callback, METH_VARARGS, PySSL_set_servername_callback_doc}, -#endif {NULL, NULL} /* sentinel */ }; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 16:45:01 2013 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 30 Mar 2013 16:45:01 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Improve_set=5Fservername?= =?utf-8?q?=5Fcallback_docstring=2E?= Message-ID: <3ZdPJs4WV5zNHZ@mail.python.org> http://hg.python.org/cpython/rev/b45630913715 changeset: 83025:b45630913715 user: Antoine Pitrou date: Sat Mar 30 16:40:27 2013 +0100 summary: Improve set_servername_callback docstring. files: Modules/_ssl.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2503,13 +2503,13 @@ PyDoc_STRVAR(PySSL_set_servername_callback_doc, "set_servername_callback(method)\n\ -\ +\n\ This sets a callback that will be called when a server name is provided by\n\ the SSL/TLS client in the SNI extension.\n\ -\ +\n\ If the argument is None then the callback is disabled. The method is called\n\ with the SSLSocket, the server name as a string, and the SSLContext object.\n\ -See RFC 6066 for details of the SNI"); +See RFC 6066 for details of the SNI extension."); static PyObject * set_servername_callback(PySSLContext *self, PyObject *args) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 16:49:36 2013 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 30 Mar 2013 16:49:36 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_comment_about_the_Open?= =?utf-8?q?SSL_version_in_which_SNI_version_was_introduced=2E?= Message-ID: <3ZdPQ864t9zMqw@mail.python.org> http://hg.python.org/cpython/rev/411e5726f84d changeset: 83026:411e5726f84d user: Antoine Pitrou date: Sat Mar 30 16:45:04 2013 +0100 summary: Fix comment about the OpenSSL version in which SNI version was introduced. files: Modules/_ssl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -95,7 +95,7 @@ # define HAVE_TLSv1_2 0 #endif -/* SNI support (client- and server-side) appeared in OpenSSL 0.9.8n. +/* SNI support (client- and server-side) appeared in OpenSSL 1.0.0. * This includes the SSL_set_SSL_CTX() function. */ #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 20:12:11 2013 From: python-checkins at python.org (ned.deily) Date: Sat, 30 Mar 2013 20:12:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?devguide=3A_Update_the_devguide_to_re?= =?utf-8?q?flect_workflow_changes_as_a_result_of?= Message-ID: <3ZdTvv0PqCzP25@mail.python.org> http://hg.python.org/devguide/rev/e125591a5f12 changeset: 615:e125591a5f12 user: Ned Deily date: Sat Mar 30 12:11:37 2013 -0700 summary: Update the devguide to reflect workflow changes as a result of the 3.2 branch changing to security-fix-only mode. files: committing.rst | 21 ++++++++------------- devcycle.rst | 17 +++++++++-------- faq.rst | 14 +++++++------- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/committing.rst b/committing.rst --- a/committing.rst +++ b/committing.rst @@ -320,15 +320,10 @@ $ hg import --no-c http://bugs.python.org/url/to/the/patch.diff $ # review, run tests, run `make patchcheck` $ hg ci -m '#12345: fix some issue.' - $ # switch to 3.2 and port the changeset using `hg graft` - $ cd ../3.2 + $ # switch to 3.3 and port the changeset using `hg graft` + $ cd ../3.3 $ hg up $ hg graft 2.7 - $ # switch to 3.3, merge, and commit - $ cd ../3.3 - $ hg up - $ hg merge 3.2 - $ hg ci -m '#12345: merge with 3.2.' $ # switch to 3.x, merge, commit, and push everything $ cd ../3.x $ hg up @@ -404,13 +399,13 @@ Porting changesets between the two major Python versions (2.x and 3.x) ---------------------------------------------------------------------- -Assume you just committed something on ``2.7``, and want to port it to ``3.2``. +Assume you just committed something on ``2.7``, and want to port it to ``3.3``. You can use ``hg graft`` as follow:: - cd ../3.2 + cd ../3.3 hg graft 2.7 -This will port the latest changeset committed in the 2.7 clone to the 3.2 clone. +This will port the latest changeset committed in the 2.7 clone to the 3.3 clone. ``hg graft`` always commits automatically, except in case of conflicts, when you have to resolve them and run ``hg graft --continue`` afterwards. Instead of the branch name you can also specify a changeset id, and you can @@ -418,15 +413,15 @@ On older version of Mercurial where ``hg graft`` is not available, you can use:: - cd ../3.2 + cd ../3.3 hg export 2.7 | hg import - The result will be the same, but in case of conflict this will create ``.rej`` files rather than using Mercurial merge capabilities. -A third option is to apply manually the patch on ``3.2``. This is convenient +A third option is to apply manually the patch on ``3.3``. This is convenient when there are too many differences with ``2.7`` or when there is already a -specific patch for ``3.2``. +specific patch for ``3.3``. .. warning:: Never use ``hg merge`` to port changes between 2.x and 3.x (or vice versa). diff --git a/devcycle.rst b/devcycle.rst --- a/devcycle.rst +++ b/devcycle.rst @@ -31,12 +31,12 @@ '''''''' There is a branch for each *feature version*, whether released or not (e.g. -2.7, 3.2, 3.3). Development is handled separately for Python 2 and Python 3: +2.7, 3.3). Development is handled separately for Python 2 and Python 3: no merging happens between 2.x and 3.x branches. In each of the 2.x and 3.x realms, the branch for a feature version is always a -descendant of the previous feature version: for example, the ``3.2`` branch is a -descendant of the ``3.1`` branch. +descendant of the previous feature version: for example, the ``3.3`` branch is a +descendant of the ``3.2`` branch. Therefore, each change should be made **first** in the oldest branch to which it applies and forward-ported as appropriate: if a bug must be fixed in both Python @@ -77,10 +77,12 @@ discussed first. Sometime after a new maintenance branch is created (after a new *minor version* -is released), the old maintenance branch on that major version (e.g. 3.2.x -after 3.3 gets released) will go into :ref:`security mode `, +is released), the old maintenance branch on that major version will go into +:ref:`security mode `, usually after one last maintenance release at the discretion of the -release manager. +release manager. For example, the 3.2 maintenance branch was put into +:ref:`security mode ` after the 3.2.4 final maintenance release +following the release of 3.3.0. .. _secbranch: @@ -107,8 +109,7 @@ - the ``default`` branch holds the future 3.4 version and descends from ``3.3`` - the ``3.3`` branch holds bug fixes for future 3.3.x maintenance releases and descends from ``3.2`` -- the ``3.2`` branch holds bug fixes for an upcoming final 3.2.4 maintenance - release and then for future 3.2.x security releases +- the ``3.2`` branch holds security fixes for future 3.2.x security releases - the ``3.1`` branch holds security fixes for future 3.1.x security releases - the ``2.7`` branch holds bug fixes for future 2.7.x maintenance releases and descends from ``2.6`` diff --git a/faq.rst b/faq.rst --- a/faq.rst +++ b/faq.rst @@ -174,7 +174,7 @@ git clone git://github.com/akheron/cpython The mirror's master branch tracks the main repository's default branch, -while the maintenance branch names (``2.7``, ``3.2``, etc) are mapped +while the maintenance branch names (``2.7``, ``3.3``, etc) are mapped directly. .. _git mirror: http://github.com/akheron/cpython @@ -796,14 +796,14 @@ How do I make a null merge? ''''''''''''''''''''''''''' -If you committed something (e.g. on 3.2) that shouldn't be ported on newer -branches (e.g. on 3.3), you have to do a *null merge*:: +If you committed something (e.g. on 3.3) that shouldn't be ported on newer +branches (e.g. on default), you have to do a *null merge*:: - cd 3.3 - hg merge 3.2 - hg revert -ar 3.3 + cd 3.x + hg merge 3.3 + hg revert -ar default hg resolve -am # needed only if the merge created conflicts - hg ci -m '#12345: null merge with 3.2.' + hg ci -m '#12345: null merge with 3.3.' Before committing, ``hg status`` should list all the merged files as ``M``, but ``hg diff`` should produce no output. This will record the merge without -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Sat Mar 30 20:31:48 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 30 Mar 2013 20:31:48 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogRyAtPiBNIChjbG9z?= =?utf-8?q?es_=2317533=29?= Message-ID: <3ZdVLX5zJczMjB@mail.python.org> http://hg.python.org/cpython/rev/be0586ebb842 changeset: 83027:be0586ebb842 branch: 2.7 parent: 83019:de48977f9289 user: Benjamin Peterson date: Sat Mar 30 15:30:28 2013 -0400 summary: G -> M (closes #17533) files: Lib/test/pickletester.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -11,7 +11,7 @@ from test.test_support import _2G, _1M, precisionbigmemtest except ImportError: # this import might fail when run on older Python versions by test_xpickle - _2G = _1G = 0 + _2G = _1M = 0 def precisionbigmemtest(*args, **kwargs): return lambda self: None -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 20:31:50 2013 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 30 Mar 2013 20:31:50 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_merge_2=2E7=2E4_release_branch?= Message-ID: <3ZdVLZ1MCGzNDP@mail.python.org> http://hg.python.org/cpython/rev/f3032825f637 changeset: 83028:f3032825f637 branch: 2.7 parent: 83020:bf5ff2a58096 parent: 83027:be0586ebb842 user: Benjamin Peterson date: Sat Mar 30 15:31:31 2013 -0400 summary: merge 2.7.4 release branch files: Lib/test/pickletester.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -11,7 +11,7 @@ from test.test_support import _2G, _1M, precisionbigmemtest except ImportError: # this import might fail when run on older Python versions by test_xpickle - _2G = _1G = 0 + _2G = _1M = 0 def precisionbigmemtest(*args, **kwargs): return lambda self: None -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 22:23:22 2013 From: python-checkins at python.org (r.david.murray) Date: Sat, 30 Mar 2013 22:23:22 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE3NDM1?= =?utf-8?q?=3A_Don=27t_use_mutable_default_values_in_Timer=2E?= Message-ID: <3ZdXqG17fCzNN8@mail.python.org> http://hg.python.org/cpython/rev/2698920eadcd changeset: 83029:2698920eadcd branch: 3.3 parent: 83013:7fd5d9fe9f71 user: R David Murray date: Sat Mar 30 17:19:38 2013 -0400 summary: Issue #17435: Don't use mutable default values in Timer. Patch by Denver Coneybeare with some test modifications by me. files: Doc/library/threading.rst | 4 ++- Lib/test/test_threading.py | 39 ++++++++++++++++++-------- Lib/threading.py | 8 ++-- Misc/NEWS | 3 ++ 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -839,10 +839,12 @@ t.start() # after 30 seconds, "hello, world" will be printed -.. class:: Timer(interval, function, args=[], kwargs={}) +.. class:: Timer(interval, function, args=None, kwargs=None) Create a timer that will run *function* with arguments *args* and keyword arguments *kwargs*, after *interval* seconds have passed. + If *args* is None (the default) then an empty list will be used. + If *kwargs* is None (the default) then an empty dict will be used. .. versionchanged:: 3.3 changed from a factory function to a class. diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -786,6 +786,32 @@ self.assertEqual(p.returncode, 0, "Unexpected error: " + stderr.decode()) self.assertEqual(data, expected_output) +class TimerTests(BaseTestCase): + + def setUp(self): + BaseTestCase.setUp(self) + self.callback_args = [] + self.callback_event = threading.Event() + + def test_init_immutable_default_args(self): + # Issue 17435: constructor defaults were mutable objects, they could be + # mutated via the object attributes and affect other Timer objects. + timer1 = threading.Timer(0.01, self._callback_spy) + timer1.start() + self.callback_event.wait() + timer1.args.append("blah") + timer1.kwargs["foo"] = "bar" + self.callback_event.clear() + timer2 = threading.Timer(0.01, self._callback_spy) + timer2.start() + self.callback_event.wait() + self.assertEqual(len(self.callback_args), 2) + self.assertEqual(self.callback_args, [((), {}), ((), {})]) + + def _callback_spy(self, *args, **kwargs): + self.callback_args.append((args[:], kwargs.copy())) + self.callback_event.set() + class LockTests(lock_tests.LockTests): locktype = staticmethod(threading.Lock) @@ -815,16 +841,5 @@ class BarrierTests(lock_tests.BarrierTests): barriertype = staticmethod(threading.Barrier) - -def test_main(): - test.support.run_unittest(LockTests, PyRLockTests, CRLockTests, EventTests, - ConditionAsRLockTests, ConditionTests, - SemaphoreTests, BoundedSemaphoreTests, - ThreadTests, - ThreadJoinOnShutdown, - ThreadingExceptionTests, - BarrierTests, - ) - if __name__ == "__main__": - test_main() + unittest.main() diff --git a/Lib/threading.py b/Lib/threading.py --- a/Lib/threading.py +++ b/Lib/threading.py @@ -802,17 +802,17 @@ class Timer(Thread): """Call a function after a specified number of seconds: - t = Timer(30.0, f, args=[], kwargs={}) + t = Timer(30.0, f, args=None, kwargs=None) t.start() t.cancel() # stop the timer's action if it's still waiting """ - def __init__(self, interval, function, args=[], kwargs={}): + def __init__(self, interval, function, args=None, kwargs=None): Thread.__init__(self) self.interval = interval self.function = function - self.args = args - self.kwargs = kwargs + self.args = args if args is not None else [] + self.kwargs = kwargs if kwargs is not None else {} self.finished = Event() def cancel(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -15,6 +15,9 @@ Library ------- +- Issue #17435: threading.Timer's __init__ method no longer uses mutable + default values for the args and kwargs parameters. + - Issue #17526: fix an IndexError raised while passing code without filename to inspect.findsource(). Initial patch by Tyler Doyle. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 22:23:23 2013 From: python-checkins at python.org (r.david.murray) Date: Sat, 30 Mar 2013 22:23:23 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_=2317435=3A_Don=27t_use_mutable_default_values_in_?= =?utf-8?q?Timer=2E?= Message-ID: <3ZdXqH5LLTzNhQ@mail.python.org> http://hg.python.org/cpython/rev/8c15e57830dd changeset: 83030:8c15e57830dd parent: 83026:411e5726f84d parent: 83029:2698920eadcd user: R David Murray date: Sat Mar 30 17:22:30 2013 -0400 summary: Merge #17435: Don't use mutable default values in Timer. Patch by Denver Coneybeare with some test modifications by me. files: Doc/library/threading.rst | 4 ++- Lib/test/test_threading.py | 39 ++++++++++++++++++-------- Lib/threading.py | 8 ++-- Misc/NEWS | 3 ++ 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -839,10 +839,12 @@ t.start() # after 30 seconds, "hello, world" will be printed -.. class:: Timer(interval, function, args=[], kwargs={}) +.. class:: Timer(interval, function, args=None, kwargs=None) Create a timer that will run *function* with arguments *args* and keyword arguments *kwargs*, after *interval* seconds have passed. + If *args* is None (the default) then an empty list will be used. + If *kwargs* is None (the default) then an empty dict will be used. .. versionchanged:: 3.3 changed from a factory function to a class. diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -787,6 +787,32 @@ self.assertEqual(p.returncode, 0, "Unexpected error: " + stderr.decode()) self.assertEqual(data, expected_output) +class TimerTests(BaseTestCase): + + def setUp(self): + BaseTestCase.setUp(self) + self.callback_args = [] + self.callback_event = threading.Event() + + def test_init_immutable_default_args(self): + # Issue 17435: constructor defaults were mutable objects, they could be + # mutated via the object attributes and affect other Timer objects. + timer1 = threading.Timer(0.01, self._callback_spy) + timer1.start() + self.callback_event.wait() + timer1.args.append("blah") + timer1.kwargs["foo"] = "bar" + self.callback_event.clear() + timer2 = threading.Timer(0.01, self._callback_spy) + timer2.start() + self.callback_event.wait() + self.assertEqual(len(self.callback_args), 2) + self.assertEqual(self.callback_args, [((), {}), ((), {})]) + + def _callback_spy(self, *args, **kwargs): + self.callback_args.append((args[:], kwargs.copy())) + self.callback_event.set() + class LockTests(lock_tests.LockTests): locktype = staticmethod(threading.Lock) @@ -816,16 +842,5 @@ class BarrierTests(lock_tests.BarrierTests): barriertype = staticmethod(threading.Barrier) - -def test_main(): - test.support.run_unittest(LockTests, PyRLockTests, CRLockTests, EventTests, - ConditionAsRLockTests, ConditionTests, - SemaphoreTests, BoundedSemaphoreTests, - ThreadTests, - ThreadJoinOnShutdown, - ThreadingExceptionTests, - BarrierTests, - ) - if __name__ == "__main__": - test_main() + unittest.main() diff --git a/Lib/threading.py b/Lib/threading.py --- a/Lib/threading.py +++ b/Lib/threading.py @@ -807,17 +807,17 @@ class Timer(Thread): """Call a function after a specified number of seconds: - t = Timer(30.0, f, args=[], kwargs={}) + t = Timer(30.0, f, args=None, kwargs=None) t.start() t.cancel() # stop the timer's action if it's still waiting """ - def __init__(self, interval, function, args=[], kwargs={}): + def __init__(self, interval, function, args=None, kwargs=None): Thread.__init__(self) self.interval = interval self.function = function - self.args = args - self.kwargs = kwargs + self.args = args if args is not None else [] + self.kwargs = kwargs if kwargs is not None else {} self.finished = Event() def cancel(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -297,6 +297,9 @@ Library ------- +- Issue #17435: threading.Timer's __init__ method no longer uses mutable + default values for the args and kwargs parameters. + - Issue #17526: fix an IndexError raised while passing code without filename to inspect.findsource(). Initial patch by Tyler Doyle. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 23:19:11 2013 From: python-checkins at python.org (richard.jones) Date: Sat, 30 Mar 2013 23:19:11 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?peps=3A_move_references_for_future_di?= =?utf-8?q?scussions_from_catalog-sig_to_distutils-sig?= Message-ID: <3ZdZ3g29h6zNKy@mail.python.org> http://hg.python.org/peps/rev/0020f2026cfe changeset: 4830:0020f2026cfe user: Richard Jones date: Sun Mar 31 09:18:51 2013 +1100 summary: move references for future discussions from catalog-sig to distutils-sig files: pep-0381.txt | 14 +++++++------- pep-0438.txt | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pep-0381.txt b/pep-0381.txt --- a/pep-0381.txt +++ b/pep-0381.txt @@ -20,7 +20,7 @@ Rationale ========= -PyPI is hosting over 6000 projects and is used on a daily basis +PyPI is hosting over 6000 projects and is used on a daily basis by people to build applications. Especially systems like `easy_install` and `zc.buildout` make intensive usage of PyPI. @@ -56,7 +56,7 @@ with b. A CNAME record last.pypi.python.org points to the last host name. Mirror operators should use a static address, and report planned changes to that address in advance to -catalog-sig. +distutils-sig. The new mirror also appears at `http://pypi.python.org/mirrors` which is a human-readable page that gives the list of mirrors. @@ -65,11 +65,11 @@ Statistics page ::::::::::::::: -PyPI provides statistics on downloads at `/stats`. This page is -calculated daily by PyPI, by reading all mirrors' local stats and +PyPI provides statistics on downloads at `/stats`. This page is +calculated daily by PyPI, by reading all mirrors' local stats and summing them. -The stats are presented in daily or montly files, under `/stats/days` +The stats are presented in daily or montly files, under `/stats/days` and `/stats/months`. Each file is a `bzip2` file with these formats: - YYYY-MM-DD.bz2 for daily files @@ -164,7 +164,7 @@ The date is provided in GMT time, using the ISO 8601 format [#iso8601]_. Each mirror will be responsible to maintain its last modified date. -This page must be located at : `/last-modified` and must be a +This page must be located at : `/last-modified` and must be a text/plain page. Local statistics @@ -232,7 +232,7 @@ The pep381client package [#pep381client]_ provides an application that respects this protocol to browse PyPI. -User-agent request header +User-agent request header ::::::::::::::::::::::::: In order to be able to differentiate actions taken by clients over diff --git a/pep-0438.txt b/pep-0438.txt --- a/pep-0438.txt +++ b/pep-0438.txt @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: Holger Krekel , Carl Meyer BDFL-Delegate: Richard Jones -Discussions-To: catalog-sig at python.org +Discussions-To: distutils-sig at python.org Status: Draft Type: Process Content-Type: text/x-rst -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sat Mar 30 23:51:20 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 30 Mar 2013 23:51:20 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzE3Mzkw?= =?utf-8?q?=3A_Display_Python_version_on_Idle_title_bar=2E_Patch_by_Edmond?= =?utf-8?q?_Burnett=2E?= Message-ID: <3ZdZmm1nV4zNlv@mail.python.org> http://hg.python.org/cpython/rev/74d9a9507019 changeset: 83031:74d9a9507019 branch: 3.3 parent: 83029:2698920eadcd user: Terry Jan Reedy date: Sat Mar 30 18:32:19 2013 -0400 summary: Issue #17390: Display Python version on Idle title bar. Patch by Edmond Burnett. files: Lib/idlelib/NEWS.txt | 7 +++++++ Lib/idlelib/PyShell.py | 3 ++- 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -1,3 +1,10 @@ +What's New in IDLE 3.3.2? +========================= + +- Issue #17390: Display Python version on Idle title bar. + Initial patch by Edmond Burnett. + + What's New in IDLE 3.3.1? ========================= diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -16,6 +16,7 @@ import linecache from code import InteractiveInterpreter +from platform import python_version try: from tkinter import * @@ -799,7 +800,7 @@ class PyShell(OutputWindow): - shell_title = "Python Shell" + shell_title = "Python " + python_version() + " Shell" # Override classes ColorDelegator = ModifiedColorDelegator -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 23:51:21 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 30 Mar 2013 23:51:21 +0100 (CET) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E3=3A_Issue_=2317390?= Message-ID: <3ZdZmn4vMrzPVY@mail.python.org> http://hg.python.org/cpython/rev/e0f66c924544 changeset: 83032:e0f66c924544 parent: 83030:8c15e57830dd parent: 83031:74d9a9507019 user: Terry Jan Reedy date: Sat Mar 30 18:39:14 2013 -0400 summary: Merge from 3.3: Issue #17390 files: Lib/idlelib/NEWS.txt | 3 +++ Lib/idlelib/PyShell.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -1,6 +1,9 @@ What's New in IDLE 3.4.0? ========================= +- Issue #17390: Display Python version on Idle title bar. + Initial patch by Edmond Burnett. + - Issue #5066: Update IDLE docs. Patch by Todd Rovito. - Issue #16226: Fix IDLE Path Browser crash. diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -16,6 +16,7 @@ import linecache from code import InteractiveInterpreter +from platform import python_version try: from tkinter import * @@ -799,7 +800,7 @@ class PyShell(OutputWindow): - shell_title = "Python Shell" + shell_title = "Python " + python_version() + " Shell" # Override classes ColorDelegator = ModifiedColorDelegator -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Mar 30 23:51:23 2013 From: python-checkins at python.org (terry.reedy) Date: Sat, 30 Mar 2013 23:51:23 +0100 (CET) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE3Mzkw?= =?utf-8?q?=3A_Display_Python_version_on_Idle_title_bar=2E_Patch_by_Edmond?= =?utf-8?q?_Burnett=2E?= Message-ID: <3ZdZmq0P8GzPPD@mail.python.org> http://hg.python.org/cpython/rev/225022955c65 changeset: 83033:225022955c65 branch: 2.7 parent: 83028:f3032825f637 user: Terry Jan Reedy date: Sat Mar 30 18:50:43 2013 -0400 summary: Issue #17390: Display Python version on Idle title bar. Patch by Edmond Burnett. files: Lib/idlelib/NEWS.txt | 7 +++++++ Lib/idlelib/PyShell.py | 3 ++- 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -1,3 +1,10 @@ +What's New in IDLE 2.7.5? +========================= + +- Issue #17390: Display Python version on Idle title bar. + Initial patch by Edmond Burnett. + + What's New in IDLE 2.7.4? ========================= diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -15,6 +15,7 @@ import linecache from code import InteractiveInterpreter +from platform import python_version try: from Tkinter import * @@ -821,7 +822,7 @@ class PyShell(OutputWindow): - shell_title = "Python Shell" + shell_title = "Python " + python_version() + " Shell" # Override classes ColorDelegator = ModifiedColorDelegator -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sun Mar 31 05:52:28 2013 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 31 Mar 2013 05:52:28 +0200 Subject: [Python-checkins] Daily reference leaks (e0f66c924544): sum=0 Message-ID: results for e0f66c924544 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogybRqf4', '-x'] From python-checkins at python.org Sun Mar 31 08:18:30 2013 From: python-checkins at python.org (roger.serwy) Date: Sun, 31 Mar 2013 08:18:30 +0200 (CEST) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzY2NDk6IEZpeGVk?= =?utf-8?q?_missing_exit_status_in_IDLE=2E_Patch_by_Guilherme_Polo=2E?= Message-ID: <3Zdmhk6fFDzPs7@mail.python.org> http://hg.python.org/cpython/rev/e044d22d2f61 changeset: 83034:e044d22d2f61 branch: 2.7 user: Roger Serwy date: Sun Mar 31 00:57:16 2013 -0500 summary: #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. files: Lib/idlelib/rpc.py | 2 +- Misc/NEWS | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py --- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -144,7 +144,7 @@ def exithook(self): "override for specific exit action" - os._exit() + os._exit(0) def debug(self, *args): if not self.debugging: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,8 @@ Library ------- +- Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. + - Issue #17526: fix an IndexError raised while passing code without filename to inspect.findsource(). Initial patch by Tyler Doyle. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 31 08:18:32 2013 From: python-checkins at python.org (roger.serwy) Date: Sun, 31 Mar 2013 08:18:32 +0200 (CEST) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzY2NDk6IEZpeGVk?= =?utf-8?q?_missing_exit_status_in_IDLE=2E_Patch_by_Guilherme_Polo=2E?= Message-ID: <3Zdmhm2fZKzPsh@mail.python.org> http://hg.python.org/cpython/rev/cd2c613527ed changeset: 83035:cd2c613527ed branch: 3.3 parent: 83031:74d9a9507019 user: Roger Serwy date: Sun Mar 31 01:00:15 2013 -0500 summary: #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. files: Lib/idlelib/rpc.py | 2 +- Misc/NEWS | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py --- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -145,7 +145,7 @@ def exithook(self): "override for specific exit action" - os._exit() + os._exit(0) def debug(self, *args): if not self.debugging: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -15,6 +15,8 @@ Library ------- +- Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. + - Issue #17435: threading.Timer's __init__ method no longer uses mutable default values for the args and kwargs parameters. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 31 08:18:33 2013 From: python-checkins at python.org (roger.serwy) Date: Sun, 31 Mar 2013 08:18:33 +0200 (CEST) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzY2NDk6IG1lcmdlIHdpdGggMy4zLg==?= Message-ID: <3Zdmhn5JsBzQ2R@mail.python.org> http://hg.python.org/cpython/rev/abbbe1f90635 changeset: 83036:abbbe1f90635 parent: 83032:e0f66c924544 parent: 83035:cd2c613527ed user: Roger Serwy date: Sun Mar 31 01:11:26 2013 -0500 summary: #6649: merge with 3.3. files: Lib/idlelib/rpc.py | 2 +- Misc/NEWS | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py --- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -145,7 +145,7 @@ def exithook(self): "override for specific exit action" - os._exit() + os._exit(0) def debug(self, *args): if not self.debugging: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -297,6 +297,8 @@ Library ------- +- Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. + - Issue #17435: threading.Timer's __init__ method no longer uses mutable default values for the args and kwargs parameters. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 31 08:38:04 2013 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 31 Mar 2013 08:38:04 +0200 (CEST) Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Add_an_itertoo?= =?utf-8?b?bHMgcmVjaXBlIHNob3dpbmcgaG93IHRvIHVzZSB0Ll9fY29weV9fKCku?= Message-ID: <3Zdn7J53MYzPt5@mail.python.org> http://hg.python.org/cpython/rev/1026b1d47f30 changeset: 83037:1026b1d47f30 branch: 2.7 parent: 83034:e044d22d2f61 user: Raymond Hettinger date: Sat Mar 30 23:37:57 2013 -0700 summary: Add an itertools recipe showing how to use t.__copy__(). files: Doc/library/itertools.rst | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -828,6 +828,18 @@ indices = sorted(random.randrange(n) for i in xrange(r)) return tuple(pool[i] for i in indices) + def tee_lookahead(t, i): + """Inspect the i-th upcomping value from a tee object + while leaving the tee object at its current position. + + Raise an IndexError if the underlying iterator doesn't + have enough values. + + """ + for value in islice(t.__copy__(), i, None): + return value + raise IndexError(i) + Note, many of the above recipes can be optimized by replacing global lookups with local variables defined as default values. For example, the *dotproduct* recipe can be written as:: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 31 19:26:05 2013 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 31 Mar 2013 19:26:05 +0200 (CEST) Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E3=29=3A_Skip_a_test_of?= =?utf-8?q?_an_old_API_on_ARM_Linux_that_isn=27t_supported_by_the_OS=2E?= Message-ID: <3Zf3W13sc0zMtV@mail.python.org> http://hg.python.org/cpython/rev/8324e63fc7a2 changeset: 83038:8324e63fc7a2 branch: 3.3 parent: 83035:cd2c613527ed user: Gregory P. Smith date: Sun Mar 31 10:10:50 2013 -0700 summary: Skip a test of an old API on ARM Linux that isn't supported by the OS. files: Lib/test/test_fcntl.py | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_fcntl.py b/Lib/test/test_fcntl.py --- a/Lib/test/test_fcntl.py +++ b/Lib/test/test_fcntl.py @@ -3,6 +3,7 @@ OS/2+EMX doesn't support the file locking operations. """ +import platform import os import struct import sys @@ -97,6 +98,9 @@ self.assertRaises(OverflowError, fcntl.fcntl, F(_testcapi.INT_MIN - 1), fcntl.F_SETFL, os.O_NONBLOCK) + @unittest.skipIf( + platform.machine().startswith('arm') and platform.system() == 'Linux', + "ARM Linux returns EINVAL for F_NOTIFY DN_MULTISHOT") def test_fcntl_64_bit(self): # Issue #1309352: fcntl shouldn't fail when the third arg fits in a # C 'long' but not in a C 'int'. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 31 19:26:06 2013 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 31 Mar 2013 19:26:06 +0200 (CEST) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_skip_a_fcntl_test_on_ARM_Linux_that_isn=27t_supported_th?= =?utf-8?q?ere=2E?= Message-ID: <3Zf3W26TYbzMyr@mail.python.org> http://hg.python.org/cpython/rev/fcb6c7119899 changeset: 83039:fcb6c7119899 parent: 83036:abbbe1f90635 parent: 83038:8324e63fc7a2 user: Gregory P. Smith date: Sun Mar 31 10:25:42 2013 -0700 summary: skip a fcntl test on ARM Linux that isn't supported there. files: Lib/test/test_fcntl.py | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_fcntl.py b/Lib/test/test_fcntl.py --- a/Lib/test/test_fcntl.py +++ b/Lib/test/test_fcntl.py @@ -1,5 +1,6 @@ """Test program for the fcntl C module. """ +import platform import os import struct import sys @@ -90,6 +91,9 @@ self.assertRaises(OverflowError, fcntl.fcntl, F(_testcapi.INT_MIN - 1), fcntl.F_SETFL, os.O_NONBLOCK) + @unittest.skipIf( + platform.machine().startswith('arm') and platform.system() == 'Linux', + "ARM Linux returns EINVAL for F_NOTIFY DN_MULTISHOT") def test_fcntl_64_bit(self): # Issue #1309352: fcntl shouldn't fail when the third arg fits in a # C 'long' but not in a C 'int'. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 31 19:46:17 2013 From: python-checkins at python.org (georg.brandl) Date: Sun, 31 Mar 2013 19:46:17 +0200 (CEST) Subject: [Python-checkins] =?utf-8?q?devguide=3A_Clarify_policy_for_securi?= =?utf-8?q?ty_branches=2E_List_RMs_for_active_branches=2E?= Message-ID: <3Zf3yK4RvvzNhQ@mail.python.org> http://hg.python.org/devguide/rev/3b30c415c9a5 changeset: 616:3b30c415c9a5 user: Georg Brandl date: Sun Mar 31 19:46:14 2013 +0200 summary: Clarify policy for security branches. List RMs for active branches. files: devcycle.rst | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/devcycle.rst b/devcycle.rst --- a/devcycle.rst +++ b/devcycle.rst @@ -93,10 +93,13 @@ The only changes made to a security branch are those fixing issues exploitable by attackers such as crashes, privilege escalation and, optionally, other -issues such as denial of service attacks. Other behavioral issues are +issues such as denial of service attacks. Any other changes are **not** considered a security risk and thus not backported to a security branch. -Any release made from a security branch is source-only and done only when -actual security patches have been applied to the branch. + +Commits to security branches are to be coordinated with the release manager +for the corresponding feature version, as listed below in the Summary_. +Any release made from a security branch is source-only and done only when actual +security patches have been applied to the branch. .. _listbranch: @@ -104,16 +107,20 @@ Summary ------- -There are 6 open branches right now in the Mercurial repository: +There are 6 active branches right now in the Mercurial repository: - the ``default`` branch holds the future 3.4 version and descends from ``3.3`` + (future RM: Larry Hastings) - the ``3.3`` branch holds bug fixes for future 3.3.x maintenance releases - and descends from ``3.2`` + and descends from ``3.2`` (RM: Georg Brandl) - the ``3.2`` branch holds security fixes for future 3.2.x security releases + (RM: Georg Brandl) - the ``3.1`` branch holds security fixes for future 3.1.x security releases + (RM: Benjamin Peterson) - the ``2.7`` branch holds bug fixes for future 2.7.x maintenance releases and - descends from ``2.6`` + descends from ``2.6`` (RM: Benjamin Peterson) - the ``2.6`` branch holds security fixes for future 2.6.x security releases + (RM: Barry Warsaw) .. _stages: -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Sun Mar 31 20:38:59 2013 From: python-checkins at python.org (charles-francois.natali) Date: Sun, 31 Mar 2013 20:38:59 +0200 (CEST) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzY0MTk6?= =?utf-8?q?_Fix_a_test=5Fkqueue_failure_on_some_BSD_flavors=2E?= Message-ID: <3Zf5776xrBzNg2@mail.python.org> http://hg.python.org/cpython/rev/cfd4cd15809e changeset: 83040:cfd4cd15809e branch: 2.7 parent: 83037:1026b1d47f30 user: Charles-Francois Natali date: Sun Mar 31 20:35:59 2013 +0200 summary: Issue #6419: Fix a test_kqueue failure on some BSD flavors. files: Lib/test/test_kqueue.py | 35 ++++++++++------------------ 1 files changed, 13 insertions(+), 22 deletions(-) diff --git a/Lib/test/test_kqueue.py b/Lib/test/test_kqueue.py --- a/Lib/test/test_kqueue.py +++ b/Lib/test/test_kqueue.py @@ -96,11 +96,6 @@ pass # FreeBSD doesn't raise an exception here server, addr = serverSocket.accept() - if sys.platform.startswith("darwin"): - flags = select.KQ_EV_ADD | select.KQ_EV_ENABLE - else: - flags = 0 - kq = select.kqueue() kq2 = select.kqueue.fromfd(kq.fileno()) @@ -122,11 +117,10 @@ kq2.control([ev], 0) events = kq.control(None, 4, 1) - events = [(e.ident, e.filter, e.flags) for e in events] - events.sort() - self.assertEqual(events, [ - (client.fileno(), select.KQ_FILTER_WRITE, flags), - (server.fileno(), select.KQ_FILTER_WRITE, flags)]) + events = set((e.ident, e.filter) for e in events) + self.assertEqual(events, set([ + (client.fileno(), select.KQ_FILTER_WRITE), + (server.fileno(), select.KQ_FILTER_WRITE)])) client.send("Hello!") server.send("world!!!") @@ -140,14 +134,12 @@ else: self.fail('timeout waiting for event notifications') - events = [(e.ident, e.filter, e.flags) for e in events] - events.sort() - - self.assertEqual(events, [ - (client.fileno(), select.KQ_FILTER_WRITE, flags), - (client.fileno(), select.KQ_FILTER_READ, flags), - (server.fileno(), select.KQ_FILTER_WRITE, flags), - (server.fileno(), select.KQ_FILTER_READ, flags)]) + events = set((e.ident, e.filter) for e in events) + self.assertEqual(events, set([ + (client.fileno(), select.KQ_FILTER_WRITE), + (client.fileno(), select.KQ_FILTER_READ), + (server.fileno(), select.KQ_FILTER_WRITE), + (server.fileno(), select.KQ_FILTER_READ)])) # Remove completely client, and server read part ev = select.kevent(client.fileno(), @@ -164,10 +156,9 @@ kq.control([ev], 0, 0) events = kq.control([], 4, 0.99) - events = [(e.ident, e.filter, e.flags) for e in events] - events.sort() - self.assertEqual(events, [ - (server.fileno(), select.KQ_FILTER_WRITE, flags)]) + events = set((e.ident, e.filter) for e in events) + self.assertEqual(events, set([ + (server.fileno(), select.KQ_FILTER_WRITE)])) client.close() server.close() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 31 20:39:01 2013 From: python-checkins at python.org (charles-francois.natali) Date: Sun, 31 Mar 2013 20:39:01 +0200 (CEST) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogSXNzdWUgIzY0MTk6?= =?utf-8?q?_Fix_a_test=5Fkqueue_failure_on_some_BSD_flavors=2E?= Message-ID: <3Zf5792lrXzNSH@mail.python.org> http://hg.python.org/cpython/rev/96776fc3cbcc changeset: 83041:96776fc3cbcc branch: 3.3 parent: 83038:8324e63fc7a2 user: Charles-Francois Natali date: Sun Mar 31 20:36:57 2013 +0200 summary: Issue #6419: Fix a test_kqueue failure on some BSD flavors. files: Lib/test/test_kqueue.py | 35 ++++++++++------------------ 1 files changed, 13 insertions(+), 22 deletions(-) diff --git a/Lib/test/test_kqueue.py b/Lib/test/test_kqueue.py --- a/Lib/test/test_kqueue.py +++ b/Lib/test/test_kqueue.py @@ -101,11 +101,6 @@ pass # FreeBSD doesn't raise an exception here server, addr = serverSocket.accept() - if sys.platform.startswith("darwin"): - flags = select.KQ_EV_ADD | select.KQ_EV_ENABLE - else: - flags = 0 - kq = select.kqueue() kq2 = select.kqueue.fromfd(kq.fileno()) @@ -127,11 +122,10 @@ kq2.control([ev], 0) events = kq.control(None, 4, 1) - events = [(e.ident, e.filter, e.flags) for e in events] - events.sort() - self.assertEqual(events, [ - (client.fileno(), select.KQ_FILTER_WRITE, flags), - (server.fileno(), select.KQ_FILTER_WRITE, flags)]) + events = set((e.ident, e.filter) for e in events) + self.assertEqual(events, set([ + (client.fileno(), select.KQ_FILTER_WRITE), + (server.fileno(), select.KQ_FILTER_WRITE)])) client.send(b"Hello!") server.send(b"world!!!") @@ -145,14 +139,12 @@ else: self.fail('timeout waiting for event notifications') - events = [(e.ident, e.filter, e.flags) for e in events] - events.sort() - - self.assertEqual(events, [ - (client.fileno(), select.KQ_FILTER_WRITE, flags), - (client.fileno(), select.KQ_FILTER_READ, flags), - (server.fileno(), select.KQ_FILTER_WRITE, flags), - (server.fileno(), select.KQ_FILTER_READ, flags)]) + events = set((e.ident, e.filter) for e in events) + self.assertEqual(events, set([ + (client.fileno(), select.KQ_FILTER_WRITE), + (client.fileno(), select.KQ_FILTER_READ), + (server.fileno(), select.KQ_FILTER_WRITE), + (server.fileno(), select.KQ_FILTER_READ)])) # Remove completely client, and server read part ev = select.kevent(client.fileno(), @@ -169,10 +161,9 @@ kq.control([ev], 0, 0) events = kq.control([], 4, 0.99) - events = [(e.ident, e.filter, e.flags) for e in events] - events.sort() - self.assertEqual(events, [ - (server.fileno(), select.KQ_FILTER_WRITE, flags)]) + events = set((e.ident, e.filter) for e in events) + self.assertEqual(events, set([ + (server.fileno(), select.KQ_FILTER_WRITE)])) client.close() server.close() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 31 20:39:02 2013 From: python-checkins at python.org (charles-francois.natali) Date: Sun, 31 Mar 2013 20:39:02 +0200 (CEST) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?q?=29=3A_Issue_=236419=3A_Fix_a_test=5Fkqueue_failure_on_some_BSD?= =?utf-8?q?_flavors=2E?= Message-ID: <3Zf57B5WykzNyf@mail.python.org> http://hg.python.org/cpython/rev/0c9415ddf403 changeset: 83042:0c9415ddf403 parent: 83039:fcb6c7119899 parent: 83041:96776fc3cbcc user: Charles-Francois Natali date: Sun Mar 31 20:37:34 2013 +0200 summary: Issue #6419: Fix a test_kqueue failure on some BSD flavors. files: Lib/test/test_kqueue.py | 35 ++++++++++------------------ 1 files changed, 13 insertions(+), 22 deletions(-) diff --git a/Lib/test/test_kqueue.py b/Lib/test/test_kqueue.py --- a/Lib/test/test_kqueue.py +++ b/Lib/test/test_kqueue.py @@ -101,11 +101,6 @@ pass # FreeBSD doesn't raise an exception here server, addr = serverSocket.accept() - if sys.platform.startswith("darwin"): - flags = select.KQ_EV_ADD | select.KQ_EV_ENABLE - else: - flags = 0 - kq = select.kqueue() kq2 = select.kqueue.fromfd(kq.fileno()) @@ -127,11 +122,10 @@ kq2.control([ev], 0) events = kq.control(None, 4, 1) - events = [(e.ident, e.filter, e.flags) for e in events] - events.sort() - self.assertEqual(events, [ - (client.fileno(), select.KQ_FILTER_WRITE, flags), - (server.fileno(), select.KQ_FILTER_WRITE, flags)]) + events = set((e.ident, e.filter) for e in events) + self.assertEqual(events, set([ + (client.fileno(), select.KQ_FILTER_WRITE), + (server.fileno(), select.KQ_FILTER_WRITE)])) client.send(b"Hello!") server.send(b"world!!!") @@ -145,14 +139,12 @@ else: self.fail('timeout waiting for event notifications') - events = [(e.ident, e.filter, e.flags) for e in events] - events.sort() - - self.assertEqual(events, [ - (client.fileno(), select.KQ_FILTER_WRITE, flags), - (client.fileno(), select.KQ_FILTER_READ, flags), - (server.fileno(), select.KQ_FILTER_WRITE, flags), - (server.fileno(), select.KQ_FILTER_READ, flags)]) + events = set((e.ident, e.filter) for e in events) + self.assertEqual(events, set([ + (client.fileno(), select.KQ_FILTER_WRITE), + (client.fileno(), select.KQ_FILTER_READ), + (server.fileno(), select.KQ_FILTER_WRITE), + (server.fileno(), select.KQ_FILTER_READ)])) # Remove completely client, and server read part ev = select.kevent(client.fileno(), @@ -169,10 +161,9 @@ kq.control([ev], 0, 0) events = kq.control([], 4, 0.99) - events = [(e.ident, e.filter, e.flags) for e in events] - events.sort() - self.assertEqual(events, [ - (server.fileno(), select.KQ_FILTER_WRITE, flags)]) + events = set((e.ident, e.filter) for e in events) + self.assertEqual(events, set([ + (server.fileno(), select.KQ_FILTER_WRITE)])) client.close() server.close() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 31 22:52:44 2013 From: python-checkins at python.org (antoine.pitrou) Date: Sun, 31 Mar 2013 22:52:44 +0200 (CEST) Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317591=3A_Use_lowe?= =?utf-8?q?rcase_filenames_when_including_Windows_header_files=2E?= Message-ID: <3Zf85S38K8zNpQ@mail.python.org> http://hg.python.org/cpython/rev/58fcd81acfb1 changeset: 83043:58fcd81acfb1 user: Antoine Pitrou date: Sun Mar 31 22:48:04 2013 +0200 summary: Issue #17591: Use lowercase filenames when including Windows header files. Patch by Roumen Petrov. files: Misc/ACKS | 1 + Misc/NEWS | 3 +++ Modules/signalmodule.c | 2 +- Objects/exceptions.c | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -943,6 +943,7 @@ Benjamin Peterson Joe Peterson Chris Petrilli +Roumen Petrov Bjorn Pettersen Justin D. Pettit Ronny Pfannschmidt diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1163,6 +1163,9 @@ Build ----- +- Issue #17591: Use lowercase filenames when including Windows header files. + Patch by Roumen Petrov. + - Issue #17550: Fix the --enable-profiling configure switch. - Issue #17425: Build with openssl 1.0.1d on Windows. diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -9,7 +9,7 @@ #endif #ifdef MS_WINDOWS -#include +#include #ifdef HAVE_PROCESS_H #include #endif diff --git a/Objects/exceptions.c b/Objects/exceptions.c --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -2327,7 +2327,7 @@ } #ifdef MS_WINDOWS -#include +#include /* The following constants were added to errno.h in VS2010 but have preferred WSA equivalents. */ #undef EADDRINUSE -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 31 23:13:21 2013 From: python-checkins at python.org (roger.serwy) Date: Sun, 31 Mar 2013 23:13:21 +0200 (CEST) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzg5MDA6IFVzaW5n?= =?utf-8?q?_keyboard_shortcuts_in_IDLE_to_open_a_file_no_longer_raises_an?= Message-ID: <3Zf8YF3PqKzPDH@mail.python.org> http://hg.python.org/cpython/rev/37352a3ccd54 changeset: 83044:37352a3ccd54 branch: 2.7 parent: 83040:cfd4cd15809e user: Roger Serwy date: Sun Mar 31 15:53:08 2013 -0500 summary: #8900: Using keyboard shortcuts in IDLE to open a file no longer raises an exception. files: Lib/idlelib/MultiCall.py | 5 +++-- Misc/NEWS | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/MultiCall.py b/Lib/idlelib/MultiCall.py --- a/Lib/idlelib/MultiCall.py +++ b/Lib/idlelib/MultiCall.py @@ -171,8 +171,9 @@ break ishandlerrunning[:] = [] # Call all functions in doafterhandler and remove them from list - while doafterhandler: - doafterhandler.pop()() + for f in doafterhandler: + f() + doafterhandler[:] = [] if r: return r return handler diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,9 @@ Library ------- +- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer + raises an exception. + - Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. - Issue #17526: fix an IndexError raised while passing code without filename to -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 31 23:13:22 2013 From: python-checkins at python.org (roger.serwy) Date: Sun, 31 Mar 2013 23:13:22 +0200 (CEST) Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy4zKTogIzg5MDA6IFVzaW5n?= =?utf-8?q?_keyboard_shortcuts_in_IDLE_to_open_a_file_no_longer_raises_an?= Message-ID: <3Zf8YG65zNzPjq@mail.python.org> http://hg.python.org/cpython/rev/61092bbd1464 changeset: 83045:61092bbd1464 branch: 3.3 parent: 83041:96776fc3cbcc user: Roger Serwy date: Sun Mar 31 15:53:08 2013 -0500 summary: #8900: Using keyboard shortcuts in IDLE to open a file no longer raises an exception. files: Lib/idlelib/MultiCall.py | 5 +++-- Misc/NEWS | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/MultiCall.py b/Lib/idlelib/MultiCall.py --- a/Lib/idlelib/MultiCall.py +++ b/Lib/idlelib/MultiCall.py @@ -170,8 +170,9 @@ break ishandlerrunning[:] = [] # Call all functions in doafterhandler and remove them from list - while doafterhandler: - doafterhandler.pop()() + for f in doafterhandler: + f() + doafterhandler[:] = [] if r: return r return handler diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -15,6 +15,9 @@ Library ------- +- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer + raises an exception. + - Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. - Issue #17435: threading.Timer's __init__ method no longer uses mutable -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 31 23:13:24 2013 From: python-checkins at python.org (roger.serwy) Date: Sun, 31 Mar 2013 23:13:24 +0200 (CEST) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E3_-=3E_default?= =?utf-8?b?KTogIzg5MDA6IG1lcmdlIHdpdGggMy4zLg==?= Message-ID: <3Zf8YJ1qNNzPK0@mail.python.org> http://hg.python.org/cpython/rev/6ad256175971 changeset: 83046:6ad256175971 parent: 83042:0c9415ddf403 parent: 83045:61092bbd1464 user: Roger Serwy date: Sun Mar 31 15:56:02 2013 -0500 summary: #8900: merge with 3.3. files: Lib/idlelib/MultiCall.py | 5 +++-- Misc/NEWS | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/MultiCall.py b/Lib/idlelib/MultiCall.py --- a/Lib/idlelib/MultiCall.py +++ b/Lib/idlelib/MultiCall.py @@ -170,8 +170,9 @@ break ishandlerrunning[:] = [] # Call all functions in doafterhandler and remove them from list - while doafterhandler: - doafterhandler.pop()() + for f in doafterhandler: + f() + doafterhandler[:] = [] if r: return r return handler diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -297,6 +297,9 @@ Library ------- +- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer + raises an exception. + - Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. - Issue #17435: threading.Timer's __init__ method no longer uses mutable -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Mar 31 23:13:25 2013 From: python-checkins at python.org (roger.serwy) Date: Sun, 31 Mar 2013 23:13:25 +0200 (CEST) Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgaGVhZHMu?= Message-ID: <3Zf8YK4TzkzPYm@mail.python.org> http://hg.python.org/cpython/rev/7a3cafe49592 changeset: 83047:7a3cafe49592 parent: 83043:58fcd81acfb1 parent: 83046:6ad256175971 user: Roger Serwy date: Sun Mar 31 16:11:51 2013 -0500 summary: Merge heads. files: Lib/idlelib/MultiCall.py | 5 +++-- Misc/NEWS | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/MultiCall.py b/Lib/idlelib/MultiCall.py --- a/Lib/idlelib/MultiCall.py +++ b/Lib/idlelib/MultiCall.py @@ -170,8 +170,9 @@ break ishandlerrunning[:] = [] # Call all functions in doafterhandler and remove them from list - while doafterhandler: - doafterhandler.pop()() + for f in doafterhandler: + f() + doafterhandler[:] = [] if r: return r return handler diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -297,6 +297,9 @@ Library ------- +- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer + raises an exception. + - Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. - Issue #17435: threading.Timer's __init__ method no longer uses mutable -- Repository URL: http://hg.python.org/cpython From brett at yvrsfo.ca Sun Mar 31 23:19:38 2013 From: brett at yvrsfo.ca (Brett Cannon) Date: Sun, 31 Mar 2013 21:19:38 -0000 Subject: [Python-checkins] cpython (2.7): Add an itertools recipe showing how to use t.__copy__(). In-Reply-To: <3Zdn7J53MYzPt5@mail.python.org> References: <3Zdn7J53MYzPt5@mail.python.org> Message-ID: "Upcomping" -> "upcoming" On Mar 31, 2013 2:38 AM, "raymond.hettinger" wrote: > http://hg.python.org/cpython/rev/1026b1d47f30 > changeset: 83037:1026b1d47f30 > branch: 2.7 > parent: 83034:e044d22d2f61 > user: Raymond Hettinger > date: Sat Mar 30 23:37:57 2013 -0700 > summary: > Add an itertools recipe showing how to use t.__copy__(). > > files: > Doc/library/itertools.rst | 12 ++++++++++++ > 1 files changed, 12 insertions(+), 0 deletions(-) > > > diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst > --- a/Doc/library/itertools.rst > +++ b/Doc/library/itertools.rst > @@ -828,6 +828,18 @@ > indices = sorted(random.randrange(n) for i in xrange(r)) > return tuple(pool[i] for i in indices) > > + def tee_lookahead(t, i): > + """Inspect the i-th upcomping value from a tee object > + while leaving the tee object at its current position. > + > + Raise an IndexError if the underlying iterator doesn't > + have enough values. > + > + """ > + for value in islice(t.__copy__(), i, None): > + return value > + raise IndexError(i) > + > Note, many of the above recipes can be optimized by replacing global > lookups > with local variables defined as default values. For example, the > *dotproduct* recipe can be written as:: > > -- > Repository URL: http://hg.python.org/cpython > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > > -------------- next part -------------- An HTML attachment was scrubbed... URL: